l3lab/ntp-mathlib huggingface dataset:
theorem isMax_iterate_succ_of_eq_of_lt {n m : ℕ} (h_eq : succ^[n] a = succ^[m] a)
    (h_lt : n < m) : IsMax (succ^[n] a) := by
  refine' max_of_succ_le (le_trans _ h_eq.symm.le)
  have : succ (succ^[n] a) = succ^[n + 1] a := by rw [Function.iterate_succ', comp]
  rw [this]
  have h_le : n + 1 ≤ m := Nat.succ_le_of_lt h_lt
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : Preorder α
inst✝ : SuccOrder α
a b : α
n m : ℕ
h_eq : succ^[n] a = succ^[m] a
h_lt : n < m
this : succ (succ^[n] a) = succ^[n + 1] a
h_le : n + 1 ≤ m
⊢ succ^[n + 1] a ≤ succ^[m] a

Next tactic:
exact Monotone.monotone_iterate_of_le_map succ_mono (le_succ a) h_le
theorem isMax_iterate_succ_of_eq_of_ne {n m : ℕ} (h_eq : succ^[n] a = succ^[m] a)
    (h_ne : n ≠ m) : IsMax (succ^[n] a) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : Preorder α
inst✝ : SuccOrder α
a b : α
n m : ℕ
h_eq : succ^[n] a = succ^[m] a
h_ne : n ≠ m
⊢ IsMax (succ^[n] a)

Next tactic:
rcases le_total n m with h | h
theorem isMax_iterate_succ_of_eq_of_ne {n m : ℕ} (h_eq : succ^[n] a = succ^[m] a)
    (h_ne : n ≠ m) : IsMax (succ^[n] a) := by
  rcases le_total n m with h | h
  · 

Proof state:
case inl
α : Type u_1
β : Type u_2
inst✝¹ : Preorder α
inst✝ : SuccOrder α
a b : α
n m : ℕ
h_eq : succ^[n] a = succ^[m] a
h_ne : n ≠ m
h : n ≤ m
⊢ IsMax (succ^[n] a)

Next tactic:
exact isMax_iterate_succ_of_eq_of_lt h_eq (lt_of_le_of_ne h h_ne)
theorem isMax_iterate_succ_of_eq_of_ne {n m : ℕ} (h_eq : succ^[n] a = succ^[m] a)
    (h_ne : n ≠ m) : IsMax (succ^[n] a) := by
  rcases le_total n m with h | h
  · exact isMax_iterate_succ_of_eq_of_lt h_eq (lt_of_le_of_ne h h_ne)
  · 

Proof state:
case inr
α : Type u_1
β : Type u_2
inst✝¹ : Preorder α
inst✝ : SuccOrder α
a b : α
n m : ℕ
h_eq : succ^[n] a = succ^[m] a
h_ne : n ≠ m
h : m ≤ n
⊢ IsMax (succ^[n] a)

Next tactic:
rw [h_eq]
theorem isMax_iterate_succ_of_eq_of_ne {n m : ℕ} (h_eq : succ^[n] a = succ^[m] a)
    (h_ne : n ≠ m) : IsMax (succ^[n] a) := by
  rcases le_total n m with h | h
  · exact isMax_iterate_succ_of_eq_of_lt h_eq (lt_of_le_of_ne h h_ne)
  · rw [h_eq]
    

Proof state:
case inr
α : Type u_1
β : Type u_2
inst✝¹ : Preorder α
inst✝ : SuccOrder α
a b : α
n m : ℕ
h_eq : succ^[n] a = succ^[m] a
h_ne : n ≠ m
h : m ≤ n
⊢ IsMax (succ^[m] a)

Next tactic:
exact isMax_iterate_succ_of_eq_of_lt h_eq.symm (lt_of_le_of_ne h h_ne.symm)
theorem Ico_succ_right_of_not_isMax (hb : ¬IsMax b) : Ico a (succ b) = Icc a b := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : Preorder α
inst✝ : SuccOrder α
a b : α
hb : ¬IsMax b
⊢ Ico a (succ b) = Icc a b

Next tactic:
rw [← Ici_inter_Iio, Iio_succ_of_not_isMax hb, Ici_inter_Iic]
theorem Ioo_succ_right_of_not_isMax (hb : ¬IsMax b) : Ioo a (succ b) = Ioc a b := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : Preorder α
inst✝ : SuccOrder α
a b : α
hb : ¬IsMax b
⊢ Ioo a (succ b) = Ioc a b

Next tactic:
rw [← Ioi_inter_Iio, Iio_succ_of_not_isMax hb, Ioi_inter_Iic]
theorem Icc_succ_left_of_not_isMax (ha : ¬IsMax a) : Icc (succ a) b = Ioc a b := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : Preorder α
inst✝ : SuccOrder α
a b : α
ha : ¬IsMax a
⊢ Icc (succ a) b = Ioc a b

Next tactic:
rw [← Ici_inter_Iic, Ici_succ_of_not_isMax ha, Ioi_inter_Iic]
theorem Ico_succ_left_of_not_isMax (ha : ¬IsMax a) : Ico (succ a) b = Ioo a b := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : Preorder α
inst✝ : SuccOrder α
a b : α
ha : ¬IsMax a
⊢ Ico (succ a) b = Ioo a b

Next tactic:
rw [← Ici_inter_Iio, Ici_succ_of_not_isMax ha, Ioi_inter_Iio]
theorem succ_le_succ_iff : succ a ≤ succ b ↔ a ≤ b := by 

Proof state:
α : Type u_1
β : Type u_2
inst✝² : Preorder α
inst✝¹ : SuccOrder α
a b : α
inst✝ : NoMaxOrder α
⊢ succ a ≤ succ b ↔ a ≤ b

Next tactic:
simp
theorem succ_lt_succ_iff : succ a < succ b ↔ a < b := by 

Proof state:
α : Type u_1
β : Type u_2
inst✝² : Preorder α
inst✝¹ : SuccOrder α
a b : α
inst✝ : NoMaxOrder α
⊢ succ a < succ b ↔ a < b

Next tactic:
simp
theorem succ_eq_succ_iff_of_not_isMax (ha : ¬IsMax a) (hb : ¬IsMax b) :
    succ a = succ b ↔ a = b := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : SuccOrder α
a b : α
ha : ¬IsMax a
hb : ¬IsMax b
⊢ succ a = succ b ↔ a = b

Next tactic:
rw [eq_iff_le_not_lt, eq_iff_le_not_lt, succ_le_succ_iff_of_not_isMax ha hb,
    succ_lt_succ_iff_of_not_isMax ha hb]
theorem le_le_succ_iff : a ≤ b ∧ b ≤ succ a ↔ b = a ∨ b = succ a := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : SuccOrder α
a b : α
⊢ a ≤ b ∧ b ≤ succ a ↔ b = a ∨ b = succ a

Next tactic:
refine'
    ⟨fun h =>
      or_iff_not_imp_left.2 fun hba : b ≠ a =>
        h.2.antisymm (succ_le_of_lt <| h.1.lt_of_ne <| hba.symm),
      _⟩
theorem le_le_succ_iff : a ≤ b ∧ b ≤ succ a ↔ b = a ∨ b = succ a := by
  refine'
    ⟨fun h =>
      or_iff_not_imp_left.2 fun hba : b ≠ a =>
        h.2.antisymm (succ_le_of_lt <| h.1.lt_of_ne <| hba.symm),
      _⟩
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : SuccOrder α
a b : α
⊢ b = a ∨ b = succ a → a ≤ b ∧ b ≤ succ a

Next tactic:
rintro (rfl | rfl)
theorem le_le_succ_iff : a ≤ b ∧ b ≤ succ a ↔ b = a ∨ b = succ a := by
  refine'
    ⟨fun h =>
      or_iff_not_imp_left.2 fun hba : b ≠ a =>
        h.2.antisymm (succ_le_of_lt <| h.1.lt_of_ne <| hba.symm),
      _⟩
  rintro (rfl | rfl)
  · 

Proof state:
case inl
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : SuccOrder α
b : α
⊢ b ≤ b ∧ b ≤ succ b

Next tactic:
exact ⟨le_rfl, le_succ b⟩
theorem le_le_succ_iff : a ≤ b ∧ b ≤ succ a ↔ b = a ∨ b = succ a := by
  refine'
    ⟨fun h =>
      or_iff_not_imp_left.2 fun hba : b ≠ a =>
        h.2.antisymm (succ_le_of_lt <| h.1.lt_of_ne <| hba.symm),
      _⟩
  rintro (rfl | rfl)
  · exact ⟨le_rfl, le_succ b⟩
  · 

Proof state:
case inr
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : SuccOrder α
a : α
⊢ a ≤ succ a ∧ succ a ≤ succ a

Next tactic:
exact ⟨le_succ a, le_rfl⟩
theorem _root_.Wcovby.le_succ (h : a ⩿ b) : b ≤ succ a := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : SuccOrder α
a b : α
h : a ⩿ b
⊢ b ≤ succ a

Next tactic:
obtain h | rfl := h.covby_or_eq
theorem _root_.Wcovby.le_succ (h : a ⩿ b) : b ≤ succ a := by
  obtain h | rfl := h.covby_or_eq
  · 

Proof state:
case inl
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : SuccOrder α
a b : α
h✝ : a ⩿ b
h : a ⋖ b
⊢ b ≤ succ a

Next tactic:
exact (Covby.succ_eq h).ge
theorem _root_.Wcovby.le_succ (h : a ⩿ b) : b ≤ succ a := by
  obtain h | rfl := h.covby_or_eq
  · exact (Covby.succ_eq h).ge
  · 

Proof state:
case inr
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : SuccOrder α
a : α
h : a ⩿ a
⊢ a ≤ succ a

Next tactic:
exact le_succ _
theorem le_succ_iff_eq_or_le : a ≤ succ b ↔ a = succ b ∨ a ≤ b := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : SuccOrder α
a b : α
⊢ a ≤ succ b ↔ a = succ b ∨ a ≤ b

Next tactic:
by_cases hb : IsMax b
theorem le_succ_iff_eq_or_le : a ≤ succ b ↔ a = succ b ∨ a ≤ b := by
  by_cases hb : IsMax b
  · 

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : SuccOrder α
a b : α
hb : IsMax b
⊢ a ≤ succ b ↔ a = succ b ∨ a ≤ b

Next tactic:
rw [hb.succ_eq, or_iff_right_of_imp le_of_eq]
theorem le_succ_iff_eq_or_le : a ≤ succ b ↔ a = succ b ∨ a ≤ b := by
  by_cases hb : IsMax b
  · rw [hb.succ_eq, or_iff_right_of_imp le_of_eq]
  · 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : SuccOrder α
a b : α
hb : ¬IsMax b
⊢ a ≤ succ b ↔ a = succ b ∨ a ≤ b

Next tactic:
rw [← lt_succ_iff_of_not_isMax hb, le_iff_eq_or_lt]
theorem Icc_succ_right (h : a ≤ succ b) : Icc a (succ b) = insert (succ b) (Icc a b) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : SuccOrder α
a b : α
h : a ≤ succ b
⊢ Icc a (succ b) = insert (succ b) (Icc a b)

Next tactic:
simp_rw [← Ici_inter_Iic, Iic_succ, inter_insert_of_mem (mem_Ici.2 h)]
theorem Ioc_succ_right (h : a < succ b) : Ioc a (succ b) = insert (succ b) (Ioc a b) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : SuccOrder α
a b : α
h : a < succ b
⊢ Ioc a (succ b) = insert (succ b) (Ioc a b)

Next tactic:
simp_rw [← Ioi_inter_Iic, Iic_succ, inter_insert_of_mem (mem_Ioi.2 h)]
theorem Ico_succ_right_eq_insert_of_not_isMax (h₁ : a ≤ b) (h₂ : ¬IsMax b) :
    Ico a (succ b) = insert b (Ico a b) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : SuccOrder α
a b : α
h₁ : a ≤ b
h₂ : ¬IsMax b
⊢ Ico a (succ b) = insert b (Ico a b)

Next tactic:
simp_rw [← Iio_inter_Ici, Iio_succ_eq_insert_of_not_isMax h₂, insert_inter_of_mem (mem_Ici.2 h₁)]
theorem Ioo_succ_right_eq_insert_of_not_isMax (h₁ : a < b) (h₂ : ¬IsMax b) :
    Ioo a (succ b) = insert b (Ioo a b) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : SuccOrder α
a b : α
h₁ : a < b
h₂ : ¬IsMax b
⊢ Ioo a (succ b) = insert b (Ioo a b)

Next tactic:
simp_rw [← Iio_inter_Ioi, Iio_succ_eq_insert_of_not_isMax h₂, insert_inter_of_mem (mem_Ioi.2 h₁)]
theorem succ_eq_iff_covby : succ a = b ↔ a ⋖ b :=
  ⟨by
    

Proof state:
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : SuccOrder α
a b : α
inst✝ : NoMaxOrder α
⊢ succ a = b → a ⋖ b

Next tactic:
rintro rfl
theorem succ_eq_iff_covby : succ a = b ↔ a ⋖ b :=
  ⟨by
    rintro rfl
    

Proof state:
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : SuccOrder α
a : α
inst✝ : NoMaxOrder α
⊢ a ⋖ succ a

Next tactic:
exact covby_succ _
@[simp]
theorem succ_top : succ (⊤ : α) = ⊤ := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : SuccOrder α
a b : α
inst✝ : OrderTop α
⊢ succ ⊤ = ⊤

Next tactic:
rw [succ_eq_iff_isMax, isMax_iff_eq_top]
theorem lt_succ_bot_iff [NoMaxOrder α] : a < succ ⊥ ↔ a = ⊥ := by 

Proof state:
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : SuccOrder α
a b : α
inst✝¹ : OrderBot α
inst✝ : NoMaxOrder α
⊢ a < succ ⊥ ↔ a = ⊥

Next tactic:
rw [lt_succ_iff, le_bot_iff]
theorem le_succ_bot_iff : a ≤ succ ⊥ ↔ a = ⊥ ∨ a = succ ⊥ := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : SuccOrder α
a b : α
inst✝ : OrderBot α
⊢ a ≤ succ ⊥ ↔ a = ⊥ ∨ a = succ ⊥

Next tactic:
rw [le_succ_iff_eq_or_le, le_bot_iff, or_comm]
/-- There is at most one way to define the successors in a `PartialOrder`. -/
instance [PartialOrder α] : Subsingleton (SuccOrder α) :=
  ⟨by
    

Proof state:
α : Type u_1
β : Type u_2
inst✝ : PartialOrder α
⊢ ∀ (a b : SuccOrder α), a = b

Next tactic:
intro h₀ h₁
/-- There is at most one way to define the successors in a `PartialOrder`. -/
instance [PartialOrder α] : Subsingleton (SuccOrder α) :=
  ⟨by
    intro h₀ h₁
    

Proof state:
α : Type u_1
β : Type u_2
inst✝ : PartialOrder α
h₀ h₁ : SuccOrder α
⊢ h₀ = h₁

Next tactic:
ext a
/-- There is at most one way to define the successors in a `PartialOrder`. -/
instance [PartialOrder α] : Subsingleton (SuccOrder α) :=
  ⟨by
    intro h₀ h₁
    ext a
    

Proof state:
case succ.h
α : Type u_1
β : Type u_2
inst✝ : PartialOrder α
h₀ h₁ : SuccOrder α
a : α
⊢ SuccOrder.succ a = SuccOrder.succ a

Next tactic:
by_cases ha : IsMax a
/-- There is at most one way to define the successors in a `PartialOrder`. -/
instance [PartialOrder α] : Subsingleton (SuccOrder α) :=
  ⟨by
    intro h₀ h₁
    ext a
    by_cases ha : IsMax a
    · 

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝ : PartialOrder α
h₀ h₁ : SuccOrder α
a : α
ha : IsMax a
⊢ SuccOrder.succ a = SuccOrder.succ a

Next tactic:
exact (@IsMax.succ_eq _ _ h₀ _ ha).trans ha.succ_eq.symm
/-- There is at most one way to define the successors in a `PartialOrder`. -/
instance [PartialOrder α] : Subsingleton (SuccOrder α) :=
  ⟨by
    intro h₀ h₁
    ext a
    by_cases ha : IsMax a
    · exact (@IsMax.succ_eq _ _ h₀ _ ha).trans ha.succ_eq.symm
    · 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝ : PartialOrder α
h₀ h₁ : SuccOrder α
a : α
ha : ¬IsMax a
⊢ SuccOrder.succ a = SuccOrder.succ a

Next tactic:
exact @Covby.succ_eq _ _ h₀ _ _ (covby_succ_of_not_isMax ha)
theorem succ_eq_iInf (a : α) : succ a = ⨅ (b) (_ : a < b), b := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : CompleteLattice α
inst✝ : SuccOrder α
a : α
⊢ succ a = ⨅ b, ⨅ (_ : a < b), b

Next tactic:
refine' le_antisymm (le_iInf fun b => le_iInf succ_le_of_lt) _
theorem succ_eq_iInf (a : α) : succ a = ⨅ (b) (_ : a < b), b := by
  refine' le_antisymm (le_iInf fun b => le_iInf succ_le_of_lt) _
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : CompleteLattice α
inst✝ : SuccOrder α
a : α
⊢ ⨅ b, ⨅ (_ : a < b), b ≤ succ a

Next tactic:
obtain rfl | ha := eq_or_ne a ⊤
theorem succ_eq_iInf (a : α) : succ a = ⨅ (b) (_ : a < b), b := by
  refine' le_antisymm (le_iInf fun b => le_iInf succ_le_of_lt) _
  obtain rfl | ha := eq_or_ne a ⊤
  · 

Proof state:
case inl
α : Type u_1
β : Type u_2
inst✝¹ : CompleteLattice α
inst✝ : SuccOrder α
⊢ ⨅ b, ⨅ (_ : ⊤ < b), b ≤ succ ⊤

Next tactic:
rw [succ_top]
theorem succ_eq_iInf (a : α) : succ a = ⨅ (b) (_ : a < b), b := by
  refine' le_antisymm (le_iInf fun b => le_iInf succ_le_of_lt) _
  obtain rfl | ha := eq_or_ne a ⊤
  · rw [succ_top]
    

Proof state:
case inl
α : Type u_1
β : Type u_2
inst✝¹ : CompleteLattice α
inst✝ : SuccOrder α
⊢ ⨅ b, ⨅ (_ : ⊤ < b), b ≤ ⊤

Next tactic:
exact le_top
theorem succ_eq_iInf (a : α) : succ a = ⨅ (b) (_ : a < b), b := by
  refine' le_antisymm (le_iInf fun b => le_iInf succ_le_of_lt) _
  obtain rfl | ha := eq_or_ne a ⊤
  · rw [succ_top]
    exact le_top
  

Proof state:
case inr
α : Type u_1
β : Type u_2
inst✝¹ : CompleteLattice α
inst✝ : SuccOrder α
a : α
ha : a ≠ ⊤
⊢ ⨅ b, ⨅ (_ : a < b), b ≤ succ a

Next tactic:
exact iInf₂_le _ (lt_succ_iff_ne_top.2 ha)
theorem pred_iterate_le (k : ℕ) (x : α) : pred^[k] x ≤ x := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : Preorder α
inst✝ : PredOrder α
a b : α
k : ℕ
x : α
⊢ pred^[k] x ≤ x

Next tactic:
conv_rhs => rw [(by simp only [Function.iterate_id, id.def] : x = id^[k] x)]
theorem pred_iterate_le (k : ℕ) (x : α) : pred^[k] x ≤ x := by
  conv_rhs => 

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : Preorder α
inst✝ : PredOrder α
a b : α
k : ℕ
x : α
| x

Next tactic:
rw [(by simp only [Function.iterate_id, id.def] : x = id^[k] x)]
theorem pred_iterate_le (k : ℕ) (x : α) : pred^[k] x ≤ x := by
  conv_rhs => rw [(by 

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : Preorder α
inst✝ : PredOrder α
a b : α
k : ℕ
x : α
⊢ x = id^[k] x

Next tactic:
simp only [Function.iterate_id, id.def]
theorem pred_iterate_le (k : ℕ) (x : α) : pred^[k] x ≤ x := by
  conv_rhs => rw [(by simp only [Function.iterate_id, id.def] : x = id^[k] x)]
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : Preorder α
inst✝ : PredOrder α
a b : α
k : ℕ
x : α
⊢ pred^[k] x ≤ id^[k] x

Next tactic:
exact Monotone.iterate_le_of_le pred_mono pred_le k x
theorem Ioc_pred_left_of_not_isMin (ha : ¬IsMin a) : Ioc (pred a) b = Icc a b := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : Preorder α
inst✝ : PredOrder α
a b : α
ha : ¬IsMin a
⊢ Ioc (pred a) b = Icc a b

Next tactic:
rw [← Ioi_inter_Iic, Ioi_pred_of_not_isMin ha, Ici_inter_Iic]
theorem Ioo_pred_left_of_not_isMin (ha : ¬IsMin a) : Ioo (pred a) b = Ico a b := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : Preorder α
inst✝ : PredOrder α
a b : α
ha : ¬IsMin a
⊢ Ioo (pred a) b = Ico a b

Next tactic:
rw [← Ioi_inter_Iio, Ioi_pred_of_not_isMin ha, Ici_inter_Iio]
theorem Icc_pred_right_of_not_isMin (ha : ¬IsMin b) : Icc a (pred b) = Ico a b := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : Preorder α
inst✝ : PredOrder α
a b : α
ha : ¬IsMin b
⊢ Icc a (pred b) = Ico a b

Next tactic:
rw [← Ici_inter_Iic, Iic_pred_of_not_isMin ha, Ici_inter_Iio]
theorem Ioc_pred_right_of_not_isMin (ha : ¬IsMin b) : Ioc a (pred b) = Ioo a b := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : Preorder α
inst✝ : PredOrder α
a b : α
ha : ¬IsMin b
⊢ Ioc a (pred b) = Ioo a b

Next tactic:
rw [← Ioi_inter_Iic, Iic_pred_of_not_isMin ha, Ioi_inter_Iio]
theorem pred_le_pred_iff : pred a ≤ pred b ↔ a ≤ b := by 

Proof state:
α : Type u_1
β : Type u_2
inst✝² : Preorder α
inst✝¹ : PredOrder α
a b : α
inst✝ : NoMinOrder α
⊢ pred a ≤ pred b ↔ a ≤ b

Next tactic:
simp
theorem pred_lt_pred_iff : pred a < pred b ↔ a < b := by 

Proof state:
α : Type u_1
β : Type u_2
inst✝² : Preorder α
inst✝¹ : PredOrder α
a b : α
inst✝ : NoMinOrder α
⊢ pred a < pred b ↔ a < b

Next tactic:
simp
theorem pred_le_le_iff {a b : α} : pred a ≤ b ∧ b ≤ a ↔ b = a ∨ b = pred a := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : PredOrder α
a✝ b✝ a b : α
⊢ pred a ≤ b ∧ b ≤ a ↔ b = a ∨ b = pred a

Next tactic:
refine'
    ⟨fun h =>
      or_iff_not_imp_left.2 fun hba : b ≠ a => (le_pred_of_lt <| h.2.lt_of_ne hba).antisymm h.1, _⟩
theorem pred_le_le_iff {a b : α} : pred a ≤ b ∧ b ≤ a ↔ b = a ∨ b = pred a := by
  refine'
    ⟨fun h =>
      or_iff_not_imp_left.2 fun hba : b ≠ a => (le_pred_of_lt <| h.2.lt_of_ne hba).antisymm h.1, _⟩
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : PredOrder α
a✝ b✝ a b : α
⊢ b = a ∨ b = pred a → pred a ≤ b ∧ b ≤ a

Next tactic:
rintro (rfl | rfl)
theorem pred_le_le_iff {a b : α} : pred a ≤ b ∧ b ≤ a ↔ b = a ∨ b = pred a := by
  refine'
    ⟨fun h =>
      or_iff_not_imp_left.2 fun hba : b ≠ a => (le_pred_of_lt <| h.2.lt_of_ne hba).antisymm h.1, _⟩
  rintro (rfl | rfl)
  · 

Proof state:
case inl
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : PredOrder α
a b✝ b : α
⊢ pred b ≤ b ∧ b ≤ b

Next tactic:
exact ⟨pred_le b, le_rfl⟩
theorem pred_le_le_iff {a b : α} : pred a ≤ b ∧ b ≤ a ↔ b = a ∨ b = pred a := by
  refine'
    ⟨fun h =>
      or_iff_not_imp_left.2 fun hba : b ≠ a => (le_pred_of_lt <| h.2.lt_of_ne hba).antisymm h.1, _⟩
  rintro (rfl | rfl)
  · exact ⟨pred_le b, le_rfl⟩
  · 

Proof state:
case inr
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : PredOrder α
a✝ b a : α
⊢ pred a ≤ pred a ∧ pred a ≤ a

Next tactic:
exact ⟨le_rfl, pred_le a⟩
theorem _root_.Wcovby.pred_le (h : a ⩿ b) : pred b ≤ a := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : PredOrder α
a b : α
h : a ⩿ b
⊢ pred b ≤ a

Next tactic:
obtain h | rfl := h.covby_or_eq
theorem _root_.Wcovby.pred_le (h : a ⩿ b) : pred b ≤ a := by
  obtain h | rfl := h.covby_or_eq
  · 

Proof state:
case inl
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : PredOrder α
a b : α
h✝ : a ⩿ b
h : a ⋖ b
⊢ pred b ≤ a

Next tactic:
exact (Covby.pred_eq h).le
theorem _root_.Wcovby.pred_le (h : a ⩿ b) : pred b ≤ a := by
  obtain h | rfl := h.covby_or_eq
  · exact (Covby.pred_eq h).le
  · 

Proof state:
case inr
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : PredOrder α
a : α
h : a ⩿ a
⊢ pred a ≤ a

Next tactic:
exact pred_le _
theorem pred_le_iff_eq_or_le : pred a ≤ b ↔ b = pred a ∨ a ≤ b := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : PredOrder α
a b : α
⊢ pred a ≤ b ↔ b = pred a ∨ a ≤ b

Next tactic:
by_cases ha : IsMin a
theorem pred_le_iff_eq_or_le : pred a ≤ b ↔ b = pred a ∨ a ≤ b := by
  by_cases ha : IsMin a
  · 

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : PredOrder α
a b : α
ha : IsMin a
⊢ pred a ≤ b ↔ b = pred a ∨ a ≤ b

Next tactic:
rw [ha.pred_eq, or_iff_right_of_imp ge_of_eq]
theorem pred_le_iff_eq_or_le : pred a ≤ b ↔ b = pred a ∨ a ≤ b := by
  by_cases ha : IsMin a
  · rw [ha.pred_eq, or_iff_right_of_imp ge_of_eq]
  · 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : PredOrder α
a b : α
ha : ¬IsMin a
⊢ pred a ≤ b ↔ b = pred a ∨ a ≤ b

Next tactic:
rw [← pred_lt_iff_of_not_isMin ha, le_iff_eq_or_lt, eq_comm]
theorem Ioi_pred_eq_insert_of_not_isMin (ha : ¬IsMin a) : Ioi (pred a) = insert a (Ioi a) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : PredOrder α
a b : α
ha : ¬IsMin a
⊢ Ioi (pred a) = insert a (Ioi a)

Next tactic:
ext x
theorem Ioi_pred_eq_insert_of_not_isMin (ha : ¬IsMin a) : Ioi (pred a) = insert a (Ioi a) := by
  ext x; 

Proof state:
case h
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : PredOrder α
a b : α
ha : ¬IsMin a
x : α
⊢ x ∈ Ioi (pred a) ↔ x ∈ insert a (Ioi a)

Next tactic:
simp only [insert, mem_setOf, @eq_comm _ x a, mem_Ioi, Set.insert]
theorem Ioi_pred_eq_insert_of_not_isMin (ha : ¬IsMin a) : Ioi (pred a) = insert a (Ioi a) := by
  ext x; simp only [insert, mem_setOf, @eq_comm _ x a, mem_Ioi, Set.insert]
  

Proof state:
case h
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : PredOrder α
a b : α
ha : ¬IsMin a
x : α
⊢ pred a < x ↔ a = x ∨ a < x

Next tactic:
exact pred_lt_iff_eq_or_lt_of_not_isMin ha
theorem Icc_pred_left (h : pred a ≤ b) : Icc (pred a) b = insert (pred a) (Icc a b) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : PredOrder α
a b : α
h : pred a ≤ b
⊢ Icc (pred a) b = insert (pred a) (Icc a b)

Next tactic:
simp_rw [← Ici_inter_Iic, Ici_pred, insert_inter_of_mem (mem_Iic.2 h)]
theorem Ico_pred_left (h : pred a < b) : Ico (pred a) b = insert (pred a) (Ico a b) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : PartialOrder α
inst✝ : PredOrder α
a b : α
h : pred a < b
⊢ Ico (pred a) b = insert (pred a) (Ico a b)

Next tactic:
simp_rw [← Ici_inter_Iio, Ici_pred, insert_inter_of_mem (mem_Iio.2 h)]
@[simp]
theorem pred_eq_pred_iff : pred a = pred b ↔ a = b := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : PredOrder α
a b : α
inst✝ : NoMinOrder α
⊢ pred a = pred b ↔ a = b

Next tactic:
simp_rw [eq_iff_le_not_lt, pred_le_pred_iff, pred_lt_pred_iff]
theorem pred_eq_iff_covby : pred b = a ↔ a ⋖ b :=
  ⟨by
    

Proof state:
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : PredOrder α
a b : α
inst✝ : NoMinOrder α
⊢ pred b = a → a ⋖ b

Next tactic:
rintro rfl
theorem pred_eq_iff_covby : pred b = a ↔ a ⋖ b :=
  ⟨by
    rintro rfl
    

Proof state:
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : PredOrder α
b : α
inst✝ : NoMinOrder α
⊢ pred b ⋖ b

Next tactic:
exact pred_covby _
theorem Ico_pred_right_eq_insert (h : a ≤ b) : Ioc (pred a) b = insert a (Ioc a b) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : PredOrder α
a b : α
inst✝ : NoMinOrder α
h : a ≤ b
⊢ Ioc (pred a) b = insert a (Ioc a b)

Next tactic:
simp_rw [← Ioi_inter_Iic, Ioi_pred_eq_insert, insert_inter_of_mem (mem_Iic.2 h)]
theorem Ioo_pred_right_eq_insert (h : a < b) : Ioo (pred a) b = insert a (Ioo a b) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝² : PartialOrder α
inst✝¹ : PredOrder α
a b : α
inst✝ : NoMinOrder α
h : a < b
⊢ Ioo (pred a) b = insert a (Ioo a b)

Next tactic:
simp_rw [← Ioi_inter_Iio, Ioi_pred_eq_insert, insert_inter_of_mem (mem_Iio.2 h)]
/-- There is at most one way to define the predecessors in a `PartialOrder`. -/
instance [PartialOrder α] : Subsingleton (PredOrder α) :=
  ⟨by
    

Proof state:
α : Type u_1
β : Type u_2
inst✝ : PartialOrder α
⊢ ∀ (a b : PredOrder α), a = b

Next tactic:
intro h₀ h₁
/-- There is at most one way to define the predecessors in a `PartialOrder`. -/
instance [PartialOrder α] : Subsingleton (PredOrder α) :=
  ⟨by
    intro h₀ h₁
    

Proof state:
α : Type u_1
β : Type u_2
inst✝ : PartialOrder α
h₀ h₁ : PredOrder α
⊢ h₀ = h₁

Next tactic:
ext a
/-- There is at most one way to define the predecessors in a `PartialOrder`. -/
instance [PartialOrder α] : Subsingleton (PredOrder α) :=
  ⟨by
    intro h₀ h₁
    ext a
    

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

Next tactic:
by_cases ha : IsMin a
/-- 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
    · 

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

Next tactic:
exact (@IsMin.pred_eq _ _ h₀ _ ha).trans ha.pred_eq.symm