l3lab/ntp-mathlib huggingface dataset:
theorem cmpLE_swap {α} [LE α] [IsTotal α (· ≤ ·)] [@DecidableRel α (· ≤ ·)] (x y : α) :
    (cmpLE x y).swap = cmpLE y x := by
  by_cases xy:x ≤ y <;> by_cases yx:y ≤ x <;> 

Proof state:
case pos
α✝ : Type u_1
β : Type u_2
α : Type u_3
inst✝² : LE α
inst✝¹ : IsTotal α fun x x_1 => x ≤ x_1
inst✝ : DecidableRel fun x x_1 => x ≤ x_1
x y : α
xy : x ≤ y
yx : y ≤ x
⊢ Ordering.swap (cmpLE x y) = cmpLE y x

Next tactic:
simp [cmpLE, *, Ordering.swap]
theorem cmpLE_swap {α} [LE α] [IsTotal α (· ≤ ·)] [@DecidableRel α (· ≤ ·)] (x y : α) :
    (cmpLE x y).swap = cmpLE y x := by
  by_cases xy:x ≤ y <;> by_cases yx:y ≤ x <;> 

Proof state:
case neg
α✝ : Type u_1
β : Type u_2
α : Type u_3
inst✝² : LE α
inst✝¹ : IsTotal α fun x x_1 => x ≤ x_1
inst✝ : DecidableRel fun x x_1 => x ≤ x_1
x y : α
xy : x ≤ y
yx : ¬y ≤ x
⊢ Ordering.swap (cmpLE x y) = cmpLE y x

Next tactic:
simp [cmpLE, *, Ordering.swap]
theorem cmpLE_swap {α} [LE α] [IsTotal α (· ≤ ·)] [@DecidableRel α (· ≤ ·)] (x y : α) :
    (cmpLE x y).swap = cmpLE y x := by
  by_cases xy:x ≤ y <;> by_cases yx:y ≤ x <;> 

Proof state:
case pos
α✝ : Type u_1
β : Type u_2
α : Type u_3
inst✝² : LE α
inst✝¹ : IsTotal α fun x x_1 => x ≤ x_1
inst✝ : DecidableRel fun x x_1 => x ≤ x_1
x y : α
xy : ¬x ≤ y
yx : y ≤ x
⊢ Ordering.swap (cmpLE x y) = cmpLE y x

Next tactic:
simp [cmpLE, *, Ordering.swap]
theorem cmpLE_swap {α} [LE α] [IsTotal α (· ≤ ·)] [@DecidableRel α (· ≤ ·)] (x y : α) :
    (cmpLE x y).swap = cmpLE y x := by
  by_cases xy:x ≤ y <;> by_cases yx:y ≤ x <;> 

Proof state:
case neg
α✝ : Type u_1
β : Type u_2
α : Type u_3
inst✝² : LE α
inst✝¹ : IsTotal α fun x x_1 => x ≤ x_1
inst✝ : DecidableRel fun x x_1 => x ≤ x_1
x y : α
xy : ¬x ≤ y
yx : ¬y ≤ x
⊢ Ordering.swap (cmpLE x y) = cmpLE y x

Next tactic:
simp [cmpLE, *, Ordering.swap]
theorem cmpLE_swap {α} [LE α] [IsTotal α (· ≤ ·)] [@DecidableRel α (· ≤ ·)] (x y : α) :
    (cmpLE x y).swap = cmpLE y x := by
  by_cases xy:x ≤ y <;> by_cases yx:y ≤ x <;> simp [cmpLE, *, Ordering.swap]
  

Proof state:
case neg
α✝ : Type u_1
β : Type u_2
α : Type u_3
inst✝² : LE α
inst✝¹ : IsTotal α fun x x_1 => x ≤ x_1
inst✝ : DecidableRel fun x x_1 => x ≤ x_1
x y : α
xy : ¬x ≤ y
yx : ¬y ≤ x
⊢ False

Next tactic:
cases not_or_of_not xy yx (total_of _ _ _)
theorem cmpLE_eq_cmp {α} [Preorder α] [IsTotal α (· ≤ ·)] [@DecidableRel α (· ≤ ·)]
    [@DecidableRel α (· < ·)] (x y : α) : cmpLE x y = cmp x y := by
  

Proof state:
α✝ : Type u_1
β : Type u_2
α : Type u_3
inst✝³ : Preorder α
inst✝² : IsTotal α fun x x_1 => x ≤ x_1
inst✝¹ : DecidableRel fun x x_1 => x ≤ x_1
inst✝ : DecidableRel fun x x_1 => x < x_1
x y : α
⊢ cmpLE x y = cmp x y

