l3lab/ntp-mathlib huggingface dataset:
instance : HasImageMaps (Type u) where
  has_image_map {f g} st :=
    HasImageMap.transport st (monoFactorisation f.hom) (isImage g.hom)
      (fun x => ⟨st.right x.1, ⟨st.left (Classical.choose x.2), by
        have p := st.w
        replace p := congr_fun p (Classical.choose x.2)
        

Proof state:
J : Type v
inst✝ : SmallCategory J
α β : Type u
f✝ : α ⟶ β
f g : Arrow (Type u)
st : f ⟶ g
x : (monoFactorisation f.hom).I
p :
  ((𝟭 (Type u)).map st.left ≫ g.hom) (Classical.choose (_ : ↑x ∈ Set.range f.hom)) =
    (f.hom ≫ (𝟭 (Type u)).map st.right) (Classical.choose (_ : ↑x ∈ Set.range f.hom))
⊢ Comma.hom g (CommaMorphism.left st (Classical.choose (_ : ↑x ∈ Set.range f.hom))) = CommaMorphism.right st ↑x

Next tactic:
simp only [Functor.id_obj, Functor.id_map, types_comp_apply] at p
instance : HasImageMaps (Type u) where
  has_image_map {f g} st :=
    HasImageMap.transport st (monoFactorisation f.hom) (isImage g.hom)
      (fun x => ⟨st.right x.1, ⟨st.left (Classical.choose x.2), by
        have p := st.w
        replace p := congr_fun p (Classical.choose x.2)
        simp only [Functor.id_obj, Functor.id_map, types_comp_apply] at p
        

Proof state:
J : Type v
inst✝ : SmallCategory J
α β : Type u
f✝ : α ⟶ β
f g : Arrow (Type u)
st : f ⟶ g
x : (monoFactorisation f.hom).I
p :
  Comma.hom g (CommaMorphism.left st (Classical.choose (_ : ∃ x_1, (fun x_2 => Comma.hom f x_2 = ↑x) x_1))) =
    CommaMorphism.right st (Comma.hom f (Classical.choose (_ : ∃ x_1, (fun x_2 => Comma.hom f x_2 = ↑x) x_1)))
⊢ Comma.hom g (CommaMorphism.left st (Classical.choose (_ : ↑x ∈ Set.range f.hom))) = CommaMorphism.right st ↑x

Next tactic:
erw [p, Classical.choose_spec x.2]
theorem StrictMonoOn.Iic_id_le [SuccOrder α] [IsSuccArchimedean α] [OrderBot α] {n : α} {φ : α → α}
    (hφ : StrictMonoOn φ (Set.Iic n)) : ∀ m ≤ n, m ≤ φ m := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : SuccOrder α
inst✝¹ : IsSuccArchimedean α
inst✝ : OrderBot α
n : α
φ : α → α
hφ : StrictMonoOn φ (Iic n)
⊢ ∀ m ≤ n, m ≤ φ m

Next tactic:
revert hφ
theorem StrictMonoOn.Iic_id_le [SuccOrder α] [IsSuccArchimedean α] [OrderBot α] {n : α} {φ : α → α}
    (hφ : StrictMonoOn φ (Set.Iic n)) : ∀ m ≤ n, m ≤ φ m := by
  revert hφ
  

Proof state:
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : SuccOrder α
inst✝¹ : IsSuccArchimedean α
inst✝ : OrderBot α
n : α
φ : α → α
⊢ StrictMonoOn φ (Iic n) → ∀ m ≤ n, m ≤ φ m

Next tactic:
refine'
    Succ.rec_bot (fun n => StrictMonoOn φ (Set.Iic n) → ∀ m ≤ n, m ≤ φ m)
      (fun _ _ hm => hm.trans bot_le) _ _
theorem StrictMonoOn.Iic_id_le [SuccOrder α] [IsSuccArchimedean α] [OrderBot α] {n : α} {φ : α → α}
    (hφ : StrictMonoOn φ (Set.Iic n)) : ∀ m ≤ n, m ≤ φ m := by
  revert hφ
  refine'
    Succ.rec_bot (fun n => StrictMonoOn φ (Set.Iic n) → ∀ m ≤ n, m ≤ φ m)
      (fun _ _ hm => hm.trans bot_le) _ _
  

Proof state:
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : SuccOrder α
inst✝¹ : IsSuccArchimedean α
inst✝ : OrderBot α
n : α
φ : α → α
⊢ ∀ (a : α),
    (fun n => StrictMonoOn φ (Iic n) → ∀ m ≤ n, m ≤ φ m) a →
      (fun n => StrictMonoOn φ (Iic n) → ∀ m ≤ n, m ≤ φ m) (succ a)

Next tactic:
rintro k ih hφ m hm
theorem StrictMonoOn.Iic_id_le [SuccOrder α] [IsSuccArchimedean α] [OrderBot α] {n : α} {φ : α → α}
    (hφ : StrictMonoOn φ (Set.Iic n)) : ∀ m ≤ n, m ≤ φ m := by
  revert hφ
  refine'
    Succ.rec_bot (fun n => StrictMonoOn φ (Set.Iic n) → ∀ m ≤ n, m ≤ φ m)
      (fun _ _ hm => hm.trans bot_le) _ _
  rintro k ih hφ m hm
  

Proof state:
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : SuccOrder α
inst✝¹ : IsSuccArchimedean α
inst✝ : OrderBot α
n : α
φ : α → α
k : α
ih : StrictMonoOn φ (Iic k) → ∀ m ≤ k, m ≤ φ m
hφ : StrictMonoOn φ (Iic (succ k))
m : α
hm : m ≤ succ k
⊢ m ≤ φ m

Next tactic:
by_cases hk : IsMax k
theorem StrictMonoOn.Iic_id_le [SuccOrder α] [IsSuccArchimedean α] [OrderBot α] {n : α} {φ : α → α}
    (hφ : StrictMonoOn φ (Set.Iic n)) : ∀ m ≤ n, m ≤ φ m := by
  revert hφ
  refine'
    Succ.rec_bot (fun n => StrictMonoOn φ (Set.Iic n) → ∀ m ≤ n, m ≤ φ m)
      (fun _ _ hm => hm.trans bot_le) _ _
  rintro k ih hφ m hm
  by_cases hk : IsMax k
  · 

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : SuccOrder α
inst✝¹ : IsSuccArchimedean α
inst✝ : OrderBot α
n : α
φ : α → α
k : α
ih : StrictMonoOn φ (Iic k) → ∀ m ≤ k, m ≤ φ m
hφ : StrictMonoOn φ (Iic (succ k))
m : α
hm : m ≤ succ k
hk : IsMax k
⊢ m ≤ φ m

Next tactic:
rw [succ_eq_iff_isMax.2 hk] at hm
theorem StrictMonoOn.Iic_id_le [SuccOrder α] [IsSuccArchimedean α] [OrderBot α] {n : α} {φ : α → α}
    (hφ : StrictMonoOn φ (Set.Iic n)) : ∀ m ≤ n, m ≤ φ m := by
  revert hφ
  refine'
    Succ.rec_bot (fun n => StrictMonoOn φ (Set.Iic n) → ∀ m ≤ n, m ≤ φ m)
      (fun _ _ hm => hm.trans bot_le) _ _
  rintro k ih hφ m hm
  by_cases hk : IsMax k
  · rw [succ_eq_iff_isMax.2 hk] at hm
    

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : SuccOrder α
inst✝¹ : IsSuccArchimedean α
inst✝ : OrderBot α
n : α
φ : α → α
k : α
ih : StrictMonoOn φ (Iic k) → ∀ m ≤ k, m ≤ φ m
hφ : StrictMonoOn φ (Iic (succ k))
m : α
hm : m ≤ k
hk : IsMax k
⊢ m ≤ φ m

Next tactic:
exact ih (hφ.mono <| Iic_subset_Iic.2 (le_succ _)) _ hm
theorem StrictMonoOn.Iic_id_le [SuccOrder α] [IsSuccArchimedean α] [OrderBot α] {n : α} {φ : α → α}
    (hφ : StrictMonoOn φ (Set.Iic n)) : ∀ m ≤ n, m ≤ φ m := by
  revert hφ
  refine'
    Succ.rec_bot (fun n => StrictMonoOn φ (Set.Iic n) → ∀ m ≤ n, m ≤ φ m)
      (fun _ _ hm => hm.trans bot_le) _ _
  rintro k ih hφ m hm
  by_cases hk : IsMax k
  · rw [succ_eq_iff_isMax.2 hk] at hm
    exact ih (hφ.mono <| Iic_subset_Iic.2 (le_succ _)) _ hm
  

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : SuccOrder α
inst✝¹ : IsSuccArchimedean α
inst✝ : OrderBot α
n : α
φ : α → α
k : α
ih : StrictMonoOn φ (Iic k) → ∀ m ≤ k, m ≤ φ m
hφ : StrictMonoOn φ (Iic (succ k))
m : α
hm : m ≤ succ k
hk : ¬IsMax k
⊢ m ≤ φ m

Next tactic:
obtain rfl | h := le_succ_iff_eq_or_le.1 hm
theorem StrictMonoOn.Iic_id_le [SuccOrder α] [IsSuccArchimedean α] [OrderBot α] {n : α} {φ : α → α}
    (hφ : StrictMonoOn φ (Set.Iic n)) : ∀ m ≤ n, m ≤ φ m := by
  revert hφ
  refine'
    Succ.rec_bot (fun n => StrictMonoOn φ (Set.Iic n) → ∀ m ≤ n, m ≤ φ m)
      (fun _ _ hm => hm.trans bot_le) _ _
  rintro k ih hφ m hm
  by_cases hk : IsMax k
  · rw [succ_eq_iff_isMax.2 hk] at hm
    exact ih (hφ.mono <| Iic_subset_Iic.2 (le_succ _)) _ hm
  obtain rfl | h := le_succ_iff_eq_or_le.1 hm
  · 

Proof state:
case neg.inl
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : SuccOrder α
inst✝¹ : IsSuccArchimedean α
inst✝ : OrderBot α
n : α
φ : α → α
k : α
ih : StrictMonoOn φ (Iic k) → ∀ m ≤ k, m ≤ φ m
hφ : StrictMonoOn φ (Iic (succ k))
hk : ¬IsMax k
hm : succ k ≤ succ k
⊢ succ k ≤ φ (succ k)

Next tactic:
specialize ih (StrictMonoOn.mono hφ fun x hx => le_trans hx (le_succ _)) k le_rfl
theorem StrictMonoOn.Iic_id_le [SuccOrder α] [IsSuccArchimedean α] [OrderBot α] {n : α} {φ : α → α}
    (hφ : StrictMonoOn φ (Set.Iic n)) : ∀ m ≤ n, m ≤ φ m := by
  revert hφ
  refine'
    Succ.rec_bot (fun n => StrictMonoOn φ (Set.Iic n) → ∀ m ≤ n, m ≤ φ m)
      (fun _ _ hm => hm.trans bot_le) _ _
  rintro k ih hφ m hm
  by_cases hk : IsMax k
  · rw [succ_eq_iff_isMax.2 hk] at hm
    exact ih (hφ.mono <| Iic_subset_Iic.2 (le_succ _)) _ hm
  obtain rfl | h := le_succ_iff_eq_or_le.1 hm
  · specialize ih (StrictMonoOn.mono hφ fun x hx => le_trans hx (le_succ _)) k le_rfl
    

Proof state:
case neg.inl
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : SuccOrder α
inst✝¹ : IsSuccArchimedean α
inst✝ : OrderBot α
n : α
φ : α → α
k : α
hφ : StrictMonoOn φ (Iic (succ k))
hk : ¬IsMax k
hm : succ k ≤ succ k
ih : k ≤ φ k
⊢ succ k ≤ φ (succ k)

Next tactic:
refine' le_trans (succ_mono ih) (succ_le_of_lt (hφ (le_succ _) le_rfl _))
theorem StrictMonoOn.Iic_id_le [SuccOrder α] [IsSuccArchimedean α] [OrderBot α] {n : α} {φ : α → α}
    (hφ : StrictMonoOn φ (Set.Iic n)) : ∀ m ≤ n, m ≤ φ m := by
  revert hφ
  refine'
    Succ.rec_bot (fun n => StrictMonoOn φ (Set.Iic n) → ∀ m ≤ n, m ≤ φ m)
      (fun _ _ hm => hm.trans bot_le) _ _
  rintro k ih hφ m hm
  by_cases hk : IsMax k
  · rw [succ_eq_iff_isMax.2 hk] at hm
    exact ih (hφ.mono <| Iic_subset_Iic.2 (le_succ _)) _ hm
  obtain rfl | h := le_succ_iff_eq_or_le.1 hm
  · specialize ih (StrictMonoOn.mono hφ fun x hx => le_trans hx (le_succ _)) k le_rfl
    refine' le_trans (succ_mono ih) (succ_le_of_lt (hφ (le_succ _) le_rfl _))
    

Proof state:
case neg.inl
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : SuccOrder α
inst✝¹ : IsSuccArchimedean α
inst✝ : OrderBot α
n : α
φ : α → α
k : α
hφ : StrictMonoOn φ (Iic (succ k))
hk : ¬IsMax k
hm : succ k ≤ succ k
ih : k ≤ φ k
⊢ k < succ k

Next tactic:
rw [lt_succ_iff_eq_or_lt_of_not_isMax hk]
theorem StrictMonoOn.Iic_id_le [SuccOrder α] [IsSuccArchimedean α] [OrderBot α] {n : α} {φ : α → α}
    (hφ : StrictMonoOn φ (Set.Iic n)) : ∀ m ≤ n, m ≤ φ m := by
  revert hφ
  refine'
    Succ.rec_bot (fun n => StrictMonoOn φ (Set.Iic n) → ∀ m ≤ n, m ≤ φ m)
      (fun _ _ hm => hm.trans bot_le) _ _
  rintro k ih hφ m hm
  by_cases hk : IsMax k
  · rw [succ_eq_iff_isMax.2 hk] at hm
    exact ih (hφ.mono <| Iic_subset_Iic.2 (le_succ _)) _ hm
  obtain rfl | h := le_succ_iff_eq_or_le.1 hm
  · specialize ih (StrictMonoOn.mono hφ fun x hx => le_trans hx (le_succ _)) k le_rfl
    refine' le_trans (succ_mono ih) (succ_le_of_lt (hφ (le_succ _) le_rfl _))
    rw [lt_succ_iff_eq_or_lt_of_not_isMax hk]
    

Proof state:
case neg.inl
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : SuccOrder α
inst✝¹ : IsSuccArchimedean α
inst✝ : OrderBot α
n : α
φ : α → α
k : α
hφ : StrictMonoOn φ (Iic (succ k))
hk : ¬IsMax k
hm : succ k ≤ succ k
ih : k ≤ φ k
⊢ k = k ∨ k < k

Next tactic:
exact Or.inl rfl
theorem StrictMonoOn.Iic_id_le [SuccOrder α] [IsSuccArchimedean α] [OrderBot α] {n : α} {φ : α → α}
    (hφ : StrictMonoOn φ (Set.Iic n)) : ∀ m ≤ n, m ≤ φ m := by
  revert hφ
  refine'
    Succ.rec_bot (fun n => StrictMonoOn φ (Set.Iic n) → ∀ m ≤ n, m ≤ φ m)
      (fun _ _ hm => hm.trans bot_le) _ _
  rintro k ih hφ m hm
  by_cases hk : IsMax k
  · rw [succ_eq_iff_isMax.2 hk] at hm
    exact ih (hφ.mono <| Iic_subset_Iic.2 (le_succ _)) _ hm
  obtain rfl | h := le_succ_iff_eq_or_le.1 hm
  · specialize ih (StrictMonoOn.mono hφ fun x hx => le_trans hx (le_succ _)) k le_rfl
    refine' le_trans (succ_mono ih) (succ_le_of_lt (hφ (le_succ _) le_rfl _))
    rw [lt_succ_iff_eq_or_lt_of_not_isMax hk]
    exact Or.inl rfl
  · 

Proof state:
case neg.inr
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : SuccOrder α
inst✝¹ : IsSuccArchimedean α
inst✝ : OrderBot α
n : α
φ : α → α
k : α
ih : StrictMonoOn φ (Iic k) → ∀ m ≤ k, m ≤ φ m
hφ : StrictMonoOn φ (Iic (succ k))
m : α
hm : m ≤ succ k
hk : ¬IsMax k
h : m ≤ k
⊢ m ≤ φ m

Next tactic:
exact ih (StrictMonoOn.mono hφ fun x hx => le_trans hx (le_succ _)) _ h
/-- A function `ψ` on a `SuccOrder` is strictly monotone before some `n` if for all `m` such that
`m < n`, we have `ψ m < ψ (succ m)`. -/
theorem strictMonoOn_Iic_of_lt_succ [SuccOrder α] [IsSuccArchimedean α] {n : α}
    (hψ : ∀ m, m < n → ψ m < ψ (succ m)) : StrictMonoOn ψ (Set.Iic n) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : Preorder β
ψ : α → β
inst✝¹ : SuccOrder α
inst✝ : IsSuccArchimedean α
n : α
hψ : ∀ m < n, ψ m < ψ (succ m)
⊢ StrictMonoOn ψ (Iic n)

Next tactic:
intro x hx y hy hxy
/-- A function `ψ` on a `SuccOrder` is strictly monotone before some `n` if for all `m` such that
`m < n`, we have `ψ m < ψ (succ m)`. -/
theorem strictMonoOn_Iic_of_lt_succ [SuccOrder α] [IsSuccArchimedean α] {n : α}
    (hψ : ∀ m, m < n → ψ m < ψ (succ m)) : StrictMonoOn ψ (Set.Iic n) := by
  intro x hx y hy hxy
  

Proof state:
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : Preorder β
ψ : α → β
inst✝¹ : SuccOrder α
inst✝ : IsSuccArchimedean α
n : α
hψ : ∀ m < n, ψ m < ψ (succ m)
x : α
hx : x ∈ Iic n
y : α
hy : y ∈ Iic n
hxy : x < y
⊢ ψ x < ψ y

Next tactic:
obtain ⟨i, rfl⟩ := hxy.le.exists_succ_iterate
/-- A function `ψ` on a `SuccOrder` is strictly monotone before some `n` if for all `m` such that
`m < n`, we have `ψ m < ψ (succ m)`. -/
theorem strictMonoOn_Iic_of_lt_succ [SuccOrder α] [IsSuccArchimedean α] {n : α}
    (hψ : ∀ m, m < n → ψ m < ψ (succ m)) : StrictMonoOn ψ (Set.Iic n) := by
  intro x hx y hy hxy
  obtain ⟨i, rfl⟩ := hxy.le.exists_succ_iterate
  

Proof state:
case intro
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : Preorder β
ψ : α → β
inst✝¹ : SuccOrder α
inst✝ : IsSuccArchimedean α
n : α
hψ : ∀ m < n, ψ m < ψ (succ m)
x : α
hx : x ∈ Iic n
i : ℕ
hy : succ^[i] x ∈ Iic n
hxy : x < succ^[i] x
⊢ ψ x < ψ (succ^[i] x)

Next tactic:
induction' i with k ih
/-- A function `ψ` on a `SuccOrder` is strictly monotone before some `n` if for all `m` such that
`m < n`, we have `ψ m < ψ (succ m)`. -/
theorem strictMonoOn_Iic_of_lt_succ [SuccOrder α] [IsSuccArchimedean α] {n : α}
    (hψ : ∀ m, m < n → ψ m < ψ (succ m)) : StrictMonoOn ψ (Set.Iic n) := by
  intro x hx y hy hxy
  obtain ⟨i, rfl⟩ := hxy.le.exists_succ_iterate
  induction' i with k ih
  · 

Proof state:
case intro.zero
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : Preorder β
ψ : α → β
inst✝¹ : SuccOrder α
inst✝ : IsSuccArchimedean α
n : α
hψ : ∀ m < n, ψ m < ψ (succ m)
x : α
hx : x ∈ Iic n
hy : succ^[Nat.zero] x ∈ Iic n
hxy : x < succ^[Nat.zero] x
⊢ ψ x < ψ (succ^[Nat.zero] x)

Next tactic:
simp at hxy
/-- A function `ψ` on a `SuccOrder` is strictly monotone before some `n` if for all `m` such that
`m < n`, we have `ψ m < ψ (succ m)`. -/
theorem strictMonoOn_Iic_of_lt_succ [SuccOrder α] [IsSuccArchimedean α] {n : α}
    (hψ : ∀ m, m < n → ψ m < ψ (succ m)) : StrictMonoOn ψ (Set.Iic n) := by
  intro x hx y hy hxy
  obtain ⟨i, rfl⟩ := hxy.le.exists_succ_iterate
  induction' i with k ih
  · simp at hxy
  

Proof state:
case intro.succ
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : Preorder β
ψ : α → β
inst✝¹ : SuccOrder α
inst✝ : IsSuccArchimedean α
n : α
hψ : ∀ m < n, ψ m < ψ (succ m)
x : α
hx : x ∈ Iic n
k : ℕ
ih : succ^[k] x ∈ Iic n → x < succ^[k] x → ψ x < ψ (succ^[k] x)
hy : succ^[Nat.succ k] x ∈ Iic n
hxy : x < succ^[Nat.succ k] x
⊢ ψ x < ψ (succ^[Nat.succ k] x)

Next tactic:
cases' k with k
/-- A function `ψ` on a `SuccOrder` is strictly monotone before some `n` if for all `m` such that
`m < n`, we have `ψ m < ψ (succ m)`. -/
theorem strictMonoOn_Iic_of_lt_succ [SuccOrder α] [IsSuccArchimedean α] {n : α}
    (hψ : ∀ m, m < n → ψ m < ψ (succ m)) : StrictMonoOn ψ (Set.Iic n) := by
  intro x hx y hy hxy
  obtain ⟨i, rfl⟩ := hxy.le.exists_succ_iterate
  induction' i with k ih
  · simp at hxy
  cases' k with k
  · 

Proof state:
case intro.succ.zero
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : Preorder β
ψ : α → β
inst✝¹ : SuccOrder α
inst✝ : IsSuccArchimedean α
n : α
hψ : ∀ m < n, ψ m < ψ (succ m)
x : α
hx : x ∈ Iic n
ih : succ^[Nat.zero] x ∈ Iic n → x < succ^[Nat.zero] x → ψ x < ψ (succ^[Nat.zero] x)
hy : succ^[Nat.succ Nat.zero] x ∈ Iic n
hxy : x < succ^[Nat.succ Nat.zero] x
⊢ ψ x < ψ (succ^[Nat.succ Nat.zero] x)

Next tactic:
exact hψ _ (lt_of_lt_of_le hxy hy)
/-- A function `ψ` on a `SuccOrder` is strictly monotone before some `n` if for all `m` such that
`m < n`, we have `ψ m < ψ (succ m)`. -/
theorem strictMonoOn_Iic_of_lt_succ [SuccOrder α] [IsSuccArchimedean α] {n : α}
    (hψ : ∀ m, m < n → ψ m < ψ (succ m)) : StrictMonoOn ψ (Set.Iic n) := by
  intro x hx y hy hxy
  obtain ⟨i, rfl⟩ := hxy.le.exists_succ_iterate
  induction' i with k ih
  · simp at hxy
  cases' k with k
  · exact hψ _ (lt_of_lt_of_le hxy hy)
  

Proof state:
case intro.succ.succ
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : Preorder β
ψ : α → β
inst✝¹ : SuccOrder α
inst✝ : IsSuccArchimedean α
n : α
hψ : ∀ m < n, ψ m < ψ (succ m)
x : α
hx : x ∈ Iic n
k : ℕ
ih : succ^[Nat.succ k] x ∈ Iic n → x < succ^[Nat.succ k] x → ψ x < ψ (succ^[Nat.succ k] x)
hy : succ^[Nat.succ (Nat.succ k)] x ∈ Iic n
hxy : x < succ^[Nat.succ (Nat.succ k)] x
⊢ ψ x < ψ (succ^[Nat.succ (Nat.succ k)] x)

Next tactic:
rw [Set.mem_Iic] at *
/-- A function `ψ` on a `SuccOrder` is strictly monotone before some `n` if for all `m` such that
`m < n`, we have `ψ m < ψ (succ m)`. -/
theorem strictMonoOn_Iic_of_lt_succ [SuccOrder α] [IsSuccArchimedean α] {n : α}
    (hψ : ∀ m, m < n → ψ m < ψ (succ m)) : StrictMonoOn ψ (Set.Iic n) := by
  intro x hx y hy hxy
  obtain ⟨i, rfl⟩ := hxy.le.exists_succ_iterate
  induction' i with k ih
  · simp at hxy
  cases' k with k
  · exact hψ _ (lt_of_lt_of_le hxy hy)
  rw [Set.mem_Iic] at *
  

Proof state:
case intro.succ.succ
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : Preorder β
ψ : α → β
inst✝¹ : SuccOrder α
inst✝ : IsSuccArchimedean α
n : α
hψ : ∀ m < n, ψ m < ψ (succ m)
x : α
hx : x ≤ n
k : ℕ
ih : succ^[Nat.succ k] x ≤ n → x < succ^[Nat.succ k] x → ψ x < ψ (succ^[Nat.succ k] x)
hy : succ^[Nat.succ (Nat.succ k)] x ≤ n
hxy : x < succ^[Nat.succ (Nat.succ k)] x
⊢ ψ x < ψ (succ^[Nat.succ (Nat.succ k)] x)

Next tactic:
simp only [Function.iterate_succ', Function.comp_apply] at ih hxy hy ⊢
/-- A function `ψ` on a `SuccOrder` is strictly monotone before some `n` if for all `m` such that
`m < n`, we have `ψ m < ψ (succ m)`. -/
theorem strictMonoOn_Iic_of_lt_succ [SuccOrder α] [IsSuccArchimedean α] {n : α}
    (hψ : ∀ m, m < n → ψ m < ψ (succ m)) : StrictMonoOn ψ (Set.Iic n) := by
  intro x hx y hy hxy
  obtain ⟨i, rfl⟩ := hxy.le.exists_succ_iterate
  induction' i with k ih
  · simp at hxy
  cases' k with k
  · exact hψ _ (lt_of_lt_of_le hxy hy)
  rw [Set.mem_Iic] at *
  simp only [Function.iterate_succ', Function.comp_apply] at ih hxy hy ⊢
  

Proof state:
case intro.succ.succ
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : Preorder β
ψ : α → β
inst✝¹ : SuccOrder α
inst✝ : IsSuccArchimedean α
n : α
hψ : ∀ m < n, ψ m < ψ (succ m)
x : α
hx : x ≤ n
k : ℕ
ih : succ (succ^[k] x) ≤ n → x < succ (succ^[k] x) → ψ x < ψ (succ (succ^[k] x))
hxy : x < succ (succ (succ^[k] x))
hy : succ (succ (succ^[k] x)) ≤ n
⊢ ψ x < ψ (succ (succ (succ^[k] x)))

Next tactic:
by_cases hmax : IsMax (succ^[k] x)
/-- A function `ψ` on a `SuccOrder` is strictly monotone before some `n` if for all `m` such that
`m < n`, we have `ψ m < ψ (succ m)`. -/
theorem strictMonoOn_Iic_of_lt_succ [SuccOrder α] [IsSuccArchimedean α] {n : α}
    (hψ : ∀ m, m < n → ψ m < ψ (succ m)) : StrictMonoOn ψ (Set.Iic n) := by
  intro x hx y hy hxy
  obtain ⟨i, rfl⟩ := hxy.le.exists_succ_iterate
  induction' i with k ih
  · simp at hxy
  cases' k with k
  · exact hψ _ (lt_of_lt_of_le hxy hy)
  rw [Set.mem_Iic] at *
  simp only [Function.iterate_succ', Function.comp_apply] at ih hxy hy ⊢
  by_cases hmax : IsMax (succ^[k] x)
  · 

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : Preorder β
ψ : α → β
inst✝¹ : SuccOrder α
inst✝ : IsSuccArchimedean α
n : α
hψ : ∀ m < n, ψ m < ψ (succ m)
x : α
hx : x ≤ n
k : ℕ
ih : succ (succ^[k] x) ≤ n → x < succ (succ^[k] x) → ψ x < ψ (succ (succ^[k] x))
hxy : x < succ (succ (succ^[k] x))
hy : succ (succ (succ^[k] x)) ≤ n
hmax : IsMax (succ^[k] x)
⊢ ψ x < ψ (succ (succ (succ^[k] x)))

Next tactic:
rw [succ_eq_iff_isMax.2 hmax] at hxy ⊢
/-- A function `ψ` on a `SuccOrder` is strictly monotone before some `n` if for all `m` such that
`m < n`, we have `ψ m < ψ (succ m)`. -/
theorem strictMonoOn_Iic_of_lt_succ [SuccOrder α] [IsSuccArchimedean α] {n : α}
    (hψ : ∀ m, m < n → ψ m < ψ (succ m)) : StrictMonoOn ψ (Set.Iic n) := by
  intro x hx y hy hxy
  obtain ⟨i, rfl⟩ := hxy.le.exists_succ_iterate
  induction' i with k ih
  · simp at hxy
  cases' k with k
  · exact hψ _ (lt_of_lt_of_le hxy hy)
  rw [Set.mem_Iic] at *
  simp only [Function.iterate_succ', Function.comp_apply] at ih hxy hy ⊢
  by_cases hmax : IsMax (succ^[k] x)
  · rw [succ_eq_iff_isMax.2 hmax] at hxy ⊢
    

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : Preorder β
ψ : α → β
inst✝¹ : SuccOrder α
inst✝ : IsSuccArchimedean α
n : α
hψ : ∀ m < n, ψ m < ψ (succ m)
x : α
hx : x ≤ n
k : ℕ
ih : succ (succ^[k] x) ≤ n → x < succ (succ^[k] x) → ψ x < ψ (succ (succ^[k] x))
hxy : x < succ (succ^[k] x)
hy : succ (succ (succ^[k] x)) ≤ n
hmax : IsMax (succ^[k] x)
⊢ ψ x < ψ (succ (succ^[k] x))

Next tactic:
exact ih (le_trans (le_succ _) hy) hxy
/-- A function `ψ` on a `SuccOrder` is strictly monotone before some `n` if for all `m` such that
`m < n`, we have `ψ m < ψ (succ m)`. -/
theorem strictMonoOn_Iic_of_lt_succ [SuccOrder α] [IsSuccArchimedean α] {n : α}
    (hψ : ∀ m, m < n → ψ m < ψ (succ m)) : StrictMonoOn ψ (Set.Iic n) := by
  intro x hx y hy hxy
  obtain ⟨i, rfl⟩ := hxy.le.exists_succ_iterate
  induction' i with k ih
  · simp at hxy
  cases' k with k
  · exact hψ _ (lt_of_lt_of_le hxy hy)
  rw [Set.mem_Iic] at *
  simp only [Function.iterate_succ', Function.comp_apply] at ih hxy hy ⊢
  by_cases hmax : IsMax (succ^[k] x)
  · rw [succ_eq_iff_isMax.2 hmax] at hxy ⊢
    exact ih (le_trans (le_succ _) hy) hxy
  

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : Preorder β
ψ : α → β
inst✝¹ : SuccOrder α
inst✝ : IsSuccArchimedean α
n : α
hψ : ∀ m < n, ψ m < ψ (succ m)
x : α
hx : x ≤ n
k : ℕ
ih : succ (succ^[k] x) ≤ n → x < succ (succ^[k] x) → ψ x < ψ (succ (succ^[k] x))
hxy : x < succ (succ (succ^[k] x))
hy : succ (succ (succ^[k] x)) ≤ n
hmax : ¬IsMax (succ^[k] x)
⊢ ψ x < ψ (succ (succ (succ^[k] x)))

Next tactic:
by_cases hmax' : IsMax (succ (succ^[k] x))
/-- A function `ψ` on a `SuccOrder` is strictly monotone before some `n` if for all `m` such that
`m < n`, we have `ψ m < ψ (succ m)`. -/
theorem strictMonoOn_Iic_of_lt_succ [SuccOrder α] [IsSuccArchimedean α] {n : α}
    (hψ : ∀ m, m < n → ψ m < ψ (succ m)) : StrictMonoOn ψ (Set.Iic n) := by
  intro x hx y hy hxy
  obtain ⟨i, rfl⟩ := hxy.le.exists_succ_iterate
  induction' i with k ih
  · simp at hxy
  cases' k with k
  · exact hψ _ (lt_of_lt_of_le hxy hy)
  rw [Set.mem_Iic] at *
  simp only [Function.iterate_succ', Function.comp_apply] at ih hxy hy ⊢
  by_cases hmax : IsMax (succ^[k] x)
  · rw [succ_eq_iff_isMax.2 hmax] at hxy ⊢
    exact ih (le_trans (le_succ _) hy) hxy
  by_cases hmax' : IsMax (succ (succ^[k] x))
  · 

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : Preorder β
ψ : α → β
inst✝¹ : SuccOrder α
inst✝ : IsSuccArchimedean α
n : α
hψ : ∀ m < n, ψ m < ψ (succ m)
x : α
hx : x ≤ n
k : ℕ
ih : succ (succ^[k] x) ≤ n → x < succ (succ^[k] x) → ψ x < ψ (succ (succ^[k] x))
hxy : x < succ (succ (succ^[k] x))
hy : succ (succ (succ^[k] x)) ≤ n
hmax : ¬IsMax (succ^[k] x)
hmax' : IsMax (succ (succ^[k] x))
⊢ ψ x < ψ (succ (succ (succ^[k] x)))

Next tactic:
rw [succ_eq_iff_isMax.2 hmax'] at hxy ⊢
/-- A function `ψ` on a `SuccOrder` is strictly monotone before some `n` if for all `m` such that
`m < n`, we have `ψ m < ψ (succ m)`. -/
theorem strictMonoOn_Iic_of_lt_succ [SuccOrder α] [IsSuccArchimedean α] {n : α}
    (hψ : ∀ m, m < n → ψ m < ψ (succ m)) : StrictMonoOn ψ (Set.Iic n) := by
  intro x hx y hy hxy
  obtain ⟨i, rfl⟩ := hxy.le.exists_succ_iterate
  induction' i with k ih
  · simp at hxy
  cases' k with k
  · exact hψ _ (lt_of_lt_of_le hxy hy)
  rw [Set.mem_Iic] at *
  simp only [Function.iterate_succ', Function.comp_apply] at ih hxy hy ⊢
  by_cases hmax : IsMax (succ^[k] x)
  · rw [succ_eq_iff_isMax.2 hmax] at hxy ⊢
    exact ih (le_trans (le_succ _) hy) hxy
  by_cases hmax' : IsMax (succ (succ^[k] x))
  · rw [succ_eq_iff_isMax.2 hmax'] at hxy ⊢
    

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : Preorder β
ψ : α → β
inst✝¹ : SuccOrder α
inst✝ : IsSuccArchimedean α
n : α
hψ : ∀ m < n, ψ m < ψ (succ m)
x : α
hx : x ≤ n
k : ℕ
ih : succ (succ^[k] x) ≤ n → x < succ (succ^[k] x) → ψ x < ψ (succ (succ^[k] x))
hxy : x < succ (succ^[k] x)
hy : succ (succ (succ^[k] x)) ≤ n
hmax : ¬IsMax (succ^[k] x)
hmax' : IsMax (succ (succ^[k] x))
⊢ ψ x < ψ (succ (succ^[k] x))

Next tactic:
exact ih (le_trans (le_succ _) hy) hxy