-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR adds the (WIP) `grind` tactic. It currently generates a warning message to make it clear that the tactic is not ready for production.
- Loading branch information
1 parent
e76dc20
commit 6a83979
Showing
9 changed files
with
117 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/- | ||
Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
Released under Apache 2.0 license as described in the file LICENSE. | ||
Authors: Leonardo de Moura | ||
-/ | ||
prelude | ||
import Init.Grind.Tactics | ||
import Lean.Meta.Tactic.Grind | ||
import Lean.Elab.Tactic.Basic | ||
|
||
namespace Lean.Elab.Tactic | ||
open Meta | ||
|
||
def grind (mvarId : MVarId) (mainDeclName : Name) : MetaM Unit := do | ||
let mvarIds ← Grind.main mvarId mainDeclName | ||
unless mvarIds.isEmpty do | ||
throwError "`grind` failed\n{goalsToMessageData mvarIds}" | ||
|
||
@[builtin_tactic Lean.Parser.Tactic.grind] def evalApplyRfl : Tactic := fun stx => do | ||
match stx with | ||
| `(tactic| grind) => | ||
logWarningAt stx "The `grind` tactic is experimental and still under development. Avoid using it in production projects" | ||
let declName := (← Term.getDeclName?).getD `_grind | ||
withMainContext do liftMetaFinishingTactic (grind · declName) | ||
| _ => throwUnsupportedSyntax | ||
|
||
end Lean.Elab.Tactic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters