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

tactic: rw [hl.2.1] at e
state_before: α : Type u_1
inst✝ : Preorder α
o₁ : WithBot α
o₂ : WithTop α
ls : ℕ
ll : Ordnode α
lx : α
lr : Ordnode α
rs : ℕ
rl : Ordnode α
rx : α
rr t : Ordnode α
hl : Valid' o₁ (Ordnode.node ls ll lx lr) o₂
hr : Valid' o₁ (Ordnode.node rs rl rx rr) o₂
h : delta * ls < rs
v : Valid' o₁ t ↑rx
e : size t = ls + size rl
⊢ Valid' o₁ (Ordnode.balanceL t rx rr) o₂ ∧ size (Ordnode.balanceL t rx rr) = ls + rs

tactic: rw [hl.2.1, hr.2.1, delta] at h
state_before: α : Type u_1
inst✝ : Preorder α
o₁ : WithBot α
o₂ : WithTop α
ls : ℕ
ll : Ordnode α
lx : α
lr : Ordnode α
rs : ℕ
rl : Ordnode α
rx : α
rr t : Ordnode α
hl : Valid' o₁ (Ordnode.node ls ll lx lr) o₂
hr : Valid' o₁ (Ordnode.node rs rl rx rr) o₂
h : delta * ls < rs
v : Valid' o₁ t ↑rx
e : size t = size ll + size lr + 1 + size rl
⊢ Valid' o₁ (Ordnode.balanceL t rx rr) o₂ ∧ size (Ordnode.balanceL t rx rr) = ls + rs

tactic: rcases hr.3.1 with (H | ⟨hr₁, hr₂⟩)
state_before: α : Type u_1
inst✝ : Preorder α
o₁ : WithBot α
o₂ : WithTop α
ls : ℕ
ll : Ordnode α
lx : α
lr : Ordnode α
rs : ℕ
rl : Ordnode α
rx : α
rr t : Ordnode α
hl : Valid' o₁ (Ordnode.node ls ll lx lr) o₂
hr : Valid' o₁ (Ordnode.node rs rl rx rr) o₂
h : 3 * (size ll + size lr + 1) < size rl + size rr + 1
v : Valid' o₁ t ↑rx
e : size t = size ll + size lr + 1 + size rl
⊢ Valid' o₁ (Ordnode.balanceL t rx rr) o₂ ∧ size (Ordnode.balanceL t rx rr) = ls + rs

tactic: suffices H₂
state_before: case inr.intro
α : Type u_1
inst✝ : Preorder α
o₁ : WithBot α
o₂ : WithTop α
ls : ℕ
ll : Ordnode α
lx : α
lr : Ordnode α
rs : ℕ
rl : Ordnode α
rx : α
rr t : Ordnode α
hl : Valid' o₁ (Ordnode.node ls ll lx lr) o₂
hr : Valid' o₁ (Ordnode.node rs rl rx rr) o₂
h : 3 * (size ll + size lr + 1) < size rl + size rr + 1
v : Valid' o₁ t ↑rx
e : size t = size ll + size lr + 1 + size rl
hr₁ : size rl ≤ delta * size rr
hr₂ : size rr ≤ delta * size rl
⊢ Valid' o₁ (Ordnode.balanceL t rx rr) o₂ ∧ size (Ordnode.balanceL t rx rr) = ls + rs

tactic: suffices H₁
state_before: case inr.intro
α : Type u_1
inst✝ : Preorder α
o₁ : WithBot α
o₂ : WithTop α
ls : ℕ
ll : Ordnode α
lx : α
lr : Ordnode α
rs : ℕ
rl : Ordnode α
rx : α
rr t : Ordnode α
hl : Valid' o₁ (Ordnode.node ls ll lx lr) o₂
hr : Valid' o₁ (Ordnode.node rs rl rx rr) o₂
h : 3 * (size ll + size lr + 1) < size rl + size rr + 1
v : Valid' o₁ t ↑rx
e : size t = size ll + size lr + 1 + size rl
hr₁ : size rl ≤ delta * size rr
hr₂ : size rr ≤ delta * size rl
H₂ : ?m.359131
⊢ Valid' o₁ (Ordnode.balanceL t rx rr) o₂ ∧ size (Ordnode.balanceL t rx rr) = ls + rs

