Theorem: Std.RBNode.Ordered.ins
File: Std/Data/RBMap/WF.lean

tactic: unfold ins
state_before: α : Type u_1
cmp : α → α → Ordering
x : α
a : RBNode α
y : α
b : RBNode α
ay : All (fun x => cmpLT cmp x y) a
yb : All (fun x => cmpLT cmp y x) b
ha : Ordered cmp a
hb : Ordered cmp b
⊢ Ordered cmp (ins cmp x (node red a y b))

tactic: split
state_before: α : Type u_1
cmp : α → α → Ordering
x : α
a : RBNode α
y : α
b : RBNode α
ay : All (fun x => cmpLT cmp x y) a
yb : All (fun x => cmpLT cmp y x) b
ha : Ordered cmp a
hb : Ordered cmp b
⊢ Ordered cmp
    (match cmp x y with
    | Ordering.lt => node red (ins cmp x a) y b
    | Ordering.gt => node red a y (ins cmp x b)
    | Ordering.eq => node red a x b)

tactic: next h => exact ⟨ay.ins ⟨h⟩, yb, ha.ins, hb⟩
state_before: case h_1
α : Type u_1
cmp : α → α → Ordering
x : α
a : RBNode α
y : α
b : RBNode α
ay : All (fun x => cmpLT cmp x y) a
yb : All (fun x => cmpLT cmp y x) b
ha : Ordered cmp a
hb : Ordered cmp b
x✝ : Ordering
heq✝ : cmp x y = Ordering.lt
⊢ Ordered cmp (node red (ins cmp x a) y b)

tactic: exact ⟨ay.ins ⟨h⟩, yb, ha.ins, hb⟩
state_before: α : Type u_1
cmp : α → α → Ordering
x : α
a : RBNode α
y : α
b : RBNode α
ay : All (fun x => cmpLT cmp x y) a
yb : All (fun x => cmpLT cmp y x) b
ha : Ordered cmp a
hb : Ordered cmp b
x✝ : Ordering
h : cmp x y = Ordering.lt
⊢ Ordered cmp (node red (ins cmp x a) y b)

tactic: next h => exact ⟨ay, yb.ins ⟨OrientedCmp.cmp_eq_gt.1 h⟩, ha, hb.ins⟩
state_before: case h_2
α : Type u_1
cmp : α → α → Ordering
x : α
a : RBNode α
y : α
b : RBNode α
ay : All (fun x => cmpLT cmp x y) a
yb : All (fun x => cmpLT cmp y x) b
ha : Ordered cmp a
hb : Ordered cmp b
x✝ : Ordering
heq✝ : cmp x y = Ordering.gt
⊢ Ordered cmp (node red a y (ins cmp x b))

tactic: exact ⟨ay, yb.ins ⟨OrientedCmp.cmp_eq_gt.1 h⟩, ha, hb.ins⟩
state_before: α : Type u_1
cmp : α → α → Ordering
x : α
a : RBNode α
y : α
b : RBNode α
ay : All (fun x => cmpLT cmp x y) a
yb : All (fun x => cmpLT cmp y x) b
ha : Ordered cmp a
hb : Ordered cmp b
x✝ : Ordering
h : cmp x y = Ordering.gt
⊢ Ordered cmp (node red a y (ins cmp x b))

tactic: next h => exact (⟨
  ay.imp fun ⟨h'⟩ => ⟨(TransCmp.cmp_congr_right h).trans h'⟩,
  yb.imp fun ⟨h'⟩ => ⟨(TransCmp.cmp_congr_left h).trans h'⟩, ha, hb⟩)
state_before: case h_3
α : Type u_1
cmp : α → α → Ordering
x : α
a : RBNode α
y : α
b : RBNode α
ay : All (fun x => cmpLT cmp x y) a
yb : All (fun x => cmpLT cmp y x) b
ha : Ordered cmp a
hb : Ordered cmp b
x✝ : Ordering
heq✝ : cmp x y = Ordering.eq
⊢ Ordered cmp (node red a x b)

tactic: exact (⟨
ay.imp fun ⟨h'⟩ => ⟨(TransCmp.cmp_congr_right h).trans h'⟩,
yb.imp fun ⟨h'⟩ => ⟨(TransCmp.cmp_congr_left h).trans h'⟩, ha, hb⟩)
state_before: α : Type u_1
cmp : α → α → Ordering
x : α
a : RBNode α
y : α
b : RBNode α
ay : All (fun x => cmpLT cmp x y) a
yb : All (fun x => cmpLT cmp y x) b
ha : Ordered cmp a
hb : Ordered cmp b
x✝ : Ordering
h : cmp x y = Ordering.eq
⊢ Ordered cmp (node red a x b)

