lean4-htt/tests/lean/run/issue10353.lean
Joachim Breitner 7f18c734eb
fix: simpHaveTelescope: calculate used fvars transitiviely (#10536)
This PR fixes `simp` in `-zeta -zetaUnused` mode from producing
incorrect proofs if in a `have` telescope a variable occurrs in the
type of the body only transitively. Fixes #10353.
2025-09-24 11:30:09 +00:00

42 lines
880 B
Text

import Lean
structure IW : Type 1 where
I : Type
set_option Elab.async false
def aux (iw: IW) (e : Nat) (sm : List iw.I)
: Nat :=
e
-- set_option wf.preprocess false
-- set_option trace.Elab.definition.wf true
-- set_option pp.raw true
-- set_option trace.Debug.Meta.Tactic.simp true
mutual
def aval (iw: IW) (n : Nat) (e : Nat) : Nat :=
match n with
| 0 => e
| n' + 1 =>
let e1 :=
let input_map : List iw.I := [] --lifting RB
let new_e := aux iw e input_map -- removing args RB
avalCore iw n' new_e -- inlining RB
avalCore iw n' e
termination_by (n, 0)
-- Inlining RB
def avalCore (iw: IW) (n' : Nat) (e : Nat) : Nat :=
aval iw n' e
termination_by (n', 1)
end
example :
(have x : Nat := id 1
have y : Nat := id x + 1
(fun (x : Fin y) => x)) = (fun x => x) := by
simp -zetaUnused -zetaDelta -zeta only [id]
rfl