no goals
case nil
α : Type u_1
c : RBColor
n : Nat
cut : α → Ordering
t : RBNode α
⊢ DelProp (isBlack nil) (del cut nil) 0
exact ⟨_, .nil⟩
case black
α : Type u_1
c : RBColor
n✝ : Nat
cut : α → Ordering
t a : RBNode α
c₁✝ : RBColor
n : Nat
b : RBNode α
c₂✝ : RBColor
v✝ : α
ha : Balanced a c₁✝ n
hb : Balanced b c₂✝ n
iha : DelProp (isBlack a) (del cut a) n
ihb : DelProp (isBlack b) (del cut b) n
⊢ RedRed True (del cut (node black a v✝ b)) n
case black
α : Type u_1
c : RBColor
n✝ : Nat
cut : α → Ordering
t a : RBNode α
c₁✝ : RBColor
n : Nat
b : RBNode α
c₂✝ : RBColor
v✝ : α
ha : Balanced a c₁✝ n
hb : Balanced b c₂✝ n
iha : DelProp (isBlack a) (del cut a) n
ihb : DelProp (isBlack b) (del cut b) n
⊢ DelProp (isBlack (node black a v✝ b)) (del cut (node black a v✝ b)) (n + 1)
refine ⟨_, rfl, ?_⟩
case black
α : Type u_1
c : RBColor
n✝ : Nat
cut : α → Ordering
t a : RBNode α
c₁✝ : RBColor
n : Nat
b : RBNode α
c₂✝ : RBColor
v✝ : α
ha : Balanced a c₁✝ n
hb : Balanced b c₂✝ n
iha : DelProp (isBlack a) (del cut a) n
ihb : DelProp (isBlack b) (del cut b) n
⊢ RedRed True
    (match cut v✝ with
    | Ordering.lt =>
      match isBlack a with
      | black => balLeft (del cut a) v✝ b
      | red => node red (del cut a) v✝ b
    | Ordering.gt =>
      match isBlack b with
      | black => balRight a v✝ (del cut b)
      | red => node red a v✝ (del cut b)
    | Ordering.eq => append a b)
    n
case black
α : Type u_1
c : RBColor
n✝ : Nat
cut : α → Ordering
t a : RBNode α
c₁✝ : RBColor
n : Nat
b : RBNode α
c₂✝ : RBColor
v✝ : α
ha : Balanced a c₁✝ n
hb : Balanced b c₂✝ n
iha : DelProp (isBlack a) (del cut a) n
ihb : DelProp (isBlack b) (del cut b) n
⊢ RedRed True (del cut (node black a v✝ b)) n
unfold del
case black.h_1
α : Type u_1
c : RBColor
n✝ : Nat
cut : α → Ordering
t a : RBNode α
c₁✝ : RBColor
n : Nat
b : RBNode α
c₂✝ : RBColor
v✝ : α
ha : Balanced a c₁✝ n
hb : Balanced b c₂✝ n
iha : DelProp (isBlack a) (del cut a) n
ihb : DelProp (isBlack b) (del cut b) n
x✝ : Ordering
heq✝ : cut v✝ = Ordering.lt
⊢ RedRed True
    (match isBlack a with
    | black => balLeft (del cut a) v✝ b
    | red => node red (del cut a) v✝ b)
    n

case black.h_2
α : Type u_1
c : RBColor
n✝ : Nat
cut : α → Ordering
t a : RBNode α
c₁✝ : RBColor
n : Nat
b : RBNode α
c₂✝ : RBColor
v✝ : α
ha : Balanced a c₁✝ n
hb : Balanced b c₂✝ n
iha : DelProp (isBlack a) (del cut a) n
ihb : DelProp (isBlack b) (del cut b) n
x✝ : Ordering
heq✝ : cut v✝ = Ordering.gt
⊢ RedRed True
    (match isBlack b with
    | black => balRight a v✝ (del cut b)
    | red => node red a v✝ (del cut b))
    n

