Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
kim-em committed Nov 13, 2024
1 parent 4092e80 commit 0fa8cd2
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Aesop/RuleTac/ElabRuleTerm.lean
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def elabRuleTermForSimpCore (goal : MVarId) (term : Term) (ctx : Simp.Context)
elabSimpTheorems (mkSimpArgs term) ctx simprocs isSimpAll

def checkElabRuleTermForSimp (term : Term) (isSimpAll : Bool) : ElabM Unit := do
let ctx := { simpTheorems := #[{}] }
let ctx ← Simp.mkContext (simpTheorems := #[{}] )
let simprocs := #[{}]
discard $ elabRuleTermForSimpCore (← read).goal term ctx simprocs isSimpAll

Expand Down
6 changes: 3 additions & 3 deletions Aesop/Search/Expansion/Simp.lean
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def addLetDeclsToSimpTheorems (ctx : Simp.Context) : MetaM Simp.Context := do
if ldecl.hasValue && ! ldecl.isImplementationDetail then
simpTheoremsArray := simpTheoremsArray.modify 0 λ simpTheorems =>
simpTheorems.addLetDeclToUnfold ldecl.fvarId
return { ctx with simpTheorems := simpTheoremsArray }
return ctx.setSimpTheorems simpTheoremsArray

def addLetDeclsToSimpTheoremsUnlessZetaDelta (ctx : Simp.Context) :
MetaM Simp.Context := do
Expand All @@ -58,7 +58,7 @@ def simpGoal (mvarId : MVarId) (ctx : Simp.Context)
(simplifyTarget : Bool := true) (fvarIdsToSimp : Array FVarId := #[])
(stats : Simp.Stats := {}) : MetaM SimpResult := do
let mvarIdOld := mvarId
let ctx := { ctx with config.failIfUnchanged := false }
let ctx := ctx.setFailIfUnchanged false
let (result, { usedTheorems := usedSimps, .. }) ←
Meta.simpGoal mvarId ctx simprocs discharge? simplifyTarget fvarIdsToSimp
stats
Expand Down Expand Up @@ -89,7 +89,7 @@ def simpAll (mvarId : MVarId) (ctx : Simp.Context)
(simprocs : Simp.SimprocsArray) (stats : Simp.Stats := {}) :
MetaM SimpResult :=
mvarId.withContext do
let ctx := { ctx with config.failIfUnchanged := false }
let ctx := ctx.setFailIfUnchanged false
let ctx ← addLetDeclsToSimpTheoremsUnlessZetaDelta ctx
match ← Lean.Meta.simpAll mvarId ctx simprocs stats with
| (none, stats) => return .solved stats.usedTheorems
Expand Down
9 changes: 4 additions & 5 deletions Aesop/Search/SearchM.lean
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ open Lean.Meta

namespace Aesop

structure NormSimpContext extends Simp.Context where
structure NormSimpContext where
toContext : Simp.Context
enabled : Bool
useHyps : Bool
configStx? : Option Term
Expand Down Expand Up @@ -83,10 +84,8 @@ protected def run (ruleSet : LocalRuleSet) (options : Aesop.Options')
MetaM (α × State Q × Tree × Stats) := do
let t ← mkInitialTree goal
let normSimpContext := {
config := simpConfig
maxDischargeDepth := UInt32.ofNatTruncate simpConfig.maxDischargeDepth
simpTheorems := ruleSet.simpTheoremsArray.map (·.snd)
congrTheorems := ← getSimpCongrTheorems
toContext := ← Simp.mkContext simpConfig (simpTheorems := ruleSet.simpTheoremsArray.map (·.snd))
(congrTheorems := ← getSimpCongrTheorems)
simprocs := ruleSet.simprocsArray.map (·.snd)
configStx? := simpConfigStx?
enabled := options.enableSimp
Expand Down
7 changes: 1 addition & 6 deletions Aesop/Util/Tactic/Unfold.lean
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ namespace Aesop
-- Lean.Meta.unfoldLocalDecl.

def mkUnfoldSimpContext : MetaM Simp.Context := do
return {
simpTheorems := #[]
congrTheorems := ← getSimpCongrTheorems
config := Simp.neutralConfig
dischargeDepth := 0
}
Simp.mkContext Simp.neutralConfig (simpTheorems := #[]) (congrTheorems := ← getSimpCongrTheorems)

@[inline]
def unfoldManyCore (ctx : Simp.Context) (unfold? : Name → Option (Option Name))
Expand Down
4 changes: 2 additions & 2 deletions lake-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"type": "git",
"subDir": null,
"scope": "",
"rev": "9ba2e12ce6570b7fed7ad4d3675e5f6632949f2b",
"rev": "660dd9dcf375c9ec3820dbf682117f3978c497b4",
"name": "batteries",
"manifestFile": "lake-manifest.json",
"inputRev": "nightly-testing",
"inputRev": "lean-pr-testing-6054",
"inherited": false,
"configFile": "lakefile.toml"}],
"name": "aesop",
Expand Down
2 changes: 1 addition & 1 deletion lakefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ precompileModules = false # We would like to turn this on, but it breaks the Mat
[[require]]
name = "batteries"
git = "https://github.com/leanprover-community/batteries"
rev = "nightly-testing"
rev = "lean-pr-testing-6054"

[[lean_lib]]
name = "Aesop"
Expand Down
2 changes: 1 addition & 1 deletion lean-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
leanprover/lean4:nightly-2024-11-12
leanprover/lean4-pr-releases:pr-release-6054

0 comments on commit 0fa8cd2

Please sign in to comment.