case H₂
α : Type u_1
inst✝ : Preorder α
o₁ : WithBot α
o₂ : WithTop α
ls : ℕ
ll : Ordnode α
lx : α
lr : Ordnode α
rs : ℕ
rl : Ordnode α
rx : α
rr t : Ordnode α
hl : Valid' o₁ (Ordnode.node ls ll lx lr) o₂
hr : Valid' o₁ (Ordnode.node rs rl rx rr) o₂
h : 3 * (size ll + size lr + 1) < size rl + size rr + 1
v : Valid' o₁ t ↑rx
e : size t = size ll + size lr + 1 + size rl
hr₁ : size rl ≤ delta * size rr
hr₂ : size rr ≤ delta * size rl
⊢ ?m.359131

tactic: refine' ⟨Valid'.balanceL_aux v hr.right H₁ H₂ _, _⟩
state_before: case inr.intro
α : Type u_1
inst✝ : Preorder α
o₁ : WithBot α
o₂ : WithTop α
ls : ℕ
ll : Ordnode α
lx : α
lr : Ordnode α
rs : ℕ
rl : Ordnode α
rx : α
rr t : Ordnode α
hl : Valid' o₁ (Ordnode.node ls ll lx lr) o₂
hr : Valid' o₁ (Ordnode.node rs rl rx rr) o₂
h : 3 * (size ll + size lr + 1) < size rl + size rr + 1
v : Valid' o₁ t ↑rx
e : size t = size ll + size lr + 1 + size rl
hr₁ : size rl ≤ delta * size rr
hr₂ : size rr ≤ delta * size rl
H₂ : ?m.359131
H₁ : ?m.359138
⊢ Valid' o₁ (Ordnode.balanceL t rx rr) o₂ ∧ size (Ordnode.balanceL t rx rr) = ls + rs

case H₁
α : Type u_1
inst✝ : Preorder α
o₁ : WithBot α
o₂ : WithTop α
ls : ℕ
ll : Ordnode α
lx : α
lr : Ordnode α
rs : ℕ
rl : Ordnode α
rx : α
rr t : Ordnode α
hl : Valid' o₁ (Ordnode.node ls ll lx lr) o₂
hr : Valid' o₁ (Ordnode.node rs rl rx rr) o₂
h : 3 * (size ll + size lr + 1) < size rl + size rr + 1
v : Valid' o₁ t ↑rx
e : size t = size ll + size lr + 1 + size rl
hr₁ : size rl ≤ delta * size rr
hr₂ : size rr ≤ delta * size rl
H₂ : ?m.359131
⊢ ?m.359138

case H₂
α : Type u_1
inst✝ : Preorder α
o₁ : WithBot α
o₂ : WithTop α
ls : ℕ
ll : Ordnode α
lx : α
lr : Ordnode α
rs : ℕ
rl : Ordnode α
rx : α
rr t : Ordnode α
hl : Valid' o₁ (Ordnode.node ls ll lx lr) o₂
hr : Valid' o₁ (Ordnode.node rs rl rx rr) o₂
h : 3 * (size ll + size lr + 1) < size rl + size rr + 1
v : Valid' o₁ t ↑rx
e : size t = size ll + size lr + 1 + size rl
hr₁ : size rl ≤ delta * size rr
hr₂ : size rr ≤ delta * size rl
⊢ ?m.359131

tactic: linarith
state_before: case inl
α : Type u_1
inst✝ : Preorder α
o₁ : WithBot α
o₂ : WithTop α
ls : ℕ
ll : Ordnode α
lx : α
lr : Ordnode α
rs : ℕ
rl : Ordnode α
rx : α
rr t : Ordnode α
hl : Valid' o₁ (Ordnode.node ls ll lx lr) o₂
hr : Valid' o₁ (Ordnode.node rs rl rx rr) o₂
h : 3 * (size ll + size lr + 1) < size rl + size rr + 1
v : Valid' o₁ t ↑rx
e : size t = size ll + size lr + 1 + size rl
H : size rl + size rr ≤ 1
⊢ Valid' o₁ (Ordnode.balanceL t rx rr) o₂ ∧ size (Ordnode.balanceL t rx rr) = ls + rs

tactic: rw [e]
state_before: case inr.intro.refine'_1
α : Type u_1
inst✝ : Preorder α
o₁ : WithBot α
o₂ : WithTop α
ls : ℕ
ll : Ordnode α
lx : α
lr : Ordnode α
rs : ℕ
rl : Ordnode α
rx : α
rr t : Ordnode α
hl : Valid' o₁ (Ordnode.node ls ll lx lr) o₂
hr : Valid' o₁ (Ordnode.node rs rl rx rr) o₂
h : 3 * (size ll + size lr + 1) < size rl + size rr + 1
v : Valid' o₁ t ↑rx
e : size t = size ll + size lr + 1 + size rl
hr₁ : size rl ≤ delta * size rr
hr₂ : size rr ≤ delta * size rl
H₂ : 1 ≤ size t → 1 ≤ size rr → size rr ≤ delta * size t
H₁ : size t = 0 → size rr ≤ 1
⊢ 2 * size t ≤ 9 * size rr + 5 ∨ size t ≤ 3

