l3lab/ntp-mathlib huggingface dataset:
@[to_additive abs_sup_sub_sup_le_abs]
theorem mabs_sup_div_sup_le_mabs [CovariantClass α α (· * ·) (· ≤ ·)] (a b c : α) :
    |(a ⊔ c) / (b ⊔ c)| ≤ |a / b| := by
  apply le_of_mul_le_of_one_le_left
  · 

Proof state:
case h
α : Type u
β : Type v
inst✝² : Lattice α
inst✝¹ : CommGroup α
inst✝ : CovariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x ≤ x_1
a b c : α
⊢ |(a ⊔ c) / (b ⊔ c)| * ?b ≤ |a / b|

Next tactic:
rw [abs_div_sup_mul_abs_div_inf]
@[to_additive abs_sup_sub_sup_le_abs]
theorem mabs_sup_div_sup_le_mabs [CovariantClass α α (· * ·) (· ≤ ·)] (a b c : α) :
    |(a ⊔ c) / (b ⊔ c)| ≤ |a / b| := by
  apply le_of_mul_le_of_one_le_left
  · rw [abs_div_sup_mul_abs_div_inf]
  · 

Proof state:
case hle
α : Type u
β : Type v
inst✝² : Lattice α
inst✝¹ : CommGroup α
inst✝ : CovariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x ≤ x_1
a b c : α
⊢ 1 ≤ |(a ⊓ c) / (b ⊓ c)|

Next tactic:
exact one_le_abs _
@[to_additive abs_inf_sub_inf_le_abs]
theorem mabs_inf_div_inf_le_mabs [CovariantClass α α (· * ·) (· ≤ ·)] (a b c : α) :
    |(a ⊓ c) / (b ⊓ c)| ≤ |a / b| := by
  

Proof state:
α : Type u
β : Type v
inst✝² : Lattice α
inst✝¹ : CommGroup α
inst✝ : CovariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x ≤ x_1
a b c : α
⊢ |(a ⊓ c) / (b ⊓ c)| ≤ |a / b|

Next tactic:
apply le_of_mul_le_of_one_le_right
@[to_additive abs_inf_sub_inf_le_abs]
theorem mabs_inf_div_inf_le_mabs [CovariantClass α α (· * ·) (· ≤ ·)] (a b c : α) :
    |(a ⊓ c) / (b ⊓ c)| ≤ |a / b| := by
  apply le_of_mul_le_of_one_le_right
  · 

Proof state:
case h
α : Type u
β : Type v
inst✝² : Lattice α
inst✝¹ : CommGroup α
inst✝ : CovariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x ≤ x_1
a b c : α
⊢ ?a * |(a ⊓ c) / (b ⊓ c)| ≤ |a / b|

Next tactic:
rw [abs_div_sup_mul_abs_div_inf]
@[to_additive abs_inf_sub_inf_le_abs]
theorem mabs_inf_div_inf_le_mabs [CovariantClass α α (· * ·) (· ≤ ·)] (a b c : α) :
    |(a ⊓ c) / (b ⊓ c)| ≤ |a / b| := by
  apply le_of_mul_le_of_one_le_right
  · rw [abs_div_sup_mul_abs_div_inf]
  · 

Proof state:
case hle
α : Type u
β : Type v
inst✝² : Lattice α
inst✝¹ : CommGroup α
inst✝ : CovariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x ≤ x_1
a b c : α
⊢ 1 ≤ |(a ⊔ c) / (b ⊔ c)|

Next tactic:
exact one_le_abs _
/-- The absolute value satisfies the triangle inequality.
-/
@[to_additive abs_add_le "The absolute value satisfies the triangle inequality."]
theorem mabs_mul_le [CovariantClass α α (· * ·) (· ≤ ·)] (a b : α) : |a * b| ≤ |a| * |b| := by
  

Proof state:
α : Type u
β : Type v
inst✝² : Lattice α
inst✝¹ : CommGroup α
inst✝ : CovariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x ≤ x_1
a b : α
⊢ |a * b| ≤ |a| * |b|

Next tactic:
apply sup_le
/-- The absolute value satisfies the triangle inequality.
-/
@[to_additive abs_add_le "The absolute value satisfies the triangle inequality."]
theorem mabs_mul_le [CovariantClass α α (· * ·) (· ≤ ·)] (a b : α) : |a * b| ≤ |a| * |b| := by
  apply sup_le
  · 

