Files
lean4/tests/elab/issue11450.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

71 lines
2.4 KiB
Lean4
Raw Permalink 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.
/-! Regressions from working on #11450 -/
namespace Test
inductive Sum (α : Type u) (β : Type v) where
| inl (val : α) : Sum α β
| inr (val : β) : Sum α β
end Test
inductive Term (L: Nat Type) (n : Nat) : Nat Type _
| var (k: Fin n) : Term L n 0
| func (f: L l) : Term L n l
| app (t: Term L n (l + 1)) (s: Term L n 0): Term L n l
/--
info: @[reducible] def Term.var.noConfusion.{u} : {L : Nat → Type} →
{n : Nat} → {P : Sort u} → {k k' : Fin n} → Term.var k = Term.var k' → (k ≍ k' → P) → P
-/
#guard_msgs in
#print sig Term.var.noConfusion
def Vector' (α : Type u) (n : Nat) :=
{ l : List α // l.length = n }
inductive HVect : (n : Nat) -> (Vector' (Type v) n) -> Type (v+1) where
| Nil : HVect 0 [], simp
| Cons : (t : Type v) -> (x : t) -> HVect n ts, p -> HVect (n+1) t::ts, by simp [p]
/--
info: @[reducible] def HVect.Nil.noConfusion.{u, v} : {P : Sort u} →
{simp simp' : [].length = 0} → HVect.Nil = HVect.Nil → P → P
-/
#guard_msgs in
#print sig HVect.Nil.noConfusion
inductive Vec (α : Type u) : Nat Type u where
| nil : Vec α 0
| cons : {n : Nat} (x : α) (xs : Vec α n) Vec α (n + 1)
/--
info: Vec.cons.noConfusion.{u_1, u} {α : Type u} {P : Sort u_1} {n : Nat} {x : α} {xs : Vec α n} {n' : Nat} {x' : α}
{xs' : Vec α n'} (eq_1 : n + 1 = n' + 1) (eq_2 : Vec.cons x xs ≍ Vec.cons x' xs')
(k : n = n' → x ≍ x' → xs ≍ xs' → P) : P
-/
#guard_msgs in
#check Vec.cons.noConfusion
/--
info: Vec.cons.inj.{u} {α : Type u} {n : Nat} {x : α} {xs : Vec α n} {x✝ : α} {xs✝ : Vec α n} :
Vec.cons x xs = Vec.cons x✝ xs✝ → x = x✝ ∧ xs = xs✝
-/
#guard_msgs in
#check Vec.cons.inj
theorem Vec.cons.hinj' {α : Type u}
{x : α} {n : Nat} {xs : Vec α n} {x' : α} {n' : Nat} {xs' : Vec α n'} :
Vec.cons x xs Vec.cons x' xs' (n + 1 = n' + 1 (x = x' xs xs')) := by
intro h eq_1
apply Vec.cons.noConfusion eq_1 h (fun _ eq_x eq_xs => eq_of_heq eq_x, eq_xs)
/--
info: Vec.cons.hinj.{u} {α : Type u} {n : Nat} {x : α} {xs : Vec α n} {α✝ : Type u} {n✝ : Nat} {x✝ : α✝} {xs✝ : Vec α✝ n✝} :
α = α✝ → n + 1 = n✝ + 1 → Vec.cons x xs ≍ Vec.cons x✝ xs✝ → α = α✝ ∧ n = n✝ ∧ x ≍ x✝ ∧ xs ≍ xs✝
-/
#guard_msgs in
#check Vec.cons.hinj