-
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 support for activating relevant `match`-equations as E-matching theorems. It uses the `match`-equation lhs as the pattern.
- Loading branch information
1 parent
28a7098
commit ad593b3
Showing
11 changed files
with
224 additions
and
28 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,35 @@ | ||
/- | ||
Copyright (c) 2025 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.Util | ||
import Init.Simproc | ||
import Lean.Meta.Tactic.Simp.Simproc | ||
|
||
namespace Lean.Meta.Grind | ||
|
||
/-- | ||
Returns `Grind.doNotSimp e`. | ||
Recall that `Grind.doNotSimp` is an identity function, but the following simproc is used to prevent the term `e` from being simplified. | ||
-/ | ||
def markAsDoNotSimp (e : Expr) : MetaM Expr := | ||
mkAppM ``Grind.doNotSimp #[e] | ||
|
||
builtin_dsimproc_decl reduceDoNotSimp (Grind.doNotSimp _) := fun e => do | ||
let_expr Grind.doNotSimp _ _ ← e | return .continue | ||
return .done e | ||
|
||
/-- Adds `reduceDoNotSimp` to `s` -/ | ||
def addDoNotSimp (s : Simprocs) : CoreM Simprocs := do | ||
s.add ``reduceDoNotSimp (post := false) | ||
|
||
/-- Erases `Grind.doNotSimp` annotations. -/ | ||
def eraseDoNotSimp (e : Expr) : CoreM Expr := do | ||
let pre (e : Expr) := do | ||
let_expr Grind.doNotSimp _ a := e | return .continue e | ||
return .continue a | ||
Core.transform e (pre := pre) | ||
|
||
end Lean.Meta.Grind |
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
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
Oops, something went wrong.