Next tactic:
by_cases xy:x ≤ y
theorem cmpLE_eq_cmp {α} [Preorder α] [IsTotal α (· ≤ ·)] [@DecidableRel α (· ≤ ·)]
    [@DecidableRel α (· < ·)] (x y : α) : cmpLE x y = cmp x y := by
  by_cases xy:x ≤ y <;> 

Proof state:
case pos
α✝ : Type u_1
β : Type u_2
α : Type u_3
inst✝³ : Preorder α
inst✝² : IsTotal α fun x x_1 => x ≤ x_1
inst✝¹ : DecidableRel fun x x_1 => x ≤ x_1
inst✝ : DecidableRel fun x x_1 => x < x_1
x y : α
xy : x ≤ y
⊢ cmpLE x y = cmp x y

Next tactic:
by_cases yx:y ≤ x
theorem cmpLE_eq_cmp {α} [Preorder α] [IsTotal α (· ≤ ·)] [@DecidableRel α (· ≤ ·)]
    [@DecidableRel α (· < ·)] (x y : α) : cmpLE x y = cmp x y := by
  by_cases xy:x ≤ y <;> 

Proof state:
case neg
α✝ : Type u_1
β : Type u_2
α : Type u_3
inst✝³ : Preorder α
inst✝² : IsTotal α fun x x_1 => x ≤ x_1
inst✝¹ : DecidableRel fun x x_1 => x ≤ x_1
inst✝ : DecidableRel fun x x_1 => x < x_1
x y : α
xy : ¬x ≤ y
⊢ cmpLE x y = cmp x y

Next tactic:
by_cases yx:y ≤ x
theorem cmpLE_eq_cmp {α} [Preorder α] [IsTotal α (· ≤ ·)] [@DecidableRel α (· ≤ ·)]
    [@DecidableRel α (· < ·)] (x y : α) : cmpLE x y = cmp x y := by
  by_cases xy:x ≤ y <;> by_cases yx:y ≤ x <;> 

Proof state:
case pos
α✝ : Type u_1
β : Type u_2
α : Type u_3
inst✝³ : Preorder α
inst✝² : IsTotal α fun x x_1 => x ≤ x_1
inst✝¹ : DecidableRel fun x x_1 => x ≤ x_1
inst✝ : DecidableRel fun x x_1 => x < x_1
x y : α
xy : x ≤ y
yx : y ≤ x
⊢ cmpLE x y = cmp x y

Next tactic:
simp [cmpLE, lt_iff_le_not_le, *, cmp, cmpUsing]
theorem cmpLE_eq_cmp {α} [Preorder α] [IsTotal α (· ≤ ·)] [@DecidableRel α (· ≤ ·)]
    [@DecidableRel α (· < ·)] (x y : α) : cmpLE x y = cmp x y := by
  by_cases xy:x ≤ y <;> by_cases yx:y ≤ x <;> 

Proof state:
case neg
α✝ : Type u_1
β : Type u_2
α : Type u_3
inst✝³ : Preorder α
inst✝² : IsTotal α fun x x_1 => x ≤ x_1
inst✝¹ : DecidableRel fun x x_1 => x ≤ x_1
inst✝ : DecidableRel fun x x_1 => x < x_1
x y : α
xy : x ≤ y
yx : ¬y ≤ x
⊢ cmpLE x y = cmp x y

Next tactic:
simp [cmpLE, lt_iff_le_not_le, *, cmp, cmpUsing]
theorem cmpLE_eq_cmp {α} [Preorder α] [IsTotal α (· ≤ ·)] [@DecidableRel α (· ≤ ·)]
    [@DecidableRel α (· < ·)] (x y : α) : cmpLE x y = cmp x y := by
  by_cases xy:x ≤ y <;> by_cases yx:y ≤ x <;> 

Proof state:
case pos
α✝ : Type u_1
β : Type u_2
α : Type u_3
inst✝³ : Preorder α
inst✝² : IsTotal α fun x x_1 => x ≤ x_1
inst✝¹ : DecidableRel fun x x_1 => x ≤ x_1
inst✝ : DecidableRel fun x x_1 => x < x_1
x y : α
xy : ¬x ≤ y
yx : y ≤ x
⊢ cmpLE x y = cmp x y

