src/HOL/Auth/Message.ML
author paulson
Mon, 19 Aug 1996 11:19:55 +0200
changeset 1913 2809adb15eb0
parent 1893 fa58f4a06f21
child 1929 f0839bab4b00
permissions -rw-r--r--
Renaming of functions, and tidying
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];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    84
AddSEs [MPair_parts];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    85
AddDs  [parts.Body];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    86
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    87
goal thy "H <= parts(H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    88
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    89
qed "parts_increasing";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    90
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    91
(*Monotonicity*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    92
goalw thy parts.defs "!!G H. G<=H ==> parts(G) <= parts(H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    93
by (rtac lfp_mono 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    94
by (REPEAT (ares_tac basic_monos 1));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    95
qed "parts_mono";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    96
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    97
goal thy "parts{} = {}";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    98
by (Step_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    99
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   100
by (ALLGOALS Fast_tac);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   101
qed "parts_empty";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   102
Addsimps [parts_empty];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   103
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   104
goal thy "!!X. X: parts{} ==> P";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   105
by (Asm_full_simp_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   106
qed "parts_emptyE";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   107
AddSEs [parts_emptyE];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   108
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   109
(*WARNING: loops if H = {Y}, therefore must not be repeated!*)
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   110
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
   111
be parts.induct 1;
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   112
by (ALLGOALS Fast_tac);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   113
qed "parts_singleton";
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   114
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   115
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   116
(** Unions **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   117
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   118
goal thy "parts(G) Un parts(H) <= parts(G Un H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   119
by (REPEAT (ares_tac [Un_least, parts_mono, Un_upper1, Un_upper2] 1));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   120
val parts_Un_subset1 = result();
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 "parts(G Un H) <= parts(G) Un parts(H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   123
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   124
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   125
by (ALLGOALS Fast_tac);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   126
val parts_Un_subset2 = result();
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   127
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   128
goal thy "parts(G Un H) = parts(G) Un parts(H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   129
by (REPEAT (ares_tac [equalityI, parts_Un_subset1, parts_Un_subset2] 1));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   130
qed "parts_Un";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   131
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   132
(*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
   133
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
   134
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
   135
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
   136
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
   137
qed "parts_insert2";
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   138
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   139
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
   140
by (REPEAT (ares_tac [UN_least, parts_mono, UN_upper] 1));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   141
val parts_UN_subset1 = result();
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   142
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   143
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
   144
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   145
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   146
by (ALLGOALS Fast_tac);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   147
val parts_UN_subset2 = result();
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   148
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   149
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
   150
by (REPEAT (ares_tac [equalityI, parts_UN_subset1, parts_UN_subset2] 1));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   151
qed "parts_UN";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   152
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   153
goal thy "parts(UN x. H x) = (UN x. parts(H x))";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   154
by (simp_tac (!simpset addsimps [UNION1_def, parts_UN]) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   155
qed "parts_UN1";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   156
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   157
(*Added to simplify arguments to parts, analz and synth*)
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   158
Addsimps [parts_Un, parts_UN, parts_UN1];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   159
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   160
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
   161
by (fast_tac (!claset addEs [impOfSubs parts_mono]) 1);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   162
qed "parts_insert_subset";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   163
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   164
(*Especially for reasoning about the Fake rule in traces*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   165
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
   166
br ([parts_mono, parts_Un_subset2] MRS subset_trans) 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   167
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   168
qed "parts_insert_subset_Un";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   169
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   170
(** Idempotence and transitivity **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   171
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   172
goal thy "!!H. X: parts (parts H) ==> X: parts H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   173
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   174
by (ALLGOALS Fast_tac);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   175
qed "parts_partsE";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   176
AddSEs [parts_partsE];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   177
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   178
goal thy "parts (parts H) = parts H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   179
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   180
qed "parts_idem";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   181
Addsimps [parts_idem];
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 "!!H. [| X: parts G;  G <= parts H |] ==> X: parts H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   184
by (dtac parts_mono 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   185
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   186
qed "parts_trans";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   187
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   188
(*Cut*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   189
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
   190
be parts_trans 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   191
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   192
qed "parts_cut";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   193
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   194
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   195
(** Rewrite rules for pulling out atomic messages **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   196
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   197
goal thy "parts (insert (Agent agt) H) = insert (Agent agt) (parts H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   198
by (rtac (parts_insert_subset RSN (2, equalityI)) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   199
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   200
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   201
(*Simplification breaks up equalities between messages;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   202
  how to make it work for fast_tac??*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   203
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   204
qed "parts_insert_Agent";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   205
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   206
goal thy "parts (insert (Nonce N) H) = insert (Nonce N) (parts H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   207
by (rtac (parts_insert_subset RSN (2, equalityI)) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   208
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   209
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   210
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   211
qed "parts_insert_Nonce";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   212
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   213
goal thy "parts (insert (Key K) H) = insert (Key K) (parts H)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   214
by (rtac (parts_insert_subset RSN (2, equalityI)) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   215
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   216
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   217
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   218
qed "parts_insert_Key";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   219
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   220
goal thy "parts (insert (Crypt X K) H) = \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   221
\         insert (Crypt X K) (parts (insert X H))";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   222
br equalityI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   223
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   224
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   225
by (Auto_tac());
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   226
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   227
by (ALLGOALS (best_tac (!claset addIs [parts.Body])));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   228
qed "parts_insert_Crypt";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   229
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   230
goal thy "parts (insert {|X,Y|} H) = \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   231
\         insert {|X,Y|} (parts (insert X (insert Y H)))";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   232
br equalityI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   233
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   234
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   235
by (Auto_tac());
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   236
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   237
by (ALLGOALS (best_tac (!claset addIs [parts.Fst, parts.Snd])));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   238
qed "parts_insert_MPair";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   239
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   240
Addsimps [parts_insert_Agent, parts_insert_Nonce, 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   241
	  parts_insert_Key, parts_insert_Crypt, parts_insert_MPair];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   242
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   243
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   244
(**** Inductive relation "analz" ****)
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   245
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   246
val major::prems = 
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   247
goal thy "[| {|X,Y|} : analz H;       \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   248
\            [| X : analz H; Y : analz H |] ==> P  \
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   249
\         |] ==> P";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   250
by (cut_facts_tac [major] 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   251
brs prems 1;
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   252
by (REPEAT (eresolve_tac [asm_rl, analz.Fst, analz.Snd] 1));
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   253
qed "MPair_analz";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   254
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   255
AddIs  [analz.Inj];
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   256
AddSEs [MPair_analz];
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   257
AddDs  [analz.Decrypt];
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
Addsimps [analz.Inj];
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   260
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   261
goal thy "H <= analz(H)";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   262
by (Fast_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   263
qed "analz_increasing";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   264
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   265
goal thy "analz H <= parts H";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   266
by (rtac subsetI 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   267
be analz.induct 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   268
by (ALLGOALS Fast_tac);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   269
qed "analz_subset_parts";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   270
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   271
bind_thm ("not_parts_not_analz", analz_subset_parts RS contra_subsetD);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   272
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   273
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   274
goal thy "parts (analz H) = parts H";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   275
br equalityI 1;
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   276
br (analz_subset_parts RS parts_mono RS subset_trans) 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   277
by (Simp_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   278
by (fast_tac (!claset addDs [analz_increasing RS parts_mono RS subsetD]) 1);
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   279
qed "parts_analz";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   280
Addsimps [parts_analz];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   281
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   282
goal thy "analz (parts H) = parts H";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   283
by (Auto_tac());
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   284
be analz.induct 1;
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   285
by (Auto_tac());
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   286
qed "analz_parts";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   287
Addsimps [analz_parts];
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   288
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   289
(*Monotonicity; Lemma 1 of Lowe*)
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   290
goalw thy analz.defs "!!G H. G<=H ==> analz(G) <= analz(H)";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   291
by (rtac lfp_mono 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   292
by (REPEAT (ares_tac basic_monos 1));
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   293
qed "analz_mono";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   294
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   295
(** General equational properties **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   296
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   297
goal thy "analz{} = {}";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   298
by (Step_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   299
be analz.induct 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   300
by (ALLGOALS Fast_tac);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   301
qed "analz_empty";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   302
Addsimps [analz_empty];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   303
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   304
(*Converse fails: we can analz more from the union than from the 
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   305
  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
   306
goal thy "analz(G) Un analz(H) <= analz(G Un H)";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   307
by (REPEAT (ares_tac [Un_least, analz_mono, Un_upper1, Un_upper2] 1));
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   308
qed "analz_Un";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   309
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   310
goal thy "insert X (analz H) <= analz(insert X H)";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   311
by (fast_tac (!claset addEs [impOfSubs analz_mono]) 1);
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   312
qed "analz_insert";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   313
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   314
(** Rewrite rules for pulling out atomic messages **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   315
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   316
goal thy "analz (insert (Agent agt) H) = insert (Agent agt) (analz H)";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   317
by (rtac (analz_insert RSN (2, equalityI)) 1);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   318
br subsetI 1;
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   319
be analz.induct 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   320
(*Simplification breaks up equalities between messages;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   321
  how to make it work for fast_tac??*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   322
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   323
qed "analz_insert_Agent";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   324
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   325
goal thy "analz (insert (Nonce N) H) = insert (Nonce N) (analz H)";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   326
by (rtac (analz_insert RSN (2, equalityI)) 1);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   327
br subsetI 1;
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   328
be analz.induct 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   329
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   330
qed "analz_insert_Nonce";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   331
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   332
(*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
   333
goalw thy [keysFor_def]
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   334
    "!!K. K ~: keysFor (analz H) ==>  \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   335
\         analz (insert (Key K) H) = insert (Key K) (analz H)";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   336
by (rtac (analz_insert RSN (2, equalityI)) 1);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   337
br subsetI 1;
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   338
be analz.induct 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   339
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   340
qed "analz_insert_Key";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   341
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   342
goal thy "analz (insert {|X,Y|} H) = \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   343
\         insert {|X,Y|} (analz (insert X (insert Y H)))";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   344
br equalityI 1;
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   345
br subsetI 1;
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   346
be analz.induct 1;
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   347
by (Auto_tac());
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   348
be analz.induct 1;
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   349
by (ALLGOALS (deepen_tac (!claset addIs [analz.Fst, analz.Snd, analz.Decrypt]) 0));
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   350
qed "analz_insert_MPair";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   351
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   352
(*Can pull out enCrypted message if the Key is not known*)
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   353
goal thy "!!H. Key (invKey K) ~: analz H ==>  \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   354
\              analz (insert (Crypt X K) H) = \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   355
\              insert (Crypt X K) (analz H)";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   356
by (rtac (analz_insert RSN (2, equalityI)) 1);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   357
br subsetI 1;
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   358
be analz.induct 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   359
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   360
qed "analz_insert_Crypt";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   361
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   362
goal thy "!!H. Key (invKey K) : analz H ==>  \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   363
\              analz (insert (Crypt X K) H) <= \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   364
\              insert (Crypt X K) (analz (insert X H))";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   365
br subsetI 1;
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   366
by (eres_inst_tac [("za","x")] analz.induct 1);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   367
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   368
val lemma1 = result();
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   369
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   370
goal thy "!!H. Key (invKey K) : analz H ==>  \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   371
\              insert (Crypt X K) (analz (insert X H)) <= \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   372
\              analz (insert (Crypt X K) H)";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   373
by (Auto_tac());
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   374
by (eres_inst_tac [("za","x")] analz.induct 1);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   375
by (Auto_tac());
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   376
by (best_tac (!claset addIs [subset_insertI RS analz_mono RS subsetD,
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   377
			     analz.Decrypt]) 1);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   378
val lemma2 = result();
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   379
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   380
goal thy "!!H. Key (invKey K) : analz H ==>  \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   381
\              analz (insert (Crypt X K) H) = \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   382
\              insert (Crypt X K) (analz (insert X H))";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   383
by (REPEAT (ares_tac [equalityI, lemma1, lemma2] 1));
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   384
qed "analz_insert_Decrypt";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   385
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   386
(*Case analysis: either the message is secure, or it is not!
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   387
  Use with expand_if;  apparently split_tac does not cope with patterns
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   388
  such as "analz (insert (Crypt X' K) H)" *)
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   389
goal thy "analz (insert (Crypt X' K) H) = \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   390
\         (if (Key (invKey K)  : analz H) then    \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   391
\               insert (Crypt X' K) (analz (insert X' H)) \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   392
\          else insert (Crypt X' K) (analz H))";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   393
by (excluded_middle_tac "Key (invKey K)  : analz H " 1);
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   394
by (ALLGOALS (asm_simp_tac (!simpset addsimps [analz_insert_Crypt, 
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   395
					       analz_insert_Decrypt])));
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   396
qed "analz_Crypt_if";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   397
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   398
Addsimps [analz_insert_Agent, analz_insert_Nonce, 
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   399
	  analz_insert_Key, analz_insert_MPair, 
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   400
	  analz_Crypt_if];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   401
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   402
(*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
   403
goal thy  "analz (insert (Crypt X K) H) <=  \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   404
\          insert (Crypt X K) (analz (insert X H))";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   405
br subsetI 1;
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   406
be analz.induct 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   407
by (Auto_tac());
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   408
qed "analz_insert_Crypt_subset";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   409
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   410
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   411
(** Idempotence and transitivity **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   412
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   413
goal thy "!!H. X: analz (analz H) ==> X: analz H";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   414
be analz.induct 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   415
by (ALLGOALS Fast_tac);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   416
qed "analz_analzE";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   417
AddSEs [analz_analzE];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   418
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   419
goal thy "analz (analz H) = analz H";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   420
by (Fast_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   421
qed "analz_idem";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   422
Addsimps [analz_idem];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   423
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   424
goal thy "!!H. [| X: analz G;  G <= analz H |] ==> X: analz H";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   425
by (dtac analz_mono 1);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   426
by (Fast_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   427
qed "analz_trans";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   428
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   429
(*Cut; Lemma 2 of Lowe*)
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   430
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
   431
be analz_trans 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   432
by (Fast_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   433
qed "analz_cut";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   434
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   435
(*Cut can be proved easily by induction on
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   436
   "!!H. Y: analz (insert X H) ==> X: analz H --> Y: analz H"
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   437
*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   438
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   439
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   440
(** A congruence rule for "analz" **)
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   441
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   442
goal thy "!!H. [| analz G <= analz G'; analz H <= analz H' \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   443
\              |] ==> analz (G Un H) <= analz (G' Un H')";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   444
by (Step_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   445
be analz.induct 1;
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   446
by (ALLGOALS (best_tac (!claset addIs [analz_mono RS subsetD])));
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   447
qed "analz_subset_cong";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   448
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   449
goal thy "!!H. [| analz G = analz G'; analz H = analz H' \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   450
\              |] ==> analz (G Un H) = analz (G' Un H')";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   451
by (REPEAT_FIRST (ares_tac [equalityI, analz_subset_cong]
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   452
	  ORELSE' etac equalityE));
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   453
qed "analz_cong";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   454
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   455
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   456
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
   457
by (asm_simp_tac (!simpset addsimps [insert_def] 
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   458
		           setloop (rtac analz_cong)) 1);
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   459
qed "analz_insert_cong";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   460
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   461
(*If there are no pairs or encryptions then analz does nothing*)
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   462
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
   463
\         analz H = H";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   464
by (Step_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   465
be analz.induct 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   466
by (ALLGOALS Fast_tac);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   467
qed "analz_trivial";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   468
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   469
(*Helps to prove Fake cases*)
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   470
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
   471
be analz.induct 1;
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   472
by (ALLGOALS (fast_tac (!claset addEs [impOfSubs analz_mono])));
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   473
val lemma = result();
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   474
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   475
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
   476
by (fast_tac (!claset addIs [lemma]
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   477
		      addEs [impOfSubs analz_mono]) 1);
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   478
qed "analz_UN_analz";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   479
Addsimps [analz_UN_analz];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   480
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   481
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   482
(**** Inductive relation "synth" ****)
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   483
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   484
AddIs  synth.intrs;
1839
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
goal thy "H <= synth(H)";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   487
by (Fast_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   488
qed "synth_increasing";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   489
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   490
(*Monotonicity*)
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   491
goalw thy synth.defs "!!G H. G<=H ==> synth(G) <= synth(H)";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   492
by (rtac lfp_mono 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   493
by (REPEAT (ares_tac basic_monos 1));
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   494
qed "synth_mono";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   495
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   496
(** Unions **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   497
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   498
(*Converse fails: we can synth more from the union than from the 
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   499
  separate parts, building a compound message using elements of each.*)
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   500
goal thy "synth(G) Un synth(H) <= synth(G Un H)";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   501
by (REPEAT (ares_tac [Un_least, synth_mono, Un_upper1, Un_upper2] 1));
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   502
qed "synth_Un";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   503
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   504
goal thy "insert X (synth H) <= synth(insert X H)";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   505
by (fast_tac (!claset addEs [impOfSubs synth_mono]) 1);
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   506
qed "synth_insert";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   507
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   508
(** Idempotence and transitivity **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   509
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   510
goal thy "!!H. X: synth (synth H) ==> X: synth H";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   511
be synth.induct 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   512
by (ALLGOALS Fast_tac);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   513
qed "synth_synthE";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   514
AddSEs [synth_synthE];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   515
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   516
goal thy "synth (synth H) = synth H";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   517
by (Fast_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   518
qed "synth_idem";
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 "!!H. [| X: synth G;  G <= synth H |] ==> X: synth H";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   521
by (dtac synth_mono 1);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   522
by (Fast_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   523
qed "synth_trans";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   524
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   525
(*Cut; Lemma 2 of Lowe*)
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   526
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
   527
be synth_trans 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   528
by (Fast_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   529
qed "synth_cut";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   530
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   531
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   532
(*Can only produce a nonce or key if it is already known,
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   533
  but can synth a pair or encryption from its components...*)
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   534
val mk_cases = synth.mk_cases msg.simps;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   535
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   536
(*NO Agent_synth, as any Agent name can be synthd*)
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   537
val Nonce_synth = mk_cases "Nonce n : synth H";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   538
val Key_synth   = mk_cases "Key K : synth H";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   539
val MPair_synth = mk_cases "{|X,Y|} : synth H";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   540
val Crypt_synth = mk_cases "Crypt X K : synth H";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   541
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   542
AddSEs [Nonce_synth, Key_synth, MPair_synth, Crypt_synth];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   543
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   544
goal thy "(Nonce N : synth H) = (Nonce N : H)";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   545
by (Fast_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   546
qed "Nonce_synth_eq";
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 "(Key K : synth H) = (Key K : 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 "Key_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
Addsimps [Nonce_synth_eq, Key_synth_eq];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   553
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   554
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   555
goalw thy [keysFor_def]
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   556
    "keysFor (synth H) = keysFor H Un invKey``{K. Key K : H}";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   557
by (Fast_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   558
qed "keysFor_synth";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   559
Addsimps [keysFor_synth];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   560
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   561
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   562
(*** Combinations of parts, analz and synth ***)
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   563
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   564
goal thy "parts (synth H) = parts H Un synth H";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   565
br equalityI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   566
br subsetI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   567
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   568
by (ALLGOALS
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   569
    (best_tac (!claset addIs ((synth_increasing RS parts_mono RS subsetD)
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   570
			     ::parts.intrs))));
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   571
qed "parts_synth";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   572
Addsimps [parts_synth];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   573
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   574
goal thy "analz (synth H) = analz H Un synth H";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   575
br equalityI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   576
br subsetI 1;
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   577
be analz.induct 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   578
by (best_tac
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   579
    (!claset addIs [synth_increasing RS analz_mono RS subsetD]) 5);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   580
(*Strange that best_tac just can't hack this one...*)
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   581
by (ALLGOALS (deepen_tac (!claset addIs analz.intrs) 0));
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   582
qed "analz_synth";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   583
Addsimps [analz_synth];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   584
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   585
(*Hard to prove; still needed now that there's only one Enemy?*)
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   586
goal thy "analz (UN i. synth (H i)) = \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   587
\         analz (UN i. H i) Un (UN i. synth (H i))";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   588
br equalityI 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   589
br subsetI 1;
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   590
be analz.induct 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   591
by (best_tac
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   592
    (!claset addEs [impOfSubs synth_increasing,
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   593
		    impOfSubs analz_mono]) 5);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   594
by (Best_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   595
by (deepen_tac (!claset addIs [analz.Fst]) 0 1);
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   596
by (deepen_tac (!claset addIs [analz.Snd]) 0 1);
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   597
by (deepen_tac (!claset addSEs [analz.Decrypt]
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   598
			addIs  [analz.Decrypt]) 0 1);
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   599
qed "analz_UN1_synth";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   600
Addsimps [analz_UN1_synth];