Theorem: Ordnode.Valid'.node4L
File: Mathlib/Data/Ordmap/Ordset.lean

tactic: cases' m with s ml z mr
state_before: α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x : α
m : Ordnode α
y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hm : Valid' (↑x) m ↑y
hr : Valid' (↑y) r o₂
Hm : 0 < size m
H :
  size l = 0 ∧ size m = 1 ∧ size r ≤ 1 ∨
    0 < size l ∧
      ratio * size r ≤ size m ∧
        delta * size l ≤ size m + size r ∧ 3 * (size m + size r) ≤ 16 * size l + 9 ∧ size m ≤ delta * size r
⊢ Valid' o₁ (Ordnode.node4L l x m y r) o₂

tactic: suffices :
  BalancedSz (size l) (size ml) ∧
    BalancedSz (size mr) (size r) ∧ BalancedSz (size l + size ml + 1) (size mr + size r + 1)
state_before: case node
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
H :
  size l = 0 ∧ size (Ordnode.node s ml z mr) = 1 ∧ size r ≤ 1 ∨
    0 < size l ∧
      ratio * size r ≤ size (Ordnode.node s ml z mr) ∧
        delta * size l ≤ size (Ordnode.node s ml z mr) + size r ∧
          3 * (size (Ordnode.node s ml z mr) + size r) ≤ 16 * size l + 9 ∧
            size (Ordnode.node s ml z mr) ≤ delta * size r
⊢ Valid' o₁ (Ordnode.node4L l x (Ordnode.node s ml z mr) y r) o₂

tactic: exact Valid'.node' (hl.node' hm.left this.1) (hm.right.node' hr this.2.1) this.2.2
state_before: case node
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
H :
  size l = 0 ∧ size (Ordnode.node s ml z mr) = 1 ∧ size r ≤ 1 ∨
    0 < size l ∧
      ratio * size r ≤ size (Ordnode.node s ml z mr) ∧
        delta * size l ≤ size (Ordnode.node s ml z mr) + size r ∧
          3 * (size (Ordnode.node s ml z mr) + size r) ≤ 16 * size l + 9 ∧
            size (Ordnode.node s ml z mr) ≤ delta * size r
this :
  BalancedSz (size l) (size ml) ∧
    BalancedSz (size mr) (size r) ∧ BalancedSz (size l + size ml + 1) (size mr + size r + 1)
⊢ Valid' o₁ (Ordnode.node4L l x (Ordnode.node s ml z mr) y r) o₂

case this
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
H :
  size l = 0 ∧ size (Ordnode.node s ml z mr) = 1 ∧ size r ≤ 1 ∨
    0 < size l ∧
      ratio * size r ≤ size (Ordnode.node s ml z mr) ∧
        delta * size l ≤ size (Ordnode.node s ml z mr) + size r ∧
          3 * (size (Ordnode.node s ml z mr) + size r) ≤ 16 * size l + 9 ∧
            size (Ordnode.node s ml z mr) ≤ delta * size r
⊢ BalancedSz (size l) (size ml) ∧
    BalancedSz (size mr) (size r) ∧ BalancedSz (size l + size ml + 1) (size mr + size r + 1)

tactic: rcases H with (⟨l0, m1, r0⟩ | ⟨l0, mr₁, lr₁, lr₂, mr₂⟩)
state_before: case this
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
H :
  size l = 0 ∧ size (Ordnode.node s ml z mr) = 1 ∧ size r ≤ 1 ∨
    0 < size l ∧
      ratio * size r ≤ size (Ordnode.node s ml z mr) ∧
        delta * size l ≤ size (Ordnode.node s ml z mr) + size r ∧
          3 * (size (Ordnode.node s ml z mr) + size r) ≤ 16 * size l + 9 ∧
            size (Ordnode.node s ml z mr) ≤ delta * size r
⊢ BalancedSz (size l) (size ml) ∧
    BalancedSz (size mr) (size r) ∧ BalancedSz (size l + size ml + 1) (size mr + size r + 1)

