lean4-htt/tests/elab/6789.lean
Garmelon 08eb78a5b2
chore: switch to new test/bench suite (#12590)
This PR sets up the new integrated test/bench suite. It then migrates
all benchmarks and some related tests to the new suite. There's also
some documentation and some linting.

For now, a lot of the old tests are left alone so this PR doesn't become
even larger than it already is. Eventually, all tests should be migrated
to the new suite though so there isn't a confusing mix of two systems.
2026-02-25 13:51:53 +00:00

62 lines
2.5 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/-!
# Ensure equational theorems generation doesn't fail when metadata is involved
https://github.com/leanprover/lean4/issues/6789
The original error would happen because `casesOnStuckLHS` (https://github.com/leanprover/lean4/blob/4ca98dcca2b0995dddff444cfef1f3ccc89c7b12/src/Lean/Meta/Match/MatchEqs.lean#L51)
would fail to find an fvar to do `cases` on when that fvar would be encapsulated by some metadata.
-/
inductive Con
| nil
| ext (Γ : Con) (n : Nat)
variable {Op : Con → Con → Type u}
inductive Extension : Con → Con → Type
| zero : Extension Γ Γ
| succ : Extension Γ Δ → (n : Nat) → Extension Γ (.ext Δ n)
def Extension.recOn'
{motive : (Γ Δ : Con) → Extension Γ Δ → Sort v}
(zero : {Γ : Con} → motive Γ Γ .zero)
(succ
: {Γ Δ : Con} → (xt : Extension Γ Δ)
→ (A : Nat)
→ motive Γ Δ xt
→ motive Γ (.ext Δ A) (.succ xt A))
: {Γ Δ : Con} → (xt : Extension Γ Δ) → motive Γ Δ xt
| _, _, .zero => zero
| _, _, .succ xt A => succ xt A (Extension.recOn' zero succ xt)
/--
info: equations:
theorem Extension.recOn'.eq_1.{v} : ∀ {motive : (Γ Δ : Con) → Extension Γ Δ → Sort v}
(zero : {Γ : Con} → motive Γ Γ Extension.zero)
(succ : {Γ Δ : Con} → (xt : Extension Γ Δ) → (A : Nat) → motive Γ Δ xt → motive Γ (Δ.ext A) (xt.succ A)) (x : Con),
Extension.recOn' zero succ Extension.zero = zero
@[defeq] theorem Extension.recOn'.eq_2.{v} : ∀ {motive : (Γ Δ : Con) → Extension Γ Δ → Sort v}
(zero : {Γ : Con} → motive Γ Γ Extension.zero)
(succ : {Γ Δ : Con} → (xt : Extension Γ Δ) → (A : Nat) → motive Γ Δ xt → motive Γ (Δ.ext A) (xt.succ A)) (x Δ : Con)
(A : Nat) (xt : Extension x Δ),
Extension.recOn' zero succ (xt.succ A) = succ xt A (Extension.recOn' (fun {Γ} => zero) (fun {Γ Δ} => succ) xt)
-/
#guard_msgs in
#print equations Extension.recOn'
def Extension.pullback_con
: (xt : Extension B Δ) → (σ : Op B' B)
→ Con
| .zero, σ => B'
| .succ xt A, σ => .ext (pullback_con xt σ) A
/--
info: equations:
@[defeq] theorem Extension.pullback_con.eq_1.{u} : ∀ {Op : Con → Con → Type u} {B B' : Con} (x : Op B' B),
Extension.zero.pullback_con x = B'
@[defeq] theorem Extension.pullback_con.eq_2.{u} : ∀ {Op : Con → Con → Type u} {B B' : Con} (x : Op B' B) (Δ_2 : Con)
(xt : Extension B Δ_2) (A : Nat), (xt.succ A).pullback_con x = (xt.pullback_con x).ext A
-/
#guard_msgs in
#print equations Extension.pullback_con