File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed
Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -56,15 +56,13 @@ It assumes `beginIdx ≤ endIdx` and `endIdx ≤ subst.size`
5656def instantiateRangeS' (e : Expr) (beginIdx endIdx : Nat) (subst : Array Expr) : AlphaShareBuilderM Expr :=
5757 if _ : beginIdx > endIdx then unreachable! else
5858 if _ : endIdx > subst.size then unreachable! else
59- let s := beginIdx
6059 let n := endIdx - beginIdx
6160 replaceS' e fun e offset => do
62- let s₁ := s + offset
6361 match e with
6462 | .bvar idx =>
65- if _h : idx >= s₁ then
66- if _h : idx < s₁ + n then
67- let v := subst[idx - s₁ ]
63+ if _h : idx >= offset then
64+ if _h : idx < offset + n then
65+ let v := subst[beginIdx + idx - offset ]
6866 liftLooseBVarsS' v 0 offset
6967 else
7068 mkBVarS (idx - n)
@@ -73,7 +71,7 @@ def instantiateRangeS' (e : Expr) (beginIdx endIdx : Nat) (subst : Array Expr) :
7371 | .lit _ | .mvar _ | .fvar _ | .const _ _ | .sort _ =>
7472 return some e
7573 | _ =>
76- if s₁ >= e.looseBVarRange then
74+ if offset >= e.looseBVarRange then
7775 return some e
7876 else
7977 return none
Original file line number Diff line number Diff line change 1+ import Lean
2+
3+ /-- info: (a + 1).add a -/
4+ #guard_msgs in
5+ open Lean Meta Sym in
6+ run_meta SymM.run do
7+ let s₁ ← share <| mkLambda `x .default Nat.mkType (mkApp (mkConst ``Nat.add) (mkNatAdd (mkBVar 0 ) (mkNatLit 1 )))
8+ let s₂ ← share <| mkConst `a
9+ let e ← share <| mkApp2 (mkBVar 1 ) (mkBVar 0 ) (mkBVar 0 )
10+ logInfo <| (← instantiateRevBetaS e #[s₁, s₂])
You can’t perform that action at this time.
0 commit comments