src/HOL/Auth/Message.ML
author paulson
Tue, 20 Aug 1996 17:46:24 +0200
changeset 1929 f0839bab4b00
parent 1913 2809adb15eb0
child 1946 b59a3d686436
permissions -rw-r--r--
Working version of NS, messages 1-3, WITH INTERLEAVING
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;
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
     7
Inductive relations "parts", "analz" and "synth"
1839
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
(** Inverse of keys **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    14
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    15
goal thy "!!K K'. (invKey K = invKey K') = (K=K')";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    16
by (Step_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    17
br box_equals 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    18
by (REPEAT (rtac invKey 2));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    19
by (Asm_simp_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    20
qed "invKey_eq";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    21
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    22
Addsimps [invKey, invKey_eq];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    23
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    24
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    25
(**** keysFor operator ****)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    26
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    27
goalw thy [keysFor_def] "keysFor {} = {}";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    28
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    29
qed "keysFor_empty";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    30
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    31
goalw thy [keysFor_def] "keysFor (H Un H') = keysFor H Un keysFor H'";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    32
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    33
qed "keysFor_Un";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    34
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    35
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
    36
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    37
qed "keysFor_UN";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    38
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    39
(*Monotonicity*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    40
goalw thy [keysFor_def] "!!G H. G<=H ==> keysFor(G) <= keysFor(H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    41
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    42
qed "keysFor_mono";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    43
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    44
goalw thy [keysFor_def] "keysFor (insert (Agent A) H) = keysFor H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    45
by (fast_tac (!claset addss (!simpset)) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    46
qed "keysFor_insert_Agent";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    47
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    48
goalw thy [keysFor_def] "keysFor (insert (Nonce N) H) = keysFor H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    49
by (fast_tac (!claset addss (!simpset)) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    50
qed "keysFor_insert_Nonce";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    51
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    52
goalw thy [keysFor_def] "keysFor (insert (Key K) H) = keysFor H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    53
by (fast_tac (!claset addss (!simpset)) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    54
qed "keysFor_insert_Key";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    55
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    56
goalw thy [keysFor_def] "keysFor (insert {|X,Y|} H) = keysFor H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    57
by (fast_tac (!claset addss (!simpset)) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    58
qed "keysFor_insert_MPair";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    59
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    60
goalw thy [keysFor_def]
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    61
    "keysFor (insert (Crypt X K) H) = insert (invKey K) (keysFor H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    62
by (Auto_tac());
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    63
by (fast_tac (!claset addIs [image_eqI]) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    64
qed "keysFor_insert_Crypt";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    65
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    66
Addsimps [keysFor_empty, keysFor_Un, keysFor_UN, 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    67
	  keysFor_insert_Agent, keysFor_insert_Nonce,
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    68
	  keysFor_insert_Key, keysFor_insert_MPair,
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    69
	  keysFor_insert_Crypt];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    70
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    71
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    72
(**** Inductive relation "parts" ****)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    73
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    74
val major::prems = 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    75
goal thy "[| {|X,Y|} : parts H;       \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    76
\            [| X : parts H; Y : parts H |] ==> P  \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    77
\         |] ==> P";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    78
by (cut_facts_tac [major] 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    79
brs prems 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    80
by (REPEAT (eresolve_tac [asm_rl, parts.Fst, parts.Snd] 1));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    81
qed "MPair_parts";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    82
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    83
AddIs  [parts.Inj];
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
    84
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
    85
val partsEs = [MPair_parts, make_elim parts.Body];
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
    86
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
    87
AddSEs partsEs;
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
    88
(*NB These two rules are UNSAFE in the formal sense, as they discard the
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
    89
     compound message.  They work well on THIS FILE, perhaps because its
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
    90
     proofs concern only atomic messages.*)
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    91
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    92
goal thy "H <= parts(H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    93
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    94
qed "parts_increasing";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    95
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    96
(*Monotonicity*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    97
goalw thy parts.defs "!!G H. G<=H ==> parts(G) <= parts(H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    98
by (rtac lfp_mono 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    99
by (REPEAT (ares_tac basic_monos 1));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   100
qed "parts_mono";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   101
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   102
goal thy "parts{} = {}";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   103
by (Step_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   104
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   105
by (ALLGOALS Fast_tac);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   106
qed "parts_empty";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   107
Addsimps [parts_empty];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   108
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   109
goal thy "!!X. X: parts{} ==> P";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   110
by (Asm_full_simp_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   111
qed "parts_emptyE";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   112
AddSEs [parts_emptyE];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   113
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   114
(*WARNING: loops if H = {Y}, therefore must not be repeated!*)
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   115
goal thy "!!H. X: parts H ==> EX Y:H. X: parts {Y}";
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   116
be parts.induct 1;
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   117
by (ALLGOALS Fast_tac);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   118
qed "parts_singleton";
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   119
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   120
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   121
(** Unions **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   122
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   123
goal thy "parts(G) Un parts(H) <= parts(G Un H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   124
by (REPEAT (ares_tac [Un_least, parts_mono, Un_upper1, Un_upper2] 1));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   125
val parts_Un_subset1 = result();
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   126
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   127
goal thy "parts(G Un H) <= parts(G) Un parts(H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   128
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   129
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   130
by (ALLGOALS Fast_tac);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   131
val parts_Un_subset2 = result();
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   132
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   133
goal thy "parts(G Un H) = parts(G) Un parts(H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   134
by (REPEAT (ares_tac [equalityI, parts_Un_subset1, parts_Un_subset2] 1));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   135
qed "parts_Un";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   136
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   137
(*TWO inserts to avoid looping.  This rewrite is better than nothing...*)
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   138
goal thy "parts (insert X (insert Y H)) = parts {X} Un parts {Y} Un parts H";
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   139
by (stac (read_instantiate [("A","H")] insert_is_Un) 1);
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   140
by (stac (read_instantiate [("A","{Y} Un H")] insert_is_Un) 1);
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   141
by (simp_tac (HOL_ss addsimps [parts_Un, Un_assoc]) 1);
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   142
qed "parts_insert2";
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   143
1839
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
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   162
(*Added to simplify arguments to parts, analz and synth*)
1839
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)";
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   166
by (fast_tac (!claset addEs [impOfSubs parts_mono]) 1);
1839
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
(** Idempotence and transitivity **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   170
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   171
goal thy "!!H. X: parts (parts H) ==> X: parts H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   172
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   173
by (ALLGOALS Fast_tac);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   174
qed "parts_partsE";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   175
AddSEs [parts_partsE];
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 "parts (parts H) = parts H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   178
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   179
qed "parts_idem";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   180
Addsimps [parts_idem];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   181
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   182
goal thy "!!H. [| X: parts G;  G <= parts H |] ==> X: parts H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   183
by (dtac parts_mono 1);
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_trans";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   186
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   187
(*Cut*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   188
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
   189
be parts_trans 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_cut";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   192
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   193
goal thy "!!H. X: parts H ==> parts (insert X H) = parts H";
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   194
by (fast_tac (!claset addSEs [parts_cut]
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   195
                      addIs [impOfSubs (subset_insertI RS parts_mono)]) 1);
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   196
qed "parts_cut_eq";
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   197
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   198
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   199
(** Rewrite rules for pulling out atomic messages **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   200
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   201
goal thy "parts (insert (Agent agt) H) = insert (Agent agt) (parts H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   202
by (rtac (parts_insert_subset RSN (2, equalityI)) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   203
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   204
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   205
(*Simplification breaks up equalities between messages;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   206
  how to make it work for fast_tac??*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   207
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   208
qed "parts_insert_Agent";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   209
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   210
goal thy "parts (insert (Nonce N) H) = insert (Nonce N) (parts H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   211
by (rtac (parts_insert_subset RSN (2, equalityI)) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   212
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   213
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   214
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   215
qed "parts_insert_Nonce";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   216
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   217
goal thy "parts (insert (Key K) H) = insert (Key K) (parts H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   218
by (rtac (parts_insert_subset RSN (2, equalityI)) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   219
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   220
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   221
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   222
qed "parts_insert_Key";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   223
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   224
goal thy "parts (insert (Crypt X K) H) = \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   225
\         insert (Crypt X K) (parts (insert X H))";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   226
br equalityI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   227
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   228
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   229
by (Auto_tac());
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   230
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   231
by (ALLGOALS (best_tac (!claset addIs [parts.Body])));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   232
qed "parts_insert_Crypt";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   233
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   234
goal thy "parts (insert {|X,Y|} H) = \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   235
\         insert {|X,Y|} (parts (insert X (insert Y H)))";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   236
br equalityI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   237
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   238
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   239
by (Auto_tac());
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   240
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   241
by (ALLGOALS (best_tac (!claset addIs [parts.Fst, parts.Snd])));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   242
qed "parts_insert_MPair";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   243
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   244
Addsimps [parts_insert_Agent, parts_insert_Nonce, 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   245
	  parts_insert_Key, parts_insert_Crypt, parts_insert_MPair];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   246
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   247
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   248
(**** Inductive relation "analz" ****)
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   249
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   250
val major::prems = 
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   251
goal thy "[| {|X,Y|} : analz H;       \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   252
\            [| X : analz H; Y : analz H |] ==> P  \
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   253
\         |] ==> P";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   254
by (cut_facts_tac [major] 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   255
brs prems 1;
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   256
by (REPEAT (eresolve_tac [asm_rl, analz.Fst, analz.Snd] 1));
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   257
qed "MPair_analz";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   258
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   259
AddIs  [analz.Inj];
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   260
AddSEs [MPair_analz];
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   261
AddDs  [analz.Decrypt];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   262
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   263
Addsimps [analz.Inj];
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   264
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   265
goal thy "H <= analz(H)";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   266
by (Fast_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   267
qed "analz_increasing";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   268
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   269
goal thy "analz H <= parts H";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   270
by (rtac subsetI 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   271
be analz.induct 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   272
by (ALLGOALS Fast_tac);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   273
qed "analz_subset_parts";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   274
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   275
bind_thm ("not_parts_not_analz", analz_subset_parts RS contra_subsetD);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   276
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   277
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   278
goal thy "parts (analz H) = parts H";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   279
br equalityI 1;
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   280
br (analz_subset_parts RS parts_mono RS subset_trans) 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   281
by (Simp_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   282
by (fast_tac (!claset addDs [analz_increasing RS parts_mono RS subsetD]) 1);
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   283
qed "parts_analz";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   284
Addsimps [parts_analz];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   285
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   286
goal thy "analz (parts H) = parts H";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   287
by (Auto_tac());
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   288
be analz.induct 1;
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   289
by (Auto_tac());
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   290
qed "analz_parts";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   291
Addsimps [analz_parts];
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   292
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   293
(*Monotonicity; Lemma 1 of Lowe*)
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   294
goalw thy analz.defs "!!G H. G<=H ==> analz(G) <= analz(H)";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   295
by (rtac lfp_mono 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   296
by (REPEAT (ares_tac basic_monos 1));
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   297
qed "analz_mono";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   298
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   299
(** General equational properties **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   300
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   301
goal thy "analz{} = {}";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   302
by (Step_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   303
be analz.induct 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   304
by (ALLGOALS Fast_tac);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   305
qed "analz_empty";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   306
Addsimps [analz_empty];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   307
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   308
(*Converse fails: we can analz more from the union than from the 
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   309
  separate parts, as a key in one might decrypt a message in the other*)
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   310
goal thy "analz(G) Un analz(H) <= analz(G Un H)";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   311
by (REPEAT (ares_tac [Un_least, analz_mono, Un_upper1, Un_upper2] 1));
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   312
qed "analz_Un";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   313
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   314
goal thy "insert X (analz H) <= analz(insert X H)";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   315
by (fast_tac (!claset addEs [impOfSubs analz_mono]) 1);
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   316
qed "analz_insert";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   317
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   318
(** Rewrite rules for pulling out atomic messages **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   319
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   320
goal thy "analz (insert (Agent agt) H) = insert (Agent agt) (analz H)";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   321
by (rtac (analz_insert RSN (2, equalityI)) 1);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   322
br subsetI 1;
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   323
be analz.induct 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   324
(*Simplification breaks up equalities between messages;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   325
  how to make it work for fast_tac??*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   326
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   327
qed "analz_insert_Agent";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   328
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   329
goal thy "analz (insert (Nonce N) H) = insert (Nonce N) (analz H)";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   330
by (rtac (analz_insert RSN (2, equalityI)) 1);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   331
br subsetI 1;
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   332
be analz.induct 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   333
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   334
qed "analz_insert_Nonce";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   335
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   336
(*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
   337
goalw thy [keysFor_def]
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   338
    "!!K. K ~: keysFor (analz H) ==>  \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   339
\         analz (insert (Key K) H) = insert (Key K) (analz H)";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   340
by (rtac (analz_insert RSN (2, equalityI)) 1);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   341
br subsetI 1;
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   342
be analz.induct 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   343
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   344
qed "analz_insert_Key";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   345
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   346
goal thy "analz (insert {|X,Y|} H) = \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   347
\         insert {|X,Y|} (analz (insert X (insert Y H)))";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   348
br equalityI 1;
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   349
br subsetI 1;
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   350
be analz.induct 1;
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   351
by (Auto_tac());
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   352
be analz.induct 1;
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   353
by (ALLGOALS (deepen_tac (!claset addIs [analz.Fst, analz.Snd, analz.Decrypt]) 0));
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   354
qed "analz_insert_MPair";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   355
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   356
(*Can pull out enCrypted message if the Key is not known*)
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   357
goal thy "!!H. Key (invKey K) ~: analz H ==>  \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   358
\              analz (insert (Crypt X K) H) = \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   359
\              insert (Crypt X K) (analz H)";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   360
by (rtac (analz_insert RSN (2, equalityI)) 1);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   361
br subsetI 1;
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   362
be analz.induct 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   363
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   364
qed "analz_insert_Crypt";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   365
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   366
goal thy "!!H. Key (invKey K) : analz H ==>  \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   367
\              analz (insert (Crypt X K) H) <= \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   368
\              insert (Crypt X K) (analz (insert X H))";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   369
br subsetI 1;
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   370
by (eres_inst_tac [("za","x")] analz.induct 1);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   371
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   372
val lemma1 = result();
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   373
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   374
goal thy "!!H. Key (invKey K) : analz H ==>  \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   375
\              insert (Crypt X K) (analz (insert X H)) <= \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   376
\              analz (insert (Crypt X K) H)";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   377
by (Auto_tac());
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   378
by (eres_inst_tac [("za","x")] analz.induct 1);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   379
by (Auto_tac());
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   380
by (best_tac (!claset addIs [subset_insertI RS analz_mono RS subsetD,
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   381
			     analz.Decrypt]) 1);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   382
val lemma2 = result();
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   383
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   384
goal thy "!!H. Key (invKey K) : analz H ==>  \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   385
\              analz (insert (Crypt X K) H) = \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   386
\              insert (Crypt X K) (analz (insert X H))";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   387
by (REPEAT (ares_tac [equalityI, lemma1, lemma2] 1));
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   388
qed "analz_insert_Decrypt";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   389
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   390
(*Case analysis: either the message is secure, or it is not!
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   391
  Use with expand_if;  apparently split_tac does not cope with patterns
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   392
  such as "analz (insert (Crypt X' K) H)" *)
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   393
goal thy "analz (insert (Crypt X' K) H) = \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   394
\         (if (Key (invKey K)  : analz H) then    \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   395
\               insert (Crypt X' K) (analz (insert X' H)) \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   396
\          else insert (Crypt X' K) (analz H))";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   397
by (excluded_middle_tac "Key (invKey K)  : analz H " 1);
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   398
by (ALLGOALS (asm_simp_tac (!simpset addsimps [analz_insert_Crypt, 
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   399
					       analz_insert_Decrypt])));
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   400
qed "analz_Crypt_if";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   401
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   402
Addsimps [analz_insert_Agent, analz_insert_Nonce, 
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   403
	  analz_insert_Key, analz_insert_MPair, 
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   404
	  analz_Crypt_if];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   405
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   406
(*This rule supposes "for the sake of argument" that we have the key.*)
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   407
goal thy  "analz (insert (Crypt X K) H) <=  \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   408
\          insert (Crypt X K) (analz (insert X H))";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   409
br subsetI 1;
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   410
be analz.induct 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   411
by (Auto_tac());
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   412
qed "analz_insert_Crypt_subset";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   413
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   414
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   415
(** Idempotence and transitivity **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   416
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   417
goal thy "!!H. X: analz (analz H) ==> X: analz H";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   418
be analz.induct 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   419
by (ALLGOALS Fast_tac);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   420
qed "analz_analzE";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   421
AddSEs [analz_analzE];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   422
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   423
goal thy "analz (analz H) = analz H";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   424
by (Fast_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   425
qed "analz_idem";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   426
Addsimps [analz_idem];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   427
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   428
goal thy "!!H. [| X: analz G;  G <= analz H |] ==> X: analz H";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   429
by (dtac analz_mono 1);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   430
by (Fast_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   431
qed "analz_trans";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   432
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   433
(*Cut; Lemma 2 of Lowe*)
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   434
goal thy "!!H. [| X: analz H;  Y: analz (insert X H) |] ==> Y: analz H";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   435
be analz_trans 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   436
by (Fast_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   437
qed "analz_cut";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   438
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   439
(*Cut can be proved easily by induction on
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   440
   "!!H. Y: analz (insert X H) ==> X: analz H --> Y: analz H"
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   441
*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   442
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   443
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   444
(** A congruence rule for "analz" **)
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   445
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   446
goal thy "!!H. [| analz G <= analz G'; analz H <= analz H' \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   447
\              |] ==> analz (G Un H) <= analz (G' Un H')";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   448
by (Step_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   449
be analz.induct 1;
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   450
by (ALLGOALS (best_tac (!claset addIs [analz_mono RS subsetD])));
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   451
qed "analz_subset_cong";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   452
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   453
goal thy "!!H. [| analz G = analz G'; analz H = analz H' \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   454
\              |] ==> analz (G Un H) = analz (G' Un H')";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   455
by (REPEAT_FIRST (ares_tac [equalityI, analz_subset_cong]
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   456
	  ORELSE' etac equalityE));
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   457
qed "analz_cong";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   458
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   459
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   460
goal thy "!!H. analz H = analz H' ==> analz(insert X H) = analz(insert X H')";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   461
by (asm_simp_tac (!simpset addsimps [insert_def] 
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   462
		           setloop (rtac analz_cong)) 1);
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   463
qed "analz_insert_cong";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   464
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   465
(*If there are no pairs or encryptions then analz does nothing*)
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   466
goal thy "!!H. [| ALL X Y. {|X,Y|} ~: H;  ALL X K. Crypt X K ~: H |] ==> \
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   467
\         analz H = H";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   468
by (Step_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   469
be analz.induct 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   470
by (ALLGOALS Fast_tac);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   471
qed "analz_trivial";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   472
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   473
(*Helps to prove Fake cases*)
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   474
goal thy "!!X. X: analz (UN i. analz (H i)) ==> X: analz (UN i. H i)";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   475
be analz.induct 1;
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   476
by (ALLGOALS (fast_tac (!claset addEs [impOfSubs analz_mono])));
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   477
val lemma = result();
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   478
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   479
goal thy "analz (UN i. analz (H i)) = analz (UN i. H i)";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   480
by (fast_tac (!claset addIs [lemma]
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   481
		      addEs [impOfSubs analz_mono]) 1);
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   482
qed "analz_UN_analz";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   483
Addsimps [analz_UN_analz];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   484
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   485
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   486
(**** Inductive relation "synth" ****)
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   487
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   488
AddIs  synth.intrs;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   489
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   490
goal thy "H <= synth(H)";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   491
by (Fast_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   492
qed "synth_increasing";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   493
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   494
(*Monotonicity*)
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   495
goalw thy synth.defs "!!G H. G<=H ==> synth(G) <= synth(H)";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   496
by (rtac lfp_mono 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   497
by (REPEAT (ares_tac basic_monos 1));
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   498
qed "synth_mono";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   499
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   500
(** Unions **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   501
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   502
(*Converse fails: we can synth more from the union than from the 
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   503
  separate parts, building a compound message using elements of each.*)
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   504
goal thy "synth(G) Un synth(H) <= synth(G Un H)";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   505
by (REPEAT (ares_tac [Un_least, synth_mono, Un_upper1, Un_upper2] 1));
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   506
qed "synth_Un";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   507
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   508
goal thy "insert X (synth H) <= synth(insert X H)";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   509
by (fast_tac (!claset addEs [impOfSubs synth_mono]) 1);
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   510
qed "synth_insert";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   511
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   512
(** Idempotence and transitivity **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   513
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   514
goal thy "!!H. X: synth (synth H) ==> X: synth H";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   515
be synth.induct 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   516
by (ALLGOALS Fast_tac);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   517
qed "synth_synthE";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   518
AddSEs [synth_synthE];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   519
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   520
goal thy "synth (synth H) = synth H";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   521
by (Fast_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   522
qed "synth_idem";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   523
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   524
goal thy "!!H. [| X: synth G;  G <= synth H |] ==> X: synth H";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   525
by (dtac synth_mono 1);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   526
by (Fast_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   527
qed "synth_trans";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   528
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   529
(*Cut; Lemma 2 of Lowe*)
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   530
goal thy "!!H. [| X: synth H;  Y: synth (insert X H) |] ==> Y: synth H";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   531
be synth_trans 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   532
by (Fast_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   533
qed "synth_cut";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   534
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   535
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   536
(*Can only produce a nonce or key if it is already known,
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   537
  but can synth a pair or encryption from its components...*)
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   538
val mk_cases = synth.mk_cases msg.simps;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   539
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   540
(*NO Agent_synth, as any Agent name can be synthd*)
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   541
val Nonce_synth = mk_cases "Nonce n : synth H";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   542
val Key_synth   = mk_cases "Key K : synth H";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   543
val MPair_synth = mk_cases "{|X,Y|} : synth H";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   544
val Crypt_synth = mk_cases "Crypt X K : synth H";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   545
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   546
AddSEs [Nonce_synth, Key_synth, MPair_synth, Crypt_synth];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   547
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   548
goal thy "(Nonce N : synth H) = (Nonce N : H)";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   549
by (Fast_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   550
qed "Nonce_synth_eq";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   551
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   552
goal thy "(Key K : synth H) = (Key K : H)";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   553
by (Fast_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   554
qed "Key_synth_eq";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   555
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   556
Addsimps [Nonce_synth_eq, Key_synth_eq];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   557
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   558
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   559
goalw thy [keysFor_def]
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   560
    "keysFor (synth H) = keysFor H Un invKey``{K. Key K : H}";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   561
by (Fast_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   562
qed "keysFor_synth";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   563
Addsimps [keysFor_synth];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   564
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   565
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   566
(*** Combinations of parts, analz and synth ***)
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   567
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   568
goal thy "parts (synth H) = parts H Un synth H";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   569
br equalityI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   570
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   571
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   572
by (ALLGOALS
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   573
    (best_tac (!claset addIs ((synth_increasing RS parts_mono RS subsetD)
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   574
			     ::parts.intrs))));
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   575
qed "parts_synth";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   576
Addsimps [parts_synth];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   577
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   578
goal thy "analz (synth H) = analz H Un synth H";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   579
br equalityI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   580
br subsetI 1;
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   581
be analz.induct 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   582
by (best_tac
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   583
    (!claset addIs [synth_increasing RS analz_mono RS subsetD]) 5);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   584
(*Strange that best_tac just can't hack this one...*)
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   585
by (ALLGOALS (deepen_tac (!claset addIs analz.intrs) 0));
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   586
qed "analz_synth";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   587
Addsimps [analz_synth];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   588
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   589
(*Hard to prove; still needed now that there's only one Enemy?*)
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   590
goal thy "analz (UN i. synth (H i)) = \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   591
\         analz (UN i. H i) Un (UN i. synth (H i))";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   592
br equalityI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   593
br subsetI 1;
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   594
be analz.induct 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   595
by (best_tac
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   596
    (!claset addEs [impOfSubs synth_increasing,
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   597
		    impOfSubs analz_mono]) 5);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   598
by (Best_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   599
by (deepen_tac (!claset addIs [analz.Fst]) 0 1);
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   600
by (deepen_tac (!claset addIs [analz.Snd]) 0 1);
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   601
by (deepen_tac (!claset addSEs [analz.Decrypt]
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   602
			addIs  [analz.Decrypt]) 0 1);
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   603
qed "analz_UN1_synth";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   604
Addsimps [analz_UN1_synth];
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   605
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   606
(*Especially for reasoning about the Fake rule in traces*)
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   607
goal thy "!!Y. X: G ==> parts(insert X H) <= parts G Un parts H";
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   608
br ([parts_mono, parts_Un_subset2] MRS subset_trans) 1;
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   609
by (Fast_tac 1);
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   610
qed "parts_insert_subset_Un";
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   611
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   612
(*Also for the Fake rule, but more specific*)
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   613
goal thy "!!H. X: synth (analz H) ==> \
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   614
\              parts (insert X H) <= synth (analz H) Un parts H";
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   615
bd parts_insert_subset_Un 1;
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   616
by (Full_simp_tac 1);
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   617
by (Fast_tac 1);
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   618
qed "synth_analz_parts_insert_subset_Un";
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   619
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   620
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   621
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   622
(*We do NOT want Crypt... messages broken up in protocols!!*)
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   623
Delrules partsEs;
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   624