author | wenzelm |
Wed, 25 Jun 2025 16:35:25 +0200 | |
changeset 82768 | 8f866fd6fae1 |
parent 81182 | fc5066122e68 |
permissions | -rw-r--r-- |
41141
ad923cdd4a5d
added example to exercise higher-order reasoning with Sledgehammer and Metis
blanchet
parents:
39260
diff
changeset
|
1 |
(* Title: HOL/Metis_Examples/Message.thy |
43197 | 2 |
Author: Lawrence C. Paulson, Cambridge University Computer Laboratory |
41144 | 3 |
Author: Jasmin Blanchette, TU Muenchen |
23449 | 4 |
|
43197 | 5 |
Metis example featuring message authentication. |
23449 | 6 |
*) |
7 |
||
63167 | 8 |
section \<open>Metis Example Featuring Message Authentication\<close> |
43197 | 9 |
|
36553 | 10 |
theory Message |
11 |
imports Main |
|
12 |
begin |
|
23449 | 13 |
|
50705
0e943b33d907
use new skolemizer for reconstructing skolemization steps in Isar proofs (because the old skolemizer messes up the order of the Skolem arguments)
blanchet
parents:
46075
diff
changeset
|
14 |
declare [[metis_new_skolem]] |
42103
6066a35f6678
Metis examples use the new Skolemizer to test it
blanchet
parents:
41144
diff
changeset
|
15 |
|
23449 | 16 |
lemma strange_Un_eq [simp]: "A \<union> (B \<union> A) = B \<union> A" |
36911 | 17 |
by (metis Un_commute Un_left_absorb) |
23449 | 18 |
|
42463 | 19 |
type_synonym key = nat |
23449 | 20 |
|
21 |
consts |
|
67443
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents:
63167
diff
changeset
|
22 |
all_symmetric :: bool \<comment> \<open>true if all keys are symmetric\<close> |
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents:
63167
diff
changeset
|
23 |
invKey :: "key=>key" \<comment> \<open>inverse of a symmetric key\<close> |
23449 | 24 |
|
25 |
specification (invKey) |
|
26 |
invKey [simp]: "invKey (invKey K) = K" |
|
27 |
invKey_symmetric: "all_symmetric --> invKey = id" |
|
36553 | 28 |
by (metis id_apply) |
23449 | 29 |
|
30 |
||
63167 | 31 |
text\<open>The inverse of a symmetric key is itself; that of a public key |
32 |
is the private key and vice versa\<close> |
|
23449 | 33 |
|
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
35109
diff
changeset
|
34 |
definition symKeys :: "key set" where |
23449 | 35 |
"symKeys == {K. invKey K = K}" |
36 |
||
67443
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents:
63167
diff
changeset
|
37 |
datatype \<comment> \<open>We allow any number of friendly agents\<close> |
23449 | 38 |
agent = Server | Friend nat | Spy |
39 |
||
58310 | 40 |
datatype |
67443
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents:
63167
diff
changeset
|
41 |
msg = Agent agent \<comment> \<open>Agent names\<close> |
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents:
63167
diff
changeset
|
42 |
| Number nat \<comment> \<open>Ordinary integers, timestamps, ...\<close> |
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents:
63167
diff
changeset
|
43 |
| Nonce nat \<comment> \<open>Unguessable nonces\<close> |
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents:
63167
diff
changeset
|
44 |
| Key key \<comment> \<open>Crypto keys\<close> |
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents:
63167
diff
changeset
|
45 |
| Hash msg \<comment> \<open>Hashing\<close> |
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents:
63167
diff
changeset
|
46 |
| MPair msg msg \<comment> \<open>Compound messages\<close> |
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents:
63167
diff
changeset
|
47 |
| Crypt key msg \<comment> \<open>Encryption, public- or shared-key\<close> |
23449 | 48 |
|
49 |
||
63167 | 50 |
text\<open>Concrete syntax: messages appear as \<open>\<lbrace>A,B,NA\<rbrace>\<close>, etc...\<close> |
23449 | 51 |
syntax |
81019
dd59daa3c37a
clarified inner-syntax markup, notably for enumerations: prefer "notation=mixfix" over "entity" via 'syntax_consts' (see also 70076ba563d2);
wenzelm
parents:
80914
diff
changeset
|
52 |
"_MTuple" :: "['a, args] \<Rightarrow> 'a * 'b" (\<open>(\<open>indent=2 notation=\<open>mixfix message tuple\<close>\<close>\<lbrace>_,/ _\<rbrace>)\<close>) |
81182 | 53 |
syntax_consts |
54 |
"_MTuple" \<rightleftharpoons> MPair |
|
23449 | 55 |
translations |
80786
70076ba563d2
more specific "args" syntax, to support more markup for syntax consts;
wenzelm
parents:
80768
diff
changeset
|
56 |
"\<lbrace>x, y, z\<rbrace>" \<rightleftharpoons> "\<lbrace>x, \<lbrace>y, z\<rbrace>\<rbrace>" |
70076ba563d2
more specific "args" syntax, to support more markup for syntax consts;
wenzelm
parents:
80768
diff
changeset
|
57 |
"\<lbrace>x, y\<rbrace>" \<rightleftharpoons> "CONST MPair x y" |
23449 | 58 |
|
59 |
||
80914
d97fdabd9e2b
standardize mixfix annotations via "isabelle update -a -u mixfix_cartouches" --- to simplify systematic editing;
wenzelm
parents:
80786
diff
changeset
|
60 |
definition HPair :: "[msg,msg] => msg" (\<open>(4Hash[_] /_)\<close> [0, 1000]) where |
67443
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents:
63167
diff
changeset
|
61 |
\<comment> \<open>Message Y paired with a MAC computed with the help of X\<close> |
61984 | 62 |
"Hash[X] Y == \<lbrace> Hash\<lbrace>X,Y\<rbrace>, Y\<rbrace>" |
23449 | 63 |
|
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
35109
diff
changeset
|
64 |
definition keysFor :: "msg set => key set" where |
67443
3abf6a722518
standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents:
63167
diff
changeset
|
65 |
\<comment> \<open>Keys useful to decrypt elements of a message set\<close> |
23449 | 66 |
"keysFor H == invKey ` {K. \<exists>X. Crypt K X \<in> H}" |
67 |
||
68 |
||
63167 | 69 |
subsubsection\<open>Inductive Definition of All Parts" of a Message\<close> |
23449 | 70 |
|
23755 | 71 |
inductive_set |
72 |
parts :: "msg set => msg set" |
|
73 |
for H :: "msg set" |
|
74 |
where |
|
23449 | 75 |
Inj [intro]: "X \<in> H ==> X \<in> parts H" |
61984 | 76 |
| Fst: "\<lbrace>X,Y\<rbrace> \<in> parts H ==> X \<in> parts H" |
77 |
| Snd: "\<lbrace>X,Y\<rbrace> \<in> parts H ==> Y \<in> parts H" |
|
23755 | 78 |
| Body: "Crypt K X \<in> parts H ==> X \<in> parts H" |
23449 | 79 |
|
80 |
lemma parts_mono: "G \<subseteq> H ==> parts(G) \<subseteq> parts(H)" |
|
81 |
apply auto |
|
36553 | 82 |
apply (erule parts.induct) |
69712 | 83 |
apply (metis parts.Inj rev_subsetD) |
36553 | 84 |
apply (metis parts.Fst) |
85 |
apply (metis parts.Snd) |
|
86 |
by (metis parts.Body) |
|
23449 | 87 |
|
63167 | 88 |
text\<open>Equations hold because constructors are injective.\<close> |
67613 | 89 |
lemma Friend_image_eq [simp]: "(Friend x \<in> Friend`A) = (x\<in>A)" |
39260 | 90 |
by (metis agent.inject image_iff) |
23449 | 91 |
|
36553 | 92 |
lemma Key_image_eq [simp]: "(Key x \<in> Key`A) = (x \<in> A)" |
93 |
by (metis image_iff msg.inject(4)) |
|
23449 | 94 |
|
36553 | 95 |
lemma Nonce_Key_image_eq [simp]: "Nonce x \<notin> Key`A" |
96 |
by (metis image_iff msg.distinct(23)) |
|
23449 | 97 |
|
98 |
||
63167 | 99 |
subsubsection\<open>Inverse of keys\<close> |
23449 | 100 |
|
36553 | 101 |
lemma invKey_eq [simp]: "(invKey K = invKey K') = (K = K')" |
23449 | 102 |
by (metis invKey) |
103 |
||
104 |
||
63167 | 105 |
subsection\<open>keysFor operator\<close> |
23449 | 106 |
|
107 |
lemma keysFor_empty [simp]: "keysFor {} = {}" |
|
108 |
by (unfold keysFor_def, blast) |
|
109 |
||
110 |
lemma keysFor_Un [simp]: "keysFor (H \<union> H') = keysFor H \<union> keysFor H'" |
|
111 |
by (unfold keysFor_def, blast) |
|
112 |
||
113 |
lemma keysFor_UN [simp]: "keysFor (\<Union>i\<in>A. H i) = (\<Union>i\<in>A. keysFor (H i))" |
|
114 |
by (unfold keysFor_def, blast) |
|
115 |
||
63167 | 116 |
text\<open>Monotonicity\<close> |
23449 | 117 |
lemma keysFor_mono: "G \<subseteq> H ==> keysFor(G) \<subseteq> keysFor(H)" |
118 |
by (unfold keysFor_def, blast) |
|
119 |
||
120 |
lemma keysFor_insert_Agent [simp]: "keysFor (insert (Agent A) H) = keysFor H" |
|
121 |
by (unfold keysFor_def, auto) |
|
122 |
||
123 |
lemma keysFor_insert_Nonce [simp]: "keysFor (insert (Nonce N) H) = keysFor H" |
|
124 |
by (unfold keysFor_def, auto) |
|
125 |
||
126 |
lemma keysFor_insert_Number [simp]: "keysFor (insert (Number N) H) = keysFor H" |
|
127 |
by (unfold keysFor_def, auto) |
|
128 |
||
129 |
lemma keysFor_insert_Key [simp]: "keysFor (insert (Key K) H) = keysFor H" |
|
130 |
by (unfold keysFor_def, auto) |
|
131 |
||
132 |
lemma keysFor_insert_Hash [simp]: "keysFor (insert (Hash X) H) = keysFor H" |
|
133 |
by (unfold keysFor_def, auto) |
|
134 |
||
61984 | 135 |
lemma keysFor_insert_MPair [simp]: "keysFor (insert \<lbrace>X,Y\<rbrace> H) = keysFor H" |
23449 | 136 |
by (unfold keysFor_def, auto) |
137 |
||
43197 | 138 |
lemma keysFor_insert_Crypt [simp]: |
23449 | 139 |
"keysFor (insert (Crypt K X) H) = insert (invKey K) (keysFor H)" |
140 |
by (unfold keysFor_def, auto) |
|
141 |
||
142 |
lemma keysFor_image_Key [simp]: "keysFor (Key`E) = {}" |
|
143 |
by (unfold keysFor_def, auto) |
|
144 |
||
145 |
lemma Crypt_imp_invKey_keysFor: "Crypt K X \<in> H ==> invKey K \<in> keysFor H" |
|
146 |
by (unfold keysFor_def, blast) |
|
147 |
||
148 |
||
63167 | 149 |
subsection\<open>Inductive relation "parts"\<close> |
23449 | 150 |
|
151 |
lemma MPair_parts: |
|
61984 | 152 |
"[| \<lbrace>X,Y\<rbrace> \<in> parts H; |
23449 | 153 |
[| X \<in> parts H; Y \<in> parts H |] ==> P |] ==> P" |
43197 | 154 |
by (blast dest: parts.Fst parts.Snd) |
23449 | 155 |
|
36553 | 156 |
declare MPair_parts [elim!] parts.Body [dest!] |
63167 | 157 |
text\<open>NB These two rules are UNSAFE in the formal sense, as they discard the |
43197 | 158 |
compound message. They work well on THIS FILE. |
63167 | 159 |
\<open>MPair_parts\<close> is left as SAFE because it speeds up proofs. |
160 |
The Crypt rule is normally kept UNSAFE to avoid breaking up certificates.\<close> |
|
23449 | 161 |
|
162 |
lemma parts_increasing: "H \<subseteq> parts(H)" |
|
163 |
by blast |
|
164 |
||
45605 | 165 |
lemmas parts_insertI = subset_insertI [THEN parts_mono, THEN subsetD] |
23449 | 166 |
|
167 |
lemma parts_empty [simp]: "parts{} = {}" |
|
168 |
apply safe |
|
169 |
apply (erule parts.induct) |
|
170 |
apply blast+ |
|
171 |
done |
|
172 |
||
173 |
lemma parts_emptyE [elim!]: "X\<in> parts{} ==> P" |
|
174 |
by simp |
|
175 |
||
63167 | 176 |
text\<open>WARNING: loops if H = {Y}, therefore must not be repeated!\<close> |
23449 | 177 |
lemma parts_singleton: "X\<in> parts H ==> \<exists>Y\<in>H. X\<in> parts {Y}" |
178 |
apply (erule parts.induct) |
|
26807
4cd176ea28dc
Replaced blast by fast in proof of parts_singleton, since blast looped
berghofe
parents:
25710
diff
changeset
|
179 |
apply fast+ |
23449 | 180 |
done |
181 |
||
182 |
||
63167 | 183 |
subsubsection\<open>Unions\<close> |
23449 | 184 |
|
185 |
lemma parts_Un_subset1: "parts(G) \<union> parts(H) \<subseteq> parts(G \<union> H)" |
|
186 |
by (intro Un_least parts_mono Un_upper1 Un_upper2) |
|
187 |
||
188 |
lemma parts_Un_subset2: "parts(G \<union> H) \<subseteq> parts(G) \<union> parts(H)" |
|
189 |
apply (rule subsetI) |
|
190 |
apply (erule parts.induct, blast+) |
|
191 |
done |
|
192 |
||
193 |
lemma parts_Un [simp]: "parts(G \<union> H) = parts(G) \<union> parts(H)" |
|
194 |
by (intro equalityI parts_Un_subset1 parts_Un_subset2) |
|
195 |
||
196 |
lemma parts_insert: "parts (insert X H) = parts {X} \<union> parts H" |
|
197 |
apply (subst insert_is_Un [of _ H]) |
|
198 |
apply (simp only: parts_Un) |
|
199 |
done |
|
200 |
||
201 |
lemma parts_insert2: |
|
202 |
"parts (insert X (insert Y H)) = parts {X} \<union> parts {Y} \<union> parts H" |
|
25710
4cdf7de81e1b
Replaced refs by config params; finer critical section in mets method
paulson
parents:
25457
diff
changeset
|
203 |
by (metis Un_commute Un_empty_left Un_empty_right Un_insert_left Un_insert_right parts_Un) |
23449 | 204 |
|
205 |
||
206 |
lemma parts_UN_subset1: "(\<Union>x\<in>A. parts(H x)) \<subseteq> parts(\<Union>x\<in>A. H x)" |
|
207 |
by (intro UN_least parts_mono UN_upper) |
|
208 |
||
209 |
lemma parts_UN_subset2: "parts(\<Union>x\<in>A. H x) \<subseteq> (\<Union>x\<in>A. parts(H x))" |
|
210 |
apply (rule subsetI) |
|
211 |
apply (erule parts.induct, blast+) |
|
212 |
done |
|
213 |
||
214 |
||
63167 | 215 |
text\<open>This allows \<open>blast\<close> to simplify occurrences of |
69597 | 216 |
\<^term>\<open>parts(G\<union>H)\<close> in the assumption.\<close> |
43197 | 217 |
lemmas in_parts_UnE = parts_Un [THEN equalityD1, THEN subsetD, THEN UnE] |
23449 | 218 |
declare in_parts_UnE [elim!] |
219 |
||
220 |
lemma parts_insert_subset: "insert X (parts H) \<subseteq> parts(insert X H)" |
|
221 |
by (blast intro: parts_mono [THEN [2] rev_subsetD]) |
|
222 |
||
63167 | 223 |
subsubsection\<open>Idempotence and transitivity\<close> |
23449 | 224 |
|
225 |
lemma parts_partsD [dest!]: "X\<in> parts (parts H) ==> X\<in> parts H" |
|
226 |
by (erule parts.induct, blast+) |
|
227 |
||
228 |
lemma parts_idem [simp]: "parts (parts H) = parts H" |
|
229 |
by blast |
|
230 |
||
231 |
lemma parts_subset_iff [simp]: "(parts G \<subseteq> parts H) = (G \<subseteq> parts H)" |
|
43197 | 232 |
apply (rule iffI) |
23449 | 233 |
apply (metis Un_absorb1 Un_subset_iff parts_Un parts_increasing) |
25710
4cdf7de81e1b
Replaced refs by config params; finer critical section in mets method
paulson
parents:
25457
diff
changeset
|
234 |
apply (metis parts_idem parts_mono) |
23449 | 235 |
done |
236 |
||
237 |
lemma parts_trans: "[| X\<in> parts G; G \<subseteq> parts H |] ==> X\<in> parts H" |
|
45503 | 238 |
by (blast dest: parts_mono) |
23449 | 239 |
|
46075
0054a9513b37
reintroduced "metis" call taken out after reintroducing "set" as a constructor, and added two "metis" calls that used to be too slow
blanchet
parents:
45970
diff
changeset
|
240 |
lemma parts_cut: "[|Y\<in> parts (insert X G); X\<in> parts H|] ==> Y\<in> parts(G \<union> H)" |
0054a9513b37
reintroduced "metis" call taken out after reintroducing "set" as a constructor, and added two "metis" calls that used to be too slow
blanchet
parents:
45970
diff
changeset
|
241 |
by (metis (no_types) Un_insert_left Un_insert_right insert_absorb le_supE |
0054a9513b37
reintroduced "metis" call taken out after reintroducing "set" as a constructor, and added two "metis" calls that used to be too slow
blanchet
parents:
45970
diff
changeset
|
242 |
parts_Un parts_idem parts_increasing parts_trans) |
23449 | 243 |
|
63167 | 244 |
subsubsection\<open>Rewrite rules for pulling out atomic messages\<close> |
23449 | 245 |
|
246 |
lemmas parts_insert_eq_I = equalityI [OF subsetI parts_insert_subset] |
|
247 |
||
248 |
||
249 |
lemma parts_insert_Agent [simp]: |
|
250 |
"parts (insert (Agent agt) H) = insert (Agent agt) (parts H)" |
|
43197 | 251 |
apply (rule parts_insert_eq_I) |
252 |
apply (erule parts.induct, auto) |
|
23449 | 253 |
done |
254 |
||
255 |
lemma parts_insert_Nonce [simp]: |
|
256 |
"parts (insert (Nonce N) H) = insert (Nonce N) (parts H)" |
|
43197 | 257 |
apply (rule parts_insert_eq_I) |
258 |
apply (erule parts.induct, auto) |
|
23449 | 259 |
done |
260 |
||
261 |
lemma parts_insert_Number [simp]: |
|
262 |
"parts (insert (Number N) H) = insert (Number N) (parts H)" |
|
43197 | 263 |
apply (rule parts_insert_eq_I) |
264 |
apply (erule parts.induct, auto) |
|
23449 | 265 |
done |
266 |
||
267 |
lemma parts_insert_Key [simp]: |
|
268 |
"parts (insert (Key K) H) = insert (Key K) (parts H)" |
|
43197 | 269 |
apply (rule parts_insert_eq_I) |
270 |
apply (erule parts.induct, auto) |
|
23449 | 271 |
done |
272 |
||
273 |
lemma parts_insert_Hash [simp]: |
|
274 |
"parts (insert (Hash X) H) = insert (Hash X) (parts H)" |
|
43197 | 275 |
apply (rule parts_insert_eq_I) |
276 |
apply (erule parts.induct, auto) |
|
23449 | 277 |
done |
278 |
||
279 |
lemma parts_insert_Crypt [simp]: |
|
43197 | 280 |
"parts (insert (Crypt K X) H) = |
23449 | 281 |
insert (Crypt K X) (parts (insert X H))" |
282 |
apply (rule equalityI) |
|
283 |
apply (rule subsetI) |
|
284 |
apply (erule parts.induct, auto) |
|
285 |
apply (blast intro: parts.Body) |
|
286 |
done |
|
287 |
||
288 |
lemma parts_insert_MPair [simp]: |
|
61984 | 289 |
"parts (insert \<lbrace>X,Y\<rbrace> H) = |
290 |
insert \<lbrace>X,Y\<rbrace> (parts (insert X (insert Y H)))" |
|
23449 | 291 |
apply (rule equalityI) |
292 |
apply (rule subsetI) |
|
293 |
apply (erule parts.induct, auto) |
|
294 |
apply (blast intro: parts.Fst parts.Snd)+ |
|
295 |
done |
|
296 |
||
297 |
lemma parts_image_Key [simp]: "parts (Key`N) = Key`N" |
|
298 |
apply auto |
|
299 |
apply (erule parts.induct, auto) |
|
300 |
done |
|
301 |
||
302 |
lemma msg_Nonce_supply: "\<exists>N. \<forall>n. N\<le>n --> Nonce n \<notin> parts {msg}" |
|
43197 | 303 |
apply (induct_tac "msg") |
23449 | 304 |
apply (simp_all add: parts_insert2) |
305 |
apply (metis Suc_n_not_le_n) |
|
306 |
apply (metis le_trans linorder_linear) |
|
307 |
done |
|
308 |
||
63167 | 309 |
subsection\<open>Inductive relation "analz"\<close> |
23449 | 310 |
|
63167 | 311 |
text\<open>Inductive definition of "analz" -- what can be broken down from a set of |
23449 | 312 |
messages, including keys. A form of downward closure. Pairs can |
63167 | 313 |
be taken apart; messages decrypted with known keys.\<close> |
23449 | 314 |
|
23755 | 315 |
inductive_set |
316 |
analz :: "msg set => msg set" |
|
317 |
for H :: "msg set" |
|
318 |
where |
|
23449 | 319 |
Inj [intro,simp] : "X \<in> H ==> X \<in> analz H" |
61984 | 320 |
| Fst: "\<lbrace>X,Y\<rbrace> \<in> analz H ==> X \<in> analz H" |
321 |
| Snd: "\<lbrace>X,Y\<rbrace> \<in> analz H ==> Y \<in> analz H" |
|
43197 | 322 |
| Decrypt [dest]: |
67613 | 323 |
"[|Crypt K X \<in> analz H; Key(invKey K) \<in> analz H|] ==> X \<in> analz H" |
23449 | 324 |
|
325 |
||
63167 | 326 |
text\<open>Monotonicity; Lemma 1 of Lowe's paper\<close> |
23449 | 327 |
lemma analz_mono: "G\<subseteq>H ==> analz(G) \<subseteq> analz(H)" |
328 |
apply auto |
|
43197 | 329 |
apply (erule analz.induct) |
330 |
apply (auto dest: analz.Fst analz.Snd) |
|
23449 | 331 |
done |
332 |
||
63167 | 333 |
text\<open>Making it safe speeds up proofs\<close> |
23449 | 334 |
lemma MPair_analz [elim!]: |
61984 | 335 |
"[| \<lbrace>X,Y\<rbrace> \<in> analz H; |
43197 | 336 |
[| X \<in> analz H; Y \<in> analz H |] ==> P |
23449 | 337 |
|] ==> P" |
338 |
by (blast dest: analz.Fst analz.Snd) |
|
339 |
||
340 |
lemma analz_increasing: "H \<subseteq> analz(H)" |
|
341 |
by blast |
|
342 |
||
343 |
lemma analz_subset_parts: "analz H \<subseteq> parts H" |
|
344 |
apply (rule subsetI) |
|
345 |
apply (erule analz.induct, blast+) |
|
346 |
done |
|
347 |
||
45605 | 348 |
lemmas analz_into_parts = analz_subset_parts [THEN subsetD] |
23449 | 349 |
|
45605 | 350 |
lemmas not_parts_not_analz = analz_subset_parts [THEN contra_subsetD] |
23449 | 351 |
|
352 |
lemma parts_analz [simp]: "parts (analz H) = parts H" |
|
353 |
apply (rule equalityI) |
|
354 |
apply (metis analz_subset_parts parts_subset_iff) |
|
355 |
apply (metis analz_increasing parts_mono) |
|
356 |
done |
|
357 |
||
358 |
||
359 |
lemma analz_parts [simp]: "analz (parts H) = parts H" |
|
360 |
apply auto |
|
361 |
apply (erule analz.induct, auto) |
|
362 |
done |
|
363 |
||
45605 | 364 |
lemmas analz_insertI = subset_insertI [THEN analz_mono, THEN [2] rev_subsetD] |
23449 | 365 |
|
63167 | 366 |
subsubsection\<open>General equational properties\<close> |
23449 | 367 |
|
368 |
lemma analz_empty [simp]: "analz{} = {}" |
|
369 |
apply safe |
|
370 |
apply (erule analz.induct, blast+) |
|
371 |
done |
|
372 |
||
63167 | 373 |
text\<open>Converse fails: we can analz more from the union than from the |
374 |
separate parts, as a key in one might decrypt a message in the other\<close> |
|
23449 | 375 |
lemma analz_Un: "analz(G) \<union> analz(H) \<subseteq> analz(G \<union> H)" |
376 |
by (intro Un_least analz_mono Un_upper1 Un_upper2) |
|
377 |
||
378 |
lemma analz_insert: "insert X (analz H) \<subseteq> analz(insert X H)" |
|
379 |
by (blast intro: analz_mono [THEN [2] rev_subsetD]) |
|
380 |
||
63167 | 381 |
subsubsection\<open>Rewrite rules for pulling out atomic messages\<close> |
23449 | 382 |
|
383 |
lemmas analz_insert_eq_I = equalityI [OF subsetI analz_insert] |
|
384 |
||
385 |
lemma analz_insert_Agent [simp]: |
|
386 |
"analz (insert (Agent agt) H) = insert (Agent agt) (analz H)" |
|
43197 | 387 |
apply (rule analz_insert_eq_I) |
388 |
apply (erule analz.induct, auto) |
|
23449 | 389 |
done |
390 |
||
391 |
lemma analz_insert_Nonce [simp]: |
|
392 |
"analz (insert (Nonce N) H) = insert (Nonce N) (analz H)" |
|
43197 | 393 |
apply (rule analz_insert_eq_I) |
394 |
apply (erule analz.induct, auto) |
|
23449 | 395 |
done |
396 |
||
397 |
lemma analz_insert_Number [simp]: |
|
398 |
"analz (insert (Number N) H) = insert (Number N) (analz H)" |
|
43197 | 399 |
apply (rule analz_insert_eq_I) |
400 |
apply (erule analz.induct, auto) |
|
23449 | 401 |
done |
402 |
||
403 |
lemma analz_insert_Hash [simp]: |
|
404 |
"analz (insert (Hash X) H) = insert (Hash X) (analz H)" |
|
43197 | 405 |
apply (rule analz_insert_eq_I) |
406 |
apply (erule analz.induct, auto) |
|
23449 | 407 |
done |
408 |
||
63167 | 409 |
text\<open>Can only pull out Keys if they are not needed to decrypt the rest\<close> |
43197 | 410 |
lemma analz_insert_Key [simp]: |
411 |
"K \<notin> keysFor (analz H) ==> |
|
23449 | 412 |
analz (insert (Key K) H) = insert (Key K) (analz H)" |
413 |
apply (unfold keysFor_def) |
|
43197 | 414 |
apply (rule analz_insert_eq_I) |
415 |
apply (erule analz.induct, auto) |
|
23449 | 416 |
done |
417 |
||
418 |
lemma analz_insert_MPair [simp]: |
|
61984 | 419 |
"analz (insert \<lbrace>X,Y\<rbrace> H) = |
420 |
insert \<lbrace>X,Y\<rbrace> (analz (insert X (insert Y H)))" |
|
23449 | 421 |
apply (rule equalityI) |
422 |
apply (rule subsetI) |
|
423 |
apply (erule analz.induct, auto) |
|
424 |
apply (erule analz.induct) |
|
425 |
apply (blast intro: analz.Fst analz.Snd)+ |
|
426 |
done |
|
427 |
||
63167 | 428 |
text\<open>Can pull out enCrypted message if the Key is not known\<close> |
23449 | 429 |
lemma analz_insert_Crypt: |
43197 | 430 |
"Key (invKey K) \<notin> analz H |
23449 | 431 |
==> analz (insert (Crypt K X) H) = insert (Crypt K X) (analz H)" |
43197 | 432 |
apply (rule analz_insert_eq_I) |
433 |
apply (erule analz.induct, auto) |
|
23449 | 434 |
|
435 |
done |
|
436 |
||
43197 | 437 |
lemma lemma1: "Key (invKey K) \<in> analz H ==> |
438 |
analz (insert (Crypt K X) H) \<subseteq> |
|
439 |
insert (Crypt K X) (analz (insert X H))" |
|
23449 | 440 |
apply (rule subsetI) |
23755 | 441 |
apply (erule_tac x = x in analz.induct, auto) |
23449 | 442 |
done |
443 |
||
43197 | 444 |
lemma lemma2: "Key (invKey K) \<in> analz H ==> |
445 |
insert (Crypt K X) (analz (insert X H)) \<subseteq> |
|
23449 | 446 |
analz (insert (Crypt K X) H)" |
447 |
apply auto |
|
23755 | 448 |
apply (erule_tac x = x in analz.induct, auto) |
23449 | 449 |
apply (blast intro: analz_insertI analz.Decrypt) |
450 |
done |
|
451 |
||
452 |
lemma analz_insert_Decrypt: |
|
43197 | 453 |
"Key (invKey K) \<in> analz H ==> |
454 |
analz (insert (Crypt K X) H) = |
|
23449 | 455 |
insert (Crypt K X) (analz (insert X H))" |
456 |
by (intro equalityI lemma1 lemma2) |
|
457 |
||
63167 | 458 |
text\<open>Case analysis: either the message is secure, or it is not! Effective, |
459 |
but can cause subgoals to blow up! Use with \<open>if_split\<close>; apparently |
|
69597 | 460 |
\<open>split_tac\<close> does not cope with patterns such as \<^term>\<open>analz (insert |
461 |
(Crypt K X) H)\<close>\<close> |
|
23449 | 462 |
lemma analz_Crypt_if [simp]: |
43197 | 463 |
"analz (insert (Crypt K X) H) = |
464 |
(if (Key (invKey K) \<in> analz H) |
|
465 |
then insert (Crypt K X) (analz (insert X H)) |
|
23449 | 466 |
else insert (Crypt K X) (analz H))" |
467 |
by (simp add: analz_insert_Crypt analz_insert_Decrypt) |
|
468 |
||
469 |
||
63167 | 470 |
text\<open>This rule supposes "for the sake of argument" that we have the key.\<close> |
23449 | 471 |
lemma analz_insert_Crypt_subset: |
43197 | 472 |
"analz (insert (Crypt K X) H) \<subseteq> |
23449 | 473 |
insert (Crypt K X) (analz (insert X H))" |
474 |
apply (rule subsetI) |
|
475 |
apply (erule analz.induct, auto) |
|
476 |
done |
|
477 |
||
478 |
||
479 |
lemma analz_image_Key [simp]: "analz (Key`N) = Key`N" |
|
480 |
apply auto |
|
481 |
apply (erule analz.induct, auto) |
|
482 |
done |
|
483 |
||
484 |
||
63167 | 485 |
subsubsection\<open>Idempotence and transitivity\<close> |
23449 | 486 |
|
487 |
lemma analz_analzD [dest!]: "X\<in> analz (analz H) ==> X\<in> analz H" |
|
488 |
by (erule analz.induct, blast+) |
|
489 |
||
490 |
lemma analz_idem [simp]: "analz (analz H) = analz H" |
|
491 |
by blast |
|
492 |
||
493 |
lemma analz_subset_iff [simp]: "(analz G \<subseteq> analz H) = (G \<subseteq> analz H)" |
|
494 |
apply (rule iffI) |
|
43197 | 495 |
apply (iprover intro: subset_trans analz_increasing) |
496 |
apply (frule analz_mono, simp) |
|
23449 | 497 |
done |
498 |
||
499 |
lemma analz_trans: "[| X\<in> analz G; G \<subseteq> analz H |] ==> X\<in> analz H" |
|
500 |
by (drule analz_mono, blast) |
|
501 |
||
502 |
||
36553 | 503 |
declare analz_trans[intro] |
504 |
||
23449 | 505 |
lemma analz_cut: "[| Y\<in> analz (insert X H); X\<in> analz H |] ==> Y\<in> analz H" |
46075
0054a9513b37
reintroduced "metis" call taken out after reintroducing "set" as a constructor, and added two "metis" calls that used to be too slow
blanchet
parents:
45970
diff
changeset
|
506 |
by (metis analz_idem analz_increasing analz_mono insert_absorb insert_mono insert_subset) |
23449 | 507 |
|
63167 | 508 |
text\<open>This rewrite rule helps in the simplification of messages that involve |
23449 | 509 |
the forwarding of unknown components (X). Without it, removing occurrences |
63167 | 510 |
of X can be very complicated.\<close> |
23449 | 511 |
lemma analz_insert_eq: "X\<in> analz H ==> analz (insert X H) = analz H" |
512 |
by (blast intro: analz_cut analz_insertI) |
|
513 |
||
514 |
||
63167 | 515 |
text\<open>A congruence rule for "analz"\<close> |
23449 | 516 |
|
517 |
lemma analz_subset_cong: |
|
43197 | 518 |
"[| analz G \<subseteq> analz G'; analz H \<subseteq> analz H' |] |
23449 | 519 |
==> analz (G \<union> H) \<subseteq> analz (G' \<union> H')" |
520 |
apply simp |
|
521 |
apply (metis Un_absorb2 Un_commute Un_subset_iff Un_upper1 Un_upper2 analz_mono) |
|
522 |
done |
|
523 |
||
524 |
||
525 |
lemma analz_cong: |
|
43197 | 526 |
"[| analz G = analz G'; analz H = analz H' |
23449 | 527 |
|] ==> analz (G \<union> H) = analz (G' \<union> H')" |
43197 | 528 |
by (intro equalityI analz_subset_cong, simp_all) |
23449 | 529 |
|
530 |
lemma analz_insert_cong: |
|
531 |
"analz H = analz H' ==> analz(insert X H) = analz(insert X H')" |
|
532 |
by (force simp only: insert_def intro!: analz_cong) |
|
533 |
||
63167 | 534 |
text\<open>If there are no pairs or encryptions then analz does nothing\<close> |
23449 | 535 |
lemma analz_trivial: |
61984 | 536 |
"[| \<forall>X Y. \<lbrace>X,Y\<rbrace> \<notin> H; \<forall>X K. Crypt K X \<notin> H |] ==> analz H = H" |
23449 | 537 |
apply safe |
538 |
apply (erule analz.induct, blast+) |
|
539 |
done |
|
540 |
||
541 |
||
63167 | 542 |
subsection\<open>Inductive relation "synth"\<close> |
23449 | 543 |
|
63167 | 544 |
text\<open>Inductive definition of "synth" -- what can be built up from a set of |
23449 | 545 |
messages. A form of upward closure. Pairs can be built, messages |
546 |
encrypted with known keys. Agent names are public domain. |
|
63167 | 547 |
Numbers can be guessed, but Nonces cannot be.\<close> |
23449 | 548 |
|
23755 | 549 |
inductive_set |
550 |
synth :: "msg set => msg set" |
|
551 |
for H :: "msg set" |
|
552 |
where |
|
23449 | 553 |
Inj [intro]: "X \<in> H ==> X \<in> synth H" |
23755 | 554 |
| Agent [intro]: "Agent agt \<in> synth H" |
555 |
| Number [intro]: "Number n \<in> synth H" |
|
556 |
| Hash [intro]: "X \<in> synth H ==> Hash X \<in> synth H" |
|
61984 | 557 |
| MPair [intro]: "[|X \<in> synth H; Y \<in> synth H|] ==> \<lbrace>X,Y\<rbrace> \<in> synth H" |
23755 | 558 |
| Crypt [intro]: "[|X \<in> synth H; Key(K) \<in> H|] ==> Crypt K X \<in> synth H" |
23449 | 559 |
|
63167 | 560 |
text\<open>Monotonicity\<close> |
23449 | 561 |
lemma synth_mono: "G\<subseteq>H ==> synth(G) \<subseteq> synth(H)" |
43197 | 562 |
by (auto, erule synth.induct, auto) |
23449 | 563 |
|
63167 | 564 |
text\<open>NO \<open>Agent_synth\<close>, as any Agent name can be synthesized. |
69597 | 565 |
The same holds for \<^term>\<open>Number\<close>\<close> |
23449 | 566 |
inductive_cases Nonce_synth [elim!]: "Nonce n \<in> synth H" |
567 |
inductive_cases Key_synth [elim!]: "Key K \<in> synth H" |
|
568 |
inductive_cases Hash_synth [elim!]: "Hash X \<in> synth H" |
|
61984 | 569 |
inductive_cases MPair_synth [elim!]: "\<lbrace>X,Y\<rbrace> \<in> synth H" |
23449 | 570 |
inductive_cases Crypt_synth [elim!]: "Crypt K X \<in> synth H" |
571 |
||
572 |
||
573 |
lemma synth_increasing: "H \<subseteq> synth(H)" |
|
574 |
by blast |
|
575 |
||
63167 | 576 |
subsubsection\<open>Unions\<close> |
23449 | 577 |
|
63167 | 578 |
text\<open>Converse fails: we can synth more from the union than from the |
579 |
separate parts, building a compound message using elements of each.\<close> |
|
23449 | 580 |
lemma synth_Un: "synth(G) \<union> synth(H) \<subseteq> synth(G \<union> H)" |
581 |
by (intro Un_least synth_mono Un_upper1 Un_upper2) |
|
582 |
||
583 |
lemma synth_insert: "insert X (synth H) \<subseteq> synth(insert X H)" |
|
584 |
by (metis insert_iff insert_subset subset_insertI synth.Inj synth_mono) |
|
585 |
||
63167 | 586 |
subsubsection\<open>Idempotence and transitivity\<close> |
23449 | 587 |
|
588 |
lemma synth_synthD [dest!]: "X\<in> synth (synth H) ==> X\<in> synth H" |
|
589 |
by (erule synth.induct, blast+) |
|
590 |
||
591 |
lemma synth_idem: "synth (synth H) = synth H" |
|
592 |
by blast |
|
593 |
||
594 |
lemma synth_subset_iff [simp]: "(synth G \<subseteq> synth H) = (G \<subseteq> synth H)" |
|
595 |
apply (rule iffI) |
|
43197 | 596 |
apply (iprover intro: subset_trans synth_increasing) |
597 |
apply (frule synth_mono, simp add: synth_idem) |
|
23449 | 598 |
done |
599 |
||
600 |
lemma synth_trans: "[| X\<in> synth G; G \<subseteq> synth H |] ==> X\<in> synth H" |
|
601 |
by (drule synth_mono, blast) |
|
602 |
||
603 |
lemma synth_cut: "[| Y\<in> synth (insert X H); X\<in> synth H |] ==> Y\<in> synth H" |
|
604 |
by (metis insert_absorb insert_mono insert_subset synth_idem synth_increasing synth_mono) |
|
605 |
||
606 |
lemma Agent_synth [simp]: "Agent A \<in> synth H" |
|
607 |
by blast |
|
608 |
||
609 |
lemma Number_synth [simp]: "Number n \<in> synth H" |
|
610 |
by blast |
|
611 |
||
612 |
lemma Nonce_synth_eq [simp]: "(Nonce N \<in> synth H) = (Nonce N \<in> H)" |
|
613 |
by blast |
|
614 |
||
615 |
lemma Key_synth_eq [simp]: "(Key K \<in> synth H) = (Key K \<in> H)" |
|
616 |
by blast |
|
617 |
||
618 |
lemma Crypt_synth_eq [simp]: |
|
619 |
"Key K \<notin> H ==> (Crypt K X \<in> synth H) = (Crypt K X \<in> H)" |
|
620 |
by blast |
|
621 |
||
622 |
||
43197 | 623 |
lemma keysFor_synth [simp]: |
23449 | 624 |
"keysFor (synth H) = keysFor H \<union> invKey`{K. Key K \<in> H}" |
625 |
by (unfold keysFor_def, blast) |
|
626 |
||
627 |
||
63167 | 628 |
subsubsection\<open>Combinations of parts, analz and synth\<close> |
23449 | 629 |
|
630 |
lemma parts_synth [simp]: "parts (synth H) = parts H \<union> synth H" |
|
631 |
apply (rule equalityI) |
|
632 |
apply (rule subsetI) |
|
633 |
apply (erule parts.induct) |
|
634 |
apply (metis UnCI) |
|
635 |
apply (metis MPair_synth UnCI UnE insert_absorb insert_subset parts.Fst parts_increasing) |
|
636 |
apply (metis MPair_synth UnCI UnE insert_absorb insert_subset parts.Snd parts_increasing) |
|
637 |
apply (metis Body Crypt_synth UnCI UnE insert_absorb insert_subset parts_increasing) |
|
638 |
apply (metis Un_subset_iff parts_increasing parts_mono synth_increasing) |
|
639 |
done |
|
640 |
||
641 |
lemma analz_analz_Un [simp]: "analz (analz G \<union> H) = analz (G \<union> H)" |
|
45503 | 642 |
apply (rule equalityI) |
23449 | 643 |
apply (metis analz_idem analz_subset_cong order_eq_refl) |
644 |
apply (metis analz_increasing analz_subset_cong order_eq_refl) |
|
645 |
done |
|
646 |
||
36553 | 647 |
declare analz_mono [intro] analz.Fst [intro] analz.Snd [intro] Un_least [intro] |
648 |
||
23449 | 649 |
lemma analz_synth_Un [simp]: "analz (synth G \<union> H) = analz (G \<union> H) \<union> synth G" |
650 |
apply (rule equalityI) |
|
651 |
apply (rule subsetI) |
|
652 |
apply (erule analz.induct) |
|
653 |
apply (metis UnCI UnE Un_commute analz.Inj) |
|
45970
b6d0cff57d96
adjusted to set/pred distinction by means of type constructor `set`
haftmann
parents:
45605
diff
changeset
|
654 |
apply (metis MPair_synth UnCI UnE Un_commute analz.Fst analz.Inj) |
b6d0cff57d96
adjusted to set/pred distinction by means of type constructor `set`
haftmann
parents:
45605
diff
changeset
|
655 |
apply (metis MPair_synth UnCI UnE Un_commute analz.Inj analz.Snd) |
23449 | 656 |
apply (blast intro: analz.Decrypt) |
24759 | 657 |
apply blast |
23449 | 658 |
done |
659 |
||
660 |
lemma analz_synth [simp]: "analz (synth H) = analz H \<union> synth H" |
|
36553 | 661 |
proof - |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
50705
diff
changeset
|
662 |
have "\<forall>x\<^sub>2 x\<^sub>1. synth x\<^sub>1 \<union> analz (x\<^sub>1 \<union> x\<^sub>2) = analz (synth x\<^sub>1 \<union> x\<^sub>2)" by (metis Un_commute analz_synth_Un) |
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
50705
diff
changeset
|
663 |
hence "\<forall>x\<^sub>1. synth x\<^sub>1 \<union> analz x\<^sub>1 = analz (synth x\<^sub>1 \<union> {})" by (metis Un_empty_right) |
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
50705
diff
changeset
|
664 |
hence "\<forall>x\<^sub>1. synth x\<^sub>1 \<union> analz x\<^sub>1 = analz (synth x\<^sub>1)" by (metis Un_empty_right) |
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
50705
diff
changeset
|
665 |
hence "\<forall>x\<^sub>1. analz x\<^sub>1 \<union> synth x\<^sub>1 = analz (synth x\<^sub>1)" by (metis Un_commute) |
36553 | 666 |
thus "analz (synth H) = analz H \<union> synth H" by metis |
23449 | 667 |
qed |
668 |
||
669 |
||
63167 | 670 |
subsubsection\<open>For reasoning about the Fake rule in traces\<close> |
23449 | 671 |
|
45970
b6d0cff57d96
adjusted to set/pred distinction by means of type constructor `set`
haftmann
parents:
45605
diff
changeset
|
672 |
lemma parts_insert_subset_Un: "X \<in> G ==> parts(insert X H) \<subseteq> parts G \<union> parts H" |
36553 | 673 |
proof - |
674 |
assume "X \<in> G" |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
50705
diff
changeset
|
675 |
hence "\<forall>x\<^sub>1. G \<subseteq> x\<^sub>1 \<longrightarrow> X \<in> x\<^sub>1 " by auto |
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
50705
diff
changeset
|
676 |
hence "\<forall>x\<^sub>1. X \<in> G \<union> x\<^sub>1" by (metis Un_upper1) |
36911 | 677 |
hence "insert X H \<subseteq> G \<union> H" by (metis Un_upper2 insert_subset) |
678 |
hence "parts (insert X H) \<subseteq> parts (G \<union> H)" by (metis parts_mono) |
|
679 |
thus "parts (insert X H) \<subseteq> parts G \<union> parts H" by (metis parts_Un) |
|
23449 | 680 |
qed |
681 |
||
682 |
lemma Fake_parts_insert: |
|
43197 | 683 |
"X \<in> synth (analz H) ==> |
23449 | 684 |
parts (insert X H) \<subseteq> synth (analz H) \<union> parts H" |
36553 | 685 |
proof - |
686 |
assume A1: "X \<in> synth (analz H)" |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
50705
diff
changeset
|
687 |
have F1: "\<forall>x\<^sub>1. analz x\<^sub>1 \<union> synth (analz x\<^sub>1) = analz (synth (analz x\<^sub>1))" |
36553 | 688 |
by (metis analz_idem analz_synth) |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
50705
diff
changeset
|
689 |
have F2: "\<forall>x\<^sub>1. parts x\<^sub>1 \<union> synth (analz x\<^sub>1) = parts (synth (analz x\<^sub>1))" |
36553 | 690 |
by (metis parts_analz parts_synth) |
45970
b6d0cff57d96
adjusted to set/pred distinction by means of type constructor `set`
haftmann
parents:
45605
diff
changeset
|
691 |
have F3: "X \<in> synth (analz H)" using A1 by metis |
61076 | 692 |
have "\<forall>x\<^sub>2 x\<^sub>1::msg set. x\<^sub>1 \<le> sup x\<^sub>1 x\<^sub>2" by (metis inf_sup_ord(3)) |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
50705
diff
changeset
|
693 |
hence F4: "\<forall>x\<^sub>1. analz x\<^sub>1 \<subseteq> analz (synth x\<^sub>1)" by (metis analz_synth) |
45970
b6d0cff57d96
adjusted to set/pred distinction by means of type constructor `set`
haftmann
parents:
45605
diff
changeset
|
694 |
have F5: "X \<in> synth (analz H)" using F3 by metis |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
50705
diff
changeset
|
695 |
have "\<forall>x\<^sub>1. analz x\<^sub>1 \<subseteq> synth (analz x\<^sub>1) |
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
50705
diff
changeset
|
696 |
\<longrightarrow> analz (synth (analz x\<^sub>1)) = synth (analz x\<^sub>1)" |
36553 | 697 |
using F1 by (metis subset_Un_eq) |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
50705
diff
changeset
|
698 |
hence F6: "\<forall>x\<^sub>1. analz (synth (analz x\<^sub>1)) = synth (analz x\<^sub>1)" |
36553 | 699 |
by (metis synth_increasing) |
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
50705
diff
changeset
|
700 |
have "\<forall>x\<^sub>1. x\<^sub>1 \<subseteq> analz (synth x\<^sub>1)" using F4 by (metis analz_subset_iff) |
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
50705
diff
changeset
|
701 |
hence "\<forall>x\<^sub>1. x\<^sub>1 \<subseteq> analz (synth (analz x\<^sub>1))" by (metis analz_subset_iff) |
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
50705
diff
changeset
|
702 |
hence "\<forall>x\<^sub>1. x\<^sub>1 \<subseteq> synth (analz x\<^sub>1)" using F6 by metis |
36553 | 703 |
hence "H \<subseteq> synth (analz H)" by metis |
704 |
hence "H \<subseteq> synth (analz H) \<and> X \<in> synth (analz H)" using F5 by metis |
|
705 |
hence "insert X H \<subseteq> synth (analz H)" by (metis insert_subset) |
|
706 |
hence "parts (insert X H) \<subseteq> parts (synth (analz H))" by (metis parts_mono) |
|
707 |
hence "parts (insert X H) \<subseteq> parts H \<union> synth (analz H)" using F2 by metis |
|
708 |
thus "parts (insert X H) \<subseteq> synth (analz H) \<union> parts H" by (metis Un_commute) |
|
23449 | 709 |
qed |
710 |
||
711 |
lemma Fake_parts_insert_in_Un: |
|
67613 | 712 |
"[|Z \<in> parts (insert X H); X \<in> synth (analz H)|] |
45505 | 713 |
==> Z \<in> synth (analz H) \<union> parts H" |
36553 | 714 |
by (blast dest: Fake_parts_insert [THEN subsetD, dest]) |
23449 | 715 |
|
45970
b6d0cff57d96
adjusted to set/pred distinction by means of type constructor `set`
haftmann
parents:
45605
diff
changeset
|
716 |
declare synth_mono [intro] |
36553 | 717 |
|
23449 | 718 |
lemma Fake_analz_insert: |
36553 | 719 |
"X \<in> synth (analz G) ==> |
23449 | 720 |
analz (insert X H) \<subseteq> synth (analz G) \<union> analz (G \<union> H)" |
36553 | 721 |
by (metis Un_commute Un_insert_left Un_insert_right Un_upper1 analz_analz_Un |
722 |
analz_mono analz_synth_Un insert_absorb) |
|
23449 | 723 |
|
724 |
lemma Fake_analz_insert_simpler: |
|
43197 | 725 |
"X \<in> synth (analz G) ==> |
23449 | 726 |
analz (insert X H) \<subseteq> synth (analz G) \<union> analz (G \<union> H)" |
727 |
apply (rule subsetI) |
|
728 |
apply (subgoal_tac "x \<in> analz (synth (analz G) \<union> H) ") |
|
729 |
apply (metis Un_commute analz_analz_Un analz_synth_Un) |
|
39260 | 730 |
by (metis Un_upper1 Un_upper2 analz_mono insert_absorb insert_subset) |
23449 | 731 |
|
732 |
end |