Load "Pi1_Pi2''".

Axiom IFBRANCH_M1: forall (n: nat) (ml1 ml2 : mylist n) (b b' : Bool)(x x' y y':message), (ml1 ++ [ bol b ; msg x] ) ~  ( ml2 ++ [ bol b'; msg x'])  ->  (ml1 ++ [bol b ; msg y ] ) ~( ml2 ++ [bol b' ; msg y'])
                                                                                -> (ml1 ++  [ msg (if_then_else_M b x y)])~ ( ml2 ++ [ msg (if_then_else_M b' x' y')]).

Axiom rev_ifbr: forall (n: nat) (ml1 ml2 : mylist n) (b b' : Bool)(x x' y y':message), ([ msg x; bol b] ++ ml1 )  ~   ([ msg x'; bol b'] ++ ml2 ) -> ([ msg y; bol b] ++ ml1 )  ~   ([ msg y'; bol b'] ++ ml2 )
-> ( [msg (if_then_else_M b x y)] ++ ml1 ) ~ (  [ msg (if_then_else_M b' x' y')] ++ ml2).

(****apply IFBRANCH_M repeateadly********************)

Ltac ifbr  ml1 ml2 b b' x x' y y' := pose proof (rev_ifbr _ ml1 ml2 b b' x x' y y');
repeat match goal with
| [H : _ |-  (Cons _ _ (msg (if_then_else_M b x y)) ml1 ) ~  (Cons _ _ (msg (if_then_else_M b' x' y')) ml2 ) ] =>   apply H; clear H; try reflexivity
                           end.
 Ltac ifbr1 :=
repeat match goal with
    | [ |-  (Cons _ _ (msg (if_then_else_M ?B ?X ?Y)) ?L1 )    ~  (Cons _ _ (msg (if_then_else_M ?B' ?X' ?Y')) ?L2 )  ] => ifbr L1 L2 B B' X X' Y Y'
  end.

Ltac ifb := try ifbr1 ; try simpl; try reflexivity; try unf_qb; try unf_qd.

Ltac simpl_Hyps :=
repeat match goal with
  | [H: _ |- _ ] => simpl in H
    end.

Definition len_mylist {n} (l:mylist n) := n.
Ltac funapp_os p1 t1  := match goal with
| [H:  ?L1 ~ ?L2 |- _] => apply FUNCApp_os with (p:= p1) (n:= len_mylist L1) (t:= t1) (ml1:= L1) (ml2:= L2) in H; simpl in H
end .

Ltac funos p H1 :=
repeat match goal with
    | [ |-  (Cons _ _ (msg ?B1 ) _ ) ~ (Cons _ _ (msg ?B2) _) ] => funapp_os p (msg B1) H1
  end.
Ltac DDH2 := assert(DDH1: Fresh [0;1;2;4] [] = true);try reflexivity;
try apply DDH in DDH1.

Axiom RESTR_rev: forall {m} (ml1 ml2: mylist m), ml1 ~ ml2 -> (reverse ml1) ~ (reverse ml2).
(************************************************************************************************)
(************************************************************************************************)
Theorem Pi44_Pi24:  phi44 ~ phi24.

Proof.

  apply RESTR_rev with (ml1:= (reverse phi44)) (ml2 := (reverse phi24)).

simpl.

unfold t45, t25.
ifb.
ifb.
ifb.
ifb.
ifb.
ifb.
ifb.
ifb.
ifb.
ifb.

Focus 2.
ifb.
Unfocus.
Focus 3.
ifb.
ifb.
ifb.
ifb.

rewrite commexp in DDH1.

apply RESTR_rev in DDH1.
simpl in DDH1.

restr_swap 1 12  [t14;
    bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2); bol (EQ_M (to x3) (i 2));
    bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new); bol (EQ_M (reveal x3) (i 2));
    bol (EQ_M (to x2) (i 1)); bol (EQ_M (reveal x2) (i 2));
    bol (EQ_M (reveal x2) (i 1));
    bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
    bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1)); msg grn21; t13;
    t12; msg (g 0); msg (G 0)]   [t14 ;
   bol
     (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
          (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
        (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
      (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2); bol (EQ_M (to x3) (i 2));
   bol
     ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
       (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
     (EQ_M (act x1) new); bol (EQ_M (reveal x3) (i 2));
   bol (EQ_M (to x2) (i 1)); bol (EQ_M (reveal x2) (i 2));
   bol (EQ_M (reveal x2) (i 1));
   bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
   bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1)); msg grn4; t13; t12;
   msg (g 0); msg (G 0)].
unfold t14.
repeat ifb.
restr_swap 1 14 [t13 ; bol (EQ_M (reveal x1) (i 1));
    bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2); bol (EQ_M (to x3) (i 2));
    bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new); bol (EQ_M (reveal x3) (i 2));
    bol (EQ_M (to x2) (i 1)); bol (EQ_M (reveal x2) (i 2));
    bol (EQ_M (reveal x2) (i 1));
    bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
    bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
    msg grn21; msg O; t12; msg (g 0); msg (G 0)]
   [t13 ; bol (EQ_M (reveal x1) (i 1));
   bol
     (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
          (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
        (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
      (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2); bol (EQ_M (to x3) (i 2));
   bol
     ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
       (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
     (EQ_M (act x1) new); bol (EQ_M (reveal x3) (i 2));
   bol (EQ_M (to x2) (i 1)); bol (EQ_M (reveal x2) (i 2));
   bol (EQ_M (reveal x2) (i 1));
   bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
   bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
   msg grn4; msg O; t12; msg (g 0); msg (G 0)].
unfold t13.
repeat ifb.

restr_swap 1 16 [t12; bol (EQ_M (reveal x1) (i 1)); bol (EQ_M (reveal x1) (i 1));
    bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2); bol (EQ_M (to x3) (i 2));
    bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new); bol (EQ_M (reveal x3) (i 2));
    bol (EQ_M (to x2) (i 1)); bol (EQ_M (reveal x2) (i 2));
    bol (EQ_M (reveal x2) (i 1));
    bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
    bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
    msg grn21; msg O; msg O; msg (g 0); msg (G 0)]
   [t12; bol (EQ_M (reveal x1) (i 1)); bol (EQ_M (reveal x1) (i 1));
   bol
     (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
          (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
        (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
      (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2); bol (EQ_M (to x3) (i 2));
   bol
     ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
       (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
     (EQ_M (act x1) new); bol (EQ_M (reveal x3) (i 2));
   bol (EQ_M (to x2) (i 1)); bol (EQ_M (reveal x2) (i 2));
   bol (EQ_M (reveal x2) (i 1));
   bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
   bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
   msg grn4; msg O; msg O; msg (g 0); msg (G 0)].
unfold t12. unf_qa.
repeat ifb.
(*******************)
restr_proj_in 3 DDH1.
 funapp_droplt DDH1.
funapp_droplt DDH1.
funapp_O_in DDH1.
funapp_O_in DDH1.
restr_swap_in 2 4 DDH1.
restr_swap_in 3 5 DDH1.
funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

rev_app funapp_O_in  DDH1; do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto.
(**************************************)

 funapp_droplt DDH1.
funapp_droplt DDH1.
funapp_O_in DDH1.
funapp_O_in DDH1.
restr_swap_in 2 4 DDH1.
restr_swap_in 3 5 DDH1.
funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).

rev_app funapp_O_in DDH1.  assumption. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto.
(*************************************************)
restr_swap_in 2 3 DDH1.

 funapp_droplt DDH1.
funapp_O_in DDH1.
funapp_O_in DDH1.
restr_swap_in 3 5 DDH1.
restr_swap_in 4 6 DDH1.
restr_swap_in 1 2 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
restr_swap_in 1 16 DDH1.
  assumption. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto.  auto.

(***********************************************************)

restr_swap_in 2 3 DDH1.

 funapp_droplt DDH1.
funapp_O_in DDH1.
funapp_O_in DDH1.
restr_swap_in 3 5 DDH1.
restr_swap_in 4 6 DDH1.
restr_swap_in 1 2 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x1) (i 2))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
restr_swap_in 1 17 DDH1.
  assumption. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto. repeat (try reflexivity).
auto. auto . auto.
aply 3 auto. auto. auto. auto . auto.  auto.

(*******************************************************)

funapp_droplt DDH1.
funapp_droplt DDH1.
rev_app funapp_O_in DDH1.
rev_app funapp_O_in DDH1.
restr_swap_in 1 3 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x1) (i 2))).
rev_app funapp_O_in DDH1.
assumption.
 aply 3 auto. auto. auto. auto. auto. auto.
auto. repeat (try reflexivity).
auto. auto . auto.
aply 3 auto. auto. auto. auto . auto.  auto.

(****************************************)
restr_swap_in 2 3 DDH1.
funapp_droplt DDH1.
funapp_droplt DDH1.

rev_app funapp_O_in DDH1.
rev_app funapp_O_in  DDH1.
restr_swap_in 1 3 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
rev_app funapp_O_in DDH1.
restr_swap 1 17 [t12 ; bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
    bol (EQ_M (reveal x1) (i 1));
    bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2); bol (EQ_M (to x3) (i 2));
    bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new); bol (EQ_M (reveal x3) (i 2));
    bol (EQ_M (to x2) (i 1)); bol (EQ_M (reveal x2) (i 2));
    bol (EQ_M (reveal x2) (i 1));
    bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
    bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
    msg grn21; msg O; msg O; msg (g 0); msg (G 0)]
   [t12 ; bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
   bol (EQ_M (reveal x1) (i 1));
   bol
     (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
          (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
        (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
      (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2); bol (EQ_M (to x3) (i 2));
   bol
     ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
       (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
     (EQ_M (act x1) new); bol (EQ_M (reveal x3) (i 2));
   bol (EQ_M (to x2) (i 1)); bol (EQ_M (reveal x2) (i 2));
   bol (EQ_M (reveal x2) (i 1));
   bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
   bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
   msg grn4; msg O; msg O; msg (g 0); msg (G 0)].
unfold t12. unf_qa.
repeat ifb.
assumption.
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
restr_swap_in 1 2 DDH1.
 aply 3 auto. auto. clear DDH1.
(*************************************)
DDH2.
rewrite commexp in DDH1.
apply RESTR_rev in DDH1. simpl in DDH1.

restr_swap_in 2 3 DDH1.
funapp_droplt DDH1.
rev_app funapp_O_in DDH1.
restr_swap_in 1 2 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
rev_app funapp_O_in DDH1.
restr_swap_in 1 20 DDH1.
assumption. auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto. auto.
clear DDH1.
(******************************)

DDH2.
rewrite commexp in DDH1.
apply RESTR_rev in DDH1. simpl in DDH1.

restr_swap_in 2 3 DDH1.
funapp_droplt DDH1.
rev_app funapp_O_in DDH1.
restr_swap_in 1 2 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x1) (i 2))) .
rev_app funapp_O_in DDH1.
restr_swap_in 1 21 DDH1.
assumption. auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto. auto. auto.
clear DDH1.

(****************************************)
DDH2.
rewrite commexp in DDH1.
apply RESTR_rev in DDH1. simpl in DDH1.

funapp_droplt DDH1.
funapp_droplt DDH1.
rev_app funapp_O_in  DDH1.
rev_app funapp_O_in DDH1.
restr_swap_in 1 3 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x1) (i 2))) .
rev_app funapp_O_in DDH1.

assumption. auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto. auto. auto.  auto. auto. auto. auto. auto.
 auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto. auto. auto.  auto. auto. auto. auto. auto.
(*************************************************************)
unf_qa.
repeat ifb.
restr_swap 1 19 [t12 ; bol (EQ_M (reveal x2) (i 1));
    bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
    bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
    bol (EQ_M (reveal x1) (i 1));
    bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2); bol (EQ_M (to x3) (i 2));
    bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new); bol (EQ_M (reveal x3) (i 2));
    bol (EQ_M (to x2) (i 1)); bol (EQ_M (reveal x2) (i 2));
    bol (EQ_M (reveal x2) (i 1));
    bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
    bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
    msg grn21; msg O; msg O; msg (g 0); msg (G 0)]
   [t12 ; bol (EQ_M (reveal x2) (i 1));
   bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
   bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
   bol (EQ_M (reveal x1) (i 1));
   bol
     (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
          (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
        (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
      (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2); bol (EQ_M (to x3) (i 2));
   bol
     ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
       (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
     (EQ_M (act x1) new); bol (EQ_M (reveal x3) (i 2));
   bol (EQ_M (to x2) (i 1)); bol (EQ_M (reveal x2) (i 2));
   bol (EQ_M (reveal x2) (i 1));
   bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
   bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
   msg grn4; msg O; msg O; msg (g 0); msg (G 0)].
unfold t12. unf_qa. repeat ifb.

funapp_droplt DDH1.
funapp_droplt DDH1.
rev_app funapp_O_in DDH1.
rev_app funapp_O_in DDH1.
restr_swap_in 1 3 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).

funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))) .
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))) .
rev_app funapp_O_in DDH1.
assumption.

 auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto. auto. auto.  auto. auto. auto. auto. auto.
 auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto.
(******************************************)

funapp_droplt DDH1.
funapp_droplt DDH1.
rev_app funapp_O_in DDH1.
rev_app funapp_O_in DDH1.
restr_swap_in 1 3 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).

funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
rev_app funapp_O_in DDH1.

assumption. auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto. auto. auto.  auto. auto. auto. auto. auto.
 auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.

(***********************************************************)

restr_swap_in 2 3 DDH1.
funapp_droplt DDH1.
rev_app funapp_O_in DDH1.
restr_swap_in 1 2 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).

funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
rev_app funapp_O_in DDH1.
restr_swap_in 1 22 DDH1.
assumption. auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto. auto. auto.

auto.

(******************************************************)

restr_swap_in 2 3 DDH1.
funapp_droplt DDH1.
rev_app funapp_O_in DDH1.
restr_swap_in 1 2 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).

funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (to x1) (i 2))).
rev_app funapp_O_in DDH1.
restr_swap_in 1 23 DDH1.
assumption. auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto. auto. auto.

auto. auto.
(*******************************************************)

funapp_droplt DDH1.
funapp_droplt DDH1.
rev_app funapp_O_in DDH1.
rev_app funapp_O_in  DDH1.
restr_swap_in 1 3 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).

funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).

funapp_os 0 ( bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x1) (i 2))).
rev_app funapp_O_in DDH1.
assumption. auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto. auto. auto.  auto. auto. auto. auto. auto.
 auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.

(****************************************************)

restr_swap 1 20 [t12; bol (EQ_M (reveal x2) (i 2)); bol (EQ_M (reveal x2) (i 1));
    bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
    bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
    bol (EQ_M (reveal x1) (i 1));
    bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2); bol (EQ_M (to x3) (i 2));
    bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new); bol (EQ_M (reveal x3) (i 2));
    bol (EQ_M (to x2) (i 1)); bol (EQ_M (reveal x2) (i 2));
    bol (EQ_M (reveal x2) (i 1));
    bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
    bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
    msg grn21; msg O; msg O; msg (g 0); msg (G 0)]
   [t12 ; bol (EQ_M (reveal x2) (i 2)); bol (EQ_M (reveal x2) (i 1));
   bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
   bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
   bol (EQ_M (reveal x1) (i 1));
   bol
     (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
          (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
        (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
      (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2); bol (EQ_M (to x3) (i 2));
   bol
     ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
       (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
     (EQ_M (act x1) new); bol (EQ_M (reveal x3) (i 2));
   bol (EQ_M (to x2) (i 1)); bol (EQ_M (reveal x2) (i 2));
   bol (EQ_M (reveal x2) (i 1));
   bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
   bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
   msg grn4; msg O; msg O; msg (g 0); msg (G 0)].

unfold t12. unf_qa.
repeat ifb.

(*************************)

funapp_droplt DDH1.
funapp_droplt DDH1.
rev_app funapp_O_in DDH1.
rev_app funapp_O_in DDH1.
restr_swap_in 1 3 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).

funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x2) (i 2))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

rev_app funapp_O_in DDH1.
assumption. auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto. auto. auto.  auto. auto. auto. auto. auto.
 auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.

(*********************************)

funapp_droplt DDH1.
funapp_droplt DDH1.
rev_app funapp_O_in DDH1.
rev_app funapp_O_in DDH1.
restr_swap_in 1 3 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).

funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x2) (i 2))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).

rev_app funapp_O_in DDH1.
assumption. auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto. auto. auto.  auto. auto. auto. auto. auto.
 auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.

(************************************)

restr_swap_in 2 3 DDH1.
funapp_droplt DDH1.
rev_app funapp_O_in DDH1.
restr_swap_in 1 2 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).

funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).

rev_app funapp_O_in DDH1.
restr_swap_in 1 23 DDH1.
assumption. auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto. auto. auto.

auto. auto.

(**************************************)

restr_swap_in 2 3 DDH1.
funapp_droplt DDH1.
rev_app funapp_O_in DDH1.
restr_swap_in 1 2 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).

funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (to x1) (i 2))).
rev_app funapp_O_in DDH1.
restr_swap_in 1 24 DDH1.
assumption. auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto. auto. auto.

auto. auto. auto.

(*******************************************************************)

funapp_droplt DDH1.
funapp_droplt DDH1.
rev_app funapp_O_in DDH1.
rev_app funapp_O_in DDH1.
restr_swap_in 1 3 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).

funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x2) (i 2))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (to x1) (i 2))).

rev_app funapp_O_in DDH1.
assumption. auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto. auto. auto.  auto. auto. auto. auto. auto.
 auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.

(*********************************************************************)
restr_swap 1 21 [t12 ; bol (EQ_M (to x2) (i 1)); bol (EQ_M (reveal x2) (i 2));
    bol (EQ_M (reveal x2) (i 1));
    bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
    bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
    bol (EQ_M (reveal x1) (i 1));
    bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2); bol (EQ_M (to x3) (i 2));
    bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new); bol (EQ_M (reveal x3) (i 2));
    bol (EQ_M (to x2) (i 1)); bol (EQ_M (reveal x2) (i 2));
    bol (EQ_M (reveal x2) (i 1));
    bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
    bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
    msg grn21; msg O; msg acc; msg (g 0); msg (G 0)]
   [t12 ; bol (EQ_M (to x2) (i 1)); bol (EQ_M (reveal x2) (i 2));
   bol (EQ_M (reveal x2) (i 1));
   bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
   bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
   bol (EQ_M (reveal x1) (i 1));
   bol
     (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
          (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
        (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
      (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2); bol (EQ_M (to x3) (i 2));
   bol
     ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
       (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
     (EQ_M (act x1) new); bol (EQ_M (reveal x3) (i 2));
   bol (EQ_M (to x2) (i 1)); bol (EQ_M (reveal x2) (i 2));
   bol (EQ_M (reveal x2) (i 1));
   bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
   bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
   msg grn4; msg O; msg acc ; msg (g 0); msg (G 0)].
unfold t12 . unf_qa.
repeat ifb.
(***************************************)
rev_app funapp_acc_in DDH1.
aply_in 2 funapp_droplt DDH1.
restr_swap_in 1 2 DDH1.
rev_app funapp_O_in DDH1.
restr_swap_in 1 2 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).

funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0  (bol (EQ_M (to x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

rev_app funapp_O_in DDH1.
assumption.
 do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto. auto. auto.  auto. auto. auto. auto. auto.
 auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.

(****************************************************************)

rev_app funapp_acc_in DDH1.
aply_in 2 funapp_droplt DDH1.
restr_swap_in 1 2 DDH1.
rev_app funapp_O_in DDH1.
restr_swap_in 1 2 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).

funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0  (bol (EQ_M (to x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).

rev_app funapp_O_in DDH1.
assumption.
 do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto. auto. auto.  auto. auto. auto. auto. auto.
 auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.

(*********************************************************)

restr_swap_in 2 3 DDH1.
aply_in 1 funapp_droplt DDH1.

rev_app funapp_O_in DDH1.
restr_swap_in 1 2 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).

funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0  (bol (EQ_M (to x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
rev_app funapp_acc_in DDH1.
restr_swap_in 1 24 DDH1.
assumption.
 do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto. auto. auto.  auto. auto. auto. auto. auto.
 auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.

(**********************************************************************)

restr_swap_in 2 3 DDH1.
aply_in 1 funapp_droplt DDH1.

rev_app funapp_O_in DDH1.
restr_swap_in 1 2 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).

funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0  (bol (EQ_M (to x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 ( bol (EQ_M (to x1) (i 2))).
rev_app funapp_acc_in DDH1.
restr_swap_in 1 25 DDH1.
assumption.
 do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto. auto. auto.  auto. auto. auto. auto. auto.
 auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.

(********************************************************************************)

rev_app funapp_acc_in DDH1.
aply_in 2 funapp_droplt DDH1.
restr_swap_in 1 2 DDH1.
rev_app funapp_O_in DDH1.
restr_swap_in 1 2 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).

funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0  (bol (EQ_M (to x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (to x1) (i 2))).
rev_app funapp_O_in DDH1.
assumption.
 do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto. auto. auto.  auto. auto. auto. auto. auto.
 auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.

(*****************************************************************)

restr_swap 1 22 [t12 ; bol (EQ_M (to x2) (i 2)); bol (EQ_M (to x2) (i 1));
    bol (EQ_M (reveal x2) (i 2)); bol (EQ_M (reveal x2) (i 1));
    bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
    bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
    bol (EQ_M (reveal x1) (i 1));
    bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2); bol (EQ_M (to x3) (i 2));
    bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new); bol (EQ_M (reveal x3) (i 2));
    bol (EQ_M (to x2) (i 1)); bol (EQ_M (reveal x2) (i 2));
    bol (EQ_M (reveal x2) (i 1));
    bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
    bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
    msg grn21; msg O; msg grn1; msg (g 0); msg (G 0)]
   [t12 ; bol (EQ_M (to x2) (i 2)); bol (EQ_M (to x2) (i 1));
   bol (EQ_M (reveal x2) (i 2)); bol (EQ_M (reveal x2) (i 1));
   bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
   bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
   bol (EQ_M (reveal x1) (i 1));
   bol
     (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
          (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
        (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
      (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2); bol (EQ_M (to x3) (i 2));
   bol
     ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
       (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
     (EQ_M (act x1) new); bol (EQ_M (reveal x3) (i 2));
   bol (EQ_M (to x2) (i 1)); bol (EQ_M (reveal x2) (i 2));
   bol (EQ_M (reveal x2) (i 1));
   bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
   bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
   msg grn4; msg O; msg grn1; msg (g 0); msg (G 0)].
unfold t12; unf_qa.

repeat ifb.

(***********************************************************************)
restr_swap_in 2 3 DDH1.
funapp_droplt DDH1.
rev_app funapp_O_in DDH1.
restr_swap_in 1 2 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).

funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0  (bol (EQ_M (to x2) (i 1))).
funapp_os 0  (bol (EQ_M (to x2) (i 2))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

rev_app funapp_O_in DDH1.
assumption.
 do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto. auto. auto.  auto. auto. auto. auto. auto.
 auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.

(****************************************************************************)

restr_swap_in 2 3 DDH1.
funapp_droplt DDH1.
rev_app funapp_O_in DDH1.
restr_swap_in 1 2 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).

funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0  (bol (EQ_M (to x2) (i 1))).
funapp_os 0  (bol (EQ_M (to x2) (i 2))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
rev_app funapp_O_in DDH1.
assumption.
 do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto. auto. auto.  auto. auto. auto. auto. auto.
 auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.

(*************************************************************************)

restr_swap_in 2 3 DDH1.
funapp_droplt DDH1.

funapp_elt_in 1 1 .

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).

funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0  (bol (EQ_M (to x2) (i 1))).
funapp_os 0  (bol (EQ_M (to x2) (i 2))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
rev_app funapp_O_in DDH1.
restr_swap_in 1 24 DDH1.
assumption.
 do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto. auto. auto.  auto. auto. auto. auto. auto.
 auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.

(*********************************************)

restr_swap_in 2 3 DDH1.
funapp_droplt DDH1.

funapp_elt_in 1 1 .

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).

funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0  (bol (EQ_M (to x2) (i 1))).
funapp_os 0  (bol (EQ_M (to x2) (i 2))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (to x1) (i 2))).
rev_app funapp_O_in DDH1.
restr_swap_in 1 25 DDH1.
assumption.
 do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto. auto. auto.  auto. auto. auto. auto. auto.
 auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.

(******************************************************************)

restr_swap_in 2 3 DDH1.
funapp_droplt DDH1.
rev_app funapp_O_in DDH1.
restr_swap_in 1 2 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).

funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0  (bol (EQ_M (to x2) (i 1))).
funapp_os 0  (bol (EQ_M (to x2) (i 2))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (to x1) (i 2))).
rev_app funapp_O_in DDH1.

assumption.
 do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto. auto. auto.  auto. auto. auto. auto. auto.
 auto. do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.

(********************************************************************)

restr_swap 1 22 [t12; bol (EQ_M (to x2) (i 2)); bol (EQ_M (to x2) (i 1));
    bol (EQ_M (reveal x2) (i 2)); bol (EQ_M (reveal x2) (i 1));
    bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
    bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
    bol (EQ_M (reveal x1) (i 1));
    bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2); bol (EQ_M (to x3) (i 2));
    bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new); bol (EQ_M (reveal x3) (i 2));
    bol (EQ_M (to x2) (i 1)); bol (EQ_M (reveal x2) (i 2));
    bol (EQ_M (reveal x2) (i 1));
    bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
    bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
    msg grn21; msg O; msg O; msg (g 0); msg (G 0)] [t12 ; bol (EQ_M (to x2) (i 2)); bol (EQ_M (to x2) (i 1));
   bol (EQ_M (reveal x2) (i 2)); bol (EQ_M (reveal x2) (i 1));
   bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
   bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
   bol (EQ_M (reveal x1) (i 1));
   bol
     (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
          (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
        (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
      (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2); bol (EQ_M (to x3) (i 2));
   bol
     ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
       (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
     (EQ_M (act x1) new); bol (EQ_M (reveal x3) (i 2));
   bol (EQ_M (to x2) (i 1)); bol (EQ_M (reveal x2) (i 2));
   bol (EQ_M (reveal x2) (i 1));
   bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
   bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
   msg grn4; msg O; msg O; msg (g 0); msg (G 0)].
unfold t12; unf_qa.
repeat ifb.

(************************************)
aply_in 2 funapp_droplt DDH1.
aply_in 2 funapp_O_in DDH1.

restr_swap_in 2 4 DDH1.
restr_swap_in 3 5 DDH1.
funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0  (bol (EQ_M (to x2) (i 1))).
funapp_os 0  (bol (EQ_M (to x2) (i 2))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
rev_app funapp_O_in  DDH1; do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto.   auto. auto. auto.   auto. auto. auto.

(*********************************************************)

aply_in 2 funapp_droplt DDH1.
aply_in 2 funapp_O_in DDH1.

restr_swap_in 2 4 DDH1.
restr_swap_in 3 5 DDH1.
funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0  (bol (EQ_M (to x2) (i 1))).
funapp_os 0  (bol (EQ_M (to x2) (i 2))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
rev_app funapp_O_in  DDH1; do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto.   auto. auto. auto.   auto. auto. auto.   auto.

(****************************************************************)
restr_swap_in 2 3 DDH1.
aply_in 1  funapp_droplt DDH1.
rev_app funapp_O_in DDH1.
restr_swap_in 1 2 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0  (bol (EQ_M (to x2) (i 1))).
funapp_os 0  (bol (EQ_M (to x2) (i 2))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0 (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
rev_app funapp_O_in  DDH1. restr_swap_in 1 25 DDH1. auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto.   auto. auto. auto.   auto. auto. auto.   auto. auto.

(***********************************************************************)

restr_swap_in 2 3 DDH1.
aply_in 1  funapp_droplt DDH1.
rev_app funapp_O_in DDH1.
restr_swap_in 1 2 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0  (bol (EQ_M (to x2) (i 1))).
funapp_os 0  (bol (EQ_M (to x2) (i 2))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0 (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (to x1) (i 2))).
rev_app funapp_O_in  DDH1. restr_swap_in 1 26 DDH1. auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto.   auto. auto. auto.   auto. auto. auto.   auto. auto. auto.

(**************************************************************************)

aply_in 2 funapp_droplt DDH1.
aply_in 2 funapp_O_in DDH1.

restr_swap_in 2 4 DDH1.
restr_swap_in 3 5 DDH1.
funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0  (bol (EQ_M (to x2) (i 1))).
funapp_os 0  (bol (EQ_M (to x2) (i 2))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0 (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (to x1) (i 2))).
rev_app funapp_O_in  DDH1; do_nat 4 auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto.   auto. auto. auto.   auto. auto. auto.   auto. auto. auto.

unfold qa01. repeat ifb.

restr_swap 1 20  [t12 ; bol (EQ_M (reveal x2) (i 1)); bol (EQ_M (to x1) (i 2));
    bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
    bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
    bol (EQ_M (reveal x1) (i 1));
    bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2); bol (EQ_M (to x3) (i 2));
    bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new); bol (EQ_M (reveal x3) (i 2));
    bol (EQ_M (to x2) (i 1)); bol (EQ_M (reveal x2) (i 2));
    bol (EQ_M (reveal x2) (i 1));
    bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
    bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
    msg grn21; msg O; msg O; msg (g 0); msg (G 0)]  [t12 ; bol (EQ_M (reveal x2) (i 1)); bol (EQ_M (to x1) (i 2));
   bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
   bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
   bol (EQ_M (reveal x1) (i 1));
   bol
     (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
          (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
        (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
      (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2); bol (EQ_M (to x3) (i 2));
   bol
     ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
       (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
     (EQ_M (act x1) new); bol (EQ_M (reveal x3) (i 2));
   bol (EQ_M (to x2) (i 1)); bol (EQ_M (reveal x2) (i 2));
   bol (EQ_M (reveal x2) (i 1));
   bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new);
   bol (EQ_M (reveal x1) (i 2)); bol (EQ_M (reveal x1) (i 1));
   msg grn4; msg O; msg O; msg (g 0); msg (G 0)].
unfold t12 ; unf_qa. repeat ifb.

(*******************************************************************)

aply_in 2 funapp_droplt DDH1.
aply_in 2 funapp_O_in DDH1.

restr_swap_in 2 4 DDH1.
restr_swap_in 3 5 DDH1.
funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x1) (i 2))).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).

rev_app funapp_O_in  DDH1. assumption. auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto.   auto. auto. auto.   auto. auto. auto.   auto.

(***********************************************************)

aply_in 2 funapp_droplt DDH1.
aply_in 2 funapp_O_in DDH1.

restr_swap_in 2 4 DDH1.
restr_swap_in 3 5 DDH1.
funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x1) (i 2))).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
rev_app funapp_O_in  DDH1. assumption. auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto.   auto. auto. auto.   auto. auto. auto.   auto.

(*******************************************************************************)

restr_swap_in 2 3 DDH1.
aply_in 1  funapp_droplt DDH1.
rev_app funapp_O_in DDH1.
restr_swap_in 1 2 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x1) (i 2))).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0 (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).

rev_app funapp_O_in  DDH1. restr_swap_in 1 23  DDH1. assumption. auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto.   auto. auto. auto.   auto. auto. auto.   auto. auto. auto.

(*********************************************************************)

restr_swap_in 2 3 DDH1.
aply_in 1  funapp_droplt DDH1.
rev_app funapp_O_in DDH1.
restr_swap_in 1 2 DDH1.

funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x1) (i 2))).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0 (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x1) (i 2))).
rev_app funapp_O_in  DDH1. restr_swap_in 1 24 DDH1. assumption. auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto.   auto. auto. auto.   auto. auto. auto.   auto. auto. auto.

(************************************)

aply_in 2 funapp_droplt DDH1.
aply_in 2 funapp_O_in DDH1.

restr_swap_in 2 4 DDH1.
restr_swap_in 3 5 DDH1.
funapp_os 0  (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0  (bol (EQ_M (reveal x2) (i 1))).
funapp_os 0  (bol (EQ_M (reveal x2) (i 2))).
funapp_os 0 ( bol (EQ_M (to x2) (i 1))) .
funapp_os 0  (bol (EQ_M (reveal x3) (i 2))) .
funapp_os 0  ( bol
      ((((EQ_M (reveal x3) (i 1)) & (EQ_M (to x2) (i 1))) &
        (EQ_M (to x1) (i 1))) & (notb (EQ_M (act x2) new))) &
      (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x3) (i 2))).
 funapp_os 0 (bol
      (((((((EQ_M (reveal x4) (i 2)) & (EQ_M (to x3) (i 1))) &
           (EQ_M (to x2) (i 2))) & (EQ_M (to x1) (i 1))) &
         (notb (EQ_M (act x3) new))) & (EQ_M (act x1) new)) &
       (EQ_M (m x2) grn1)) & (EQ_M (m x3) grn2)).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x1) (i 2))).
