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

tactic: rw [← balance_eq_balance' hl hr sl sr, balanceL_eq_balance sl sr]
state_before: α : Type u_1
l : Ordnode α
x : α
r : Ordnode α
hl : Balanced l
hr : Balanced r
sl : Sized l
sr : Sized r
H : (∃ l', Raised l' (size l) ∧ BalancedSz l' (size r)) ∨ ∃ r', Raised (size r) r' ∧ BalancedSz (size l) r'
⊢ balanceL l x r = balance' l x r

tactic: intro l0
state_before: case H1
α : Type u_1
l : Ordnode α
x : α
r : Ordnode α
hl : Balanced l
hr : Balanced r
sl : Sized l
sr : Sized r
H : (∃ l', Raised l' (size l) ∧ BalancedSz l' (size r)) ∨ ∃ r', Raised (size r) r' ∧ BalancedSz (size l) r'
⊢ size l = 0 → size r ≤ 1

tactic: rw [l0] at H
state_before: case H1
α : Type u_1
l : Ordnode α
x : α
r : Ordnode α
hl : Balanced l
hr : Balanced r
sl : Sized l
sr : Sized r
H : (∃ l', Raised l' (size l) ∧ BalancedSz l' (size r)) ∨ ∃ r', Raised (size r) r' ∧ BalancedSz (size l) r'
l0 : size l = 0
⊢ size r ≤ 1

tactic: rcases H with (⟨_, ⟨⟨⟩⟩ | ⟨⟨⟩⟩, H⟩ | ⟨r', e, H⟩)
state_before: case H1
α : Type u_1
l : Ordnode α
x : α
r : Ordnode α
hl : Balanced l
hr : Balanced r
sl : Sized l
sr : Sized r
H : (∃ l', Raised l' 0 ∧ BalancedSz l' (size r)) ∨ ∃ r', Raised (size r) r' ∧ BalancedSz 0 r'
l0 : size l = 0
⊢ size r ≤ 1

tactic: exact le_trans (raised_iff.1 e).1 (balancedSz_zero.1 H.symm)
state_before: case H1.inr.intro.intro
α : Type u_1
l : Ordnode α
x : α
r : Ordnode α
hl : Balanced l
hr : Balanced r
sl : Sized l
sr : Sized r
l0 : size l = 0
r' : ℕ
e : Raised (size r) r'
H : BalancedSz 0 r'
⊢ size r ≤ 1

tactic: exact balancedSz_zero.1 H.symm
state_before: case H1.inl.intro.intro.inl.refl
α : Type u_1
l : Ordnode α
x : α
r : Ordnode α
hl : Balanced l
hr : Balanced r
sl : Sized l
sr : Sized r
l0 : size l = 0
H : BalancedSz 0 (size r)
⊢ size r ≤ 1

tactic: intro l1 _
state_before: case H2
α : Type u_1
l : Ordnode α
x : α
r : Ordnode α
hl : Balanced l
hr : Balanced r
sl : Sized l
sr : Sized r
H : (∃ l', Raised l' (size l) ∧ BalancedSz l' (size r)) ∨ ∃ r', Raised (size r) r' ∧ BalancedSz (size l) r'
⊢ 1 ≤ size l → 1 ≤ size r → size r ≤ delta * size l

tactic: rcases H with (⟨l', e, H | ⟨_, H₂⟩⟩ | ⟨r', e, H | ⟨_, H₂⟩⟩)
state_before: case H2
α : Type u_1
l : Ordnode α
x : α
r : Ordnode α
hl : Balanced l
hr : Balanced r
sl : Sized l
sr : Sized r
H : (∃ l', Raised l' (size l) ∧ BalancedSz l' (size r)) ∨ ∃ r', Raised (size r) r' ∧ BalancedSz (size l) r'
l1 : 1 ≤ size l
a✝ : 1 ≤ size r
⊢ size r ≤ delta * size l

tactic: exact le_trans (le_trans (Nat.le_add_left _ _) H) (mul_pos (by decide) l1 : (0 : ℕ) < _)
state_before: case H2.inl.intro.intro.inl
α : Type u_1
l : Ordnode α
x : α
r : Ordnode α
hl : Balanced l
hr : Balanced r
sl : Sized l
sr : Sized r
l1 : 1 ≤ size l
a✝ : 1 ≤ size r
l' : ℕ
e : Raised l' (size l)
H : l' + size r ≤ 1
⊢ size r ≤ delta * size l

tactic: decide
state_before: α : Type u_1
l : Ordnode α
x : α
r : Ordnode α
hl : Balanced l
hr : Balanced r
sl : Sized l
sr : Sized r
l1 : 1 ≤ size l
a✝ : 1 ≤ size r
l' : ℕ
e : Raised l' (size l)
H : l' + size r ≤ 1
⊢ 0 < delta

tactic: exact le_trans H₂ (Nat.mul_le_mul_left _ (raised_iff.1 e).1)
state_before: case H2.inl.intro.intro.inr.intro
α : Type u_1
l : Ordnode α
x : α
r : Ordnode α
hl : Balanced l
hr : Balanced r
sl : Sized l
sr : Sized r
l1 : 1 ≤ size l
a✝ : 1 ≤ size r
l' : ℕ
e : Raised l' (size l)
left✝ : l' ≤ delta * size r
H₂ : size r ≤ delta * l'
⊢ size r ≤ delta * size l

tactic: cases raised_iff.1 e
state_before: case H2.inr.intro.intro.inl
α : Type u_1
l : Ordnode α
x : α
r : Ordnode α
hl : Balanced l
hr : Balanced r
sl : Sized l
sr : Sized r
l1 : 1 ≤ size l
a✝ : 1 ≤ size r
r' : ℕ
e : Raised (size r) r'
H : size l + r' ≤ 1
⊢ size r ≤ delta * size l

tactic: unfold delta
state_before: case H2.inr.intro.intro.inl.intro
α : Type u_1
l : Ordnode α
x : α
r : Ordnode α
hl : Balanced l
hr : Balanced r
sl : Sized l
sr : Sized r
l1 : 1 ≤ size l
a✝ : 1 ≤ size r
r' : ℕ
e : Raised (size r) r'
H : size l + r' ≤ 1
left✝ : size r ≤ r'
right✝ : r' ≤ size r + 1
⊢ size r ≤ delta * size l

tactic: linarith
state_before: case H2.inr.intro.intro.inl.intro
α : Type u_1
l : Ordnode α
x : α
r : Ordnode α
hl : Balanced l
hr : Balanced r
sl : Sized l
sr : Sized r
l1 : 1 ≤ size l
a✝ : 1 ≤ size r
r' : ℕ
e : Raised (size r) r'
H : size l + r' ≤ 1
left✝ : size r ≤ r'
right✝ : r' ≤ size r + 1
⊢ size r ≤ 3 * size l

tactic: exact le_trans (raised_iff.1 e).1 H₂
state_before: case H2.inr.intro.intro.inr.intro
α : Type u_1
l : Ordnode α
x : α
r : Ordnode α
hl : Balanced l
hr : Balanced r
sl : Sized l
sr : Sized r
l1 : 1 ≤ size l
a✝ : 1 ≤ size r
r' : ℕ
e : Raised (size r) r'
left✝ : size l ≤ delta * r'
H₂ : r' ≤ delta * size l
⊢ size r ≤ delta * size l