l3lab/ntp-mathlib huggingface dataset:
set_option linter.unusedVariables false in -- `have` for wf induction triggers linter
lemma transGen_wcovby_of_le [Preorder α] [LocallyFiniteOrder α] {x y : α} (hxy : x ≤ y) :
    TransGen (· ⩿ ·) x y := by
  -- We proceed by well-founded induction on the cardinality of `Icc x y`.
  -- It's impossible for the cardinality to be zero since `x ≤ y`
  

Proof state:
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y : α
hxy : x ≤ y
⊢ TransGen (fun x x_1 => x ⩿ x_1) x y

Next tactic:
have : (Ico x y).card < (Icc x y).card := card_lt_card <|
    ⟨Ico_subset_Icc_self, not_subset.mpr ⟨y, ⟨right_mem_Icc.mpr hxy, right_not_mem_Ico⟩⟩⟩
set_option linter.unusedVariables false in -- `have` for wf induction triggers linter
lemma transGen_wcovby_of_le [Preorder α] [LocallyFiniteOrder α] {x y : α} (hxy : x ≤ y) :
    TransGen (· ⩿ ·) x y := by
  -- We proceed by well-founded induction on the cardinality of `Icc x y`.
  -- It's impossible for the cardinality to be zero since `x ≤ y`
  have : (Ico x y).card < (Icc x y).card := card_lt_card <|
    ⟨Ico_subset_Icc_self, not_subset.mpr ⟨y, ⟨right_mem_Icc.mpr hxy, right_not_mem_Ico⟩⟩⟩
  

Proof state:
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y : α
hxy : x ≤ y
this : card (Ico x y) < card (Icc x y)
⊢ TransGen (fun x x_1 => x ⩿ x_1) x y

Next tactic:
by_cases hxy' : y ≤ x
set_option linter.unusedVariables false in -- `have` for wf induction triggers linter
lemma transGen_wcovby_of_le [Preorder α] [LocallyFiniteOrder α] {x y : α} (hxy : x ≤ y) :
    TransGen (· ⩿ ·) x y := by
  -- We proceed by well-founded induction on the cardinality of `Icc x y`.
  -- It's impossible for the cardinality to be zero since `x ≤ y`
  have : (Ico x y).card < (Icc x y).card := card_lt_card <|
    ⟨Ico_subset_Icc_self, not_subset.mpr ⟨y, ⟨right_mem_Icc.mpr hxy, right_not_mem_Ico⟩⟩⟩
  by_cases hxy' : y ≤ x
  -- If `y ≤ x`, then `x ⩿ y`
  · 

Proof state:
case pos
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y : α
hxy : x ≤ y
this : card (Ico x y) < card (Icc x y)
hxy' : y ≤ x
⊢ TransGen (fun x x_1 => x ⩿ x_1) x y

Next tactic:
exact .single <| wcovby_of_le_of_le hxy hxy'
set_option linter.unusedVariables false in -- `have` for wf induction triggers linter
lemma transGen_wcovby_of_le [Preorder α] [LocallyFiniteOrder α] {x y : α} (hxy : x ≤ y) :
    TransGen (· ⩿ ·) x y := by
  -- We proceed by well-founded induction on the cardinality of `Icc x y`.
  -- It's impossible for the cardinality to be zero since `x ≤ y`
  have : (Ico x y).card < (Icc x y).card := card_lt_card <|
    ⟨Ico_subset_Icc_self, not_subset.mpr ⟨y, ⟨right_mem_Icc.mpr hxy, right_not_mem_Ico⟩⟩⟩
  by_cases hxy' : y ≤ x
  -- If `y ≤ x`, then `x ⩿ y`
  · exact .single <| wcovby_of_le_of_le hxy hxy'
  /- and if `¬ y ≤ x`, then `x < y`, not because it is a linear order, but because `x ≤ y`
  already. In that case, since `z` is maximal in `Ico x y`, then `z ⩿ y` and we can use the
  induction hypothesis to show that `Relation.TransGen (· ⩿ ·) x z`. -/
  · 