funapp_os 0 (bol (EQ_M (reveal x2) (i 1))).

funapp_os 0 (bol (EQ_M (reveal x1) (i 1))).
funapp_os 0 (bol (EQ_M (reveal x1) (i 2))).
funapp_os 0  (bol (EQ_M (to x1) (i 1)) & (EQ_M (act x1) new)).
funapp_os 0 (bol (EQ_M (to x1) (i 2))).
rev_app funapp_O_in  DDH1. assumption. auto. aply 3 auto. auto. auto. auto. auto. auto.
auto.  repeat (try reflexivity);
auto. auto ; auto.
aply 1 auto. auto. auto. auto.   auto. auto. auto.   auto. auto. auto.   auto.

Admitted.


(** 直積型に関するモジュールです。 *)

Require Googology_In_Coq.Base.
Require Googology_In_Coq.Path.

(** ライブラリを要求します。 *)

Import Googology_In_Coq.Base.
Import Googology_In_Coq.Path.

(** ライブラリを開きます。 *)

Inductive Product@{ i | } ( A : Type@{ i } ) ( B : Type@{ i } ) : Type@{ i } := pair_Product : A -> B -> Product A B.
(* from: originally defined by Hexirp *)

(** 直積型です。 *)

Definition matching_Product@{ i j | } ( A : Type@{ i } ) ( B : Type@{ i } ) ( P : Type@{ j } ) ( cp : A -> B -> P ) ( x : Product A B ) : P := match x with pair_Product _ _ xf xs => cp xf xs end.
(* from: originally defined by Hexirp *)