Next tactic:
simp [cmpLE, lt_iff_le_not_le, *, cmp, cmpUsing]
theorem cmpLE_eq_cmp {α} [Preorder α] [IsTotal α (· ≤ ·)] [@DecidableRel α (· ≤ ·)]
    [@DecidableRel α (· < ·)] (x y : α) : cmpLE x y = cmp x y := by
  by_cases xy:x ≤ y <;> by_cases yx:y ≤ x <;> 

Proof state:
case neg
α✝ : Type u_1
β : Type u_2
α : Type u_3
inst✝³ : Preorder α
inst✝² : IsTotal α fun x x_1 => x ≤ x_1
inst✝¹ : DecidableRel fun x x_1 => x ≤ x_1
inst✝ : DecidableRel fun x x_1 => x < x_1
x y : α
xy : ¬x ≤ y
yx : ¬y ≤ x
⊢ cmpLE x y = cmp x y

Next tactic:
simp [cmpLE, lt_iff_le_not_le, *, cmp, cmpUsing]
theorem cmpLE_eq_cmp {α} [Preorder α] [IsTotal α (· ≤ ·)] [@DecidableRel α (· ≤ ·)]
    [@DecidableRel α (· < ·)] (x y : α) : cmpLE x y = cmp x y := by
  by_cases xy:x ≤ y <;> by_cases yx:y ≤ x <;> simp [cmpLE, lt_iff_le_not_le, *, cmp, cmpUsing]
  

Proof state:
case neg
α✝ : Type u_1
β : Type u_2
α : Type u_3
inst✝³ : Preorder α
inst✝² : IsTotal α fun x x_1 => x ≤ x_1
inst✝¹ : DecidableRel fun x x_1 => x ≤ x_1
inst✝ : DecidableRel fun x x_1 => x < x_1
x y : α
xy : ¬x ≤ y
yx : ¬y ≤ x
⊢ False

Next tactic:
cases not_or_of_not xy yx (total_of _ _ _)
theorem compares_swap [LT α] {a b : α} {o : Ordering} : o.swap.Compares a b ↔ o.Compares b a := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝ : LT α
a b : α
o : Ordering
⊢ Compares (swap o) a b ↔ Compares o b a

Next tactic:
cases o
theorem compares_swap [LT α] {a b : α} {o : Ordering} : o.swap.Compares a b ↔ o.Compares b a := by
  cases o
  · 

Proof state:
case lt
α : Type u_1
β : Type u_2
inst✝ : LT α
a b : α
⊢ Compares (swap lt) a b ↔ Compares lt b a

Next tactic:
exact Iff.rfl
theorem compares_swap [LT α] {a b : α} {o : Ordering} : o.swap.Compares a b ↔ o.Compares b a := by
  cases o
  · exact Iff.rfl
  · 

Proof state:
case eq
α : Type u_1
β : Type u_2
inst✝ : LT α
a b : α
⊢ Compares (swap eq) a b ↔ Compares eq b a

Next tactic:
exact eq_comm
theorem compares_swap [LT α] {a b : α} {o : Ordering} : o.swap.Compares a b ↔ o.Compares b a := by
  cases o
  · exact Iff.rfl
  · exact eq_comm
  · 

Proof state:
case gt
α : Type u_1
β : Type u_2
inst✝ : LT α
a b : α
⊢ Compares (swap gt) a b ↔ Compares gt b a

Next tactic:
exact Iff.rfl
theorem swap_eq_iff_eq_swap {o o' : Ordering} : o.swap = o' ↔ o = o'.swap := by
  

Proof state:
α : Type u_1
β : Type u_2
o o' : Ordering
⊢ swap o = o' ↔ o = swap o'

Next tactic:
rw [← swap_inj, swap_swap]
theorem Compares.eq_lt [Preorder α] : ∀ {o} {a b : α}, Compares o a b → (o = lt ↔ a < b)
  | lt, a, b, h => ⟨fun _ => h, fun _ => rfl⟩
  | eq, a, b, h => ⟨fun h => by 

Proof state:
α : Type u_1
β : Type u_2
inst✝ : Preorder α
a b : α
h✝ : Compares eq a b
h : eq = lt
⊢ a < b

Next tactic:
injection h
theorem Compares.eq_lt [Preorder α] : ∀ {o} {a b : α}, Compares o a b → (o = lt ↔ a < b)
  | lt, a, b, h => ⟨fun _ => h, fun _ => rfl⟩
  | eq, a, b, h => ⟨fun h => by injection h, fun h' => (ne_of_lt h' h).elim⟩
  | gt, a, b, h => ⟨fun h => by 

Proof state:
α : Type u_1
β : Type u_2
inst✝ : Preorder α
a b : α
h✝ : Compares gt a b
h : gt = lt
⊢ a < b

