l3lab/ntp-mathlib huggingface dataset:
/-- There is at most one way to define the predecessors in a `PartialOrder`. -/
instance [PartialOrder α] : Subsingleton (PredOrder α) :=
  ⟨by
    intro h₀ h₁
    ext a
    by_cases ha : IsMin a
    · exact (@IsMin.pred_eq _ _ h₀ _ ha).trans ha.pred_eq.symm
    · 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝ : PartialOrder α
h₀ h₁ : PredOrder α
a : α
ha : ¬IsMin a
⊢ PredOrder.pred a = PredOrder.pred a

Next tactic:
exact @Covby.pred_eq _ _ h₀ _ _ (pred_covby_of_not_isMin ha)
theorem pred_eq_iSup (a : α) : pred a = ⨆ (b) (_ : b < a), b := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : CompleteLattice α
inst✝ : PredOrder α
a : α
⊢ pred a = ⨆ b, ⨆ (_ : b < a), b

Next tactic:
refine' le_antisymm _ (iSup_le fun b => iSup_le le_pred_of_lt)
theorem pred_eq_iSup (a : α) : pred a = ⨆ (b) (_ : b < a), b := by
  refine' le_antisymm _ (iSup_le fun b => iSup_le le_pred_of_lt)
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : CompleteLattice α
inst✝ : PredOrder α
a : α
⊢ pred a ≤ ⨆ b, ⨆ (_ : b < a), b

Next tactic:
obtain rfl | ha := eq_or_ne a ⊥
theorem pred_eq_iSup (a : α) : pred a = ⨆ (b) (_ : b < a), b := by
  refine' le_antisymm _ (iSup_le fun b => iSup_le le_pred_of_lt)
  obtain rfl | ha := eq_or_ne a ⊥
  · 

Proof state:
case inl
α : Type u_1
β : Type u_2
inst✝¹ : CompleteLattice α
inst✝ : PredOrder α
⊢ pred ⊥ ≤ ⨆ b, ⨆ (_ : b < ⊥), b

Next tactic:
rw [pred_bot]
theorem pred_eq_iSup (a : α) : pred a = ⨆ (b) (_ : b < a), b := by
  refine' le_antisymm _ (iSup_le fun b => iSup_le le_pred_of_lt)
  obtain rfl | ha := eq_or_ne a ⊥
  · rw [pred_bot]
    

Proof state:
case inl
α : Type u_1
β : Type u_2
inst✝¹ : CompleteLattice α
inst✝ : PredOrder α
⊢ ⊥ ≤ ⨆ b, ⨆ (_ : b < ⊥), b

Next tactic:
exact bot_le
theorem pred_eq_iSup (a : α) : pred a = ⨆ (b) (_ : b < a), b := by
  refine' le_antisymm _ (iSup_le fun b => iSup_le le_pred_of_lt)
  obtain rfl | ha := eq_or_ne a ⊥
  · rw [pred_bot]
    exact bot_le
  · 

Proof state:
case inr
α : Type u_1
β : Type u_2
inst✝¹ : CompleteLattice α
inst✝ : PredOrder α
a : α
ha : a ≠ ⊥
⊢ pred a ≤ ⨆ b, ⨆ (_ : b < a), b

Next tactic:
exact @le_iSup₂ _ _ (fun b => b < a) _ (fun a _ => a) (pred a) (pred_lt_iff_ne_bot.2 ha)
theorem pred_succ_iterate_of_not_isMax (i : α) (n : ℕ) (hin : ¬IsMax (succ^[n - 1] i)) :
    pred^[n] (succ^[n] i) = i := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : SuccOrder α
inst✝ : PredOrder α
a b i : α
n : ℕ
hin : ¬IsMax (succ^[n - 1] i)
⊢ pred^[n] (succ^[n] i) = i

Next tactic:
induction' n with n hn
theorem pred_succ_iterate_of_not_isMax (i : α) (n : ℕ) (hin : ¬IsMax (succ^[n - 1] i)) :
    pred^[n] (succ^[n] i) = i := by
  induction' n with n hn
  · 