(** 直積型の場合分けです。 *)

Definition identity_matching_Product@{ i j | } ( A : Type@{ i } ) ( B : Type@{ i } ) ( P : Type@{ j } ) ( display : P -> Product A B ) (cp : A -> B -> P ) ( icp : forall ( xf : A ) ( xs : B ), Path ( Product A B ) ( display ( cp xf xs ) ) ( pair_Product A B xf xs ) ) ( x : Product A B ) : Path ( Product A B ) ( display ( matching_Product A B P cp x ) ) x := match x as x_ return Path ( Product A B ) ( display ( matching_Product A B P cp x_ ) ) x_ with pair_Product _ _ xf xs => icp xf xs end.
(* from: originally defined by Hexirp *)

(** 直積型の場合分けの恒等式です。 *)

Definition dependent_matching_Product@{ i j | } ( A : Type@{ i } ) ( B : Type@{ i } ) ( P : Product A B -> Type@{ j } ) ( cp : forall ( xf : A ) ( xs : B ), P ( pair_Product A B xf xs ) ) ( x : Product A B ) : P x := match x as x_ return P x_ with pair_Product _ _ xf xs => cp xf xs end.
(* from: originally defined by Hexirp *)

(** 直積型の依存場合分けです。 *)

Definition path_cons_Product@{ i si | i < si } ( A : Type@{ i } ) ( B : Type@{ i } ) ( x : Product A B ) ( y : Product A B ) : Type@{ i }.
Proof.
  refine ( matching_Product@{ i si } A B ( forall y_ : Product A B, Type@{ i } ) _ x y ).
  refine ( fun ( xf : A ) ( xs : B ) ( y_ : Product A B ) => _ ).
  refine ( matching_Product@{ i si } A B Type@{ i } _ y_ ).
  refine ( fun ( yf : A ) ( ys : B ) => _ ).
  exact ( Product ( Path A xf yf ) ( Path B xs ys ) ).