Proof state:
case neg
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y : α
hxy : x ≤ y
this : card (Ico x y) < card (Icc x y)
hxy' : ¬y ≤ x
⊢ TransGen (fun x x_1 => x ⩿ x_1) x y

Next tactic:
have h_non : (Ico x y).Nonempty := ⟨x, mem_Ico.mpr ⟨le_rfl, lt_of_le_not_le hxy hxy'⟩⟩
set_option linter.unusedVariables false in -- `have` for wf induction triggers linter
lemma transGen_wcovby_of_le [Preorder α] [LocallyFiniteOrder α] {x y : α} (hxy : x ≤ y) :
    TransGen (· ⩿ ·) x y := by
  -- We proceed by well-founded induction on the cardinality of `Icc x y`.
  -- It's impossible for the cardinality to be zero since `x ≤ y`
  have : (Ico x y).card < (Icc x y).card := card_lt_card <|
    ⟨Ico_subset_Icc_self, not_subset.mpr ⟨y, ⟨right_mem_Icc.mpr hxy, right_not_mem_Ico⟩⟩⟩
  by_cases hxy' : y ≤ x
  -- If `y ≤ x`, then `x ⩿ y`
  · exact .single <| wcovby_of_le_of_le hxy hxy'
  /- and if `¬ y ≤ x`, then `x < y`, not because it is a linear order, but because `x ≤ y`
  already. In that case, since `z` is maximal in `Ico x y`, then `z ⩿ y` and we can use the
  induction hypothesis to show that `Relation.TransGen (· ⩿ ·) x z`. -/
  · have h_non : (Ico x y).Nonempty := ⟨x, mem_Ico.mpr ⟨le_rfl, lt_of_le_not_le hxy hxy'⟩⟩
    

Proof state:
case neg
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y : α
hxy : x ≤ y
this : card (Ico x y) < card (Icc x y)
hxy' : ¬y ≤ x
h_non : Finset.Nonempty (Ico x y)
⊢ TransGen (fun x x_1 => x ⩿ x_1) x y

Next tactic:
obtain ⟨z, z_mem, hz⟩ := (Ico x y).exists_maximal h_non
set_option linter.unusedVariables false in -- `have` for wf induction triggers linter
lemma transGen_wcovby_of_le [Preorder α] [LocallyFiniteOrder α] {x y : α} (hxy : x ≤ y) :
    TransGen (· ⩿ ·) x y := by
  -- We proceed by well-founded induction on the cardinality of `Icc x y`.
  -- It's impossible for the cardinality to be zero since `x ≤ y`
  have : (Ico x y).card < (Icc x y).card := card_lt_card <|
    ⟨Ico_subset_Icc_self, not_subset.mpr ⟨y, ⟨right_mem_Icc.mpr hxy, right_not_mem_Ico⟩⟩⟩
  by_cases hxy' : y ≤ x
  -- If `y ≤ x`, then `x ⩿ y`
  · exact .single <| wcovby_of_le_of_le hxy hxy'
  /- and if `¬ y ≤ x`, then `x < y`, not because it is a linear order, but because `x ≤ y`
  already. In that case, since `z` is maximal in `Ico x y`, then `z ⩿ y` and we can use the
  induction hypothesis to show that `Relation.TransGen (· ⩿ ·) x z`. -/
  · have h_non : (Ico x y).Nonempty := ⟨x, mem_Ico.mpr ⟨le_rfl, lt_of_le_not_le hxy hxy'⟩⟩
    obtain ⟨z, z_mem, hz⟩ := (Ico x y).exists_maximal h_non
    

Proof state:
case neg.intro.intro
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y : α
hxy : x ≤ y
this : card (Ico x y) < card (Icc x y)
hxy' : ¬y ≤ x
h_non : Finset.Nonempty (Ico x y)
z : α
z_mem : z ∈ Ico x y
hz : ∀ x_1 ∈ Ico x y, ¬z < x_1
⊢ TransGen (fun x x_1 => x ⩿ x_1) x y

