Skip to content

Commit 83f4403

Browse files
committed
Update tests
1 parent 46ca51f commit 83f4403

File tree

8 files changed

+39
-33
lines changed

8 files changed

+39
-33
lines changed

tests/lean/run/6123_mod_cast.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ theorem coe_le_coe : (a : WithBot α) ≤ b ↔ a ≤ b := by
142142
simp [LE.le]
143143

144144
instance orderBot : OrderBot (WithBot α) where
145-
bot_le _ := fun _ h => Option.noConfusion h
145+
bot_le _ := fun _ h => Option.noConfusion rfl (heq_of_eq h)
146146

147147
theorem le_coe_iff : ∀ {x : WithBot α}, x ≤ b ↔ ∀ a : α, x = ↑a → a ≤ b
148148
| (b : α) => by simp

tests/lean/run/concatElim.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ theorem concatEq (xs : List α) (h : xs ≠ []) : concat (dropLast xs) (last xs
2020
match xs, h with
2121
| [], h => contradiction
2222
| [x], h => rfl
23-
| x₁::x₂::xs, h => simp [concat, dropLast, last, concatEq (x₂::xs) List.noConfusion]
23+
| x₁::x₂::xs, h => simp [concat, dropLast, last, concatEq (x₂::xs)]
2424

2525
theorem lengthCons {α} (x : α) (xs : List α) : (x::xs).length = xs.length + 1 :=
2626
rfl
@@ -42,11 +42,11 @@ theorem dropLastLen {α} (xs : List α) : (n : Nat) → xs.length = n+1 → (dro
4242
intro n h
4343
cases n with
4444
| zero =>
45-
simp [lengthCons] at h
45+
simp at h
4646
| succ n =>
47-
have : (x₁ :: x₂ :: xs).length = xs.length + 2 := by simp [lengthCons]
47+
have : (x₁ :: x₂ :: xs).length = xs.length + 2 := by simp
4848
have : xs.length = n := by rw [this] at h; injection h with h; injection h
49-
simp [dropLast, lengthCons, dropLastLen (x₂::xs) xs.length (lengthCons ..), this]
49+
simp [dropLast, dropLastLen (x₂::xs) xs.length (lengthCons ..), this]
5050

5151
@[inline]
5252
def concatElim {α}

tests/lean/run/hinj_thm.lean

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,22 @@ inductive Foo' (α β : Type u) : (n : Nat) → P n -> Type u
88
| odd (b : β) (n : Nat) (v : T n) : Foo' α β (Nat.succ (double n)) (pax _)
99

1010
/--
11-
info: Foo'.even.hinj.{u} {α β : Type u} {a : α} {n : Nat} {v : T n} {h : P n} {a✝ : α} {n✝ : Nat} {v✝ : T n✝} {h✝ : P n✝} :
12-
double n = double n✝ → ⋯ ≍ ⋯ → Foo'.even a n v h ≍ Foo'.even a✝ n✝ v✝ h✝ → a = a✝ ∧ n = n✝ ∧ v ≍ v✝
11+
info: Foo'.even.hinj.{u} {α β : Type u} {a : α} {n : Nat} {v : T n} {h : P n} {α✝ β✝ : Type u} {a✝ : α✝} {n✝ : Nat}
12+
{v✝ : T n✝} {h✝ : P n✝} :
13+
α = α✝ →
14+
β = β✝ →
15+
double n = double n✝ →
16+
⋯ ≍ ⋯ → Foo'.even a n v h ≍ Foo'.even a✝ n✝ v✝ h✝ → α = α✝ ∧ β = β✝ ∧ a ≍ a✝ ∧ n = n✝ ∧ v ≍ v✝
1317
-/
1418
#guard_msgs in
1519
#check Foo'.even.hinj
1620

1721
/--
18-
info: Foo'.odd.hinj.{u} {α β : Type u} {b : β} {n : Nat} {v : T n} {b✝ : β} {n✝ : Nat} {v✝ : T n✝} :
19-
(double n).succ = (double n✝).succ → ⋯ ≍ ⋯ → Foo'.odd b n v ≍ Foo'.odd b✝ n✝ v✝ → b = b✝ ∧ n = n✝ ∧ v ≍ v✝
22+
info: Foo'.odd.hinj.{u} {α β : Type u} {b : β} {n : Nat} {v : T n} {α✝ β✝ : Type u} {b✝ : β✝} {n✝ : Nat} {v✝ : T n✝} :
23+
α = α✝ →
24+
β = β✝ →
25+
(double n).succ = (double n✝).succ →
26+
⋯ ≍ ⋯ → Foo'.odd b n v ≍ Foo'.odd b✝ n✝ v✝ → α = α✝ ∧ β = β✝ ∧ b ≍ b✝ ∧ n = n✝ ∧ v ≍ v✝
2027
-/
2128
#guard_msgs in
2229
#check Foo'.odd.hinj

tests/lean/run/issue11450.lean

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ inductive Term (L: Nat → Type) (n : Nat) : Nat → Type _
1717

1818
/--
1919
info: @[reducible] def Term.var.noConfusion.{u} : {L : Nat → Type} →
20-
{n : Nat} → {P : Sort u} → {k k' : Fin n} → Term.var k = Term.var k' → (k = k' → P) → P
20+
{n : Nat} → {P : Sort u} → {k k' : Fin n} → Term.var k = Term.var k' → (k k' → P) → P
2121
-/
2222
#guard_msgs in
2323
#print sig Term.var.noConfusion
@@ -44,7 +44,7 @@ inductive Vec (α : Type u) : Nat → Type u where
4444
/--
4545
info: Vec.cons.noConfusion.{u_1, u} {α : Type u} {P : Sort u_1} {n : Nat} {x : α} {xs : Vec α n} {n' : Nat} {x' : α}
4646
{xs' : Vec α n'} (eq_1 : n + 1 = n' + 1) (eq_2 : Vec.cons x xs ≍ Vec.cons x' xs')
47-
(k : n = n' → x = x' → xs ≍ xs' → P) : P
47+
(k : n = n' → x x' → xs ≍ xs' → P) : P
4848
-/
4949
#guard_msgs in
5050
#check Vec.cons.noConfusion
@@ -60,11 +60,11 @@ theorem Vec.cons.hinj' {α : Type u}
6060
{x : α} {n : Nat} {xs : Vec α n} {x' : α} {n' : Nat} {xs' : Vec α n'} :
6161
Vec.cons x xs ≍ Vec.cons x' xs' → (n + 1 = n' + 1 → (x = x' ∧ xs ≍ xs')) := by
6262
intro h eq_1
63-
apply Vec.cons.noConfusion eq_1 h (fun _ eq_x eq_xs => ⟨eq_x, eq_xs⟩)
63+
apply Vec.cons.noConfusion eq_1 h (fun _ eq_x eq_xs => ⟨eq_of_heq eq_x, eq_xs⟩)
6464

6565
/--
66-
info: Vec.cons.hinj.{u} {α : Type u} {n : Nat} {x : α} {xs : Vec α n} {n✝ : Nat} {x✝ : α} {xs✝ : Vec α n✝} :
67-
n + 1 = n✝ + 1 → Vec.cons x xs ≍ Vec.cons x✝ xs✝ → n = n✝ ∧ x = x✝ ∧ xs ≍ xs✝
66+
info: Vec.cons.hinj.{u} {α : Type u} {n : Nat} {x : α} {xs : Vec α n} {α✝ : Type u} {n✝ : Nat} {x✝ : α} {xs✝ : Vec α n✝} :
67+
α = α✝ → n + 1 = n✝ + 1 → Vec.cons x xs ≍ Vec.cons x✝ xs✝ → α = α✝ ∧ n = n✝ ∧ x x✝ ∧ xs ≍ xs✝
6868
-/
6969
#guard_msgs in
7070
#check Vec.cons.hinj

tests/lean/run/issue11560.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ example
99
(h2 : d.succ < b)
1010
(hab : a = b)
1111
(hcd : @Fin'.mk a c.succ h1 ≍ @Fin'.mk b d.succ h2) :
12-
c = d := Fin'.mk.noConfusion hab hcd (fun h => Nat.succ.noConfusion h fun h' => h')
12+
c = d := Fin'.noConfusion hab hcd (fun h => Nat.succ.noConfusion h fun h' => h')
1313

1414
example
1515
(a b c d : Nat)

tests/lean/run/linearNoConfusion.lean

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,31 @@ inductive Vec.{u} (α : Type) : Nat → Type u where
2020
| cons1 {n} : α → Vec α n → Vec α (n + 1)
2121
| cons2 {n} : α → Vec α n → Vec α (n + 1)
2222

23-
@[reducible] protected def Vec.noConfusionType'.{u_1, u} : {α : Type} →
24-
Sort u_1 → {a : Nat} → Vec.{u} α a → {a : Nat} → Vec α a → Sort u_1 :=
25-
fun P _ x1 _ x2 =>
23+
@[reducible] protected def Vec.noConfusionType'.{u_1, u} : Sort u_1 →
24+
{α : Type} → {a : Nat} → Vec.{u} α a →
25+
{α : Type} → {a : Nat} → Vec α a → Sort u_1 :=
26+
fun P _ _ x1 _ _ x2 =>
2627
Vec.casesOn x1
2728
(if h : x2.ctorIdx = 0 then
2829
Vec.nil.elim (motive := fun _ _ => Sort u_1) x2 h (P → P)
2930
else P)
3031
(fun {n} a_1 a_2 => if h : x2.ctorIdx = 1 then
31-
Vec.cons1.elim (motive := fun _ _ => Sort u_1) x2 h fun {n_1} a a_3 => (n = n_1 → a_1 = a → a_2 ≍ a_3 → P) → P
32+
Vec.cons1.elim (motive := fun _ _ => Sort u_1) x2 h fun {n_1} a a_3 => (n = n_1 → a_1 a → a_2 ≍ a_3 → P) → P
3233
else P)
3334
(fun {n} a_1 a_2 => if h : x2.ctorIdx = 2 then
34-
Vec.cons2.elim (motive := fun _ _ => Sort u_1) x2 h fun {n_1} a a_3 => (n = n_1 → a_1 = a → a_2 ≍ a_3 → P) → P
35+
Vec.cons2.elim (motive := fun _ _ => Sort u_1) x2 h fun {n_1} a a_3 => (n = n_1 → a_1 a → a_2 ≍ a_3 → P) → P
3536
else P)
3637

3738
/--
38-
info: @[reducible] protected def Vec.noConfusionType.{u_1, u} : {α : Type}
39-
Sort u_1 → {a : Nat} → Vec α a → {a' : Nat} → Vec α a' → Sort u_1 :=
40-
fun {α} P {a} t {a'} t' =>
39+
info: @[reducible] protected def Vec.noConfusionType.{u_1, u} : Sort u_1
40+
{α : Type} → {a : Nat} → Vec α a → {α' : Type} → {a' : Nat} → Vec α' a' → Sort u_1 :=
41+
fun P {α} {a} t {α'} {a'} t' =>
4142
Vec.casesOn t (if h : t'.ctorIdx = 0 then Vec.nil.elim t' h (P → P) else P)
4243
(fun {n} a a_1 =>
43-
if h : t'.ctorIdx = 1 then Vec.cons1.elim t' h fun {n_1} a_2 a_3 => (n = n_1 → a = a_2 → a_1 ≍ a_3 → P) → P
44+
if h : t'.ctorIdx = 1 then Vec.cons1.elim t' h fun {n_1} a_2 a_3 => (n = n_1 → a a_2 → a_1 ≍ a_3 → P) → P
4445
else P)
4546
fun {n} a a_1 =>
46-
if h : t'.ctorIdx = 2 then Vec.cons2.elim t' h fun {n_1} a_2 a_3 => (n = n_1 → a = a_2 → a_1 ≍ a_3 → P) → P else P
47+
if h : t'.ctorIdx = 2 then Vec.cons2.elim t' h fun {n_1} a_2 a_3 => (n = n_1 → a a_2 → a_1 ≍ a_3 → P) → P else P
4748
-/
4849
#guard_msgs in
4950
#print Vec.noConfusionType

tests/lean/run/listDecEq.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ end
3131
-- List decidable equality using `withPtrEqDecEq`
3232
def listDecEqAux {α} [s : DecidableEq α] : ∀ (as bs : List α), Decidable (as = bs)
3333
| [], [] => isTrue rfl
34-
| [], b::bs => isFalse $ fun h => List.noConfusion h
35-
| a::as, [] => isFalse $ fun h => List.noConfusion h
34+
| [], b::bs => isFalse $ fun h => List.noConfusion rfl (heq_of_eq h)
35+
| a::as, [] => isFalse $ fun h => List.noConfusion rfl (heq_of_eq h)
3636
| a::as, b::bs =>
3737
match s a b with
3838
| isTrue h₁ =>
3939
match withPtrEqDecEq as bs (fun _ => listDecEqAux as bs) with
4040
| isTrue h₂ => isTrue $ h₁ ▸ h₂ ▸ rfl
41-
| isFalse h₂ => isFalse $ fun h => List.noConfusion h $ fun _ h₃ => absurd h₃ h₂
42-
| isFalse h₁ => isFalse $ fun h => List.noConfusion h $ fun h₂ _ => absurd h₂ h₁
41+
| isFalse h₂ => isFalse $ fun h => List.noConfusion rfl (heq_of_eq h) (fun _ h₃ => absurd (eq_of_heq h₃) h₂)
42+
| isFalse h₁ => isFalse $ fun h => List.noConfusion rfl (heq_of_eq h) (fun h₂ _ => absurd (eq_of_heq h₂) h₁)
4343

4444
instance List.optimizedDecEq {α} [DecidableEq α] : DecidableEq (List α) :=
4545
fun a b => withPtrEqDecEq a b (fun _ => listDecEqAux a b)

tests/lean/run/noConfusionCtorInjection.lean

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ inductive L (α : Type u) : Type u where
66
/--
77
info: theorem L.cons.inj.{u} : ∀ {α : Type u} {x : α} {xs : L α} {x_1 : α} {xs_1 : L α},
88
L.cons x xs = L.cons x_1 xs_1 → x = x_1 ∧ xs = xs_1 :=
9-
fun {α} {x} {xs} {x_1} {xs_1} x_2 =>
10-
L.cons.noConfusion (Eq.refl α) (heq_of_eq x_2) fun x_eq xs_eq => ⟨eq_of_heq x_eq, eq_of_heq xs_eq⟩
9+
fun {α} {x} {xs} {x_1} {xs_1} x_2 => L.cons.noConfusion x_2 fun x_eq xs_eq => ⟨eq_of_heq x_eq, eq_of_heq xs_eq⟩
1110
-/
1211
#guard_msgs in
1312
#print L.cons.inj
@@ -21,8 +20,7 @@ theorem ex1 (h : L.cons x xs = L.cons y ys) : x = y ∧ xs = ys := by
2120
/--
2221
info: theorem ex1.{u_1} : ∀ {α : Type u_1} {x : α} {xs : L α} {y : α} {ys : L α},
2322
L.cons x xs = L.cons y ys → x = y ∧ xs = ys :=
24-
fun {α} {x} {xs} {y} {ys} h =>
25-
L.cons.noConfusion (Eq.refl α) (heq_of_eq h) fun x_eq xs_eq => ⟨eq_of_heq x_eq, eq_of_heq xs_eq⟩
23+
fun {α} {x} {xs} {y} {ys} h => L.cons.noConfusion h fun x_eq xs_eq => ⟨eq_of_heq x_eq, eq_of_heq xs_eq⟩
2624
-/
2725
#guard_msgs in #print ex1
2826

0 commit comments

Comments
 (0)