α : Type u_1
cut : α → Ordering
path : Path α
t' : RBNode α
path' : Path α
t : RBNode α
⊢ zoom cut t path = (t', path') →
    del path
        (match t with
        | nil => nil
        | node c a y b =>
          match cut y with
          | Ordering.lt =>
            match isBlack a with
            | black => balLeft (RBNode.del cut a) y b
            | red => node red (RBNode.del cut a) y b
          | Ordering.gt =>
            match isBlack b with
            | black => balRight a y (RBNode.del cut b)
            | red => node red a y (RBNode.del cut b)
          | Ordering.eq => append a b)
        (match t with
        | node c l v r => c
        | x => red) =
      del path' (delRoot t')
        (match t' with
        | node c l v r => c
        | x => red)
α : Type u_1
cut : α → Ordering
path : Path α
t' : RBNode α
path' : Path α
t : RBNode α
⊢ zoom cut t path = (t', path') →
    del path (RBNode.del cut t)
        (match t with
        | node c l v r => c
        | x => red) =
      del path' (delRoot t')
        (match t' with
        | node c l v r => c
        | x => red)
unfold RBNode.del
case h_1
α : Type u_1
cut : α → Ordering
path : Path α
t' : RBNode α
path' : Path α
x✝ : RBNode α
⊢ nil = t' →
    path = path' →
      del path nil red =
        del path' (delRoot t')
          (match t' with
          | node c l v r => c
          | x => red)

case h_2
α : Type u_1
cut : α → Ordering
path : Path α
t' : RBNode α
path' : Path α
x✝ : RBNode α
a✝³ : RBColor
a✝² : RBNode α
a✝¹ : α
a✝ : RBNode α
⊢ (match cut a✝¹ with
      | Ordering.lt => zoom cut a✝² (left a✝³ path a✝¹ a✝)
      | Ordering.gt => zoom cut a✝ (right a✝³ a✝² a✝¹ path)
      | Ordering.eq => (node a✝³ a✝² a✝¹ a✝, path)) =
      (t', path') →
    del path
        (match cut a✝¹ with
        | Ordering.lt =>
          match isBlack a✝² with
          | black => balLeft (RBNode.del cut a✝²) a✝¹ a✝
          | red => node red (RBNode.del cut a✝²) a✝¹ a✝
        | Ordering.gt =>
          match isBlack a✝ with
          | black => balRight a✝² a✝¹ (RBNode.del cut a✝)
          | red => node red a✝² a✝¹ (RBNode.del cut a✝)
        | Ordering.eq => append a✝² a✝)
        a✝³ =
      del path' (delRoot t')
        (match t' with
        | node c l v r => c
        | x => red)
α : Type u_1
cut : α → Ordering
path : Path α
t' : RBNode α
path' : Path α
t : RBNode α
⊢ zoom cut t path = (t', path') →
    del path
        (match t with
        | nil => nil
        | node c a y b =>
          match cut y with
          | Ordering.lt =>
            match isBlack a with
            | black => balLeft (RBNode.del cut a) y b
            | red => node red (RBNode.del cut a) y b
          | Ordering.gt =>
            match isBlack b with
            | black => balRight a y (RBNode.del cut b)
            | red => node red a y (RBNode.del cut b)
          | Ordering.eq => append a b)
        (match t with
        | node c l v r => c
        | x => red) =
      del path' (delRoot t')
        (match t' with
        | node c l v r => c
        | x => red)
split <;> simp [zoom]
no goals
case h_1
α : Type u_1
cut : α → Ordering
path : Path α
t' : RBNode α
path' : Path α
x✝ : RBNode α
⊢ nil = t' →
    path = path' →
      del path nil red =
        del path' (delRoot t')
          (match t' with
          | node c l v r => c
          | x => red)
intro | rfl, rfl => rfl
no goals
α : Type u_1
cut : α → Ordering
path : Path α
t' : RBNode α
path' : Path α
x✝² : RBNode α
x✝¹ : nil = t'
x✝ : path = path'
⊢ del path nil red =
    del path (delRoot nil)
      (match nil with
      | node c l v r => c
      | x => red)
rfl
case h_1
α : Type u_1
cut : α → Ordering
path : Path α
t' : RBNode α
path' : Path α
x✝¹ : RBNode α
c : RBColor
a : RBNode α
y : α
b : RBNode α
x✝ : Ordering
heq✝ : cut y = Ordering.lt
⊢ zoom cut a (left c path y b) = (t', path') →
    del path
        (match isBlack a with
        | black => balLeft (RBNode.del cut a) y b
        | red => node red (RBNode.del cut a) y b)
        c =
      del path' (delRoot t')
        (match t' with
        | node c l v r => c
        | x => red)