Next tactic:
injection h
theorem Compares.ne_lt [Preorder α] : ∀ {o} {a b : α}, Compares o a b → (o ≠ lt ↔ b ≤ a)
  | lt, a, b, h => ⟨absurd rfl, fun h' => (not_le_of_lt h h').elim⟩
  | eq, a, b, h => ⟨fun _ => ge_of_eq h, fun _ h => by 

Proof state:
α : Type u_1
β : Type u_2
inst✝ : Preorder α
a b : α
h✝ : Compares eq a b
x✝ : b ≤ a
h : eq = lt
⊢ False

Next tactic:
injection h
theorem Compares.ne_lt [Preorder α] : ∀ {o} {a b : α}, Compares o a b → (o ≠ lt ↔ b ≤ a)
  | lt, a, b, h => ⟨absurd rfl, fun h' => (not_le_of_lt h h').elim⟩
  | eq, a, b, h => ⟨fun _ => ge_of_eq h, fun _ h => by injection h⟩
  | gt, a, b, h => ⟨fun _ => le_of_lt h, fun _ h => by 

Proof state:
α : Type u_1
β : Type u_2
inst✝ : Preorder α
a b : α
h✝ : Compares gt a b
x✝ : b ≤ a
h : gt = lt
⊢ False

Next tactic:
injection h
theorem Compares.eq_eq [Preorder α] : ∀ {o} {a b : α}, Compares o a b → (o = eq ↔ a = b)
  | lt, a, b, h => ⟨fun h => by 

Proof state:
α : Type u_1
β : Type u_2
inst✝ : Preorder α
a b : α
h✝ : Compares lt a b
h : lt = eq
⊢ a = b

Next tactic:
injection h
theorem Compares.eq_eq [Preorder α] : ∀ {o} {a b : α}, Compares o a b → (o = eq ↔ a = b)
  | lt, a, b, h => ⟨fun h => by injection h, fun h' => (ne_of_lt h h').elim⟩
  | eq, a, b, h => ⟨fun _ => h, fun _ => rfl⟩
  | gt, a, b, h => ⟨fun h => by 

Proof state:
α : Type u_1
β : Type u_2
inst✝ : Preorder α
a b : α
h✝ : Compares gt a b
h : gt = eq
⊢ a = b

Next tactic:
injection h
theorem compares_iff_of_compares_impl [LinearOrder α] [Preorder β] {a b : α} {a' b' : β}
    (h : ∀ {o}, Compares o a b → Compares o a' b') (o) : Compares o a b ↔ Compares o a' b' := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrder α
inst✝ : Preorder β
a b : α
a' b' : β
h : ∀ {o : Ordering}, Compares o a b → Compares o a' b'
o : Ordering
⊢ Compares o a b ↔ Compares o a' b'

Next tactic:
refine' ⟨h, fun ho => _⟩
theorem compares_iff_of_compares_impl [LinearOrder α] [Preorder β] {a b : α} {a' b' : β}
    (h : ∀ {o}, Compares o a b → Compares o a' b') (o) : Compares o a b ↔ Compares o a' b' := by
  refine' ⟨h, fun ho => _⟩
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrder α
inst✝ : Preorder β
a b : α
a' b' : β
h : ∀ {o : Ordering}, Compares o a b → Compares o a' b'
o : Ordering
ho : Compares o a' b'
⊢ Compares o a b

Next tactic:
cases' lt_trichotomy a b with hab hab
theorem compares_iff_of_compares_impl [LinearOrder α] [Preorder β] {a b : α} {a' b' : β}
    (h : ∀ {o}, Compares o a b → Compares o a' b') (o) : Compares o a b ↔ Compares o a' b' := by
  refine' ⟨h, fun ho => _⟩
  cases' lt_trichotomy a b with hab hab
  · 

Proof state:
case inl
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrder α
inst✝ : Preorder β
a b : α
a' b' : β
h : ∀ {o : Ordering}, Compares o a b → Compares o a' b'
o : Ordering
ho : Compares o a' b'
hab : a < b
⊢ Compares o a b

Next tactic:
have hab : Compares Ordering.lt a b := hab
theorem compares_iff_of_compares_impl [LinearOrder α] [Preorder β] {a b : α} {a' b' : β}
    (h : ∀ {o}, Compares o a b → Compares o a' b') (o) : Compares o a b ↔ Compares o a' b' := by
  refine' ⟨h, fun ho => _⟩
  cases' lt_trichotomy a b with hab hab
  · have hab : Compares Ordering.lt a b := hab
    