tactic: cases Hm
state_before: case nil
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
hm : Valid' (↑x) nil ↑y
Hm : 0 < size nil
H :
  size l = 0 ∧ size nil = 1 ∧ size r ≤ 1 ∨
    0 < size l ∧
      ratio * size r ≤ size nil ∧
        delta * size l ≤ size nil + size r ∧ 3 * (size nil + size r) ≤ 16 * size l + 9 ∧ size nil ≤ delta * size r
⊢ Valid' o₁ (Ordnode.node4L l x nil y r) o₂

tactic: rw [hm.2.size_eq, Nat.succ_inj', add_eq_zero_iff] at m1
state_before: case this.inl.intro.intro
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : size l = 0
m1 : size (Ordnode.node s ml z mr) = 1
r0 : size r ≤ 1
⊢ BalancedSz (size l) (size ml) ∧
    BalancedSz (size mr) (size r) ∧ BalancedSz (size l + size ml + 1) (size mr + size r + 1)

tactic: rw [l0, m1.1, m1.2]
state_before: case this.inl.intro.intro
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : size l = 0
m1 : size ml = 0 ∧ size mr = 0
r0 : size r ≤ 1
⊢ BalancedSz (size l) (size ml) ∧
    BalancedSz (size mr) (size r) ∧ BalancedSz (size l + size ml + 1) (size mr + size r + 1)

tactic: revert r0
state_before: case this.inl.intro.intro
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : size l = 0
m1 : size ml = 0 ∧ size mr = 0
r0 : size r ≤ 1
⊢ BalancedSz 0 0 ∧ BalancedSz 0 (size r) ∧ BalancedSz (0 + 0 + 1) (0 + size r + 1)

tactic: rcases size r with (_ | _ | _) <;>
[decide; decide; (intro r0; unfold BalancedSz delta; linarith)]
state_before: case this.inl.intro.intro
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : size l = 0
m1 : size ml = 0 ∧ size mr = 0
⊢ size r ≤ 1 → BalancedSz 0 0 ∧ BalancedSz 0 (size r) ∧ BalancedSz (0 + 0 + 1) (0 + size r + 1)

tactic: intro r0
state_before: case this.inl.intro.intro.succ.succ
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : size l = 0
m1 : size ml = 0 ∧ size mr = 0
n✝ : ℕ
⊢ Nat.succ (Nat.succ n✝) ≤ 1 →
    BalancedSz 0 0 ∧ BalancedSz 0 (Nat.succ (Nat.succ n✝)) ∧ BalancedSz (0 + 0 + 1) (0 + Nat.succ (Nat.succ n✝) + 1)

tactic: unfold BalancedSz delta
state_before: case this.inl.intro.intro.succ.succ
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : size l = 0
m1 : size ml = 0 ∧ size mr = 0
n✝ : ℕ
r0 : Nat.succ (Nat.succ n✝) ≤ 1
⊢ BalancedSz 0 0 ∧ BalancedSz 0 (Nat.succ (Nat.succ n✝)) ∧ BalancedSz (0 + 0 + 1) (0 + Nat.succ (Nat.succ n✝) + 1)

tactic: linarith
state_before: case this.inl.intro.intro.succ.succ
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : size l = 0
m1 : size ml = 0 ∧ size mr = 0
n✝ : ℕ
r0 : Nat.succ (Nat.succ n✝) ≤ 1
⊢ (0 + 0 ≤ 1 ∨ 0 ≤ 3 * 0 ∧ 0 ≤ 3 * 0) ∧
    (0 + Nat.succ (Nat.succ n✝) ≤ 1 ∨ 0 ≤ 3 * Nat.succ (Nat.succ n✝) ∧ Nat.succ (Nat.succ n✝) ≤ 3 * 0) ∧
      (0 + 0 + 1 + (0 + Nat.succ (Nat.succ n✝) + 1) ≤ 1 ∨
        0 + 0 + 1 ≤ 3 * (0 + Nat.succ (Nat.succ n✝) + 1) ∧ 0 + Nat.succ (Nat.succ n✝) + 1 ≤ 3 * (0 + 0 + 1))

tactic: cases' Nat.eq_zero_or_pos (size r) with r0 r0
state_before: case this.inr.intro.intro.intro.intro
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size (Ordnode.node s ml z mr)
lr₁ : delta * size l ≤ size (Ordnode.node s ml z mr) + size r
lr₂ : 3 * (size (Ordnode.node s ml z mr) + size r) ≤ 16 * size l + 9
mr₂ : size (Ordnode.node s ml z mr) ≤ delta * size r
⊢ BalancedSz (size l) (size ml) ∧
    BalancedSz (size mr) (size r) ∧ BalancedSz (size l + size ml + 1) (size mr + size r + 1)

tactic: rw [hm.2.size_eq] at lr₁ lr₂ mr₁ mr₂
state_before: case this.inr.intro.intro.intro.intro.inr
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size (Ordnode.node s ml z mr)
lr₁ : delta * size l ≤ size (Ordnode.node s ml z mr) + size r
lr₂ : 3 * (size (Ordnode.node s ml z mr) + size r) ≤ 16 * size l + 9
mr₂ : size (Ordnode.node s ml z mr) ≤ delta * size r
r0 : size r > 0
⊢ BalancedSz (size l) (size ml) ∧
    BalancedSz (size mr) (size r) ∧ BalancedSz (size l + size ml + 1) (size mr + size r + 1)

tactic: by_cases mm : size ml + size mr ≤ 1
state_before: case this.inr.intro.intro.intro.intro.inr
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
⊢ BalancedSz (size l) (size ml) ∧
    BalancedSz (size mr) (size r) ∧ BalancedSz (size l + size ml + 1) (size mr + size r + 1)

tactic: rcases hm.3.1.resolve_left mm with ⟨mm₁, mm₂⟩
state_before: case neg
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : ¬size ml + size mr ≤ 1
⊢ BalancedSz (size l) (size ml) ∧
    BalancedSz (size mr) (size r) ∧ BalancedSz (size l + size ml + 1) (size mr + size r + 1)

tactic: cases' Nat.eq_zero_or_pos (size ml) with ml0 ml0
state_before: case neg.intro
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : ¬size ml + size mr ≤ 1
mm₁ : size ml ≤ delta * size mr
mm₂ : size mr ≤ delta * size ml
⊢ BalancedSz (size l) (size ml) ∧
    BalancedSz (size mr) (size r) ∧ BalancedSz (size l + size ml + 1) (size mr + size r + 1)

tactic: have : 2 * size l ≤ size ml + size mr + 1 := by
  have := Nat.mul_le_mul_left ratio lr₁
  rw [mul_left_comm, mul_add] at this
  have := le_trans this (add_le_add_left mr₁ _)
  rw [← Nat.succ_mul] at this
  exact (mul_le_mul_left (by decide)).1 this
state_before: case neg.intro.inr
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : ¬size ml + size mr ≤ 1
mm₁ : size ml ≤ delta * size mr
mm₂ : size mr ≤ delta * size ml
ml0 : size ml > 0
⊢ BalancedSz (size l) (size ml) ∧
    BalancedSz (size mr) (size r) ∧ BalancedSz (size l + size ml + 1) (size mr + size r + 1)

tactic: refine' ⟨Or.inr ⟨_, _⟩, Or.inr ⟨_, _⟩, Or.inr ⟨_, _⟩⟩
state_before: case neg.intro.inr
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : ¬size ml + size mr ≤ 1
mm₁ : size ml ≤ delta * size mr
mm₂ : size mr ≤ delta * size ml
ml0 : size ml > 0
this : 2 * size l ≤ size ml + size mr + 1
⊢ BalancedSz (size l) (size ml) ∧
    BalancedSz (size mr) (size r) ∧ BalancedSz (size l + size ml + 1) (size mr + size r + 1)

tactic: rw [r0] at mr₂
state_before: case this.inr.intro.intro.intro.intro.inl
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size (Ordnode.node s ml z mr)
lr₁ : delta * size l ≤ size (Ordnode.node s ml z mr) + size r
lr₂ : 3 * (size (Ordnode.node s ml z mr) + size r) ≤ 16 * size l + 9
mr₂ : size (Ordnode.node s ml z mr) ≤ delta * size r
r0 : size r = 0
⊢ BalancedSz (size l) (size ml) ∧
    BalancedSz (size mr) (size r) ∧ BalancedSz (size l + size ml + 1) (size mr + size r + 1)

tactic: cases not_le_of_lt Hm mr₂
state_before: case this.inr.intro.intro.intro.intro.inl
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size (Ordnode.node s ml z mr)
lr₁ : delta * size l ≤ size (Ordnode.node s ml z mr) + size r
lr₂ : 3 * (size (Ordnode.node s ml z mr) + size r) ≤ 16 * size l + 9
mr₂ : size (Ordnode.node s ml z mr) ≤ delta * 0
r0 : size r = 0
⊢ BalancedSz (size l) (size ml) ∧
    BalancedSz (size mr) (size r) ∧ BalancedSz (size l + size ml + 1) (size mr + size r + 1)

tactic: have r1 :=
  le_antisymm
    ((mul_le_mul_left (by decide)).1 (le_trans mr₁ (Nat.succ_le_succ mm) : _ ≤ ratio * 1)) r0
state_before: case pos
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : size ml + size mr ≤ 1
⊢ BalancedSz (size l) (size ml) ∧
    BalancedSz (size mr) (size r) ∧ BalancedSz (size l + size ml + 1) (size mr + size r + 1)

tactic: rw [r1, add_assoc] at lr₁
state_before: case pos
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : size ml + size mr ≤ 1
r1 : size r = 1
⊢ BalancedSz (size l) (size ml) ∧
    BalancedSz (size mr) (size r) ∧ BalancedSz (size l + size ml + 1) (size mr + size r + 1)

tactic: have l1 :=
  le_antisymm
    ((mul_le_mul_left (by decide)).1 (le_trans lr₁ (add_le_add_right mm 2) : _ ≤ delta * 1))
    l0
state_before: case pos
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + (1 + 1)
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : size ml + size mr ≤ 1
r1 : size r = 1
⊢ BalancedSz (size l) (size ml) ∧
    BalancedSz (size mr) (size r) ∧ BalancedSz (size l + size ml + 1) (size mr + size r + 1)

tactic: rw [l1, r1]
state_before: case pos
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + (1 + 1)
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : size ml + size mr ≤ 1
r1 : size r = 1
l1 : size l = 1
⊢ BalancedSz (size l) (size ml) ∧
    BalancedSz (size mr) (size r) ∧ BalancedSz (size l + size ml + 1) (size mr + size r + 1)

tactic: revert mm
state_before: case pos
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + (1 + 1)
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : size ml + size mr ≤ 1
r1 : size r = 1
l1 : size l = 1
⊢ BalancedSz 1 (size ml) ∧ BalancedSz (size mr) 1 ∧ BalancedSz (1 + size ml + 1) (size mr + 1 + 1)

tactic: cases size ml <;> cases size mr <;> intro mm
state_before: case pos
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + (1 + 1)
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
r1 : size r = 1
l1 : size l = 1
⊢ size ml + size mr ≤ 1 →
    BalancedSz 1 (size ml) ∧ BalancedSz (size mr) 1 ∧ BalancedSz (1 + size ml + 1) (size mr + 1 + 1)

tactic: decide
state_before: α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : size ml + size mr ≤ 1
⊢ 0 < ratio

tactic: decide
state_before: α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + (1 + 1)
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : size ml + size mr ≤ 1
r1 : size r = 1
⊢ 0 < delta

tactic: decide
state_before: case pos.zero.zero
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + (1 + 1)
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
r1 : size r = 1
l1 : size l = 1
mm : Nat.zero + Nat.zero ≤ 1
⊢ BalancedSz 1 Nat.zero ∧ BalancedSz Nat.zero 1 ∧ BalancedSz (1 + Nat.zero + 1) (Nat.zero + 1 + 1)

tactic: rw [Nat.zero_eq, zero_add] at mm
state_before: case pos.zero.succ
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + (1 + 1)
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
r1 : size r = 1
l1 : size l = 1
n✝ : ℕ
mm : Nat.zero + Nat.succ n✝ ≤ 1
⊢ BalancedSz 1 Nat.zero ∧ BalancedSz (Nat.succ n✝) 1 ∧ BalancedSz (1 + Nat.zero + 1) (Nat.succ n✝ + 1 + 1)

tactic: rcases mm with (_ | ⟨⟨⟩⟩)
state_before: case pos.zero.succ
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + (1 + 1)
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
r1 : size r = 1
l1 : size l = 1
n✝ : ℕ
mm : Nat.succ n✝ ≤ 1
⊢ BalancedSz 1 Nat.zero ∧ BalancedSz (Nat.succ n✝) 1 ∧ BalancedSz (1 + Nat.zero + 1) (Nat.succ n✝ + 1 + 1)

tactic: decide
state_before: case pos.zero.succ.refl
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + (1 + 1)
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
r1 : size r = 1
l1 : size l = 1
⊢ BalancedSz 1 Nat.zero ∧ BalancedSz (Nat.succ 0) 1 ∧ BalancedSz (1 + Nat.zero + 1) (Nat.succ 0 + 1 + 1)

tactic: rcases mm with (_ | ⟨⟨⟩⟩)
state_before: case pos.succ.zero
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + (1 + 1)
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
r1 : size r = 1
l1 : size l = 1
n✝ : ℕ
mm : Nat.succ n✝ + Nat.zero ≤ 1
⊢ BalancedSz 1 (Nat.succ n✝) ∧ BalancedSz Nat.zero 1 ∧ BalancedSz (1 + Nat.succ n✝ + 1) (Nat.zero + 1 + 1)

tactic: decide
state_before: case pos.succ.zero.refl
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + (1 + 1)
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
r1 : size r = 1
l1 : size l = 1
⊢ BalancedSz 1 (Nat.succ 0) ∧ BalancedSz Nat.zero 1 ∧ BalancedSz (1 + Nat.succ 0 + 1) (Nat.zero + 1 + 1)

tactic: rw [Nat.succ_add] at mm
state_before: case pos.succ.succ
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + (1 + 1)
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
r1 : size r = 1
l1 : size l = 1
n✝¹ n✝ : ℕ
mm : Nat.succ n✝¹ + Nat.succ n✝ ≤ 1
⊢ BalancedSz 1 (Nat.succ n✝¹) ∧ BalancedSz (Nat.succ n✝) 1 ∧ BalancedSz (1 + Nat.succ n✝¹ + 1) (Nat.succ n✝ + 1 + 1)

tactic: rcases mm with (_ | ⟨⟨⟩⟩)
state_before: case pos.succ.succ
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + (1 + 1)
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
r1 : size r = 1
l1 : size l = 1
n✝¹ n✝ : ℕ
mm : Nat.succ (n✝¹ + Nat.succ n✝) ≤ 1
⊢ BalancedSz 1 (Nat.succ n✝¹) ∧ BalancedSz (Nat.succ n✝) 1 ∧ BalancedSz (1 + Nat.succ n✝¹ + 1) (Nat.succ n✝ + 1 + 1)

tactic: rw [ml0, MulZeroClass.mul_zero, le_zero_iff] at mm₂
state_before: case neg.intro.inl
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : ¬size ml + size mr ≤ 1
mm₁ : size ml ≤ delta * size mr
mm₂ : size mr ≤ delta * size ml
ml0 : size ml = 0
⊢ BalancedSz (size l) (size ml) ∧
    BalancedSz (size mr) (size r) ∧ BalancedSz (size l + size ml + 1) (size mr + size r + 1)

tactic: rw [ml0, mm₂] at mm
state_before: case neg.intro.inl
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : ¬size ml + size mr ≤ 1
mm₁ : size ml ≤ delta * size mr
mm₂ : size mr = 0
ml0 : size ml = 0
⊢ BalancedSz (size l) (size ml) ∧
    BalancedSz (size mr) (size r) ∧ BalancedSz (size l + size ml + 1) (size mr + size r + 1)

tactic: cases mm (by decide)
state_before: case neg.intro.inl
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : ¬0 + 0 ≤ 1
mm₁ : size ml ≤ delta * size mr
mm₂ : size mr = 0
ml0 : size ml = 0
⊢ BalancedSz (size l) (size ml) ∧
    BalancedSz (size mr) (size r) ∧ BalancedSz (size l + size ml + 1) (size mr + size r + 1)

tactic: decide
state_before: α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : ¬0 + 0 ≤ 1
mm₁ : size ml ≤ delta * size mr
mm₂ : size mr = 0
ml0 : size ml = 0
⊢ 0 + 0 ≤ 1

tactic: have := Nat.mul_le_mul_left ratio lr₁
state_before: α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : ¬size ml + size mr ≤ 1
mm₁ : size ml ≤ delta * size mr
mm₂ : size mr ≤ delta * size ml
ml0 : size ml > 0
⊢ 2 * size l ≤ size ml + size mr + 1

tactic: rw [mul_left_comm, mul_add] at this
state_before: α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : ¬size ml + size mr ≤ 1
mm₁ : size ml ≤ delta * size mr
mm₂ : size mr ≤ delta * size ml
ml0 : size ml > 0
this : ratio * (delta * size l) ≤ ratio * (size ml + size mr + 1 + size r)
⊢ 2 * size l ≤ size ml + size mr + 1

tactic: have := le_trans this (add_le_add_left mr₁ _)
state_before: α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : ¬size ml + size mr ≤ 1
mm₁ : size ml ≤ delta * size mr
mm₂ : size mr ≤ delta * size ml
ml0 : size ml > 0
this : delta * (ratio * size l) ≤ ratio * (size ml + size mr + 1) + ratio * size r
⊢ 2 * size l ≤ size ml + size mr + 1

tactic: rw [← Nat.succ_mul] at this
state_before: α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : ¬size ml + size mr ≤ 1
mm₁ : size ml ≤ delta * size mr
mm₂ : size mr ≤ delta * size ml
ml0 : size ml > 0
this✝ : delta * (ratio * size l) ≤ ratio * (size ml + size mr + 1) + ratio * size r
this : delta * (ratio * size l) ≤ ratio * (size ml + size mr + 1) + (size ml + size mr + 1)
⊢ 2 * size l ≤ size ml + size mr + 1

tactic: exact (mul_le_mul_left (by decide)).1 this
state_before: α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : ¬size ml + size mr ≤ 1
mm₁ : size ml ≤ delta * size mr
mm₂ : size mr ≤ delta * size ml
ml0 : size ml > 0
this✝ : delta * (ratio * size l) ≤ ratio * (size ml + size mr + 1) + ratio * size r
this : delta * (ratio * size l) ≤ Nat.succ ratio * (size ml + size mr + 1)
⊢ 2 * size l ≤ size ml + size mr + 1

tactic: decide
state_before: α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : ¬size ml + size mr ≤ 1
mm₁ : size ml ≤ delta * size mr
mm₂ : size mr ≤ delta * size ml
ml0 : size ml > 0
this✝ : delta * (ratio * size l) ≤ ratio * (size ml + size mr + 1) + ratio * size r
this : delta * (ratio * size l) ≤ Nat.succ ratio * (size ml + size mr + 1)
⊢ 0 < delta

tactic: refine' (mul_le_mul_left (by decide)).1 (le_trans this _)
state_before: case neg.intro.inr.refine'_1
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : ¬size ml + size mr ≤ 1
mm₁ : size ml ≤ delta * size mr
mm₂ : size mr ≤ delta * size ml
ml0 : size ml > 0
this : 2 * size l ≤ size ml + size mr + 1
⊢ size l ≤ delta * size ml

tactic: rw [two_mul, Nat.succ_le_iff]
state_before: case neg.intro.inr.refine'_1
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : ¬size ml + size mr ≤ 1
mm₁ : size ml ≤ delta * size mr
mm₂ : size mr ≤ delta * size ml
ml0 : size ml > 0
this : 2 * size l ≤ size ml + size mr + 1
⊢ size ml + size mr + 1 ≤ 2 * (delta * size ml)

tactic: refine' add_lt_add_of_lt_of_le _ mm₂
state_before: case neg.intro.inr.refine'_1
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : ¬size ml + size mr ≤ 1
mm₁ : size ml ≤ delta * size mr
mm₂ : size mr ≤ delta * size ml
ml0 : size ml > 0
this : 2 * size l ≤ size ml + size mr + 1
⊢ size ml + size mr < delta * size ml + delta * size ml

tactic: simpa using (mul_lt_mul_right ml0).2 (by decide : 1 < 3)
state_before: case neg.intro.inr.refine'_1
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : ¬size ml + size mr ≤ 1
mm₁ : size ml ≤ delta * size mr
mm₂ : size mr ≤ delta * size ml
ml0 : size ml > 0
this : 2 * size l ≤ size ml + size mr + 1
⊢ size ml < delta * size ml

tactic: decide
state_before: α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : ¬size ml + size mr ≤ 1
mm₁ : size ml ≤ delta * size mr
mm₂ : size mr ≤ delta * size ml
ml0 : size ml > 0
this : 2 * size l ≤ size ml + size mr + 1
⊢ 0 < 2

tactic: decide
state_before: α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : ¬size ml + size mr ≤ 1
mm₁ : size ml ≤ delta * size mr
mm₂ : size mr ≤ delta * size ml
ml0 : size ml > 0
this : 2 * size l ≤ size ml + size mr + 1
⊢ 1 < 3

tactic: exact Nat.le_of_lt_succ (Valid'.node4L_lemma₁ lr₂ mr₂ mm₁)
state_before: case neg.intro.inr.refine'_2
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : ¬size ml + size mr ≤ 1
mm₁ : size ml ≤ delta * size mr
mm₂ : size mr ≤ delta * size ml
ml0 : size ml > 0
this : 2 * size l ≤ size ml + size mr + 1
⊢ size ml ≤ delta * size l

tactic: exact Valid'.node4L_lemma₂ mr₂
state_before: case neg.intro.inr.refine'_3
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : ¬size ml + size mr ≤ 1
mm₁ : size ml ≤ delta * size mr
mm₂ : size mr ≤ delta * size ml
ml0 : size ml > 0
this : 2 * size l ≤ size ml + size mr + 1
⊢ size mr ≤ delta * size r

tactic: exact Valid'.node4L_lemma₃ mr₁ mm₁
state_before: case neg.intro.inr.refine'_4
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : ¬size ml + size mr ≤ 1
mm₁ : size ml ≤ delta * size mr
mm₂ : size mr ≤ delta * size ml
ml0 : size ml > 0
this : 2 * size l ≤ size ml + size mr + 1
⊢ size r ≤ delta * size mr

tactic: exact Valid'.node4L_lemma₄ lr₁ mr₂ mm₁
state_before: case neg.intro.inr.refine'_5
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : ¬size ml + size mr ≤ 1
mm₁ : size ml ≤ delta * size mr
mm₂ : size mr ≤ delta * size ml
ml0 : size ml > 0
this : 2 * size l ≤ size ml + size mr + 1
⊢ size l + size ml + 1 ≤ delta * (size mr + size r + 1)

tactic: exact Valid'.node4L_lemma₅ lr₂ mr₁ mm₂
state_before: case neg.intro.inr.refine'_6
α : Type u_1
inst✝ : Preorder α
l : Ordnode α
x y : α
r : Ordnode α
o₁ : WithBot α
o₂ : WithTop α
hl : Valid' o₁ l ↑x
hr : Valid' (↑y) r o₂
s : ℕ
ml : Ordnode α
z : α
mr : Ordnode α
hm : Valid' (↑x) (Ordnode.node s ml z mr) ↑y
Hm : 0 < size (Ordnode.node s ml z mr)
l0 : 0 < size l
mr₁ : ratio * size r ≤ size ml + size mr + 1
lr₁ : delta * size l ≤ size ml + size mr + 1 + size r
lr₂ : 3 * (size ml + size mr + 1 + size r) ≤ 16 * size l + 9
mr₂ : size ml + size mr + 1 ≤ delta * size r
r0 : size r > 0
mm : ¬size ml + size mr ≤ 1
mm₁ : size ml ≤ delta * size mr
mm₂ : size mr ≤ delta * size ml
ml0 : size ml > 0
this : 2 * size l ≤ size ml + size mr + 1
⊢ size mr + size r + 1 ≤ delta * (size l + size ml + 1)