author | paulson |
Thu, 05 Dec 1996 19:03:08 +0100 | |
changeset 2326 | 6df4488339e4 |
parent 2320 | 41289907faed |
child 2376 | f5c61fd9b9b6 |
permissions | -rw-r--r-- |
2320 | 1 |
(* Title: HOL/Auth/Shared |
1934 | 2 |
ID: $Id$ |
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
|
4 |
Copyright 1996 University of Cambridge |
|
5 |
||
6 |
Theory of Shared Keys (common to all symmetric-key protocols) |
|
7 |
||
8 |
Server keys; initial states of agents; new nonces and keys; function "sees" |
|
2032 | 9 |
*) |
10 |
||
1934 | 11 |
|
12 |
open Shared; |
|
13 |
||
1964 | 14 |
(*Holds because Friend is injective: thus cannot prove for all f*) |
15 |
goal thy "(Friend x : Friend``A) = (x:A)"; |
|
16 |
by (Auto_tac()); |
|
17 |
qed "Friend_image_eq"; |
|
18 |
Addsimps [Friend_image_eq]; |
|
19 |
||
1934 | 20 |
Addsimps [Un_insert_left, Un_insert_right]; |
21 |
||
22 |
(*By default only o_apply is built-in. But in the presence of eta-expansion |
|
23 |
this means that some terms displayed as (f o g) will be rewritten, and others |
|
24 |
will not!*) |
|
25 |
Addsimps [o_def]; |
|
26 |
||
1943 | 27 |
(*** Basic properties of shrK and newK ***) |
1934 | 28 |
|
1943 | 29 |
(* invKey (shrK A) = shrK A *) |
30 |
bind_thm ("invKey_shrK", rewrite_rule [isSymKey_def] isSym_shrK); |
|
1934 | 31 |
|
32 |
(* invKey (newK evs) = newK evs *) |
|
33 |
bind_thm ("invKey_newK", rewrite_rule [isSymKey_def] isSym_newK); |
|
1943 | 34 |
Addsimps [invKey_shrK, invKey_newK]; |
1934 | 35 |
|
36 |
||
1993 | 37 |
(*Injectiveness and freshness of new keys and nonces*) |
2264
f298678bd54a
Weaking of injectivity assumptions for newK and newN:
paulson
parents:
2160
diff
changeset
|
38 |
AddIffs [inj_shrK RS inj_eq]; |
f298678bd54a
Weaking of injectivity assumptions for newK and newN:
paulson
parents:
2160
diff
changeset
|
39 |
AddSDs [newN_length, newK_length]; |
1934 | 40 |
|
2320 | 41 |
Addsimps [newK_neq_shrK, newK_neq_shrK RS not_sym]; |
42 |
||
1934 | 43 |
(** Rewrites should not refer to initState(Friend i) |
44 |
-- not in normal form! **) |
|
45 |
||
2032 | 46 |
goal thy "Key (newK evs) ~: parts (initState lost B)"; |
47 |
by (agent.induct_tac "B" 1); |
|
1934 | 48 |
by (Auto_tac ()); |
2032 | 49 |
qed "newK_notin_initState"; |
1934 | 50 |
|
2032 | 51 |
goal thy "Nonce (newN evs) ~: parts (initState lost B)"; |
52 |
by (agent.induct_tac "B" 1); |
|
1934 | 53 |
by (Auto_tac ()); |
2032 | 54 |
qed "newN_notin_initState"; |
1934 | 55 |
|
2032 | 56 |
AddIffs [newK_notin_initState, newN_notin_initState]; |
1934 | 57 |
|
2032 | 58 |
goalw thy [keysFor_def] "keysFor (parts (initState lost C)) = {}"; |
1934 | 59 |
by (agent.induct_tac "C" 1); |
1993 | 60 |
by (auto_tac (!claset addIs [range_eqI], !simpset)); |
1934 | 61 |
qed "keysFor_parts_initState"; |
62 |
Addsimps [keysFor_parts_initState]; |
|
63 |
||
64 |
goalw thy [keysFor_def] "keysFor (Key``E) = {}"; |
|
65 |
by (Auto_tac ()); |
|
66 |
qed "keysFor_image_Key"; |
|
67 |
Addsimps [keysFor_image_Key]; |
|
68 |
||
1943 | 69 |
goal thy "shrK A ~: newK``E"; |
1934 | 70 |
by (agent.induct_tac "A" 1); |
71 |
by (Auto_tac ()); |
|
1943 | 72 |
qed "shrK_notin_image_newK"; |
73 |
Addsimps [shrK_notin_image_newK]; |
|
1934 | 74 |
|
2032 | 75 |
|
76 |
(*** Function "sees" ***) |
|
77 |
||
78 |
goal thy |
|
79 |
"!!evs. lost' <= lost ==> sees lost' A evs <= sees lost A evs"; |
|
80 |
by (list.induct_tac "evs" 1); |
|
81 |
by (agent.induct_tac "A" 1); |
|
82 |
by (event.induct_tac "a" 2); |
|
83 |
by (Auto_tac ()); |
|
84 |
qed "sees_mono"; |
|
85 |
||
1964 | 86 |
(*Agents see their own shared keys!*) |
2032 | 87 |
goal thy "A ~= Spy --> Key (shrK A) : sees lost A evs"; |
1934 | 88 |
by (list.induct_tac "evs" 1); |
89 |
by (agent.induct_tac "A" 1); |
|
2032 | 90 |
by (Auto_tac ()); |
91 |
qed_spec_mp "sees_own_shrK"; |
|
1934 | 92 |
|
2032 | 93 |
(*Spy sees shared keys of lost agents!*) |
2045
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
94 |
goal thy "!!A. A: lost ==> Key (shrK A) : sees lost Spy evs"; |
2032 | 95 |
by (list.induct_tac "evs" 1); |
96 |
by (Auto_tac()); |
|
2045
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
97 |
qed "Spy_sees_lost"; |
1934 | 98 |
|
2045
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
99 |
AddSIs [sees_own_shrK, Spy_sees_lost]; |
2032 | 100 |
|
2124
9677fdf5fc23
New theorem Crypt_Spy_analz_lost; improvements to spy_analz_tac; ex_strip_tac
paulson
parents:
2109
diff
changeset
|
101 |
(*Added for Yahalom/lost_tac*) |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
102 |
goal thy "!!A. [| Crypt (shrK A) X : analz (sees lost Spy evs); A: lost |] \ |
2124
9677fdf5fc23
New theorem Crypt_Spy_analz_lost; improvements to spy_analz_tac; ex_strip_tac
paulson
parents:
2109
diff
changeset
|
103 |
\ ==> X : analz (sees lost Spy evs)"; |
9677fdf5fc23
New theorem Crypt_Spy_analz_lost; improvements to spy_analz_tac; ex_strip_tac
paulson
parents:
2109
diff
changeset
|
104 |
by (fast_tac (!claset addSDs [analz.Decrypt] addss (!simpset)) 1); |
9677fdf5fc23
New theorem Crypt_Spy_analz_lost; improvements to spy_analz_tac; ex_strip_tac
paulson
parents:
2109
diff
changeset
|
105 |
qed "Crypt_Spy_analz_lost"; |
9677fdf5fc23
New theorem Crypt_Spy_analz_lost; improvements to spy_analz_tac; ex_strip_tac
paulson
parents:
2109
diff
changeset
|
106 |
|
2032 | 107 |
(** Specialized rewrite rules for (sees lost A (Says...#evs)) **) |
2026
0df5a96bf77e
Last working version prior to introduction of "lost"
paulson
parents:
2012
diff
changeset
|
108 |
|
2078 | 109 |
goal thy "sees lost B (Says A B X # evs) = insert X (sees lost B evs)"; |
1934 | 110 |
by (Simp_tac 1); |
111 |
qed "sees_own"; |
|
112 |
||
2078 | 113 |
goal thy "!!A. Server ~= B ==> \ |
114 |
\ sees lost Server (Says A B X # evs) = sees lost Server evs"; |
|
1934 | 115 |
by (Asm_simp_tac 1); |
116 |
qed "sees_Server"; |
|
117 |
||
2078 | 118 |
goal thy "!!A. Friend i ~= B ==> \ |
119 |
\ sees lost (Friend i) (Says A B X # evs) = sees lost (Friend i) evs"; |
|
1934 | 120 |
by (Asm_simp_tac 1); |
121 |
qed "sees_Friend"; |
|
122 |
||
2032 | 123 |
goal thy "sees lost Spy (Says A B X # evs) = insert X (sees lost Spy evs)"; |
1934 | 124 |
by (Simp_tac 1); |
2032 | 125 |
qed "sees_Spy"; |
1934 | 126 |
|
2032 | 127 |
goal thy "sees lost A (Says A' B X # evs) <= insert X (sees lost A evs)"; |
1934 | 128 |
by (simp_tac (!simpset setloop split_tac [expand_if]) 1); |
129 |
by (Fast_tac 1); |
|
130 |
qed "sees_Says_subset_insert"; |
|
131 |
||
2032 | 132 |
goal thy "sees lost A evs <= sees lost A (Says A' B X # evs)"; |
1934 | 133 |
by (simp_tac (!simpset setloop split_tac [expand_if]) 1); |
134 |
by (Fast_tac 1); |
|
135 |
qed "sees_subset_sees_Says"; |
|
136 |
||
2132 | 137 |
(*Pushing Unions into parts. One of the agents A is B, and thus sees Y. |
2160 | 138 |
Once used to prove new_keys_not_seen; now obsolete.*) |
2032 | 139 |
goal thy "(UN A. parts (sees lost A (Says B C Y # evs))) = \ |
140 |
\ parts {Y} Un (UN A. parts (sees lost A evs))"; |
|
1934 | 141 |
by (Step_tac 1); |
2132 | 142 |
by (etac rev_mp 1); (*split_tac does not work on assumptions*) |
143 |
by (ALLGOALS |
|
144 |
(fast_tac (!claset addss (!simpset addsimps [parts_Un, sees_Cons] |
|
145 |
setloop split_tac [expand_if])))); |
|
1934 | 146 |
qed "UN_parts_sees_Says"; |
147 |
||
2032 | 148 |
goal thy "Says A B X : set_of_list evs --> X : sees lost Spy evs"; |
1934 | 149 |
by (list.induct_tac "evs" 1); |
150 |
by (Auto_tac ()); |
|
2032 | 151 |
qed_spec_mp "Says_imp_sees_Spy"; |
1934 | 152 |
|
2064 | 153 |
goal thy |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
154 |
"!!evs. [| Says A B (Crypt (shrK C) X) : set_of_list evs; C : lost |] \ |
2064 | 155 |
\ ==> X : analz (sees lost Spy evs)"; |
156 |
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj] |
|
157 |
addss (!simpset)) 1); |
|
158 |
qed "Says_Crypt_lost"; |
|
159 |
||
2072 | 160 |
goal thy |
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2264
diff
changeset
|
161 |
"!!evs. [| Says A B (Crypt (shrK C) X) : set_of_list evs; \ |
2072 | 162 |
\ X ~: analz (sees lost Spy evs) |] \ |
163 |
\ ==> C ~: lost"; |
|
164 |
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj] |
|
165 |
addss (!simpset)) 1); |
|
166 |
qed "Says_Crypt_not_lost"; |
|
167 |
||
2320 | 168 |
(*NEEDED??*) |
2032 | 169 |
goal thy "initState lost C <= Key `` range shrK"; |
1934 | 170 |
by (agent.induct_tac "C" 1); |
171 |
by (Auto_tac ()); |
|
172 |
qed "initState_subset"; |
|
173 |
||
2320 | 174 |
(*NEEDED??*) |
2032 | 175 |
goal thy "X : sees lost C evs --> \ |
2078 | 176 |
\ (EX A B. Says A B X : set_of_list evs) | (EX A. X = Key (shrK A))"; |
1934 | 177 |
by (list.induct_tac "evs" 1); |
178 |
by (ALLGOALS Asm_simp_tac); |
|
179 |
by (fast_tac (!claset addDs [impOfSubs initState_subset]) 1); |
|
2032 | 180 |
by (rtac conjI 1); |
1934 | 181 |
by (Fast_tac 2); |
182 |
by (event.induct_tac "a" 1); |
|
183 |
by (ALLGOALS (asm_simp_tac (!simpset addsimps [mem_if]))); |
|
184 |
by (ALLGOALS Fast_tac); |
|
185 |
qed_spec_mp "seesD"; |
|
186 |
||
2160 | 187 |
Addsimps [sees_own, sees_Server, sees_Friend, sees_Spy]; |
2032 | 188 |
Delsimps [sees_Cons]; (**** NOTE REMOVAL -- laws above are cleaner ****) |
1934 | 189 |
|
190 |
||
2049
d3b93e1765bc
Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents:
2045
diff
changeset
|
191 |
(** Power of the Spy **) |
1934 | 192 |
|
2049
d3b93e1765bc
Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents:
2045
diff
changeset
|
193 |
(*The Spy can see more than anybody else, except for their initial state*) |
d3b93e1765bc
Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents:
2045
diff
changeset
|
194 |
goal thy "sees lost A evs <= initState lost A Un sees lost Spy evs"; |
d3b93e1765bc
Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents:
2045
diff
changeset
|
195 |
by (list.induct_tac "evs" 1); |
d3b93e1765bc
Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents:
2045
diff
changeset
|
196 |
by (event.induct_tac "a" 2); |
d3b93e1765bc
Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents:
2045
diff
changeset
|
197 |
by (ALLGOALS (fast_tac (!claset addDs [sees_Says_subset_insert RS subsetD] |
d3b93e1765bc
Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents:
2045
diff
changeset
|
198 |
addss (!simpset)))); |
d3b93e1765bc
Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents:
2045
diff
changeset
|
199 |
qed "sees_agent_subset_sees_Spy"; |
d3b93e1765bc
Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents:
2045
diff
changeset
|
200 |
|
d3b93e1765bc
Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents:
2045
diff
changeset
|
201 |
(*The Spy can see more than anybody else who's lost their key!*) |
d3b93e1765bc
Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents:
2045
diff
changeset
|
202 |
goal thy "A: lost --> A ~= Server --> sees lost A evs <= sees lost Spy evs"; |
d3b93e1765bc
Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents:
2045
diff
changeset
|
203 |
by (list.induct_tac "evs" 1); |
d3b93e1765bc
Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents:
2045
diff
changeset
|
204 |
by (event.induct_tac "a" 2); |
d3b93e1765bc
Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents:
2045
diff
changeset
|
205 |
by (agent.induct_tac "A" 1); |
d3b93e1765bc
Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents:
2045
diff
changeset
|
206 |
by (auto_tac (!claset addDs [sees_Says_subset_insert RS subsetD], (!simpset))); |
d3b93e1765bc
Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents:
2045
diff
changeset
|
207 |
qed_spec_mp "sees_lost_agent_subset_sees_Spy"; |
d3b93e1765bc
Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents:
2045
diff
changeset
|
208 |
|
1934 | 209 |
|
2032 | 210 |
(** Simplifying parts (insert X (sees lost A evs)) |
2045
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
211 |
= parts {X} Un parts (sees lost A evs) -- since general case loops*) |
2012 | 212 |
|
213 |
val parts_insert_sees = |
|
2045
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
214 |
parts_insert |> read_instantiate_sg (sign_of thy) |
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
215 |
[("H", "sees lost A evs")] |
2012 | 216 |
|> standard; |
2045
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
217 |
|
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
218 |
|
2049
d3b93e1765bc
Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents:
2045
diff
changeset
|
219 |
(*** Specialized rewriting for analz_insert_Key_newK ***) |
d3b93e1765bc
Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents:
2045
diff
changeset
|
220 |
|
2320 | 221 |
(*Push newK applications in, allowing other keys to be pulled out*) |
222 |
val pushKey_newK = insComm thy "Key (newK ?evs)" "Key (shrK ?C)"; |
|
223 |
||
2049
d3b93e1765bc
Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents:
2045
diff
changeset
|
224 |
goal thy "!!K. newK evs = invKey K ==> newK evs = K"; |
d3b93e1765bc
Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents:
2045
diff
changeset
|
225 |
by (rtac (invKey_eq RS iffD1) 1); |
d3b93e1765bc
Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents:
2045
diff
changeset
|
226 |
by (Simp_tac 1); |
d3b93e1765bc
Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents:
2045
diff
changeset
|
227 |
val newK_invKey = result(); |
d3b93e1765bc
Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents:
2045
diff
changeset
|
228 |
|
d3b93e1765bc
Moved sees_lost_agent_subset_sees_Spy to common file
paulson
parents:
2045
diff
changeset
|
229 |
AddSDs [newK_invKey]; |
2124
9677fdf5fc23
New theorem Crypt_Spy_analz_lost; improvements to spy_analz_tac; ex_strip_tac
paulson
parents:
2109
diff
changeset
|
230 |
AddSDs [sym RS newK_invKey]; |
2045
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
231 |
|
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
232 |
Delsimps [image_insert]; |
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
233 |
Addsimps [image_insert RS sym]; |
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
234 |
|
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
235 |
Delsimps [image_Un]; |
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
236 |
Addsimps [image_Un RS sym]; |
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
237 |
|
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
238 |
goal thy "insert (Key (newK x)) H = Key `` (newK``{x}) Un H"; |
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
239 |
by (Fast_tac 1); |
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
240 |
qed "insert_Key_singleton"; |
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
241 |
|
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
242 |
goal thy "insert (Key (f x)) (Key``(f``E) Un C) = \ |
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
243 |
\ Key `` (f `` (insert x E)) Un C"; |
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
244 |
by (Fast_tac 1); |
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
245 |
qed "insert_Key_image"; |
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
246 |
|
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
247 |
|
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
248 |
(*Lemma for the trivial direction of the if-and-only-if*) |
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
249 |
goal thy |
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
250 |
"!!evs. (Key K : analz (Key``nE Un H)) --> (K : nE | Key K : analz H) ==> \ |
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
251 |
\ (Key K : analz (Key``nE Un H)) = (K : nE | Key K : analz H)"; |
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
252 |
by (fast_tac (!claset addSEs [impOfSubs analz_mono]) 1); |
ae1030e66745
Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents:
2032
diff
changeset
|
253 |
qed "analz_image_newK_lemma"; |