l3lab/ntp-mathlib huggingface dataset:
theorem MonotoneOn.map_max (hf : MonotoneOn f s) (ha : a ∈ s) (hb : b ∈ s) : f (max a b) =
    max (f a) (f b) := by
  rcases le_total a b with h | h <;>
    

Proof state:
case inl
α : Type u
β : Type v
inst✝¹ : LinearOrder α
inst✝ : LinearOrder β
f : α → β
s : Set α
a b c d : α
hf : MonotoneOn f s
ha : a ∈ s
hb : b ∈ s
h : a ≤ b
⊢ f (max a b) = max (f a) (f b)

Next tactic:
simp only [max_eq_right, max_eq_left, hf ha hb, hf hb ha, h]
theorem MonotoneOn.map_max (hf : MonotoneOn f s) (ha : a ∈ s) (hb : b ∈ s) : f (max a b) =
    max (f a) (f b) := by
  rcases le_total a b with h | h <;>
    

Proof state:
case inr
α : Type u
β : Type v
inst✝¹ : LinearOrder α
inst✝ : LinearOrder β
f : α → β
s : Set α
a b c d : α
hf : MonotoneOn f s
ha : a ∈ s
hb : b ∈ s
h : b ≤ a
⊢ f (max a b) = max (f a) (f b)

Next tactic:
simp only [max_eq_right, max_eq_left, hf ha hb, hf hb ha, h]
theorem Monotone.map_max (hf : Monotone f) : f (max a b) = max (f a) (f b) := by
  

Proof state:
α : Type u
β : Type v
inst✝¹ : LinearOrder α
inst✝ : LinearOrder β
f : α → β
s : Set α
a b c d : α
hf : Monotone f
⊢ f (max a b) = max (f a) (f b)

Next tactic:
rcases le_total a b with h | h
theorem Monotone.map_max (hf : Monotone f) : f (max a b) = max (f a) (f b) := by
  rcases le_total a b with h | h <;> 

Proof state:
case inl
α : Type u
β : Type v
inst✝¹ : LinearOrder α
inst✝ : LinearOrder β
f : α → β
s : Set α
a b c d : α
hf : Monotone f
h : a ≤ b
⊢ f (max a b) = max (f a) (f b)

Next tactic:
simp [h, hf h]
theorem Monotone.map_max (hf : Monotone f) : f (max a b) = max (f a) (f b) := by
  rcases le_total a b with h | h <;> 

Proof state:
case inr
α : Type u
β : Type v
inst✝¹ : LinearOrder α
inst✝ : LinearOrder β
f : α → β
s : Set α
a b c d : α
hf : Monotone f
h : b ≤ a
⊢ f (max a b) = max (f a) (f b)

Next tactic:
simp [h, hf h]
theorem Antitone.map_max (hf : Antitone f) : f (max a b) = min (f a) (f b) := by
  

Proof state:
α : Type u
β : Type v
inst✝¹ : LinearOrder α
inst✝ : LinearOrder β
f : α → β
s : Set α
a b c d : α
hf : Antitone f
⊢ f (max a b) = min (f a) (f b)

Next tactic:
rcases le_total a b with h | h
theorem Antitone.map_max (hf : Antitone f) : f (max a b) = min (f a) (f b) := by
  rcases le_total a b with h | h <;> 

Proof state:
case inl
α : Type u
β : Type v
inst✝¹ : LinearOrder α
inst✝ : LinearOrder β
f : α → β
s : Set α
a b c d : α
hf : Antitone f
h : a ≤ b
⊢ f (max a b) = min (f a) (f b)

Next tactic:
simp [h, hf h]
theorem Antitone.map_max (hf : Antitone f) : f (max a b) = min (f a) (f b) := by
  rcases le_total a b with h | h <;> 

Proof state:
case inr
α : Type u
β : Type v
inst✝¹ : LinearOrder α
inst✝ : LinearOrder β
f : α → β
s : Set α
a b c d : α
hf : Antitone f
h : b ≤ a
⊢ f (max a b) = min (f a) (f b)

Next tactic:
simp [h, hf h]
theorem min_choice (a b : α) : min a b = a ∨ min a b = b := by 