Defined.
(* from: originally defined by Hexirp *)

(** 直積型の構成子の道です。 *)

Definition from_path_cons_Product@{ i si | i < si } ( A : Type@{ i } ) ( B : Type@{ i } ) ( x : Product A B ) ( y : Product A B ) ( p : path_cons_Product@{ i si } A B x y ) : Path ( Product A B ) x y.
Proof.
  refine ( dependent_matching_Product A B ( fun x_ : Product A B => forall ( y_ : Product A B ) ( p_ : path_cons_Product@{ i si } A B x_ y_ ), Path ( Product A B ) x_ y_ ) _ x y p ).
  refine ( fun ( xf : A ) ( xs : B ) ( y_ : Product A B ) ( p_ : path_cons_Product@{ i si } A B ( pair_Product A B xf xs ) y_ ) => _ ).
  refine ( dependent_matching_Product A B ( fun y__ : Product A B => forall p__ : path_cons_Product@{ i si } A B ( pair_Product A B xf xs ) y__, Path ( Product A B ) ( pair_Product A B xf xs ) y__ ) _ y_ p_ ).
  refine ( fun ( yf : A ) ( ys : B ) => _ ).
  change ( path_cons_Product@{ i si } A B ( pair_Product A B xf xs ) ( pair_Product A B yf ys ) -> Path ( Product A B ) ( pair_Product A B xf xs ) ( pair_Product A B yf ys ) ).
  change ( Product ( Path A xf yf ) ( Path B xs ys ) -> Path ( Product A B ) ( pair_Product A B xf xs ) ( pair_Product A B yf ys ) ).
  refine ( fun p__ : Product ( Path A xf yf ) ( Path B xs ys ) => _ ).
  refine ( matching_Product ( Path A xf yf ) ( Path B xs ys ) ( Path ( Product A B ) ( pair_Product A B xf xs ) ( pair_Product A B yf ys ) ) _ p__ ).
  refine ( fun ( pf : Path A xf yf ) ( ps : Path B xs ys ) => _ ).
  exact ( trpt_2_Path A B ( fun ( yf_ : A ) ( ys_ : B ) => Path ( Product A B ) ( pair_Product A B xf xs ) ( pair_Product A B yf_ ys_ ) ) xf yf pf xs ys ps ( id_Path ( Product A B ) ( pair_Product A B xf xs ) ) ).
