(* Take two covers an substitute the elements of one by the element of the other *)
Inductive subst_pred :
list (btree A) -> list (btree A) -> btree A -> btree A -> Prop :=
  | subst_pred_id :
      forall (t1 t2 : btree A) (l1 l2 : list (btree A)),
      subst_pred (t1 :: nil) (t2 :: nil) t1 t2
  | subst_pred_node :
      forall (t1 t2 t3 t4 : btree A) (l1 l2 l3 l4 l5 l6 : list (btree A)),
      subst_pred l1 l2 t1 t2 ->
      subst_pred l3 l4 t3 t4 ->
      subst_pred (l1 ++ l3) (l2 ++ l4) (node t1 t3) (node t2 t4).(* Take two covers an substitute the elements of one by the element of the other *)
Inductive subst_pred :
list (btree A) -> list (btree A) -> btree A -> btree A -> Prop :=
  | subst_pred_id :
      forall (t1 t2 : btree A) (l1 l2 : list (btree A)),
      subst_pred (t1 :: nil) (t2 :: nil) t1 t2
  | subst_pred_node :
      forall (t1 t2 t3 t4 : btree A) (l1 l2 l3 l4 l5 l6 : list (btree A)),
      subst_pred l1 l2 t1 t2 ->
      subst_pred l3 l4 t3 t4 ->
      subst_pred (l1 ++ l3) (l2 ++ l4) (node t1 t3) (node t2 t4).(* Take two covers an substitute the elements of one by the element of the other *)
Inductive subst_pred :
list (btree A) -> list (btree A) -> btree A -> btree A -> Prop :=
  | subst_pred_id :
      forall (t1 t2 : btree A) (l1 l2 : list (btree A)),
      subst_pred (t1 :: nil) (t2 :: nil) t1 t2
  | subst_pred_node :
      forall (t1 t2 t3 t4 : btree A) (l1 l2 l3 l4 l5 l6 : list (btree A)),
      subst_pred l1 l2 t1 t2 ->
      subst_pred l3 l4 t3 t4 ->
      subst_pred (l1 ++ l3) (l2 ++ l4) (node t1 t3) (node t2 t4).

(* Specifications: *)
Theorem subst_pred_ordered_cover_l : forall (t1 t2 : btree A) (l1 l2 : list (btree A)), subst_pred l1 l2 t1 t2 -> ordered_cover l1 t1.
Theorem subst_pred_ordered_cover_r : forall (t1 t2 : btree A) (l1 l2 : list (btree A)), subst_pred l1 l2 t1 t2 -> ordered_cover l2 t2.
Theorem subst_pred_length : forall (t1 t2 : btree A) (l1 l2 : list (btree A)), subst_pred l1 l2 t1 t2 -> length l1 = length l2.
Theorem ordered_cover_subst_pred : forall (t1 : btree A) (l1 l2 : list (btree A)), ordered_cover l1 t1 -> length l1 = length l2 -> exists t2 : btree A, subst_pred l1 l2 t1 t2.
Theorem height_pred_subst_pred : forall (n : nat) (ln : list nat) (t1 : btree A) (l1 l2 : list (btree A)), height_pred n ln l1 t1 -> length l1 = length l2 -> exists t2 : btree A, height_pred n ln l2 t2 /\ subst_pred l1 l2 t1 t2.