case black.h_3
α : Type u_1
c : RBColor
n✝ : Nat
cut : α → Ordering
t a : RBNode α
c₁✝ : RBColor
n : Nat
b : RBNode α
c₂✝ : RBColor
v✝ : α
ha : Balanced a c₁✝ n
hb : Balanced b c₂✝ n
iha : DelProp (isBlack a) (del cut a) n
ihb : DelProp (isBlack b) (del cut b) n
x✝ : Ordering
heq✝ : cut v✝ = Ordering.eq
⊢ RedRed True (append a b) n
case black
α : Type u_1
c : RBColor
n✝ : Nat
cut : α → Ordering
t a : RBNode α
c₁✝ : RBColor
n : Nat
b : RBNode α
c₂✝ : RBColor
v✝ : α
ha : Balanced a c₁✝ n
hb : Balanced b c₂✝ n
iha : DelProp (isBlack a) (del cut a) n
ihb : DelProp (isBlack b) (del cut b) n
⊢ RedRed True
    (match cut v✝ with
    | Ordering.lt =>
      match isBlack a with
      | black => balLeft (del cut a) v✝ b
      | red => node red (del cut a) v✝ b
    | Ordering.gt =>
      match isBlack b with
      | black => balRight a v✝ (del cut b)
      | red => node red a v✝ (del cut b)
    | Ordering.eq => append a b)
    n
split
no goals
case black.h_1
α : Type u_1
c : RBColor
n✝ : Nat
cut : α → Ordering
t a : RBNode α
c₁✝ : RBColor
n : Nat
b : RBNode α
c₂✝ : RBColor
v✝ : α
ha : Balanced a c₁✝ n
hb : Balanced b c₂✝ n
iha : DelProp (isBlack a) (del cut a) n
ihb : DelProp (isBlack b) (del cut b) n
x✝ : Ordering
heq✝ : cut v✝ = Ordering.lt
⊢ RedRed True
    (match isBlack a with
    | black => balLeft (del cut a) v✝ b
    | red => node red (del cut a) v✝ b)
    n
exact match a, n, iha with
| .nil, _, ⟨c, ha⟩ | .node red .., _, ⟨c, ha⟩ => .redred ⟨⟩ ha hb
| .node black .., _, ⟨n, rfl, ha⟩ => (hb.balLeft ha).imp fun _ => ⟨⟩
no goals
case black.h_2
α : Type u_1
c : RBColor
n✝ : Nat
cut : α → Ordering
t a : RBNode α
c₁✝ : RBColor
n : Nat
b : RBNode α
c₂✝ : RBColor
v✝ : α
ha : Balanced a c₁✝ n
hb : Balanced b c₂✝ n
iha : DelProp (isBlack a) (del cut a) n
ihb : DelProp (isBlack b) (del cut b) n
x✝ : Ordering
heq✝ : cut v✝ = Ordering.gt
⊢ RedRed True
    (match isBlack b with
    | black => balRight a v✝ (del cut b)
    | red => node red a v✝ (del cut b))
    n
exact match b, n, ihb with
| .nil, _, ⟨c, hb⟩ | .node .red .., _, ⟨c, hb⟩ => .redred ⟨⟩ ha hb
| .node black .., _, ⟨n, rfl, hb⟩ => (ha.balRight hb).imp fun _ => ⟨⟩
no goals
case black.h_3
α : Type u_1
c : RBColor
n✝ : Nat
cut : α → Ordering
t a : RBNode α
c₁✝ : RBColor
n : Nat
b : RBNode α
c₂✝ : RBColor
v✝ : α
ha : Balanced a c₁✝ n
hb : Balanced b c₂✝ n
iha : DelProp (isBlack a) (del cut a) n
ihb : DelProp (isBlack b) (del cut b) n
x✝ : Ordering
heq✝ : cut v✝ = Ordering.eq
⊢ RedRed True (append a b) n
exact (ha.append hb).imp fun _ => ⟨⟩
case red
α : Type u_1
c : RBColor
n✝ : Nat
cut : α → Ordering
t a : RBNode α
n : Nat
b : RBNode α
v✝ : α
ha : Balanced a black n
hb : Balanced b black n
iha : DelProp (isBlack a) (del cut a) n
ihb : DelProp (isBlack b) (del cut b) n
⊢ DelProp (isBlack (node red a v✝ b))
    (match cut v✝ with
    | Ordering.lt =>
      match isBlack a with
      | black => balLeft (del cut a) v✝ b
      | red => node red (del cut a) v✝ b
    | Ordering.gt =>
      match isBlack b with
      | black => balRight a v✝ (del cut b)
      | red => node red a v✝ (del cut b)
    | Ordering.eq => append a b)
    n