Proof state:
case a
α : Type u
β : Type v
inst✝² : Lattice α
inst✝¹ : CommGroup α
inst✝ : CovariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x ≤ x_1
a b : α
⊢ a * b ≤ |a| * |b|

Next tactic:
exact mul_le_mul' (le_mabs a) (le_mabs b)
/-- The absolute value satisfies the triangle inequality.
-/
@[to_additive abs_add_le "The absolute value satisfies the triangle inequality."]
theorem mabs_mul_le [CovariantClass α α (· * ·) (· ≤ ·)] (a b : α) : |a * b| ≤ |a| * |b| := by
  apply sup_le
  · exact mul_le_mul' (le_mabs a) (le_mabs b)
  · 

Proof state:
case a
α : Type u
β : Type v
inst✝² : Lattice α
inst✝¹ : CommGroup α
inst✝ : CovariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x ≤ x_1
a b : α
⊢ (a * b)⁻¹ ≤ |a| * |b|

Next tactic:
rw [mul_inv]
/-- The absolute value satisfies the triangle inequality.
-/
@[to_additive abs_add_le "The absolute value satisfies the triangle inequality."]
theorem mabs_mul_le [CovariantClass α α (· * ·) (· ≤ ·)] (a b : α) : |a * b| ≤ |a| * |b| := by
  apply sup_le
  · exact mul_le_mul' (le_mabs a) (le_mabs b)
  · rw [mul_inv]
    

Proof state:
case a
α : Type u
β : Type v
inst✝² : Lattice α
inst✝¹ : CommGroup α
inst✝ : CovariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x ≤ x_1
a b : α
⊢ a⁻¹ * b⁻¹ ≤ |a| * |b|

Next tactic:
exact mul_le_mul' (inv_le_abs _) (inv_le_abs _)
@[to_additive]
theorem abs_abs_div_abs_le [CovariantClass α α (· * ·) (· ≤ ·)] (a b : α) :
    |(|a| / |b|)| ≤ |a / b| := by
  

Proof state:
α : Type u
β : Type v
inst✝² : Lattice α
inst✝¹ : CommGroup α
inst✝ : CovariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x ≤ x_1
a b : α
⊢ ||a| / |b|| ≤ |a / b|

Next tactic:
rw [abs_eq_sup_inv, sup_le_iff]
@[to_additive]
theorem abs_abs_div_abs_le [CovariantClass α α (· * ·) (· ≤ ·)] (a b : α) :
    |(|a| / |b|)| ≤ |a / b| := by
  rw [abs_eq_sup_inv, sup_le_iff]
  

Proof state:
α : Type u
β : Type v
inst✝² : Lattice α
inst✝¹ : CommGroup α
inst✝ : CovariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x ≤ x_1
a b : α
⊢ |a| / |b| ≤ |a / b| ∧ (|a| / |b|)⁻¹ ≤ |a / b|

Next tactic:
constructor
@[to_additive]
theorem abs_abs_div_abs_le [CovariantClass α α (· * ·) (· ≤ ·)] (a b : α) :
    |(|a| / |b|)| ≤ |a / b| := by
  rw [abs_eq_sup_inv, sup_le_iff]
  constructor
  · 

Proof state:
case left
α : Type u
β : Type v
inst✝² : Lattice α
inst✝¹ : CommGroup α
inst✝ : CovariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x ≤ x_1
a b : α
⊢ |a| / |b| ≤ |a / b|

Next tactic:
apply div_le_iff_le_mul.2
@[to_additive]
theorem abs_abs_div_abs_le [CovariantClass α α (· * ·) (· ≤ ·)] (a b : α) :
    |(|a| / |b|)| ≤ |a / b| := by
  rw [abs_eq_sup_inv, sup_le_iff]
  constructor
  · apply div_le_iff_le_mul.2
    

Proof state:
case left
α : Type u
β : Type v
inst✝² : Lattice α
inst✝¹ : CommGroup α
inst✝ : CovariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x ≤ x_1
a b : α
⊢ |a| ≤ |a / b| * |b|

Next tactic:
convert mabs_mul_le (a / b) b
@[to_additive]
theorem abs_abs_div_abs_le [CovariantClass α α (· * ·) (· ≤ ·)] (a b : α) :
    |(|a| / |b|)| ≤ |a / b| := by
  rw [abs_eq_sup_inv, sup_le_iff]
  constructor
  · apply div_le_iff_le_mul.2
    convert mabs_mul_le (a / b) b
    

Proof state:
case h.e'_3.h.e'_3
α : Type u
β : Type v
inst✝² : Lattice α
inst✝¹ : CommGroup α
inst✝ : CovariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x ≤ x_1
a b : α
⊢ a = a / b * b

