lean4-htt/tests/lean/run/cceScoping.lean
Cameron Zwarich 8d0093b43f
fix: properly handle scoping of join point candidates in cce (#7398)
This PR fixes a scoping error in the cce (Common Case Elimination) pass
of the old code generator. This pass would create a join point for
common minor premises even if some of those premises were in the bodies
of locally defined functions, which results in an improperly scoped
reference to a join point. The fix is to save/restore candidates when
visiting a lambda.
2025-03-08 18:10:41 +00:00

20 lines
381 B
Text

def f1 (n : Nat) := n + 1
def g1 : Bool :=
let N := fun t => f1 2 + if t % f1 2 = 0 then 1 else 0
¬N 0 = f1 2 + if 0 % f1 2 = 0 then 1 else 0
def f2 (n : Nat) := (n + 0) + 1
def g2 : Bool :=
¬ (fun _ => f2 2 + if 0 % f2 2 = 0 then 1 else 0) 0 = f2 2 + if 0 % f2 2 = 0 then 1 else 0
/--
info: false
-/
#guard_msgs in
#reduce g2
/--
info: false
-/
#guard_msgs in
#eval g2