Proof state:
case inl
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrder α
inst✝ : Preorder β
a b : α
a' b' : β
h : ∀ {o : Ordering}, Compares o a b → Compares o a' b'
o : Ordering
ho : Compares o a' b'
hab✝ : a < b
hab : Compares lt a b
⊢ Compares o a b

Next tactic:
rwa [ho.inj (h hab)]
theorem compares_iff_of_compares_impl [LinearOrder α] [Preorder β] {a b : α} {a' b' : β}
    (h : ∀ {o}, Compares o a b → Compares o a' b') (o) : Compares o a b ↔ Compares o a' b' := by
  refine' ⟨h, fun ho => _⟩
  cases' lt_trichotomy a b with hab hab
  · have hab : Compares Ordering.lt a b := hab
    rwa [ho.inj (h hab)]
  · 

Proof state:
case inr
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrder α
inst✝ : Preorder β
a b : α
a' b' : β
h : ∀ {o : Ordering}, Compares o a b → Compares o a' b'
o : Ordering
ho : Compares o a' b'
hab : a = b ∨ b < a
⊢ Compares o a b

Next tactic:
cases' hab with hab hab
theorem compares_iff_of_compares_impl [LinearOrder α] [Preorder β] {a b : α} {a' b' : β}
    (h : ∀ {o}, Compares o a b → Compares o a' b') (o) : Compares o a b ↔ Compares o a' b' := by
  refine' ⟨h, fun ho => _⟩
  cases' lt_trichotomy a b with hab hab
  · have hab : Compares Ordering.lt a b := hab
    rwa [ho.inj (h hab)]
  · cases' hab with hab hab
    · 

Proof state:
case inr.inl
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrder α
inst✝ : Preorder β
a b : α
a' b' : β
h : ∀ {o : Ordering}, Compares o a b → Compares o a' b'
o : Ordering
ho : Compares o a' b'
hab : a = b
⊢ Compares o a b

Next tactic:
have hab : Compares Ordering.eq a b := hab
theorem compares_iff_of_compares_impl [LinearOrder α] [Preorder β] {a b : α} {a' b' : β}
    (h : ∀ {o}, Compares o a b → Compares o a' b') (o) : Compares o a b ↔ Compares o a' b' := by
  refine' ⟨h, fun ho => _⟩
  cases' lt_trichotomy a b with hab hab
  · have hab : Compares Ordering.lt a b := hab
    rwa [ho.inj (h hab)]
  · cases' hab with hab hab
    · have hab : Compares Ordering.eq a b := hab
      

Proof state:
case inr.inl
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrder α
inst✝ : Preorder β
a b : α
a' b' : β
h : ∀ {o : Ordering}, Compares o a b → Compares o a' b'
o : Ordering
ho : Compares o a' b'
hab✝ : a = b
hab : Compares eq a b
⊢ Compares o a b

Next tactic:
rwa [ho.inj (h hab)]
theorem compares_iff_of_compares_impl [LinearOrder α] [Preorder β] {a b : α} {a' b' : β}
    (h : ∀ {o}, Compares o a b → Compares o a' b') (o) : Compares o a b ↔ Compares o a' b' := by
  refine' ⟨h, fun ho => _⟩
  cases' lt_trichotomy a b with hab hab
  · have hab : Compares Ordering.lt a b := hab
    rwa [ho.inj (h hab)]
  · cases' hab with hab hab
    · have hab : Compares Ordering.eq a b := hab
      rwa [ho.inj (h hab)]
    · 

Proof state:
case inr.inr
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrder α
inst✝ : Preorder β
a b : α
a' b' : β
h : ∀ {o : Ordering}, Compares o a b → Compares o a' b'
o : Ordering
ho : Compares o a' b'
hab : b < a
⊢ Compares o a b

Next tactic:
have hab : Compares Ordering.gt a b := hab
theorem compares_iff_of_compares_impl [LinearOrder α] [Preorder β] {a b : α} {a' b' : β}
    (h : ∀ {o}, Compares o a b → Compares o a' b') (o) : Compares o a b ↔ Compares o a' b' := by
  refine' ⟨h, fun ho => _⟩
  cases' lt_trichotomy a b with hab hab
  · have hab : Compares Ordering.lt a b := hab
    rwa [ho.inj (h hab)]
  · cases' hab with hab hab
    · have hab : Compares Ordering.eq a b := hab
      rwa [ho.inj (h hab)]
    · have hab : Compares Ordering.gt a b := hab
      

