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:
Leonardo de Moura 2024-02-18 13:31:15 -08:00 committed by Leonardo de Moura
parent 55ce5d570c
commit cd9648a61e
2 changed files with 10 additions and 0 deletions

View file

@ -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'}"

View 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