Proof state:
case zero
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : SuccOrder α
inst✝ : PredOrder α
a b i : α
hin : ¬IsMax (succ^[Nat.zero - 1] i)
⊢ pred^[Nat.zero] (succ^[Nat.zero] i) = i

Next tactic:
simp only [Nat.zero_eq, Function.iterate_zero, id.def]
theorem pred_succ_iterate_of_not_isMax (i : α) (n : ℕ) (hin : ¬IsMax (succ^[n - 1] i)) :
    pred^[n] (succ^[n] i) = i := by
  induction' n with n hn
  · simp only [Nat.zero_eq, Function.iterate_zero, id.def]
  

Proof state:
case succ
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : SuccOrder α
inst✝ : PredOrder α
a b i : α
n : ℕ
hn : ¬IsMax (succ^[n - 1] i) → pred^[n] (succ^[n] i) = i
hin : ¬IsMax (succ^[Nat.succ n - 1] i)
⊢ pred^[Nat.succ n] (succ^[Nat.succ n] i) = i

Next tactic:
rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hin
theorem pred_succ_iterate_of_not_isMax (i : α) (n : ℕ) (hin : ¬IsMax (succ^[n - 1] i)) :
    pred^[n] (succ^[n] i) = i := by
  induction' n with n hn
  · simp only [Nat.zero_eq, Function.iterate_zero, id.def]
  rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hin
  

Proof state:
case succ
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : SuccOrder α
inst✝ : PredOrder α
a b i : α
n : ℕ
hn : ¬IsMax (succ^[n - 1] i) → pred^[n] (succ^[n] i) = i
hin : ¬IsMax (succ^[n] i)
⊢ pred^[Nat.succ n] (succ^[Nat.succ n] i) = i