Defined.
(* from: originally defined by Hexirp *)

(** 直積型の構成子の道から直積型の道への関数です。 *)

Definition first_Product@{ i | } ( A : Type@{ i } ) ( B : Type@{ i } ) ( x : Product A B ) : A := matching_Product A B A ( fun ( xf : A ) ( xs : B ) => xf ) x.
(* from: originally defined by Hexirp *)

(** 直積型の第一射影関数（分解子）です。 *)

Definition second_Product@{ i | } ( A : Type@{ i } ) ( B : Type@{ i } ) ( x : Product A B ) : B := matching_Product A B B ( fun ( xf : A ) ( xs : B ) => xs ) x.
(* from: originally defined by Hexirp *)

(** 直積型の第二射影関数（分解子）です。 *)

Definition path_dest_Product@{ i | } ( A : Type@{ i } ) ( B : Type@{ i } ) ( x : Product A B ) ( y : Product A B ) : Type@{ i } := Product ( Path A ( first_Product A B x ) ( first_Product A B y ) ) ( Path B ( second_Product A B x ) ( second_Product A B y ) ).
(* from: originally defined by Hexirp *)

(** 直積型の分解子の道です。 *)

Definition from_path_dest_Product@{ i | } ( A : Type@{ i } ) ( B : Type@{ i } ) ( x : Product A B ) ( y : Product A B ) ( p : path_dest_Product A B x y ) : Path ( Product A B ) x y.
Proof.
  refine ( dependent_matching_Product A B ( fun x_ : Product A B => forall ( y_ : Product A B ) ( p_ : path_dest_Product A B x_ y_ ), Path ( Product A B ) x_ y_ ) _ x y p ).
  refine ( fun ( xf : A ) ( xs : B ) ( y_ : Product A B ) ( p_ : path_dest_Product@{ i } A B ( pair_Product A B xf xs ) y_ ) => _ ).
  refine ( dependent_matching_Product A B ( fun y__ : Product A B => forall p__ : path_dest_Product A B ( pair_Product A B xf xs ) y__, Path ( Product A B ) ( pair_Product A B xf xs ) y__ ) _ y_ p_ ).
  refine ( fun ( yf : A ) ( ys : B ) => _ ).
  change ( path_cons_Product A B ( pair_Product A B xf xs ) ( pair_Product A B yf ys ) -> Path ( Product A B ) ( pair_Product A B xf xs ) ( pair_Product A B yf ys ) ).
  change ( Product ( Path A xf yf ) ( Path B xs ys ) -> Path ( Product A B ) ( pair_Product A B xf xs ) ( pair_Product A B yf ys ) ).
  refine ( fun p__ : Product ( Path A xf yf ) ( Path B xs ys ) => _ ).
  refine ( matching_Product ( Path A xf yf ) ( Path B xs ys ) ( Path ( Product A B ) ( pair_Product A B xf xs ) ( pair_Product A B yf ys ) ) _ p__ ).
  refine ( fun ( pf : Path A xf yf ) ( ps : Path B xs ys ) => _ ).
  exact ( trpt_2_Path A B ( fun ( yf_ : A ) ( ys_ : B ) => Path ( Product A B ) ( pair_Product A B xf xs ) ( pair_Product A B yf_ ys_ ) ) xf yf pf xs ys ps ( id_Path ( Product A B ) ( pair_Product A B xf xs ) ) ).