Proof state:
case inr.inr
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrder α
inst✝ : Preorder β
a b : α
a' b' : β
h : ∀ {o : Ordering}, Compares o a b → Compares o a' b'
o : Ordering
ho : Compares o a' b'
hab✝ : b < a
hab : Compares gt a b
⊢ Compares o a b

Next tactic:
rwa [ho.inj (h hab)]
theorem swap_orElse (o₁ o₂) : (orElse o₁ o₂).swap = orElse o₁.swap o₂.swap := by
  

Proof state:
α : Type u_1
β : Type u_2
o₁ o₂ : Ordering
⊢ swap (orElse o₁ o₂) = orElse (swap o₁) (swap o₂)

Next tactic:
cases o₁
theorem swap_orElse (o₁ o₂) : (orElse o₁ o₂).swap = orElse o₁.swap o₂.swap := by
  cases o₁ <;> 

Proof state:
case lt
α : Type u_1
β : Type u_2
o₂ : Ordering
⊢ swap (orElse lt o₂) = orElse (swap lt) (swap o₂)

Next tactic:
rfl
theorem swap_orElse (o₁ o₂) : (orElse o₁ o₂).swap = orElse o₁.swap o₂.swap := by
  cases o₁ <;> 

Proof state:
case eq
α : Type u_1
β : Type u_2
o₂ : Ordering
⊢ swap (orElse eq o₂) = orElse (swap eq) (swap o₂)

Next tactic:
rfl
theorem swap_orElse (o₁ o₂) : (orElse o₁ o₂).swap = orElse o₁.swap o₂.swap := by
  cases o₁ <;> 

Proof state:
case gt
α : Type u_1
β : Type u_2
o₂ : Ordering
⊢ swap (orElse gt o₂) = orElse (swap gt) (swap o₂)

Next tactic:
rfl
theorem orElse_eq_lt (o₁ o₂) : orElse o₁ o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by
  

Proof state:
α : Type u_1
β : Type u_2
o₁ o₂ : Ordering
⊢ orElse o₁ o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt

Next tactic:
cases o₁
theorem orElse_eq_lt (o₁ o₂) : orElse o₁ o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by
  cases o₁ <;> 

Proof state:
case lt
α : Type u_1
β : Type u_2
o₂ : Ordering
⊢ orElse lt o₂ = lt ↔ lt = lt ∨ lt = eq ∧ o₂ = lt

Next tactic:
cases o₂
theorem orElse_eq_lt (o₁ o₂) : orElse o₁ o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by
  cases o₁ <;> 

Proof state:
case eq
α : Type u_1
β : Type u_2
o₂ : Ordering
⊢ orElse eq o₂ = lt ↔ eq = lt ∨ eq = eq ∧ o₂ = lt

Next tactic:
cases o₂
theorem orElse_eq_lt (o₁ o₂) : orElse o₁ o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by
  cases o₁ <;> 

Proof state:
case gt
α : Type u_1
β : Type u_2
o₂ : Ordering
⊢ orElse gt o₂ = lt ↔ gt = lt ∨ gt = eq ∧ o₂ = lt

Next tactic:
cases o₂
theorem orElse_eq_lt (o₁ o₂) : orElse o₁ o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by
  cases o₁ <;> cases o₂ <;> 

Proof state:
case lt.lt
α : Type u_1
β : Type u_2
⊢ orElse lt lt = lt ↔ lt = lt ∨ lt = eq ∧ lt = lt

Next tactic:
exact by decide
theorem orElse_eq_lt (o₁ o₂) : orElse o₁ o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by
  cases o₁ <;> cases o₂ <;> exact by 

Proof state:
α : Type u_1
β : Type u_2
⊢ orElse lt lt = lt ↔ lt = lt ∨ lt = eq ∧ lt = lt

Next tactic:
decide
theorem orElse_eq_lt (o₁ o₂) : orElse o₁ o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by
  cases o₁ <;> cases o₂ <;> 

Proof state:
case lt.eq
α : Type u_1
β : Type u_2
⊢ orElse lt eq = lt ↔ lt = lt ∨ lt = eq ∧ eq = lt

Next tactic:
exact by decide
theorem orElse_eq_lt (o₁ o₂) : orElse o₁ o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by
  cases o₁ <;> cases o₂ <;> exact by 

Proof state:
α : Type u_1
β : Type u_2
⊢ orElse lt eq = lt ↔ lt = lt ∨ lt = eq ∧ eq = lt