case h_2
α : Type u_1
cut : α → Ordering
path : Path α
t' : RBNode α
path' : Path α
x✝¹ : RBNode α
c : RBColor
a : RBNode α
y : α
b : RBNode α
x✝ : Ordering
heq✝ : cut y = Ordering.gt
⊢ zoom cut b (right c a y path) = (t', path') →
    del path
        (match isBlack b with
        | black => balRight a y (RBNode.del cut b)
        | red => node red a y (RBNode.del cut b))
        c =
      del path' (delRoot t')
        (match t' with
        | node c l v r => c
        | x => red)

case h_3
α : Type u_1
cut : α → Ordering
path : Path α
t' : RBNode α
path' : Path α
x✝¹ : RBNode α
c : RBColor
a : RBNode α
y : α
b : RBNode α
x✝ : Ordering
heq✝ : cut y = Ordering.eq
⊢ (node c a y b, path) = (t', path') →
    del path (append a b) c =
      del path' (delRoot t')
        (match t' with
        | node c l v r => c
        | x => red)
α : Type u_1
cut : α → Ordering
path : Path α
t' : RBNode α
path' : Path α
x✝ : RBNode α
c : RBColor
a : RBNode α
y : α
b : RBNode α
⊢ (match cut y with
      | Ordering.lt => zoom cut a (left c path y b)
      | Ordering.gt => zoom cut b (right c a y path)
      | Ordering.eq => (node c a y b, path)) =
      (t', path') →
    del path
        (match cut y with
        | Ordering.lt =>
          match isBlack a with
          | black => balLeft (RBNode.del cut a) y b
          | red => node red (RBNode.del cut a) y b
        | Ordering.gt =>
          match isBlack b with
          | black => balRight a y (RBNode.del cut b)
          | red => node red a y (RBNode.del cut b)
        | Ordering.eq => append a b)
        c =
      del path' (delRoot t')
        (match t' with
        | node c l v r => c
        | x => red)
split
case h_1
α : Type u_1
cut : α → Ordering
path : Path α
t' : RBNode α
path' : Path α
x✝¹ : RBNode α
c : RBColor
a : RBNode α
y : α
b : RBNode α
x✝ : Ordering
heq✝ : cut y = Ordering.lt
IH :
  ∀ (cut : α → Ordering) (path : Path α) (t' : RBNode α) (path' : Path α),
    zoom cut a path = (t', path') →
      del path (RBNode.del cut a)
          (match a with
          | node c l v r => c
          | x => red) =
        del path' (delRoot t')
          (match t' with
          | node c l v r => c
          | x => red)
⊢ zoom cut a (left c path y b) = (t', path') →
    del path
        (match isBlack a with
        | black => balLeft (RBNode.del cut a) y b
        | red => node red (RBNode.del cut a) y b)
        c =
      del path' (delRoot t')
        (match t' with
        | node c l v r => c
        | x => red)
case h_1
α : Type u_1
cut : α → Ordering
path : Path α
t' : RBNode α
path' : Path α
x✝¹ : RBNode α
c : RBColor
a : RBNode α
y : α
b : RBNode α
x✝ : Ordering
heq✝ : cut y = Ordering.lt
⊢ zoom cut a (left c path y b) = (t', path') →
    del path
        (match isBlack a with
        | black => balLeft (RBNode.del cut a) y b
        | red => node red (RBNode.del cut a) y b)
        c =
      del path' (delRoot t')
        (match t' with
        | node c l v r => c
        | x => red)
have IH := @zoom_del (t := a)
no goals
case h_1
α : Type u_1
cut : α → Ordering
path : Path α
t' : RBNode α
path' : Path α
x✝¹ : RBNode α
c : RBColor
a : RBNode α
y : α
b : RBNode α
x✝ : Ordering
heq✝ : cut y = Ordering.lt
IH :
  ∀ (cut : α → Ordering) (path : Path α) (t' : RBNode α) (path' : Path α),
    zoom cut a path = (t', path') →
      del path (RBNode.del cut a)
          (match a with
          | node c l v r => c
          | x => red) =
        del path' (delRoot t')
          (match t' with
          | node c l v r => c
          | x => red)
⊢ zoom cut a (left c path y b) = (t', path') →
    del path
        (match isBlack a with
        | black => balLeft (RBNode.del cut a) y b
        | red => node red (RBNode.del cut a) y b)
        c =
      del path' (delRoot t')
        (match t' with
        | node c l v r => c
        | x => red)
match a with
| nil => intro | rfl => rfl
| node black .. | node red .. => apply IH
no goals
α : Type u_1
cut : α → Ordering
path : Path α
t' : RBNode α
path' : Path α
x✝¹ : RBNode α
c : RBColor
a : RBNode α
y : α
b : RBNode α
x✝ : Ordering
heq✝ : cut y = Ordering.lt
IH :
  ∀ (cut : α → Ordering) (path : Path α) (t' : RBNode α) (path' : Path α),
    zoom cut nil path = (t', path') →
      del path (RBNode.del cut nil)
          (match nil with
          | node c l v r => c
          | x => red) =
        del path' (delRoot t')
          (match t' with
          | node c l v r => c
          | x => red)
