l3lab/ntp-mathlib huggingface dataset:
theorem lt_iff_lex_lt [LinearOrder α] (l l' : List α) : lt l l' ↔ Lex (· < ·) l l' := by
  constructor <;>
  intro h
  · induction h with
    | nil b bs => exact Lex.nil
    | @head a as b bs hab => 

Proof state:
case mp.head
α : Type u
inst✝ : LinearOrder α
l l' : List α
a : α
as : List α
b : α
bs : List α
hab : a < b
⊢ Lex (fun x x_1 => x < x_1) (a :: as) (b :: bs)

Next tactic:
apply Lex.rel
theorem lt_iff_lex_lt [LinearOrder α] (l l' : List α) : lt l l' ↔ Lex (· < ·) l l' := by
  constructor <;>
  intro h
  · induction h with
    | nil b bs => exact Lex.nil
    | @head a as b bs hab => apply Lex.rel; 

Proof state:
case mp.head.h
α : Type u
inst✝ : LinearOrder α
l l' : List α
a : α
as : List α
b : α
bs : List α
hab : a < b
⊢ a < b

Next tactic:
assumption
theorem lt_iff_lex_lt [LinearOrder α] (l l' : List α) : lt l l' ↔ Lex (· < ·) l l' := by
  constructor <;>
  intro h
  · induction h with
    | nil b bs => exact Lex.nil
    | @head a as b bs hab => apply Lex.rel; assumption
    

Proof state:
case mp.tail
α : Type u
inst✝ : LinearOrder α
l l' : List α
a : α
as : List α
b : α
bs : List α
hab : ¬a < b
hba : ¬b < a
a✝ : lt as bs
ih : Lex (fun x x_1 => x < x_1) as bs
⊢ Lex (fun x x_1 => x < x_1) (a :: as) (b :: bs)

Next tactic:
| @tail a as b bs hab hba _ ih =>
      have heq : a = b := _root_.le_antisymm (le_of_not_lt hba) (le_of_not_lt hab)
      subst b; apply Lex.cons; assumption
theorem lt_iff_lex_lt [LinearOrder α] (l l' : List α) : lt l l' ↔ Lex (· < ·) l l' := by
  constructor <;>
  intro h
  · induction h with
    | nil b bs => exact Lex.nil
    | @head a as b bs hab => apply Lex.rel; assumption
    | @tail a as b bs hab hba _ ih =>
      

Proof state:
case mp.tail
α : Type u
inst✝ : LinearOrder α
l l' : List α
a : α
as : List α
b : α
bs : List α
hab : ¬a < b
hba : ¬b < a
a✝ : lt as bs
ih : Lex (fun x x_1 => x < x_1) as bs
⊢ Lex (fun x x_1 => x < x_1) (a :: as) (b :: bs)

Next tactic:
have heq : a = b := _root_.le_antisymm (le_of_not_lt hba) (le_of_not_lt hab)
theorem lt_iff_lex_lt [LinearOrder α] (l l' : List α) : lt l l' ↔ Lex (· < ·) l l' := by
  constructor <;>
  intro h
  · induction h with
    | nil b bs => exact Lex.nil
    | @head a as b bs hab => apply Lex.rel; assumption
    | @tail a as b bs hab hba _ ih =>
      have heq : a = b := _root_.le_antisymm (le_of_not_lt hba) (le_of_not_lt hab)
      

Proof state:
case mp.tail
α : Type u
inst✝ : LinearOrder α
l l' : List α
a : α
as : List α
b : α
bs : List α
hab : ¬a < b
hba : ¬b < a
a✝ : lt as bs
ih : Lex (fun x x_1 => x < x_1) as bs
heq : a = b
⊢ Lex (fun x x_1 => x < x_1) (a :: as) (b :: bs)

Next tactic:
subst b
theorem lt_iff_lex_lt [LinearOrder α] (l l' : List α) : lt l l' ↔ Lex (· < ·) l l' := by
  constructor <;>
  intro h
  · induction h with
    | nil b bs => exact Lex.nil
    | @head a as b bs hab => apply Lex.rel; assumption
    | @tail a as b bs hab hba _ ih =>
      have heq : a = b := _root_.le_antisymm (le_of_not_lt hba) (le_of_not_lt hab)
      subst b; 

Proof state:
case mp.tail
α : Type u
inst✝ : LinearOrder α
l l' : List α
a : α
as bs : List α
a✝ : lt as bs
ih : Lex (fun x x_1 => x < x_1) as bs
hab hba : ¬a < a
⊢ Lex (fun x x_1 => x < x_1) (a :: as) (a :: bs)

Next tactic:
apply Lex.cons
theorem lt_iff_lex_lt [LinearOrder α] (l l' : List α) : lt l l' ↔ Lex (· < ·) l l' := by
  constructor <;>
  intro h
  · induction h with
    | nil b bs => exact Lex.nil
    | @head a as b bs hab => apply Lex.rel; assumption
    | @tail a as b bs hab hba _ ih =>
      have heq : a = b := _root_.le_antisymm (le_of_not_lt hba) (le_of_not_lt hab)
      subst b; apply Lex.cons; 

Proof state:
case mp.tail.h
α : Type u
inst✝ : LinearOrder α
l l' : List α
a : α
as bs : List α
a✝ : lt as bs
ih : Lex (fun x x_1 => x < x_1) as bs
hab hba : ¬a < a
⊢ Lex (fun x x_1 => x < x_1) as bs

Next tactic:
assumption
theorem lt_iff_lex_lt [LinearOrder α] (l l' : List α) : lt l l' ↔ Lex (· < ·) l l' := by
  constructor <;>
  intro h
  · induction h with
    | nil b bs => exact Lex.nil
    | @head a as b bs hab => apply Lex.rel; assumption
    | @tail a as b bs hab hba _ ih =>
      have heq : a = b := _root_.le_antisymm (le_of_not_lt hba) (le_of_not_lt hab)
      subst b; apply Lex.cons; assumption
  · 

Proof state:
case mpr
α : Type u
inst✝ : LinearOrder α
l l' : List α
h : Lex (fun x x_1 => x < x_1) l l'
⊢ lt l l'

Next tactic:
induction h with
    | @nil a as => apply lt.nil
    | @cons a as bs _ ih => apply lt.tail <;> simp [ih]
    | @rel a as b bs h => apply lt.head; assumption
theorem lt_iff_lex_lt [LinearOrder α] (l l' : List α) : lt l l' ↔ Lex (· < ·) l l' := by
  constructor <;>
  intro h
  · induction h with
    | nil b bs => exact Lex.nil
    | @head a as b bs hab => apply Lex.rel; assumption
    | @tail a as b bs hab hba _ ih =>
      have heq : a = b := _root_.le_antisymm (le_of_not_lt hba) (le_of_not_lt hab)
      subst b; apply Lex.cons; assumption
  · induction h with
    

Proof state:
case mpr.nil
α : Type u
inst✝ : LinearOrder α
l l' : List α
a : α
as : List α
⊢ lt [] (a :: as)

Next tactic:
| @nil a as => apply lt.nil
theorem lt_iff_lex_lt [LinearOrder α] (l l' : List α) : lt l l' ↔ Lex (· < ·) l l' := by
  constructor <;>
  intro h
  · induction h with
    | nil b bs => exact Lex.nil
    | @head a as b bs hab => apply Lex.rel; assumption
    | @tail a as b bs hab hba _ ih =>
      have heq : a = b := _root_.le_antisymm (le_of_not_lt hba) (le_of_not_lt hab)
      subst b; apply Lex.cons; assumption
  · induction h with
    | @nil a as => 

Proof state:
case mpr.nil
α : Type u
inst✝ : LinearOrder α
l l' : List α
a : α
as : List α
⊢ lt [] (a :: as)

Next tactic:
apply lt.nil
theorem lt_iff_lex_lt [LinearOrder α] (l l' : List α) : lt l l' ↔ Lex (· < ·) l l' := by
  constructor <;>
  intro h
  · induction h with
    | nil b bs => exact Lex.nil
    | @head a as b bs hab => apply Lex.rel; assumption
    | @tail a as b bs hab hba _ ih =>
      have heq : a = b := _root_.le_antisymm (le_of_not_lt hba) (le_of_not_lt hab)
      subst b; apply Lex.cons; assumption
  · induction h with
    | @nil a as => apply lt.nil
    

Proof state:
case mpr.cons
α : Type u
inst✝ : LinearOrder α
l l' : List α
a : α
as bs : List α
h✝ : Lex (fun x x_1 => x < x_1) as bs
ih : lt as bs
⊢ lt (a :: as) (a :: bs)

Next tactic:
| @cons a as bs _ ih => apply lt.tail <;> simp [ih]
theorem lt_iff_lex_lt [LinearOrder α] (l l' : List α) : lt l l' ↔ Lex (· < ·) l l' := by
  constructor <;>
  intro h
  · induction h with
    | nil b bs => exact Lex.nil
    | @head a as b bs hab => apply Lex.rel; assumption
    | @tail a as b bs hab hba _ ih =>
      have heq : a = b := _root_.le_antisymm (le_of_not_lt hba) (le_of_not_lt hab)
      subst b; apply Lex.cons; assumption
  · induction h with
    | @nil a as => apply lt.nil
    | @cons a as bs _ ih => 

Proof state:
case mpr.cons
α : Type u
inst✝ : LinearOrder α
l l' : List α
a : α
as bs : List α
h✝ : Lex (fun x x_1 => x < x_1) as bs
ih : lt as bs
⊢ lt (a :: as) (a :: bs)

Next tactic:
apply lt.tail
theorem lt_iff_lex_lt [LinearOrder α] (l l' : List α) : lt l l' ↔ Lex (· < ·) l l' := by
  constructor <;>
  intro h
  · induction h with
    | nil b bs => exact Lex.nil
    | @head a as b bs hab => apply Lex.rel; assumption
    | @tail a as b bs hab hba _ ih =>
      have heq : a = b := _root_.le_antisymm (le_of_not_lt hba) (le_of_not_lt hab)
      subst b; apply Lex.cons; assumption
  · induction h with
    | @nil a as => apply lt.nil
    | @cons a as bs _ ih => apply lt.tail <;> 

Proof state:
case mpr.cons.a
α : Type u
inst✝ : LinearOrder α
l l' : List α
a : α
as bs : List α
h✝ : Lex (fun x x_1 => x < x_1) as bs
ih : lt as bs
⊢ ¬a < a

Next tactic:
simp [ih]
theorem lt_iff_lex_lt [LinearOrder α] (l l' : List α) : lt l l' ↔ Lex (· < ·) l l' := by
  constructor <;>
  intro h
  · induction h with
    | nil b bs => exact Lex.nil
    | @head a as b bs hab => apply Lex.rel; assumption
    | @tail a as b bs hab hba _ ih =>
      have heq : a = b := _root_.le_antisymm (le_of_not_lt hba) (le_of_not_lt hab)
      subst b; apply Lex.cons; assumption
  · induction h with
    | @nil a as => apply lt.nil
    | @cons a as bs _ ih => apply lt.tail <;> 

Proof state:
case mpr.cons.a
α : Type u
inst✝ : LinearOrder α
l l' : List α
a : α
as bs : List α
h✝ : Lex (fun x x_1 => x < x_1) as bs
ih : lt as bs
⊢ lt as bs

Next tactic:
simp [ih]
theorem lt_iff_lex_lt [LinearOrder α] (l l' : List α) : lt l l' ↔ Lex (· < ·) l l' := by
  constructor <;>
  intro h
  · induction h with
    | nil b bs => exact Lex.nil
    | @head a as b bs hab => apply Lex.rel; assumption
    | @tail a as b bs hab hba _ ih =>
      have heq : a = b := _root_.le_antisymm (le_of_not_lt hba) (le_of_not_lt hab)
      subst b; apply Lex.cons; assumption
  · induction h with
    | @nil a as => apply lt.nil
    | @cons a as bs _ ih => apply lt.tail <;> simp [ih]
    

Proof state:
case mpr.rel
α : Type u
inst✝ : LinearOrder α
l l' : List α
a : α
as : List α
b : α
bs : List α
h : a < b
⊢ lt (a :: as) (b :: bs)

Next tactic:
| @rel a as b bs h => apply lt.head; assumption
theorem lt_iff_lex_lt [LinearOrder α] (l l' : List α) : lt l l' ↔ Lex (· < ·) l l' := by
  constructor <;>
  intro h
  · induction h with
    | nil b bs => exact Lex.nil
    | @head a as b bs hab => apply Lex.rel; assumption
    | @tail a as b bs hab hba _ ih =>
      have heq : a = b := _root_.le_antisymm (le_of_not_lt hba) (le_of_not_lt hab)
      subst b; apply Lex.cons; assumption
  · induction h with
    | @nil a as => apply lt.nil
    | @cons a as bs _ ih => apply lt.tail <;> simp [ih]
    | @rel a as b bs h => 

Proof state:
case mpr.rel
α : Type u
inst✝ : LinearOrder α
l l' : List α
a : α
as : List α
b : α
bs : List α
h : a < b
⊢ lt (a :: as) (b :: bs)

Next tactic:
apply lt.head
theorem lt_iff_lex_lt [LinearOrder α] (l l' : List α) : lt l l' ↔ Lex (· < ·) l l' := by
  constructor <;>
  intro h
  · induction h with
    | nil b bs => exact Lex.nil
    | @head a as b bs hab => apply Lex.rel; assumption
    | @tail a as b bs hab hba _ ih =>
      have heq : a = b := _root_.le_antisymm (le_of_not_lt hba) (le_of_not_lt hab)
      subst b; apply Lex.cons; assumption
  · induction h with
    | @nil a as => apply lt.nil
    | @cons a as bs _ ih => apply lt.tail <;> simp [ih]
    | @rel a as b bs h => apply lt.head; 

Proof state:
case mpr.rel.a
α : Type u
inst✝ : LinearOrder α
l l' : List α
a : α
as : List α
b : α
bs : List α
h : a < b
⊢ a < b

Next tactic:
assumption
theorem head_le_of_lt [LinearOrder α] {a a' : α} {l l' : List α} (h : (a' :: l') < (a :: l)) :
    a' ≤ a := by
  

Proof state:
α : Type u
inst✝ : LinearOrder α
a a' : α
l l' : List α
h : a' :: l' < a :: l
⊢ a' ≤ a

Next tactic:
by_contra hh
theorem head_le_of_lt [LinearOrder α] {a a' : α} {l l' : List α} (h : (a' :: l') < (a :: l)) :
    a' ≤ a := by
  by_contra hh
  

Proof state:
α : Type u
inst✝ : LinearOrder α
a a' : α
l l' : List α
h : a' :: l' < a :: l
hh : ¬a' ≤ a
⊢ False

Next tactic:
simp only [not_le] at hh
theorem head_le_of_lt [LinearOrder α] {a a' : α} {l l' : List α} (h : (a' :: l') < (a :: l)) :
    a' ≤ a := by
  by_contra hh
  simp only [not_le] at hh
  

Proof state:
α : Type u
inst✝ : LinearOrder α
a a' : α
l l' : List α
h : a' :: l' < a :: l
hh : a < a'
⊢ False

Next tactic:
exact List.Lex.isAsymm.aux _ _ _ (List.Lex.rel hh) h
theorem head!_le_of_lt [LinearOrder α] [Inhabited α] (l l' : List α) (h : l' < l) (hl' : l' ≠ []) :
    l'.head! ≤ l.head! := by
  

Proof state:
α : Type u
inst✝¹ : LinearOrder α
inst✝ : Inhabited α
l l' : List α
h : l' < l
hl' : l' ≠ []
⊢ head! l' ≤ head! l

Next tactic:
replace h : List.Lex (· < ·) l' l := h
theorem head!_le_of_lt [LinearOrder α] [Inhabited α] (l l' : List α) (h : l' < l) (hl' : l' ≠ []) :
    l'.head! ≤ l.head! := by
  replace h : List.Lex (· < ·) l' l := h
  

Proof state:
α : Type u
inst✝¹ : LinearOrder α
inst✝ : Inhabited α
l l' : List α
hl' : l' ≠ []
h : Lex (fun x x_1 => x < x_1) l' l
⊢ head! l' ≤ head! l

Next tactic:
by_cases hl : l = []
theorem head!_le_of_lt [LinearOrder α] [Inhabited α] (l l' : List α) (h : l' < l) (hl' : l' ≠ []) :
    l'.head! ≤ l.head! := by
  replace h : List.Lex (· < ·) l' l := h
  by_cases hl : l = []
  · 

Proof state:
case pos
α : Type u
inst✝¹ : LinearOrder α
inst✝ : Inhabited α
l l' : List α
hl' : l' ≠ []
h : Lex (fun x x_1 => x < x_1) l' l
hl : l = []
⊢ head! l' ≤ head! l

Next tactic:
simp [hl] at h
theorem head!_le_of_lt [LinearOrder α] [Inhabited α] (l l' : List α) (h : l' < l) (hl' : l' ≠ []) :
    l'.head! ≤ l.head! := by
  replace h : List.Lex (· < ·) l' l := h
  by_cases hl : l = []
  · simp [hl] at h
  · 

Proof state:
case neg
α : Type u
inst✝¹ : LinearOrder α
inst✝ : Inhabited α
l l' : List α
hl' : l' ≠ []
h : Lex (fun x x_1 => x < x_1) l' l
hl : ¬l = []
⊢ head! l' ≤ head! l

Next tactic:
rw [← List.cons_head!_tail hl', ← List.cons_head!_tail hl] at h
theorem head!_le_of_lt [LinearOrder α] [Inhabited α] (l l' : List α) (h : l' < l) (hl' : l' ≠ []) :
    l'.head! ≤ l.head! := by
  replace h : List.Lex (· < ·) l' l := h
  by_cases hl : l = []
  · simp [hl] at h
  · rw [← List.cons_head!_tail hl', ← List.cons_head!_tail hl] at h
    

Proof state:
case neg
α : Type u
inst✝¹ : LinearOrder α
inst✝ : Inhabited α
l l' : List α
hl' : l' ≠ []
h : Lex (fun x x_1 => x < x_1) (head! l' :: tail l') (head! l :: tail l)
hl : ¬l = []
⊢ head! l' ≤ head! l

Next tactic:
exact head_le_of_lt h
theorem cons_le_cons [LinearOrder α] (a : α) {l l' : List α} (h : l' ≤ l) :
    a :: l' ≤ a :: l := by
  

Proof state:
α : Type u
inst✝ : LinearOrder α
a : α
l l' : List α
h : l' ≤ l
⊢ a :: l' ≤ a :: l

Next tactic:
rw [le_iff_lt_or_eq] at h ⊢
theorem cons_le_cons [LinearOrder α] (a : α) {l l' : List α} (h : l' ≤ l) :
    a :: l' ≤ a :: l := by
  rw [le_iff_lt_or_eq] at h ⊢
  

Proof state:
α : Type u
inst✝ : LinearOrder α
a : α
l l' : List α
h : l' < l ∨ l' = l
⊢ a :: l' < a :: l ∨ a :: l' = a :: l

Next tactic:
refine h.imp ?_ (congr_arg _)
theorem cons_le_cons [LinearOrder α] (a : α) {l l' : List α} (h : l' ≤ l) :
    a :: l' ≤ a :: l := by
  rw [le_iff_lt_or_eq] at h ⊢
  refine h.imp ?_ (congr_arg _)
  

Proof state:
α : Type u
inst✝ : LinearOrder α
a : α
l l' : List α
h : l' < l ∨ l' = l
⊢ l' < l → a :: l' < a :: l

Next tactic:
intro h
theorem cons_le_cons [LinearOrder α] (a : α) {l l' : List α} (h : l' ≤ l) :
    a :: l' ≤ a :: l := by
  rw [le_iff_lt_or_eq] at h ⊢
  refine h.imp ?_ (congr_arg _)
  intro h
  

Proof state:
α : Type u
inst✝ : LinearOrder α
a : α
l l' : List α
h✝ : l' < l ∨ l' = l
h : l' < l
⊢ a :: l' < a :: l

Next tactic:
have haa := lt_irrefl a
theorem cons_le_cons [LinearOrder α] (a : α) {l l' : List α} (h : l' ≤ l) :
    a :: l' ≤ a :: l := by
  rw [le_iff_lt_or_eq] at h ⊢
  refine h.imp ?_ (congr_arg _)
  intro h
  have haa := lt_irrefl a
  

Proof state:
α : Type u
inst✝ : LinearOrder α
a : α
l l' : List α
h✝ : l' < l ∨ l' = l
h : l' < l
haa : ¬a < a
⊢ a :: l' < a :: l

Next tactic:
exact (List.lt_iff_lex_lt _ _).mp
    (List.lt.tail haa haa ((List.lt_iff_lex_lt _ _).mpr h))
theorem antisymm_iff [IsRefl α r] [IsAntisymm α r] {a b : α} : r a b ∧ r b a ↔ a = b :=
  ⟨fun h => antisymm h.1 h.2, by
    

Proof state:
α : Type u
β : Type v
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsRefl α r
inst✝ : IsAntisymm α r
a b : α
⊢ a = b → r a b ∧ r b a

Next tactic:
rintro rfl
theorem antisymm_iff [IsRefl α r] [IsAntisymm α r] {a b : α} : r a b ∧ r b a ↔ a = b :=
  ⟨fun h => antisymm h.1 h.2, by
    rintro rfl
    

Proof state:
α : Type u
β : Type v
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsRefl α r
inst✝ : IsAntisymm α r
a : α
⊢ r a a ∧ r a a

Next tactic:
exact ⟨refl _, refl _⟩
theorem IsTrichotomous.swap (r) [IsTrichotomous α r] : IsTrichotomous α (swap r) :=
  ⟨fun a b => by 

Proof state:
α : Type u
β : Type v
r✝ : α → α → Prop
s : β → β → Prop
r : α → α → Prop
inst✝ : IsTrichotomous α r
a b : α
⊢ Function.swap r a b ∨ a = b ∨ Function.swap r b a

Next tactic:
simpa [Function.swap, or_comm, or_left_comm] using trichotomous_of r a b
theorem eq_empty_relation (r) [IsIrrefl α r] [Subsingleton α] : r = EmptyRelation :=
  funext₂ <| by 

Proof state:
α : Type u
β : Type v
r✝ : α → α → Prop
s : β → β → Prop
r : α → α → Prop
inst✝¹ : IsIrrefl α r
inst✝ : Subsingleton α
⊢ ∀ (a b : α), r a b = EmptyRelation a b

Next tactic:
simpa using not_rel_of_subsingleton r
theorem trans_trichotomous_left [IsTrans α r] [IsTrichotomous α r] {a b c : α} :
    ¬r b a → r b c → r a c := by
  

Proof state:
α : Type u
β : Type v
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsTrans α r
inst✝ : IsTrichotomous α r
a b c : α
⊢ ¬r b a → r b c → r a c

Next tactic:
intro h₁ h₂
theorem trans_trichotomous_left [IsTrans α r] [IsTrichotomous α r] {a b c : α} :
    ¬r b a → r b c → r a c := by
  intro h₁ h₂
  

Proof state:
α : Type u
β : Type v
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsTrans α r
inst✝ : IsTrichotomous α r
a b c : α
h₁ : ¬r b a
h₂ : r b c
⊢ r a c

Next tactic:
rcases trichotomous_of r a b with (h₃ | rfl | h₃)
theorem trans_trichotomous_left [IsTrans α r] [IsTrichotomous α r] {a b c : α} :
    ¬r b a → r b c → r a c := by
  intro h₁ h₂
  rcases trichotomous_of r a b with (h₃ | rfl | h₃)
  

Proof state:
case inl
α : Type u
β : Type v
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsTrans α r
inst✝ : IsTrichotomous α r
a b c : α
h₁ : ¬r b a
h₂ : r b c
h₃ : r a b
⊢ r a c
case inr.inl
α : Type u
β : Type v
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsTrans α r
inst✝ : IsTrichotomous α r
a c : α
h₁ : ¬r a a
h₂ : r a c
⊢ r a c
case inr.inr
α : Type u
β : Type v
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsTrans α r
inst✝ : IsTrichotomous α r
a b c : α
h₁ : ¬r b a
h₂ : r b c
h₃ : r b a
⊢ r a c

Next tactic:
exacts [_root_.trans h₃ h₂, h₂, absurd h₃ h₁]
theorem trans_trichotomous_right [IsTrans α r] [IsTrichotomous α r] {a b c : α} :
    r a b → ¬r c b → r a c := by
  

Proof state:
α : Type u
β : Type v
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsTrans α r
inst✝ : IsTrichotomous α r
a b c : α
⊢ r a b → ¬r c b → r a c

Next tactic:
intro h₁ h₂
theorem trans_trichotomous_right [IsTrans α r] [IsTrichotomous α r] {a b c : α} :
    r a b → ¬r c b → r a c := by
  intro h₁ h₂
  

Proof state:
α : Type u
β : Type v
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsTrans α r
inst✝ : IsTrichotomous α r
a b c : α
h₁ : r a b
h₂ : ¬r c b
⊢ r a c

Next tactic:
rcases trichotomous_of r b c with (h₃ | rfl | h₃)
theorem trans_trichotomous_right [IsTrans α r] [IsTrichotomous α r] {a b c : α} :
    r a b → ¬r c b → r a c := by
  intro h₁ h₂
  rcases trichotomous_of r b c with (h₃ | rfl | h₃)
  

Proof state:
case inl
α : Type u
β : Type v
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsTrans α r
inst✝ : IsTrichotomous α r
a b c : α
h₁ : r a b
h₂ : ¬r c b
h₃ : r b c
⊢ r a c
case inr.inl
α : Type u
β : Type v
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsTrans α r
inst✝ : IsTrichotomous α r
a b : α
h₁ : r a b
h₂ : ¬r b b
⊢ r a b
case inr.inr
α : Type u
β : Type v
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsTrans α r
inst✝ : IsTrichotomous α r
a b c : α
h₁ : r a b
h₂ : ¬r c b
h₃ : r c b
⊢ r a c

Next tactic:
exacts [_root_.trans h₁ h₃, h₁, absurd h₃ h₂]
/-- Construct a partial order from an `isStrictOrder` relation.

See note [reducible non-instances]. -/
@[reducible]
def partialOrderOfSO (r) [IsStrictOrder α r] : PartialOrder α where
  le x y := x = y ∨ r x y
  lt := r
  le_refl x := Or.inl rfl
  le_trans x y z h₁ h₂ :=
    match y, z, h₁, h₂ with
    | _, _, Or.inl rfl, h₂ => h₂
    | _, _, h₁, Or.inl rfl => h₁
    | _, _, Or.inr h₁, Or.inr h₂ => Or.inr (_root_.trans h₁ h₂)
  le_antisymm x y h₁ h₂ :=
    match y, h₁, h₂ with
    | _, Or.inl rfl, _ => rfl
    | _, _, Or.inl rfl => rfl
    | _, Or.inr h₁, Or.inr h₂ => (asymm h₁ h₂).elim
  lt_iff_le_not_le x y :=
    ⟨fun h => ⟨Or.inr h, not_or_of_not (fun e => by 

Proof state:
α : Type u
β : Type v
r✝ : α → α → Prop
s : β → β → Prop
r : α → α → Prop
inst✝ : IsStrictOrder α r
x y : α
h : x < y
e : y = x
⊢ False

Next tactic:
rw [e] at h
/-- Construct a partial order from an `isStrictOrder` relation.

See note [reducible non-instances]. -/
@[reducible]
def partialOrderOfSO (r) [IsStrictOrder α r] : PartialOrder α where
  le x y := x = y ∨ r x y
  lt := r
  le_refl x := Or.inl rfl
  le_trans x y z h₁ h₂ :=
    match y, z, h₁, h₂ with
    | _, _, Or.inl rfl, h₂ => h₂
    | _, _, h₁, Or.inl rfl => h₁
    | _, _, Or.inr h₁, Or.inr h₂ => Or.inr (_root_.trans h₁ h₂)
  le_antisymm x y h₁ h₂ :=
    match y, h₁, h₂ with
    | _, Or.inl rfl, _ => rfl
    | _, _, Or.inl rfl => rfl
    | _, Or.inr h₁, Or.inr h₂ => (asymm h₁ h₂).elim
  lt_iff_le_not_le x y :=
    ⟨fun h => ⟨Or.inr h, not_or_of_not (fun e => by rw [e] at h; 

Proof state:
α : Type u
β : Type v
r✝ : α → α → Prop
s : β → β → Prop
r : α → α → Prop
inst✝ : IsStrictOrder α r
x y : α
h : x < x
e : y = x
⊢ False

Next tactic:
exact irrefl _ h
theorem IsOrderConnected.neg_trans {r : α → α → Prop} [IsOrderConnected α r] {a b c}
    (h₁ : ¬r a b) (h₂ : ¬r b c) : ¬r a c :=
  mt (IsOrderConnected.conn a b c) <| by 

Proof state:
α : Type u
β : Type v
r✝ : α → α → Prop
s : β → β → Prop
r : α → α → Prop
inst✝ : IsOrderConnected α r
a b c : α
h₁ : ¬r a b
h₂ : ¬r b c
⊢ ¬(r a b ∨ r b c)

Next tactic:
simp [h₁, h₂]
instance (priority := 100) {α} (r : α → α → Prop) [IsWellOrder α r] : IsTrichotomous α r := by
  

Proof state:
α✝ : Type u
β : Type v
r✝ : α✝ → α✝ → Prop
s : β → β → Prop
α : Type ?u.15333
r : α → α → Prop
inst✝ : IsWellOrder α r
⊢ IsTrichotomous α r

Next tactic:
infer_instance
instance (priority := 100) {α} (r : α → α → Prop) [IsWellOrder α r] : IsTrans α r := by
  

Proof state:
α✝ : Type u
β : Type v
r✝ : α✝ → α✝ → Prop
s : β → β → Prop
α : Type ?u.15416
r : α → α → Prop
inst✝ : IsWellOrder α r
⊢ IsTrans α r

Next tactic:
infer_instance
instance (priority := 100) {α} (r : α → α → Prop) [IsWellOrder α r] : IsIrrefl α r := by
  

Proof state:
α✝ : Type u
β : Type v
r✝ : α✝ → α✝ → Prop
s : β → β → Prop
α : Type ?u.15502
r : α → α → Prop
inst✝ : IsWellOrder α r
⊢ IsIrrefl α r

Next tactic:
infer_instance
instance (priority := 100) {α} (r : α → α → Prop) [IsWellOrder α r] : IsAsymm α r := by
  

Proof state:
α✝ : Type u
β : Type v
r✝ : α✝ → α✝ → Prop
s : β → β → Prop
α : Type ?u.15614
r : α → α → Prop
inst✝ : IsWellOrder α r
⊢ IsAsymm α r

Next tactic:
infer_instance
instance [IsWellOrder α r] [IsWellOrder β s] : IsWellOrder (α × β) (Prod.Lex r s) where
  trichotomous := fun ⟨a₁, a₂⟩ ⟨b₁, b₂⟩ =>
    match @trichotomous _ r _ a₁ b₁ with
    | Or.inl h₁ => Or.inl <| Prod.Lex.left _ _ h₁
    | Or.inr (Or.inr h₁) => Or.inr <| Or.inr <| Prod.Lex.left _ _ h₁
    | Or.inr (Or.inl (.refl _)) =>
        match @trichotomous _ s _ a₂ b₂ with
        | Or.inl h => Or.inl <| Prod.Lex.right _ h
        | Or.inr (Or.inr h) => Or.inr <| Or.inr <| Prod.Lex.right _ h
        | Or.inr (Or.inl (.refl _)) => Or.inr <| Or.inl rfl
  trans a b c h₁ h₂ := by
    

Proof state:
α : Type u
β : Type v
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsWellOrder α r
inst✝ : IsWellOrder β s
a b c : α × β
h₁ : Prod.Lex r s a b
h₂ : Prod.Lex r s b c
⊢ Prod.Lex r s a c

Next tactic:
cases' h₁ with a₁ a₂ b₁ b₂ ab a₁ b₁ b₂ ab
instance [IsWellOrder α r] [IsWellOrder β s] : IsWellOrder (α × β) (Prod.Lex r s) where
  trichotomous := fun ⟨a₁, a₂⟩ ⟨b₁, b₂⟩ =>
    match @trichotomous _ r _ a₁ b₁ with
    | Or.inl h₁ => Or.inl <| Prod.Lex.left _ _ h₁
    | Or.inr (Or.inr h₁) => Or.inr <| Or.inr <| Prod.Lex.left _ _ h₁
    | Or.inr (Or.inl (.refl _)) =>
        match @trichotomous _ s _ a₂ b₂ with
        | Or.inl h => Or.inl <| Prod.Lex.right _ h
        | Or.inr (Or.inr h) => Or.inr <| Or.inr <| Prod.Lex.right _ h
        | Or.inr (Or.inl (.refl _)) => Or.inr <| Or.inl rfl
  trans a b c h₁ h₂ := by
    cases' h₁ with a₁ a₂ b₁ b₂ ab a₁ b₁ b₂ ab <;> 

Proof state:
case left
α : Type u
β : Type v
r : α → α → Prop
s : β → β → Prop
inst✝¹ : IsWellOrder α r
inst✝ : IsWellOrder β s
c : α × β
a₁ : α
a₂ : β
b₁ : α
b₂ : β
ab : r a₁ b₁
h₂ : Prod.Lex r s (b₁, b₂) c
⊢ Prod.Lex r s (a₁, a₂) c

Next tactic:
cases' h₂ with _ _ c₁ c₂ bc _ _ c₂ bc