Skip to content

Commit

Permalink
fix: adaptations for nightly-2024-01-24 (leanprover/lean4#3060) (#9943)
Browse files Browse the repository at this point in the history
leanprover/lean4#3060 exposed the latent leanprover-community/quote4#30 (by propagating it from `if let` and `match` to `let`). The workaround is thankfully trivial.
  • Loading branch information
eric-wieser committed Jan 25, 2024
1 parent 4f800f7 commit a8d7ec5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions Mathlib/Tactic/TFAE.lean
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ partial def proveChain (i : ℕ) (is : List ℕ) (P : Q(Prop)) (l : Q(List Prop)
match l with
| ~q([]) => return q(Chain.nil)
| ~q($P' :: $l') =>
let i' :: is' := is | unreachable!
-- `id` is a workaround for https://github.com/leanprover-community/quote4/issues/30
let i' :: is' := id is | unreachable!
have cl' : Q(Chain (· → ·) $P' $l') := ← proveChain i' is' q($P') q($l')
let p ← proveImpl hyps atoms i i' P P'
return q(Chain.cons $p $cl')
Expand All @@ -139,7 +140,8 @@ partial def proveGetLastDImpl (i i' : ℕ) (is : List ℕ) (P P' : Q(Prop)) (l :
match l with
| ~q([]) => proveImpl hyps atoms i' i P' P
| ~q($P'' :: $l') =>
let i'' :: is' := is | unreachable!
-- `id` is a workaround for https://github.com/leanprover-community/quote4/issues/30
let i'' :: is' := id is | unreachable!
proveGetLastDImpl i i'' is' P P'' l'

/-- Attempt to prove a statement of the form `TFAE [P₁, P₂, ...]`. -/
Expand All @@ -148,7 +150,8 @@ def proveTFAE (is : List ℕ) (l : Q(List Prop)) : MetaM Q(TFAE $l) := do
| ~q([]) => return q(tfae_nil)
| ~q([$P]) => return q(tfae_singleton $P)
| ~q($P :: $P' :: $l') =>
let i :: i' :: is' := is | unreachable!
-- `id` is a workaround for https://github.com/leanprover-community/quote4/issues/30
let i :: i' :: is' := id is | unreachable!
let c ← proveChain hyps atoms i (i'::is') P q($P' :: $l')
let il ← proveGetLastDImpl hyps atoms i i' is' P P' l'
return q(tfae_of_cycle $c $il)
Expand Down
2 changes: 1 addition & 1 deletion lean-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
leanprover/lean4:nightly-2024-01-23
leanprover/lean4:nightly-2024-01-24

0 comments on commit a8d7ec5

Please sign in to comment.