α : 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)
α : 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))
unfold ins
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)

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))

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)
α : 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)
split
no goals
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)
next h => exact ⟨ay.ins ⟨h⟩, yb, ha.ins, hb⟩
no goals
α : 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)
exact ⟨ay.ins ⟨h⟩, yb, ha.ins, hb⟩
no goals
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))
next h => exact ⟨ay, yb.ins ⟨OrientedCmp.cmp_eq_gt.1 h⟩, ha, hb.ins⟩
no goals
α : 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))
exact ⟨ay, yb.ins ⟨OrientedCmp.cmp_eq_gt.1 h⟩, ha, hb.ins⟩
no goals
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)
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⟩)
no goals
α : 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)
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⟩)
α : 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)
α : 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))
unfold ins
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)

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))

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)
α : 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)
split
no goals
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)
next h => exact ha.ins.balance1 (ay.ins ⟨h⟩) yb hb
no goals
α : 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)
exact ha.ins.balance1 (ay.ins ⟨h⟩) yb hb
no goals
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))
next h => exact ha.balance2 ay (yb.ins ⟨OrientedCmp.cmp_eq_gt.1 h⟩) hb.ins
no goals
α : 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))
exact ha.balance2 ay (yb.ins ⟨OrientedCmp.cmp_eq_gt.1 h⟩) hb.ins
no goals
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)
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⟩)
no goals
α : 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)
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⟩)