fix: dsimp zeta bug
Before the `zeta` / `zetaDelta` split, `dsimp` was performing `zeta` by going inside of a `let`-expression, performing `zetaDelta`, and then removing the unused `let`-expression.
This commit is contained in:
parent
55ce5d570c
commit
cd9648a61e
2 changed files with 10 additions and 0 deletions
|
|
@ -166,6 +166,8 @@ private def reduceStep (e : Expr) : SimpM Expr := do
|
|||
if cfg.zeta then
|
||||
if let some (args, _, _, v, b) := e.letFunAppArgs? then
|
||||
return mkAppN (b.instantiate1 v) args
|
||||
if e.isLet then
|
||||
return e.letBody!.instantiate1 e.letValue!
|
||||
match (← unfold? e) with
|
||||
| some e' =>
|
||||
trace[Meta.Tactic.simp.rewrite] "unfold {mkConst e.getAppFn.constName!}, {e} ==> {e'}"
|
||||
|
|
|
|||
8
tests/lean/run/zetaDSimpIssue.lean
Normal file
8
tests/lean/run/zetaDSimpIssue.lean
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
def f (x : Nat) :=
|
||||
let n := x + 1
|
||||
n + n
|
||||
|
||||
example : f x = 2*x + 2 := by
|
||||
dsimp [f]
|
||||
guard_target =ₛ x + 1 + (x + 1) = 2*x + 2
|
||||
simp_arith
|
||||
Loading…
Add table
Reference in a new issue