Skip to content

Commit

Permalink
chore: remove unnecessary explicit indexing proofs (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
kim-em authored Dec 19, 2024
1 parent 43bcb19 commit a4a08d9
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Aesop/Builder/Forward.lean
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def getImmediatePremises (type : Expr) (pat? : Option RulePattern)
for h : i in [:args.size] do
if isPatternInstantiated i then
continue
let fvarId := (args[i]'h.2).fvarId!
let fvarId := args[i].fvarId!
let ldecl ← fvarId.getDecl
let isNondep : MetaM Bool :=
args.allM (start := i + 1) λ arg => do
Expand Down
6 changes: 3 additions & 3 deletions Aesop/RulePattern.lean
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def openRuleType (pat : RulePattern) (inst : RulePatternInstantiation)
let mut assigned := ∅
for h : i in [:mvars.size] do
if let some inst ← pat.getInstantiation inst i then
let mvarId := mvars[i]'h.2 |>.mvarId!
let mvarId := mvars[i] |>.mvarId!
-- We use `isDefEq` to make sure that universe metavariables occurring in
-- the type of `mvarId` are assigned.
if ← isDefEq (.mvar mvarId) inst then
Expand All @@ -163,7 +163,7 @@ def specializeRule (pat : RulePattern) (inst : RulePatternInstantiation)
if let some inst ← pat.getInstantiation inst i then
args := args.push $ some inst
else
let fvarId := fvarIds[i]'h.2
let fvarId := fvarIds[i]
args := args.push $ some fvarId
remainingFVarIds := remainingFVarIds.push fvarId
let result ← mkLambdaFVars remainingFVarIds (← mkAppOptM' rule args)
Expand Down Expand Up @@ -207,7 +207,7 @@ where
let e := s.lctx.mkLambda s.fvars e
let mut mvarIdToPos := ∅
for h : i in [:s.fvars.size] do
let name := s.lctx.get! (s.fvars[i]'h.2).fvarId! |>.userName
let name := s.lctx.get! (s.fvars[i]).fvarId! |>.userName
mvarIdToPos := mvarIdToPos.insert ⟨name⟩ i
let result :=
{ paramNames := s.paramNames, numMVars := s.fvars.size, expr := e }
Expand Down
2 changes: 1 addition & 1 deletion Aesop/RuleTac/Forward.lean
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ partial def makeForwardHyps (e : Expr) (pat? : Option RulePattern)
let mut instMVars := Array.mkEmpty argMVars.size
let mut immediateMVars := Array.mkEmpty argMVars.size
for h : i in [:argMVars.size] do
let mvarId := argMVars[i]'h.2 |>.mvarId!
let mvarId := argMVars[i].mvarId!
if patInstantiatedMVars.contains mvarId then
continue
if immediate.contains i then
Expand Down
2 changes: 1 addition & 1 deletion Aesop/Script/StructureDynamic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def DynStructureM.run (x : DynStructureM α) (script : UScript) :
MetaM (α × Bool) := do
let mut steps : PHashMap MVarId (Nat × Step) := {}
for h : i in [:script.size] do
let step := script[i]'h.2
let step := script[i]
steps := steps.insert step.preGoal (i, step)
let (a, s) ← ReaderT.run x { steps } |>.run {}
return (a, s.perfect)
Expand Down
2 changes: 1 addition & 1 deletion Aesop/Script/StructureStatic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected def StaticStructureM.run (script : UScript) (x : StaticStructureM α)
CoreM (α × Bool) := do
let mut steps : Std.HashMap MVarId (Nat × Step) := Std.HashMap.empty script.size
for h : i in [:script.size] do
let step := script[i]'h.2
let step := script[i]
if h : step.postGoals.size = 1 then
if step.postGoals[0].goal == step.preGoal then
continue
Expand Down
2 changes: 1 addition & 1 deletion Aesop/Script/Util.lean
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def findFirstStep? {α β : Type} (goals : Array α) (step? : α → Option β)
(stepOrder : β → Nat) : Option (Nat × α × β) := Id.run do
let mut firstStep? := none
for h : pos in [:goals.size] do
let g := goals[pos]'h.2
let g := goals[pos]
if let some step := step? g then
if let some (_, _, currentFirstStep) := firstStep? then
if stepOrder step < stepOrder currentFirstStep then
Expand Down
2 changes: 1 addition & 1 deletion Aesop/Search/Expansion.lean
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def addRapps (parentRef : GoalRef) (rule : RegularRule)
let mut rrefs := Array.mkEmpty rapps.size
let mut subgoals := Array.mkEmpty $ rapps.size * 3
for h : i in [:rapps.size] do
let rapp := rapps[i]'h.2
let rapp := rapps[i]
let successProbability :=
parent.successProbability *
(rapp.successProbability?.getD rule.successProbability)
Expand Down

0 comments on commit a4a08d9

Please sign in to comment.