tactic: unfold ins
state_before: α : Type u_1
cmp : α → α → Ordering
x : α
a : RBNode α
y : α
b : RBNode α
ay : All (fun x => cmpLT cmp x y) a
yb : All (fun x => cmpLT cmp y x) b
ha : Ordered cmp a
hb : Ordered cmp b
⊢ Ordered cmp (ins cmp x (node black a y b))

tactic: split
state_before: α : Type u_1
cmp : α → α → Ordering
x : α
a : RBNode α
y : α
b : RBNode α
ay : All (fun x => cmpLT cmp x y) a
yb : All (fun x => cmpLT cmp y x) b
ha : Ordered cmp a
hb : Ordered cmp b
⊢ Ordered cmp
    (match cmp x y with
    | Ordering.lt => balance1 (ins cmp x a) y b
    | Ordering.gt => balance2 a y (ins cmp x b)
    | Ordering.eq => node black a x b)

tactic: next h => exact ha.ins.balance1 (ay.ins ⟨h⟩) yb hb
state_before: case h_1
α : Type u_1
cmp : α → α → Ordering
x : α
a : RBNode α
y : α
b : RBNode α
ay : All (fun x => cmpLT cmp x y) a
yb : All (fun x => cmpLT cmp y x) b
ha : Ordered cmp a
hb : Ordered cmp b
x✝ : Ordering
heq✝ : cmp x y = Ordering.lt
⊢ Ordered cmp (balance1 (ins cmp x a) y b)

tactic: exact ha.ins.balance1 (ay.ins ⟨h⟩) yb hb
state_before: α : Type u_1
cmp : α → α → Ordering
x : α
a : RBNode α
y : α
b : RBNode α
ay : All (fun x => cmpLT cmp x y) a
yb : All (fun x => cmpLT cmp y x) b
ha : Ordered cmp a
hb : Ordered cmp b
x✝ : Ordering
h : cmp x y = Ordering.lt
⊢ Ordered cmp (balance1 (ins cmp x a) y b)

tactic: next h => exact ha.balance2 ay (yb.ins ⟨OrientedCmp.cmp_eq_gt.1 h⟩) hb.ins
state_before: case h_2
α : Type u_1
cmp : α → α → Ordering
x : α
a : RBNode α
y : α
b : RBNode α
ay : All (fun x => cmpLT cmp x y) a
yb : All (fun x => cmpLT cmp y x) b
ha : Ordered cmp a
hb : Ordered cmp b
x✝ : Ordering
heq✝ : cmp x y = Ordering.gt
⊢ Ordered cmp (balance2 a y (ins cmp x b))

tactic: exact ha.balance2 ay (yb.ins ⟨OrientedCmp.cmp_eq_gt.1 h⟩) hb.ins
state_before: α : Type u_1
cmp : α → α → Ordering
x : α
a : RBNode α
y : α
b : RBNode α
ay : All (fun x => cmpLT cmp x y) a
yb : All (fun x => cmpLT cmp y x) b
ha : Ordered cmp a
hb : Ordered cmp b
x✝ : Ordering
h : cmp x y = Ordering.gt
⊢ Ordered cmp (balance2 a y (ins cmp x b))

tactic: next h => exact (⟨
  ay.imp fun ⟨h'⟩ => ⟨(TransCmp.cmp_congr_right h).trans h'⟩,
  yb.imp fun ⟨h'⟩ => ⟨(TransCmp.cmp_congr_left h).trans h'⟩, ha, hb⟩)
state_before: case h_3
α : Type u_1
cmp : α → α → Ordering
x : α
a : RBNode α
y : α
b : RBNode α
ay : All (fun x => cmpLT cmp x y) a
yb : All (fun x => cmpLT cmp y x) b
ha : Ordered cmp a
hb : Ordered cmp b
x✝ : Ordering
heq✝ : cmp x y = Ordering.eq
⊢ Ordered cmp (node black a x b)

tactic: exact (⟨
ay.imp fun ⟨h'⟩ => ⟨(TransCmp.cmp_congr_right h).trans h'⟩,
yb.imp fun ⟨h'⟩ => ⟨(TransCmp.cmp_congr_left h).trans h'⟩, ha, hb⟩)
state_before: α : Type u_1
cmp : α → α → Ordering
x : α
a : RBNode α
y : α
b : RBNode α
ay : All (fun x => cmpLT cmp x y) a
yb : All (fun x => cmpLT cmp y x) b
ha : Ordered cmp a
hb : Ordered cmp b
x✝ : Ordering
h : cmp x y = Ordering.eq
⊢ Ordered cmp (node black a x b)