src/HOL/IOA/ABP/Correctness.ML
author lcp
Tue, 25 Apr 1995 11:14:03 +0200
changeset 1072 0140ff702b23
parent 1050 0c36c6a52a1d
child 1138 82fd99d5a6ff
permissions -rw-r--r--
updated version
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1050
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
     1
 (*  Title:      HOL/IOA/ABP/Correctness.ML
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
     2
    ID:         $Id$
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
     3
    Author:     Tobias Nipkow & Olaf Mueller
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
     4
    Copyright   1995  TU Muenchen
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
     5
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
     6
*)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
     7
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
     8
open Correctness; open Abschannel; open Abschannel_finite;
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
     9
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    10
goal Abschannel.thy "(? x.x=P & Q(x)) = Q(P)";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    11
by (fast_tac HOL_cs 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    12
qed"exis_elim";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    13
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    14
val abschannel_ss = action_ss addsimps 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    15
 ([srch_asig_def, rsch_asig_def, rsch_ioa_def, srch_ioa_def, ch_ioa_def, 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    16
   ch_asig_def, srch_actions_def, rsch_actions_def, rename_def, asig_of_def, 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    17
   actions_def, exis_elim, srch_trans_def, rsch_trans_def, ch_trans_def, 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    18
   trans_of_def] 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    19
   @ Option.option.simps @ act.simps @ asig_projections @ set_lemmas);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    20
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    21
val abschannel_fin = [srch_fin_asig_def, rsch_fin_asig_def, 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    22
                      rsch_fin_ioa_def, srch_fin_ioa_def, 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    23
                      ch_fin_ioa_def,ch_fin_trans_def,ch_fin_asig_def];
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    24
val abschannel_fin_ss = abschannel_ss addsimps abschannel_fin;
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    25
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    26
val impl_ioas =  [Sender.sender_ioa_def,Receiver.receiver_ioa_def];
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    27
val impl_trans = [Sender.sender_trans_def,Receiver.receiver_trans_def];
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    28
val impl_asigs = [Sender.sender_asig_def,Receiver.receiver_asig_def];
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    29
val impl_ss = merge_ss(action_ss,list_ss) 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    30
              addcongs [let_weak_cong] 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    31
              addsimps [Let_def, ioa_triple_proj, starts_of_par];
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    32
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    33
val env_ioas = [Env.env_ioa_def,Env.env_asig_def,Env.env_trans_def];
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    34
val hom_ioas = env_ioas @ impl_ioas @ impl_trans @ impl_asigs @ 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    35
               asig_projections @ set_lemmas;
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    36
val hom_ss = (impl_ss addsimps hom_ioas);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    37
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    38
val red_ss = impl_ss addsimps [reduce_Nil,reduce_Cons];
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    39
val red_ss_ch = merge_ss(abschannel_fin_ss,red_ss);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    40
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    41
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    42
(* auxiliary function *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    43
fun rotate n i = EVERY(replicate n (etac revcut_rl i));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    44
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    45
(* lemmas about reduce *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    46
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    47
goal Correctness.thy "(reduce(l)=[]) = (l=[])";  
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    48
 by (rtac iffI 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    49
 by (subgoal_tac "(l~=[]) --> (reduce(l)~=[])" 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    50
 by (fast_tac HOL_cs 1); 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    51
 by (List.list.induct_tac "l" 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    52
 by (simp_tac red_ss 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    53
 by (simp_tac red_ss 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    54
 by (rtac (expand_list_case RS iffD2) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    55
 by (asm_full_simp_tac list_ss 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    56
 by (REPEAT (rtac allI 1)); 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    57
 by (rtac impI 1); 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    58
 by (hyp_subst_tac 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    59
 by (rtac (expand_if RS ssubst) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    60
 by (asm_full_simp_tac list_ss 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    61
 by (asm_full_simp_tac red_ss 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    62
val l_iff_red_nil = result();
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    63
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    64
goal Correctness.thy "s~=[] --> hd(s)=hd(reduce(s))";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    65
by (List.list.induct_tac "s" 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    66
by (simp_tac red_ss 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    67
by (case_tac "list =[]" 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    68
by (asm_full_simp_tac red_ss 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    69
(* main case *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    70
by (rotate 1 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    71
by (asm_full_simp_tac list_ss 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    72
by (simp_tac red_ss 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    73
by (rtac (expand_list_case RS iffD2) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    74
by (asm_full_simp_tac list_ss 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    75
by (REPEAT (rtac allI 1)); 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    76
 by (rtac impI 1); 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    77
by (rtac (expand_if RS ssubst) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    78
by (REPEAT(hyp_subst_tac 1));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    79
by (etac subst 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    80
by (simp_tac list_ss 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    81
qed"hd_is_reduce_hd";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    82
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    83
(* to be used in the following Lemma *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    84
goal Correctness.thy "l~=[] --> reverse(reduce(l))~=[]";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    85
by (List.list.induct_tac "l" 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    86
by (simp_tac red_ss 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    87
by (case_tac "list =[]" 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    88
by (asm_full_simp_tac (red_ss addsimps [reverse_Cons]) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    89
(* main case *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    90
by (rotate 1 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    91
by (asm_full_simp_tac red_ss 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    92
by (cut_inst_tac [("l","list")] cons_not_nil 1); 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    93
by (asm_full_simp_tac list_ss 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    94
by (REPEAT (etac exE 1));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    95
by (asm_simp_tac list_ss 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    96
by (rtac (expand_if RS ssubst) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    97
by (hyp_subst_tac 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    98
by (asm_full_simp_tac (list_ss addsimps [reverse_Cons]) 1); 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
    99
qed"rev_red_not_nil";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   100
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   101
(* shows applicability of the induction hypothesis of the following Lemma 1 *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   102
goal Correctness.thy "!!l.[| l~=[] |] ==>   \
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   103
\   hd(reverse(reduce(a#l))) = hd(reverse(reduce(l)))";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   104
 by (simp_tac red_ss 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   105
 by (rtac (expand_list_case RS iffD2) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   106
 by (asm_full_simp_tac list_ss 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   107
 by (REPEAT (rtac allI 1)); 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   108
 by (rtac impI 1); 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   109
 by (rtac (expand_if RS ssubst) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   110
 by (asm_full_simp_tac (list_ss addsimps [reverse_Cons,hd_append,
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   111
                          (rev_red_not_nil RS mp)])  1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   112
qed"last_ind_on_first";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   113
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   114
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   115
(* Main Lemma 1 for S_pkt in showing that reduce is refinement  *) 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   116
goal Correctness.thy 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   117
   "if x=hd(reverse(reduce(l))) & reduce(l)~=[] then   \
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   118
\      reduce(l@[x])=reduce(l) else                  \
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   119
\      reduce(l@[x])=reduce(l)@[x]"; 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   120
by (rtac (expand_if RS ssubst) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   121
by (rtac conjI 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   122
(* --> *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   123
by (List.list.induct_tac "l" 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   124
by (simp_tac red_ss 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   125
by (case_tac "list=[]" 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   126
 by (asm_full_simp_tac (red_ss  addsimps [reverse_Nil,reverse_Cons]) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   127
 by (rtac impI 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   128
by (simp_tac red_ss 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   129
by (cut_inst_tac [("l","list")] cons_not_nil 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   130
 by (asm_full_simp_tac impl_ss 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   131
 by (REPEAT (etac exE 1));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   132
 by (hyp_subst_tac 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   133
by (asm_full_simp_tac (impl_ss addsimps [last_ind_on_first,l_iff_red_nil]) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   134
(* <-- *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   135
by (simp_tac (red_ss addsimps [and_de_morgan_and_absorbe,l_iff_red_nil]) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   136
by (List.list.induct_tac "l" 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   137
by (simp_tac red_ss 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   138
by (case_tac "list=[]" 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   139
 by (asm_full_simp_tac (red_ss  addsimps [reverse_Nil,reverse_Cons]) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   140
by (rtac (expand_if RS ssubst) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   141
 by (fast_tac HOL_cs 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   142
 by (rtac impI 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   143
by (simp_tac red_ss 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   144
by (cut_inst_tac [("l","list")] cons_not_nil 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   145
 by (asm_full_simp_tac impl_ss 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   146
 by (REPEAT (etac exE 1));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   147
 by (hyp_subst_tac 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   148
by (asm_full_simp_tac (impl_ss addsimps [last_ind_on_first,l_iff_red_nil]) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   149
by (rtac (expand_if RS ssubst) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   150
by (rtac (expand_if RS ssubst) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   151
by (asm_full_simp_tac impl_ss 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   152
qed"reduce_hd";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   153
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   154
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   155
(* Main Lemma 2 for R_pkt in showing that reduce is refinement *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   156
goal Correctness.thy 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   157
  "!! s. [| s~=[] |] ==>  \
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   158
\    if hd(s)=hd(tl(s)) & tl(s)~=[] then    \
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   159
\      reduce(tl(s))=reduce(s) else      \
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   160
\      reduce(tl(s))=tl(reduce(s))"; 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   161
by (cut_inst_tac [("l","s")] cons_not_nil 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   162
by (asm_full_simp_tac red_ss 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   163
by (REPEAT (etac exE 1));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   164
by (asm_full_simp_tac red_ss 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   165
by (rtac (expand_if RS ssubst) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   166
by (rtac conjI 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   167
by (simp_tac (red_ss addsimps [and_de_morgan_and_absorbe]) 2);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   168
by (ALLGOALS (EVERY'[rtac impI,etac conjE,cut_inst_tac [("l","xs")] cons_not_nil,asm_full_simp_tac red_ss]));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   169
by (REPEAT (etac exE 1));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   170
by (REPEAT (etac exE 2));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   171
by (hyp_subst_tac 2);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   172
by (ALLGOALS (asm_full_simp_tac red_ss));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   173
val reduce_tl =result();
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   174
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   175
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   176
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   177
goal Correctness.thy 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   178
      "is_weak_pmap reduce ch_ioa ch_fin_ioa";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   179
by (simp_tac (red_ss addsimps [Solve.is_weak_pmap_def]) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   180
by (rtac conjI 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   181
(* start states *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   182
by (simp_tac red_ss_ch 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   183
br ballI 1;
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   184
by (asm_full_simp_tac red_ss_ch 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   185
(* main-part *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   186
by (REPEAT (rtac allI 1));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   187
by (rtac imp_conj_lemma 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   188
by (act.induct_tac "a" 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   189
(* 2 cases *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   190
by (ALLGOALS (simp_tac (red_ss_ch addsimps [externals_def])));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   191
(* fst case *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   192
 by (rtac impI 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   193
 by (rtac disjI2 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   194
by (rtac reduce_hd 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   195
(* snd case *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   196
 by (rtac impI 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   197
 by (REPEAT (etac conjE 1));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   198
 by (etac disjE 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   199
by (asm_full_simp_tac (red_ss addsimps [l_iff_red_nil]) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   200
by (etac (hd_is_reduce_hd RS mp) 1); 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   201
by (asm_full_simp_tac (red_ss addsimps [l_iff_red_nil]) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   202
by (rtac conjI 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   203
by (etac (hd_is_reduce_hd RS mp) 1); 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   204
by (rtac (bool_if_impl_or RS mp) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   205
by (etac reduce_tl 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   206
qed"channel_abstraction";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   207
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   208
goal Correctness.thy 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   209
      "is_weak_pmap reduce srch_ioa srch_fin_ioa";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   210
by (simp_tac (list_ss addsimps [srch_fin_ioa_def,rsch_fin_ioa_def,
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   211
 srch_ioa_def,rsch_ioa_def,rename_through_pmap,channel_abstraction]) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   212
qed"sender_abstraction";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   213
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   214
goal Correctness.thy 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   215
      "is_weak_pmap reduce rsch_ioa rsch_fin_ioa";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   216
by (simp_tac (list_ss addsimps [srch_fin_ioa_def,rsch_fin_ioa_def,
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   217
 srch_ioa_def,rsch_ioa_def,rename_through_pmap,channel_abstraction]) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   218
qed"receiver_abstraction";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   219
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   220
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   221
(* 3 thms that do not hold generally! The lucky restriction here is 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   222
   the absence of internal actions. *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   223
goal Correctness.thy 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   224
      "is_weak_pmap (%id.id) sender_ioa sender_ioa";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   225
by (simp_tac (red_ss addsimps [Solve.is_weak_pmap_def]) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   226
by (rtac conjI 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   227
(* start states *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   228
br ballI 1;
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   229
by (simp_tac red_ss_ch 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   230
(* main-part *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   231
by (REPEAT (rtac allI 1));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   232
by (rtac imp_conj_lemma 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   233
by (Action.action.induct_tac "a" 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   234
(* 7 cases *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   235
by (ALLGOALS (simp_tac ((hom_ss addsimps [externals_def]) setloop (split_tac [expand_if]))));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   236
qed"sender_unchanged";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   237
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   238
(* 2 copies of before *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   239
goal Correctness.thy 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   240
      "is_weak_pmap (%id.id) receiver_ioa receiver_ioa";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   241
by (simp_tac (red_ss addsimps [Solve.is_weak_pmap_def]) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   242
by (rtac conjI 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   243
(* start states *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   244
br ballI 1;
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   245
by (simp_tac red_ss_ch 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   246
(* main-part *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   247
by (REPEAT (rtac allI 1));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   248
by (rtac imp_conj_lemma 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   249
by (Action.action.induct_tac "a" 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   250
(* 7 cases *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   251
by (ALLGOALS (simp_tac ((hom_ss addsimps [externals_def]) setloop (split_tac [expand_if]))));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   252
qed"receiver_unchanged";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   253
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   254
goal Correctness.thy 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   255
      "is_weak_pmap (%id.id) env_ioa env_ioa";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   256
by (simp_tac (red_ss addsimps [Solve.is_weak_pmap_def]) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   257
by (rtac conjI 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   258
(* start states *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   259
br ballI 1;
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   260
by (simp_tac red_ss_ch 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   261
(* main-part *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   262
by (REPEAT (rtac allI 1));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   263
by (rtac imp_conj_lemma 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   264
by (Action.action.induct_tac "a" 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   265
(* 7 cases *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   266
by (ALLGOALS (simp_tac ((hom_ss addsimps [externals_def]) setloop (split_tac [expand_if]))));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   267
qed"env_unchanged";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   268
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   269
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   270
goal Correctness.thy "compat_ioas srch_ioa rsch_ioa"; 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   271
by (simp_tac (red_ss_ch addsimps [compat_ioas_def,compat_asigs_def,Int_def,empty_def]) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   272
by (rtac set_ext 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   273
by (Action.action.induct_tac "x" 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   274
by (ALLGOALS(simp_tac red_ss_ch));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   275
val compat_single_ch = result();
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   276
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   277
(* totally the same as before *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   278
goal Correctness.thy "compat_ioas srch_fin_ioa rsch_fin_ioa"; 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   279
by (simp_tac (red_ss_ch addsimps [compat_ioas_def,compat_asigs_def,Int_def,empty_def]) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   280
by (rtac set_ext 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   281
by (Action.action.induct_tac "x" 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   282
by (ALLGOALS(simp_tac red_ss_ch));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   283
val compat_single_fin_ch = result();
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   284
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   285
goal Correctness.thy "compat_ioas receiver_ioa (srch_ioa || rsch_ioa)";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   286
by (simp_tac (hom_ss addsimps [empty_def,compat_ioas_def,compat_asigs_def,asig_of_par,asig_comp_def,actions_def,Int_def]) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   287
by (simp_tac red_ss_ch 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   288
by (rtac set_ext 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   289
by (Action.action.induct_tac "x" 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   290
by (ALLGOALS(simp_tac red_ss_ch));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   291
by (ALLGOALS(simp_tac (red_ss addsimps [insert_def,Un_def]))); 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   292
by (ALLGOALS(simp_tac (red_ss_ch addsimps [de_morgan,singleton_set])));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   293
val compat_rec =result();
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   294
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   295
(* 5 proofs totally the same as before *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   296
goal Correctness.thy "compat_ioas receiver_ioa (srch_fin_ioa || rsch_fin_ioa)";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   297
by (simp_tac (hom_ss addsimps [empty_def,compat_ioas_def,compat_asigs_def,asig_of_par,asig_comp_def,actions_def,Int_def]) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   298
by (simp_tac red_ss_ch 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   299
by (rtac set_ext 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   300
by (Action.action.induct_tac "x" 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   301
by (ALLGOALS(simp_tac red_ss_ch));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   302
by (ALLGOALS(simp_tac (red_ss addsimps [insert_def,Un_def]))); 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   303
by (ALLGOALS(simp_tac (red_ss_ch addsimps [de_morgan,singleton_set])));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   304
val compat_rec_fin =result();
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   305
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   306
goal Correctness.thy "compat_ioas sender_ioa \
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   307
\      (receiver_ioa || srch_ioa || rsch_ioa)";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   308
by (simp_tac (hom_ss addsimps [empty_def,compat_ioas_def,compat_asigs_def,asig_of_par,asig_comp_def,actions_def,Int_def]) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   309
by (simp_tac red_ss_ch 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   310
by (rtac set_ext 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   311
by (Action.action.induct_tac "x" 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   312
by (ALLGOALS(simp_tac red_ss_ch));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   313
by (ALLGOALS(simp_tac (red_ss addsimps [insert_def,Un_def]))); 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   314
by (ALLGOALS(simp_tac (red_ss_ch addsimps [de_morgan,singleton_set])));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   315
val compat_sen=result();
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   316
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   317
goal Correctness.thy "compat_ioas sender_ioa\
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   318
\      (receiver_ioa || srch_fin_ioa || rsch_fin_ioa)";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   319
by (simp_tac (hom_ss addsimps [empty_def,  compat_ioas_def,compat_asigs_def,asig_of_par,asig_comp_def,actions_def,Int_def]) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   320
by (simp_tac red_ss_ch 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   321
by (rtac set_ext 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   322
by (Action.action.induct_tac "x" 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   323
by (ALLGOALS(simp_tac red_ss_ch));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   324
by (ALLGOALS(simp_tac (red_ss addsimps [insert_def,Un_def]))); 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   325
by (ALLGOALS(simp_tac (red_ss_ch addsimps [de_morgan,singleton_set])));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   326
val compat_sen_fin =result();
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   327
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   328
goal Correctness.thy "compat_ioas env_ioa\
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   329
\      (sender_ioa || receiver_ioa || srch_ioa || rsch_ioa)";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   330
by (simp_tac (hom_ss addsimps [empty_def,compat_ioas_def,compat_asigs_def,asig_of_par,asig_comp_def,actions_def,Int_def]) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   331
by (simp_tac red_ss_ch 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   332
by (rtac set_ext 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   333
by (Action.action.induct_tac "x" 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   334
by (ALLGOALS(simp_tac red_ss_ch));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   335
by (ALLGOALS(simp_tac (red_ss addsimps [insert_def,Un_def]))); 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   336
by (ALLGOALS(simp_tac (red_ss_ch addsimps [de_morgan,singleton_set])));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   337
val compat_env=result();
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   338
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   339
goal Correctness.thy "compat_ioas env_ioa\
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   340
\      (sender_ioa || receiver_ioa || srch_fin_ioa || rsch_fin_ioa)";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   341
by (simp_tac (hom_ss addsimps [empty_def,compat_ioas_def,compat_asigs_def,asig_of_par,asig_comp_def,actions_def,Int_def]) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   342
by (simp_tac red_ss_ch 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   343
by (rtac set_ext 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   344
by (Action.action.induct_tac "x" 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   345
by (ALLGOALS(simp_tac red_ss_ch));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   346
by (ALLGOALS(simp_tac (red_ss addsimps [insert_def,Un_def]))); 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   347
by (ALLGOALS(simp_tac (red_ss_ch addsimps [de_morgan,singleton_set])));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   348
val compat_env_fin=result();
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   349
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   350
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   351
(* lemmata about externals of channels *)
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   352
goal Correctness.thy 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   353
 "externals(asig_of(srch_fin_ioa)) = externals(asig_of(srch_ioa)) &  \
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   354
\ externals(asig_of(rsch_fin_ioa)) = externals(asig_of(rsch_ioa))";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   355
by (simp_tac (red_ss_ch addsimps [externals_def]) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   356
val ext_single_ch = result();
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   357
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   358
goal Correctness.thy "is_weak_pmap                                       \
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   359
\   (%p.(fst(p),(fst(snd(p)),(fst(snd(snd(p))),                          \
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   360
\      (reduce(fst(snd(snd(snd(p))))),reduce(snd(snd(snd(snd(p)))))))))) \
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   361
\    (env_ioa || impl_ioa) (env_ioa || impl_fin_ioa)";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   362
by (simp_tac (impl_ss addsimps [Impl.impl_def,Impl_finite.impl_fin_def]) 1);
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   363
by(REPEAT(EVERY[rtac fxg_is_weak_pmap_of_product_IOA 1, 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   364
                simp_tac (red_ss addsimps [env_unchanged,sender_unchanged,
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   365
          receiver_unchanged,sender_abstraction,receiver_abstraction]) 1,
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   366
                rtac conjI 1]));
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   367
by (ALLGOALS(simp_tac (list_ss addsimps [externals_of_par,ext_single_ch,
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   368
             compat_single_ch,compat_single_fin_ch,compat_rec,compat_rec_fin,
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   369
             compat_sen,compat_sen_fin,compat_env,compat_env_fin]))); 
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   370
qed "system_refinement";
0c36c6a52a1d ABP: Alternating bit protocol example
nipkow
parents:
diff changeset
   371