Skip to content

Commit b60128a

Browse files
Small proof improvements
1 parent 39fb3be commit b60128a

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/Init/Data/Order/Lemmas.lean

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ public instance (r : α → α → Prop) [Asymm r] : Antisymm r where
3131
public instance (r : α → α → Prop) [Total r] : Trichotomous r where
3232
trichotomous a b h h' := by simpa [h, h'] using Total.total (r := r) a b
3333

34-
public theorem Trichotomous.rel_or_eq_or_rel_swap {r : α → α → Prop} [Trichotomous r] {a b} :
34+
public theorem Trichotomous.rel_or_eq_or_rel_swap {r : α → α → Prop} [i : Trichotomous r] {a b} :
3535
r a b ∨ a = b ∨ r b a := match Classical.em (r a b) with
3636
| .inl hab => .inl hab | .inr hab => match Classical.em (r b a) with
3737
| .inl hba => .inr <| .inr hba
38-
| .inr hba => .inr <| .inl <| Trichotomous.trichotomous _ _ hab hba
38+
| .inr hba => .inr <| .inl <| i.trichotomous _ _ hab hba
3939

4040
public theorem trichotomous_of_rel_or_eq_or_rel_swap {r : α → α → Prop}
4141
(h : ∀ {a b}, r a b ∨ a = b ∨ r b a) : Trichotomous r where
@@ -52,7 +52,7 @@ public theorem Total.of_not_swap {r : α → α → Prop} [Total r] {a b} (h :
5252

5353
public theorem total_of_not_rel_swap_imp_rel {r : α → α → Prop} (h : ∀ {a b}, ¬ r a b → r b a) :
5454
Total r where
55-
total a b := Classical.byCases (p := r a b) Or.inl (fun hab => Or.inr (h hab))
55+
total a b := match Classical.em (r a b) with | .inl hab => .inl hab | .inr hab => .inr (h hab)
5656

5757
public theorem total_of_refl_of_trichotomous (r : α → α → Prop) [Refl r] [Trichotomous r] :
5858
Total r where
@@ -63,13 +63,12 @@ public theorem asymm_of_irrefl_of_antisymm (r : α → α → Prop) [Irrefl r] [
6363
asymm a b h h' := Irrefl.irrefl _ (Antisymm.antisymm a b h h' ▸ h)
6464

6565
public theorem Total.asymm_of_total_not {r : α → α → Prop} [i : Total (¬ r · ·)] : Asymm r where
66-
asymm a b h := by cases i.total a b <;> trivial
66+
asymm a b h := (i.total a b).resolve_left (· h)
6767

6868
public theorem Asymm.total_not {r : α → α → Prop} [i : Asymm r] : Total (¬ r · ·) where
69-
total a b := by
70-
apply Classical.byCases (p := r a b) <;> intro hab
71-
· exact Or.inr <| i.asymm a b hab
72-
· exact Or.inl hab
69+
total a b := match Classical.em (r b a) with
70+
| .inl hba => .inl <| i.asymm b a hba
71+
| .inr hba => .inr hba
7372

7473
public instance {α : Type u} [LE α] [IsPartialOrder α] :
7574
Antisymm (α := α) (· ≤ ·) where

0 commit comments

Comments
 (0)