src/HOL/Auth/Event.ML
author paulson
Tue, 20 Aug 1996 17:46:24 +0200
changeset 1929 f0839bab4b00
parent 1913 2809adb15eb0
child 1930 cdf9bcd53749
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
Datatype of events;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
     7
inductive relation "traces" for Needham-Schroeder (shared keys)
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
     8
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
     9
Rewrites should not refer to	 initState (Friend i)    -- not in normal form
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    10
*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    11
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
    12
Addsimps [parts_cut_eq];
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
    13
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
    14
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
    15
(*INSTALLED ON NAT.ML*)
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
    16
goalw Nat.thy [le_def] "(m <= n) = (m < Suc n)";
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
    17
by (rtac not_less_eq 1);
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
    18
qed "le_eq_less_Suc";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    19
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    20
proof_timing:=true;
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    21
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    22
(*FOR LIST.ML??*)
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
    23
goal List.thy "x : set_of_list (x#xs)";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    24
by (Simp_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
    25
qed "set_of_list_I1";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    26
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
    27
goal List.thy "!!x. xs = x#xs' ==> x : set_of_list xs";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    28
by (Asm_simp_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
    29
qed "set_of_list_eqI1";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    30
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
    31
goal List.thy "set_of_list l <= set_of_list (x#l)";
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
    32
by (Simp_tac 1);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
    33
by (Fast_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
    34
qed "set_of_list_subset_Cons";
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
    35
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    36
(*Not for Addsimps -- it can cause goals to blow up!*)
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    37
goal Set.thy "(a : (if Q then x else y)) = ((Q --> a:x) & (~Q --> a : y))";
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    38
by (simp_tac (!simpset setloop split_tac [expand_if]) 1);
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    39
qed "mem_if";
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    40
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
    41
(*FUN.ML??  WE NEED A NOTION OF INVERSE IMAGE, OR GRAPH!!*)
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    42
goal Set.thy "!!f. B <= range f = (B = f`` {x. f x: B})";
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    43
by (fast_tac (!claset addEs [equalityE]) 1);
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    44
val subset_range_iff = result();
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    45
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    46
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    47
open Event;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    48
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    49
Addsimps [Un_insert_left, Un_insert_right];
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    50
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    51
(*By default only o_apply is built-in.  But in the presence of eta-expansion
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    52
  this means that some terms displayed as (f o g) will be rewritten, and others
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    53
  will not!*)
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    54
Addsimps [o_def];
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
    55
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
    56
(*** Basic properties of serverKey and newK ***)
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
    57
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    58
(* invKey (serverKey A) = serverKey A *)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    59
bind_thm ("invKey_serverKey", rewrite_rule [isSymKey_def] isSym_serverKey);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    60
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
    61
(* invKey (newK evs) = newK evs *)
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    62
bind_thm ("invKey_newK", rewrite_rule [isSymKey_def] isSym_newK);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    63
Addsimps [invKey_serverKey, invKey_newK];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    64
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    65
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    66
(*New keys and nonces are fresh*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    67
val serverKey_inject = inj_serverKey RS injD;
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
    68
val newN_inject = inj_newN RS injD
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
    69
and newK_inject = inj_newK RS injD;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    70
AddSEs [serverKey_inject, newN_inject, newK_inject,
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    71
	fresh_newK RS notE, fresh_newN RS notE];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    72
Addsimps [inj_serverKey RS inj_eq, inj_newN RS inj_eq, inj_newK RS inj_eq];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    73
Addsimps [fresh_newN, fresh_newK];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    74
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
    75
goal thy "newK evs ~= serverKey B";
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
    76
by (subgoal_tac "newK evs = serverKey B --> \
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
    77
\                Key (newK evs) : parts (initState B)" 1);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    78
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    79
by (agent.induct_tac "B" 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    80
by (auto_tac (!claset addIs [range_eqI], !simpset));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    81
qed "newK_neq_serverKey";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    82
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    83
Addsimps [newK_neq_serverKey, newK_neq_serverKey RS not_sym];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    84
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    85
(*Good for talking about Server's initial state*)
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    86
goal thy "!!H. H <= Key``E ==> parts H = H";
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    87
by (Auto_tac ());
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    88
be parts.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    89
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    90
qed "parts_image_subset";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    91
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    92
bind_thm ("parts_image_Key", subset_refl RS parts_image_subset);
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    93
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
    94
goal thy "!!H. H <= Key``E ==> analz H = H";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
    95
by (Auto_tac ());
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
    96
be analz.induct 1;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    97
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
    98
qed "analz_image_subset";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
    99
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   100
bind_thm ("analz_image_Key", subset_refl RS analz_image_subset);
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   101
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   102
Addsimps [parts_image_Key, analz_image_Key];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   103
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   104
goalw thy [keysFor_def] "keysFor (parts (initState C)) = {}";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   105
by (agent.induct_tac "C" 1);
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   106
by (auto_tac (!claset addIs [range_eqI] delrules partsEs, !simpset));
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   107
qed "keysFor_parts_initState";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   108
Addsimps [keysFor_parts_initState];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   109
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   110
goalw thy [keysFor_def] "keysFor (Key``E) = {}";
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   111
by (Auto_tac ());
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   112
qed "keysFor_image_Key";
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   113
Addsimps [keysFor_image_Key];
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   114
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   115
goal thy "serverKey A ~: newK``E";
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   116
by (agent.induct_tac "A" 1);
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   117
by (Auto_tac ());
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   118
qed "serverKey_notin_image_newK";
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   119
Addsimps [serverKey_notin_image_newK];
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   120
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   121
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   122
(*Agents see their own serverKeys!*)
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   123
goal thy "Key (serverKey A) : analz (sees A evs)";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   124
by (list.induct_tac "evs" 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   125
by (asm_simp_tac (!simpset addsimps [impOfSubs(Un_upper2 RS analz_mono)]) 2);
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   126
by (agent.induct_tac "A" 1);
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   127
by (auto_tac (!claset addIs [range_eqI], !simpset));
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   128
qed "analz_own_serverKey";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   129
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   130
bind_thm ("parts_own_serverKey",
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   131
	  [analz_subset_parts, analz_own_serverKey] MRS subsetD);
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   132
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   133
Addsimps [analz_own_serverKey, parts_own_serverKey];
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   134
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   135
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   136
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   137
(**** Inductive relation "traces" -- basic properties ****)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   138
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   139
val mk_cases = traces.mk_cases (list.simps @ agent.simps @ event.simps);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   140
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   141
val Says_tracesE        = mk_cases "Says A B X # evs: traces";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   142
val Says_Server_tracesE = mk_cases "Says Server B X # evs: traces";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   143
val Says_Enemy_tracesE  = mk_cases "Says Enemy B X # evs: traces";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   144
val Says_to_Server_tracesE = mk_cases "Says A Server X # evs: traces";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   145
val Notes_tracesE       = mk_cases "Notes A X # evs: traces";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   146
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   147
(*The tail of a trace is a trace*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   148
goal thy "!!ev evs. ev#evs : traces ==> evs : traces";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   149
by (fast_tac (!claset addEs [mk_cases "ev#evs:traces"]) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   150
qed "traces_ConsE";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   151
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   152
goal thy "!!ev evs. [| evs = ev#evs'; evs : traces |] ==> evs' : traces";
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   153
by (fast_tac (!claset addEs [mk_cases "ev#evs:traces"]) 1);
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   154
qed "traces_eq_ConsE";
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   155
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   156
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   157
(** Specialized rewrite rules for (sees A (Says...#evs)) **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   158
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   159
goal thy "sees A (Says A B X # evs) = insert X (sees A evs)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   160
by (Simp_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   161
qed "sees_own";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   162
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   163
goal thy "!!A. Server ~= A ==> \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   164
\              sees Server (Says A B X # evs) = sees Server evs";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   165
by (Asm_simp_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   166
qed "sees_Server";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   167
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   168
goal thy "!!A. Friend i ~= A ==> \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   169
\              sees (Friend i) (Says A B X # evs) = sees (Friend i) evs";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   170
by (Asm_simp_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   171
qed "sees_Friend";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   172
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   173
goal thy "sees Enemy (Says A B X # evs) = insert X (sees Enemy evs)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   174
by (Simp_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   175
qed "sees_Enemy";
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 "sees A (Says A' B X # evs) <= insert X (sees A evs)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   178
by (simp_tac (!simpset setloop split_tac [expand_if]) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   179
by (Fast_tac 1);
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   180
qed "sees_Says_subset_insert";
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   181
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   182
goal thy "sees A evs <= sees A (Says A' B X # evs)";
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   183
by (simp_tac (!simpset setloop split_tac [expand_if]) 1);
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   184
by (Fast_tac 1);
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   185
qed "sees_subset_sees_Says";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   186
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   187
(*Pushing Unions into parts; one of the A's equals B, and thus sees Y*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   188
goal thy "(UN A. parts (sees A (Says B C Y # evs))) = \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   189
\         parts {Y} Un (UN A. parts (sees A evs))";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   190
by (Step_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   191
be rev_mp 1;	(*for some reason, split_tac does not work on assumptions*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   192
val ss = (!simpset addsimps [parts_Un, sees_Cons] 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   193
	           setloop split_tac [expand_if]);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   194
by (ALLGOALS (fast_tac (!claset addss ss)));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   195
qed "UN_parts_sees_Says";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   196
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   197
goal thy "Says A B X : set_of_list evs --> X : sees Enemy evs";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   198
by (list.induct_tac "evs" 1);
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   199
by (Auto_tac ());
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   200
qed_spec_mp "Says_imp_sees_Enemy";
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   201
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   202
Addsimps [Says_imp_sees_Enemy];
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   203
AddIs    [Says_imp_sees_Enemy];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   204
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   205
goal thy "initState C <= Key `` range serverKey";
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   206
by (agent.induct_tac "C" 1);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   207
by (Auto_tac ());
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   208
qed "initState_subset";
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   209
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   210
goal thy "X : sees C evs --> \
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   211
\          (EX A B. Says A B X : set_of_list evs) | \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   212
\          (EX A. Notes A X : set_of_list evs) | \
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   213
\          (EX A. X = Key (serverKey A))";
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   214
by (list.induct_tac "evs" 1);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   215
by (ALLGOALS Asm_simp_tac);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   216
by (fast_tac (!claset addDs [impOfSubs initState_subset]) 1);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   217
br conjI 1;
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   218
by (Fast_tac 2);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   219
by (event.induct_tac "a" 1);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   220
by (ALLGOALS (asm_simp_tac (!simpset addsimps [mem_if])));
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   221
by (ALLGOALS Fast_tac);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   222
qed_spec_mp "seesD";
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   223
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   224
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   225
Addsimps [UN_parts_sees_Says, sees_own, sees_Server, sees_Friend, sees_Enemy];
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   226
Delsimps [sees_Cons];	(**** NOTE REMOVAL -- laws above are cleaner ****)
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   227
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   228
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   229
(**** Inductive proofs about traces ****)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   230
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   231
(*The Enemy can see more than anybody else, except for their initial state*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   232
goal thy 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   233
 "!!evs. evs : traces ==> \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   234
\     sees A evs <= initState A Un sees Enemy evs";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   235
be traces.induct 1;
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   236
by (ALLGOALS (fast_tac (!claset addDs [sees_Says_subset_insert RS subsetD] 
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   237
			        addss (!simpset))));
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   238
qed "sees_agent_subset_sees_Enemy";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   239
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   240
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   241
(*Nobody sends themselves messages*)
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   242
goal thy "!!evs. evs : traces ==> ALL A X. Says A A X ~: set_of_list evs";
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   243
be traces.induct 1;
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   244
by (Auto_tac());
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   245
qed_spec_mp "not_Says_to_self";
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   246
Addsimps [not_Says_to_self];
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   247
AddSEs   [not_Says_to_self RSN (2, rev_notE)];
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   248
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   249
goal thy "!!evs. evs : traces ==> Notes A X ~: set_of_list evs";
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   250
be traces.induct 1;
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   251
by (Auto_tac());
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   252
qed "not_Notes";
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   253
Addsimps [not_Notes];
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   254
AddSEs   [not_Notes RSN (2, rev_notE)];
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   255
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   256
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   257
goal thy "!!evs. (Says S A (Crypt {|N, B, K, X|} KA)) : set_of_list evs ==> \
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   258
\                X : parts (sees Enemy evs)";
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   259
by (fast_tac (!claset addSEs partsEs
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   260
	              addSDs [Says_imp_sees_Enemy RS parts.Inj]) 1);
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   261
qed "NS3_msg_in_parts_sees_Enemy";
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   262
			      
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   263
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   264
(*** Server keys are not betrayed ***)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   265
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   266
(*Enemy never sees another agent's server key!*)
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   267
goal thy 
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   268
 "!!evs. [| evs : traces; A ~= Enemy |] ==> \
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   269
\        Key (serverKey A) ~: parts (sees Enemy evs)";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   270
be traces.induct 1;
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   271
bd NS3_msg_in_parts_sees_Enemy 5;
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   272
by (Auto_tac());
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   273
(*Deals with Fake message*)
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   274
by (best_tac (!claset addDs [impOfSubs analz_subset_parts,
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   275
			     impOfSubs synth_analz_parts_insert_subset_Un]) 1);
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   276
qed "Enemy_not_see_serverKey";
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
bind_thm ("Enemy_not_analz_serverKey",
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   279
	  [analz_subset_parts, Enemy_not_see_serverKey] MRS contra_subsetD);
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   280
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   281
Addsimps [Enemy_not_see_serverKey, 
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   282
	  not_sym RSN (2, Enemy_not_see_serverKey), 
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   283
	  Enemy_not_analz_serverKey, 
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   284
	  not_sym RSN (2, Enemy_not_analz_serverKey)];
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   285
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   286
(*We go to some trouble to preserve R in the 3rd subgoal*)
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   287
val major::prems = 
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   288
goal thy  "[| Key (serverKey A) : parts (sees Enemy evs);    \
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   289
\             evs : traces;                                  \
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   290
\             A=Enemy ==> R                                  \
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   291
\           |] ==> R";
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   292
br ccontr 1;
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   293
br ([major, Enemy_not_see_serverKey] MRS rev_notE) 1;
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   294
by (swap_res_tac prems 2);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   295
by (ALLGOALS (fast_tac (!claset addIs prems)));
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   296
qed "Enemy_see_serverKey_E";
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   297
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   298
bind_thm ("Enemy_analz_serverKey_E", 
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   299
	  analz_subset_parts RS subsetD RS Enemy_see_serverKey_E);
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   300
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   301
(*Classical reasoner doesn't need the not_sym versions (with swapped ~=) *)
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   302
AddSEs [Enemy_see_serverKey_E, Enemy_analz_serverKey_E];
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   303
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   304
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   305
(*No Friend will ever see another agent's server key 
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   306
  (excluding the Enemy, who might transmit his).
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   307
  The Server, of course, knows all server keys.*)
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   308
goal thy 
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   309
 "!!evs. [| evs : traces; A ~= Enemy;  A ~= Friend j |] ==> \
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   310
\        Key (serverKey A) ~: parts (sees (Friend j) evs)";
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   311
br (sees_agent_subset_sees_Enemy RS parts_mono RS contra_subsetD) 1;
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   312
by (ALLGOALS Asm_simp_tac);
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   313
qed "Friend_not_see_serverKey";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   314
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   315
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   316
(*Not for Addsimps -- it can cause goals to blow up!*)
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   317
goal thy  
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   318
 "!!evs. evs : traces ==>                                  \
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   319
\        (Key (serverKey A) \
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   320
\           : analz (insert (Key (serverKey B)) (sees Enemy evs))) =  \
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   321
\        (A=B | A=Enemy)";
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   322
by (best_tac (!claset addDs [impOfSubs analz_subset_parts]
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   323
		      addIs [impOfSubs (subset_insertI RS analz_mono)]
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   324
	              addss (!simpset)) 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   325
qed "serverKey_mem_analz";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   326
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   327
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   328
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   329
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   330
(*** Future keys can't be seen or used! ***)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   331
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   332
(*Nobody can have SEEN keys that will be generated in the future.
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   333
  This has to be proved anew for each protocol description,
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   334
  but should go by similar reasoning every time.  Hardest case is the
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   335
  standard Fake rule.  
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   336
      The length comparison, and Union over C, are essential for the 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   337
  induction! *)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   338
goal thy "!!evs. evs : traces ==> \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   339
\                length evs <= length evs' --> \
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   340
\                          Key (newK evs') ~: (UN C. parts (sees C evs))";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   341
be traces.induct 1;
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   342
bd NS3_msg_in_parts_sees_Enemy 5;
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   343
(*auto_tac does not work here, as it performs safe_tac first*)
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   344
by (ALLGOALS Asm_simp_tac);
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   345
by (ALLGOALS (best_tac (!claset addDs [impOfSubs analz_subset_parts,
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   346
				       impOfSubs parts_insert_subset_Un,
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   347
				       Suc_leD]
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   348
			        addss (!simpset))));
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   349
val lemma = result();
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   350
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   351
(*Variant needed for the main theorem below*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   352
goal thy 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   353
 "!!evs. [| evs : traces;  length evs <= length evs' |] ==> \
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   354
\        Key (newK evs') ~: parts (sees C evs)";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   355
by (fast_tac (!claset addDs [lemma]) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   356
qed "new_keys_not_seen";
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   357
Addsimps [new_keys_not_seen];
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   358
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   359
(*Another variant: old messages must contain old keys!*)
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   360
goal thy 
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   361
 "!!evs. [| Says A B X : set_of_list evs;  \
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   362
\           Key (newK evt) : parts {X};    \
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   363
\           evs : traces                 \
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   364
\        |] ==> length evt < length evs";
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   365
br ccontr 1;
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   366
by (fast_tac (!claset addSDs [new_keys_not_seen, Says_imp_sees_Enemy]
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   367
	              addIs [impOfSubs parts_mono, leI]) 1);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   368
qed "Says_imp_old_keys";
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   369
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   370
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   371
goal thy "!!K. newK evs = invKey K ==> newK evs = K";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   372
br (invKey_eq RS iffD1) 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   373
by (Simp_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   374
val newK_invKey = result();
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   375
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   376
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   377
val keysFor_parts_mono = parts_mono RS keysFor_mono;
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   378
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   379
(*Nobody can have USED keys that will be generated in the future.
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   380
  ...very like new_keys_not_seen*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   381
goal thy "!!evs. evs : traces ==> \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   382
\                length evs <= length evs' --> \
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   383
\                newK evs' ~: keysFor (UN C. parts (sees C evs))";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   384
be traces.induct 1;
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   385
bd NS3_msg_in_parts_sees_Enemy 5;
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   386
by (ALLGOALS Asm_simp_tac);
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   387
by (ALLGOALS
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   388
    (best_tac 
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   389
     (!claset addSDs [newK_invKey]
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   390
	      addDs [impOfSubs (analz_subset_parts RS keysFor_mono),
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   391
		     impOfSubs (parts_insert_subset_Un RS keysFor_mono),
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   392
		     Suc_leD]
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   393
	      addEs [new_keys_not_seen RS not_parts_not_analz RSN (2,rev_notE)]
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   394
	      addss (!simpset))));
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   395
val lemma = result();
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   396
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   397
goal thy 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   398
 "!!evs. [| evs : traces;  length evs <= length evs' |] ==> \
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   399
\        newK evs' ~: keysFor (parts (sees C evs))";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   400
by (fast_tac (!claset addSDs [lemma] addss (!simpset)) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   401
qed "new_keys_not_used";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   402
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   403
bind_thm ("new_keys_not_analzd",
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   404
	  [analz_subset_parts RS keysFor_mono,
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   405
	   new_keys_not_used] MRS contra_subsetD);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   406
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   407
Addsimps [new_keys_not_used, new_keys_not_analzd];
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   408
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   409
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   410
(** Rewrites to push in Key and Crypt messages, so that other messages can
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   411
    be pulled out using the analz_insert rules **)
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   412
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   413
fun insComm x y = read_instantiate_sg (sign_of thy) [("x",x), ("y",y)] 
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   414
                      insert_commute;
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   415
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   416
val pushKeys = map (insComm "Key ?K") 
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   417
                  ["Agent ?C", "Nonce ?N", "MPair ?X ?Y", "Crypt ?X ?K'"];
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   418
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   419
val pushCrypts = map (insComm "Crypt ?X ?K") 
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   420
                    ["Agent ?C", "Nonce ?N", "MPair ?X' ?Y"];
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   421
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   422
(*Cannot be added with Addsimps -- we don't always want to re-order messages*)
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   423
val pushes = pushKeys@pushCrypts;
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   424
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   425
val pushKey_newK = insComm "Key (newK ?evs)"  "Key (serverKey ?C)";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   426
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   427
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   428
(** Lemmas concerning the form of items passed in messages **)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   429
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   430
(*Describes the form *and age* of K, and the form of X,
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   431
  when the following message is sent*)
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   432
goal thy 
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   433
 "!!evs. [| Says Server A (Crypt {|N, Agent B, K, X|} K') : set_of_list evs; \
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   434
\           evs : traces    \
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   435
\        |] ==> (EX evt:traces. \
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   436
\                         K = Key(newK evt) & \
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   437
\                         X = (Crypt {|K, Agent A|} (serverKey B)) & \
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   438
\                         K' = serverKey A & \
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   439
\                         length evt < length evs)";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   440
be rev_mp 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   441
be traces.induct 1;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   442
by (ALLGOALS (fast_tac (!claset addIs [less_SucI] addss (!simpset))));
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   443
qed "Says_Server_message_form";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   444
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   445
(* c ~: keysFor (parts H) ==> c ~: keysFor (analz H) *)
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   446
bind_thm ("not_parts_not_keysFor_analz", 
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   447
	  analz_subset_parts RS keysFor_mono RS contra_subsetD);
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   448
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   449
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   450
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   451
(*USELESS for NS3, case 1, as the ind hyp says the same thing!
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   452
goal thy 
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   453
 "!!evs. [| evs = Says Server (Friend i) \
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   454
\                 (Crypt {|N, Agent(Friend j), K, X|} K') # evs';  \
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   455
\           evs : traces;  i~=k                                    \
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   456
\        |] ==>                                                    \
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   457
\     K ~: analz (insert (Key (serverKey (Friend k))) (sees Enemy evs))";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   458
be rev_mp 1;
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   459
be traces.induct 1;
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   460
by (ALLGOALS (asm_full_simp_tac (!simpset addsimps pushes)));
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   461
by (Step_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   462
by (asm_full_simp_tac (!simpset addsimps[analz_subset_parts RS contra_subsetD]) 1);
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   463
val Enemy_not_see_encrypted_key_lemma = result();
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   464
*)
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   465
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   466
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   467
(*Describes the form of X when the following message is sent*)
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   468
goal thy
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   469
 "!!evs. evs : traces ==>                             \
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   470
\        ALL A NA B K X.                            \
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   471
\            (Crypt {|Nonce NA, Agent B, Key K, X|} (serverKey A)) \
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   472
\            : parts (sees Enemy evs) & A ~= Enemy  -->   \
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   473
\          (EX evt:traces. K = newK evt & \
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   474
\                          X = (Crypt {|Key K, Agent A|} (serverKey B)))";
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   475
be traces.induct 1;
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   476
bd NS3_msg_in_parts_sees_Enemy 5;
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   477
by (Step_tac 1);
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   478
by (ALLGOALS Asm_full_simp_tac);
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   479
(*Remaining cases are Fake and NS2*)
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   480
by (fast_tac (!claset addSDs [spec]) 2);
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   481
(*Now for the Fake case*)
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   482
by (best_tac (!claset addDs [impOfSubs analz_subset_parts,
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   483
			     impOfSubs synth_analz_parts_insert_subset_Un]
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   484
	              addss (!simpset)) 1);
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   485
qed_spec_mp "encrypted_form";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   486
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   487
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   488
(*For eliminating the A ~= Enemy condition from the previous result*)
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   489
goal thy 
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   490
 "!!evs. evs : traces ==>                             \
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   491
\        ALL S A NA B K X.                            \
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   492
\            Says S A (Crypt {|Nonce NA, Agent B, Key K, X|} (serverKey A)) \
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   493
\            : set_of_list evs  -->   \
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   494
\        S = Server | S = Enemy";
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   495
be traces.induct 1;
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   496
by (ALLGOALS Asm_simp_tac);
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   497
(*We are left with NS3*)
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   498
by (subgoal_tac "S = Server | S = Enemy" 1);
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   499
(*First justify this assumption!*)
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   500
by (fast_tac (!claset addSEs [allE, mp] addss (!simpset)) 2);
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   501
by (Step_tac 1);
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   502
bd Says_Server_message_form 1;
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   503
by (ALLGOALS Full_simp_tac);
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   504
(*Final case.  Clear out needless quantifiers to speed the following step*)
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   505
by (eres_inst_tac [("V","ALL x. ?P(x)")] thin_rl 1);
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   506
bd encrypted_form 1;
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   507
br (parts.Inj RS conjI) 1;
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   508
auto();
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   509
qed_spec_mp "Server_or_Enemy";
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   510
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   511
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   512
(*Describes the form of X when the following message is sent;
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   513
  use Says_Server_message_form if applicable*)
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   514
goal thy 
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   515
 "!!evs. [| Says S A (Crypt {|Nonce NA, Agent B, Key K, X|} (serverKey A)) \
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   516
\            : set_of_list evs;                              \
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   517
\           evs : traces               \
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   518
\        |] ==> (EX evt:traces. K = newK evt & length evt < length evs & \
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   519
\                               X = (Crypt {|Key K, Agent A|} (serverKey B)))";
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   520
by (forward_tac [Server_or_Enemy] 1);
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   521
ba 1;
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   522
by (Step_tac 1);
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   523
by (fast_tac (!claset addSDs [Says_Server_message_form] addss (!simpset)) 1);
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   524
by (forward_tac [encrypted_form] 1);
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   525
br (parts.Inj RS conjI) 1;
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   526
by (auto_tac (!claset addIs [Says_imp_old_keys], !simpset));
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   527
qed "Says_S_message_form";
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   528
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   529
goal thy 
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   530
 "!!evs. [| evs = Says S A (Crypt {|Nonce NA, Agent B, Key K, X|}   \
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   531
\                           (serverKey A)) # evs';                  \
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   532
\           evs : traces                                           \
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   533
\        |] ==> (EX evt:traces. evs' : traces & length evt < length evs & \
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   534
\                               K = newK evt & \
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   535
\                               X = (Crypt {|Key K, Agent A|} (serverKey B)))";
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   536
by (forward_tac [traces_eq_ConsE] 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   537
by (dtac (set_of_list_eqI1 RS Says_S_message_form) 2);
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   538
by (Auto_tac());	
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   539
qed "Says_S_message_form_eq";
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   540
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   541
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   542
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   543
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   544
(****
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   545
 The following is to prove theorems of the form
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   546
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   547
          Key K : analz (insert (Key (newK evt)) 
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   548
	                   (insert (Key (serverKey C)) (sees Enemy evs))) ==>
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   549
          Key K : analz (insert (Key (serverKey C)) (sees Enemy evs))
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   550
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   551
 A more general formula must be proved inductively.
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   552
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   553
****)
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   554
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   555
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   556
(*Not useful in this form, but it says that session keys are not used
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   557
  to encrypt messages containing other keys, in the actual protocol.
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   558
  We require that agents should behave like this subsequently also.*)
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   559
goal thy 
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   560
 "!!evs. evs : traces ==> \
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   561
\        (Crypt X (newK evt)) : parts (sees Enemy evs) & \
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   562
\        Key K : parts {X} --> Key K : parts (sees Enemy evs)";
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   563
be traces.induct 1;
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   564
bd NS3_msg_in_parts_sees_Enemy 5;
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   565
by (ALLGOALS (asm_simp_tac (!simpset addsimps pushes)));
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   566
(*Deals with Faked messages*)
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   567
by (best_tac (!claset addSEs partsEs
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   568
		      addDs [impOfSubs analz_subset_parts,
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   569
                             impOfSubs parts_insert_subset_Un]
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   570
                      addss (!simpset)) 1);
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   571
result();
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   572
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   573
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   574
(** Specialized rewriting for this proof **)
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   575
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   576
Delsimps [image_insert];
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   577
Addsimps [image_insert RS sym];
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   578
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   579
goal thy "insert (Key (newK x)) (sees A evs) = \
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   580
\         Key `` (newK``{x}) Un (sees A evs)";
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   581
by (Fast_tac 1);
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   582
val insert_Key_singleton = result();
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   583
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   584
goal thy "insert (Key (f x)) (Key``(f``E) Un C) = \
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   585
\         Key `` (f `` (insert x E)) Un C";
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   586
by (Fast_tac 1);
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   587
val insert_Key_image = result();
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   588
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   589
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   590
(** Session keys are not used to encrypt other session keys **)
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   591
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   592
goal thy  
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   593
 "!!evs. evs : traces ==> \
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   594
\  ALL K E. (Key K : analz (insert (Key (serverKey C)) \
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   595
\                             (Key``(newK``E) Un (sees Enemy evs)))) = \
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   596
\           (K : newK``E |  \
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   597
\            Key K : analz (insert (Key (serverKey C)) \
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   598
\                             (sees Enemy evs)))";
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   599
be traces.induct 1;
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   600
by (forward_tac [Says_S_message_form] 5 THEN assume_tac 5);	
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   601
by (REPEAT ((eresolve_tac [bexE, conjE] ORELSE' hyp_subst_tac) 5));
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   602
by (ALLGOALS 
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   603
    (asm_simp_tac 
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   604
     (!simpset addsimps ([insert_Key_singleton, insert_Key_image, pushKey_newK]
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   605
			 @ pushes)
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   606
               setloop split_tac [expand_if])));
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   607
(*Cases NS2 and NS3!!  Simple, thanks to auto case splits*)
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   608
by (REPEAT (Fast_tac 3));
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   609
(*Base case*)
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   610
by (fast_tac (!claset addIs [image_eqI] addss (!simpset)) 1);
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   611
(** LEVEL 7 **)
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   612
(*Fake case*)
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   613
by (REPEAT (Safe_step_tac 1));
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   614
by (fast_tac (!claset addSEs [impOfSubs analz_mono]) 2);
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   615
by (subgoal_tac 
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   616
    "Key K : analz \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   617
\             (synth \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   618
\              (analz (insert (Key (serverKey C)) \
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   619
\                        (Key``(newK``E) Un (sees Enemy evsa)))))" 1);
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   620
(*First, justify this subgoal*)
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   621
(*Discard formulae for better speed*)
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   622
by (eres_inst_tac [("V","ALL S.?P(S)")] thin_rl 2);
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   623
by (eres_inst_tac [("V","?Q ~: ?QQ")] thin_rl 2);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   624
by (best_tac (!claset addIs [impOfSubs (analz_mono RS synth_mono)]
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   625
                      addSEs [impOfSubs analz_mono]) 2);
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   626
by (Asm_full_simp_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   627
by (deepen_tac (!claset addIs [impOfSubs analz_mono]) 0 1);
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   628
qed_spec_mp "analz_image_newK";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   629
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   630
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   631
goal thy  
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   632
 "!!evs. evs : traces ==>                                  \
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   633
\        Key K : analz (insert (Key (newK evt))            \
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   634
\                         (insert (Key (serverKey C))      \
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   635
\                          (sees Enemy evs))) =            \
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   636
\             (K = newK evt |                              \
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   637
\              Key K : analz (insert (Key (serverKey C))   \
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   638
\                               (sees Enemy evs)))";
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   639
by (asm_simp_tac (HOL_ss addsimps [pushKey_newK, analz_image_newK, 
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   640
				   insert_Key_singleton]) 1);
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   641
by (Fast_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   642
qed "analz_insert_Key_newK";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   643
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   644
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   645
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   646
(*This says that the Key, K, uniquely identifies the message.
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   647
    But if C=Enemy then he could send all sorts of nonsense.*)
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   648
goal thy 
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   649
 "!!evs. evs : traces ==>                      \
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   650
\      EX X'. ALL C S A Y N B X.               \
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   651
\         C ~= Enemy -->                       \
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   652
\         Says S A Y : set_of_list evs -->     \
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   653
\         ((Crypt {|N, Agent B, Key K, X|} (serverKey C)) : parts{Y} --> \
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   654
\       (X = X'))";
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   655
be traces.induct 1;
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   656
by (forward_tac [Says_S_message_form] 5 THEN assume_tac 5);	
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   657
by (ALLGOALS 
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   658
    (asm_simp_tac (!simpset addsimps [all_conj_distrib, imp_conj_distrib])));
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   659
(*NS2: Case split propagates some context to other subgoal...*)
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   660
by (excluded_middle_tac "K = newK evsa" 2);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   661
by (Asm_simp_tac 2);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   662
(*...we assume X is a very new message, and handle this case by contradiction*)
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   663
by (fast_tac (!claset addIs [impOfSubs (subset_insertI RS parts_mono)]
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   664
		      addSEs partsEs
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   665
		      addEs [Says_imp_old_keys RS less_irrefl]
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   666
	              addss (!simpset)) 2);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   667
(*NS3: No relevant messages*)
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   668
by (fast_tac (!claset addSEs [exI] addss (!simpset)) 2);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   669
(*Fake*)
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   670
by (Step_tac 1);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   671
br exI 1;
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   672
br conjI 1;
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   673
ba 2;
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   674
by (Step_tac 1);
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   675
(** LEVEL 12 **)
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   676
by (subgoal_tac "Crypt {|N, Agent Ba, Key K, Xa|} (serverKey C) \
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   677
\                  : parts (sees Enemy evsa)" 1);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   678
by (eres_inst_tac [("V","ALL S.?P(S)")] thin_rl 2);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   679
by (best_tac (!claset addSEs [impOfSubs analz_subset_parts]
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   680
	              addDs [impOfSubs parts_insert_subset_Un]
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   681
                      addss (!simpset)) 2);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   682
by (eres_inst_tac [("V","?aa : parts {X}")] thin_rl 1);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   683
bd parts_singleton 1;
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   684
by (Step_tac 1);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   685
bd seesD 1;
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   686
by (Step_tac 1);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   687
by (Full_simp_tac 2);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   688
by (fast_tac (!claset addSDs [spec]) 1);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   689
val lemma = result();
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   690
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   691
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   692
(*In messages of this form, the session key uniquely identifies the rest*)
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   693
goal thy 
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   694
 "!!evs. [| Says S A          \
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   695
\             (Crypt {|N, Agent B, Key K, X|} (serverKey C))     \
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   696
\                  : set_of_list evs; \
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   697
 \          Says S' A'                                         \
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   698
\             (Crypt {|N', Agent B', Key K, X'|} (serverKey C')) \
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   699
\                  : set_of_list evs;                         \
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   700
\           evs : traces;  C ~= Enemy;  C' ~= Enemy    |] ==> X = X'";
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   701
bd lemma 1;
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   702
be exE 1;
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   703
by (forw_inst_tac [("psi", "ALL C.?P(C)")] asm_rl 1);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   704
by (Fast_tac 1);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   705
qed "unique_session_keys";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   706
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   707
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   708
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   709
(*Crucial security property: Enemy does not see the keys sent in msg NS2
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   710
   -- even if another key is compromised*)
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   711
goal thy 
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   712
 "!!evs. [| Says Server (Friend i) \
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   713
\            (Crypt {|N, Agent(Friend j), K, X|} K') : set_of_list evs;  \
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   714
\           evs : traces;  Friend i ~= C;  Friend j ~= C              \
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   715
\        |] ==>                                                       \
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   716
\     K ~: analz (insert (Key (serverKey C)) (sees Enemy evs))";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   717
be rev_mp 1;
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   718
be traces.induct 1;
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   719
by (ALLGOALS (asm_simp_tac (!simpset addsimps pushes)));
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   720
(*Next 3 steps infer that K has the form "Key (newK evs'" ... *)
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   721
by (REPEAT_FIRST (resolve_tac [conjI, impI]));
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   722
by (TRYALL (forward_tac [Says_Server_message_form] THEN' assume_tac));
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   723
by (REPEAT_FIRST (eresolve_tac [bexE, conjE] ORELSE' hyp_subst_tac));
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   724
by (ALLGOALS 
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   725
    (asm_full_simp_tac 
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   726
     (!simpset addsimps ([analz_subset_parts RS contra_subsetD,
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   727
			  analz_insert_Key_newK] @ pushes)
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   728
               setloop split_tac [expand_if])));
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   729
(*NS2*)
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   730
by (fast_tac (!claset addSEs [less_irrefl]) 2);
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   731
(** LEVEL 8 **)
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   732
(*Now for the Fake case*)
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   733
br notI 1;
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   734
by (subgoal_tac 
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   735
    "Key (newK evt) : \
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   736
\    analz (synth (analz (insert (Key (serverKey C)) \
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   737
\                                  (sees Enemy evsa))))" 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   738
be (impOfSubs analz_mono) 2;
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   739
by (deepen_tac (!claset addIs [analz_mono RS synth_mono RSN (2,rev_subsetD),
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   740
			       impOfSubs synth_increasing,
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   741
			       impOfSubs analz_increasing]) 0 2);
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   742
(*Proves the Fake goal*)
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   743
by (fast_tac (!claset addss (!simpset)) 1);
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   744
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   745
(**LEVEL 13**)
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   746
(*NS3: that message from the Server was sent earlier*)
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   747
by (mp_tac 1);
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   748
by (forward_tac [Says_S_message_form] 1 THEN assume_tac 1);
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   749
by (REPEAT_FIRST (eresolve_tac [bexE, conjE] ORELSE' hyp_subst_tac));
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   750
by (asm_full_simp_tac
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   751
    (!simpset addsimps (mem_if::analz_insert_Key_newK::pushes)) 1);
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   752
by (Step_tac 1);
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   753
(**LEVEL 18 **)
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   754
bd unique_session_keys 1;
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   755
by (REPEAT_FIRST assume_tac);
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   756
by (ALLGOALS Full_simp_tac);
1929
f0839bab4b00 Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents: 1913
diff changeset
   757
by (Step_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   758
by (asm_full_simp_tac (!simpset addsimps [serverKey_mem_analz]) 1);
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   759
qed "Enemy_not_see_encrypted_key";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   760
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   761
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   762
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   763
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   764
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX;
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   765
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   766
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   767
goals_limit:=4;
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   768
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   769
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   770
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   771
goal thy 
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   772
 "!!evs. [| Says Server (Friend i) \
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   773
\             (Crypt {|N, Agent B, K|} K') : set_of_list evs;  \
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   774
\           evs : traces;  i~=j    \
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   775
\         |] ==> K ~: analz (sees (Friend j) evs)";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   776
br (sees_agent_subset_sees_Enemy RS analz_mono RS contra_subsetD) 1;
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   777
by (ALLGOALS (asm_simp_tac (!simpset addsimps [Enemy_not_see_encrypted_key])));
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   778
qed "Friend_not_see_encrypted_key";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   779
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   780
goal thy 
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   781
 "!!evs. [| Says Server (Friend i) \
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   782
\             (Crypt {|N, Agent B, K|} K') : set_of_list evs;  \
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   783
\           A ~: {Friend i, Server};  \
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   784
\           evs : traces    \
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   785
\        |] ==>  K ~: analz (sees A evs)";
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   786
by (eres_inst_tac [("P", "A~:?X")] rev_mp 1);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   787
by (agent.induct_tac "A" 1);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   788
by (ALLGOALS Simp_tac);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   789
by (asm_simp_tac (!simpset addsimps [eq_sym_conv, 
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   790
				     Friend_not_see_encrypted_key]) 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   791
br ([analz_mono, Enemy_not_see_encrypted_key] MRS contra_subsetD) 1;
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   792
(*  hyp_subst_tac would deletes the equality assumption... *)
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   793
by (ALLGOALS (rtac n_not_Suc_n ORELSE' Fast_tac));
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   794
qed "Agent_not_see_encrypted_key";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   795
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   796
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   797
(*Neatly packaged, perhaps in a useless form*)
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   798
goalw thy [knownBy_def]
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   799
 "!!evs. [| Says Server (Friend i) \
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   800
\             (Crypt {|N, Agent B, K|} K') : set_of_list evs;  \
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   801
\           evs : traces    \
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   802
\        |] ==>  knownBy evs K <= {Friend i, Server}";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   803
1893
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   804
by (Step_tac 1);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   805
br ccontr 1;
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   806
by (fast_tac (!claset addDs [Agent_not_see_encrypted_key]) 1);
fa58f4a06f21 Works up to main theorem, then XXX...X
paulson
parents: 1885
diff changeset
   807
qed "knownBy_encrypted_key";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   808
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   809
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   810
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   811
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   812
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   813
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   814
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   815
push_proof();
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   816
goal thy 
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   817
 "!!evs. [| evs = Says S (Friend i) \
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   818
\                 (Crypt {|N, Agent(Friend j), K, X|} K') # evs';  \
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   819
\           evs : traces;  i~=k                                    \
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   820
\        |] ==>                                                    \
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   821
\     K ~: analz (insert (Key (serverKey (Friend k))) (sees Enemy evs))";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   822
be rev_mp 1;
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   823
be traces.induct 1;
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   824
by (ALLGOALS (asm_full_simp_tac (!simpset addsimps pushes)));
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   825
by (Step_tac 1);
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   826
by (asm_full_simp_tac (!simpset addsimps[analz_subset_parts RS contra_subsetD]) 1);
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   827
val Enemy_not_see_encrypted_key_lemma = result();
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   828
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   829
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   830
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   831
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   832
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   833
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   834
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   835
(*Precisely formulated as needed below.  Perhaps redundant, as simplification
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   836
  with the aid of  analz_subset_parts RS contra_subsetD  might do the
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   837
  same thing.*)
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   838
goal thy 
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   839
 "!!evs. [| evs : traces; A ~= Enemy;  A ~= Friend j |] ==> \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   840
\        Key (serverKey A) ~:                               \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   841
\          analz (insert (Key (serverKey (Friend j))) (sees Enemy evs))";
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   842
br (analz_subset_parts RS contra_subsetD) 1;
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   843
by (Asm_simp_tac 1);
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   844
qed "insert_not_analz_serverKey";
1885
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   845
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   846
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   847
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   848
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   849
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX;
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   850
proof_timing:=true;
a18a6dc14f76 Auth proofs work up to the XXX...
paulson
parents: 1852
diff changeset
   851
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   853
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   854
YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY;
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   855
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   856
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   857
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   858
(*If a message is sent, encrypted with a Friend's server key, then either
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   859
  that Friend or the Server originally sent it.*)
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   860
goal thy 
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   861
 "!!evs. evs : traces ==>                             \
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   862
\    ALL A B X i. Says A B (Crypt X (serverKey (Friend i))) \
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   863
\        : set_of_list evs  -->   \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   864
\    (EX B'. Says Server B' (Crypt X (serverKey (Friend i))) : set_of_list evs | \
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   865
\            Says (Friend i) B' (Crypt X (serverKey (Friend i))) : set_of_list evs)";
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   866
be traces.induct 1;
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   867
by (Step_tac 1);
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   868
by (ALLGOALS Asm_full_simp_tac);
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   869
(*Remaining cases are Fake, NS2 and NS3*)
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   870
by (Fast_tac 2);	(*Proves the NS2 case*)
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   871
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   872
by (REPEAT (dtac spec 2));
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   873
fe conjE;
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   874
bd mp 2;
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   875
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   876
by (REPEAT (resolve_tac [refl, conjI] 2));
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   877
by (ALLGOALS Asm_full_simp_tac);
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   878
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   879
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   880
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   881
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   882
by (full_simp_tac (!simpset addsimps [all_conj_distrib]) 2);
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   883
be conjE 2;
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   884
by ((dtac spec THEN' dtac spec THEN' dtac spec THEN' dtac spec)2);
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   885
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   886
(*The NS3 case needs the induction hypothesis twice!
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   887
    One application is to the X component of the most recent message.*)
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   888
by (subgoal_tac "? evs'. X = Crypt {|Key (newK evs'), Agent A|} (serverKey B)" 2);
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   889
by (Fast_tac 3);
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   890
by (full_simp_tac (!simpset addsimps [all_conj_distrib]) 2);
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   891
be conjE 2;
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   892
(*DELETE the first quantified formula: it's now useless*)
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   893
by (eres_inst_tac [("V","ALL S.?P(S)")] thin_rl 2);
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   894
by (fast_tac (!claset addss (!simpset)) 2);
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   895
(*Now for the Fake case*)
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   896
be disjE 1;
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   897
(*The subcase of Fake, where the message in question is NOT the most recent*)
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   898
by (Best_tac 2);
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   899
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   900
by (REPEAT_FIRST (etac conjE ORELSE' hyp_subst_tac));
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   901
be Crypt_synth 1;
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   902
be Key_synth 2;
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   903
1913
2809adb15eb0 Renaming of functions, and tidying
paulson
parents: 1893
diff changeset
   904
(*Split up the possibilities of that message being synthd...*)
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   905
by (Step_tac 1);
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   906
by (Best_tac 6);
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   907
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   908
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   909
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   910
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   911
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   912
(*NEEDED??*)
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   913
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   914
goal thy "!!A. X ~= Y ==> (X : sees A (Says B C Y # evs)) = (X : sees A evs)";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   915
by (asm_simp_tac (!simpset addsimps [sees_Cons] 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   916
                           setloop split_tac [expand_if]) 1); 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   917
qed "in_sees_Says";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   918
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   919
goal thy "!!A. X ~: parts {Y} ==> \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   920
\              (X : parts (sees A (Says B C Y # evs))) = \
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   921
\              (X : parts (sees A evs))";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   922
by (asm_simp_tac (!simpset addsimps [sees_Cons] 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   923
                           setloop split_tac [expand_if]) 1); 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   924
by (asm_simp_tac (!simpset addsimps [parts_Un]) 1); 
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   925
qed "in_parts_sees_Says";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   926
1852
289ce6cb5c84 Added Msg 3; works up to Says_Server_imp_Key_newK
paulson
parents: 1839
diff changeset
   927
goal thy "!!evs. length evs < length evs' ==> newK  evs ~= newK (A',evs')";
1839
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   928
by (fast_tac (!claset addSEs [less_irrefl]) 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   929
qed "length_less_newK_neq";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   930
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   931
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   932
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   933
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   934
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   935
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   936
YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY;
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   937
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   938
goalw thy [keysFor_def]
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   939
    "!!X. Crypt X K: H ==> invKey K : keysFor H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   940
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   941
qed "keysFor_I";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   942
AddSIs [keysFor_I];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   943
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   944
goalw thy [keysFor_def]
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   945
    "!!K. K : keysFor H ==> EX X K'. K=invKey K' & Crypt X K': H";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   946
by (Fast_tac 1);
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   947
qed "keysFor_D";
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   948
AddSDs [keysFor_D];
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   949
199243afac2b Proving safety properties of authentication protocols
paulson
parents:
diff changeset
   950