tactic: exact Or.inl (Valid'.merge_lemma h hr₁)
state_before: case inr.intro.refine'_1
α : Type u_1
inst✝ : Preorder α
o₁ : WithBot α
o₂ : WithTop α
ls : ℕ
ll : Ordnode α
lx : α
lr : Ordnode α
rs : ℕ
rl : Ordnode α
rx : α
rr t : Ordnode α
hl : Valid' o₁ (Ordnode.node ls ll lx lr) o₂
hr : Valid' o₁ (Ordnode.node rs rl rx rr) o₂
h : 3 * (size ll + size lr + 1) < size rl + size rr + 1
v : Valid' o₁ t ↑rx
e : size t = size ll + size lr + 1 + size rl
hr₁ : size rl ≤ delta * size rr
hr₂ : size rr ≤ delta * size rl
H₂ : 1 ≤ size t → 1 ≤ size rr → size rr ≤ delta * size t
H₁ : size t = 0 → size rr ≤ 1
⊢ 2 * (size ll + size lr + 1 + size rl) ≤ 9 * size rr + 5 ∨ size ll + size lr + 1 + size rl ≤ 3

tactic: rw [balanceL_eq_balance v.2 hr.2.2.2 H₁ H₂, balance_eq_balance' v.3 hr.3.2.2 v.2 hr.2.2.2,
  size_balance' v.2 hr.2.2.2, e, hl.2.1, hr.2.1]
state_before: case inr.intro.refine'_2
α : Type u_1
inst✝ : Preorder α
o₁ : WithBot α
o₂ : WithTop α
ls : ℕ
ll : Ordnode α
lx : α
lr : Ordnode α
rs : ℕ
rl : Ordnode α
rx : α
rr t : Ordnode α
hl : Valid' o₁ (Ordnode.node ls ll lx lr) o₂
hr : Valid' o₁ (Ordnode.node rs rl rx rr) o₂
h : 3 * (size ll + size lr + 1) < size rl + size rr + 1
v : Valid' o₁ t ↑rx
e : size t = size ll + size lr + 1 + size rl
hr₁ : size rl ≤ delta * size rr
hr₂ : size rr ≤ delta * size rl
H₂ : 1 ≤ size t → 1 ≤ size rr → size rr ≤ delta * size t
H₁ : size t = 0 → size rr ≤ 1
⊢ size (Ordnode.balanceL t rx rr) = ls + rs

tactic: abel
state_before: case inr.intro.refine'_2
α : Type u_1
inst✝ : Preorder α
o₁ : WithBot α
o₂ : WithTop α
ls : ℕ
ll : Ordnode α
lx : α
lr : Ordnode α
rs : ℕ
rl : Ordnode α
rx : α
rr t : Ordnode α
hl : Valid' o₁ (Ordnode.node ls ll lx lr) o₂
hr : Valid' o₁ (Ordnode.node rs rl rx rr) o₂
h : 3 * (size ll + size lr + 1) < size rl + size rr + 1
v : Valid' o₁ t ↑rx
e : size t = size ll + size lr + 1 + size rl
hr₁ : size rl ≤ delta * size rr
hr₂ : size rr ≤ delta * size rl
H₂ : 1 ≤ size t → 1 ≤ size rr → size rr ≤ delta * size t
H₁ : size t = 0 → size rr ≤ 1
⊢ size ll + size lr + 1 + size rl + size rr + 1 = size ll + size lr + 1 + (size rl + size rr + 1)

tactic: rw [e, add_right_comm]
state_before: case H₁
α : Type u_1
inst✝ : Preorder α
o₁ : WithBot α
o₂ : WithTop α
ls : ℕ
ll : Ordnode α
lx : α
lr : Ordnode α
rs : ℕ
rl : Ordnode α
rx : α
rr t : Ordnode α
hl : Valid' o₁ (Ordnode.node ls ll lx lr) o₂
hr : Valid' o₁ (Ordnode.node rs rl rx rr) o₂
h : 3 * (size ll + size lr + 1) < size rl + size rr + 1
v : Valid' o₁ t ↑rx
e : size t = size ll + size lr + 1 + size rl
hr₁ : size rl ≤ delta * size rr
hr₂ : size rr ≤ delta * size rl
H₂ : 1 ≤ size t → 1 ≤ size rr → size rr ≤ delta * size t
⊢ size t = 0 → size rr ≤ 1

tactic: rintro ⟨⟩
state_before: case H₁
α : Type u_1
inst✝ : Preorder α
o₁ : WithBot α
o₂ : WithTop α
ls : ℕ
ll : Ordnode α
lx : α
lr : Ordnode α
rs : ℕ
rl : Ordnode α
rx : α
rr t : Ordnode α
hl : Valid' o₁ (Ordnode.node ls ll lx lr) o₂
hr : Valid' o₁ (Ordnode.node rs rl rx rr) o₂
h : 3 * (size ll + size lr + 1) < size rl + size rr + 1
v : Valid' o₁ t ↑rx
e : size t = size ll + size lr + 1 + size rl
hr₁ : size rl ≤ delta * size rr
hr₂ : size rr ≤ delta * size rl
H₂ : 1 ≤ size t → 1 ≤ size rr → size rr ≤ delta * size t
⊢ size ll + size lr + size rl + 1 = 0 → size rr ≤ 1

tactic: intro _ _
state_before: case H₂
α : Type u_1
inst✝ : Preorder α
o₁ : WithBot α
o₂ : WithTop α
ls : ℕ
ll : Ordnode α
lx : α
lr : Ordnode α
rs : ℕ
rl : Ordnode α
rx : α
rr t : Ordnode α
hl : Valid' o₁ (Ordnode.node ls ll lx lr) o₂
hr : Valid' o₁ (Ordnode.node rs rl rx rr) o₂
h : 3 * (size ll + size lr + 1) < size rl + size rr + 1
v : Valid' o₁ t ↑rx
e : size t = size ll + size lr + 1 + size rl
hr₁ : size rl ≤ delta * size rr
hr₂ : size rr ≤ delta * size rl
⊢ 1 ≤ size t → 1 ≤ size rr → size rr ≤ delta * size t

tactic: rw [e]
state_before: case H₂
α : Type u_1
inst✝ : Preorder α
o₁ : WithBot α
o₂ : WithTop α
ls : ℕ
ll : Ordnode α
lx : α
lr : Ordnode α
rs : ℕ
rl : Ordnode α
rx : α
rr t : Ordnode α
hl : Valid' o₁ (Ordnode.node ls ll lx lr) o₂
hr : Valid' o₁ (Ordnode.node rs rl rx rr) o₂
h : 3 * (size ll + size lr + 1) < size rl + size rr + 1
v : Valid' o₁ t ↑rx
e : size t = size ll + size lr + 1 + size rl
hr₁ : size rl ≤ delta * size rr
hr₂ : size rr ≤ delta * size rl
a✝¹ : 1 ≤ size t
a✝ : 1 ≤ size rr
⊢ size rr ≤ delta * size t

tactic: unfold delta at hr₂ ⊢
state_before: case H₂
α : Type u_1
inst✝ : Preorder α
o₁ : WithBot α
o₂ : WithTop α
ls : ℕ
ll : Ordnode α
lx : α
lr : Ordnode α
rs : ℕ
rl : Ordnode α
rx : α
rr t : Ordnode α
hl : Valid' o₁ (Ordnode.node ls ll lx lr) o₂
hr : Valid' o₁ (Ordnode.node rs rl rx rr) o₂
h : 3 * (size ll + size lr + 1) < size rl + size rr + 1
v : Valid' o₁ t ↑rx
e : size t = size ll + size lr + 1 + size rl
hr₁ : size rl ≤ delta * size rr
hr₂ : size rr ≤ delta * size rl
a✝¹ : 1 ≤ size t
a✝ : 1 ≤ size rr
⊢ size rr ≤ delta * (size ll + size lr + 1 + size rl)

tactic: linarith
state_before: case H₂
α : Type u_1
inst✝ : Preorder α
o₁ : WithBot α
o₂ : WithTop α
ls : ℕ
ll : Ordnode α
lx : α
lr : Ordnode α
rs : ℕ
rl : Ordnode α
rx : α
rr t : Ordnode α
hl : Valid' o₁ (Ordnode.node ls ll lx lr) o₂
hr : Valid' o₁ (Ordnode.node rs rl rx rr) o₂
h : 3 * (size ll + size lr + 1) < size rl + size rr + 1
v : Valid' o₁ t ↑rx
e : size t = size ll + size lr + 1 + size rl
hr₁ : size rl ≤ delta * size rr
hr₂ : size rr ≤ 3 * size rl
a✝¹ : 1 ≤ size t
a✝ : 1 ≤ size rr
⊢ size rr ≤ 3 * (size ll + size lr + 1 + size rl)