Next tactic:
have z_card : (Icc x z).card <(Icc x y).card := calc
      (Icc x z).card ≤ (Ico x y).card :=
        card_le_of_subset <| Icc_subset_Ico_right (mem_Ico.mp z_mem).2
      _              < (Icc x y).card := this
set_option linter.unusedVariables false in -- `have` for wf induction triggers linter
lemma transGen_wcovby_of_le [Preorder α] [LocallyFiniteOrder α] {x y : α} (hxy : x ≤ y) :
    TransGen (· ⩿ ·) x y := by
  -- We proceed by well-founded induction on the cardinality of `Icc x y`.
  -- It's impossible for the cardinality to be zero since `x ≤ y`
  have : (Ico x y).card < (Icc x y).card := card_lt_card <|
    ⟨Ico_subset_Icc_self, not_subset.mpr ⟨y, ⟨right_mem_Icc.mpr hxy, right_not_mem_Ico⟩⟩⟩
  by_cases hxy' : y ≤ x
  -- If `y ≤ x`, then `x ⩿ y`
  · exact .single <| wcovby_of_le_of_le hxy hxy'
  /- and if `¬ y ≤ x`, then `x < y`, not because it is a linear order, but because `x ≤ y`
  already. In that case, since `z` is maximal in `Ico x y`, then `z ⩿ y` and we can use the
  induction hypothesis to show that `Relation.TransGen (· ⩿ ·) x z`. -/
  · have h_non : (Ico x y).Nonempty := ⟨x, mem_Ico.mpr ⟨le_rfl, lt_of_le_not_le hxy hxy'⟩⟩
    obtain ⟨z, z_mem, hz⟩ := (Ico x y).exists_maximal h_non
    have z_card : (Icc x z).card <(Icc x y).card := calc
      (Icc x z).card ≤ (Ico x y).card :=
        card_le_of_subset <| Icc_subset_Ico_right (mem_Ico.mp z_mem).2
      _              < (Icc x y).card := this
    

Proof state:
case neg.intro.intro
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y : α
hxy : x ≤ y
this : card (Ico x y) < card (Icc x y)
hxy' : ¬y ≤ x
h_non : Finset.Nonempty (Ico x y)
z : α
z_mem : z ∈ Ico x y
hz : ∀ x_1 ∈ Ico x y, ¬z < x_1
z_card : card (Icc x z) < card (Icc x y)
⊢ TransGen (fun x x_1 => x ⩿ x_1) x y

Next tactic:
have h₁ := transGen_wcovby_of_le (mem_Ico.mp z_mem).1
set_option linter.unusedVariables false in -- `have` for wf induction triggers linter
lemma transGen_wcovby_of_le [Preorder α] [LocallyFiniteOrder α] {x y : α} (hxy : x ≤ y) :
    TransGen (· ⩿ ·) x y := by
  -- We proceed by well-founded induction on the cardinality of `Icc x y`.
  -- It's impossible for the cardinality to be zero since `x ≤ y`
  have : (Ico x y).card < (Icc x y).card := card_lt_card <|
    ⟨Ico_subset_Icc_self, not_subset.mpr ⟨y, ⟨right_mem_Icc.mpr hxy, right_not_mem_Ico⟩⟩⟩
  by_cases hxy' : y ≤ x
  -- If `y ≤ x`, then `x ⩿ y`
  · exact .single <| wcovby_of_le_of_le hxy hxy'
  /- and if `¬ y ≤ x`, then `x < y`, not because it is a linear order, but because `x ≤ y`
  already. In that case, since `z` is maximal in `Ico x y`, then `z ⩿ y` and we can use the
  induction hypothesis to show that `Relation.TransGen (· ⩿ ·) x z`. -/
  · have h_non : (Ico x y).Nonempty := ⟨x, mem_Ico.mpr ⟨le_rfl, lt_of_le_not_le hxy hxy'⟩⟩
    obtain ⟨z, z_mem, hz⟩ := (Ico x y).exists_maximal h_non
    have z_card : (Icc x z).card <(Icc x y).card := calc
      (Icc x z).card ≤ (Ico x y).card :=
        card_le_of_subset <| Icc_subset_Ico_right (mem_Ico.mp z_mem).2
      _              < (Icc x y).card := this
    have h₁ := transGen_wcovby_of_le (mem_Ico.mp z_mem).1
    