⊢ zoom cut nil (left c path y b) = (t', path') →
    del path
        (match isBlack nil with
        | black => balLeft (RBNode.del cut nil) y b
        | red => node red (RBNode.del cut nil) y b)
        c =
      del path' (delRoot t')
        (match t' with
        | node c l v r => c
        | x => red)
intro | rfl => rfl
no goals
α : Type u_1
cut : α → Ordering
path : Path α
t' : RBNode α
path' : Path α
x✝² : RBNode α
c : RBColor
a : RBNode α
y : α
b : RBNode α
x✝¹ : Ordering
heq✝ : cut y = Ordering.lt
IH :
  ∀ (cut : α → Ordering) (path : Path α) (t' : RBNode α) (path' : Path α),
    zoom cut nil path = (t', path') →
      del path (RBNode.del cut nil)
          (match nil with
          | node c l v r => c
          | x => red) =
        del path' (delRoot t')
          (match t' with
          | node c l v r => c
          | x => red)
x✝ : zoom cut nil (left c path y b) = (t', path')
⊢ del path
      (match isBlack nil with
      | black => balLeft (RBNode.del cut nil) y b
      | red => node red (RBNode.del cut nil) y b)
      c =
    del (left c path y b) (delRoot nil)
      (match nil with
      | node c l v r => c
      | x => red)
rfl
no goals
α : Type u_1
cut : α → Ordering
path : Path α
t' : RBNode α
path' : Path α
x✝¹ : RBNode α
c : RBColor
a : RBNode α
y : α
b : RBNode α
x✝ : Ordering
heq✝ : cut y = Ordering.lt
l✝ : RBNode α
v✝ : α
r✝ : RBNode α
IH :
  ∀ (cut : α → Ordering) (path : Path α) (t' : RBNode α) (path' : Path α),
    zoom cut (node red l✝ v✝ r✝) path = (t', path') →
      del path (RBNode.del cut (node red l✝ v✝ r✝))
          (match node red l✝ v✝ r✝ with
          | node c l v r => c
          | x => red) =
        del path' (delRoot t')
          (match t' with
          | node c l v r => c
          | x => red)
⊢ zoom cut (node red l✝ v✝ r✝) (left c path y b) = (t', path') →
    del path
        (match isBlack (node red l✝ v✝ r✝) with
        | black => balLeft (RBNode.del cut (node red l✝ v✝ r✝)) y b
        | red => node red (RBNode.del cut (node red l✝ v✝ r✝)) y b)
        c =
      del path' (delRoot t')
        (match t' with
        | node c l v r => c
        | x => red)
apply IH
case h_2
α : Type u_1
cut : α → Ordering
path : Path α
t' : RBNode α
path' : Path α
x✝¹ : RBNode α
c : RBColor
a : RBNode α
y : α
b : RBNode α
x✝ : Ordering
heq✝ : cut y = Ordering.gt
IH :
  ∀ (cut : α → Ordering) (path : Path α) (t' : RBNode α) (path' : Path α),
    zoom cut b path = (t', path') →
      del path (RBNode.del cut b)
          (match b with
          | node c l v r => c
          | x => red) =
        del path' (delRoot t')
          (match t' with
          | node c l v r => c
          | x => red)
⊢ zoom cut b (right c a y path) = (t', path') →
    del path
        (match isBlack b with
        | black => balRight a y (RBNode.del cut b)
        | red => node red a y (RBNode.del cut b))
        c =
      del path' (delRoot t')
        (match t' with
        | node c l v r => c
        | x => red)
case h_2
α : Type u_1
cut : α → Ordering
path : Path α
t' : RBNode α
path' : Path α
x✝¹ : RBNode α
c : RBColor
a : RBNode α
y : α
b : RBNode α
x✝ : Ordering
heq✝ : cut y = Ordering.gt
⊢ zoom cut b (right c a y path) = (t', path') →
    del path
        (match isBlack b with
        | black => balRight a y (RBNode.del cut b)
        | red => node red a y (RBNode.del cut b))
        c =
      del path' (delRoot t')
        (match t' with
        | node c l v r => c
        | x => red)
have IH := @zoom_del (t := b)
no goals
case h_2
α : Type u_1
cut : α → Ordering
path : Path α
t' : RBNode α
path' : Path α
x✝¹ : RBNode α
c : RBColor
a : RBNode α
y : α
b : RBNode α
x✝ : Ordering
heq✝ : cut y = Ordering.gt
IH :
  ∀ (cut : α → Ordering) (path : Path α) (t' : RBNode α) (path' : Path α),
    zoom cut b path = (t', path') →
      del path (RBNode.del cut b)
          (match b with
          | node c l v r => c
          | x => red) =
        del path' (delRoot t')
          (match t' with
          | node c l v r => c
          | x => red)