Next tactic:
have h_not_max : ¬IsMax (succ^[n - 1] i) := by
    cases' n with n
    · simpa using hin
    rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hn ⊢
    have h_sub_le : succ^[n] i ≤ succ^[n.succ] i := by
      rw [Function.iterate_succ']
      exact le_succ _
    refine' fun h_max => hin fun j hj => _
    have hj_le : j ≤ succ^[n] i := h_max (h_sub_le.trans hj)
    exact hj_le.trans h_sub_le
theorem pred_succ_iterate_of_not_isMax (i : α) (n : ℕ) (hin : ¬IsMax (succ^[n - 1] i)) :
    pred^[n] (succ^[n] i) = i := by
  induction' n with n hn
  · simp only [Nat.zero_eq, Function.iterate_zero, id.def]
  rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hin
  have h_not_max : ¬IsMax (succ^[n - 1] i) := by
    

Proof state:
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : SuccOrder α
inst✝ : PredOrder α
a b i : α
n : ℕ
hn : ¬IsMax (succ^[n - 1] i) → pred^[n] (succ^[n] i) = i
hin : ¬IsMax (succ^[n] i)
⊢ ¬IsMax (succ^[n - 1] i)

Next tactic:
cases' n with n
theorem pred_succ_iterate_of_not_isMax (i : α) (n : ℕ) (hin : ¬IsMax (succ^[n - 1] i)) :
    pred^[n] (succ^[n] i) = i := by
  induction' n with n hn
  · simp only [Nat.zero_eq, Function.iterate_zero, id.def]
  rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hin
  have h_not_max : ¬IsMax (succ^[n - 1] i) := by
    cases' n with n
    · 

Proof state:
case zero
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : SuccOrder α
inst✝ : PredOrder α
a b i : α
hn : ¬IsMax (succ^[Nat.zero - 1] i) → pred^[Nat.zero] (succ^[Nat.zero] i) = i
hin : ¬IsMax (succ^[Nat.zero] i)
⊢ ¬IsMax (succ^[Nat.zero - 1] i)

Next tactic:
simpa using hin
theorem pred_succ_iterate_of_not_isMax (i : α) (n : ℕ) (hin : ¬IsMax (succ^[n - 1] i)) :
    pred^[n] (succ^[n] i) = i := by
  induction' n with n hn
  · simp only [Nat.zero_eq, Function.iterate_zero, id.def]
  rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hin
  have h_not_max : ¬IsMax (succ^[n - 1] i) := by
    cases' n with n
    · simpa using hin
    

Proof state:
case succ
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : SuccOrder α
inst✝ : PredOrder α
a b i : α
n : ℕ
hn : ¬IsMax (succ^[Nat.succ n - 1] i) → pred^[Nat.succ n] (succ^[Nat.succ n] i) = i
hin : ¬IsMax (succ^[Nat.succ n] i)
⊢ ¬IsMax (succ^[Nat.succ n - 1] i)

Next tactic:
rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hn ⊢
theorem pred_succ_iterate_of_not_isMax (i : α) (n : ℕ) (hin : ¬IsMax (succ^[n - 1] i)) :
    pred^[n] (succ^[n] i) = i := by
  induction' n with n hn
  · simp only [Nat.zero_eq, Function.iterate_zero, id.def]
  rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hin
  have h_not_max : ¬IsMax (succ^[n - 1] i) := by
    cases' n with n
    · simpa using hin
    rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hn ⊢
    

Proof state:
case succ
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : SuccOrder α
inst✝ : PredOrder α
a b i : α
n : ℕ
hn : ¬IsMax (succ^[n] i) → pred^[Nat.succ n] (succ^[Nat.succ n] i) = i
hin : ¬IsMax (succ^[Nat.succ n] i)
⊢ ¬IsMax (succ^[n] i)

Next tactic:
have h_sub_le : succ^[n] i ≤ succ^[n.succ] i := by
      rw [Function.iterate_succ']
      exact le_succ _
theorem pred_succ_iterate_of_not_isMax (i : α) (n : ℕ) (hin : ¬IsMax (succ^[n - 1] i)) :
    pred^[n] (succ^[n] i) = i := by
  induction' n with n hn
  · simp only [Nat.zero_eq, Function.iterate_zero, id.def]
  rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hin
  have h_not_max : ¬IsMax (succ^[n - 1] i) := by
    cases' n with n
    · simpa using hin
    rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hn ⊢
    have h_sub_le : succ^[n] i ≤ succ^[n.succ] i := by
      

Proof state:
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : SuccOrder α
inst✝ : PredOrder α
a b i : α
n : ℕ
hn : ¬IsMax (succ^[n] i) → pred^[Nat.succ n] (succ^[Nat.succ n] i) = i
hin : ¬IsMax (succ^[Nat.succ n] i)
⊢ succ^[n] i ≤ succ^[Nat.succ n] i

Next tactic:
rw [Function.iterate_succ']
theorem pred_succ_iterate_of_not_isMax (i : α) (n : ℕ) (hin : ¬IsMax (succ^[n - 1] i)) :
    pred^[n] (succ^[n] i) = i := by
  induction' n with n hn
  · simp only [Nat.zero_eq, Function.iterate_zero, id.def]
  rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hin
  have h_not_max : ¬IsMax (succ^[n - 1] i) := by
    cases' n with n
    · simpa using hin
    rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hn ⊢
    have h_sub_le : succ^[n] i ≤ succ^[n.succ] i := by
      rw [Function.iterate_succ']
      

Proof state:
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : SuccOrder α
inst✝ : PredOrder α
a b i : α
n : ℕ
hn : ¬IsMax (succ^[n] i) → pred^[Nat.succ n] (succ^[Nat.succ n] i) = i
hin : ¬IsMax (succ^[Nat.succ n] i)
⊢ succ^[n] i ≤ (succ ∘ succ^[n]) i

Next tactic:
exact le_succ _
theorem pred_succ_iterate_of_not_isMax (i : α) (n : ℕ) (hin : ¬IsMax (succ^[n - 1] i)) :
    pred^[n] (succ^[n] i) = i := by
  induction' n with n hn
  · simp only [Nat.zero_eq, Function.iterate_zero, id.def]
  rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hin
  have h_not_max : ¬IsMax (succ^[n - 1] i) := by
    cases' n with n
    · simpa using hin
    rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hn ⊢
    have h_sub_le : succ^[n] i ≤ succ^[n.succ] i := by
      rw [Function.iterate_succ']
      exact le_succ _
    

Proof state:
case succ
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : SuccOrder α
inst✝ : PredOrder α
a b i : α
n : ℕ
hn : ¬IsMax (succ^[n] i) → pred^[Nat.succ n] (succ^[Nat.succ n] i) = i
hin : ¬IsMax (succ^[Nat.succ n] i)
h_sub_le : succ^[n] i ≤ succ^[Nat.succ n] i
⊢ ¬IsMax (succ^[n] i)

Next tactic:
refine' fun h_max => hin fun j hj => _
theorem pred_succ_iterate_of_not_isMax (i : α) (n : ℕ) (hin : ¬IsMax (succ^[n - 1] i)) :
    pred^[n] (succ^[n] i) = i := by
  induction' n with n hn
  · simp only [Nat.zero_eq, Function.iterate_zero, id.def]
  rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hin
  have h_not_max : ¬IsMax (succ^[n - 1] i) := by
    cases' n with n
    · simpa using hin
    rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hn ⊢
    have h_sub_le : succ^[n] i ≤ succ^[n.succ] i := by
      rw [Function.iterate_succ']
      exact le_succ _
    refine' fun h_max => hin fun j hj => _
    

Proof state:
case succ
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : SuccOrder α
inst✝ : PredOrder α
a b i : α
n : ℕ
hn : ¬IsMax (succ^[n] i) → pred^[Nat.succ n] (succ^[Nat.succ n] i) = i
hin : ¬IsMax (succ^[Nat.succ n] i)
h_sub_le : succ^[n] i ≤ succ^[Nat.succ n] i
h_max : IsMax (succ^[n] i)
j : α
hj : succ^[Nat.succ n] i ≤ j
⊢ j ≤ succ^[Nat.succ n] i

Next tactic:
have hj_le : j ≤ succ^[n] i := h_max (h_sub_le.trans hj)
theorem pred_succ_iterate_of_not_isMax (i : α) (n : ℕ) (hin : ¬IsMax (succ^[n - 1] i)) :
    pred^[n] (succ^[n] i) = i := by
  induction' n with n hn
  · simp only [Nat.zero_eq, Function.iterate_zero, id.def]
  rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hin
  have h_not_max : ¬IsMax (succ^[n - 1] i) := by
    cases' n with n
    · simpa using hin
    rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hn ⊢
    have h_sub_le : succ^[n] i ≤ succ^[n.succ] i := by
      rw [Function.iterate_succ']
      exact le_succ _
    refine' fun h_max => hin fun j hj => _
    have hj_le : j ≤ succ^[n] i := h_max (h_sub_le.trans hj)
    

Proof state:
case succ
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : SuccOrder α
inst✝ : PredOrder α
a b i : α
n : ℕ
hn : ¬IsMax (succ^[n] i) → pred^[Nat.succ n] (succ^[Nat.succ n] i) = i
hin : ¬IsMax (succ^[Nat.succ n] i)
h_sub_le : succ^[n] i ≤ succ^[Nat.succ n] i
h_max : IsMax (succ^[n] i)
j : α
hj : succ^[Nat.succ n] i ≤ j
hj_le : j ≤ succ^[n] i
⊢ j ≤ succ^[Nat.succ n] i

Next tactic:
exact hj_le.trans h_sub_le
theorem pred_succ_iterate_of_not_isMax (i : α) (n : ℕ) (hin : ¬IsMax (succ^[n - 1] i)) :
    pred^[n] (succ^[n] i) = i := by
  induction' n with n hn
  · simp only [Nat.zero_eq, Function.iterate_zero, id.def]
  rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hin
  have h_not_max : ¬IsMax (succ^[n - 1] i) := by
    cases' n with n
    · simpa using hin
    rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hn ⊢
    have h_sub_le : succ^[n] i ≤ succ^[n.succ] i := by
      rw [Function.iterate_succ']
      exact le_succ _
    refine' fun h_max => hin fun j hj => _
    have hj_le : j ≤ succ^[n] i := h_max (h_sub_le.trans hj)
    exact hj_le.trans h_sub_le
  

Proof state:
case succ
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : SuccOrder α
inst✝ : PredOrder α
a b i : α
n : ℕ
hn : ¬IsMax (succ^[n - 1] i) → pred^[n] (succ^[n] i) = i
hin : ¬IsMax (succ^[n] i)
h_not_max : ¬IsMax (succ^[n - 1] i)
⊢ pred^[Nat.succ n] (succ^[Nat.succ n] i) = i

Next tactic:
rw [Function.iterate_succ, Function.iterate_succ']
theorem pred_succ_iterate_of_not_isMax (i : α) (n : ℕ) (hin : ¬IsMax (succ^[n - 1] i)) :
    pred^[n] (succ^[n] i) = i := by
  induction' n with n hn
  · simp only [Nat.zero_eq, Function.iterate_zero, id.def]
  rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hin
  have h_not_max : ¬IsMax (succ^[n - 1] i) := by
    cases' n with n
    · simpa using hin
    rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hn ⊢
    have h_sub_le : succ^[n] i ≤ succ^[n.succ] i := by
      rw [Function.iterate_succ']
      exact le_succ _
    refine' fun h_max => hin fun j hj => _
    have hj_le : j ≤ succ^[n] i := h_max (h_sub_le.trans hj)
    exact hj_le.trans h_sub_le
  rw [Function.iterate_succ, Function.iterate_succ']
  

Proof state:
case succ
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : SuccOrder α
inst✝ : PredOrder α
a b i : α
n : ℕ
hn : ¬IsMax (succ^[n - 1] i) → pred^[n] (succ^[n] i) = i
hin : ¬IsMax (succ^[n] i)
h_not_max : ¬IsMax (succ^[n - 1] i)
⊢ (pred^[n] ∘ pred) ((succ ∘ succ^[n]) i) = i

Next tactic:
simp only [Function.comp_apply]
theorem pred_succ_iterate_of_not_isMax (i : α) (n : ℕ) (hin : ¬IsMax (succ^[n - 1] i)) :
    pred^[n] (succ^[n] i) = i := by
  induction' n with n hn
  · simp only [Nat.zero_eq, Function.iterate_zero, id.def]
  rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hin
  have h_not_max : ¬IsMax (succ^[n - 1] i) := by
    cases' n with n
    · simpa using hin
    rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hn ⊢
    have h_sub_le : succ^[n] i ≤ succ^[n.succ] i := by
      rw [Function.iterate_succ']
      exact le_succ _
    refine' fun h_max => hin fun j hj => _
    have hj_le : j ≤ succ^[n] i := h_max (h_sub_le.trans hj)
    exact hj_le.trans h_sub_le
  rw [Function.iterate_succ, Function.iterate_succ']
  simp only [Function.comp_apply]
  

Proof state:
case succ
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : SuccOrder α
inst✝ : PredOrder α
a b i : α
n : ℕ
hn : ¬IsMax (succ^[n - 1] i) → pred^[n] (succ^[n] i) = i
hin : ¬IsMax (succ^[n] i)
h_not_max : ¬IsMax (succ^[n - 1] i)
⊢ pred^[n] (pred (succ (succ^[n] i))) = i

Next tactic:
rw [pred_succ_of_not_isMax hin]
theorem pred_succ_iterate_of_not_isMax (i : α) (n : ℕ) (hin : ¬IsMax (succ^[n - 1] i)) :
    pred^[n] (succ^[n] i) = i := by
  induction' n with n hn
  · simp only [Nat.zero_eq, Function.iterate_zero, id.def]
  rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hin
  have h_not_max : ¬IsMax (succ^[n - 1] i) := by
    cases' n with n
    · simpa using hin
    rw [Nat.succ_sub_succ_eq_sub, Nat.sub_zero] at hn ⊢
    have h_sub_le : succ^[n] i ≤ succ^[n.succ] i := by
      rw [Function.iterate_succ']
      exact le_succ _
    refine' fun h_max => hin fun j hj => _
    have hj_le : j ≤ succ^[n] i := h_max (h_sub_le.trans hj)
    exact hj_le.trans h_sub_le
  rw [Function.iterate_succ, Function.iterate_succ']
  simp only [Function.comp_apply]
  rw [pred_succ_of_not_isMax hin]
  

Proof state:
case succ
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : SuccOrder α
inst✝ : PredOrder α
a b i : α
n : ℕ
hn : ¬IsMax (succ^[n - 1] i) → pred^[n] (succ^[n] i) = i
hin : ¬IsMax (succ^[n] i)
h_not_max : ¬IsMax (succ^[n - 1] i)
⊢ pred^[n] (succ^[n] i) = i

Next tactic:
exact hn h_not_max
instance : SuccOrder (WithTop α) where
  succ a :=
    match a with
    | ⊤ => ⊤
    | Option.some a => ite (a = ⊤) ⊤ (some (succ a))
  le_succ a := by
    

Proof state:
α : Type u_1
β : Type u_2
inst✝³ : DecidableEq α
inst✝² : PartialOrder α
inst✝¹ : OrderTop α
inst✝ : SuccOrder α
a : WithTop α
⊢ a ≤
    (fun a =>
        match a with
        | none => ⊤
        | Option.some a => if a = ⊤ then ⊤ else ↑(succ a))
      a

Next tactic:
cases' a with a a
instance : SuccOrder (WithTop α) where
  succ a :=
    match a with
    | ⊤ => ⊤
    | Option.some a => ite (a = ⊤) ⊤ (some (succ a))
  le_succ a := by
    cases' a with a a
    · 

Proof state:
case none
α : Type u_1
β : Type u_2
inst✝³ : DecidableEq α
inst✝² : PartialOrder α
inst✝¹ : OrderTop α
inst✝ : SuccOrder α
⊢ none ≤
    (fun a =>
        match a with
        | none => ⊤
        | Option.some a => if a = ⊤ then ⊤ else ↑(succ a))
      none

Next tactic:
exact le_top
instance : SuccOrder (WithTop α) where
  succ a :=
    match a with
    | ⊤ => ⊤
    | Option.some a => ite (a = ⊤) ⊤ (some (succ a))
  le_succ a := by
    cases' a with a a
    · exact le_top
    

Proof state:
case some
α : Type u_1
β : Type u_2
inst✝³ : DecidableEq α
inst✝² : PartialOrder α
inst✝¹ : OrderTop α
inst✝ : SuccOrder α
a : α
⊢ Option.some a ≤
    (fun a =>
        match a with
        | none => ⊤
        | Option.some a => if a = ⊤ then ⊤ else ↑(succ a))
      (Option.some a)

Next tactic:
change _ ≤ ite _ _ _
instance : SuccOrder (WithTop α) where
  succ a :=
    match a with
    | ⊤ => ⊤
    | Option.some a => ite (a = ⊤) ⊤ (some (succ a))
  le_succ a := by
    cases' a with a a
    · exact le_top
    change _ ≤ ite _ _ _
    

Proof state:
case some
α : Type u_1
β : Type u_2
inst✝³ : DecidableEq α
inst✝² : PartialOrder α
inst✝¹ : OrderTop α
inst✝ : SuccOrder α
a : α
⊢ Option.some a ≤ if a = ⊤ then ⊤ else ↑(succ a)

Next tactic:
split_ifs
instance : SuccOrder (WithTop α) where
  succ a :=
    match a with
    | ⊤ => ⊤
    | Option.some a => ite (a = ⊤) ⊤ (some (succ a))
  le_succ a := by
    cases' a with a a
    · exact le_top
    change _ ≤ ite _ _ _
    split_ifs
    · 

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝³ : DecidableEq α
inst✝² : PartialOrder α
inst✝¹ : OrderTop α
inst✝ : SuccOrder α
a : α
h✝ : a = ⊤
⊢ Option.some a ≤ ⊤

Next tactic:
exact le_top
instance : SuccOrder (WithTop α) where
  succ a :=
    match a with
    | ⊤ => ⊤
    | Option.some a => ite (a = ⊤) ⊤ (some (succ a))
  le_succ a := by
    cases' a with a a
    · exact le_top
    change _ ≤ ite _ _ _
    split_ifs
    · exact le_top
    · 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝³ : DecidableEq α
inst✝² : PartialOrder α
inst✝¹ : OrderTop α
inst✝ : SuccOrder α
a : α
h✝ : ¬a = ⊤
⊢ Option.some a ≤ ↑(succ a)

Next tactic:
exact some_le_some.2 (le_succ a)
instance : SuccOrder (WithTop α) where
  succ a :=
    match a with
    | ⊤ => ⊤
    | Option.some a => ite (a = ⊤) ⊤ (some (succ a))
  le_succ a := by
    cases' a with a a
    · exact le_top
    change _ ≤ ite _ _ _
    split_ifs
    · exact le_top
    · exact some_le_some.2 (le_succ a)
  max_of_succ_le {a} ha := by
    

Proof state:
α : Type u_1
β : Type u_2
inst✝³ : DecidableEq α
inst✝² : PartialOrder α
inst✝¹ : OrderTop α
inst✝ : SuccOrder α
a : WithTop α
ha :
  (fun a =>
        match a with
        | none => ⊤
        | Option.some a => if a = ⊤ then ⊤ else ↑(succ a))
      a ≤
    a
⊢ IsMax a

Next tactic:
cases a
instance : SuccOrder (WithTop α) where
  succ a :=
    match a with
    | ⊤ => ⊤
    | Option.some a => ite (a = ⊤) ⊤ (some (succ a))
  le_succ a := by
    cases' a with a a
    · exact le_top
    change _ ≤ ite _ _ _
    split_ifs
    · exact le_top
    · exact some_le_some.2 (le_succ a)
  max_of_succ_le {a} ha := by
    cases a
    · 

Proof state:
case none
α : Type u_1
β : Type u_2
inst✝³ : DecidableEq α
inst✝² : PartialOrder α
inst✝¹ : OrderTop α
inst✝ : SuccOrder α
ha :
  (fun a =>
        match a with
        | none => ⊤
        | Option.some a => if a = ⊤ then ⊤ else ↑(succ a))
      none ≤
    none
⊢ IsMax none

Next tactic:
exact isMax_top
instance : SuccOrder (WithTop α) where
  succ a :=
    match a with
    | ⊤ => ⊤
    | Option.some a => ite (a = ⊤) ⊤ (some (succ a))
  le_succ a := by
    cases' a with a a
    · exact le_top
    change _ ≤ ite _ _ _
    split_ifs
    · exact le_top
    · exact some_le_some.2 (le_succ a)
  max_of_succ_le {a} ha := by
    cases a
    · exact isMax_top
    

Proof state:
case some
α : Type u_1
β : Type u_2
inst✝³ : DecidableEq α
inst✝² : PartialOrder α
inst✝¹ : OrderTop α
inst✝ : SuccOrder α
val✝ : α
ha :
  (fun a =>
        match a with
        | none => ⊤
        | Option.some a => if a = ⊤ then ⊤ else ↑(succ a))
      (Option.some val✝) ≤
    Option.some val✝
⊢ IsMax (Option.some val✝)

Next tactic:
dsimp only at ha
instance : SuccOrder (WithTop α) where
  succ a :=
    match a with
    | ⊤ => ⊤
    | Option.some a => ite (a = ⊤) ⊤ (some (succ a))
  le_succ a := by
    cases' a with a a
    · exact le_top
    change _ ≤ ite _ _ _
    split_ifs
    · exact le_top
    · exact some_le_some.2 (le_succ a)
  max_of_succ_le {a} ha := by
    cases a
    · exact isMax_top
    dsimp only at ha
    

Proof state:
case some
α : Type u_1
β : Type u_2
inst✝³ : DecidableEq α
inst✝² : PartialOrder α
inst✝¹ : OrderTop α
inst✝ : SuccOrder α
val✝ : α
ha : (if val✝ = ⊤ then ⊤ else ↑(succ val✝)) ≤ Option.some val✝
⊢ IsMax (Option.some val✝)

Next tactic:
split_ifs at ha with ha'
instance : SuccOrder (WithTop α) where
  succ a :=
    match a with
    | ⊤ => ⊤
    | Option.some a => ite (a = ⊤) ⊤ (some (succ a))
  le_succ a := by
    cases' a with a a
    · exact le_top
    change _ ≤ ite _ _ _
    split_ifs
    · exact le_top
    · exact some_le_some.2 (le_succ a)
  max_of_succ_le {a} ha := by
    cases a
    · exact isMax_top
    dsimp only at ha
    split_ifs at ha with ha'
    · 

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝³ : DecidableEq α
inst✝² : PartialOrder α
inst✝¹ : OrderTop α
inst✝ : SuccOrder α
val✝ : α
ha' : val✝ = ⊤
ha : ⊤ ≤ Option.some val✝
⊢ IsMax (Option.some val✝)

Next tactic:
exact (not_top_le_coe _ ha).elim
instance : SuccOrder (WithTop α) where
  succ a :=
    match a with
    | ⊤ => ⊤
    | Option.some a => ite (a = ⊤) ⊤ (some (succ a))
  le_succ a := by
    cases' a with a a
    · exact le_top
    change _ ≤ ite _ _ _
    split_ifs
    · exact le_top
    · exact some_le_some.2 (le_succ a)
  max_of_succ_le {a} ha := by
    cases a
    · exact isMax_top
    dsimp only at ha
    split_ifs at ha with ha'
    · exact (not_top_le_coe _ ha).elim
    · 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝³ : DecidableEq α
inst✝² : PartialOrder α
inst✝¹ : OrderTop α
inst✝ : SuccOrder α
val✝ : α
ha' : ¬val✝ = ⊤
ha : ↑(succ val✝) ≤ Option.some val✝
⊢ IsMax (Option.some val✝)

Next tactic:
rw [some_eq_coe, coe_le_coe, succ_le_iff_eq_top] at ha
instance : SuccOrder (WithTop α) where
  succ a :=
    match a with
    | ⊤ => ⊤
    | Option.some a => ite (a = ⊤) ⊤ (some (succ a))
  le_succ a := by
    cases' a with a a
    · exact le_top
    change _ ≤ ite _ _ _
    split_ifs
    · exact le_top
    · exact some_le_some.2 (le_succ a)
  max_of_succ_le {a} ha := by
    cases a
    · exact isMax_top
    dsimp only at ha
    split_ifs at ha with ha'
    · exact (not_top_le_coe _ ha).elim
    · rw [some_eq_coe, coe_le_coe, succ_le_iff_eq_top] at ha
      

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝³ : DecidableEq α
inst✝² : PartialOrder α
inst✝¹ : OrderTop α
inst✝ : SuccOrder α
val✝ : α
ha' : ¬val✝ = ⊤
ha : val✝ = ⊤
⊢ IsMax (Option.some val✝)

Next tactic:
exact (ha' ha).elim
instance : SuccOrder (WithTop α) where
  succ a :=
    match a with
    | ⊤ => ⊤
    | Option.some a => ite (a = ⊤) ⊤ (some (succ a))
  le_succ a := by
    cases' a with a a
    · exact le_top
    change _ ≤ ite _ _ _
    split_ifs
    · exact le_top
    · exact some_le_some.2 (le_succ a)
  max_of_succ_le {a} ha := by
    cases a
    · exact isMax_top
    dsimp only at ha
    split_ifs at ha with ha'
    · exact (not_top_le_coe _ ha).elim
    · rw [some_eq_coe, coe_le_coe, succ_le_iff_eq_top] at ha
      exact (ha' ha).elim
  succ_le_of_lt {a b} h := by
    

Proof state:
α : Type u_1
β : Type u_2
inst✝³ : DecidableEq α
inst✝² : PartialOrder α
inst✝¹ : OrderTop α
inst✝ : SuccOrder α
a b : WithTop α
h : a < b
⊢ (fun a =>
        match a with
        | none => ⊤
        | Option.some a => if a = ⊤ then ⊤ else ↑(succ a))
      a ≤
    b

Next tactic:
cases b