Proof state:
case neg.intro.intro
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y : α
hxy : x ≤ y
this : card (Ico x y) < card (Icc x y)
hxy' : ¬y ≤ x
h_non : Finset.Nonempty (Ico x y)
z : α
z_mem : z ∈ Ico x y
hz : ∀ x_1 ∈ Ico x y, ¬z < x_1
z_card : card (Icc x z) < card (Icc x y)
h₁ : TransGen (fun x x_1 => x ⩿ x_1) x z
⊢ TransGen (fun x x_1 => x ⩿ x_1) x y

Next tactic:
have h₂ : z ⩿ y := by
      refine ⟨(mem_Ico.mp z_mem).2.le, fun c hzc hcy ↦ hz c ?_ hzc⟩
      exact mem_Ico.mpr <| ⟨(mem_Ico.mp z_mem).1.trans hzc.le, hcy⟩
set_option linter.unusedVariables false in -- `have` for wf induction triggers linter
lemma transGen_wcovby_of_le [Preorder α] [LocallyFiniteOrder α] {x y : α} (hxy : x ≤ y) :
    TransGen (· ⩿ ·) x y := by
  -- We proceed by well-founded induction on the cardinality of `Icc x y`.
  -- It's impossible for the cardinality to be zero since `x ≤ y`
  have : (Ico x y).card < (Icc x y).card := card_lt_card <|
    ⟨Ico_subset_Icc_self, not_subset.mpr ⟨y, ⟨right_mem_Icc.mpr hxy, right_not_mem_Ico⟩⟩⟩
  by_cases hxy' : y ≤ x
  -- If `y ≤ x`, then `x ⩿ y`
  · exact .single <| wcovby_of_le_of_le hxy hxy'
  /- and if `¬ y ≤ x`, then `x < y`, not because it is a linear order, but because `x ≤ y`
  already. In that case, since `z` is maximal in `Ico x y`, then `z ⩿ y` and we can use the
  induction hypothesis to show that `Relation.TransGen (· ⩿ ·) x z`. -/
  · have h_non : (Ico x y).Nonempty := ⟨x, mem_Ico.mpr ⟨le_rfl, lt_of_le_not_le hxy hxy'⟩⟩
    obtain ⟨z, z_mem, hz⟩ := (Ico x y).exists_maximal h_non
    have z_card : (Icc x z).card <(Icc x y).card := calc
      (Icc x z).card ≤ (Ico x y).card :=
        card_le_of_subset <| Icc_subset_Ico_right (mem_Ico.mp z_mem).2
      _              < (Icc x y).card := this
    have h₁ := transGen_wcovby_of_le (mem_Ico.mp z_mem).1
    have h₂ : z ⩿ y := by
      

Proof state:
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y : α
hxy : x ≤ y
this : card (Ico x y) < card (Icc x y)
hxy' : ¬y ≤ x
h_non : Finset.Nonempty (Ico x y)
z : α
z_mem : z ∈ Ico x y
hz : ∀ x_1 ∈ Ico x y, ¬z < x_1
z_card : card (Icc x z) < card (Icc x y)
h₁ : TransGen (fun x x_1 => x ⩿ x_1) x z
⊢ z ⩿ y