Next tactic:
decide
theorem orElse_eq_lt (o₁ o₂) : orElse o₁ o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by
  cases o₁ <;> cases o₂ <;> 

Proof state:
case lt.gt
α : Type u_1
β : Type u_2
⊢ orElse lt gt = lt ↔ lt = lt ∨ lt = eq ∧ gt = lt

Next tactic:
exact by decide
theorem orElse_eq_lt (o₁ o₂) : orElse o₁ o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by
  cases o₁ <;> cases o₂ <;> exact by 

Proof state:
α : Type u_1
β : Type u_2
⊢ orElse lt gt = lt ↔ lt = lt ∨ lt = eq ∧ gt = lt

Next tactic:
decide
theorem orElse_eq_lt (o₁ o₂) : orElse o₁ o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by
  cases o₁ <;> cases o₂ <;> 

Proof state:
case eq.lt
α : Type u_1
β : Type u_2
⊢ orElse eq lt = lt ↔ eq = lt ∨ eq = eq ∧ lt = lt

Next tactic:
exact by decide
theorem orElse_eq_lt (o₁ o₂) : orElse o₁ o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by
  cases o₁ <;> cases o₂ <;> exact by 

Proof state:
α : Type u_1
β : Type u_2
⊢ orElse eq lt = lt ↔ eq = lt ∨ eq = eq ∧ lt = lt

Next tactic:
decide
theorem orElse_eq_lt (o₁ o₂) : orElse o₁ o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by
  cases o₁ <;> cases o₂ <;> 

Proof state:
case eq.eq
α : Type u_1
β : Type u_2
⊢ orElse eq eq = lt ↔ eq = lt ∨ eq = eq ∧ eq = lt

Next tactic:
exact by decide
theorem orElse_eq_lt (o₁ o₂) : orElse o₁ o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by
  cases o₁ <;> cases o₂ <;> exact by 

Proof state:
α : Type u_1
β : Type u_2
⊢ orElse eq eq = lt ↔ eq = lt ∨ eq = eq ∧ eq = lt

Next tactic:
decide
theorem orElse_eq_lt (o₁ o₂) : orElse o₁ o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by
  cases o₁ <;> cases o₂ <;> 

Proof state:
case eq.gt
α : Type u_1
β : Type u_2
⊢ orElse eq gt = lt ↔ eq = lt ∨ eq = eq ∧ gt = lt

Next tactic:
exact by decide
theorem orElse_eq_lt (o₁ o₂) : orElse o₁ o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by
  cases o₁ <;> cases o₂ <;> exact by 

Proof state:
α : Type u_1
β : Type u_2
⊢ orElse eq gt = lt ↔ eq = lt ∨ eq = eq ∧ gt = lt

Next tactic:
decide
theorem orElse_eq_lt (o₁ o₂) : orElse o₁ o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by
  cases o₁ <;> cases o₂ <;> 

Proof state:
case gt.lt
α : Type u_1
β : Type u_2
⊢ orElse gt lt = lt ↔ gt = lt ∨ gt = eq ∧ lt = lt

Next tactic:
exact by decide
theorem orElse_eq_lt (o₁ o₂) : orElse o₁ o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by
  cases o₁ <;> cases o₂ <;> exact by 

Proof state:
α : Type u_1
β : Type u_2
⊢ orElse gt lt = lt ↔ gt = lt ∨ gt = eq ∧ lt = lt

Next tactic:
decide
theorem orElse_eq_lt (o₁ o₂) : orElse o₁ o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by
  cases o₁ <;> cases o₂ <;> 

Proof state:
case gt.eq
α : Type u_1
β : Type u_2
⊢ orElse gt eq = lt ↔ gt = lt ∨ gt = eq ∧ eq = lt

Next tactic:
exact by decide
theorem orElse_eq_lt (o₁ o₂) : orElse o₁ o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by
  cases o₁ <;> cases o₂ <;> exact by 

Proof state:
α : Type u_1
β : Type u_2
⊢ orElse gt eq = lt ↔ gt = lt ∨ gt = eq ∧ eq = lt

Next tactic:
decide
theorem orElse_eq_lt (o₁ o₂) : orElse o₁ o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by
  cases o₁ <;> cases o₂ <;> 

Proof state:
case gt.gt
α : Type u_1
β : Type u_2
⊢ orElse gt gt = lt ↔ gt = lt ∨ gt = eq ∧ gt = lt

Next tactic:
exact by decide
theorem orElse_eq_lt (o₁ o₂) : orElse o₁ o₂ = lt ↔ o₁ = lt ∨ o₁ = eq ∧ o₂ = lt := by
  cases o₁ <;> cases o₂ <;> exact by 

