Definition is_red_or_empty t :=
  match t with T Black _ _ _ => False | _ => True end.Definition is_black t :=
  match t with T Black _ _ _ => True | _ => False end.

(* Specifications: *)
Lemma append_shape_aux: forall sz tl tr, size tl + size tr < sz -> (forall n, is_redblack tl Black n -> is_redblack tr Black n -> infrared (append (tl,tr)) n) /\ (forall n, is_redblack tl Red n -> is_redblack tr Red n -> is_redblack (append (tl,tr)) Black n).
Lemma infrared_append: forall tl tr n, is_redblack tl Black n -> is_redblack tr Black n -> infrared (append (tl,tr)) n.
Lemma append_is_redblack: forall tl tr n, is_redblack tl Red n -> is_redblack tr Red n -> is_redblack (append (tl,tr)) Black n.
Lemma balance'_shape2: forall n tl k tr, is_redblack tl Black n -> is_redblack tr Black n -> is_redblack (balance' tl k tr) Red (S n).
Lemma del_shape: forall x t, (forall n, is_redblack t Red (S n) -> is_black t -> infrared (del x t) n) /\ (forall n, is_redblack t Black n -> is_red_or_empty t -> is_redblack (del x t) Black n).
Lemma delete_is_redblack: forall x t n, is_redblack t Black n -> exists n', is_redblack (delete x t) Red n'.
Lemma interp_balance': forall tl k tr x, interp (balance' tl k tr) x <-> K.eq x k \/ interp tl x \/ interp tr x.