Next tactic:
refine ⟨(mem_Ico.mp z_mem).2.le, fun c hzc hcy ↦ hz c ?_ hzc⟩
set_option linter.unusedVariables false in -- `have` for wf induction triggers linter
lemma transGen_wcovby_of_le [Preorder α] [LocallyFiniteOrder α] {x y : α} (hxy : x ≤ y) :
    TransGen (· ⩿ ·) x y := by
  -- We proceed by well-founded induction on the cardinality of `Icc x y`.
  -- It's impossible for the cardinality to be zero since `x ≤ y`
  have : (Ico x y).card < (Icc x y).card := card_lt_card <|
    ⟨Ico_subset_Icc_self, not_subset.mpr ⟨y, ⟨right_mem_Icc.mpr hxy, right_not_mem_Ico⟩⟩⟩
  by_cases hxy' : y ≤ x
  -- If `y ≤ x`, then `x ⩿ y`
  · exact .single <| wcovby_of_le_of_le hxy hxy'
  /- and if `¬ y ≤ x`, then `x < y`, not because it is a linear order, but because `x ≤ y`
  already. In that case, since `z` is maximal in `Ico x y`, then `z ⩿ y` and we can use the
  induction hypothesis to show that `Relation.TransGen (· ⩿ ·) x z`. -/
  · have h_non : (Ico x y).Nonempty := ⟨x, mem_Ico.mpr ⟨le_rfl, lt_of_le_not_le hxy hxy'⟩⟩
    obtain ⟨z, z_mem, hz⟩ := (Ico x y).exists_maximal h_non
    have z_card : (Icc x z).card <(Icc x y).card := calc
      (Icc x z).card ≤ (Ico x y).card :=
        card_le_of_subset <| Icc_subset_Ico_right (mem_Ico.mp z_mem).2
      _              < (Icc x y).card := this
    have h₁ := transGen_wcovby_of_le (mem_Ico.mp z_mem).1
    have h₂ : z ⩿ y := by
      refine ⟨(mem_Ico.mp z_mem).2.le, fun c hzc hcy ↦ hz c ?_ hzc⟩
      

Proof state:
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y : α
hxy : x ≤ y
this : card (Ico x y) < card (Icc x y)
hxy' : ¬y ≤ x
h_non : Finset.Nonempty (Ico x y)
z : α
z_mem : z ∈ Ico x y
hz : ∀ x_1 ∈ Ico x y, ¬z < x_1
z_card : card (Icc x z) < card (Icc x y)
h₁ : TransGen (fun x x_1 => x ⩿ x_1) x z
c : α
hzc : z < c
hcy : c < y
⊢ c ∈ Ico x y

Next tactic:
exact mem_Ico.mpr <| ⟨(mem_Ico.mp z_mem).1.trans hzc.le, hcy⟩
set_option linter.unusedVariables false in -- `have` for wf induction triggers linter
lemma transGen_wcovby_of_le [Preorder α] [LocallyFiniteOrder α] {x y : α} (hxy : x ≤ y) :
    TransGen (· ⩿ ·) x y := by
  -- We proceed by well-founded induction on the cardinality of `Icc x y`.
  -- It's impossible for the cardinality to be zero since `x ≤ y`
  have : (Ico x y).card < (Icc x y).card := card_lt_card <|
    ⟨Ico_subset_Icc_self, not_subset.mpr ⟨y, ⟨right_mem_Icc.mpr hxy, right_not_mem_Ico⟩⟩⟩
  by_cases hxy' : y ≤ x
  -- If `y ≤ x`, then `x ⩿ y`
  · exact .single <| wcovby_of_le_of_le hxy hxy'
  /- and if `¬ y ≤ x`, then `x < y`, not because it is a linear order, but because `x ≤ y`
  already. In that case, since `z` is maximal in `Ico x y`, then `z ⩿ y` and we can use the
  induction hypothesis to show that `Relation.TransGen (· ⩿ ·) x z`. -/
  · have h_non : (Ico x y).Nonempty := ⟨x, mem_Ico.mpr ⟨le_rfl, lt_of_le_not_le hxy hxy'⟩⟩
    obtain ⟨z, z_mem, hz⟩ := (Ico x y).exists_maximal h_non
    have z_card : (Icc x z).card <(Icc x y).card := calc
      (Icc x z).card ≤ (Ico x y).card :=
        card_le_of_subset <| Icc_subset_Ico_right (mem_Ico.mp z_mem).2
      _              < (Icc x y).card := this
    have h₁ := transGen_wcovby_of_le (mem_Ico.mp z_mem).1
    have h₂ : z ⩿ y := by
      refine ⟨(mem_Ico.mp z_mem).2.le, fun c hzc hcy ↦ hz c ?_ hzc⟩
      exact mem_Ico.mpr <| ⟨(mem_Ico.mp z_mem).1.trans hzc.le, hcy⟩
    