Proof state:
α : Type u_1
β : Type u_2
⊢ orElse gt gt = lt ↔ gt = lt ∨ gt = eq ∧ gt = lt

Next tactic:
decide
@[simp]
theorem toDual_compares_toDual [LT α] {a b : α} {o : Ordering} :
    Compares o (toDual a) (toDual b) ↔ Compares o b a := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝ : LT α
a b : α
o : Ordering
⊢ Compares o (toDual a) (toDual b) ↔ Compares o b a

Next tactic:
cases o
@[simp]
theorem toDual_compares_toDual [LT α] {a b : α} {o : Ordering} :
    Compares o (toDual a) (toDual b) ↔ Compares o b a := by
  cases o
  

Proof state:
case lt
α : Type u_1
β : Type u_2
inst✝ : LT α
a b : α
⊢ Compares lt (toDual a) (toDual b) ↔ Compares lt b a
case eq
α : Type u_1
β : Type u_2
inst✝ : LT α
a b : α
⊢ Compares eq (toDual a) (toDual b) ↔ Compares eq b a
case gt α : Type u_1 β : Type u_2 inst✝ : LT α a b : α ⊢ Compares gt (toDual a) (toDual b) ↔ Compares gt b a

Next tactic:
exacts [Iff.rfl, eq_comm, Iff.rfl]
@[simp]
theorem ofDual_compares_ofDual [LT α] {a b : αᵒᵈ} {o : Ordering} :
    Compares o (ofDual a) (ofDual b) ↔ Compares o b a := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝ : LT α
a b : αᵒᵈ
o : Ordering
⊢ Compares o (ofDual a) (ofDual b) ↔ Compares o b a

Next tactic:
cases o
@[simp]
theorem ofDual_compares_ofDual [LT α] {a b : αᵒᵈ} {o : Ordering} :
    Compares o (ofDual a) (ofDual b) ↔ Compares o b a := by
  cases o
  

Proof state:
case lt
α : Type u_1
β : Type u_2
inst✝ : LT α
a b : αᵒᵈ
⊢ Compares lt (ofDual a) (ofDual b) ↔ Compares lt b a
case eq
α : Type u_1
β : Type u_2
inst✝ : LT α
a b : αᵒᵈ
⊢ Compares eq (ofDual a) (ofDual b) ↔ Compares eq b a
case gt α : Type u_1 β : Type u_2 inst✝ : LT α a b : αᵒᵈ ⊢ Compares gt (ofDual a) (ofDual b) ↔ Compares gt b a

Next tactic:
exacts [Iff.rfl, eq_comm, Iff.rfl]
theorem cmp_compares [LinearOrder α] (a b : α) : (cmp a b).Compares a b := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝ : LinearOrder α
a b : α
⊢ Compares (cmp a b) a b

Next tactic:
obtain h | h | h := lt_trichotomy a b
theorem cmp_compares [LinearOrder α] (a b : α) : (cmp a b).Compares a b := by
  obtain h | h | h := lt_trichotomy a b <;> 

Proof state:
case inl
α : Type u_1
β : Type u_2
inst✝ : LinearOrder α
a b : α
h : a < b
⊢ Compares (cmp a b) a b

Next tactic:
simp [cmp, cmpUsing, h, h.not_lt]
theorem cmp_compares [LinearOrder α] (a b : α) : (cmp a b).Compares a b := by
  obtain h | h | h := lt_trichotomy a b <;> 

Proof state:
case inr.inl
α : Type u_1
β : Type u_2
inst✝ : LinearOrder α
a b : α
h : a = b
⊢ Compares (cmp a b) a b

Next tactic:
simp [cmp, cmpUsing, h, h.not_lt]
theorem cmp_compares [LinearOrder α] (a b : α) : (cmp a b).Compares a b := by
  obtain h | h | h := lt_trichotomy a b <;> 

Proof state:
case inr.inr
α : Type u_1
β : Type u_2
inst✝ : LinearOrder α
a b : α
h : b < a
⊢ Compares (cmp a b) a b

Next tactic:
simp [cmp, cmpUsing, h, h.not_lt]
@[simp]
theorem cmp_swap [Preorder α] [@DecidableRel α (· < ·)] (a b : α) : (cmp a b).swap = cmp b a := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : Preorder α
inst✝ : DecidableRel fun x x_1 => x < x_1
a b : α
⊢ swap (cmp a b) = cmp b a

Next tactic:
unfold cmp cmpUsing