src/HOL/IOA/NTP/Impl.ML
changeset 1328 9a449a91425d
parent 1266 3ae9fe3c0f68
child 1465 5d7a7e439cec
equal deleted inserted replaced
1327:6c29cfab679c 1328:9a449a91425d
     4     Copyright   1994  TU Muenchen
     4     Copyright   1994  TU Muenchen
     5 
     5 
     6 The implementation --- Invariants
     6 The implementation --- Invariants
     7 *)
     7 *)
     8 
     8 
     9 open Abschannel;
     9 
       
    10 
       
    11 
       
    12 open Abschannel Impl;
    10 
    13 
    11 val impl_ioas =
    14 val impl_ioas =
    12   [Impl.impl_def,
    15   [Impl.impl_def,
    13    Sender.sender_ioa_def, 
    16    Sender.sender_ioa_def, 
    14    Receiver.receiver_ioa_def, 
    17    Receiver.receiver_ioa_def, 
    15    srch_ioa_thm RS eq_reflection,
    18    srch_ioa_thm RS eq_reflection,
    16    rsch_ioa_thm RS eq_reflection];
    19    rsch_ioa_thm RS eq_reflection];
    17 
    20 
    18 val transitions = [Sender.sender_trans_def, Receiver.receiver_trans_def,
    21 val transitions = [Sender.sender_trans_def, Receiver.receiver_trans_def,
    19             Abschannel.srch_trans_def, Abschannel.rsch_trans_def];
    22                    srch_trans_def, rsch_trans_def];
    20  
    23  
    21 
    24 
    22 Addsimps [ioa_triple_proj, starts_of_par, trans_of_par4,
    25 Addsimps [ioa_triple_proj, starts_of_par, trans_of_par4,
    23           in_sender_asig, in_receiver_asig, in_srch_asig,
    26           in_sender_asig, in_receiver_asig, in_srch_asig,
    24           in_rsch_asig, count_addm_simp, count_delm_simp,
    27           in_rsch_asig];
    25           Multiset.countm_empty_def, Multiset.delm_empty_def,
    28 Addcongs [let_weak_cong];
    26           (* Multiset.count_def, *) count_empty,
       
    27           Packet.hdr_def, Packet.msg_def];
       
    28 
    29 
    29 goal Impl.thy
    30 goal Impl.thy
    30   "fst(x) = sen(x)            & \
    31   "fst(x) = sen(x)            & \
    31 \  fst(snd(x)) = rec(x)       & \
    32 \  fst(snd(x)) = rec(x)       & \
    32 \  fst(snd(snd(x))) = srch(x) & \
    33 \  fst(snd(snd(x))) = srch(x) & \
    33 \  snd(snd(snd(x))) = rsch(x)";
    34 \  snd(snd(snd(x))) = rsch(x)";
    34 by(simp_tac (!simpset addsimps
    35 by(simp_tac (!simpset addsimps
    35              [Impl.sen_def,Impl.rec_def,Impl.srch_def,Impl.rsch_def]) 1);
    36              [sen_def,rec_def,srch_def,rsch_def]) 1);
    36 Addsimps [result()];
    37 Addsimps [result()];
    37 
    38 
    38 goal Impl.thy "a:actions(sender_asig)   \
    39 goal Impl.thy "a:actions(sender_asig)   \
    39 \            | a:actions(receiver_asig) \
    40 \            | a:actions(receiver_asig) \
    40 \            | a:actions(srch_asig)     \
    41 \            | a:actions(srch_asig)     \
    41 \            | a:actions(rsch_asig)";
    42 \            | a:actions(rsch_asig)";
    42   by(Action.action.induct_tac "a" 1);
    43   by(Action.action.induct_tac "a" 1);
    43   by(ALLGOALS (simp_tac (!simpset
    44   by(ALLGOALS (Simp_tac));
    44                          delsimps [actions_def,srch_asig_def,rsch_asig_def])));
       
    45 Addsimps [result()];
    45 Addsimps [result()];
    46 
    46 
       
    47 Delsimps [split_paired_All];
       
    48 
       
    49 
       
    50 (* Three Simp_sets in different sizes 
       
    51 ----------------------------------------------
       
    52 
       
    53 1) !simpset does not unfold the transition relations 
       
    54 2) ss unfolds transition relations 
       
    55 3) renname_ss unfolds transitions and the abstract channel *)
       
    56 
       
    57 
       
    58 val ss = (!simpset addcongs [if_weak_cong]
       
    59                    addsimps transitions);     
       
    60 val rename_ss = (ss addsimps unfold_renaming);
       
    61 
       
    62 
       
    63 
       
    64 val tac     = asm_simp_tac ((ss addcongs [conj_cong]) 
       
    65                             setloop (split_tac [expand_if]));
       
    66 val tac_ren = asm_simp_tac ((rename_ss addcongs [conj_cong]) 
       
    67                             setloop (split_tac [expand_if]));
       
    68 
       
    69 
    47 
    70 
    48 (* INVARIANT 1 *)
    71 (* INVARIANT 1 *)
    49 val ss = !simpset addcongs [let_weak_cong] delsimps
       
    50   [trans_of_def, starts_of_def, srch_asig_def, rsch_asig_def,
       
    51    asig_of_def, actions_def, srch_trans_def, rsch_trans_def];
       
    52 
    72 
    53 goalw Impl.thy impl_ioas "invariant impl_ioa inv1";
    73 goalw Impl.thy impl_ioas "invariant impl_ioa inv1";
    54 br invariantI 1;
    74 br invariantI 1;
    55 by(asm_full_simp_tac (ss
    75 by(asm_full_simp_tac (!simpset
    56    addsimps [Impl.inv1_def, Impl.hdr_sum_def, Sender.srcvd_def,
    76    addsimps [inv1_def, hdr_sum_def, Sender.srcvd_def,
    57              Sender.ssent_def, Receiver.rsent_def,Receiver.rrcvd_def]) 1);
    77              Sender.ssent_def, Receiver.rsent_def,Receiver.rrcvd_def]) 1);
    58 
    78 
    59 by(simp_tac (ss delsimps [trans_of_par4]
    79 by(simp_tac (!simpset delsimps [trans_of_par4]
    60                       addsimps [fork_lemma,Impl.inv1_def]) 1);
    80                 addsimps [fork_lemma,inv1_def]) 1);
    61 
    81 
    62 (* Split proof in two *)
    82 (* Split proof in two *)
    63 by (rtac conjI 1);
    83 by (rtac conjI 1); 
    64 
    84 
    65 (* First half *)
    85 (* First half *)
    66 by(asm_full_simp_tac (ss addsimps [Impl.inv1_def]) 1);
    86 by(asm_full_simp_tac (!simpset addsimps [Impl.inv1_def]) 1);
    67 br Action.action.induct 1;
    87 br Action.action.induct 1;
    68 
    88 
    69 val tac = asm_simp_tac (ss delsimps [srch_ioa_def, rsch_ioa_def]
       
    70                                 addcongs [if_weak_cong, conj_cong] 
       
    71                                 addsimps (Suc_pred_lemma :: transitions)
       
    72                                 setloop (split_tac [expand_if]));
       
    73 val tac_abs = asm_simp_tac (!simpset
       
    74             delsimps [srch_asig_def, rsch_asig_def, actions_def,
       
    75                       srch_trans_def, rsch_trans_def]
       
    76             addcongs [if_weak_cong, conj_cong] 
       
    77             addsimps (Suc_pred_lemma :: transitions)
       
    78             setloop (split_tac [expand_if]));
       
    79 by (EVERY1[tac, tac, tac, tac]);
    89 by (EVERY1[tac, tac, tac, tac]);
    80 by (tac 1);
    90 by (tac 1);
    81 by (tac_abs 1);
    91 by (tac_ren 1);
    82 
    92 
    83 (* 5 + 1 *)
    93 (* 5 + 1 *)
    84 
    94 
    85 by (tac 1);
    95 by (tac 1);
    86 by (tac_abs 1);
    96 by (tac_ren 1);
    87 
    97 
    88 (* 4 + 1 *)
    98 (* 4 + 1 *)
    89 by(EVERY1[tac, tac, tac, tac]);
    99 by(EVERY1[tac, tac, tac, tac]);
    90 
   100 
    91 
   101 
    92 (* Now the other half *)
   102 (* Now the other half *)
    93 by(asm_full_simp_tac (ss addsimps [Impl.inv1_def]) 1);
   103 by(asm_full_simp_tac (!simpset addsimps [Impl.inv1_def]) 1);
    94 br Action.action.induct 1;
   104 br Action.action.induct 1;
    95 by(EVERY1[tac, tac]);
   105 by(EVERY1[tac, tac]);
    96 
   106 
    97 (* detour 1 *)
   107 (* detour 1 *)
    98 by (tac 1);
   108 by (tac 1);
    99 by (tac_abs 1);
   109 by (tac_ren 1);
   100 by (rtac impI 1);
   110 by (rtac impI 1);
   101 by (REPEAT (etac conjE 1));
   111 by (REPEAT (etac conjE 1));
   102 by (asm_simp_tac (ss addsimps [Impl.hdr_sum_def, Multiset.count_def,
   112 by (asm_simp_tac (!simpset addsimps [hdr_sum_def, Multiset.count_def,
   103                                     Multiset.countm_nonempty_def]
   113                                Multiset.countm_nonempty_def]
   104                           setloop (split_tac [expand_if])) 1);
   114                      setloop (split_tac [expand_if])) 1);
   105 (* detour 2 *)
   115 (* detour 2 *)
   106 by (tac 1);
   116 by (tac 1);
   107 by (tac_abs 1);
   117 by (tac_ren 1);
   108 by (rtac impI 1);
   118 by (rtac impI 1);
   109 by (REPEAT (etac conjE 1));
   119 by (REPEAT (etac conjE 1));
   110 by (asm_full_simp_tac (ss addsimps [Impl.hdr_sum_def, 
   120 by (asm_full_simp_tac (!simpset addsimps [Impl.hdr_sum_def, 
   111                                          Multiset.count_def,
   121                                          Multiset.count_def,
   112                                          Multiset.countm_nonempty_def,
   122                                          Multiset.countm_nonempty_def,
   113                                          Multiset.delm_nonempty_def,
   123                                          Multiset.delm_nonempty_def,
   114                                          left_plus_cancel,
   124                                          left_plus_cancel,
   115                                          left_plus_cancel_inside_succ,
   125                                          left_plus_cancel_inside_succ,
   126 by (assume_tac 1);
   136 by (assume_tac 1);
   127 by (assume_tac 1);
   137 by (assume_tac 1);
   128 
   138 
   129 by (rtac (countm_done_delm RS mp RS sym) 1);
   139 by (rtac (countm_done_delm RS mp RS sym) 1);
   130 by (rtac refl 1);
   140 by (rtac refl 1);
   131 by (asm_simp_tac (ss addsimps [Multiset.count_def]) 1);
   141 by (asm_simp_tac (!simpset addsimps [Multiset.count_def]) 1);
   132 
   142 
   133 by (rtac impI 1);
   143 by (rtac impI 1);
   134 by (asm_full_simp_tac (ss addsimps [neg_flip]) 1);
   144 by (asm_full_simp_tac (!simpset addsimps [neg_flip]) 1);
   135 by (hyp_subst_tac 1);
   145 by (hyp_subst_tac 1);
   136 by (rtac countm_spurious_delm 1);
   146 by (rtac countm_spurious_delm 1);
   137 by (Simp_tac 1);
   147 by (Simp_tac 1);
   138 
   148 
   139 by (EVERY1[tac, tac, tac, tac, tac, tac]);
   149 by (EVERY1[tac, tac, tac, tac, tac, tac]);
   146 
   156 
   147   goal Impl.thy "invariant impl_ioa inv2";
   157   goal Impl.thy "invariant impl_ioa inv2";
   148 
   158 
   149   by (rtac invariantI1 1); 
   159   by (rtac invariantI1 1); 
   150   (* Base case *)
   160   (* Base case *)
   151   by (asm_full_simp_tac (ss addsimps (Impl.inv2_def ::
   161   by (asm_full_simp_tac (!simpset addsimps (inv2_def ::
   152                                            (receiver_projections 
   162                           (receiver_projections 
   153                                             @ sender_projections @ impl_ioas)))
   163                            @ sender_projections @ impl_ioas)))
   154       1);
   164       1);
   155 
   165 
   156   by (asm_simp_tac (ss addsimps impl_ioas) 1);
   166   by (asm_simp_tac (!simpset addsimps impl_ioas) 1);
   157   by (Action.action.induct_tac "a" 1);
   167   by (Action.action.induct_tac "a" 1);
   158 
   168 
   159   (* 10 cases. First 4 are simple, since state doesn't change wrt. invariant *)
   169   (* 10 cases. First 4 are simple, since state doesn't change *)
   160   (* 10 *)
   170 
   161   by (asm_simp_tac (ss delsimps [srch_ioa_def, rsch_ioa_def]
   171 val tac2 = asm_full_simp_tac (ss addsimps [inv2_def]);
   162                             addsimps (Impl.inv2_def::transitions)) 1);
   172 
   163   (* 9 *)
   173   (* 10 - 7 *)
   164   by (asm_simp_tac (ss delsimps [srch_ioa_def, rsch_ioa_def]
   174   by (EVERY1[tac2,tac2,tac2,tac2]);
   165                             addsimps (Impl.inv2_def::transitions)) 1);
       
   166   (* 8 *)
       
   167   by (asm_simp_tac (ss delsimps [srch_ioa_def, rsch_ioa_def]
       
   168                             addsimps (Impl.inv2_def::transitions)) 2);
       
   169   (* 7 *)
       
   170   by (asm_simp_tac (ss delsimps [srch_ioa_def, rsch_ioa_def]
       
   171                             addsimps (Impl.inv2_def::transitions)) 3);
       
   172   (* 6 *)
   175   (* 6 *)
   173   by(forward_tac [rewrite_rule [Impl.inv1_def]
   176   by(forward_tac [rewrite_rule [Impl.inv1_def]
   174                                (inv1 RS invariantE) RS conjunct1] 1);
   177                                (inv1 RS invariantE) RS conjunct1] 1);
   175   by (asm_full_simp_tac (ss delsimps [srch_ioa_def, rsch_ioa_def]
   178   (* 6 - 5 *)
   176                                  addsimps ([leq_imp_leq_suc,Impl.inv2_def]
   179   by (EVERY1[tac2,tac2]);
   177                                            @ transitions)) 1);
   180 
   178   (* 5 *)
       
   179   by (asm_full_simp_tac (ss delsimps [srch_ioa_def, rsch_ioa_def]
       
   180                                  addsimps ([leq_imp_leq_suc,Impl.inv2_def]
       
   181                                            @ transitions)) 1);
       
   182   (* 4 *)
   181   (* 4 *)
   183   by (forward_tac [rewrite_rule [Impl.inv1_def]
   182   by (forward_tac [rewrite_rule [Impl.inv1_def]
   184                                 (inv1 RS invariantE) RS conjunct1] 1);
   183                                 (inv1 RS invariantE) RS conjunct1] 1);
   185   by (asm_full_simp_tac (ss delsimps [srch_ioa_def, rsch_ioa_def]
   184   by (tac2 1);
   186                                  addsimps (Impl.inv2_def :: transitions)) 1);
       
   187   by (fast_tac (HOL_cs addDs [add_leD1,leD]) 1);
   185   by (fast_tac (HOL_cs addDs [add_leD1,leD]) 1);
   188 
   186 
   189   (* 3 *)
   187   (* 3 *)
   190   by (forward_tac [rewrite_rule [Impl.inv1_def] (inv1 RS invariantE)] 1);
   188   by (forward_tac [rewrite_rule [Impl.inv1_def] (inv1 RS invariantE)] 1);
   191 
   189 
   192   by (asm_full_simp_tac (ss delsimps [srch_ioa_def, rsch_ioa_def]
   190   by (tac2 1);
   193                                  addsimps (Impl.inv2_def :: transitions)) 1);
       
   194   by (fold_tac [rewrite_rule [Packet.hdr_def]Impl.hdr_sum_def]);
   191   by (fold_tac [rewrite_rule [Packet.hdr_def]Impl.hdr_sum_def]);
   195   by (fast_tac (HOL_cs addDs [add_leD1,leD]) 1);
   192   by (fast_tac (HOL_cs addDs [add_leD1,leD]) 1);
   196 
   193 
   197   (* 2 *)
   194   (* 2 *)
   198   by (asm_full_simp_tac (ss delsimps [srch_ioa_def, rsch_ioa_def]
   195   by (tac2 1);
   199                                  addsimps (Impl.inv2_def :: transitions)) 1);
       
   200   by(forward_tac [rewrite_rule [Impl.inv1_def]
   196   by(forward_tac [rewrite_rule [Impl.inv1_def]
   201                                (inv1 RS invariantE) RS conjunct1] 1);
   197                                (inv1 RS invariantE) RS conjunct1] 1);
   202   by (rtac impI 1);
   198   by (rtac impI 1);
   203   by (rtac impI 1);
   199   by (rtac impI 1);
   204   by (REPEAT (etac conjE 1));
   200   by (REPEAT (etac conjE 1));
   205   by (dres_inst_tac [("k","count (rsch s) (~sbit(sen s))")] 
   201   by (dres_inst_tac [("k","count (rsch s) (~sbit(sen s))")] 
   206                      (standard(leq_add_leq RS mp)) 1);
   202                      (standard(leq_add_leq RS mp)) 1);
   207   by (asm_full_simp_tac ss 1);
   203   by (Asm_full_simp_tac 1);
   208 
   204 
   209   (* 1 *)
   205   (* 1 *)
   210   by (asm_full_simp_tac (ss delsimps [srch_ioa_def, rsch_ioa_def]
   206   by (tac2 1);
   211                                  addsimps (Impl.inv2_def :: transitions)) 1);
       
   212   by(forward_tac [rewrite_rule [Impl.inv1_def]
   207   by(forward_tac [rewrite_rule [Impl.inv1_def]
   213                                (inv1 RS invariantE) RS conjunct2] 1);
   208                                (inv1 RS invariantE) RS conjunct2] 1);
   214   by (rtac impI 1);
   209   by (rtac impI 1);
   215   by (rtac impI 1);
   210   by (rtac impI 1);
   216   by (REPEAT (etac conjE 1));
   211   by (REPEAT (etac conjE 1));
   217   by (fold_tac  [rewrite_rule[Packet.hdr_def]Impl.hdr_sum_def]);
   212   by (fold_tac  [rewrite_rule[Packet.hdr_def]Impl.hdr_sum_def]);
   218   by (dres_inst_tac [("k","hdr_sum (srch s) (sbit(sen s))")] 
   213   by (dres_inst_tac [("k","hdr_sum (srch s) (sbit(sen s))")] 
   219                      (standard(leq_add_leq RS mp)) 1);
   214                      (standard(leq_add_leq RS mp)) 1);
   220   by (asm_full_simp_tac ss 1);
   215   by (Asm_full_simp_tac 1);
   221 qed "inv2";
   216 qed "inv2";
   222 
   217 
   223 
   218 
   224 (* INVARIANT 3 *)
   219 (* INVARIANT 3 *)
   225 
       
   226 val ss = ss delsimps [srch_ioa_def, rsch_ioa_def, Packet.hdr_def];
       
   227 
   220 
   228 goal Impl.thy "invariant impl_ioa inv3";
   221 goal Impl.thy "invariant impl_ioa inv3";
   229 
   222 
   230   by (rtac invariantI 1); 
   223   by (rtac invariantI 1); 
   231   (* Base case *)
   224   (* Base case *)
   232   by (asm_full_simp_tac (ss addsimps 
   225   by (asm_full_simp_tac (!simpset addsimps 
   233                     (Impl.inv3_def :: (receiver_projections 
   226                     (Impl.inv3_def :: (receiver_projections 
   234                                        @ sender_projections @ impl_ioas))) 1);
   227                                        @ sender_projections @ impl_ioas))) 1);
   235 
   228 
   236   by (asm_simp_tac (ss addsimps impl_ioas) 1);
   229   by (asm_simp_tac (!simpset addsimps impl_ioas) 1);
   237   by (Action.action.induct_tac "a" 1);
   230   by (Action.action.induct_tac "a" 1);
   238 
   231 
   239   (* 10 *)
   232 val tac3 = asm_full_simp_tac (ss addsimps [inv3_def] 
   240   by (asm_full_simp_tac (ss
   233                               setloop (split_tac [expand_if]));
   241               addsimps (append_cons::not_hd_append::Impl.inv3_def::transitions)
   234 
   242               setloop (split_tac [expand_if])) 1);
   235   (* 10 - 8 *)
   243 
   236 
   244   (* 9 *)
   237   by (EVERY1[tac3,tac3,tac3]);
   245   by (asm_full_simp_tac (ss
   238  
   246               addsimps (append_cons::not_hd_append::Impl.inv3_def::transitions)
   239   by (tac_ren 1);
   247               setloop (split_tac [expand_if])) 1);
   240   by (strip_tac  1 THEN REPEAT (etac conjE 1));
   248 
       
   249   (* 8 *)
       
   250   by (asm_full_simp_tac (ss
       
   251               addsimps (append_cons::not_hd_append::Impl.inv3_def::transitions)
       
   252               setloop (split_tac [expand_if])) 1);
       
   253   by (tac_abs 1);
       
   254   by (strip_tac  1 THEN REPEAT (etac conjE 1));
       
   255   by (asm_full_simp_tac (ss addsimps [cons_imp_not_null]) 1);
       
   256 
       
   257   by (hyp_subst_tac 1);
   241   by (hyp_subst_tac 1);
   258   by (etac exE 1);
   242   by (etac exE 1);
   259   by (Asm_full_simp_tac 1);
   243   by (Asm_full_simp_tac 1);
   260 
   244 
   261   (* 7 *)
   245   (* 7 *)
   262   by (asm_full_simp_tac (ss addsimps 
   246   by (tac3 1);
   263       (Suc_pred_lemma::append_cons::not_hd_append::Impl.inv3_def::transitions)
   247   by (tac_ren 1);
   264                   setloop (split_tac [expand_if])) 1); 
       
   265   by (tac_abs 1);
       
   266   by (fast_tac HOL_cs 1);
   248   by (fast_tac HOL_cs 1);
   267 
   249 
   268   (* 6 *)
   250   (* 6 - 3 *)
   269   by (asm_full_simp_tac (ss addsimps 
   251 
   270                   (append_cons::not_hd_append::Impl.inv3_def::transitions)
   252   by (EVERY1[tac3,tac3,tac3,tac3]);
   271                   setloop (split_tac [expand_if])) 1);
       
   272   (* 5 *)
       
   273   by (asm_full_simp_tac (ss addsimps 
       
   274                   (append_cons::not_hd_append::Impl.inv3_def::transitions)
       
   275                   setloop (split_tac [expand_if])) 1);
       
   276   (* 4 *)
       
   277   by (asm_full_simp_tac (ss addsimps 
       
   278                   (append_cons::not_hd_append::Impl.inv3_def::transitions)
       
   279                   setloop (split_tac [expand_if])) 1);
       
   280 
       
   281   (* 3 *)
       
   282   by (asm_full_simp_tac (ss addsimps 
       
   283                   (append_cons::not_hd_append::Impl.inv3_def::transitions)
       
   284                   setloop (split_tac [expand_if])) 1);
       
   285 
   253 
   286   (* 2 *)
   254   (* 2 *)
   287   by (asm_full_simp_tac (ss addsimps transitions) 1);
   255   by (asm_full_simp_tac ss 1);
   288   by (simp_tac (ss addsimps [Impl.inv3_def]) 1);
   256   by (simp_tac (!simpset addsimps [inv3_def]) 1);
   289   by (strip_tac  1 THEN REPEAT (etac conjE 1));
   257   by (strip_tac  1 THEN REPEAT (etac conjE 1));
   290   by (rtac (imp_or_lem RS iffD2) 1);
   258   by (rtac (imp_or_lem RS iffD2) 1);
   291   by (rtac impI 1);
   259   by (rtac impI 1);
   292   by (forward_tac [rewrite_rule [Impl.inv2_def] (inv2 RS invariantE)] 1);
   260   by (forward_tac [rewrite_rule [Impl.inv2_def] (inv2 RS invariantE)] 1);
   293   by (asm_full_simp_tac ss 1);
   261   by (Asm_full_simp_tac 1);
   294   by (REPEAT (etac conjE 1));
   262   by (REPEAT (etac conjE 1));
   295   by (res_inst_tac [("j","count (ssent(sen s)) (~sbit(sen s))"),
   263   by (res_inst_tac [("j","count (ssent(sen s)) (~sbit(sen s))"),
   296                     ("k","count (rsent(rec s)) (sbit(sen s))")] le_trans 1);
   264                     ("k","count (rsent(rec s)) (sbit(sen s))")] le_trans 1);
   297   by (forward_tac [rewrite_rule [Impl.inv1_def]
   265   by (forward_tac [rewrite_rule [inv1_def]
   298                                 (inv1 RS invariantE) RS conjunct2] 1);
   266                                 (inv1 RS invariantE) RS conjunct2] 1);
   299   by (asm_full_simp_tac (ss addsimps
   267   by (asm_full_simp_tac (!simpset addsimps
   300                          [Impl.hdr_sum_def, Multiset.count_def]) 1);
   268                          [hdr_sum_def, Multiset.count_def]) 1);
   301   by (rtac (less_eq_add_cong RS mp RS mp) 1);
   269   by (rtac (less_eq_add_cong RS mp RS mp) 1);
   302   by (rtac countm_props 1);
   270   by (rtac countm_props 1);
   303   by (simp_tac (ss addsimps [Packet.hdr_def]) 1);
   271   by (Simp_tac 1);
   304   by (rtac countm_props 1);
   272   by (rtac countm_props 1);
   305   by (simp_tac (ss addsimps [Packet.hdr_def]) 1);
   273   by (Simp_tac 1);
   306   by (assume_tac 1);
   274   by (assume_tac 1);
   307 
   275 
   308   (* 1 *)
   276   (* 1 *)
   309   by (asm_full_simp_tac (ss addsimps 
   277   by (tac3 1);
   310                   (append_cons::not_hd_append::Impl.inv3_def::transitions)
       
   311                   setloop (split_tac [expand_if])) 1);
       
   312   by (strip_tac  1 THEN REPEAT (etac conjE 1));
   278   by (strip_tac  1 THEN REPEAT (etac conjE 1));
   313   by (rtac (imp_or_lem RS iffD2) 1);
   279   by (rtac (imp_or_lem RS iffD2) 1);
   314   by (rtac impI 1);
   280   by (rtac impI 1);
   315   by (forward_tac [rewrite_rule [Impl.inv2_def] (inv2 RS invariantE)] 1);
   281   by (forward_tac [rewrite_rule [Impl.inv2_def] (inv2 RS invariantE)] 1);
   316   by (asm_full_simp_tac ss 1);
   282   by (Asm_full_simp_tac 1);
   317   by (REPEAT (etac conjE 1));
   283   by (REPEAT (etac conjE 1));
   318   by (dtac mp 1);
   284   by (dtac mp 1);
   319   by (assume_tac 1);
   285   by (assume_tac 1);
   320   by (etac allE 1);
   286   by (etac allE 1);
   321   by (dtac (imp_or_lem RS iffD1) 1);
   287   by (dtac (imp_or_lem RS iffD1) 1);
   329 
   295 
   330 goal Impl.thy "invariant impl_ioa inv4";
   296 goal Impl.thy "invariant impl_ioa inv4";
   331 
   297 
   332   by (rtac invariantI 1); 
   298   by (rtac invariantI 1); 
   333   (* Base case *)
   299   (* Base case *)
   334   by (asm_full_simp_tac (ss addsimps 
   300   by (asm_full_simp_tac (!simpset addsimps 
   335                     (Impl.inv4_def :: (receiver_projections 
   301                     (Impl.inv4_def :: (receiver_projections 
   336                                        @ sender_projections @ impl_ioas))) 1);
   302                                        @ sender_projections @ impl_ioas))) 1);
   337 
   303 
   338   by (asm_simp_tac (ss addsimps impl_ioas) 1);
   304   by (asm_simp_tac (!simpset addsimps impl_ioas) 1);
   339   by (Action.action.induct_tac "a" 1);
   305   by (Action.action.induct_tac "a" 1);
   340 
   306 
   341   (* 10 *)
   307 val tac4 =  asm_full_simp_tac (ss addsimps [inv4_def]
   342   by (asm_full_simp_tac (ss addsimps (append_cons::Impl.inv4_def::transitions)
   308                               setloop (split_tac [expand_if]));
   343                   setloop (split_tac [expand_if])) 1);
   309 
   344 
   310   (* 10 - 2 *)
   345   (* 9 *)
   311   
   346   by (asm_full_simp_tac (ss addsimps (append_cons::Impl.inv4_def::transitions)
   312   by (EVERY1[tac4,tac4,tac4,tac4,tac4,tac4,tac4,tac4,tac4]);
   347                   setloop (split_tac [expand_if])) 1);
   313  
   348 
   314  (* 2 b *)
   349   (* 8 *)
   315  
   350   by (asm_full_simp_tac (ss addsimps (append_cons::Impl.inv4_def::transitions)
       
   351                   setloop (split_tac [expand_if])) 1);
       
   352   (* 7 *)
       
   353   by (asm_full_simp_tac (ss addsimps (append_cons::Impl.inv4_def::transitions)
       
   354                   setloop (split_tac [expand_if])) 1);
       
   355 
       
   356   (* 6 *)
       
   357   by (asm_full_simp_tac (ss addsimps (append_cons::Impl.inv4_def::transitions)
       
   358                   setloop (split_tac [expand_if])) 1);
       
   359 
       
   360   (* 5 *)
       
   361   by (asm_full_simp_tac (ss addsimps (append_cons::Impl.inv4_def::transitions)
       
   362                   setloop (split_tac [expand_if])) 1);
       
   363 
       
   364   (* 4 *)
       
   365   by (asm_full_simp_tac (ss addsimps (append_cons::Impl.inv4_def::transitions)
       
   366                   setloop (split_tac [expand_if])) 1);
       
   367 
       
   368   (* 3 *)
       
   369   by (asm_full_simp_tac (ss addsimps (append_cons::Impl.inv4_def::transitions)
       
   370                   setloop (split_tac [expand_if])) 1);
       
   371 
       
   372   (* 2 *)
       
   373   by (asm_full_simp_tac (ss addsimps (append_cons::Impl.inv4_def::transitions)
       
   374                   setloop (split_tac [expand_if])) 1);
       
   375 
       
   376   by (strip_tac  1 THEN REPEAT (etac conjE 1));
   316   by (strip_tac  1 THEN REPEAT (etac conjE 1));
   377   by(forward_tac [rewrite_rule [Impl.inv2_def]
   317   by(forward_tac [rewrite_rule [Impl.inv2_def]
   378                                (inv2 RS invariantE)] 1);
   318                                (inv2 RS invariantE)] 1);
   379  
   319   by (tac4 1);
   380   by (Asm_full_simp_tac 1);
   320   by (Asm_full_simp_tac 1);
   381 
   321 
   382   (* 1 *)
   322   (* 1 *)
   383   by (asm_full_simp_tac (ss addsimps (append_cons::Impl.inv4_def::transitions)
   323   by (tac4 1);
   384                   setloop (split_tac [expand_if])) 1);
       
   385   by (strip_tac  1 THEN REPEAT (etac conjE 1));
   324   by (strip_tac  1 THEN REPEAT (etac conjE 1));
   386   by (rtac ccontr 1);
   325   by (rtac ccontr 1);
   387   by(forward_tac [rewrite_rule [Impl.inv2_def]
   326   by(forward_tac [rewrite_rule [Impl.inv2_def]
   388                                (inv2 RS invariantE)] 1);
   327                                (inv2 RS invariantE)] 1);
   389   by(forward_tac [rewrite_rule [Impl.inv3_def]
   328   by(forward_tac [rewrite_rule [Impl.inv3_def]