case red
α : Type u_1
c : RBColor
n✝ : Nat
cut : α → Ordering
t a : RBNode α
n : Nat
b : RBNode α
v✝ : α
ha : Balanced a black n
hb : Balanced b black n
iha : DelProp (isBlack a) (del cut a) n
ihb : DelProp (isBlack b) (del cut b) n
⊢ DelProp (isBlack (node red a v✝ b)) (del cut (node red a v✝ b)) n
unfold del
case red.h_1
α : Type u_1
c : RBColor
n✝ : Nat
cut : α → Ordering
t a : RBNode α
n : Nat
b : RBNode α
v✝ : α
ha : Balanced a black n
hb : Balanced b black n
iha : DelProp (isBlack a) (del cut a) n
ihb : DelProp (isBlack b) (del cut b) n
x✝ : Ordering
heq✝ : cut v✝ = Ordering.lt
⊢ DelProp (isBlack (node red a v✝ b))
    (match isBlack a with
    | black => balLeft (del cut a) v✝ b
    | red => node red (del cut a) v✝ b)
    n

case red.h_2
α : Type u_1
c : RBColor
n✝ : Nat
cut : α → Ordering
t a : RBNode α
n : Nat
b : RBNode α
v✝ : α
ha : Balanced a black n
hb : Balanced b black n
iha : DelProp (isBlack a) (del cut a) n
ihb : DelProp (isBlack b) (del cut b) n
x✝ : Ordering
heq✝ : cut v✝ = Ordering.gt
⊢ DelProp (isBlack (node red a v✝ b))
    (match isBlack b with
    | black => balRight a v✝ (del cut b)
    | red => node red a v✝ (del cut b))
    n

case red.h_3
α : Type u_1
c : RBColor
n✝ : Nat
cut : α → Ordering
t a : RBNode α
n : Nat
b : RBNode α
v✝ : α
ha : Balanced a black n
hb : Balanced b black n
iha : DelProp (isBlack a) (del cut a) n
ihb : DelProp (isBlack b) (del cut b) n
x✝ : Ordering
heq✝ : cut v✝ = Ordering.eq
⊢ DelProp (isBlack (node red a v✝ b)) (append a b) n
case red
α : Type u_1
c : RBColor
n✝ : Nat
cut : α → Ordering
t a : RBNode α
n : Nat
b : RBNode α
v✝ : α
ha : Balanced a black n
hb : Balanced b black n
iha : DelProp (isBlack a) (del cut a) n
ihb : DelProp (isBlack b) (del cut b) n
⊢ DelProp (isBlack (node red a v✝ b))
    (match cut v✝ with
    | Ordering.lt =>
      match isBlack a with
      | black => balLeft (del cut a) v✝ b
      | red => node red (del cut a) v✝ b
    | Ordering.gt =>
      match isBlack b with
      | black => balRight a v✝ (del cut b)
      | red => node red a v✝ (del cut b)
    | Ordering.eq => append a b)
    n
split
no goals
case red.h_1
α : Type u_1
c : RBColor
n✝ : Nat
cut : α → Ordering
t a : RBNode α
n : Nat
b : RBNode α
v✝ : α
ha : Balanced a black n
hb : Balanced b black n
iha : DelProp (isBlack a) (del cut a) n
ihb : DelProp (isBlack b) (del cut b) n
x✝ : Ordering
heq✝ : cut v✝ = Ordering.lt
⊢ DelProp (isBlack (node red a v✝ b))
    (match isBlack a with
    | black => balLeft (del cut a) v✝ b
    | red => node red (del cut a) v✝ b)
    n
exact match a, n, iha with
| .nil, _, _ => ⟨_, .red ha hb⟩
| .node black .., _, ⟨n, rfl, ha⟩ => (hb.balLeft ha).of_false (fun.)
no goals
case red.h_2
α : Type u_1
c : RBColor
n✝ : Nat
cut : α → Ordering
t a : RBNode α
n : Nat
b : RBNode α
v✝ : α
ha : Balanced a black n
hb : Balanced b black n
iha : DelProp (isBlack a) (del cut a) n
ihb : DelProp (isBlack b) (del cut b) n
x✝ : Ordering
heq✝ : cut v✝ = Ordering.gt
⊢ DelProp (isBlack (node red a v✝ b))
    (match isBlack b with
    | black => balRight a v✝ (del cut b)
    | red => node red a v✝ (del cut b))
    n
exact match b, n, ihb with
| .nil, _, _ => ⟨_, .red ha hb⟩
| .node black .., _, ⟨n, rfl, hb⟩ => (ha.balRight hb).of_false (fun.)