Defined.
(* from: originally defined by Hexirp *)

(** 直積型の分解子の道です。 *)

Definition comatching_Product@{ i j | } ( A : Type@{ i } ) ( B : Type@{ i } ) ( P : Type@{ j } ) ( df : P -> A ) ( ds : P -> B ) ( x : P ) : Product A B := pair_Product A B ( df x ) ( ds x ).
(* from: originally defined by Hexirp *)

(** 直積型の余場合分けです。 *)

Definition identity_comatching_Product@{ i j | } ( A : Type@{ i } ) ( B : Type@{ i } ) ( P : Type@{ j } ) ( codisplay : Product A B -> P ) ( df : P -> A ) ( idf : forall x : Product A B, Path A ( df ( codisplay x ) ) ( first_Product A B x ) ) ( ds : P -> B ) ( ids : forall x : Product A B, Path B ( ds ( codisplay x ) ) ( second_Product A B x ) ) ( x : Product A B ) : Path ( Product A B ) ( comatching_Product A B P df ds ( codisplay x ) ) x.
Proof.
  refine ( dependent_matching_Product A B ( fun x_ : Product A B => Path ( Product A B ) ( comatching_Product A B P df ds ( codisplay x_ ) ) x_ ) _ x ).
  refine ( fun ( xf : A ) ( xs : B ) => _ ).
  refine ( from_path_dest_Product A B ( comatching_Product A B P df ds ( codisplay ( pair_Product A B xf xs ) ) ) ( pair_Product A B xf xs ) _ ).
  change ( path_dest_Product A B ( comatching_Product A B P df ds ( codisplay ( pair_Product A B xf xs ) ) ) ( pair_Product A B xf xs ) ).
  change ( Product ( Path A ( first_Product A B ( comatching_Product A B P df ds ( codisplay ( pair_Product A B xf xs ) ) ) ) ( first_Product A B ( pair_Product A B xf xs ) ) ) ( Path B ( second_Product A B ( comatching_Product A B P df ds ( codisplay ( pair_Product A B xf xs ) ) ) ) ( second_Product A B ( pair_Product A B xf xs ) ) ) ).
  change ( Product ( Path A ( df ( codisplay ( pair_Product A B xf xs ) ) ) xf ) ( Path B ( ds ( codisplay ( pair_Product A B xf xs ) ) ) xs ) ).
  refine ( pair_Product ( Path A ( df ( codisplay ( pair_Product A B xf xs ) ) ) xf ) ( Path B ( ds ( codisplay ( pair_Product A B xf xs ) ) ) xs ) _ _ ).
  -
    change ( Path A ( df ( codisplay ( pair_Product A B xf xs ) ) ) xf ).
    change ( Path A ( df ( codisplay ( pair_Product A B xf xs ) ) ) ( first_Product A B ( pair_Product A B xf xs ) ) ).
    exact ( idf ( pair_Product A B xf xs ) ).
  -
    change ( Path B ( ds ( codisplay ( pair_Product A B xf xs ) ) ) xs ).
    change ( Path B ( ds ( codisplay ( pair_Product A B xf xs ) ) ) ( second_Product A B ( pair_Product A B xf xs ) ) ).
    exact ( ids ( pair_Product A B xf xs ) ).
Defined.
(* from: originally defined by Hexirp *)

(** 直積型の余場合分けの恒等式です。 *)

Definition curry_Product@{ i j | } ( A : Type@{ i } ) ( B : Type@{ i } ) ( C : Type@{ j } ) ( f : Product A B -> C ) ( x : A ) ( y : B ) : C := f ( pair_Product A B x y ).
(* from: originally defined by Hexirp *)

(** 直積型のカリー化です。 *)

Definition uncurry_Product@{ i j | } ( A : Type@{ i } ) ( B : Type@{ i } ) ( C : Type@{ j } ) ( f : A -> B -> C ) ( x : Product A B ) : C := matching_Product@{ i j } A B C ( fun ( xf : A ) ( xs : B ) => f xf xs ) x.
(* from: originally defined by Hexirp *)

(** 直積型の非カリー化です。 *)

Definition map_Product@{ i j | } ( A : Type@{ i } ) ( B : Type@{ i } ) ( C : Type@{ j } ) ( D : Type@{ j } ) ( f : A -> C ) ( g : B -> D ) ( x : Product A B ) : Product C D := matching_Product A B ( Product C D ) ( fun ( xf : A ) ( xs : B ) => pair_Product C D ( f xf ) ( g xs ) ) x.
(* from: originally defined by Hexirp *)

(** 直積型の写像です。 *)