Proof state:
case neg.intro.intro
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y : α
hxy : x ≤ y
this : card (Ico x y) < card (Icc x y)
hxy' : ¬y ≤ x
h_non : Finset.Nonempty (Ico x y)
z : α
z_mem : z ∈ Ico x y
hz : ∀ x_1 ∈ Ico x y, ¬z < x_1
z_card : card (Icc x z) < card (Icc x y)
h₁ : TransGen (fun x x_1 => x ⩿ x_1) x z
h₂ : z ⩿ y
⊢ TransGen (fun x x_1 => x ⩿ x_1) x y

Next tactic:
exact .tail h₁ h₂
/-- In a locally finite preorder, `≤` is the transitive closure of `⩿`. -/
lemma le_iff_transGen_wcovby [Preorder α] [LocallyFiniteOrder α] {x y : α} :
    x ≤ y ↔ TransGen (· ⩿ ·) x y := by
  

Proof state:
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y : α
⊢ x ≤ y ↔ TransGen (fun x x_1 => x ⩿ x_1) x y

Next tactic:
refine ⟨transGen_wcovby_of_le, fun h ↦ ?_⟩
/-- In a locally finite preorder, `≤` is the transitive closure of `⩿`. -/
lemma le_iff_transGen_wcovby [Preorder α] [LocallyFiniteOrder α] {x y : α} :
    x ≤ y ↔ TransGen (· ⩿ ·) x y := by
  refine ⟨transGen_wcovby_of_le, fun h ↦ ?_⟩
  

Proof state:
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y : α
h : TransGen (fun x x_1 => x ⩿ x_1) x y
⊢ x ≤ y

Next tactic:
induction h with
  | single h => exact h.le
  | tail _ h₁ h₂ => exact h₂.trans h₁.le
/-- In a locally finite preorder, `≤` is the transitive closure of `⩿`. -/
lemma le_iff_transGen_wcovby [Preorder α] [LocallyFiniteOrder α] {x y : α} :
    x ≤ y ↔ TransGen (· ⩿ ·) x y := by
  refine ⟨transGen_wcovby_of_le, fun h ↦ ?_⟩
  induction h with
  

Proof state:
case single
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y b✝ : α
h : x ⩿ b✝
⊢ x ≤ b✝

Next tactic:
| single h => exact h.le
/-- In a locally finite preorder, `≤` is the transitive closure of `⩿`. -/
lemma le_iff_transGen_wcovby [Preorder α] [LocallyFiniteOrder α] {x y : α} :
    x ≤ y ↔ TransGen (· ⩿ ·) x y := by
  refine ⟨transGen_wcovby_of_le, fun h ↦ ?_⟩
  induction h with
  | single h => 

Proof state:
case single
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y b✝ : α
h : x ⩿ b✝
⊢ x ≤ b✝

Next tactic:
exact h.le
/-- In a locally finite preorder, `≤` is the transitive closure of `⩿`. -/
lemma le_iff_transGen_wcovby [Preorder α] [LocallyFiniteOrder α] {x y : α} :
    x ≤ y ↔ TransGen (· ⩿ ·) x y := by
  refine ⟨transGen_wcovby_of_le, fun h ↦ ?_⟩
  induction h with
  | single h => exact h.le
  

Proof state:
case tail
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y b✝ c✝ : α
a✝ : TransGen (fun x x_1 => x ⩿ x_1) x b✝
h₁ : b✝ ⩿ c✝
h₂ : x ≤ b✝
⊢ x ≤ c✝

