l3lab/ntp-mathlib huggingface dataset:
/-- Transfer a `LinearOrder` on `β` to a `LinearOrder` on `α` using an injective
function `f : α → β`. This version takes `[Sup α]` and `[Inf α]` as arguments, then uses
them for `max` and `min` fields. It also takes `[Ord α]` as an argument and uses them for `compare`
fields. See `LinearOrder.lift` for a version that autogenerates `compare` fields, and
`LinearOrder.liftWithOrd'` for one that auto-generates `min` and `max` fields.
fields. See note [reducible non-instances]. -/
@[reducible]
def LinearOrder.liftWithOrd {α β} [LinearOrder β] [Sup α] [Inf α] [Ord α] (f : α → β)
    (inj : Injective f) (hsup : ∀ x y, f (x ⊔ y) = max (f x) (f y))
    (hinf : ∀ x y, f (x ⊓ y) = min (f x) (f y))
    (compare_f : ∀ a b : α, compare a b = compare (f a) (f b)) : LinearOrder α :=
  letI decidableLE := fun x y ↦ (inferInstance : Decidable (f x ≤ f y))
  letI decidableLT := fun x y ↦ (inferInstance : Decidable (f x < f y))
  letI decidableEq := fun x y ↦ decidable_of_iff (f x = f y) inj.eq_iff
  { PartialOrder.lift f inj with
    le_total := fun x y ↦ le_total (f x) (f y)
    decidableLE := decidableLE
    decidableLT := decidableLT
    decidableEq := decidableEq
    min := (· ⊓ ·)
    max := (· ⊔ ·)
    min_def := by
      intros x y
      apply inj
      rw [apply_ite f]
      exact (hinf _ _).trans (min_def _ _)
    max_def := by
      intros x y
      apply inj
      

Proof state:
case a
ι : Type u_1
α✝ : Type u
β✝ : Type v
γ : Type w
π : ι → Type u_2
r : α✝ → α✝ → Prop
α : Type ?u.96919
β : Type ?u.96916
inst✝³ : LinearOrder β
inst✝² : Sup α
inst✝¹ : Inf α
inst✝ : Ord α
f : α → β
inj : Injective f
hsup : ∀ (x y : α), f (x ⊔ y) = max (f x) (f y)
hinf : ∀ (x y : α), f (x ⊓ y) = min (f x) (f y)
compare_f : ∀ (a b : α), compare a b = compare (f a) (f b)
decidableLE : (x y : α) → Decidable (f x ≤ f y) := fun x y => inferInstance
decidableLT : (x y : α) → Decidable (f x < f y) := fun x y => inferInstance
decidableEq : (x y : α) → Decidable (x = y) := fun x y => decidable_of_iff (f x = f y) (_ : f x = f y ↔ x = y)
src✝ : PartialOrder α := PartialOrder.lift f inj
x y : α
⊢ f (max x y) = f (if x ≤ y then y else x)

Next tactic:
rw [apply_ite f]
/-- Transfer a `LinearOrder` on `β` to a `LinearOrder` on `α` using an injective
function `f : α → β`. This version takes `[Sup α]` and `[Inf α]` as arguments, then uses
them for `max` and `min` fields. It also takes `[Ord α]` as an argument and uses them for `compare`
fields. See `LinearOrder.lift` for a version that autogenerates `compare` fields, and
`LinearOrder.liftWithOrd'` for one that auto-generates `min` and `max` fields.
fields. See note [reducible non-instances]. -/
@[reducible]
def LinearOrder.liftWithOrd {α β} [LinearOrder β] [Sup α] [Inf α] [Ord α] (f : α → β)
    (inj : Injective f) (hsup : ∀ x y, f (x ⊔ y) = max (f x) (f y))
    (hinf : ∀ x y, f (x ⊓ y) = min (f x) (f y))
    (compare_f : ∀ a b : α, compare a b = compare (f a) (f b)) : LinearOrder α :=
  letI decidableLE := fun x y ↦ (inferInstance : Decidable (f x ≤ f y))
  letI decidableLT := fun x y ↦ (inferInstance : Decidable (f x < f y))
  letI decidableEq := fun x y ↦ decidable_of_iff (f x = f y) inj.eq_iff
  { PartialOrder.lift f inj with
    le_total := fun x y ↦ le_total (f x) (f y)
    decidableLE := decidableLE
    decidableLT := decidableLT
    decidableEq := decidableEq
    min := (· ⊓ ·)
    max := (· ⊔ ·)
    min_def := by
      intros x y
      apply inj
      rw [apply_ite f]
      exact (hinf _ _).trans (min_def _ _)
    max_def := by
      intros x y
      apply inj
      rw [apply_ite f]
      

Proof state:
case a
ι : Type u_1
α✝ : Type u
β✝ : Type v
γ : Type w
π : ι → Type u_2
r : α✝ → α✝ → Prop
α : Type ?u.96919
β : Type ?u.96916
inst✝³ : LinearOrder β
inst✝² : Sup α
inst✝¹ : Inf α
inst✝ : Ord α
f : α → β
inj : Injective f
hsup : ∀ (x y : α), f (x ⊔ y) = max (f x) (f y)
hinf : ∀ (x y : α), f (x ⊓ y) = min (f x) (f y)
compare_f : ∀ (a b : α), compare a b = compare (f a) (f b)
decidableLE : (x y : α) → Decidable (f x ≤ f y) := fun x y => inferInstance
decidableLT : (x y : α) → Decidable (f x < f y) := fun x y => inferInstance
decidableEq : (x y : α) → Decidable (x = y) := fun x y => decidable_of_iff (f x = f y) (_ : f x = f y ↔ x = y)
src✝ : PartialOrder α := PartialOrder.lift f inj
x y : α
⊢ f (max x y) = if x ≤ y then f y else f x

Next tactic:
exact (hsup _ _).trans (max_def _ _)
theorem lt_iff : x < y ↔ x.1 < y.1 ∧ x.2 ≤ y.2 ∨ x.1 ≤ y.1 ∧ x.2 < y.2 := by
  

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝¹ : Preorder α
inst✝ : Preorder β
a a₁ a₂ : α
b b₁ b₂ : β
x y : α × β
⊢ x < y ↔ x.1 < y.1 ∧ x.2 ≤ y.2 ∨ x.1 ≤ y.1 ∧ x.2 < y.2

Next tactic:
refine' ⟨fun h ↦ _, _⟩
theorem lt_iff : x < y ↔ x.1 < y.1 ∧ x.2 ≤ y.2 ∨ x.1 ≤ y.1 ∧ x.2 < y.2 := by
  refine' ⟨fun h ↦ _, _⟩
  · 

Proof state:
case refine'_1
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝¹ : Preorder α
inst✝ : Preorder β
a a₁ a₂ : α
b b₁ b₂ : β
x y : α × β
h : x < y
⊢ x.1 < y.1 ∧ x.2 ≤ y.2 ∨ x.1 ≤ y.1 ∧ x.2 < y.2

Next tactic:
by_cases h₁ : y.1 ≤ x.1
theorem lt_iff : x < y ↔ x.1 < y.1 ∧ x.2 ≤ y.2 ∨ x.1 ≤ y.1 ∧ x.2 < y.2 := by
  refine' ⟨fun h ↦ _, _⟩
  · by_cases h₁ : y.1 ≤ x.1
    · 

Proof state:
case pos
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝¹ : Preorder α
inst✝ : Preorder β
a a₁ a₂ : α
b b₁ b₂ : β
x y : α × β
h : x < y
h₁ : y.1 ≤ x.1
⊢ x.1 < y.1 ∧ x.2 ≤ y.2 ∨ x.1 ≤ y.1 ∧ x.2 < y.2

Next tactic:
exact Or.inr ⟨h.1.1, LE.le.lt_of_not_le h.1.2 fun h₂ ↦ h.2 ⟨h₁, h₂⟩⟩
theorem lt_iff : x < y ↔ x.1 < y.1 ∧ x.2 ≤ y.2 ∨ x.1 ≤ y.1 ∧ x.2 < y.2 := by
  refine' ⟨fun h ↦ _, _⟩
  · by_cases h₁ : y.1 ≤ x.1
    · exact Or.inr ⟨h.1.1, LE.le.lt_of_not_le h.1.2 fun h₂ ↦ h.2 ⟨h₁, h₂⟩⟩
    · 

Proof state:
case neg
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝¹ : Preorder α
inst✝ : Preorder β
a a₁ a₂ : α
b b₁ b₂ : β
x y : α × β
h : x < y
h₁ : ¬y.1 ≤ x.1
⊢ x.1 < y.1 ∧ x.2 ≤ y.2 ∨ x.1 ≤ y.1 ∧ x.2 < y.2

Next tactic:
exact Or.inl ⟨LE.le.lt_of_not_le h.1.1 h₁, h.1.2⟩
theorem lt_iff : x < y ↔ x.1 < y.1 ∧ x.2 ≤ y.2 ∨ x.1 ≤ y.1 ∧ x.2 < y.2 := by
  refine' ⟨fun h ↦ _, _⟩
  · by_cases h₁ : y.1 ≤ x.1
    · exact Or.inr ⟨h.1.1, LE.le.lt_of_not_le h.1.2 fun h₂ ↦ h.2 ⟨h₁, h₂⟩⟩
    · exact Or.inl ⟨LE.le.lt_of_not_le h.1.1 h₁, h.1.2⟩
  · 

Proof state:
case refine'_2
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝¹ : Preorder α
inst✝ : Preorder β
a a₁ a₂ : α
b b₁ b₂ : β
x y : α × β
⊢ x.1 < y.1 ∧ x.2 ≤ y.2 ∨ x.1 ≤ y.1 ∧ x.2 < y.2 → x < y

Next tactic:
rintro (⟨h₁, h₂⟩ | ⟨h₁, h₂⟩)
theorem lt_iff : x < y ↔ x.1 < y.1 ∧ x.2 ≤ y.2 ∨ x.1 ≤ y.1 ∧ x.2 < y.2 := by
  refine' ⟨fun h ↦ _, _⟩
  · by_cases h₁ : y.1 ≤ x.1
    · exact Or.inr ⟨h.1.1, LE.le.lt_of_not_le h.1.2 fun h₂ ↦ h.2 ⟨h₁, h₂⟩⟩
    · exact Or.inl ⟨LE.le.lt_of_not_le h.1.1 h₁, h.1.2⟩
  · rintro (⟨h₁, h₂⟩ | ⟨h₁, h₂⟩)
    · 

Proof state:
case refine'_2.inl.intro
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝¹ : Preorder α
inst✝ : Preorder β
a a₁ a₂ : α
b b₁ b₂ : β
x y : α × β
h₁ : x.1 < y.1
h₂ : x.2 ≤ y.2
⊢ x < y

Next tactic:
exact ⟨⟨h₁.le, h₂⟩, fun h ↦ h₁.not_le h.1⟩
theorem lt_iff : x < y ↔ x.1 < y.1 ∧ x.2 ≤ y.2 ∨ x.1 ≤ y.1 ∧ x.2 < y.2 := by
  refine' ⟨fun h ↦ _, _⟩
  · by_cases h₁ : y.1 ≤ x.1
    · exact Or.inr ⟨h.1.1, LE.le.lt_of_not_le h.1.2 fun h₂ ↦ h.2 ⟨h₁, h₂⟩⟩
    · exact Or.inl ⟨LE.le.lt_of_not_le h.1.1 h₁, h.1.2⟩
  · rintro (⟨h₁, h₂⟩ | ⟨h₁, h₂⟩)
    · exact ⟨⟨h₁.le, h₂⟩, fun h ↦ h₁.not_le h.1⟩
    · 

Proof state:
case refine'_2.inr.intro
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝¹ : Preorder α
inst✝ : Preorder β
a a₁ a₂ : α
b b₁ b₂ : β
x y : α × β
h₁ : x.1 ≤ y.1
h₂ : x.2 < y.2
⊢ x < y

Next tactic:
exact ⟨⟨h₁, h₂.le⟩, fun h ↦ h₂.not_le h.2⟩
@[simp]
theorem denselyOrdered_orderDual [LT α] : DenselyOrdered αᵒᵈ ↔ DenselyOrdered α :=
  ⟨by 

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝ : LT α
⊢ DenselyOrdered αᵒᵈ → DenselyOrdered α

Next tactic:
convert @OrderDual.denselyOrdered αᵒᵈ _
instance [Preorder α] [Preorder β] [DenselyOrdered α] [DenselyOrdered β] : DenselyOrdered (α × β) :=
  ⟨fun a b ↦ by
    

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝³ : Preorder α
inst✝² : Preorder β
inst✝¹ : DenselyOrdered α
inst✝ : DenselyOrdered β
a b : α × β
⊢ a < b → ∃ a_2, a < a_2 ∧ a_2 < b

Next tactic:
simp_rw [Prod.lt_iff]
instance [Preorder α] [Preorder β] [DenselyOrdered α] [DenselyOrdered β] : DenselyOrdered (α × β) :=
  ⟨fun a b ↦ by
    simp_rw [Prod.lt_iff]
    

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝³ : Preorder α
inst✝² : Preorder β
inst✝¹ : DenselyOrdered α
inst✝ : DenselyOrdered β
a b : α × β
⊢ a.1 < b.1 ∧ a.2 ≤ b.2 ∨ a.1 ≤ b.1 ∧ a.2 < b.2 →
    ∃ a_2,
      (a.1 < a_2.1 ∧ a.2 ≤ a_2.2 ∨ a.1 ≤ a_2.1 ∧ a.2 < a_2.2) ∧ (a_2.1 < b.1 ∧ a_2.2 ≤ b.2 ∨ a_2.1 ≤ b.1 ∧ a_2.2 < b.2)

Next tactic:
rintro (⟨h₁, h₂⟩ | ⟨h₁, h₂⟩)
instance [Preorder α] [Preorder β] [DenselyOrdered α] [DenselyOrdered β] : DenselyOrdered (α × β) :=
  ⟨fun a b ↦ by
    simp_rw [Prod.lt_iff]
    rintro (⟨h₁, h₂⟩ | ⟨h₁, h₂⟩)
    · 

Proof state:
case inl.intro
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝³ : Preorder α
inst✝² : Preorder β
inst✝¹ : DenselyOrdered α
inst✝ : DenselyOrdered β
a b : α × β
h₁ : a.1 < b.1
h₂ : a.2 ≤ b.2
⊢ ∃ a_1,
    (a.1 < a_1.1 ∧ a.2 ≤ a_1.2 ∨ a.1 ≤ a_1.1 ∧ a.2 < a_1.2) ∧ (a_1.1 < b.1 ∧ a_1.2 ≤ b.2 ∨ a_1.1 ≤ b.1 ∧ a_1.2 < b.2)

Next tactic:
obtain ⟨c, ha, hb⟩ := exists_between h₁
instance [Preorder α] [Preorder β] [DenselyOrdered α] [DenselyOrdered β] : DenselyOrdered (α × β) :=
  ⟨fun a b ↦ by
    simp_rw [Prod.lt_iff]
    rintro (⟨h₁, h₂⟩ | ⟨h₁, h₂⟩)
    · obtain ⟨c, ha, hb⟩ := exists_between h₁
      

Proof state:
case inl.intro.intro.intro
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝³ : Preorder α
inst✝² : Preorder β
inst✝¹ : DenselyOrdered α
inst✝ : DenselyOrdered β
a b : α × β
h₁ : a.1 < b.1
h₂ : a.2 ≤ b.2
c : α
ha : a.1 < c
hb : c < b.1
⊢ ∃ a_1,
    (a.1 < a_1.1 ∧ a.2 ≤ a_1.2 ∨ a.1 ≤ a_1.1 ∧ a.2 < a_1.2) ∧ (a_1.1 < b.1 ∧ a_1.2 ≤ b.2 ∨ a_1.1 ≤ b.1 ∧ a_1.2 < b.2)

Next tactic:
exact ⟨(c, _), Or.inl ⟨ha, h₂⟩, Or.inl ⟨hb, le_rfl⟩⟩
instance [Preorder α] [Preorder β] [DenselyOrdered α] [DenselyOrdered β] : DenselyOrdered (α × β) :=
  ⟨fun a b ↦ by
    simp_rw [Prod.lt_iff]
    rintro (⟨h₁, h₂⟩ | ⟨h₁, h₂⟩)
    · obtain ⟨c, ha, hb⟩ := exists_between h₁
      exact ⟨(c, _), Or.inl ⟨ha, h₂⟩, Or.inl ⟨hb, le_rfl⟩⟩
    · 

Proof state:
case inr.intro
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝³ : Preorder α
inst✝² : Preorder β
inst✝¹ : DenselyOrdered α
inst✝ : DenselyOrdered β
a b : α × β
h₁ : a.1 ≤ b.1
h₂ : a.2 < b.2
⊢ ∃ a_1,
    (a.1 < a_1.1 ∧ a.2 ≤ a_1.2 ∨ a.1 ≤ a_1.1 ∧ a.2 < a_1.2) ∧ (a_1.1 < b.1 ∧ a_1.2 ≤ b.2 ∨ a_1.1 ≤ b.1 ∧ a_1.2 < b.2)

Next tactic:
obtain ⟨c, ha, hb⟩ := exists_between h₂
instance [Preorder α] [Preorder β] [DenselyOrdered α] [DenselyOrdered β] : DenselyOrdered (α × β) :=
  ⟨fun a b ↦ by
    simp_rw [Prod.lt_iff]
    rintro (⟨h₁, h₂⟩ | ⟨h₁, h₂⟩)
    · obtain ⟨c, ha, hb⟩ := exists_between h₁
      exact ⟨(c, _), Or.inl ⟨ha, h₂⟩, Or.inl ⟨hb, le_rfl⟩⟩
    · obtain ⟨c, ha, hb⟩ := exists_between h₂
      

Proof state:
case inr.intro.intro.intro
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝³ : Preorder α
inst✝² : Preorder β
inst✝¹ : DenselyOrdered α
inst✝ : DenselyOrdered β
a b : α × β
h₁ : a.1 ≤ b.1
h₂ : a.2 < b.2
c : β
ha : a.2 < c
hb : c < b.2
⊢ ∃ a_1,
    (a.1 < a_1.1 ∧ a.2 ≤ a_1.2 ∨ a.1 ≤ a_1.1 ∧ a.2 < a_1.2) ∧ (a_1.1 < b.1 ∧ a_1.2 ≤ b.2 ∨ a_1.1 ≤ b.1 ∧ a_1.2 < b.2)

Next tactic:
exact ⟨(_, c), Or.inr ⟨h₁, ha⟩, Or.inr ⟨le_rfl, hb⟩⟩
instance {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, DenselyOrdered (α i)] :
    DenselyOrdered (∀ i, α i) :=
  ⟨fun a b ↦ by
    

Proof state:
ι : Type u_1
α✝ : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α✝ → α✝ → Prop
α : ι → Type u_3
inst✝¹ : (i : ι) → Preorder (α i)
inst✝ : ∀ (i : ι), DenselyOrdered (α i)
a b : (i : ι) → α i
⊢ a < b → ∃ a_2, a < a_2 ∧ a_2 < b

Next tactic:
classical
      simp_rw [Pi.lt_def]
      rintro ⟨hab, i, hi⟩
      obtain ⟨c, ha, hb⟩ := exists_between hi
      exact
        ⟨Function.update a i c,
          ⟨le_update_iff.2 ⟨ha.le, fun _ _ ↦ le_rfl⟩, i, by rwa [update_same]⟩,
          update_le_iff.2 ⟨hb.le, fun _ _ ↦ hab _⟩, i, by rwa [update_same]⟩
instance {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, DenselyOrdered (α i)] :
    DenselyOrdered (∀ i, α i) :=
  ⟨fun a b ↦ by
    classical
      

Proof state:
ι : Type u_1
α✝ : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α✝ → α✝ → Prop
α : ι → Type u_3
inst✝¹ : (i : ι) → Preorder (α i)
inst✝ : ∀ (i : ι), DenselyOrdered (α i)
a b : (i : ι) → α i
⊢ a < b → ∃ a_2, a < a_2 ∧ a_2 < b

Next tactic:
simp_rw [Pi.lt_def]
instance {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, DenselyOrdered (α i)] :
    DenselyOrdered (∀ i, α i) :=
  ⟨fun a b ↦ by
    classical
      simp_rw [Pi.lt_def]
      

Proof state:
ι : Type u_1
α✝ : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α✝ → α✝ → Prop
α : ι → Type u_3
inst✝¹ : (i : ι) → Preorder (α i)
inst✝ : ∀ (i : ι), DenselyOrdered (α i)
a b : (i : ι) → α i
⊢ (a ≤ b ∧ ∃ i, a i < b i) → ∃ a_2, (a ≤ a_2 ∧ ∃ i, a i < a_2 i) ∧ a_2 ≤ b ∧ ∃ i, a_2 i < b i

Next tactic:
rintro ⟨hab, i, hi⟩
instance {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, DenselyOrdered (α i)] :
    DenselyOrdered (∀ i, α i) :=
  ⟨fun a b ↦ by
    classical
      simp_rw [Pi.lt_def]
      rintro ⟨hab, i, hi⟩
      

Proof state:
case intro.intro
ι : Type u_1
α✝ : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α✝ → α✝ → Prop
α : ι → Type u_3
inst✝¹ : (i : ι) → Preorder (α i)
inst✝ : ∀ (i : ι), DenselyOrdered (α i)
a b : (i : ι) → α i
hab : a ≤ b
i : ι
hi : a i < b i
⊢ ∃ a_1, (a ≤ a_1 ∧ ∃ i, a i < a_1 i) ∧ a_1 ≤ b ∧ ∃ i, a_1 i < b i

Next tactic:
obtain ⟨c, ha, hb⟩ := exists_between hi
instance {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, DenselyOrdered (α i)] :
    DenselyOrdered (∀ i, α i) :=
  ⟨fun a b ↦ by
    classical
      simp_rw [Pi.lt_def]
      rintro ⟨hab, i, hi⟩
      obtain ⟨c, ha, hb⟩ := exists_between hi
      

Proof state:
case intro.intro.intro.intro
ι : Type u_1
α✝ : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α✝ → α✝ → Prop
α : ι → Type u_3
inst✝¹ : (i : ι) → Preorder (α i)
inst✝ : ∀ (i : ι), DenselyOrdered (α i)
a b : (i : ι) → α i
hab : a ≤ b
i : ι
hi : a i < b i
c : α i
ha : a i < c
hb : c < b i
⊢ ∃ a_1, (a ≤ a_1 ∧ ∃ i, a i < a_1 i) ∧ a_1 ≤ b ∧ ∃ i, a_1 i < b i

Next tactic:
exact
        ⟨Function.update a i c,
          ⟨le_update_iff.2 ⟨ha.le, fun _ _ ↦ le_rfl⟩, i, by rwa [update_same]⟩,
          update_le_iff.2 ⟨hb.le, fun _ _ ↦ hab _⟩, i, by rwa [update_same]⟩
instance {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, DenselyOrdered (α i)] :
    DenselyOrdered (∀ i, α i) :=
  ⟨fun a b ↦ by
    classical
      simp_rw [Pi.lt_def]
      rintro ⟨hab, i, hi⟩
      obtain ⟨c, ha, hb⟩ := exists_between hi
      exact
        ⟨Function.update a i c,
          ⟨le_update_iff.2 ⟨ha.le, fun _ _ ↦ le_rfl⟩, i, by 

Proof state:
ι : Type u_1
α✝ : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α✝ → α✝ → Prop
α : ι → Type u_3
inst✝¹ : (i : ι) → Preorder (α i)
inst✝ : ∀ (i : ι), DenselyOrdered (α i)
a b : (i : ι) → α i
hab : a ≤ b
i : ι
hi : a i < b i
c : α i
ha : a i < c
hb : c < b i
⊢ a i < update a i c i

Next tactic:
rwa [update_same]
instance {α : ι → Type*} [∀ i, Preorder (α i)] [∀ i, DenselyOrdered (α i)] :
    DenselyOrdered (∀ i, α i) :=
  ⟨fun a b ↦ by
    classical
      simp_rw [Pi.lt_def]
      rintro ⟨hab, i, hi⟩
      obtain ⟨c, ha, hb⟩ := exists_between hi
      exact
        ⟨Function.update a i c,
          ⟨le_update_iff.2 ⟨ha.le, fun _ _ ↦ le_rfl⟩, i, by rwa [update_same]⟩,
          update_le_iff.2 ⟨hb.le, fun _ _ ↦ hab _⟩, i, by 

Proof state:
ι : Type u_1
α✝ : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α✝ → α✝ → Prop
α : ι → Type u_3
inst✝¹ : (i : ι) → Preorder (α i)
inst✝ : ∀ (i : ι), DenselyOrdered (α i)
a b : (i : ι) → α i
hab : a ≤ b
i : ι
hi : a i < b i
c : α i
ha : a i < c
hb : c < b i
⊢ update a i c i < b i

Next tactic:
rwa [update_same]
/-- If a linear order has no elements `x < y < z`, then it has at most two elements. -/
lemma eq_or_eq_or_eq_of_forall_not_lt_lt [LinearOrder α]
    (h : ∀ ⦃x y z : α⦄, x < y → y < z → False) (x y z : α) : x = y ∨ y = z ∨ x = z := by
  

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝ : LinearOrder α
h : ∀ ⦃x y z : α⦄, x < y → y < z → False
x y z : α
⊢ x = y ∨ y = z ∨ x = z

Next tactic:
by_contra hne
/-- If a linear order has no elements `x < y < z`, then it has at most two elements. -/
lemma eq_or_eq_or_eq_of_forall_not_lt_lt [LinearOrder α]
    (h : ∀ ⦃x y z : α⦄, x < y → y < z → False) (x y z : α) : x = y ∨ y = z ∨ x = z := by
  by_contra hne
  

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝ : LinearOrder α
h : ∀ ⦃x y z : α⦄, x < y → y < z → False
x y z : α
hne : ¬(x = y ∨ y = z ∨ x = z)
⊢ False

Next tactic:
simp only [not_or, ← Ne.def] at hne
/-- If a linear order has no elements `x < y < z`, then it has at most two elements. -/
lemma eq_or_eq_or_eq_of_forall_not_lt_lt [LinearOrder α]
    (h : ∀ ⦃x y z : α⦄, x < y → y < z → False) (x y z : α) : x = y ∨ y = z ∨ x = z := by
  by_contra hne
  simp only [not_or, ← Ne.def] at hne
  

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝ : LinearOrder α
h : ∀ ⦃x y z : α⦄, x < y → y < z → False
x y z : α
hne : x ≠ y ∧ y ≠ z ∧ x ≠ z
⊢ False

Next tactic:
cases' hne.1.lt_or_lt with h₁ h₁
/-- If a linear order has no elements `x < y < z`, then it has at most two elements. -/
lemma eq_or_eq_or_eq_of_forall_not_lt_lt [LinearOrder α]
    (h : ∀ ⦃x y z : α⦄, x < y → y < z → False) (x y z : α) : x = y ∨ y = z ∨ x = z := by
  by_contra hne
  simp only [not_or, ← Ne.def] at hne
  cases' hne.1.lt_or_lt with h₁ h₁ <;> 

Proof state:
case inl
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝ : LinearOrder α
h : ∀ ⦃x y z : α⦄, x < y → y < z → False
x y z : α
hne : x ≠ y ∧ y ≠ z ∧ x ≠ z
h₁ : x < y
⊢ False

Next tactic:
cases' hne.2.1.lt_or_lt with h₂ h₂
/-- If a linear order has no elements `x < y < z`, then it has at most two elements. -/
lemma eq_or_eq_or_eq_of_forall_not_lt_lt [LinearOrder α]
    (h : ∀ ⦃x y z : α⦄, x < y → y < z → False) (x y z : α) : x = y ∨ y = z ∨ x = z := by
  by_contra hne
  simp only [not_or, ← Ne.def] at hne
  cases' hne.1.lt_or_lt with h₁ h₁ <;> 

Proof state:
case inr
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝ : LinearOrder α
h : ∀ ⦃x y z : α⦄, x < y → y < z → False
x y z : α
hne : x ≠ y ∧ y ≠ z ∧ x ≠ z
h₁ : y < x
⊢ False

Next tactic:
cases' hne.2.1.lt_or_lt with h₂ h₂
/-- If a linear order has no elements `x < y < z`, then it has at most two elements. -/
lemma eq_or_eq_or_eq_of_forall_not_lt_lt [LinearOrder α]
    (h : ∀ ⦃x y z : α⦄, x < y → y < z → False) (x y z : α) : x = y ∨ y = z ∨ x = z := by
  by_contra hne
  simp only [not_or, ← Ne.def] at hne
  cases' hne.1.lt_or_lt with h₁ h₁ <;> cases' hne.2.1.lt_or_lt with h₂ h₂ <;>
    

Proof state:
case inl.inl
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝ : LinearOrder α
h : ∀ ⦃x y z : α⦄, x < y → y < z → False
x y z : α
hne : x ≠ y ∧ y ≠ z ∧ x ≠ z
h₁ : x < y
h₂ : y < z
⊢ False

Next tactic:
cases' hne.2.2.lt_or_lt with h₃ h₃
/-- If a linear order has no elements `x < y < z`, then it has at most two elements. -/
lemma eq_or_eq_or_eq_of_forall_not_lt_lt [LinearOrder α]
    (h : ∀ ⦃x y z : α⦄, x < y → y < z → False) (x y z : α) : x = y ∨ y = z ∨ x = z := by
  by_contra hne
  simp only [not_or, ← Ne.def] at hne
  cases' hne.1.lt_or_lt with h₁ h₁ <;> cases' hne.2.1.lt_or_lt with h₂ h₂ <;>
    

Proof state:
case inl.inr
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝ : LinearOrder α
h : ∀ ⦃x y z : α⦄, x < y → y < z → False
x y z : α
hne : x ≠ y ∧ y ≠ z ∧ x ≠ z
h₁ : x < y
h₂ : z < y
⊢ False

Next tactic:
cases' hne.2.2.lt_or_lt with h₃ h₃
/-- If a linear order has no elements `x < y < z`, then it has at most two elements. -/
lemma eq_or_eq_or_eq_of_forall_not_lt_lt [LinearOrder α]
    (h : ∀ ⦃x y z : α⦄, x < y → y < z → False) (x y z : α) : x = y ∨ y = z ∨ x = z := by
  by_contra hne
  simp only [not_or, ← Ne.def] at hne
  cases' hne.1.lt_or_lt with h₁ h₁ <;> cases' hne.2.1.lt_or_lt with h₂ h₂ <;>
    

Proof state:
case inr.inl
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝ : LinearOrder α
h : ∀ ⦃x y z : α⦄, x < y → y < z → False
x y z : α
hne : x ≠ y ∧ y ≠ z ∧ x ≠ z
h₁ : y < x
h₂ : y < z
⊢ False

Next tactic:
cases' hne.2.2.lt_or_lt with h₃ h₃
/-- If a linear order has no elements `x < y < z`, then it has at most two elements. -/
lemma eq_or_eq_or_eq_of_forall_not_lt_lt [LinearOrder α]
    (h : ∀ ⦃x y z : α⦄, x < y → y < z → False) (x y z : α) : x = y ∨ y = z ∨ x = z := by
  by_contra hne
  simp only [not_or, ← Ne.def] at hne
  cases' hne.1.lt_or_lt with h₁ h₁ <;> cases' hne.2.1.lt_or_lt with h₂ h₂ <;>
    

Proof state:
case inr.inr
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝ : LinearOrder α
h : ∀ ⦃x y z : α⦄, x < y → y < z → False
x y z : α
hne : x ≠ y ∧ y ≠ z ∧ x ≠ z
h₁ : y < x
h₂ : z < y
⊢ False

Next tactic:
cases' hne.2.2.lt_or_lt with h₃ h₃
/-- If a linear order has no elements `x < y < z`, then it has at most two elements. -/
lemma eq_or_eq_or_eq_of_forall_not_lt_lt [LinearOrder α]
    (h : ∀ ⦃x y z : α⦄, x < y → y < z → False) (x y z : α) : x = y ∨ y = z ∨ x = z := by
  by_contra hne
  simp only [not_or, ← Ne.def] at hne
  cases' hne.1.lt_or_lt with h₁ h₁ <;> cases' hne.2.1.lt_or_lt with h₂ h₂ <;>
    cases' hne.2.2.lt_or_lt with h₃ h₃
  

Proof state:
case inl.inl.inl
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝ : LinearOrder α
h : ∀ ⦃x y z : α⦄, x < y → y < z → False
x y z : α
hne : x ≠ y ∧ y ≠ z ∧ x ≠ z
h₁ : x < y
h₂ : y < z
h₃ : x < z
⊢ False
case inl.inl.inr
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝ : LinearOrder α
h : ∀ ⦃x y z : α⦄, x < y → y < z → False
x y z : α
hne : x ≠ y ∧ y ≠ z ∧ x ≠ z
h₁ : x < y
h₂ : y < z
h₃ : z < x
⊢ False
case inl.inr.inl
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝ : LinearOrder α
h : ∀ ⦃x y z : α⦄, x < y → y < z → False
x y z : α
hne : x ≠ y ∧ y ≠ z ∧ x ≠ z
h₁ : x < y
h₂ : z < y
h₃ : x < z
⊢ False
case inl.inr.inr
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝ : LinearOrder α
h : ∀ ⦃x y z : α⦄, x < y → y < z → False
x y z : α
hne : x ≠ y ∧ y ≠ z ∧ x ≠ z
h₁ : x < y
h₂ : z < y
h₃ : z < x
⊢ False
case inr.inl.inl
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝ : LinearOrder α
h : ∀ ⦃x y z : α⦄, x < y → y < z → False
x y z : α
hne : x ≠ y ∧ y ≠ z ∧ x ≠ z
h₁ : y < x
h₂ : y < z
h₃ : x < z
⊢ False
case inr.inl.inr
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝ : LinearOrder α
h : ∀ ⦃x y z : α⦄, x < y → y < z → False
x y z : α
hne : x ≠ y ∧ y ≠ z ∧ x ≠ z
h₁ : y < x
h₂ : y < z
h₃ : z < x
⊢ False
case inr.inr.inl
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝ : LinearOrder α
h : ∀ ⦃x y z : α⦄, x < y → y < z → False
x y z : α
hne : x ≠ y ∧ y ≠ z ∧ x ≠ z
h₁ : y < x
h₂ : z < y
h₃ : x < z
⊢ False
case inr.inr.inr
ι : Type u_1
α : Type u
β : Type v
γ : Type w
π : ι → Type u_2
r : α → α → Prop
inst✝ : LinearOrder α
h : ∀ ⦃x y z : α⦄, x < y → y < z → False
x y z : α
hne : x ≠ y ∧ y ≠ z ∧ x ≠ z
h₁ : y < x
h₂ : z < y
h₃ : z < x
⊢ False

Next tactic:
exacts [h h₁ h₂, h h₂ h₃, h h₃ h₂, h h₃ h₁, h h₁ h₃, h h₂ h₃, h h₁ h₃, h h₂ h₁]