diff --git a/tests/lean/match3.lean b/tests/lean/match3.lean index 142973ad80..db074eaa42 100644 --- a/tests/lean/match3.lean +++ b/tests/lean/match3.lean @@ -1,5 +1,3 @@ - - def f (x : Nat) : Nat := match x with | 30 => 31 @@ -39,14 +37,14 @@ by { } theorem ex7 (a : Bool) (p q : Prop) (h₁ : a = true → p) (h₂ : a = false → q) : p ∨ q := -match h:a with -| true => Or.inl $ h₁ h -| false => Or.inr $ h₂ h + match h:a with + | true => Or.inl $ h₁ h + | false => Or.inr $ h₂ h def head {α} (xs : List α) (h : xs = [] → False) : α := -match he:xs with -| [] => False.elim $ h he -| x::_ => x + match he:xs with + | [] => by contradiction + | x::_ => x variable {α : Type u} {p : α → Prop} diff --git a/tests/lean/run/casesUsing.lean b/tests/lean/run/casesUsing.lean index e9bd074943..d0e44e8988 100644 --- a/tests/lean/run/casesUsing.lean +++ b/tests/lean/run/casesUsing.lean @@ -59,12 +59,12 @@ theorem ex3b (n : Nat) : Exists (fun m => n = m + m ∨ n = m + m + 1) := by def ex4 {α} (xs : List α) (h : xs = [] → False) : α := by cases he:xs with - | nil => apply False.elim; exact h he; done + | nil => contradiction | cons x _ => exact x def ex5 {α} (xs : List α) (h : xs = [] → False) : α := by cases he:xs using List.casesOn with - | nil => apply False.elim; exact h he; done + | nil => contradiction | cons x _ => exact x theorem ex6 {α} (f : List α → Bool) (h₁ : {xs : List α} → f xs = true → xs = []) (xs : List α) (h₂ : xs ≠ []) : f xs = false := @@ -82,9 +82,9 @@ theorem ex8 {α} (f : List α → Bool) (h₁ : {xs : List α} → f xs = true | true => exact False.elim (h₂ (h₁ he)) | false => rfl -theorem ex9 {α} (xs : List α) (h : xs = [] → False) : Nonempty α := by +theorem ex9 (xs : List α) (h : xs = [] → False) : Nonempty α := by cases xs using List.rec with - | nil => apply False.elim; apply h; rfl + | nil => contradiction | cons x _ => apply Nonempty.intro; assumption theorem modLt (x : Nat) {y : Nat} (h : y > 0) : x % y < y := by diff --git a/tests/lean/run/contra.lean b/tests/lean/run/contra.lean index d326f3f9bd..5ffdf894f7 100644 --- a/tests/lean/run/contra.lean +++ b/tests/lean/run/contra.lean @@ -39,3 +39,11 @@ theorem ex13 (h : id False) : α := by theorem ex14 (h : 100000000 ≤ 20) : α := by contradiction + +theorem ex15 (x : α) (h : x = x → False) : α := by + contradiction + +theorem ex16 (xs : List α) (h : xs = [] → False) : Nonempty α := by + cases xs using List.rec with + | nil => contradiction + | cons x _ => apply Nonempty.intro; assumption