Proof state:
α : Type u
β : Type v
inst✝¹ : LinearOrder α
inst✝ : LinearOrder β
f : α → β
s : Set α
a✝ b✝ c d a b : α
⊢ min a b = a ∨ min a b = b

Next tactic:
cases le_total a b
theorem min_choice (a b : α) : min a b = a ∨ min a b = b := by cases le_total a b <;> 

Proof state:
case inl
α : Type u
β : Type v
inst✝¹ : LinearOrder α
inst✝ : LinearOrder β
f : α → β
s : Set α
a✝ b✝ c d a b : α
h✝ : a ≤ b
⊢ min a b = a ∨ min a b = b

Next tactic:
simp [*]
theorem min_choice (a b : α) : min a b = a ∨ min a b = b := by cases le_total a b <;> 

Proof state:
case inr
α : Type u
β : Type v
inst✝¹ : LinearOrder α
inst✝ : LinearOrder β
f : α → β
s : Set α
a✝ b✝ c d a b : α
h✝ : b ≤ a
⊢ min a b = a ∨ min a b = b

Next tactic:
simp [*]
theorem lex_lt_of_lt [∀ i, PartialOrder (β i)] {r} (hwf : WellFounded r) {x y : ∀ i, β i}
    (hlt : x < y) : Pi.Lex r (@fun i => (· < ·)) x y := by
  

Proof state:
ι : Type u_1
β : ι → Type u_2
r✝ : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝ : (i : ι) → PartialOrder (β i)
r : ι → ι → Prop
hwf : WellFounded r
x y : (i : ι) → β i
hlt : x < y
⊢ Pi.Lex r (fun i x x_1 => x < x_1) x y

Next tactic:
simp_rw [Pi.Lex, le_antisymm_iff]
theorem lex_lt_of_lt [∀ i, PartialOrder (β i)] {r} (hwf : WellFounded r) {x y : ∀ i, β i}
    (hlt : x < y) : Pi.Lex r (@fun i => (· < ·)) x y := by
  simp_rw [Pi.Lex, le_antisymm_iff]
  

Proof state:
ι : Type u_1
β : ι → Type u_2
r✝ : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝ : (i : ι) → PartialOrder (β i)
r : ι → ι → Prop
hwf : WellFounded r
x y : (i : ι) → β i
hlt : x < y
⊢ ∃ i, (∀ (j : ι), r j i → x j ≤ y j ∧ y j ≤ x j) ∧ x i < y i

