-
Notifications
You must be signed in to change notification settings - Fork 451
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: fix canonicalizer handling over forall/lambda (#6082)
This PR changes how the canonicalizer handles `forall` and `lambda`, replacing bvars with temporary fvars. Fixes a bug reported by @hrmacbeth on [zulip](https://leanprover.zulipchat.com/#narrow/channel/270676-lean4/topic/Quantifiers.20in.20CanonM/near/482483448).
- Loading branch information
Showing
2 changed files
with
39 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import Lean.Meta.Canonicalizer | ||
import Lean.Elab.Tactic | ||
|
||
elab "foo" t:term : tactic => do | ||
let e ← Lean.Elab.Tactic.elabTerm t none | ||
trace[debug] "canonicalizing {e}" | ||
let e' ← (Lean.Meta.canon e).run' | ||
trace[debug] "canonicalized it to {e'}" | ||
|
||
/-- info: ∃ f, ∀ (x : Nat), f x = 0 : Prop -/ | ||
#guard_msgs in | ||
#check (∃ f : Nat → Nat, ∀ x, f x = 0) -- works fine | ||
|
||
/-- | ||
info: [debug] canonicalizing ∃ f, ∀ (x : Nat), f x = 0 | ||
[debug] canonicalized it to ∃ f, ∀ (x : Nat), f x = 0 | ||
-/ | ||
#guard_msgs in | ||
set_option trace.debug true in | ||
example : True := by | ||
foo (∃ f : Nat → Nat, ∀ x, f x = 0) -- used to fail with "unexpected bound variable #1" | ||
trivial |