⊢ zoom cut b (right c a y path) = (t', path') →
    del path
        (match isBlack b with
        | black => balRight a y (RBNode.del cut b)
        | red => node red a y (RBNode.del cut b))
        c =
      del path' (delRoot t')
        (match t' with
        | node c l v r => c
        | x => red)
match b with
| nil => intro | rfl => rfl
| node black .. | node red .. => apply IH
no goals
α : Type u_1
cut : α → Ordering
path : Path α
t' : RBNode α
path' : Path α
x✝¹ : RBNode α
c : RBColor
a : RBNode α
y : α
b : RBNode α
x✝ : Ordering
heq✝ : cut y = Ordering.gt
IH :
  ∀ (cut : α → Ordering) (path : Path α) (t' : RBNode α) (path' : Path α),
    zoom cut nil path = (t', path') →
      del path (RBNode.del cut nil)
          (match nil with
          | node c l v r => c
          | x => red) =
        del path' (delRoot t')
          (match t' with
          | node c l v r => c
          | x => red)
⊢ zoom cut nil (right c a y path) = (t', path') →
    del path
        (match isBlack nil with
        | black => balRight a y (RBNode.del cut nil)
        | red => node red a y (RBNode.del cut nil))
        c =
      del path' (delRoot t')
        (match t' with
        | node c l v r => c
        | x => red)
intro | rfl => rfl
no goals
α : Type u_1
cut : α → Ordering
path : Path α
t' : RBNode α
path' : Path α
x✝² : RBNode α
c : RBColor
a : RBNode α
y : α
b : RBNode α
x✝¹ : Ordering
heq✝ : cut y = Ordering.gt
IH :
  ∀ (cut : α → Ordering) (path : Path α) (t' : RBNode α) (path' : Path α),
    zoom cut nil path = (t', path') →
      del path (RBNode.del cut nil)
          (match nil with
          | node c l v r => c
          | x => red) =
        del path' (delRoot t')
          (match t' with
          | node c l v r => c
          | x => red)
x✝ : zoom cut nil (right c a y path) = (t', path')
⊢ del path
      (match isBlack nil with
      | black => balRight a y (RBNode.del cut nil)
      | red => node red a y (RBNode.del cut nil))
      c =
    del (right c a y path) (delRoot nil)
      (match nil with
      | node c l v r => c
      | x => red)
rfl
no goals
α : Type u_1
cut : α → Ordering
path : Path α
t' : RBNode α
path' : Path α
x✝¹ : RBNode α
c : RBColor
a : RBNode α
y : α
b : RBNode α
x✝ : Ordering
heq✝ : cut y = Ordering.gt
l✝ : RBNode α
v✝ : α
r✝ : RBNode α
IH :
  ∀ (cut : α → Ordering) (path : Path α) (t' : RBNode α) (path' : Path α),
    zoom cut (node red l✝ v✝ r✝) path = (t', path') →
      del path (RBNode.del cut (node red l✝ v✝ r✝))
          (match node red l✝ v✝ r✝ with
          | node c l v r => c
          | x => red) =
        del path' (delRoot t')
          (match t' with
          | node c l v r => c
          | x => red)
⊢ zoom cut (node red l✝ v✝ r✝) (right c a y path) = (t', path') →
    del path
        (match isBlack (node red l✝ v✝ r✝) with
        | black => balRight a y (RBNode.del cut (node red l✝ v✝ r✝))
        | red => node red a y (RBNode.del cut (node red l✝ v✝ r✝)))
        c =
      del path' (delRoot t')
        (match t' with
        | node c l v r => c
        | x => red)
apply IH
no goals
case h_3
α : Type u_1
cut : α → Ordering
path : Path α
t' : RBNode α
path' : Path α
x✝¹ : RBNode α
c : RBColor
a : RBNode α
y : α
b : RBNode α
x✝ : Ordering
heq✝ : cut y = Ordering.eq
⊢ (node c a y b, path) = (t', path') →
    del path (append a b) c =
      del path' (delRoot t')
        (match t' with
        | node c l v r => c
        | x => red)
intro | rfl => rfl
no goals
α : Type u_1
cut : α → Ordering
path : Path α
t' : RBNode α
path' : Path α
x✝² : RBNode α
c : RBColor
a : RBNode α
y : α
b : RBNode α
x✝¹ : Ordering
heq✝ : cut y = Ordering.eq
x✝ : (node c a y b, path) = (t', path')
⊢ del path (append a b) c =
    del path (delRoot (node c a y b))
      (match node c a y b with
      | node c l v r => c
      | x => red)
rfl