Next tactic:
exact lex_lt_of_lt_of_preorder hwf hlt
theorem isTrichotomous_lex [∀ i, IsTrichotomous (β i) s] (wf : WellFounded r) :
    IsTrichotomous (∀ i, β i) (Pi.Lex r @s) :=
  { trichotomous := fun a b => by
      

Proof state:
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝ : ∀ (i : ι), IsTrichotomous (β i) s
wf : WellFounded r
a b : (i : ι) → β i
⊢ Pi.Lex r s a b ∨ a = b ∨ Pi.Lex r s b a

Next tactic:
rcases eq_or_ne a b with hab | hab
theorem isTrichotomous_lex [∀ i, IsTrichotomous (β i) s] (wf : WellFounded r) :
    IsTrichotomous (∀ i, β i) (Pi.Lex r @s) :=
  { trichotomous := fun a b => by
      rcases eq_or_ne a b with hab | hab
      · 

Proof state:
case inl
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝ : ∀ (i : ι), IsTrichotomous (β i) s
wf : WellFounded r
a b : (i : ι) → β i
hab : a = b
⊢ Pi.Lex r s a b ∨ a = b ∨ Pi.Lex r s b a

Next tactic:
exact Or.inr (Or.inl hab)
theorem isTrichotomous_lex [∀ i, IsTrichotomous (β i) s] (wf : WellFounded r) :
    IsTrichotomous (∀ i, β i) (Pi.Lex r @s) :=
  { trichotomous := fun a b => by
      rcases eq_or_ne a b with hab | hab
      · exact Or.inr (Or.inl hab)
      · 

Proof state:
case inr
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝ : ∀ (i : ι), IsTrichotomous (β i) s
wf : WellFounded r
a b : (i : ι) → β i
hab : a ≠ b
⊢ Pi.Lex r s a b ∨ a = b ∨ Pi.Lex r s b a

Next tactic:
rw [Function.ne_iff] at hab
theorem isTrichotomous_lex [∀ i, IsTrichotomous (β i) s] (wf : WellFounded r) :
    IsTrichotomous (∀ i, β i) (Pi.Lex r @s) :=
  { trichotomous := fun a b => by
      rcases eq_or_ne a b with hab | hab
      · exact Or.inr (Or.inl hab)
      · rw [Function.ne_iff] at hab
        

Proof state:
case inr
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝ : ∀ (i : ι), IsTrichotomous (β i) s
wf : WellFounded r
a b : (i : ι) → β i
hab : ∃ a_1, a a_1 ≠ b a_1
⊢ Pi.Lex r s a b ∨ a = b ∨ Pi.Lex r s b a

Next tactic:
let i := wf.min _ hab
theorem isTrichotomous_lex [∀ i, IsTrichotomous (β i) s] (wf : WellFounded r) :
    IsTrichotomous (∀ i, β i) (Pi.Lex r @s) :=
  { trichotomous := fun a b => by
      rcases eq_or_ne a b with hab | hab
      · exact Or.inr (Or.inl hab)
      · rw [Function.ne_iff] at hab
        let i := wf.min _ hab
        

Proof state:
case inr
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝ : ∀ (i : ι), IsTrichotomous (β i) s
wf : WellFounded r
a b : (i : ι) → β i
hab : ∃ a_1, a a_1 ≠ b a_1
i : ι := WellFounded.min wf (fun x => a x = b x → False) hab
⊢ Pi.Lex r s a b ∨ a = b ∨ Pi.Lex r s b a

Next tactic:
have hri : ∀ j, r j i → a j = b j := by
          intro j
          rw [← not_imp_not]
          exact fun h' => wf.not_lt_min _ _ h'
theorem isTrichotomous_lex [∀ i, IsTrichotomous (β i) s] (wf : WellFounded r) :
    IsTrichotomous (∀ i, β i) (Pi.Lex r @s) :=
  { trichotomous := fun a b => by
      rcases eq_or_ne a b with hab | hab
      · exact Or.inr (Or.inl hab)
      · rw [Function.ne_iff] at hab
        let i := wf.min _ hab
        have hri : ∀ j, r j i → a j = b j := by
          

Proof state:
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝ : ∀ (i : ι), IsTrichotomous (β i) s
wf : WellFounded r
a b : (i : ι) → β i
hab : ∃ a_1, a a_1 ≠ b a_1
i : ι := WellFounded.min wf (fun x => a x = b x → False) hab
⊢ ∀ (j : ι), r j i → a j = b j

Next tactic:
intro j
theorem isTrichotomous_lex [∀ i, IsTrichotomous (β i) s] (wf : WellFounded r) :
    IsTrichotomous (∀ i, β i) (Pi.Lex r @s) :=
  { trichotomous := fun a b => by
      rcases eq_or_ne a b with hab | hab
      · exact Or.inr (Or.inl hab)
      · rw [Function.ne_iff] at hab
        let i := wf.min _ hab
        have hri : ∀ j, r j i → a j = b j := by
          intro j
          

Proof state:
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝ : ∀ (i : ι), IsTrichotomous (β i) s
wf : WellFounded r
a b : (i : ι) → β i
hab : ∃ a_1, a a_1 ≠ b a_1
i : ι := WellFounded.min wf (fun x => a x = b x → False) hab
j : ι
⊢ r j i → a j = b j

Next tactic:
rw [← not_imp_not]
theorem isTrichotomous_lex [∀ i, IsTrichotomous (β i) s] (wf : WellFounded r) :
    IsTrichotomous (∀ i, β i) (Pi.Lex r @s) :=
  { trichotomous := fun a b => by
      rcases eq_or_ne a b with hab | hab
      · exact Or.inr (Or.inl hab)
      · rw [Function.ne_iff] at hab
        let i := wf.min _ hab
        have hri : ∀ j, r j i → a j = b j := by
          intro j
          rw [← not_imp_not]
          

Proof state:
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝ : ∀ (i : ι), IsTrichotomous (β i) s
wf : WellFounded r
a b : (i : ι) → β i
hab : ∃ a_1, a a_1 ≠ b a_1
i : ι := WellFounded.min wf (fun x => a x = b x → False) hab
j : ι
⊢ ¬a j = b j → ¬r j i

Next tactic:
exact fun h' => wf.not_lt_min _ _ h'
theorem isTrichotomous_lex [∀ i, IsTrichotomous (β i) s] (wf : WellFounded r) :
    IsTrichotomous (∀ i, β i) (Pi.Lex r @s) :=
  { trichotomous := fun a b => by
      rcases eq_or_ne a b with hab | hab
      · exact Or.inr (Or.inl hab)
      · rw [Function.ne_iff] at hab
        let i := wf.min _ hab
        have hri : ∀ j, r j i → a j = b j := by
          intro j
          rw [← not_imp_not]
          exact fun h' => wf.not_lt_min _ _ h'
        

Proof state:
case inr
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝ : ∀ (i : ι), IsTrichotomous (β i) s
wf : WellFounded r
a b : (i : ι) → β i
hab : ∃ a_1, a a_1 ≠ b a_1
i : ι := WellFounded.min wf (fun x => a x = b x → False) hab
hri : ∀ (j : ι), r j i → a j = b j
⊢ Pi.Lex r s a b ∨ a = b ∨ Pi.Lex r s b a

Next tactic:
have hne : a i ≠ b i := wf.min_mem _ hab
theorem isTrichotomous_lex [∀ i, IsTrichotomous (β i) s] (wf : WellFounded r) :
    IsTrichotomous (∀ i, β i) (Pi.Lex r @s) :=
  { trichotomous := fun a b => by
      rcases eq_or_ne a b with hab | hab
      · exact Or.inr (Or.inl hab)
      · rw [Function.ne_iff] at hab
        let i := wf.min _ hab
        have hri : ∀ j, r j i → a j = b j := by
          intro j
          rw [← not_imp_not]
          exact fun h' => wf.not_lt_min _ _ h'
        have hne : a i ≠ b i := wf.min_mem _ hab
        

Proof state:
case inr
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝ : ∀ (i : ι), IsTrichotomous (β i) s
wf : WellFounded r
a b : (i : ι) → β i
hab : ∃ a_1, a a_1 ≠ b a_1
i : ι := WellFounded.min wf (fun x => a x = b x → False) hab
hri : ∀ (j : ι), r j i → a j = b j
hne : a i ≠ b i
⊢ Pi.Lex r s a b ∨ a = b ∨ Pi.Lex r s b a

Next tactic:
cases' trichotomous_of s (a i) (b i) with hi hi
theorem isTrichotomous_lex [∀ i, IsTrichotomous (β i) s] (wf : WellFounded r) :
    IsTrichotomous (∀ i, β i) (Pi.Lex r @s) :=
  { trichotomous := fun a b => by
      rcases eq_or_ne a b with hab | hab
      · exact Or.inr (Or.inl hab)
      · rw [Function.ne_iff] at hab
        let i := wf.min _ hab
        have hri : ∀ j, r j i → a j = b j := by
          intro j
          rw [← not_imp_not]
          exact fun h' => wf.not_lt_min _ _ h'
        have hne : a i ≠ b i := wf.min_mem _ hab
        cases' trichotomous_of s (a i) (b i) with hi hi
        

Proof state:
case inr.inl
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝ : ∀ (i : ι), IsTrichotomous (β i) s
wf : WellFounded r
a b : (i : ι) → β i
hab : ∃ a_1, a a_1 ≠ b a_1
i : ι := WellFounded.min wf (fun x => a x = b x → False) hab
hri : ∀ (j : ι), r j i → a j = b j
hne : a i ≠ b i
hi : s (a i) (b i)
⊢ Pi.Lex r s a b ∨ a = b ∨ Pi.Lex r s b a
case inr.inr
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝ : ∀ (i : ι), IsTrichotomous (β i) s
wf : WellFounded r
a b : (i : ι) → β i
hab : ∃ a_1, a a_1 ≠ b a_1
i : ι := WellFounded.min wf (fun x => a x = b x → False) hab
hri : ∀ (j : ι), r j i → a j = b j
hne : a i ≠ b i
hi : a i = b i ∨ s (b i) (a i)
⊢ Pi.Lex r s a b ∨ a = b ∨ Pi.Lex r s b a

Next tactic:
exacts [Or.inl ⟨i, hri, hi⟩,
          Or.inr <| Or.inr <| ⟨i, fun j hj => (hri j hj).symm, hi.resolve_left hne⟩]
instance Lex.isStrictOrder [LinearOrder ι] [∀ a, PartialOrder (β a)] :
    IsStrictOrder (Lex (∀ i, β i)) (· < ·) where
  irrefl := fun a ⟨k, _, hk₂⟩ => lt_irrefl (a k) hk₂
  trans := by
    

Proof state:
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝¹ : LinearOrder ι
inst✝ : (a : ι) → PartialOrder (β a)
⊢ ∀ (a b c : Lex ((i : ι) → β i)), a < b → b < c → a < c

Next tactic:
rintro a b c ⟨N₁, lt_N₁, a_lt_b⟩ ⟨N₂, lt_N₂, b_lt_c⟩
instance Lex.isStrictOrder [LinearOrder ι] [∀ a, PartialOrder (β a)] :
    IsStrictOrder (Lex (∀ i, β i)) (· < ·) where
  irrefl := fun a ⟨k, _, hk₂⟩ => lt_irrefl (a k) hk₂
  trans := by
    rintro a b c ⟨N₁, lt_N₁, a_lt_b⟩ ⟨N₂, lt_N₂, b_lt_c⟩
    

Proof state:
case intro.intro.intro.intro
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝¹ : LinearOrder ι
inst✝ : (a : ι) → PartialOrder (β a)
a b c : Lex ((i : ι) → β i)
N₁ : ι
lt_N₁ : ∀ (j : ι), (fun x x_1 => x < x_1) j N₁ → a j = b j
a_lt_b : a N₁ < b N₁
N₂ : ι
lt_N₂ : ∀ (j : ι), (fun x x_1 => x < x_1) j N₂ → b j = c j
b_lt_c : b N₂ < c N₂
⊢ a < c

Next tactic:
rcases lt_trichotomy N₁ N₂ with (H | rfl | H)
instance Lex.isStrictOrder [LinearOrder ι] [∀ a, PartialOrder (β a)] :
    IsStrictOrder (Lex (∀ i, β i)) (· < ·) where
  irrefl := fun a ⟨k, _, hk₂⟩ => lt_irrefl (a k) hk₂
  trans := by
    rintro a b c ⟨N₁, lt_N₁, a_lt_b⟩ ⟨N₂, lt_N₂, b_lt_c⟩
    rcases lt_trichotomy N₁ N₂ with (H | rfl | H)
    

Proof state:
case intro.intro.intro.intro.inl
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝¹ : LinearOrder ι
inst✝ : (a : ι) → PartialOrder (β a)
a b c : Lex ((i : ι) → β i)
N₁ : ι
lt_N₁ : ∀ (j : ι), (fun x x_1 => x < x_1) j N₁ → a j = b j
a_lt_b : a N₁ < b N₁
N₂ : ι
lt_N₂ : ∀ (j : ι), (fun x x_1 => x < x_1) j N₂ → b j = c j
b_lt_c : b N₂ < c N₂
H : N₁ < N₂
⊢ a < c
case intro.intro.intro.intro.inr.inl
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝¹ : LinearOrder ι
inst✝ : (a : ι) → PartialOrder (β a)
a b c : Lex ((i : ι) → β i)
N₁ : ι
lt_N₁ : ∀ (j : ι), (fun x x_1 => x < x_1) j N₁ → a j = b j
a_lt_b : a N₁ < b N₁
lt_N₂ : ∀ (j : ι), (fun x x_1 => x < x_1) j N₁ → b j = c j
b_lt_c : b N₁ < c N₁
⊢ a < c
case intro.intro.intro.intro.inr.inr
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝¹ : LinearOrder ι
inst✝ : (a : ι) → PartialOrder (β a)
a b c : Lex ((i : ι) → β i)
N₁ : ι
lt_N₁ : ∀ (j : ι), (fun x x_1 => x < x_1) j N₁ → a j = b j
a_lt_b : a N₁ < b N₁
N₂ : ι
lt_N₂ : ∀ (j : ι), (fun x x_1 => x < x_1) j N₂ → b j = c j
b_lt_c : b N₂ < c N₂
H : N₂ < N₁
⊢ a < c

Next tactic:
exacts [⟨N₁, fun j hj => (lt_N₁ _ hj).trans (lt_N₂ _ <| hj.trans H), lt_N₂ _ H ▸ a_lt_b⟩,
      ⟨N₁, fun j hj => (lt_N₁ _ hj).trans (lt_N₂ _ hj), a_lt_b.trans b_lt_c⟩,
      ⟨N₂, fun j hj => (lt_N₁ _ (hj.trans H)).trans (lt_N₂ _ hj), (lt_N₁ _ H).symm ▸ b_lt_c⟩]
theorem toLex_monotone : Monotone (@toLex (∀ i, β i)) := fun a b h =>
  or_iff_not_imp_left.2 fun hne =>
    let ⟨i, hi, hl⟩ := IsWellFounded.wf.has_min (r := (· < · )) { i | a i ≠ b i }
      (Function.ne_iff.1 hne)
    ⟨i, fun j hj => by
      

Proof state:
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝² : LinearOrder ι
inst✝¹ : IsWellOrder ι fun x x_1 => x < x_1
inst✝ : (i : ι) → PartialOrder (β i)
x y : (i : ι) → β i
i✝ : ι
a✝ : β i✝
a b : (i : ι) → β i
h : a ≤ b
hne : ¬toLex a = toLex b
i : ι
hi : i ∈ {i | a i ≠ b i}
hl : ∀ x ∈ {i | a i ≠ b i}, ¬x < i
j : ι
hj : (fun x x_1 => x < x_1) j i
⊢ toLex a j = toLex b j

Next tactic:
contrapose! hl
theorem toLex_monotone : Monotone (@toLex (∀ i, β i)) := fun a b h =>
  or_iff_not_imp_left.2 fun hne =>
    let ⟨i, hi, hl⟩ := IsWellFounded.wf.has_min (r := (· < · )) { i | a i ≠ b i }
      (Function.ne_iff.1 hne)
    ⟨i, fun j hj => by
      contrapose! hl
      

Proof state:
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝² : LinearOrder ι
inst✝¹ : IsWellOrder ι fun x x_1 => x < x_1
inst✝ : (i : ι) → PartialOrder (β i)
x y : (i : ι) → β i
i✝ : ι
a✝ : β i✝
a b : (i : ι) → β i
h : a ≤ b
hne : ¬toLex a = toLex b
i : ι
hi : i ∈ {i | a i ≠ b i}
j : ι
hj : (fun x x_1 => x < x_1) j i
hl : toLex a j ≠ toLex b j
⊢ ∃ x ∈ {i | a i ≠ b i}, x < i

Next tactic:
exact ⟨j, hl, hj⟩
theorem toLex_strictMono : StrictMono (@toLex (∀ i, β i)) := fun a b h =>
  let ⟨i, hi, hl⟩ := IsWellFounded.wf.has_min (r := (· < · )) { i | a i ≠ b i }
    (Function.ne_iff.1 h.ne)
  ⟨i, fun j hj => by
    

Proof state:
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝² : LinearOrder ι
inst✝¹ : IsWellOrder ι fun x x_1 => x < x_1
inst✝ : (i : ι) → PartialOrder (β i)
x y : (i : ι) → β i
i✝ : ι
a✝ : β i✝
a b : (i : ι) → β i
h : a < b
i : ι
hi : i ∈ {i | a i ≠ b i}
hl : ∀ x ∈ {i | a i ≠ b i}, ¬x < i
j : ι
hj : (fun x x_1 => x < x_1) j i
⊢ toLex a j = toLex b j

Next tactic:
contrapose! hl
theorem toLex_strictMono : StrictMono (@toLex (∀ i, β i)) := fun a b h =>
  let ⟨i, hi, hl⟩ := IsWellFounded.wf.has_min (r := (· < · )) { i | a i ≠ b i }
    (Function.ne_iff.1 h.ne)
  ⟨i, fun j hj => by
    contrapose! hl
    

Proof state:
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝² : LinearOrder ι
inst✝¹ : IsWellOrder ι fun x x_1 => x < x_1
inst✝ : (i : ι) → PartialOrder (β i)
x y : (i : ι) → β i
i✝ : ι
a✝ : β i✝
a b : (i : ι) → β i
h : a < b
i : ι
hi : i ∈ {i | a i ≠ b i}
j : ι
hj : (fun x x_1 => x < x_1) j i
hl : toLex a j ≠ toLex b j
⊢ ∃ x ∈ {i | a i ≠ b i}, x < i

Next tactic:
exact ⟨j, hl, hj⟩
@[simp]
theorem lt_toLex_update_self_iff : toLex x < toLex (update x i a) ↔ x i < a := by
  

Proof state:
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝² : LinearOrder ι
inst✝¹ : IsWellOrder ι fun x x_1 => x < x_1
inst✝ : (i : ι) → PartialOrder (β i)
x y : (i : ι) → β i
i : ι
a : β i
⊢ toLex x < toLex (update x i a) ↔ x i < a

Next tactic:
refine' ⟨_, fun h => toLex_strictMono <| lt_update_self_iff.2 h⟩
@[simp]
theorem lt_toLex_update_self_iff : toLex x < toLex (update x i a) ↔ x i < a := by
  refine' ⟨_, fun h => toLex_strictMono <| lt_update_self_iff.2 h⟩
  

Proof state:
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝² : LinearOrder ι
inst✝¹ : IsWellOrder ι fun x x_1 => x < x_1
inst✝ : (i : ι) → PartialOrder (β i)
x y : (i : ι) → β i
i : ι
a : β i
⊢ toLex x < toLex (update x i a) → x i < a

Next tactic:
rintro ⟨j, hj, h⟩
@[simp]
theorem lt_toLex_update_self_iff : toLex x < toLex (update x i a) ↔ x i < a := by
  refine' ⟨_, fun h => toLex_strictMono <| lt_update_self_iff.2 h⟩
  rintro ⟨j, hj, h⟩
  

Proof state:
case intro.intro
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝² : LinearOrder ι
inst✝¹ : IsWellOrder ι fun x x_1 => x < x_1
inst✝ : (i : ι) → PartialOrder (β i)
x y : (i : ι) → β i
i : ι
a : β i
j : ι
hj : ∀ (j_1 : ι), (fun x x_1 => x < x_1) j_1 j → toLex x j_1 = toLex (update x i a) j_1
h : toLex x j < toLex (update x i a) j
⊢ x i < a

Next tactic:
dsimp at h
@[simp]
theorem lt_toLex_update_self_iff : toLex x < toLex (update x i a) ↔ x i < a := by
  refine' ⟨_, fun h => toLex_strictMono <| lt_update_self_iff.2 h⟩
  rintro ⟨j, hj, h⟩
  dsimp at h
  

Proof state:
case intro.intro
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝² : LinearOrder ι
inst✝¹ : IsWellOrder ι fun x x_1 => x < x_1
inst✝ : (i : ι) → PartialOrder (β i)
x y : (i : ι) → β i
i : ι
a : β i
j : ι
hj : ∀ (j_1 : ι), (fun x x_1 => x < x_1) j_1 j → toLex x j_1 = toLex (update x i a) j_1
h : x j < update x i a j
⊢ x i < a

Next tactic:
obtain rfl : j = i := by
    by_contra H
    rw [update_noteq H] at h
    exact h.false
@[simp]
theorem lt_toLex_update_self_iff : toLex x < toLex (update x i a) ↔ x i < a := by
  refine' ⟨_, fun h => toLex_strictMono <| lt_update_self_iff.2 h⟩
  rintro ⟨j, hj, h⟩
  dsimp at h
  obtain rfl : j = i := by
    

Proof state:
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝² : LinearOrder ι
inst✝¹ : IsWellOrder ι fun x x_1 => x < x_1
inst✝ : (i : ι) → PartialOrder (β i)
x y : (i : ι) → β i
i : ι
a : β i
j : ι
hj : ∀ (j_1 : ι), (fun x x_1 => x < x_1) j_1 j → toLex x j_1 = toLex (update x i a) j_1
h : x j < update x i a j
⊢ j = i

Next tactic:
by_contra H
@[simp]
theorem lt_toLex_update_self_iff : toLex x < toLex (update x i a) ↔ x i < a := by
  refine' ⟨_, fun h => toLex_strictMono <| lt_update_self_iff.2 h⟩
  rintro ⟨j, hj, h⟩
  dsimp at h
  obtain rfl : j = i := by
    by_contra H
    

Proof state:
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝² : LinearOrder ι
inst✝¹ : IsWellOrder ι fun x x_1 => x < x_1
inst✝ : (i : ι) → PartialOrder (β i)
x y : (i : ι) → β i
i : ι
a : β i
j : ι
hj : ∀ (j_1 : ι), (fun x x_1 => x < x_1) j_1 j → toLex x j_1 = toLex (update x i a) j_1
h : x j < update x i a j
H : ¬j = i
⊢ False

Next tactic:
rw [update_noteq H] at h
@[simp]
theorem lt_toLex_update_self_iff : toLex x < toLex (update x i a) ↔ x i < a := by
  refine' ⟨_, fun h => toLex_strictMono <| lt_update_self_iff.2 h⟩
  rintro ⟨j, hj, h⟩
  dsimp at h
  obtain rfl : j = i := by
    by_contra H
    rw [update_noteq H] at h
    

Proof state:
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝² : LinearOrder ι
inst✝¹ : IsWellOrder ι fun x x_1 => x < x_1
inst✝ : (i : ι) → PartialOrder (β i)
x y : (i : ι) → β i
i : ι
a : β i
j : ι
hj : ∀ (j_1 : ι), (fun x x_1 => x < x_1) j_1 j → toLex x j_1 = toLex (update x i a) j_1
h : x j < x j
H : ¬j = i
⊢ False

Next tactic:
exact h.false
@[simp]
theorem lt_toLex_update_self_iff : toLex x < toLex (update x i a) ↔ x i < a := by
  refine' ⟨_, fun h => toLex_strictMono <| lt_update_self_iff.2 h⟩
  rintro ⟨j, hj, h⟩
  dsimp at h
  obtain rfl : j = i := by
    by_contra H
    rw [update_noteq H] at h
    exact h.false
  

Proof state:
case intro.intro
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝² : LinearOrder ι
inst✝¹ : IsWellOrder ι fun x x_1 => x < x_1
inst✝ : (i : ι) → PartialOrder (β i)
x y : (i : ι) → β i
j : ι
a : β j
hj : ∀ (j_1 : ι), (fun x x_1 => x < x_1) j_1 j → toLex x j_1 = toLex (update x j a) j_1
h : x j < update x j a j
⊢ x j < a

Next tactic:
rwa [update_same] at h
@[simp]
theorem toLex_update_lt_self_iff : toLex (update x i a) < toLex x ↔ a < x i := by
  

Proof state:
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝² : LinearOrder ι
inst✝¹ : IsWellOrder ι fun x x_1 => x < x_1
inst✝ : (i : ι) → PartialOrder (β i)
x y : (i : ι) → β i
i : ι
a : β i
⊢ toLex (update x i a) < toLex x ↔ a < x i

Next tactic:
refine' ⟨_, fun h => toLex_strictMono <| update_lt_self_iff.2 h⟩
@[simp]
theorem toLex_update_lt_self_iff : toLex (update x i a) < toLex x ↔ a < x i := by
  refine' ⟨_, fun h => toLex_strictMono <| update_lt_self_iff.2 h⟩
  

Proof state:
ι : Type u_1
β : ι → Type u_2
r : ι → ι → Prop
s : {i : ι} → β i → β i → Prop
inst✝² : LinearOrder ι
inst✝¹ : IsWellOrder ι fun x x_1 => x < x_1
inst✝ : (i : ι) → PartialOrder (β i)
x y : (i : ι) → β i
i : ι
a : β i
⊢ toLex (update x i a) < toLex x → a < x i

Next tactic:
rintro ⟨j, hj, h⟩