src/HOL/Auth/Message.ML
author paulson
Fri, 28 Jun 1996 15:26:39 +0200
changeset 1839 199243afac2b
child 1852 289ce6cb5c84
permissions -rw-r--r--
Proving safety properties of authentication protocols
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
     1
(*  Title:      HOL/Auth/Message
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
     2
    ID:         $Id$
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
     4
    Copyright   1996  University of Cambridge
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
     5
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
     6
Datatypes of agents and messages;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
     7
Inductive relations "parts", "analyze" and "synthesize"
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
     8
*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
     9
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    10
open Message;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    11
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    12
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    13
(**************** INSTALL CENTRALLY SOMEWHERE? ****************)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    14
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    15
(*Maybe swap the safe_tac and simp_tac lines?**)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    16
fun auto_tac (cs,ss) = 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    17
    TRY (safe_tac cs) THEN 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    18
    ALLGOALS (asm_full_simp_tac ss) THEN
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    19
    REPEAT (FIRSTGOAL (best_tac (cs addss ss)));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    20
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    21
fun Auto_tac() = auto_tac (!claset, !simpset);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    22
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    23
fun auto() = by (Auto_tac());
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    24
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    25
fun imp_of_subset th = th RSN (2, rev_subsetD);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    26
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    27
(**************** INSTALL CENTRALLY SOMEWHERE? ****************)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    28
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    29
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    30
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    31
(** Inverse of keys **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    32
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    33
goal thy "!!K K'. (invKey K = invKey K') = (K=K')";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    34
by (Step_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    35
br box_equals 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    36
by (REPEAT (rtac invKey 2));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    37
by (Asm_simp_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    38
qed "invKey_eq";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    39
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    40
Addsimps [invKey, invKey_eq];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    41
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    42
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    43
(**** keysFor operator ****)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    44
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    45
goalw thy [keysFor_def] "keysFor {} = {}";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    46
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    47
qed "keysFor_empty";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    48
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    49
goalw thy [keysFor_def] "keysFor (H Un H') = keysFor H Un keysFor H'";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    50
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    51
qed "keysFor_Un";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    52
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    53
goalw thy [keysFor_def] "keysFor (UN i. H i) = (UN i. keysFor (H i))";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    54
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    55
qed "keysFor_UN";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    56
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    57
(*Monotonicity*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    58
goalw thy [keysFor_def] "!!G H. G<=H ==> keysFor(G) <= keysFor(H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    59
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    60
qed "keysFor_mono";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    61
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    62
goalw thy [keysFor_def] "keysFor (insert (Agent A) H) = keysFor H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    63
by (fast_tac (!claset addss (!simpset)) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    64
qed "keysFor_insert_Agent";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    65
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    66
goalw thy [keysFor_def] "keysFor (insert (Nonce N) H) = keysFor H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    67
by (fast_tac (!claset addss (!simpset)) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    68
qed "keysFor_insert_Nonce";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    69
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    70
goalw thy [keysFor_def] "keysFor (insert (Key K) H) = keysFor H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    71
by (fast_tac (!claset addss (!simpset)) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    72
qed "keysFor_insert_Key";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    73
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    74
goalw thy [keysFor_def] "keysFor (insert {|X,Y|} H) = keysFor H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    75
by (fast_tac (!claset addss (!simpset)) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    76
qed "keysFor_insert_MPair";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    77
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    78
goalw thy [keysFor_def]
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    79
    "keysFor (insert (Crypt X K) H) = insert (invKey K) (keysFor H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    80
by (Auto_tac());
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    81
by (fast_tac (!claset addIs [image_eqI]) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    82
qed "keysFor_insert_Crypt";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    83
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    84
Addsimps [keysFor_empty, keysFor_Un, keysFor_UN, 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    85
	  keysFor_insert_Agent, keysFor_insert_Nonce,
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    86
	  keysFor_insert_Key, keysFor_insert_MPair,
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    87
	  keysFor_insert_Crypt];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    88
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    89
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    90
(**** Inductive relation "parts" ****)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    91
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    92
val major::prems = 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    93
goal thy "[| {|X,Y|} : parts H;       \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    94
\            [| X : parts H; Y : parts H |] ==> P  \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    95
\         |] ==> P";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    96
by (cut_facts_tac [major] 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    97
brs prems 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    98
by (REPEAT (eresolve_tac [asm_rl, parts.Fst, parts.Snd] 1));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    99
qed "MPair_parts";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   100
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   101
AddIs  [parts.Inj];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   102
AddSEs [MPair_parts];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   103
AddDs  [parts.Body];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   104
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   105
goal thy "H <= parts(H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   106
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   107
qed "parts_increasing";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   108
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   109
(*Monotonicity*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   110
goalw thy parts.defs "!!G H. G<=H ==> parts(G) <= parts(H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   111
by (rtac lfp_mono 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   112
by (REPEAT (ares_tac basic_monos 1));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   113
qed "parts_mono";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   114
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   115
goal thy "parts{} = {}";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   116
by (Step_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   117
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   118
by (ALLGOALS Fast_tac);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   119
qed "parts_empty";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   120
Addsimps [parts_empty];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   121
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   122
goal thy "!!X. X: parts{} ==> P";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   123
by (Asm_full_simp_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   124
qed "parts_emptyE";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   125
AddSEs [parts_emptyE];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   126
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   127
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   128
(** Unions **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   129
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   130
goal thy "parts(G) Un parts(H) <= parts(G Un H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   131
by (REPEAT (ares_tac [Un_least, parts_mono, Un_upper1, Un_upper2] 1));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   132
val parts_Un_subset1 = result();
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   133
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   134
goal thy "parts(G Un H) <= parts(G) Un parts(H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   135
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   136
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   137
by (ALLGOALS Fast_tac);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   138
val parts_Un_subset2 = result();
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   139
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   140
goal thy "parts(G Un H) = parts(G) Un parts(H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   141
by (REPEAT (ares_tac [equalityI, parts_Un_subset1, parts_Un_subset2] 1));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   142
qed "parts_Un";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   143
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   144
goal thy "(UN x:A. parts(H x)) <= parts(UN x:A. H x)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   145
by (REPEAT (ares_tac [UN_least, parts_mono, UN_upper] 1));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   146
val parts_UN_subset1 = result();
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   147
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   148
goal thy "parts(UN x:A. H x) <= (UN x:A. parts(H x))";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   149
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   150
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   151
by (ALLGOALS Fast_tac);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   152
val parts_UN_subset2 = result();
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   153
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   154
goal thy "parts(UN x:A. H x) = (UN x:A. parts(H x))";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   155
by (REPEAT (ares_tac [equalityI, parts_UN_subset1, parts_UN_subset2] 1));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   156
qed "parts_UN";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   157
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   158
goal thy "parts(UN x. H x) = (UN x. parts(H x))";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   159
by (simp_tac (!simpset addsimps [UNION1_def, parts_UN]) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   160
qed "parts_UN1";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   161
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   162
(*Added to simplify arguments to parts, analyze and synthesize*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   163
Addsimps [parts_Un, parts_UN, parts_UN1];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   164
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   165
goal thy "insert X (parts H) <= parts(insert X H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   166
by (fast_tac (!claset addEs [imp_of_subset parts_mono]) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   167
qed "parts_insert_subset";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   168
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   169
(*Especially for reasoning about the Fake rule in traces*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   170
goal thy "!!Y. X: G ==> parts(insert X H) <= parts G Un parts H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   171
br ([parts_mono, parts_Un_subset2] MRS subset_trans) 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   172
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   173
qed "parts_insert_subset_Un";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   174
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   175
(** Idempotence and transitivity **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   176
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   177
goal thy "!!H. X: parts (parts H) ==> X: parts H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   178
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   179
by (ALLGOALS Fast_tac);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   180
qed "parts_partsE";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   181
AddSEs [parts_partsE];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   182
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   183
goal thy "parts (parts H) = parts H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   184
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   185
qed "parts_idem";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   186
Addsimps [parts_idem];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   187
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   188
goal thy "!!H. [| X: parts G;  G <= parts H |] ==> X: parts H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   189
by (dtac parts_mono 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   190
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   191
qed "parts_trans";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   192
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   193
(*Cut*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   194
goal thy "!!H. [| X: parts H;  Y: parts (insert X H) |] ==> Y: parts H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   195
be parts_trans 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   196
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   197
qed "parts_cut";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   198
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   199
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   200
(** Rewrite rules for pulling out atomic messages **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   201
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   202
goal thy "parts (insert (Agent agt) H) = insert (Agent agt) (parts H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   203
by (rtac (parts_insert_subset RSN (2, equalityI)) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   204
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   205
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   206
(*Simplification breaks up equalities between messages;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   207
  how to make it work for fast_tac??*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   208
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   209
qed "parts_insert_Agent";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   210
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   211
goal thy "parts (insert (Nonce N) H) = insert (Nonce N) (parts H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   212
by (rtac (parts_insert_subset RSN (2, equalityI)) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   213
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   214
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   215
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   216
qed "parts_insert_Nonce";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   217
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   218
goal thy "parts (insert (Key K) H) = insert (Key K) (parts H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   219
by (rtac (parts_insert_subset RSN (2, equalityI)) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   220
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   221
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   222
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   223
qed "parts_insert_Key";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   224
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   225
goal thy "parts (insert (Crypt X K) H) = \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   226
\         insert (Crypt X K) (parts (insert X H))";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   227
br equalityI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   228
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   229
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   230
by (Auto_tac());
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   231
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   232
by (ALLGOALS (best_tac (!claset addIs [parts.Body])));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   233
qed "parts_insert_Crypt";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   234
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   235
goal thy "parts (insert {|X,Y|} H) = \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   236
\         insert {|X,Y|} (parts (insert X (insert Y H)))";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   237
br equalityI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   238
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   239
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   240
by (Auto_tac());
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   241
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   242
by (ALLGOALS (best_tac (!claset addIs [parts.Fst, parts.Snd])));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   243
qed "parts_insert_MPair";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   244
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   245
Addsimps [parts_insert_Agent, parts_insert_Nonce, 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   246
	  parts_insert_Key, parts_insert_Crypt, parts_insert_MPair];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   247
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   248
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   249
(**** Inductive relation "analyze" ****)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   250
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   251
val major::prems = 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   252
goal thy "[| {|X,Y|} : analyze H;       \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   253
\            [| X : analyze H; Y : analyze H |] ==> P  \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   254
\         |] ==> P";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   255
by (cut_facts_tac [major] 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   256
brs prems 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   257
by (REPEAT (eresolve_tac [asm_rl, analyze.Fst, analyze.Snd] 1));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   258
qed "MPair_analyze";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   259
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   260
AddIs  [analyze.Inj];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   261
AddSEs [MPair_analyze];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   262
AddDs  [analyze.Decrypt];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   263
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   264
goal thy "H <= analyze(H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   265
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   266
qed "analyze_increasing";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   267
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   268
goal thy "analyze H <= parts H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   269
by (rtac subsetI 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   270
be analyze.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   271
by (ALLGOALS Fast_tac);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   272
qed "analyze_subset_parts";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   273
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   274
bind_thm ("not_parts_not_analyze", analyze_subset_parts RS contra_subsetD);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   275
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   276
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   277
goal thy "parts (analyze H) = parts H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   278
br equalityI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   279
br (analyze_subset_parts RS parts_mono RS subset_trans) 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   280
by (Simp_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   281
by (fast_tac (!claset addDs [analyze_increasing RS parts_mono RS subsetD]) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   282
qed "parts_analyze";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   283
Addsimps [parts_analyze];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   284
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   285
(*Monotonicity; Lemma 1 of Lowe*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   286
goalw thy analyze.defs "!!G H. G<=H ==> analyze(G) <= analyze(H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   287
by (rtac lfp_mono 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   288
by (REPEAT (ares_tac basic_monos 1));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   289
qed "analyze_mono";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   290
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   291
(** General equational properties **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   292
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   293
goal thy "analyze{} = {}";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   294
by (Step_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   295
be analyze.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   296
by (ALLGOALS Fast_tac);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   297
qed "analyze_empty";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   298
Addsimps [analyze_empty];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   299
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   300
(*Converse fails: we can analyze more from the union than from the 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   301
  separate parts, as a key in one might decrypt a message in the other*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   302
goal thy "analyze(G) Un analyze(H) <= analyze(G Un H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   303
by (REPEAT (ares_tac [Un_least, analyze_mono, Un_upper1, Un_upper2] 1));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   304
qed "analyze_Un";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   305
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   306
goal thy "insert X (analyze H) <= analyze(insert X H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   307
by (fast_tac (!claset addEs [imp_of_subset analyze_mono]) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   308
qed "analyze_insert";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   309
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   310
(** Rewrite rules for pulling out atomic messages **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   311
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   312
goal thy "analyze (insert (Agent agt) H) = insert (Agent agt) (analyze H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   313
by (rtac (analyze_insert RSN (2, equalityI)) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   314
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   315
be analyze.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   316
(*Simplification breaks up equalities between messages;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   317
  how to make it work for fast_tac??*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   318
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   319
qed "analyze_insert_Agent";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   320
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   321
goal thy "analyze (insert (Nonce N) H) = insert (Nonce N) (analyze H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   322
by (rtac (analyze_insert RSN (2, equalityI)) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   323
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   324
be analyze.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   325
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   326
qed "analyze_insert_Nonce";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   327
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   328
(*Can only pull out Keys if they are not needed to decrypt the rest*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   329
goalw thy [keysFor_def]
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   330
    "!!K. K ~: keysFor (analyze H) ==>  \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   331
\         analyze (insert (Key K) H) = insert (Key K) (analyze H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   332
by (rtac (analyze_insert RSN (2, equalityI)) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   333
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   334
be analyze.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   335
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   336
qed "analyze_insert_Key";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   337
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   338
goal thy "!!H. Key (invKey K) ~: analyze H ==>  \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   339
\              analyze (insert (Crypt X K) H) = \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   340
\              insert (Crypt X K) (analyze H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   341
by (rtac (analyze_insert RSN (2, equalityI)) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   342
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   343
be analyze.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   344
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   345
qed "analyze_insert_Crypt";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   346
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   347
goal thy "!!H. Key (invKey K) : analyze H ==>  \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   348
\              analyze (insert (Crypt X K) H) <= \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   349
\              insert (Crypt X K) (analyze (insert X H))";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   350
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   351
by (eres_inst_tac [("za","x")] analyze.induct 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   352
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   353
val lemma1 = result();
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   354
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   355
goal thy "!!H. Key (invKey K) : analyze H ==>  \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   356
\              insert (Crypt X K) (analyze (insert X H)) <= \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   357
\              analyze (insert (Crypt X K) H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   358
by (Auto_tac());
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   359
by (eres_inst_tac [("za","x")] analyze.induct 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   360
by (Auto_tac());
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   361
by (best_tac (!claset addIs [subset_insertI RS analyze_mono RS subsetD,
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   362
			     analyze.Decrypt]) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   363
val lemma2 = result();
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   364
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   365
goal thy "!!H. Key (invKey K) : analyze H ==>  \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   366
\              analyze (insert (Crypt X K) H) = \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   367
\              insert (Crypt X K) (analyze (insert X H))";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   368
by (REPEAT (ares_tac [equalityI, lemma1, lemma2] 1));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   369
qed "analyze_insert_Decrypt";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   370
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   371
Addsimps [analyze_insert_Agent, analyze_insert_Nonce, 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   372
	  analyze_insert_Key, analyze_insert_Crypt,
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   373
	  analyze_insert_Decrypt];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   374
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   375
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   376
(*This rule supposes "for the sake of argument" that we have the key.*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   377
goal thy  "analyze (insert (Crypt X K) H) <=  \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   378
\         insert (Crypt X K) (analyze (insert X H))";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   379
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   380
be analyze.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   381
by (Auto_tac());
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   382
qed "analyze_insert_Crypt_subset";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   383
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   384
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   385
(** Rewrite rules for pulling out atomic parts of messages **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   386
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   387
goal thy "analyze (insert X H) <= analyze (insert {|X,Y|} H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   388
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   389
be analyze.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   390
by (ALLGOALS (best_tac (!claset addIs [analyze.Fst]))); 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   391
qed "analyze_insert_subset_MPair1";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   392
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   393
goal thy "analyze (insert Y H) <= analyze (insert {|X,Y|} H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   394
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   395
be analyze.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   396
by (ALLGOALS (best_tac (!claset addIs [analyze.Snd]))); 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   397
qed "analyze_insert_subset_MPair2";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   398
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   399
goal thy "analyze (insert {|Agent agt,Y|} H) = \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   400
\         insert {|Agent agt,Y|} (insert (Agent agt) (analyze (insert Y H)))";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   401
by (rtac equalityI 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   402
by (best_tac (!claset addIs [analyze.Fst,
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   403
			     imp_of_subset analyze_insert_subset_MPair2]) 2); 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   404
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   405
be analyze.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   406
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   407
qed "analyze_insert_Agent_MPair";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   408
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   409
goal thy "analyze (insert {|Nonce N,Y|} H) = \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   410
\         insert {|Nonce N,Y|} (insert (Nonce N) (analyze (insert Y H)))";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   411
by (rtac equalityI 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   412
by (best_tac (!claset addIs [analyze.Fst,
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   413
			     imp_of_subset analyze_insert_subset_MPair2]) 2); 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   414
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   415
be analyze.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   416
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   417
qed "analyze_insert_Nonce_MPair";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   418
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   419
(*Can only pull out Keys if they are not needed to decrypt the rest*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   420
goalw thy [keysFor_def]
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   421
    "!!K. K ~: keysFor (analyze (insert Y H)) ==>  \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   422
\         analyze (insert {|Key K, Y|} H) = \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   423
\         insert {|Key K, Y|} (insert (Key K) (analyze (insert Y H)))";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   424
by (rtac equalityI 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   425
by (best_tac (!claset addIs [analyze.Fst,
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   426
			     imp_of_subset analyze_insert_subset_MPair2]) 2); 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   427
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   428
be analyze.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   429
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   430
qed "analyze_insert_Key_MPair";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   431
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   432
Addsimps [analyze_insert_Agent_MPair, analyze_insert_Nonce_MPair,
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   433
	  analyze_insert_Key_MPair];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   434
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   435
(** Idempotence and transitivity **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   436
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   437
goal thy "!!H. X: analyze (analyze H) ==> X: analyze H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   438
be analyze.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   439
by (ALLGOALS Fast_tac);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   440
qed "analyze_analyzeE";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   441
AddSEs [analyze_analyzeE];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   442
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   443
goal thy "analyze (analyze H) = analyze H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   444
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   445
qed "analyze_idem";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   446
Addsimps [analyze_idem];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   447
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   448
goal thy "!!H. [| X: analyze G;  G <= analyze H |] ==> X: analyze H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   449
by (dtac analyze_mono 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   450
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   451
qed "analyze_trans";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   452
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   453
(*Cut; Lemma 2 of Lowe*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   454
goal thy "!!H. [| X: analyze H;  Y: analyze (insert X H) |] ==> Y: analyze H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   455
be analyze_trans 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   456
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   457
qed "analyze_cut";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   458
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   459
(*Cut can be proved easily by induction on
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   460
   "!!H. Y: analyze (insert X H) ==> X: analyze H --> Y: analyze H"
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   461
*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   462
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   463
(*If there are no pairs or encryptions then analyze does nothing*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   464
goal thy "!!H. [| ALL X Y. {|X,Y|} ~: H;  ALL X K. Crypt X K ~: H |] ==> \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   465
\         analyze H = H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   466
by (Step_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   467
be analyze.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   468
by (ALLGOALS Fast_tac);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   469
qed "analyze_trivial";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   470
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   471
(*Helps to prove Fake cases*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   472
goal thy "!!X. X: analyze (UN i. analyze (H i)) ==> X: analyze (UN i. H i)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   473
be analyze.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   474
by (ALLGOALS (fast_tac (!claset addEs [imp_of_subset analyze_mono])));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   475
val lemma = result();
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   476
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   477
goal thy "analyze (UN i. analyze (H i)) = analyze (UN i. H i)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   478
by (fast_tac (!claset addIs [lemma]
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   479
		      addEs [imp_of_subset analyze_mono]) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   480
qed "analyze_UN_analyze";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   481
Addsimps [analyze_UN_analyze];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   482
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   483
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   484
(**** Inductive relation "synthesize" ****)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   485
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   486
AddIs  synthesize.intrs;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   487
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   488
goal thy "H <= synthesize(H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   489
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   490
qed "synthesize_increasing";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   491
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   492
(*Monotonicity*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   493
goalw thy synthesize.defs "!!G H. G<=H ==> synthesize(G) <= synthesize(H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   494
by (rtac lfp_mono 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   495
by (REPEAT (ares_tac basic_monos 1));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   496
qed "synthesize_mono";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   497
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   498
(** Unions **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   499
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   500
(*Converse fails: we can synthesize more from the union than from the 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   501
  separate parts, building a compound message using elements of each.*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   502
goal thy "synthesize(G) Un synthesize(H) <= synthesize(G Un H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   503
by (REPEAT (ares_tac [Un_least, synthesize_mono, Un_upper1, Un_upper2] 1));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   504
qed "synthesize_Un";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   505
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   506
(** Idempotence and transitivity **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   507
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   508
goal thy "!!H. X: synthesize (synthesize H) ==> X: synthesize H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   509
be synthesize.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   510
by (ALLGOALS Fast_tac);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   511
qed "synthesize_synthesizeE";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   512
AddSEs [synthesize_synthesizeE];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   513
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   514
goal thy "synthesize (synthesize H) = synthesize H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   515
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   516
qed "synthesize_idem";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   517
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   518
goal thy "!!H. [| X: synthesize G;  G <= synthesize H |] ==> X: synthesize H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   519
by (dtac synthesize_mono 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   520
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   521
qed "synthesize_trans";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   522
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   523
(*Cut; Lemma 2 of Lowe*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   524
goal thy "!!H. [| X: synthesize H;  Y: synthesize (insert X H) \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   525
\              |] ==> Y: synthesize H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   526
be synthesize_trans 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   527
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   528
qed "synthesize_cut";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   529
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   530
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   531
(*Can only produce a nonce or key if it is already known,
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   532
  but can synthesize a pair or encryption from its components...*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   533
val mk_cases = synthesize.mk_cases msg.simps;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   534
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   535
val Nonce_synthesize = mk_cases "Nonce n : synthesize H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   536
val Key_synthesize   = mk_cases "Key K : synthesize H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   537
val MPair_synthesize = mk_cases "{|X,Y|} : synthesize H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   538
val Crypt_synthesize = mk_cases "Crypt X K : synthesize H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   539
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   540
AddSEs [Nonce_synthesize, Key_synthesize, MPair_synthesize, Crypt_synthesize];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   541
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   542
goal thy "(Nonce N : synthesize H) = (Nonce N : H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   543
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   544
qed "Nonce_synthesize_eq";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   545
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   546
goal thy "(Key K : synthesize H) = (Key K : H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   547
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   548
qed "Key_synthesize_eq";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   549
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   550
Addsimps [Nonce_synthesize_eq, Key_synthesize_eq];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   551
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   552
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   553
goalw thy [keysFor_def]
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   554
    "keysFor (synthesize H) = keysFor H Un invKey``{K. Key K : H}";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   555
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   556
qed "keysFor_synthesize";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   557
Addsimps [keysFor_synthesize];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   558
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   559
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   560
(*** Combinations of parts, analyze and synthesize ***)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   561
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   562
(*Not that useful, in view of the following one...*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   563
goal thy "parts (synthesize H) <= synthesize (parts H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   564
by (Step_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   565
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   566
be (parts_increasing RS synthesize_mono RS subsetD) 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   567
by (ALLGOALS Fast_tac);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   568
qed "parts_synthesize_subset";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   569
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   570
goal thy "parts (synthesize H) = parts H Un synthesize H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   571
br equalityI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   572
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   573
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   574
by (ALLGOALS
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   575
    (best_tac (!claset addIs ((synthesize_increasing RS parts_mono RS subsetD)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   576
			     ::parts.intrs))));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   577
qed "parts_synthesize";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   578
Addsimps [parts_synthesize];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   579
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   580
goal thy "analyze (synthesize H) = analyze H Un synthesize H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   581
br equalityI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   582
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   583
be analyze.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   584
by (best_tac
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   585
    (!claset addIs [synthesize_increasing RS analyze_mono RS subsetD]) 5);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   586
(*Strange that best_tac just can't hack this one...*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   587
by (ALLGOALS (deepen_tac (!claset addIs analyze.intrs) 0));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   588
qed "analyze_synthesize";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   589
Addsimps [analyze_synthesize];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   590
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   591
(*Hard to prove; still needed now that there's only one Enemy?*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   592
goal thy "analyze (UN i. synthesize (H i)) = \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   593
\         analyze (UN i. H i) Un (UN i. synthesize (H i))";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   594
br equalityI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   595
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   596
be analyze.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   597
by (best_tac
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   598
    (!claset addEs [imp_of_subset synthesize_increasing,
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   599
		    imp_of_subset analyze_mono]) 5);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   600
by (Best_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   601
by (deepen_tac (!claset addIs [analyze.Fst]) 0 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   602
by (deepen_tac (!claset addIs [analyze.Snd]) 0 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   603
by (deepen_tac (!claset addSEs [analyze.Decrypt]
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   604
			addIs  [analyze.Decrypt]) 0 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   605
qed "analyze_UN1_synthesize";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   606
Addsimps [analyze_UN1_synthesize];