Next tactic:
rw [div_mul_cancel']
@[to_additive]
theorem abs_abs_div_abs_le [CovariantClass α α (· * ·) (· ≤ ·)] (a b : α) :
    |(|a| / |b|)| ≤ |a / b| := by
  rw [abs_eq_sup_inv, sup_le_iff]
  constructor
  · apply div_le_iff_le_mul.2
    convert mabs_mul_le (a / b) b
    rw [div_mul_cancel']
  · 

Proof state:
case right
α : Type u
β : Type v
inst✝² : Lattice α
inst✝¹ : CommGroup α
inst✝ : CovariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x ≤ x_1
a b : α
⊢ (|a| / |b|)⁻¹ ≤ |a / b|

Next tactic:
rw [div_eq_mul_inv, mul_inv_rev, inv_inv, mul_inv_le_iff_le_mul, abs_div_comm]
@[to_additive]
theorem abs_abs_div_abs_le [CovariantClass α α (· * ·) (· ≤ ·)] (a b : α) :
    |(|a| / |b|)| ≤ |a / b| := by
  rw [abs_eq_sup_inv, sup_le_iff]
  constructor
  · apply div_le_iff_le_mul.2
    convert mabs_mul_le (a / b) b
    rw [div_mul_cancel']
  · rw [div_eq_mul_inv, mul_inv_rev, inv_inv, mul_inv_le_iff_le_mul, abs_div_comm]
    

Proof state:
case right
α : Type u
β : Type v
inst✝² : Lattice α
inst✝¹ : CommGroup α
inst✝ : CovariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x ≤ x_1
a b : α
⊢ |b| ≤ |b / a| * |a|

Next tactic:
convert mabs_mul_le (b / a) a
@[to_additive]
theorem abs_abs_div_abs_le [CovariantClass α α (· * ·) (· ≤ ·)] (a b : α) :
    |(|a| / |b|)| ≤ |a / b| := by
  rw [abs_eq_sup_inv, sup_le_iff]
  constructor
  · apply div_le_iff_le_mul.2
    convert mabs_mul_le (a / b) b
    rw [div_mul_cancel']
  · rw [div_eq_mul_inv, mul_inv_rev, inv_inv, mul_inv_le_iff_le_mul, abs_div_comm]
    convert mabs_mul_le (b / a) a
    · 

Proof state:
case h.e'_3.h.e'_3
α : Type u
β : Type v
inst✝² : Lattice α
inst✝¹ : CommGroup α
inst✝ : CovariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x ≤ x_1
a b : α
⊢ b = b / a * a

Next tactic:
rw [div_mul_cancel']
lemma inf_eq_half_smul_add_sub_abs_sub (x y : β) :
    x ⊓ y = (⅟2 : α) • (x + y - |y - x|) := by
  

Proof state:
α : Type u
β : Type v
inst✝⁷ : Lattice α
inst✝⁶ : CommGroup α
inst✝⁵ : Semiring α
inst✝⁴ : Invertible 2
inst✝³ : Lattice β
inst✝² : AddCommGroup β
inst✝¹ : Module α β
inst✝ : CovariantClass β β (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
x y : β
⊢ x ⊓ y = ⅟2 • (x + y - |y - x|)

Next tactic:
rw [← LatticeOrderedCommGroup.two_inf_eq_add_sub_abs_sub x y, two_smul, ← two_smul α,
    smul_smul, invOf_mul_self, one_smul]
lemma sup_eq_half_smul_add_add_abs_sub (x y : β) :
    x ⊔ y = (⅟2 : α) • (x + y + |y - x|) := by
  

Proof state:
α : Type u
β : Type v
inst✝⁷ : Lattice α
inst✝⁶ : CommGroup α
inst✝⁵ : Semiring α
inst✝⁴ : Invertible 2
inst✝³ : Lattice β
inst✝² : AddCommGroup β
inst✝¹ : Module α β
inst✝ : CovariantClass β β (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
x y : β
⊢ x ⊔ y = ⅟2 • (x + y + |y - x|)

Next tactic:
rw [← LatticeOrderedCommGroup.two_sup_eq_add_add_abs_sub x y, two_smul, ← two_smul α,
    smul_smul, invOf_mul_self, one_smul]
lemma inf_eq_half_smul_add_sub_abs_sub' (x y : β) : x ⊓ y = (2⁻¹ : α) • (x + y - |y - x|) := by
  

Proof state:
α : Type u
β : Type v
inst✝⁷ : Lattice α
inst✝⁶ : CommGroup α
inst✝⁵ : DivisionSemiring α
inst✝⁴ : NeZero 2
inst✝³ : Lattice β
inst✝² : AddCommGroup β
inst✝¹ : Module α β
inst✝ : CovariantClass β β (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
x y : β
⊢ x ⊓ y = 2⁻¹ • (x + y - |y - x|)

Next tactic:
letI := invertibleOfNonzero (two_ne_zero' α)
lemma inf_eq_half_smul_add_sub_abs_sub' (x y : β) : x ⊓ y = (2⁻¹ : α) • (x + y - |y - x|) := by
  letI := invertibleOfNonzero (two_ne_zero' α)
  

Proof state:
α : Type u
β : Type v
inst✝⁷ : Lattice α
inst✝⁶ : CommGroup α
inst✝⁵ : DivisionSemiring α
inst✝⁴ : NeZero 2
inst✝³ : Lattice β
inst✝² : AddCommGroup β
inst✝¹ : Module α β
inst✝ : CovariantClass β β (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
x y : β
this : Invertible 2 := invertibleOfNonzero (_ : 2 ≠ 0)
⊢ x ⊓ y = 2⁻¹ • (x + y - |y - x|)

Next tactic:
exact inf_eq_half_smul_add_sub_abs_sub α x y
lemma sup_eq_half_smul_add_add_abs_sub' (x y : β) : x ⊔ y = (2⁻¹ : α) • (x + y + |y - x|) := by
  

Proof state:
α : Type u
β : Type v
inst✝⁷ : Lattice α
inst✝⁶ : CommGroup α
inst✝⁵ : DivisionSemiring α
inst✝⁴ : NeZero 2
inst✝³ : Lattice β
inst✝² : AddCommGroup β
inst✝¹ : Module α β
inst✝ : CovariantClass β β (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
x y : β
⊢ x ⊔ y = 2⁻¹ • (x + y + |y - x|)

Next tactic:
letI := invertibleOfNonzero (two_ne_zero' α)
lemma sup_eq_half_smul_add_add_abs_sub' (x y : β) : x ⊔ y = (2⁻¹ : α) • (x + y + |y - x|) := by
  letI := invertibleOfNonzero (two_ne_zero' α)
  

Proof state:
α : Type u
β : Type v
inst✝⁷ : Lattice α
inst✝⁶ : CommGroup α
inst✝⁵ : DivisionSemiring α
inst✝⁴ : NeZero 2
inst✝³ : Lattice β
inst✝² : AddCommGroup β
inst✝¹ : Module α β
inst✝ : CovariantClass β β (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
x y : β
this : Invertible 2 := invertibleOfNonzero (_ : 2 ≠ 0)
⊢ x ⊔ y = 2⁻¹ • (x + y + |y - x|)

Next tactic:
exact sup_eq_half_smul_add_add_abs_sub α x y
def push {n} (m : UFModel n) (k) (le : n ≤ k) : UFModel k where
  parent i :=
    if h : i < n then
      let ⟨a, h'⟩ := m.parent ⟨i, h⟩
      ⟨a, lt_of_lt_of_le h' le⟩
    else i
  rank i := if i < n then m.rank i else 0
  rank_lt i := by
    

Proof state:
n : ℕ
m : UFModel n
k : ℕ
le : n ≤ k
i : Fin k
⊢ ↑((fun i =>
            if h : ↑i < n then
              match parent m { val := ↑i, isLt := h } with
              | { val := a, isLt := h' } => { val := a, isLt := (_ : a < k) }
            else i)
          i) ≠
      ↑i →
    (fun i => if i < n then rank m i else 0) ↑i <
      (fun i => if i < n then rank m i else 0)
        ↑((fun i =>
              if h : ↑i < n then
                match parent m { val := ↑i, isLt := h } with
                | { val := a, isLt := h' } => { val := a, isLt := (_ : a < k) }
              else i)
            i)

Next tactic:
simp
def push {n} (m : UFModel n) (k) (le : n ≤ k) : UFModel k where
  parent i :=
    if h : i < n then
      let ⟨a, h'⟩ := m.parent ⟨i, h⟩
      ⟨a, lt_of_lt_of_le h' le⟩
    else i
  rank i := if i < n then m.rank i else 0
  rank_lt i := by
    simp; 

Proof state:
n : ℕ
m : UFModel n
k : ℕ
le : n ≤ k
i : Fin k
⊢ ¬↑(if h : ↑i < n then
            { val := ↑(m.1 { val := ↑i, isLt := (_ : ↑i < n) }),
              isLt := (_ : ↑(m.1 { val := ↑i, isLt := (_ : ↑i < n) }) < k) }
          else i) =
        ↑i →
    (if ↑i < n then rank m ↑i else 0) <
      if
          ↑(if h : ↑i < n then
                { val := ↑(m.1 { val := ↑i, isLt := (_ : ↑i < n) }),
                  isLt := (_ : ↑(m.1 { val := ↑i, isLt := (_ : ↑i < n) }) < k) }
              else i) <
            n then
        rank m
          ↑(if h : ↑i < n then
              { val := ↑(m.1 { val := ↑i, isLt := (_ : ↑i < n) }),
                isLt := (_ : ↑(m.1 { val := ↑i, isLt := (_ : ↑i < n) }) < k) }
            else i)
      else 0

Next tactic:
split
def push {n} (m : UFModel n) (k) (le : n ≤ k) : UFModel k where
  parent i :=
    if h : i < n then
      let ⟨a, h'⟩ := m.parent ⟨i, h⟩
      ⟨a, lt_of_lt_of_le h' le⟩
    else i
  rank i := if i < n then m.rank i else 0
  rank_lt i := by
    simp; split <;> 

Proof state:
case inl
n : ℕ
m : UFModel n
k : ℕ
le : n ≤ k
i : Fin k
h✝ : ↑i < n
⊢ ¬↑{ val := ↑(m.1 { val := ↑i, isLt := (_ : ↑i < n) }),
            isLt := (_ : ↑(m.1 { val := ↑i, isLt := (_ : ↑i < n) }) < k) } =
        ↑i →
    rank m ↑i <
      if
          ↑{ val := ↑(m.1 { val := ↑i, isLt := (_ : ↑i < n) }),
                isLt := (_ : ↑(m.1 { val := ↑i, isLt := (_ : ↑i < n) }) < k) } <
            n then
        rank m
          ↑{ val := ↑(m.1 { val := ↑i, isLt := (_ : ↑i < n) }),
              isLt := (_ : ↑(m.1 { val := ↑i, isLt := (_ : ↑i < n) }) < k) }
      else 0

Next tactic:
rename_i h
def push {n} (m : UFModel n) (k) (le : n ≤ k) : UFModel k where
  parent i :=
    if h : i < n then
      let ⟨a, h'⟩ := m.parent ⟨i, h⟩
      ⟨a, lt_of_lt_of_le h' le⟩
    else i
  rank i := if i < n then m.rank i else 0
  rank_lt i := by
    simp; split <;> 

Proof state:
case inr
n : ℕ
m : UFModel n
k : ℕ
le : n ≤ k
i : Fin k
h✝ : ¬↑i < n
⊢ ¬↑i = ↑i → 0 < 0

Next tactic:
rename_i h
def push {n} (m : UFModel n) (k) (le : n ≤ k) : UFModel k where
  parent i :=
    if h : i < n then
      let ⟨a, h'⟩ := m.parent ⟨i, h⟩
      ⟨a, lt_of_lt_of_le h' le⟩
    else i
  rank i := if i < n then m.rank i else 0
  rank_lt i := by
    simp; split <;> rename_i h
    · 

Proof state:
case inl
n : ℕ
m : UFModel n
k : ℕ
le : n ≤ k
i : Fin k
h : ↑i < n
⊢ ¬↑{ val := ↑(m.1 { val := ↑i, isLt := (_ : ↑i < n) }),
            isLt := (_ : ↑(m.1 { val := ↑i, isLt := (_ : ↑i < n) }) < k) } =
        ↑i →
    rank m ↑i <
      if
          ↑{ val := ↑(m.1 { val := ↑i, isLt := (_ : ↑i < n) }),
                isLt := (_ : ↑(m.1 { val := ↑i, isLt := (_ : ↑i < n) }) < k) } <
            n then
        rank m
          ↑{ val := ↑(m.1 { val := ↑i, isLt := (_ : ↑i < n) }),
              isLt := (_ : ↑(m.1 { val := ↑i, isLt := (_ : ↑i < n) }) < k) }
      else 0

Next tactic:
simp [(m.parent ⟨i, h⟩).2, h]
def push {n} (m : UFModel n) (k) (le : n ≤ k) : UFModel k where
  parent i :=
    if h : i < n then
      let ⟨a, h'⟩ := m.parent ⟨i, h⟩
      ⟨a, lt_of_lt_of_le h' le⟩
    else i
  rank i := if i < n then m.rank i else 0
  rank_lt i := by
    simp; split <;> rename_i h
    · simp [(m.parent ⟨i, h⟩).2, h]; 

Proof state:
case inl
n : ℕ
m : UFModel n
k : ℕ
le : n ≤ k
i : Fin k
h : ↑i < n
⊢ ¬↑(m.1 { val := ↑i, isLt := (_ : ↑i < n) }) = ↑i → rank m ↑i < rank m ↑(m.1 { val := ↑i, isLt := (_ : ↑i < n) })

Next tactic:
exact m.rank_lt _
def push {n} (m : UFModel n) (k) (le : n ≤ k) : UFModel k where
  parent i :=
    if h : i < n then
      let ⟨a, h'⟩ := m.parent ⟨i, h⟩
      ⟨a, lt_of_lt_of_le h' le⟩
    else i
  rank i := if i < n then m.rank i else 0
  rank_lt i := by
    simp; split <;> rename_i h
    · simp [(m.parent ⟨i, h⟩).2, h]; exact m.rank_lt _
    · 

Proof state:
case inr
n : ℕ
m : UFModel n
k : ℕ
le : n ≤ k
i : Fin k
h : ¬↑i < n
⊢ ¬↑i = ↑i → 0 < 0

Next tactic:
intro.
def setParent {n} (m : UFModel n) (x y : Fin n) (h : m.rank x < m.rank y) : UFModel n where
  parent i := if x.1 = i then y else m.parent i
  rank := m.rank
  rank_lt i := by
    

Proof state:
n : ℕ
m : UFModel n
x y : Fin n
h : rank m ↑x < rank m ↑y
i : Fin n
⊢ ↑((fun i => if ↑x = ↑i then y else parent m i) i) ≠ ↑i →
    rank m ↑i < rank m ↑((fun i => if ↑x = ↑i then y else parent m i) i)

Next tactic:
simp
def setParent {n} (m : UFModel n) (x y : Fin n) (h : m.rank x < m.rank y) : UFModel n where
  parent i := if x.1 = i then y else m.parent i
  rank := m.rank
  rank_lt i := by
    simp; 

Proof state:
n : ℕ
m : UFModel n
x y : Fin n
h : rank m ↑x < rank m ↑y
i : Fin n
⊢ ¬↑(if ↑x = ↑i then y else parent m i) = ↑i → rank m ↑i < rank m ↑(if ↑x = ↑i then y else parent m i)

Next tactic:
split
def setParent {n} (m : UFModel n) (x y : Fin n) (h : m.rank x < m.rank y) : UFModel n where
  parent i := if x.1 = i then y else m.parent i
  rank := m.rank
  rank_lt i := by
    simp; split <;> 

Proof state:
case inl
n : ℕ
m : UFModel n
x y : Fin n
h : rank m ↑x < rank m ↑y
i : Fin n
h✝ : ↑x = ↑i
⊢ ¬↑y = ↑i → rank m ↑i < rank m ↑y

Next tactic:
rename_i h'
def setParent {n} (m : UFModel n) (x y : Fin n) (h : m.rank x < m.rank y) : UFModel n where
  parent i := if x.1 = i then y else m.parent i
  rank := m.rank
  rank_lt i := by
    simp; split <;> 

Proof state:
case inr
n : ℕ
m : UFModel n
x y : Fin n
h : rank m ↑x < rank m ↑y
i : Fin n
h✝ : ¬↑x = ↑i
⊢ ¬↑(parent m i) = ↑i → rank m ↑i < rank m ↑(parent m i)

Next tactic:
rename_i h'
def setParent {n} (m : UFModel n) (x y : Fin n) (h : m.rank x < m.rank y) : UFModel n where
  parent i := if x.1 = i then y else m.parent i
  rank := m.rank
  rank_lt i := by
    simp; split <;> rename_i h'
    · 

Proof state:
case inl
n : ℕ
m : UFModel n
x y : Fin n
h : rank m ↑x < rank m ↑y
i : Fin n
h' : ↑x = ↑i
⊢ ¬↑y = ↑i → rank m ↑i < rank m ↑y

Next tactic:
rw [← h']
def setParent {n} (m : UFModel n) (x y : Fin n) (h : m.rank x < m.rank y) : UFModel n where
  parent i := if x.1 = i then y else m.parent i
  rank := m.rank
  rank_lt i := by
    simp; split <;> rename_i h'
    · rw [← h']; 

Proof state:
case inl
n : ℕ
m : UFModel n
x y : Fin n
h : rank m ↑x < rank m ↑y
i : Fin n
h' : ↑x = ↑i
⊢ ¬↑y = ↑x → rank m ↑x < rank m ↑y

Next tactic:
exact fun _ ↦ h
def setParent {n} (m : UFModel n) (x y : Fin n) (h : m.rank x < m.rank y) : UFModel n where
  parent i := if x.1 = i then y else m.parent i
  rank := m.rank
  rank_lt i := by
    simp; split <;> rename_i h'
    · rw [← h']; exact fun _ ↦ h
    · 

Proof state:
case inr
n : ℕ
m : UFModel n
x y : Fin n
h : rank m ↑x < rank m ↑y
i : Fin n
h' : ¬↑x = ↑i
⊢ ¬↑(parent m i) = ↑i → rank m ↑i < rank m ↑(parent m i)

Next tactic:
exact m.rank_lt i
def setParentBump {n} (m : UFModel n) (x y : Fin n)
    (H : m.rank x ≤ m.rank y) (hroot : (m.parent y).1 = y) : UFModel n where
  parent i := if x.1 = i then y else m.parent i
  rank i := if y.1 = i ∧ m.rank x = m.rank y then m.rank y + 1 else m.rank i
  rank_lt i := by
    

Proof state:
n : ℕ
m : UFModel n
x y : Fin n
H : rank m ↑x ≤ rank m ↑y
hroot : ↑(parent m y) = ↑y
i : Fin n
⊢ ↑((fun i => if ↑x = ↑i then y else parent m i) i) ≠ ↑i →
    (fun i => if ↑y = i ∧ rank m ↑x = rank m ↑y then rank m ↑y + 1 else rank m i) ↑i <
      (fun i => if ↑y = i ∧ rank m ↑x = rank m ↑y then rank m ↑y + 1 else rank m i)
        ↑((fun i => if ↑x = ↑i then y else parent m i) i)

Next tactic:
simp
def setParentBump {n} (m : UFModel n) (x y : Fin n)
    (H : m.rank x ≤ m.rank y) (hroot : (m.parent y).1 = y) : UFModel n where
  parent i := if x.1 = i then y else m.parent i
  rank i := if y.1 = i ∧ m.rank x = m.rank y then m.rank y + 1 else m.rank i
  rank_lt i := by
    simp; 

Proof state:
n : ℕ
m : UFModel n
x y : Fin n
H : rank m ↑x ≤ rank m ↑y
hroot : ↑(parent m y) = ↑y
i : Fin n
⊢ ¬↑(if ↑x = ↑i then y else parent m i) = ↑i →
    (if ↑y = ↑i ∧ rank m ↑x = rank m ↑y then rank m ↑y + 1 else rank m ↑i) <
      if ↑y = ↑(if ↑x = ↑i then y else parent m i) ∧ rank m ↑x = rank m ↑y then rank m ↑y + 1
      else rank m ↑(if ↑x = ↑i then y else parent m i)

Next tactic:
split
def setParentBump {n} (m : UFModel n) (x y : Fin n)
    (H : m.rank x ≤ m.rank y) (hroot : (m.parent y).1 = y) : UFModel n where
  parent i := if x.1 = i then y else m.parent i
  rank i := if y.1 = i ∧ m.rank x = m.rank y then m.rank y + 1 else m.rank i
  rank_lt i := by
    simp; split <;>
      (

Proof state:
case inl
n : ℕ
m : UFModel n
x y : Fin n
H : rank m ↑x ≤ rank m ↑y
hroot : ↑(parent m y) = ↑y
i : Fin n
h✝ : ↑x = ↑i
⊢ ¬↑y = ↑i →
    (if ↑y = ↑i ∧ rank m ↑x = rank m ↑y then rank m ↑y + 1 else rank m ↑i) <
      if ↑y = ↑y ∧ rank m ↑x = rank m ↑y then rank m ↑y + 1 else rank m ↑y

Next tactic:
rename_i h₁
def setParentBump {n} (m : UFModel n) (x y : Fin n)
    (H : m.rank x ≤ m.rank y) (hroot : (m.parent y).1 = y) : UFModel n where
  parent i := if x.1 = i then y else m.parent i
  rank i := if y.1 = i ∧ m.rank x = m.rank y then m.rank y + 1 else m.rank i
  rank_lt i := by
    simp; split <;>
      (rename_i h₁; (

Proof state:
case inl
n : ℕ
m : UFModel n
x y : Fin n
H : rank m ↑x ≤ rank m ↑y
hroot : ↑(parent m y) = ↑y
i : Fin n
h₁ : ↑x = ↑i
⊢ ¬↑y = ↑i →
    (if ↑y = ↑i ∧ rank m ↑x = rank m ↑y then rank m ↑y + 1 else rank m ↑i) <
      if ↑y = ↑y ∧ rank m ↑x = rank m ↑y then rank m ↑y + 1 else rank m ↑y

Next tactic:
try simp [h₁]
def setParentBump {n} (m : UFModel n) (x y : Fin n)
    (H : m.rank x ≤ m.rank y) (hroot : (m.parent y).1 = y) : UFModel n where
  parent i := if x.1 = i then y else m.parent i
  rank i := if y.1 = i ∧ m.rank x = m.rank y then m.rank y + 1 else m.rank i
  rank_lt i := by
    simp; split <;>
      (rename_i h₁; (try 

Proof state:
case inl
n : ℕ
m : UFModel n
x y : Fin n
H : rank m ↑x ≤ rank m ↑y
hroot : ↑(parent m y) = ↑y
i : Fin n
h₁ : ↑x = ↑i
⊢ ¬↑y = ↑i →
    (if ↑y = ↑i ∧ rank m ↑x = rank m ↑y then rank m ↑y + 1 else rank m ↑i) <
      if ↑y = ↑y ∧ rank m ↑x = rank m ↑y then rank m ↑y + 1 else rank m ↑y

Next tactic:
simp [h₁]
def setParentBump {n} (m : UFModel n) (x y : Fin n)
    (H : m.rank x ≤ m.rank y) (hroot : (m.parent y).1 = y) : UFModel n where
  parent i := if x.1 = i then y else m.parent i
  rank i := if y.1 = i ∧ m.rank x = m.rank y then m.rank y + 1 else m.rank i
  rank_lt i := by
    simp; split <;>
      (rename_i h₁; (try simp [h₁]); 

Proof state:
case inl
n : ℕ
m : UFModel n
x y : Fin n
H : rank m ↑x ≤ rank m ↑y
hroot : ↑(parent m y) = ↑y
i : Fin n
h₁ : ↑x = ↑i
⊢ ¬↑y = ↑i →
    (if ↑y = ↑i ∧ rank m ↑i = rank m ↑y then rank m ↑y + 1 else rank m ↑i) <
      if rank m ↑i = rank m ↑y then rank m ↑y + 1 else rank m ↑y

Next tactic:
split
def setParentBump {n} (m : UFModel n) (x y : Fin n)
    (H : m.rank x ≤ m.rank y) (hroot : (m.parent y).1 = y) : UFModel n where
  parent i := if x.1 = i then y else m.parent i
  rank i := if y.1 = i ∧ m.rank x = m.rank y then m.rank y + 1 else m.rank i
  rank_lt i := by
    simp; split <;>
      (rename_i h₁; (try simp [h₁]); split <;> 

Proof state:
case inl.inl
n : ℕ
m : UFModel n
x y : Fin n
H : rank m ↑x ≤ rank m ↑y
hroot : ↑(parent m y) = ↑y
i : Fin n
h₁ : ↑x = ↑i
h✝ : ↑y = ↑i ∧ rank m ↑i = rank m ↑y
⊢ ¬↑y = ↑i → rank m ↑y + 1 < if rank m ↑i = rank m ↑y then rank m ↑y + 1 else rank m ↑y

Next tactic:
rename_i h₂
def setParentBump {n} (m : UFModel n) (x y : Fin n)
    (H : m.rank x ≤ m.rank y) (hroot : (m.parent y).1 = y) : UFModel n where
  parent i := if x.1 = i then y else m.parent i
  rank i := if y.1 = i ∧ m.rank x = m.rank y then m.rank y + 1 else m.rank i
  rank_lt i := by
    simp; split <;>
      (rename_i h₁; (try simp [h₁]); split <;> 

Proof state:
case inl.inr
n : ℕ
m : UFModel n
x y : Fin n
H : rank m ↑x ≤ rank m ↑y
hroot : ↑(parent m y) = ↑y
i : Fin n
h₁ : ↑x = ↑i
h✝ : ¬(↑y = ↑i ∧ rank m ↑i = rank m ↑y)
⊢ ¬↑y = ↑i → rank m ↑i < if rank m ↑i = rank m ↑y then rank m ↑y + 1 else rank m ↑y

Next tactic:
rename_i h₂