Next tactic:
| tail _ h₁ h₂ => exact h₂.trans h₁.le
/-- In a locally finite preorder, `≤` is the transitive closure of `⩿`. -/
lemma le_iff_transGen_wcovby [Preorder α] [LocallyFiniteOrder α] {x y : α} :
    x ≤ y ↔ TransGen (· ⩿ ·) x y := by
  refine ⟨transGen_wcovby_of_le, fun h ↦ ?_⟩
  induction h with
  | single h => exact h.le
  | tail _ h₁ h₂ => 

Proof state:
case tail
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y b✝ c✝ : α
a✝ : TransGen (fun x x_1 => x ⩿ x_1) x b✝
h₁ : b✝ ⩿ c✝
h₂ : x ≤ b✝
⊢ x ≤ c✝

Next tactic:
exact h₂.trans h₁.le
/-- In a locally finite partial order, `≤` is the reflexive transitive closure of `⋖`. -/
lemma le_iff_reflTransGen_covby [PartialOrder α] [LocallyFiniteOrder α] {x y : α} :
    x ≤ y ↔ ReflTransGen (· ⋖ ·) x y := by
  

Proof state:
ι : Type u_1
α : Type u_2
inst✝¹ : PartialOrder α
inst✝ : LocallyFiniteOrder α
x y : α
⊢ x ≤ y ↔ ReflTransGen (fun x x_1 => x ⋖ x_1) x y

Next tactic:
rw [le_iff_transGen_wcovby, wcovby_eq_reflGen_covby, transGen_reflGen]
set_option linter.unusedVariables false in -- `have` for wf induction triggers linter
lemma transGen_covby_of_lt [Preorder α] [LocallyFiniteOrder α] {x y : α} (hxy : x < y) :
    TransGen (· ⋖ ·) x y := by
  -- We proceed by well-founded induction on the cardinality of `Ico x y`.
  -- It's impossible for the cardinality to be zero since `x < y`
  

Proof state:
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y : α
hxy : x < y
⊢ TransGen (fun x x_1 => x ⋖ x_1) x y

Next tactic:
have h_non : (Ico x y).Nonempty := ⟨x, mem_Ico.mpr ⟨le_rfl, hxy⟩⟩
set_option linter.unusedVariables false in -- `have` for wf induction triggers linter
lemma transGen_covby_of_lt [Preorder α] [LocallyFiniteOrder α] {x y : α} (hxy : x < y) :
    TransGen (· ⋖ ·) x y := by
  -- We proceed by well-founded induction on the cardinality of `Ico x y`.
  -- It's impossible for the cardinality to be zero since `x < y`
  have h_non : (Ico x y).Nonempty := ⟨x, mem_Ico.mpr ⟨le_rfl, hxy⟩⟩
  -- `Ico x y` is a nonempty finset and so contains a maximal element `z` and
  -- `Ico x z` has cardinality strictly less than the cardinality of `Ico x y`
  

Proof state:
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y : α
hxy : x < y
h_non : Finset.Nonempty (Ico x y)
⊢ TransGen (fun x x_1 => x ⋖ x_1) x y

Next tactic:
obtain ⟨z, z_mem, hz⟩ := (Ico x y).exists_maximal h_non
set_option linter.unusedVariables false in -- `have` for wf induction triggers linter
lemma transGen_covby_of_lt [Preorder α] [LocallyFiniteOrder α] {x y : α} (hxy : x < y) :
    TransGen (· ⋖ ·) x y := by
  -- We proceed by well-founded induction on the cardinality of `Ico x y`.
  -- It's impossible for the cardinality to be zero since `x < y`
  have h_non : (Ico x y).Nonempty := ⟨x, mem_Ico.mpr ⟨le_rfl, hxy⟩⟩
  -- `Ico x y` is a nonempty finset and so contains a maximal element `z` and
  -- `Ico x z` has cardinality strictly less than the cardinality of `Ico x y`
  obtain ⟨z, z_mem, hz⟩ := (Ico x y).exists_maximal h_non
  

