| author | wenzelm |
| Thu, 16 Oct 1997 14:00:20 +0200 | |
| changeset 3895 | b2463861c86a |
| parent 3730 | 6933d20f335f |
| child 3919 | c036caebfc75 |
| permissions | -rw-r--r-- |
| 1839 | 1 |
(* Title: HOL/Auth/Message |
2 |
ID: $Id$ |
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
|
4 |
Copyright 1996 University of Cambridge |
|
5 |
||
6 |
Datatypes of agents and messages; |
|
| 1913 | 7 |
Inductive relations "parts", "analz" and "synth" |
| 1839 | 8 |
*) |
9 |
||
| 3702 | 10 |
|
11 |
(*Eliminates a commonly-occurring expression*) |
|
12 |
goal HOL.thy "~ (ALL x. x~=y)"; |
|
13 |
by (Blast_tac 1); |
|
14 |
Addsimps [result()]; |
|
15 |
||
| 1839 | 16 |
open Message; |
17 |
||
| 3668 | 18 |
AddIffs atomic.inject; |
19 |
AddIffs msg.inject; |
|
| 1839 | 20 |
|
|
3514
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
21 |
(*Holds because Friend is injective: thus cannot prove for all f*) |
|
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
22 |
goal thy "(Friend x : Friend``A) = (x:A)"; |
|
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
23 |
by (Auto_tac()); |
|
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
24 |
qed "Friend_image_eq"; |
|
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
25 |
Addsimps [Friend_image_eq]; |
|
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
26 |
|
|
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
27 |
|
| 1839 | 28 |
(** Inverse of keys **) |
29 |
||
30 |
goal thy "!!K K'. (invKey K = invKey K') = (K=K')"; |
|
| 3730 | 31 |
by Safe_tac; |
| 2032 | 32 |
by (rtac box_equals 1); |
| 1839 | 33 |
by (REPEAT (rtac invKey 2)); |
34 |
by (Asm_simp_tac 1); |
|
35 |
qed "invKey_eq"; |
|
36 |
||
37 |
Addsimps [invKey, invKey_eq]; |
|
38 |
||
39 |
||
40 |
(**** keysFor operator ****) |
|
41 |
||
42 |
goalw thy [keysFor_def] "keysFor {} = {}";
|
|
| 2891 | 43 |
by (Blast_tac 1); |
| 1839 | 44 |
qed "keysFor_empty"; |
45 |
||
46 |
goalw thy [keysFor_def] "keysFor (H Un H') = keysFor H Un keysFor H'"; |
|
| 2891 | 47 |
by (Blast_tac 1); |
| 1839 | 48 |
qed "keysFor_Un"; |
49 |
||
50 |
goalw thy [keysFor_def] "keysFor (UN i. H i) = (UN i. keysFor (H i))"; |
|
| 2891 | 51 |
by (Blast_tac 1); |
|
3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset
|
52 |
qed "keysFor_UN1"; |
| 1839 | 53 |
|
54 |
(*Monotonicity*) |
|
55 |
goalw thy [keysFor_def] "!!G H. G<=H ==> keysFor(G) <= keysFor(H)"; |
|
| 2891 | 56 |
by (Blast_tac 1); |
| 1839 | 57 |
qed "keysFor_mono"; |
58 |
||
59 |
goalw thy [keysFor_def] "keysFor (insert (Agent A) H) = keysFor H"; |
|
| 3102 | 60 |
by (Blast_tac 1); |
| 1839 | 61 |
qed "keysFor_insert_Agent"; |
62 |
||
63 |
goalw thy [keysFor_def] "keysFor (insert (Nonce N) H) = keysFor H"; |
|
| 3102 | 64 |
by (Blast_tac 1); |
| 1839 | 65 |
qed "keysFor_insert_Nonce"; |
66 |
||
| 3668 | 67 |
goalw thy [keysFor_def] "keysFor (insert (Number N) H) = keysFor H"; |
68 |
by (Blast_tac 1); |
|
69 |
qed "keysFor_insert_Number"; |
|
70 |
||
| 1839 | 71 |
goalw thy [keysFor_def] "keysFor (insert (Key K) H) = keysFor H"; |
| 3102 | 72 |
by (Blast_tac 1); |
| 1839 | 73 |
qed "keysFor_insert_Key"; |
74 |
||
| 2373 | 75 |
goalw thy [keysFor_def] "keysFor (insert (Hash X) H) = keysFor H"; |
| 3102 | 76 |
by (Blast_tac 1); |
| 2373 | 77 |
qed "keysFor_insert_Hash"; |
78 |
||
| 1839 | 79 |
goalw thy [keysFor_def] "keysFor (insert {|X,Y|} H) = keysFor H";
|
| 3102 | 80 |
by (Blast_tac 1); |
| 1839 | 81 |
qed "keysFor_insert_MPair"; |
82 |
||
83 |
goalw thy [keysFor_def] |
|
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2170
diff
changeset
|
84 |
"keysFor (insert (Crypt K X) H) = insert (invKey K) (keysFor H)"; |
| 1839 | 85 |
by (Auto_tac()); |
86 |
qed "keysFor_insert_Crypt"; |
|
87 |
||
|
3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset
|
88 |
Addsimps [keysFor_empty, keysFor_Un, keysFor_UN1, |
| 3668 | 89 |
keysFor_insert_Agent, keysFor_insert_Nonce, |
90 |
keysFor_insert_Number, keysFor_insert_Key, |
|
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
91 |
keysFor_insert_Hash, keysFor_insert_MPair, keysFor_insert_Crypt]; |
|
3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset
|
92 |
AddSEs [keysFor_Un RS equalityD1 RS subsetD RS UnE, |
|
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset
|
93 |
keysFor_UN1 RS equalityD1 RS subsetD RS UN1_E]; |
| 1839 | 94 |
|
|
3514
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
95 |
goalw thy [keysFor_def] "keysFor (Key``E) = {}";
|
|
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
96 |
by (Auto_tac ()); |
|
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
97 |
qed "keysFor_image_Key"; |
|
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
98 |
Addsimps [keysFor_image_Key]; |
|
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
99 |
|
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2170
diff
changeset
|
100 |
goalw thy [keysFor_def] "!!H. Crypt K X : H ==> invKey K : keysFor H"; |
| 2891 | 101 |
by (Blast_tac 1); |
| 2068 | 102 |
qed "Crypt_imp_invKey_keysFor"; |
103 |
||
| 1839 | 104 |
|
105 |
(**** Inductive relation "parts" ****) |
|
106 |
||
107 |
val major::prems = |
|
108 |
goal thy "[| {|X,Y|} : parts H; \
|
|
109 |
\ [| X : parts H; Y : parts H |] ==> P \ |
|
110 |
\ |] ==> P"; |
|
111 |
by (cut_facts_tac [major] 1); |
|
| 2032 | 112 |
by (resolve_tac prems 1); |
| 1839 | 113 |
by (REPEAT (eresolve_tac [asm_rl, parts.Fst, parts.Snd] 1)); |
114 |
qed "MPair_parts"; |
|
115 |
||
116 |
AddIs [parts.Inj]; |
|
|
1929
f0839bab4b00
Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents:
1913
diff
changeset
|
117 |
|
|
f0839bab4b00
Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents:
1913
diff
changeset
|
118 |
val partsEs = [MPair_parts, make_elim parts.Body]; |
|
f0839bab4b00
Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents:
1913
diff
changeset
|
119 |
|
|
f0839bab4b00
Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents:
1913
diff
changeset
|
120 |
AddSEs partsEs; |
|
f0839bab4b00
Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents:
1913
diff
changeset
|
121 |
(*NB These two rules are UNSAFE in the formal sense, as they discard the |
|
f0839bab4b00
Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents:
1913
diff
changeset
|
122 |
compound message. They work well on THIS FILE, perhaps because its |
|
f0839bab4b00
Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents:
1913
diff
changeset
|
123 |
proofs concern only atomic messages.*) |
| 1839 | 124 |
|
125 |
goal thy "H <= parts(H)"; |
|
| 2891 | 126 |
by (Blast_tac 1); |
| 1839 | 127 |
qed "parts_increasing"; |
128 |
||
129 |
(*Monotonicity*) |
|
130 |
goalw thy parts.defs "!!G H. G<=H ==> parts(G) <= parts(H)"; |
|
131 |
by (rtac lfp_mono 1); |
|
132 |
by (REPEAT (ares_tac basic_monos 1)); |
|
133 |
qed "parts_mono"; |
|
134 |
||
| 2373 | 135 |
val parts_insertI = impOfSubs (subset_insertI RS parts_mono); |
136 |
||
| 1839 | 137 |
goal thy "parts{} = {}";
|
| 3730 | 138 |
by Safe_tac; |
| 2032 | 139 |
by (etac parts.induct 1); |
| 2891 | 140 |
by (ALLGOALS Blast_tac); |
| 1839 | 141 |
qed "parts_empty"; |
142 |
Addsimps [parts_empty]; |
|
143 |
||
144 |
goal thy "!!X. X: parts{} ==> P";
|
|
145 |
by (Asm_full_simp_tac 1); |
|
146 |
qed "parts_emptyE"; |
|
147 |
AddSEs [parts_emptyE]; |
|
148 |
||
| 1893 | 149 |
(*WARNING: loops if H = {Y}, therefore must not be repeated!*)
|
150 |
goal thy "!!H. X: parts H ==> EX Y:H. X: parts {Y}";
|
|
| 2032 | 151 |
by (etac parts.induct 1); |
| 2891 | 152 |
by (ALLGOALS Blast_tac); |
| 1893 | 153 |
qed "parts_singleton"; |
154 |
||
| 1839 | 155 |
|
156 |
(** Unions **) |
|
157 |
||
158 |
goal thy "parts(G) Un parts(H) <= parts(G Un H)"; |
|
159 |
by (REPEAT (ares_tac [Un_least, parts_mono, Un_upper1, Un_upper2] 1)); |
|
160 |
val parts_Un_subset1 = result(); |
|
161 |
||
162 |
goal thy "parts(G Un H) <= parts(G) Un parts(H)"; |
|
| 2032 | 163 |
by (rtac subsetI 1); |
164 |
by (etac parts.induct 1); |
|
| 2891 | 165 |
by (ALLGOALS Blast_tac); |
| 1839 | 166 |
val parts_Un_subset2 = result(); |
167 |
||
168 |
goal thy "parts(G Un H) = parts(G) Un parts(H)"; |
|
169 |
by (REPEAT (ares_tac [equalityI, parts_Un_subset1, parts_Un_subset2] 1)); |
|
170 |
qed "parts_Un"; |
|
171 |
||
| 2011 | 172 |
goal thy "parts (insert X H) = parts {X} Un parts H";
|
| 1852 | 173 |
by (stac (read_instantiate [("A","H")] insert_is_Un) 1);
|
| 2011 | 174 |
by (simp_tac (HOL_ss addsimps [parts_Un]) 1); |
175 |
qed "parts_insert"; |
|
176 |
||
177 |
(*TWO inserts to avoid looping. This rewrite is better than nothing. |
|
178 |
Not suitable for Addsimps: its behaviour can be strange.*) |
|
179 |
goal thy "parts (insert X (insert Y H)) = parts {X} Un parts {Y} Un parts H";
|
|
180 |
by (simp_tac (!simpset addsimps [Un_assoc]) 1); |
|
181 |
by (simp_tac (!simpset addsimps [parts_insert RS sym]) 1); |
|
| 1852 | 182 |
qed "parts_insert2"; |
183 |
||
| 1839 | 184 |
goal thy "(UN x:A. parts(H x)) <= parts(UN x:A. H x)"; |
185 |
by (REPEAT (ares_tac [UN_least, parts_mono, UN_upper] 1)); |
|
186 |
val parts_UN_subset1 = result(); |
|
187 |
||
188 |
goal thy "parts(UN x:A. H x) <= (UN x:A. parts(H x))"; |
|
| 2032 | 189 |
by (rtac subsetI 1); |
190 |
by (etac parts.induct 1); |
|
| 2891 | 191 |
by (ALLGOALS Blast_tac); |
| 1839 | 192 |
val parts_UN_subset2 = result(); |
193 |
||
194 |
goal thy "parts(UN x:A. H x) = (UN x:A. parts(H x))"; |
|
195 |
by (REPEAT (ares_tac [equalityI, parts_UN_subset1, parts_UN_subset2] 1)); |
|
196 |
qed "parts_UN"; |
|
197 |
||
198 |
goal thy "parts(UN x. H x) = (UN x. parts(H x))"; |
|
199 |
by (simp_tac (!simpset addsimps [UNION1_def, parts_UN]) 1); |
|
200 |
qed "parts_UN1"; |
|
201 |
||
|
3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset
|
202 |
(*Added to simplify arguments to parts, analz and synth. |
|
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset
|
203 |
NOTE: the UN versions are no longer used!*) |
| 1839 | 204 |
Addsimps [parts_Un, parts_UN, parts_UN1]; |
|
3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset
|
205 |
AddSEs [parts_Un RS equalityD1 RS subsetD RS UnE, |
|
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset
|
206 |
parts_UN RS equalityD1 RS subsetD RS UN_E, |
|
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset
|
207 |
parts_UN1 RS equalityD1 RS subsetD RS UN1_E]; |
| 1839 | 208 |
|
209 |
goal thy "insert X (parts H) <= parts(insert X H)"; |
|
| 2922 | 210 |
by (blast_tac (!claset addIs [impOfSubs parts_mono]) 1); |
| 1839 | 211 |
qed "parts_insert_subset"; |
212 |
||
213 |
(** Idempotence and transitivity **) |
|
214 |
||
215 |
goal thy "!!H. X: parts (parts H) ==> X: parts H"; |
|
| 2032 | 216 |
by (etac parts.induct 1); |
| 2891 | 217 |
by (ALLGOALS Blast_tac); |
| 2922 | 218 |
qed "parts_partsD"; |
219 |
AddSDs [parts_partsD]; |
|
| 1839 | 220 |
|
221 |
goal thy "parts (parts H) = parts H"; |
|
| 2891 | 222 |
by (Blast_tac 1); |
| 1839 | 223 |
qed "parts_idem"; |
224 |
Addsimps [parts_idem]; |
|
225 |
||
226 |
goal thy "!!H. [| X: parts G; G <= parts H |] ==> X: parts H"; |
|
227 |
by (dtac parts_mono 1); |
|
| 2891 | 228 |
by (Blast_tac 1); |
| 1839 | 229 |
qed "parts_trans"; |
230 |
||
231 |
(*Cut*) |
|
| 2373 | 232 |
goal thy "!!H. [| Y: parts (insert X G); X: parts H |] \ |
233 |
\ ==> Y: parts (G Un H)"; |
|
| 2032 | 234 |
by (etac parts_trans 1); |
| 2373 | 235 |
by (Auto_tac()); |
| 1839 | 236 |
qed "parts_cut"; |
237 |
||
|
1929
f0839bab4b00
Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents:
1913
diff
changeset
|
238 |
goal thy "!!H. X: parts H ==> parts (insert X H) = parts H"; |
| 2373 | 239 |
by (fast_tac (!claset addSDs [parts_cut] |
240 |
addIs [parts_insertI] |
|
241 |
addss (!simpset)) 1); |
|
|
1929
f0839bab4b00
Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents:
1913
diff
changeset
|
242 |
qed "parts_cut_eq"; |
|
f0839bab4b00
Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents:
1913
diff
changeset
|
243 |
|
|
2028
738bb98d65ec
Last working version prior to addition of "lost" component
paulson
parents:
2026
diff
changeset
|
244 |
Addsimps [parts_cut_eq]; |
|
738bb98d65ec
Last working version prior to addition of "lost" component
paulson
parents:
2026
diff
changeset
|
245 |
|
| 1839 | 246 |
|
247 |
(** Rewrite rules for pulling out atomic messages **) |
|
248 |
||
| 2373 | 249 |
fun parts_tac i = |
250 |
EVERY [rtac ([subsetI, parts_insert_subset] MRS equalityI) i, |
|
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
251 |
etac parts.induct i, |
| 3102 | 252 |
REPEAT (Blast_tac i)]; |
| 2373 | 253 |
|
| 1839 | 254 |
goal thy "parts (insert (Agent agt) H) = insert (Agent agt) (parts H)"; |
| 2373 | 255 |
by (parts_tac 1); |
| 1839 | 256 |
qed "parts_insert_Agent"; |
257 |
||
258 |
goal thy "parts (insert (Nonce N) H) = insert (Nonce N) (parts H)"; |
|
| 2373 | 259 |
by (parts_tac 1); |
| 1839 | 260 |
qed "parts_insert_Nonce"; |
261 |
||
| 3668 | 262 |
goal thy "parts (insert (Number N) H) = insert (Number N) (parts H)"; |
263 |
by (parts_tac 1); |
|
264 |
qed "parts_insert_Number"; |
|
265 |
||
| 1839 | 266 |
goal thy "parts (insert (Key K) H) = insert (Key K) (parts H)"; |
| 2373 | 267 |
by (parts_tac 1); |
| 1839 | 268 |
qed "parts_insert_Key"; |
269 |
||
| 2373 | 270 |
goal thy "parts (insert (Hash X) H) = insert (Hash X) (parts H)"; |
271 |
by (parts_tac 1); |
|
272 |
qed "parts_insert_Hash"; |
|
273 |
||
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2170
diff
changeset
|
274 |
goal thy "parts (insert (Crypt K X) H) = \ |
|
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2170
diff
changeset
|
275 |
\ insert (Crypt K X) (parts (insert X H))"; |
| 2032 | 276 |
by (rtac equalityI 1); |
277 |
by (rtac subsetI 1); |
|
278 |
by (etac parts.induct 1); |
|
| 1839 | 279 |
by (Auto_tac()); |
| 2032 | 280 |
by (etac parts.induct 1); |
| 2922 | 281 |
by (ALLGOALS (blast_tac (!claset addIs [parts.Body]))); |
| 1839 | 282 |
qed "parts_insert_Crypt"; |
283 |
||
284 |
goal thy "parts (insert {|X,Y|} H) = \
|
|
285 |
\ insert {|X,Y|} (parts (insert X (insert Y H)))";
|
|
| 2032 | 286 |
by (rtac equalityI 1); |
287 |
by (rtac subsetI 1); |
|
288 |
by (etac parts.induct 1); |
|
| 1839 | 289 |
by (Auto_tac()); |
| 2032 | 290 |
by (etac parts.induct 1); |
| 2922 | 291 |
by (ALLGOALS (blast_tac (!claset addIs [parts.Fst, parts.Snd]))); |
| 1839 | 292 |
qed "parts_insert_MPair"; |
293 |
||
| 3668 | 294 |
Addsimps [parts_insert_Agent, parts_insert_Nonce, |
295 |
parts_insert_Number, parts_insert_Key, |
|
| 2373 | 296 |
parts_insert_Hash, parts_insert_Crypt, parts_insert_MPair]; |
| 1839 | 297 |
|
298 |
||
|
2026
0df5a96bf77e
Last working version prior to introduction of "lost"
paulson
parents:
2011
diff
changeset
|
299 |
goal thy "parts (Key``N) = Key``N"; |
|
0df5a96bf77e
Last working version prior to introduction of "lost"
paulson
parents:
2011
diff
changeset
|
300 |
by (Auto_tac()); |
| 2032 | 301 |
by (etac parts.induct 1); |
|
2026
0df5a96bf77e
Last working version prior to introduction of "lost"
paulson
parents:
2011
diff
changeset
|
302 |
by (Auto_tac()); |
|
0df5a96bf77e
Last working version prior to introduction of "lost"
paulson
parents:
2011
diff
changeset
|
303 |
qed "parts_image_Key"; |
|
3514
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
304 |
Addsimps [parts_image_Key]; |
|
2026
0df5a96bf77e
Last working version prior to introduction of "lost"
paulson
parents:
2011
diff
changeset
|
305 |
|
|
3514
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
306 |
|
|
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
307 |
(*In any message, there is an upper bound N on its greatest nonce.*) |
|
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
308 |
goal thy "EX N. ALL n. N<=n --> Nonce n ~: parts {msg}";
|
| 3668 | 309 |
by (induct_tac "msg" 1); |
310 |
by (induct_tac "atomic" 1); |
|
|
3514
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
311 |
by (ALLGOALS (asm_simp_tac (!simpset addsimps [exI, parts_insert2]))); |
|
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
312 |
(*MPair case: blast_tac works out the necessary sum itself!*) |
|
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
313 |
by (blast_tac (!claset addSEs [add_leE]) 2); |
|
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
314 |
(*Nonce case*) |
|
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
315 |
by (res_inst_tac [("x","N + Suc nat")] exI 1);
|
|
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
316 |
by (fast_tac (!claset addSEs [add_leE] addaltern trans_tac) 1); |
|
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
317 |
qed "msg_Nonce_supply"; |
|
2026
0df5a96bf77e
Last working version prior to introduction of "lost"
paulson
parents:
2011
diff
changeset
|
318 |
|
|
0df5a96bf77e
Last working version prior to introduction of "lost"
paulson
parents:
2011
diff
changeset
|
319 |
|
| 1913 | 320 |
(**** Inductive relation "analz" ****) |
| 1839 | 321 |
|
322 |
val major::prems = |
|
| 1913 | 323 |
goal thy "[| {|X,Y|} : analz H; \
|
324 |
\ [| X : analz H; Y : analz H |] ==> P \ |
|
| 1839 | 325 |
\ |] ==> P"; |
326 |
by (cut_facts_tac [major] 1); |
|
| 2032 | 327 |
by (resolve_tac prems 1); |
| 1913 | 328 |
by (REPEAT (eresolve_tac [asm_rl, analz.Fst, analz.Snd] 1)); |
329 |
qed "MPair_analz"; |
|
| 1839 | 330 |
|
| 1913 | 331 |
AddIs [analz.Inj]; |
| 2011 | 332 |
AddSEs [MPair_analz]; (*Perhaps it should NOT be deemed safe!*) |
| 1913 | 333 |
AddDs [analz.Decrypt]; |
| 1839 | 334 |
|
| 1913 | 335 |
Addsimps [analz.Inj]; |
| 1885 | 336 |
|
| 1913 | 337 |
goal thy "H <= analz(H)"; |
| 2891 | 338 |
by (Blast_tac 1); |
| 1913 | 339 |
qed "analz_increasing"; |
| 1839 | 340 |
|
| 1913 | 341 |
goal thy "analz H <= parts H"; |
| 1839 | 342 |
by (rtac subsetI 1); |
| 2032 | 343 |
by (etac analz.induct 1); |
| 2891 | 344 |
by (ALLGOALS Blast_tac); |
| 1913 | 345 |
qed "analz_subset_parts"; |
| 1839 | 346 |
|
| 1913 | 347 |
bind_thm ("not_parts_not_analz", analz_subset_parts RS contra_subsetD);
|
| 1839 | 348 |
|
349 |
||
| 1913 | 350 |
goal thy "parts (analz H) = parts H"; |
| 2032 | 351 |
by (rtac equalityI 1); |
352 |
by (rtac (analz_subset_parts RS parts_mono RS subset_trans) 1); |
|
| 1839 | 353 |
by (Simp_tac 1); |
| 2891 | 354 |
by (blast_tac (!claset addIs [analz_increasing RS parts_mono RS subsetD]) 1); |
| 1913 | 355 |
qed "parts_analz"; |
356 |
Addsimps [parts_analz]; |
|
| 1839 | 357 |
|
| 1913 | 358 |
goal thy "analz (parts H) = parts H"; |
| 1885 | 359 |
by (Auto_tac()); |
| 2032 | 360 |
by (etac analz.induct 1); |
| 1885 | 361 |
by (Auto_tac()); |
| 1913 | 362 |
qed "analz_parts"; |
363 |
Addsimps [analz_parts]; |
|
| 1885 | 364 |
|
| 1839 | 365 |
(*Monotonicity; Lemma 1 of Lowe*) |
| 1913 | 366 |
goalw thy analz.defs "!!G H. G<=H ==> analz(G) <= analz(H)"; |
| 1839 | 367 |
by (rtac lfp_mono 1); |
368 |
by (REPEAT (ares_tac basic_monos 1)); |
|
| 1913 | 369 |
qed "analz_mono"; |
| 1839 | 370 |
|
| 2373 | 371 |
val analz_insertI = impOfSubs (subset_insertI RS analz_mono); |
372 |
||
| 1839 | 373 |
(** General equational properties **) |
374 |
||
| 1913 | 375 |
goal thy "analz{} = {}";
|
| 3730 | 376 |
by Safe_tac; |
| 2032 | 377 |
by (etac analz.induct 1); |
| 2891 | 378 |
by (ALLGOALS Blast_tac); |
| 1913 | 379 |
qed "analz_empty"; |
380 |
Addsimps [analz_empty]; |
|
| 1839 | 381 |
|
| 1913 | 382 |
(*Converse fails: we can analz more from the union than from the |
| 1839 | 383 |
separate parts, as a key in one might decrypt a message in the other*) |
| 1913 | 384 |
goal thy "analz(G) Un analz(H) <= analz(G Un H)"; |
385 |
by (REPEAT (ares_tac [Un_least, analz_mono, Un_upper1, Un_upper2] 1)); |
|
386 |
qed "analz_Un"; |
|
| 1839 | 387 |
|
| 1913 | 388 |
goal thy "insert X (analz H) <= analz(insert X H)"; |
| 2922 | 389 |
by (blast_tac (!claset addIs [impOfSubs analz_mono]) 1); |
| 1913 | 390 |
qed "analz_insert"; |
| 1839 | 391 |
|
392 |
(** Rewrite rules for pulling out atomic messages **) |
|
393 |
||
| 2373 | 394 |
fun analz_tac i = |
395 |
EVERY [rtac ([subsetI, analz_insert] MRS equalityI) i, |
|
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
396 |
etac analz.induct i, |
| 3102 | 397 |
REPEAT (Blast_tac i)]; |
| 2373 | 398 |
|
| 1913 | 399 |
goal thy "analz (insert (Agent agt) H) = insert (Agent agt) (analz H)"; |
| 2373 | 400 |
by (analz_tac 1); |
| 1913 | 401 |
qed "analz_insert_Agent"; |
| 1839 | 402 |
|
| 1913 | 403 |
goal thy "analz (insert (Nonce N) H) = insert (Nonce N) (analz H)"; |
| 2373 | 404 |
by (analz_tac 1); |
| 1913 | 405 |
qed "analz_insert_Nonce"; |
| 1839 | 406 |
|
| 3668 | 407 |
goal thy "analz (insert (Number N) H) = insert (Number N) (analz H)"; |
408 |
by (analz_tac 1); |
|
409 |
qed "analz_insert_Number"; |
|
410 |
||
| 2373 | 411 |
goal thy "analz (insert (Hash X) H) = insert (Hash X) (analz H)"; |
412 |
by (analz_tac 1); |
|
413 |
qed "analz_insert_Hash"; |
|
414 |
||
| 1839 | 415 |
(*Can only pull out Keys if they are not needed to decrypt the rest*) |
416 |
goalw thy [keysFor_def] |
|
| 1913 | 417 |
"!!K. K ~: keysFor (analz H) ==> \ |
418 |
\ analz (insert (Key K) H) = insert (Key K) (analz H)"; |
|
| 2373 | 419 |
by (analz_tac 1); |
| 1913 | 420 |
qed "analz_insert_Key"; |
| 1839 | 421 |
|
| 1913 | 422 |
goal thy "analz (insert {|X,Y|} H) = \
|
423 |
\ insert {|X,Y|} (analz (insert X (insert Y H)))";
|
|
| 2032 | 424 |
by (rtac equalityI 1); |
425 |
by (rtac subsetI 1); |
|
426 |
by (etac analz.induct 1); |
|
| 1885 | 427 |
by (Auto_tac()); |
| 2032 | 428 |
by (etac analz.induct 1); |
| 2922 | 429 |
by (ALLGOALS (blast_tac (!claset addIs [analz.Fst, analz.Snd]))); |
| 1913 | 430 |
qed "analz_insert_MPair"; |
| 1885 | 431 |
|
432 |
(*Can pull out enCrypted message if the Key is not known*) |
|
| 1913 | 433 |
goal thy "!!H. Key (invKey K) ~: analz H ==> \ |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2170
diff
changeset
|
434 |
\ analz (insert (Crypt K X) H) = \ |
|
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2170
diff
changeset
|
435 |
\ insert (Crypt K X) (analz H)"; |
| 2373 | 436 |
by (analz_tac 1); |
| 1913 | 437 |
qed "analz_insert_Crypt"; |
| 1839 | 438 |
|
| 1913 | 439 |
goal thy "!!H. Key (invKey K) : analz H ==> \ |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2170
diff
changeset
|
440 |
\ analz (insert (Crypt K X) H) <= \ |
|
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2170
diff
changeset
|
441 |
\ insert (Crypt K X) (analz (insert X H))"; |
| 2032 | 442 |
by (rtac subsetI 1); |
| 1913 | 443 |
by (eres_inst_tac [("za","x")] analz.induct 1);
|
| 3102 | 444 |
by (ALLGOALS (Blast_tac)); |
| 1839 | 445 |
val lemma1 = result(); |
446 |
||
| 1913 | 447 |
goal thy "!!H. Key (invKey K) : analz H ==> \ |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2170
diff
changeset
|
448 |
\ insert (Crypt K X) (analz (insert X H)) <= \ |
|
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2170
diff
changeset
|
449 |
\ analz (insert (Crypt K X) H)"; |
| 1839 | 450 |
by (Auto_tac()); |
| 1913 | 451 |
by (eres_inst_tac [("za","x")] analz.induct 1);
|
| 1839 | 452 |
by (Auto_tac()); |
| 3449 | 453 |
by (blast_tac (!claset addIs [analz_insertI, analz.Decrypt]) 1); |
| 1839 | 454 |
val lemma2 = result(); |
455 |
||
| 1913 | 456 |
goal thy "!!H. Key (invKey K) : analz H ==> \ |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2170
diff
changeset
|
457 |
\ analz (insert (Crypt K X) H) = \ |
|
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2170
diff
changeset
|
458 |
\ insert (Crypt K X) (analz (insert X H))"; |
| 1839 | 459 |
by (REPEAT (ares_tac [equalityI, lemma1, lemma2] 1)); |
| 1913 | 460 |
qed "analz_insert_Decrypt"; |
| 1839 | 461 |
|
| 1885 | 462 |
(*Case analysis: either the message is secure, or it is not! |
| 1946 | 463 |
Effective, but can cause subgoals to blow up! |
| 1885 | 464 |
Use with expand_if; apparently split_tac does not cope with patterns |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2170
diff
changeset
|
465 |
such as "analz (insert (Crypt K X) H)" *) |
|
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2170
diff
changeset
|
466 |
goal thy "analz (insert (Crypt K X) H) = \ |
| 2154 | 467 |
\ (if (Key (invKey K) : analz H) \ |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2170
diff
changeset
|
468 |
\ then insert (Crypt K X) (analz (insert X H)) \ |
|
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2170
diff
changeset
|
469 |
\ else insert (Crypt K X) (analz H))"; |
| 2102 | 470 |
by (case_tac "Key (invKey K) : analz H " 1); |
| 1913 | 471 |
by (ALLGOALS (asm_simp_tac (!simpset addsimps [analz_insert_Crypt, |
| 2032 | 472 |
analz_insert_Decrypt]))); |
| 1913 | 473 |
qed "analz_Crypt_if"; |
| 1885 | 474 |
|
| 3668 | 475 |
Addsimps [analz_insert_Agent, analz_insert_Nonce, |
476 |
analz_insert_Number, analz_insert_Key, |
|
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
477 |
analz_insert_Hash, analz_insert_MPair, analz_Crypt_if]; |
| 1839 | 478 |
|
479 |
(*This rule supposes "for the sake of argument" that we have the key.*) |
|
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2170
diff
changeset
|
480 |
goal thy "analz (insert (Crypt K X) H) <= \ |
|
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2170
diff
changeset
|
481 |
\ insert (Crypt K X) (analz (insert X H))"; |
| 2032 | 482 |
by (rtac subsetI 1); |
483 |
by (etac analz.induct 1); |
|
| 1839 | 484 |
by (Auto_tac()); |
| 1913 | 485 |
qed "analz_insert_Crypt_subset"; |
| 1839 | 486 |
|
487 |
||
|
2026
0df5a96bf77e
Last working version prior to introduction of "lost"
paulson
parents:
2011
diff
changeset
|
488 |
goal thy "analz (Key``N) = Key``N"; |
|
0df5a96bf77e
Last working version prior to introduction of "lost"
paulson
parents:
2011
diff
changeset
|
489 |
by (Auto_tac()); |
| 2032 | 490 |
by (etac analz.induct 1); |
|
2026
0df5a96bf77e
Last working version prior to introduction of "lost"
paulson
parents:
2011
diff
changeset
|
491 |
by (Auto_tac()); |
|
0df5a96bf77e
Last working version prior to introduction of "lost"
paulson
parents:
2011
diff
changeset
|
492 |
qed "analz_image_Key"; |
|
0df5a96bf77e
Last working version prior to introduction of "lost"
paulson
parents:
2011
diff
changeset
|
493 |
|
|
0df5a96bf77e
Last working version prior to introduction of "lost"
paulson
parents:
2011
diff
changeset
|
494 |
Addsimps [analz_image_Key]; |
|
0df5a96bf77e
Last working version prior to introduction of "lost"
paulson
parents:
2011
diff
changeset
|
495 |
|
|
0df5a96bf77e
Last working version prior to introduction of "lost"
paulson
parents:
2011
diff
changeset
|
496 |
|
| 1839 | 497 |
(** Idempotence and transitivity **) |
498 |
||
| 1913 | 499 |
goal thy "!!H. X: analz (analz H) ==> X: analz H"; |
| 2032 | 500 |
by (etac analz.induct 1); |
| 2891 | 501 |
by (ALLGOALS Blast_tac); |
| 2922 | 502 |
qed "analz_analzD"; |
503 |
AddSDs [analz_analzD]; |
|
| 1839 | 504 |
|
| 1913 | 505 |
goal thy "analz (analz H) = analz H"; |
| 2891 | 506 |
by (Blast_tac 1); |
| 1913 | 507 |
qed "analz_idem"; |
508 |
Addsimps [analz_idem]; |
|
| 1839 | 509 |
|
| 1913 | 510 |
goal thy "!!H. [| X: analz G; G <= analz H |] ==> X: analz H"; |
511 |
by (dtac analz_mono 1); |
|
| 2891 | 512 |
by (Blast_tac 1); |
| 1913 | 513 |
qed "analz_trans"; |
| 1839 | 514 |
|
515 |
(*Cut; Lemma 2 of Lowe*) |
|
|
1998
f8230821f1e8
Reordering of premises for cut theorems, and new law MPair_synth_analz
paulson
parents:
1994
diff
changeset
|
516 |
goal thy "!!H. [| Y: analz (insert X H); X: analz H |] ==> Y: analz H"; |
| 2032 | 517 |
by (etac analz_trans 1); |
| 2891 | 518 |
by (Blast_tac 1); |
| 1913 | 519 |
qed "analz_cut"; |
| 1839 | 520 |
|
521 |
(*Cut can be proved easily by induction on |
|
| 1913 | 522 |
"!!H. Y: analz (insert X H) ==> X: analz H --> Y: analz H" |
| 1839 | 523 |
*) |
524 |
||
| 3449 | 525 |
(*This rewrite rule helps in the simplification of messages that involve |
526 |
the forwarding of unknown components (X). Without it, removing occurrences |
|
527 |
of X can be very complicated. *) |
|
| 3431 | 528 |
goal thy "!!H. X: analz H ==> analz (insert X H) = analz H"; |
529 |
by (blast_tac (!claset addIs [analz_cut, analz_insertI]) 1); |
|
530 |
qed "analz_insert_eq"; |
|
531 |
||
| 1885 | 532 |
|
| 1913 | 533 |
(** A congruence rule for "analz" **) |
| 1885 | 534 |
|
| 1913 | 535 |
goal thy "!!H. [| analz G <= analz G'; analz H <= analz H' \ |
536 |
\ |] ==> analz (G Un H) <= analz (G' Un H')"; |
|
| 3714 | 537 |
by (Clarify_tac 1); |
| 2032 | 538 |
by (etac analz.induct 1); |
| 1913 | 539 |
by (ALLGOALS (best_tac (!claset addIs [analz_mono RS subsetD]))); |
540 |
qed "analz_subset_cong"; |
|
| 1885 | 541 |
|
| 1913 | 542 |
goal thy "!!H. [| analz G = analz G'; analz H = analz H' \ |
543 |
\ |] ==> analz (G Un H) = analz (G' Un H')"; |
|
544 |
by (REPEAT_FIRST (ares_tac [equalityI, analz_subset_cong] |
|
| 2032 | 545 |
ORELSE' etac equalityE)); |
| 1913 | 546 |
qed "analz_cong"; |
| 1885 | 547 |
|
548 |
||
| 1913 | 549 |
goal thy "!!H. analz H = analz H' ==> analz(insert X H) = analz(insert X H')"; |
|
3583
5a47b869d16a
Had to remove {x.x=a} = a from !simpset in one proof.
nipkow
parents:
3519
diff
changeset
|
550 |
by (asm_simp_tac (!simpset addsimps [insert_def] delsimps [singleton_conv] |
| 2032 | 551 |
setloop (rtac analz_cong)) 1); |
| 1913 | 552 |
qed "analz_insert_cong"; |
| 1885 | 553 |
|
| 1913 | 554 |
(*If there are no pairs or encryptions then analz does nothing*) |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2170
diff
changeset
|
555 |
goal thy "!!H. [| ALL X Y. {|X,Y|} ~: H; ALL X K. Crypt K X ~: H |] ==> \
|
| 1913 | 556 |
\ analz H = H"; |
| 3730 | 557 |
by Safe_tac; |
| 2032 | 558 |
by (etac analz.induct 1); |
| 2891 | 559 |
by (ALLGOALS Blast_tac); |
| 1913 | 560 |
qed "analz_trivial"; |
| 1839 | 561 |
|
562 |
(*Helps to prove Fake cases*) |
|
| 1913 | 563 |
goal thy "!!X. X: analz (UN i. analz (H i)) ==> X: analz (UN i. H i)"; |
| 2032 | 564 |
by (etac analz.induct 1); |
| 2922 | 565 |
by (ALLGOALS (blast_tac (!claset addIs [impOfSubs analz_mono]))); |
| 1839 | 566 |
val lemma = result(); |
567 |
||
| 1913 | 568 |
goal thy "analz (UN i. analz (H i)) = analz (UN i. H i)"; |
| 2922 | 569 |
by (blast_tac (!claset addIs [lemma, impOfSubs analz_mono]) 1); |
| 1913 | 570 |
qed "analz_UN_analz"; |
571 |
Addsimps [analz_UN_analz]; |
|
| 1839 | 572 |
|
573 |
||
| 1913 | 574 |
(**** Inductive relation "synth" ****) |
| 1839 | 575 |
|
| 1913 | 576 |
AddIs synth.intrs; |
| 1839 | 577 |
|
| 2011 | 578 |
(*Can only produce a nonce or key if it is already known, |
579 |
but can synth a pair or encryption from its components...*) |
|
| 3668 | 580 |
val mk_cases = synth.mk_cases (atomic.simps @ msg.simps); |
| 2011 | 581 |
|
| 3668 | 582 |
(*NO Agent_synth, as any Agent name can be synthesized. Ditto for Number*) |
| 2011 | 583 |
val Nonce_synth = mk_cases "Nonce n : synth H"; |
584 |
val Key_synth = mk_cases "Key K : synth H"; |
|
| 2373 | 585 |
val Hash_synth = mk_cases "Hash X : synth H"; |
| 2011 | 586 |
val MPair_synth = mk_cases "{|X,Y|} : synth H";
|
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2170
diff
changeset
|
587 |
val Crypt_synth = mk_cases "Crypt K X : synth H"; |
| 2011 | 588 |
|
| 2373 | 589 |
AddSEs [Nonce_synth, Key_synth, Hash_synth, MPair_synth, Crypt_synth]; |
| 2011 | 590 |
|
| 1913 | 591 |
goal thy "H <= synth(H)"; |
| 2891 | 592 |
by (Blast_tac 1); |
| 1913 | 593 |
qed "synth_increasing"; |
| 1839 | 594 |
|
595 |
(*Monotonicity*) |
|
| 1913 | 596 |
goalw thy synth.defs "!!G H. G<=H ==> synth(G) <= synth(H)"; |
| 1839 | 597 |
by (rtac lfp_mono 1); |
598 |
by (REPEAT (ares_tac basic_monos 1)); |
|
| 1913 | 599 |
qed "synth_mono"; |
| 1839 | 600 |
|
601 |
(** Unions **) |
|
602 |
||
| 1913 | 603 |
(*Converse fails: we can synth more from the union than from the |
| 1839 | 604 |
separate parts, building a compound message using elements of each.*) |
| 1913 | 605 |
goal thy "synth(G) Un synth(H) <= synth(G Un H)"; |
606 |
by (REPEAT (ares_tac [Un_least, synth_mono, Un_upper1, Un_upper2] 1)); |
|
607 |
qed "synth_Un"; |
|
| 1839 | 608 |
|
| 1913 | 609 |
goal thy "insert X (synth H) <= synth(insert X H)"; |
| 2922 | 610 |
by (blast_tac (!claset addIs [impOfSubs synth_mono]) 1); |
| 1913 | 611 |
qed "synth_insert"; |
| 1885 | 612 |
|
| 1839 | 613 |
(** Idempotence and transitivity **) |
614 |
||
| 1913 | 615 |
goal thy "!!H. X: synth (synth H) ==> X: synth H"; |
| 2032 | 616 |
by (etac synth.induct 1); |
| 2891 | 617 |
by (ALLGOALS Blast_tac); |
| 2922 | 618 |
qed "synth_synthD"; |
619 |
AddSDs [synth_synthD]; |
|
| 1839 | 620 |
|
| 1913 | 621 |
goal thy "synth (synth H) = synth H"; |
| 2891 | 622 |
by (Blast_tac 1); |
| 1913 | 623 |
qed "synth_idem"; |
| 1839 | 624 |
|
| 1913 | 625 |
goal thy "!!H. [| X: synth G; G <= synth H |] ==> X: synth H"; |
626 |
by (dtac synth_mono 1); |
|
| 2891 | 627 |
by (Blast_tac 1); |
| 1913 | 628 |
qed "synth_trans"; |
| 1839 | 629 |
|
630 |
(*Cut; Lemma 2 of Lowe*) |
|
|
1998
f8230821f1e8
Reordering of premises for cut theorems, and new law MPair_synth_analz
paulson
parents:
1994
diff
changeset
|
631 |
goal thy "!!H. [| Y: synth (insert X H); X: synth H |] ==> Y: synth H"; |
| 2032 | 632 |
by (etac synth_trans 1); |
| 2891 | 633 |
by (Blast_tac 1); |
| 1913 | 634 |
qed "synth_cut"; |
| 1839 | 635 |
|
| 1946 | 636 |
goal thy "Agent A : synth H"; |
| 2891 | 637 |
by (Blast_tac 1); |
| 1946 | 638 |
qed "Agent_synth"; |
639 |
||
| 3668 | 640 |
goal thy "Number n : synth H"; |
641 |
by (Blast_tac 1); |
|
642 |
qed "Number_synth"; |
|
643 |
||
| 1913 | 644 |
goal thy "(Nonce N : synth H) = (Nonce N : H)"; |
| 2891 | 645 |
by (Blast_tac 1); |
| 1913 | 646 |
qed "Nonce_synth_eq"; |
| 1839 | 647 |
|
| 1913 | 648 |
goal thy "(Key K : synth H) = (Key K : H)"; |
| 2891 | 649 |
by (Blast_tac 1); |
| 1913 | 650 |
qed "Key_synth_eq"; |
| 1839 | 651 |
|
| 2373 | 652 |
goal thy "!!K. Key K ~: H ==> (Crypt K X : synth H) = (Crypt K X : H)"; |
| 2891 | 653 |
by (Blast_tac 1); |
| 2011 | 654 |
qed "Crypt_synth_eq"; |
655 |
||
| 3668 | 656 |
Addsimps [Agent_synth, Number_synth, |
657 |
Nonce_synth_eq, Key_synth_eq, Crypt_synth_eq]; |
|
| 1839 | 658 |
|
659 |
||
660 |
goalw thy [keysFor_def] |
|
| 1913 | 661 |
"keysFor (synth H) = keysFor H Un invKey``{K. Key K : H}";
|
| 2891 | 662 |
by (Blast_tac 1); |
| 1913 | 663 |
qed "keysFor_synth"; |
664 |
Addsimps [keysFor_synth]; |
|
| 1839 | 665 |
|
666 |
||
| 1913 | 667 |
(*** Combinations of parts, analz and synth ***) |
| 1839 | 668 |
|
| 1913 | 669 |
goal thy "parts (synth H) = parts H Un synth H"; |
| 2032 | 670 |
by (rtac equalityI 1); |
671 |
by (rtac subsetI 1); |
|
672 |
by (etac parts.induct 1); |
|
| 1839 | 673 |
by (ALLGOALS |
| 2922 | 674 |
(blast_tac (!claset addIs ((synth_increasing RS parts_mono RS subsetD) |
| 2032 | 675 |
::parts.intrs)))); |
| 1913 | 676 |
qed "parts_synth"; |
677 |
Addsimps [parts_synth]; |
|
| 1839 | 678 |
|
| 2373 | 679 |
goal thy "analz (analz G Un H) = analz (G Un H)"; |
680 |
by (REPEAT_FIRST (resolve_tac [equalityI, analz_subset_cong])); |
|
681 |
by (ALLGOALS Simp_tac); |
|
682 |
qed "analz_analz_Un"; |
|
683 |
||
684 |
goal thy "analz (synth G Un H) = analz (G Un H) Un synth G"; |
|
| 2032 | 685 |
by (rtac equalityI 1); |
686 |
by (rtac subsetI 1); |
|
687 |
by (etac analz.induct 1); |
|
| 2922 | 688 |
by (blast_tac (!claset addIs [impOfSubs analz_mono]) 5); |
689 |
by (ALLGOALS (blast_tac (!claset addIs analz.intrs))); |
|
| 2373 | 690 |
qed "analz_synth_Un"; |
691 |
||
692 |
goal thy "analz (synth H) = analz H Un synth H"; |
|
693 |
by (cut_inst_tac [("H","{}")] analz_synth_Un 1);
|
|
694 |
by (Full_simp_tac 1); |
|
| 1913 | 695 |
qed "analz_synth"; |
| 2373 | 696 |
Addsimps [analz_analz_Un, analz_synth_Un, analz_synth]; |
| 1839 | 697 |
|
| 1946 | 698 |
|
699 |
(** For reasoning about the Fake rule in traces **) |
|
700 |
||
|
1929
f0839bab4b00
Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents:
1913
diff
changeset
|
701 |
goal thy "!!Y. X: G ==> parts(insert X H) <= parts G Un parts H"; |
| 2032 | 702 |
by (rtac ([parts_mono, parts_Un_subset2] MRS subset_trans) 1); |
| 2891 | 703 |
by (Blast_tac 1); |
|
1929
f0839bab4b00
Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents:
1913
diff
changeset
|
704 |
qed "parts_insert_subset_Un"; |
|
f0839bab4b00
Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents:
1913
diff
changeset
|
705 |
|
| 1946 | 706 |
(*More specifically for Fake*) |
707 |
goal thy "!!H. X: synth (analz G) ==> \ |
|
708 |
\ parts (insert X H) <= synth (analz G) Un parts G Un parts H"; |
|
| 2032 | 709 |
by (dtac parts_insert_subset_Un 1); |
| 1946 | 710 |
by (Full_simp_tac 1); |
| 2891 | 711 |
by (Blast_tac 1); |
| 1946 | 712 |
qed "Fake_parts_insert"; |
713 |
||
| 2061 | 714 |
goal thy |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2170
diff
changeset
|
715 |
"!!H. [| Crypt K Y : parts (insert X H); X: synth (analz G); \ |
| 2061 | 716 |
\ Key K ~: analz G |] \ |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2170
diff
changeset
|
717 |
\ ==> Crypt K Y : parts G Un parts H"; |
| 2061 | 718 |
by (dtac (impOfSubs Fake_parts_insert) 1); |
| 2170 | 719 |
by (assume_tac 1); |
| 3102 | 720 |
by (blast_tac (!claset addDs [impOfSubs analz_subset_parts]) 1); |
| 2061 | 721 |
qed "Crypt_Fake_parts_insert"; |
722 |
||
| 2373 | 723 |
goal thy "!!H. X: synth (analz G) ==> \ |
724 |
\ analz (insert X H) <= synth (analz G) Un analz (G Un H)"; |
|
725 |
by (rtac subsetI 1); |
|
726 |
by (subgoal_tac "x : analz (synth (analz G) Un H)" 1); |
|
| 2922 | 727 |
by (blast_tac (!claset addIs [impOfSubs analz_mono, |
728 |
impOfSubs (analz_mono RS synth_mono)]) 2); |
|
| 2373 | 729 |
by (Full_simp_tac 1); |
| 2891 | 730 |
by (Blast_tac 1); |
| 2373 | 731 |
qed "Fake_analz_insert"; |
732 |
||
| 2011 | 733 |
goal thy "(X: analz H & X: parts H) = (X: analz H)"; |
| 2891 | 734 |
by (blast_tac (!claset addIs [impOfSubs analz_subset_parts]) 1); |
| 2011 | 735 |
val analz_conj_parts = result(); |
736 |
||
737 |
goal thy "(X: analz H | X: parts H) = (X: parts H)"; |
|
| 2891 | 738 |
by (blast_tac (!claset addIs [impOfSubs analz_subset_parts]) 1); |
| 2011 | 739 |
val analz_disj_parts = result(); |
740 |
||
741 |
AddIffs [analz_conj_parts, analz_disj_parts]; |
|
742 |
||
|
1998
f8230821f1e8
Reordering of premises for cut theorems, and new law MPair_synth_analz
paulson
parents:
1994
diff
changeset
|
743 |
(*Without this equation, other rules for synth and analz would yield |
|
f8230821f1e8
Reordering of premises for cut theorems, and new law MPair_synth_analz
paulson
parents:
1994
diff
changeset
|
744 |
redundant cases*) |
|
f8230821f1e8
Reordering of premises for cut theorems, and new law MPair_synth_analz
paulson
parents:
1994
diff
changeset
|
745 |
goal thy "({|X,Y|} : synth (analz H)) = \
|
|
f8230821f1e8
Reordering of premises for cut theorems, and new law MPair_synth_analz
paulson
parents:
1994
diff
changeset
|
746 |
\ (X : synth (analz H) & Y : synth (analz H))"; |
| 2891 | 747 |
by (Blast_tac 1); |
|
1998
f8230821f1e8
Reordering of premises for cut theorems, and new law MPair_synth_analz
paulson
parents:
1994
diff
changeset
|
748 |
qed "MPair_synth_analz"; |
|
f8230821f1e8
Reordering of premises for cut theorems, and new law MPair_synth_analz
paulson
parents:
1994
diff
changeset
|
749 |
|
|
f8230821f1e8
Reordering of premises for cut theorems, and new law MPair_synth_analz
paulson
parents:
1994
diff
changeset
|
750 |
AddIffs [MPair_synth_analz]; |
|
1929
f0839bab4b00
Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents:
1913
diff
changeset
|
751 |
|
| 2154 | 752 |
goal thy "!!K. [| Key K : analz H; Key (invKey K) : analz H |] \ |
|
2284
80ebd1a213fd
Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents:
2170
diff
changeset
|
753 |
\ ==> (Crypt K X : synth (analz H)) = (X : synth (analz H))"; |
| 2891 | 754 |
by (Blast_tac 1); |
| 2154 | 755 |
qed "Crypt_synth_analz"; |
756 |
||
|
1929
f0839bab4b00
Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents:
1913
diff
changeset
|
757 |
|
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
758 |
goal thy "!!K. X ~: synth (analz H) \ |
|
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
759 |
\ ==> (Hash{|X,Y|} : synth (analz H)) = (Hash{|X,Y|} : analz H)";
|
| 2891 | 760 |
by (Blast_tac 1); |
| 2373 | 761 |
qed "Hash_synth_analz"; |
762 |
Addsimps [Hash_synth_analz]; |
|
763 |
||
764 |
||
| 2484 | 765 |
(**** HPair: a combination of Hash and MPair ****) |
766 |
||
767 |
(*** Freeness ***) |
|
768 |
||
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
769 |
goalw thy [HPair_def] "Agent A ~= Hash[X] Y"; |
| 2484 | 770 |
by (Simp_tac 1); |
771 |
qed "Agent_neq_HPair"; |
|
772 |
||
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
773 |
goalw thy [HPair_def] "Nonce N ~= Hash[X] Y"; |
| 2484 | 774 |
by (Simp_tac 1); |
775 |
qed "Nonce_neq_HPair"; |
|
776 |
||
| 3668 | 777 |
goalw thy [HPair_def] "Number N ~= Hash[X] Y"; |
778 |
by (Simp_tac 1); |
|
779 |
qed "Number_neq_HPair"; |
|
780 |
||
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
781 |
goalw thy [HPair_def] "Key K ~= Hash[X] Y"; |
| 2484 | 782 |
by (Simp_tac 1); |
783 |
qed "Key_neq_HPair"; |
|
784 |
||
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
785 |
goalw thy [HPair_def] "Hash Z ~= Hash[X] Y"; |
| 2484 | 786 |
by (Simp_tac 1); |
787 |
qed "Hash_neq_HPair"; |
|
788 |
||
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
789 |
goalw thy [HPair_def] "Crypt K X' ~= Hash[X] Y"; |
| 2484 | 790 |
by (Simp_tac 1); |
791 |
qed "Crypt_neq_HPair"; |
|
792 |
||
| 3668 | 793 |
val HPair_neqs = [Agent_neq_HPair, Nonce_neq_HPair, Number_neq_HPair, |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
794 |
Key_neq_HPair, Hash_neq_HPair, Crypt_neq_HPair]; |
| 2484 | 795 |
|
796 |
AddIffs HPair_neqs; |
|
797 |
AddIffs (HPair_neqs RL [not_sym]); |
|
798 |
||
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
799 |
goalw thy [HPair_def] "(Hash[X'] Y' = Hash[X] Y) = (X' = X & Y'=Y)"; |
| 2484 | 800 |
by (Simp_tac 1); |
801 |
qed "HPair_eq"; |
|
802 |
||
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
803 |
goalw thy [HPair_def] "({|X',Y'|} = Hash[X] Y) = (X' = Hash{|X,Y|} & Y'=Y)";
|
| 2484 | 804 |
by (Simp_tac 1); |
805 |
qed "MPair_eq_HPair"; |
|
806 |
||
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
807 |
goalw thy [HPair_def] "(Hash[X] Y = {|X',Y'|}) = (X' = Hash{|X,Y|} & Y'=Y)";
|
| 2484 | 808 |
by (Auto_tac()); |
809 |
qed "HPair_eq_MPair"; |
|
810 |
||
811 |
AddIffs [HPair_eq, MPair_eq_HPair, HPair_eq_MPair]; |
|
812 |
||
813 |
||
814 |
(*** Specialized laws, proved in terms of those for Hash and MPair ***) |
|
815 |
||
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
816 |
goalw thy [HPair_def] "keysFor (insert (Hash[X] Y) H) = keysFor H"; |
| 2484 | 817 |
by (Simp_tac 1); |
818 |
qed "keysFor_insert_HPair"; |
|
819 |
||
820 |
goalw thy [HPair_def] |
|
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
821 |
"parts (insert (Hash[X] Y) H) = \ |
|
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
822 |
\ insert (Hash[X] Y) (insert (Hash{|X,Y|}) (parts (insert Y H)))";
|
| 2484 | 823 |
by (Simp_tac 1); |
824 |
qed "parts_insert_HPair"; |
|
825 |
||
826 |
goalw thy [HPair_def] |
|
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
827 |
"analz (insert (Hash[X] Y) H) = \ |
|
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
828 |
\ insert (Hash[X] Y) (insert (Hash{|X,Y|}) (analz (insert Y H)))";
|
| 2484 | 829 |
by (Simp_tac 1); |
830 |
qed "analz_insert_HPair"; |
|
831 |
||
832 |
goalw thy [HPair_def] "!!H. X ~: synth (analz H) \ |
|
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
833 |
\ ==> (Hash[X] Y : synth (analz H)) = \ |
| 2484 | 834 |
\ (Hash {|X, Y|} : analz H & Y : synth (analz H))";
|
835 |
by (Simp_tac 1); |
|
| 2891 | 836 |
by (Blast_tac 1); |
| 2484 | 837 |
qed "HPair_synth_analz"; |
838 |
||
839 |
Addsimps [keysFor_insert_HPair, parts_insert_HPair, analz_insert_HPair, |
|
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
840 |
HPair_synth_analz, HPair_synth_analz]; |
| 2484 | 841 |
|
842 |
||
|
1929
f0839bab4b00
Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents:
1913
diff
changeset
|
843 |
(*We do NOT want Crypt... messages broken up in protocols!!*) |
|
f0839bab4b00
Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents:
1913
diff
changeset
|
844 |
Delrules partsEs; |
|
f0839bab4b00
Working version of NS, messages 1-3, WITH INTERLEAVING
paulson
parents:
1913
diff
changeset
|
845 |
|
| 2327 | 846 |
|
847 |
(** Rewrites to push in Key and Crypt messages, so that other messages can |
|
848 |
be pulled out using the analz_insert rules **) |
|
849 |
||
850 |
fun insComm thy x y = read_instantiate_sg (sign_of thy) [("x",x), ("y",y)]
|
|
851 |
insert_commute; |
|
852 |
||
853 |
val pushKeys = map (insComm thy "Key ?K") |
|
| 3668 | 854 |
["Agent ?C", "Nonce ?N", "Number ?N", |
855 |
"Hash ?X", "MPair ?X ?Y", "Crypt ?X ?K'"]; |
|
| 2327 | 856 |
|
857 |
val pushCrypts = map (insComm thy "Crypt ?X ?K") |
|
| 3668 | 858 |
["Agent ?C", "Nonce ?N", "Number ?N", |
859 |
"Hash ?X'", "MPair ?X' ?Y"]; |
|
| 2327 | 860 |
|
861 |
(*Cannot be added with Addsimps -- we don't always want to re-order messages*) |
|
862 |
val pushes = pushKeys@pushCrypts; |
|
863 |
||
|
3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset
|
864 |
|
|
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset
|
865 |
(*** Tactics useful for many protocol proofs ***) |
|
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset
|
866 |
|
| 3470 | 867 |
(*Prove base case (subgoal i) and simplify others. A typical base case |
| 3683 | 868 |
concerns Crypt K X ~: Key``shrK``bad and cannot be proved by rewriting |
| 3470 | 869 |
alone.*) |
|
3121
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset
|
870 |
fun prove_simple_subgoals_tac i = |
|
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset
|
871 |
fast_tac (!claset addss (!simpset)) i THEN |
|
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset
|
872 |
ALLGOALS Asm_simp_tac; |
|
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset
|
873 |
|
|
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset
|
874 |
fun Fake_parts_insert_tac i = |
|
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset
|
875 |
blast_tac (!claset addDs [impOfSubs analz_subset_parts, |
|
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset
|
876 |
impOfSubs Fake_parts_insert]) i; |
|
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset
|
877 |
|
|
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset
|
878 |
(*Apply rules to break down assumptions of the form |
|
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset
|
879 |
Y : parts(insert X H) and Y : analz(insert X H) |
|
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
paulson
parents:
3102
diff
changeset
|
880 |
*) |
| 2373 | 881 |
val Fake_insert_tac = |
882 |
dresolve_tac [impOfSubs Fake_analz_insert, |
|
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
883 |
impOfSubs Fake_parts_insert] THEN' |
| 2373 | 884 |
eresolve_tac [asm_rl, synth.Inj]; |
885 |
||
| 3702 | 886 |
fun Fake_insert_simp_tac i = |
887 |
REPEAT (Fake_insert_tac i) THEN Asm_full_simp_tac i; |
|
888 |
||
889 |
||
| 3449 | 890 |
(*Analysis of Fake cases. Also works for messages that forward unknown parts, |
891 |
but this application is no longer necessary if analz_insert_eq is used. |
|
| 2327 | 892 |
Abstraction over i is ESSENTIAL: it delays the dereferencing of claset |
893 |
DEPENDS UPON "X" REFERRING TO THE FRADULENT MESSAGE *) |
|
894 |
fun spy_analz_tac i = |
|
| 2373 | 895 |
DETERM |
896 |
(SELECT_GOAL |
|
897 |
(EVERY |
|
898 |
[ (*push in occurrences of X...*) |
|
899 |
(REPEAT o CHANGED) |
|
900 |
(res_inst_tac [("x1","X")] (insert_commute RS ssubst) 1),
|
|
901 |
(*...allowing further simplifications*) |
|
902 |
simp_tac (!simpset setloop split_tac [expand_if]) 1, |
|
|
3476
1be4fee7606b
spy_analz_tac: Restored iffI to the list of rules used to break down
paulson
parents:
3470
diff
changeset
|
903 |
REPEAT (FIRSTGOAL (resolve_tac [allI,impI,notI,conjI,iffI])), |
| 2373 | 904 |
DEPTH_SOLVE |
| 3702 | 905 |
(Fake_insert_simp_tac 1 |
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
906 |
THEN |
| 3102 | 907 |
IF_UNSOLVED (Blast.depth_tac |
|
3650
282ffdc91884
Replacing impOfSubs analz_mono by analz_insertI should improve convergence
paulson
parents:
3583
diff
changeset
|
908 |
(!claset addIs [analz_insertI, |
| 3668 | 909 |
impOfSubs analz_subset_parts]) 4 1)) |
| 2373 | 910 |
]) i); |
| 2327 | 911 |
|
| 2415 | 912 |
(** Useful in many uniqueness proofs **) |
| 2327 | 913 |
fun ex_strip_tac i = REPEAT (swap_res_tac [exI, conjI] i) THEN |
914 |
assume_tac (i+1); |
|
915 |
||
| 2415 | 916 |
(*Apply the EX-ALL quantifification to prove uniqueness theorems in |
917 |
their standard form*) |
|
918 |
fun prove_unique_tac lemma = |
|
919 |
EVERY' [dtac lemma, |
|
|
2516
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
920 |
REPEAT o (mp_tac ORELSE' eresolve_tac [asm_rl,exE]), |
|
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
921 |
(*Duplicate the assumption*) |
|
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents:
2484
diff
changeset
|
922 |
forw_inst_tac [("psi", "ALL C.?P(C)")] asm_rl,
|
| 3102 | 923 |
Blast.depth_tac (!claset addSDs [spec]) 0]; |
| 2415 | 924 |
|
| 2373 | 925 |
|
926 |
(*Needed occasionally with spy_analz_tac, e.g. in analz_insert_Key_newK*) |
|
927 |
goal Set.thy "A Un (B Un A) = B Un A"; |
|
| 2891 | 928 |
by (Blast_tac 1); |
| 2373 | 929 |
val Un_absorb3 = result(); |
930 |
Addsimps [Un_absorb3]; |
|
|
3514
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
931 |
|
|
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
932 |
(*By default only o_apply is built-in. But in the presence of eta-expansion |
|
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
933 |
this means that some terms displayed as (f o g) will be rewritten, and others |
|
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
934 |
will not!*) |
|
eb16b8e8d872
Moved some declarations to Message from Public and Shared
paulson
parents:
3476
diff
changeset
|
935 |
Addsimps [o_def]; |