Proof state:
case intro.intro
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y : α
hxy : x < y
h_non : Finset.Nonempty (Ico x y)
z : α
z_mem : z ∈ Ico x y
hz : ∀ x_1 ∈ Ico x y, ¬z < x_1
⊢ TransGen (fun x x_1 => x ⋖ x_1) x y

Next tactic:
have z_card : (Ico x z).card < (Ico x y).card := card_lt_card <| ssubset_iff_of_subset
    (Ico_subset_Ico le_rfl (mem_Ico.mp z_mem).2.le) |>.mpr ⟨z, z_mem, right_not_mem_Ico⟩
set_option linter.unusedVariables false in -- `have` for wf induction triggers linter
lemma transGen_covby_of_lt [Preorder α] [LocallyFiniteOrder α] {x y : α} (hxy : x < y) :
    TransGen (· ⋖ ·) x y := by
  -- We proceed by well-founded induction on the cardinality of `Ico x y`.
  -- It's impossible for the cardinality to be zero since `x < y`
  have h_non : (Ico x y).Nonempty := ⟨x, mem_Ico.mpr ⟨le_rfl, hxy⟩⟩
  -- `Ico x y` is a nonempty finset and so contains a maximal element `z` and
  -- `Ico x z` has cardinality strictly less than the cardinality of `Ico x y`
  obtain ⟨z, z_mem, hz⟩ := (Ico x y).exists_maximal h_non
  have z_card : (Ico x z).card < (Ico x y).card := card_lt_card <| ssubset_iff_of_subset
    (Ico_subset_Ico le_rfl (mem_Ico.mp z_mem).2.le) |>.mpr ⟨z, z_mem, right_not_mem_Ico⟩
  /- Since `z` is maximal in `Ico x y`, `z ⋖ y`. -/
  

Proof state:
case intro.intro
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y : α
hxy : x < y
h_non : Finset.Nonempty (Ico x y)
z : α
z_mem : z ∈ Ico x y
hz : ∀ x_1 ∈ Ico x y, ¬z < x_1
z_card : card (Ico x z) < card (Ico x y)
⊢ TransGen (fun x x_1 => x ⋖ x_1) x y

Next tactic:
have hzy : z ⋖ y := by
    refine ⟨(mem_Ico.mp z_mem).2, fun c hc hcy ↦ ?_⟩
    exact hz _ (mem_Ico.mpr ⟨((mem_Ico.mp z_mem).1.trans_lt hc).le, hcy⟩) hc
set_option linter.unusedVariables false in -- `have` for wf induction triggers linter
lemma transGen_covby_of_lt [Preorder α] [LocallyFiniteOrder α] {x y : α} (hxy : x < y) :
    TransGen (· ⋖ ·) x y := by
  -- We proceed by well-founded induction on the cardinality of `Ico x y`.
  -- It's impossible for the cardinality to be zero since `x < y`
  have h_non : (Ico x y).Nonempty := ⟨x, mem_Ico.mpr ⟨le_rfl, hxy⟩⟩
  -- `Ico x y` is a nonempty finset and so contains a maximal element `z` and
  -- `Ico x z` has cardinality strictly less than the cardinality of `Ico x y`
  obtain ⟨z, z_mem, hz⟩ := (Ico x y).exists_maximal h_non
  have z_card : (Ico x z).card < (Ico x y).card := card_lt_card <| ssubset_iff_of_subset
    (Ico_subset_Ico le_rfl (mem_Ico.mp z_mem).2.le) |>.mpr ⟨z, z_mem, right_not_mem_Ico⟩
  /- Since `z` is maximal in `Ico x y`, `z ⋖ y`. -/
  have hzy : z ⋖ y := by
    

Proof state:
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y : α
hxy : x < y
h_non : Finset.Nonempty (Ico x y)
z : α
z_mem : z ∈ Ico x y
hz : ∀ x_1 ∈ Ico x y, ¬z < x_1
z_card : card (Ico x z) < card (Ico x y)
⊢ z ⋖ y

Next tactic:
refine ⟨(mem_Ico.mp z_mem).2, fun c hc hcy ↦ ?_⟩