| author | blanchet | 
| Mon, 19 Apr 2010 17:18:21 +0200 | |
| changeset 36229 | c95fab3f9cc5 | 
| parent 35416 | d8d7d1b785af | 
| child 36553 | 95bdfa572cee | 
| permissions | -rw-r--r-- | 
| 23449 | 1 | (* Title: HOL/MetisTest/Message.thy | 
| 2 | Author: Lawrence C Paulson, Cambridge University Computer Laboratory | |
| 3 | ||
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
32864diff
changeset | 4 | Testing the metis method. | 
| 23449 | 5 | *) | 
| 6 | ||
| 7 | theory Message imports Main begin | |
| 8 | ||
| 9 | (*Needed occasionally with spy_analz_tac, e.g. in analz_insert_Key_newK*) | |
| 10 | lemma strange_Un_eq [simp]: "A \<union> (B \<union> A) = B \<union> A" | |
| 11 | by blast | |
| 12 | ||
| 13 | types | |
| 14 | key = nat | |
| 15 | ||
| 16 | consts | |
| 17 |   all_symmetric :: bool        --{*true if all keys are symmetric*}
 | |
| 18 |   invKey        :: "key=>key"  --{*inverse of a symmetric key*}
 | |
| 19 | ||
| 20 | specification (invKey) | |
| 21 | invKey [simp]: "invKey (invKey K) = K" | |
| 22 | invKey_symmetric: "all_symmetric --> invKey = id" | |
| 23 | by (rule exI [of _ id], auto) | |
| 24 | ||
| 25 | ||
| 26 | text{*The inverse of a symmetric key is itself; that of a public key
 | |
| 27 | is the private key and vice versa*} | |
| 28 | ||
| 35416 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 haftmann parents: 
35109diff
changeset | 29 | definition symKeys :: "key set" where | 
| 23449 | 30 |   "symKeys == {K. invKey K = K}"
 | 
| 31 | ||
| 32 | datatype  --{*We allow any number of friendly agents*}
 | |
| 33 | agent = Server | Friend nat | Spy | |
| 34 | ||
| 35 | datatype | |
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
32864diff
changeset | 36 |      msg = Agent  agent     --{*Agent names*}
 | 
| 23449 | 37 |          | Number nat       --{*Ordinary integers, timestamps, ...*}
 | 
| 38 |          | Nonce  nat       --{*Unguessable nonces*}
 | |
| 39 |          | Key    key       --{*Crypto keys*}
 | |
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
32864diff
changeset | 40 |          | Hash   msg       --{*Hashing*}
 | 
| 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
32864diff
changeset | 41 |          | MPair  msg msg   --{*Compound messages*}
 | 
| 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
32864diff
changeset | 42 |          | Crypt  key msg   --{*Encryption, public- or shared-key*}
 | 
| 23449 | 43 | |
| 44 | ||
| 45 | text{*Concrete syntax: messages appear as {|A,B,NA|}, etc...*}
 | |
| 46 | syntax | |
| 35109 | 47 |   "_MTuple"      :: "['a, args] => 'a * 'b"       ("(2{|_,/ _|})")
 | 
| 23449 | 48 | |
| 49 | syntax (xsymbols) | |
| 35109 | 50 |   "_MTuple"      :: "['a, args] => 'a * 'b"       ("(2\<lbrace>_,/ _\<rbrace>)")
 | 
| 23449 | 51 | |
| 52 | translations | |
| 53 |   "{|x, y, z|}"   == "{|x, {|y, z|}|}"
 | |
| 35054 | 54 |   "{|x, y|}"      == "CONST MPair x y"
 | 
| 23449 | 55 | |
| 56 | ||
| 35416 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 haftmann parents: 
35109diff
changeset | 57 | definition HPair :: "[msg,msg] => msg" ("(4Hash[_] /_)" [0, 1000]) where
 | 
| 23449 | 58 |     --{*Message Y paired with a MAC computed with the help of X*}
 | 
| 59 |     "Hash[X] Y == {| Hash{|X,Y|}, Y|}"
 | |
| 60 | ||
| 35416 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 haftmann parents: 
35109diff
changeset | 61 | definition keysFor :: "msg set => key set" where | 
| 23449 | 62 |     --{*Keys useful to decrypt elements of a message set*}
 | 
| 63 |   "keysFor H == invKey ` {K. \<exists>X. Crypt K X \<in> H}"
 | |
| 64 | ||
| 65 | ||
| 66 | subsubsection{*Inductive Definition of All Parts" of a Message*}
 | |
| 67 | ||
| 23755 | 68 | inductive_set | 
| 69 | parts :: "msg set => msg set" | |
| 70 | for H :: "msg set" | |
| 71 | where | |
| 23449 | 72 | Inj [intro]: "X \<in> H ==> X \<in> parts H" | 
| 23755 | 73 |   | Fst:         "{|X,Y|}   \<in> parts H ==> X \<in> parts H"
 | 
| 74 |   | Snd:         "{|X,Y|}   \<in> parts H ==> Y \<in> parts H"
 | |
| 75 | | Body: "Crypt K X \<in> parts H ==> X \<in> parts H" | |
| 23449 | 76 | |
| 77 | ||
| 32864 
a226f29d4bdc
re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
 boehmes parents: 
32685diff
changeset | 78 | declare [[ atp_problem_prefix = "Message__parts_mono" ]] | 
| 23449 | 79 | lemma parts_mono: "G \<subseteq> H ==> parts(G) \<subseteq> parts(H)" | 
| 80 | apply auto | |
| 81 | apply (erule parts.induct) | |
| 82 | apply (metis Inj set_mp) | |
| 83 | apply (metis Fst) | |
| 84 | apply (metis Snd) | |
| 85 | apply (metis Body) | |
| 86 | done | |
| 87 | ||
| 88 | ||
| 89 | text{*Equations hold because constructors are injective.*}
 | |
| 90 | lemma Friend_image_eq [simp]: "(Friend x \<in> Friend`A) = (x:A)" | |
| 91 | by auto | |
| 92 | ||
| 93 | lemma Key_image_eq [simp]: "(Key x \<in> Key`A) = (x\<in>A)" | |
| 94 | by auto | |
| 95 | ||
| 96 | lemma Nonce_Key_image_eq [simp]: "(Nonce x \<notin> Key`A)" | |
| 97 | by auto | |
| 98 | ||
| 99 | ||
| 100 | subsubsection{*Inverse of keys *}
 | |
| 101 | ||
| 32864 
a226f29d4bdc
re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
 boehmes parents: 
32685diff
changeset | 102 | declare [[ atp_problem_prefix = "Message__invKey_eq" ]] | 
| 23449 | 103 | lemma invKey_eq [simp]: "(invKey K = invKey K') = (K=K')" | 
| 104 | by (metis invKey) | |
| 105 | ||
| 106 | ||
| 107 | subsection{*keysFor operator*}
 | |
| 108 | ||
| 109 | lemma keysFor_empty [simp]: "keysFor {} = {}"
 | |
| 110 | by (unfold keysFor_def, blast) | |
| 111 | ||
| 112 | lemma keysFor_Un [simp]: "keysFor (H \<union> H') = keysFor H \<union> keysFor H'" | |
| 113 | by (unfold keysFor_def, blast) | |
| 114 | ||
| 115 | lemma keysFor_UN [simp]: "keysFor (\<Union>i\<in>A. H i) = (\<Union>i\<in>A. keysFor (H i))" | |
| 116 | by (unfold keysFor_def, blast) | |
| 117 | ||
| 118 | text{*Monotonicity*}
 | |
| 119 | lemma keysFor_mono: "G \<subseteq> H ==> keysFor(G) \<subseteq> keysFor(H)" | |
| 120 | by (unfold keysFor_def, blast) | |
| 121 | ||
| 122 | lemma keysFor_insert_Agent [simp]: "keysFor (insert (Agent A) H) = keysFor H" | |
| 123 | by (unfold keysFor_def, auto) | |
| 124 | ||
| 125 | lemma keysFor_insert_Nonce [simp]: "keysFor (insert (Nonce N) H) = keysFor H" | |
| 126 | by (unfold keysFor_def, auto) | |
| 127 | ||
| 128 | lemma keysFor_insert_Number [simp]: "keysFor (insert (Number N) H) = keysFor H" | |
| 129 | by (unfold keysFor_def, auto) | |
| 130 | ||
| 131 | lemma keysFor_insert_Key [simp]: "keysFor (insert (Key K) H) = keysFor H" | |
| 132 | by (unfold keysFor_def, auto) | |
| 133 | ||
| 134 | lemma keysFor_insert_Hash [simp]: "keysFor (insert (Hash X) H) = keysFor H" | |
| 135 | by (unfold keysFor_def, auto) | |
| 136 | ||
| 137 | lemma keysFor_insert_MPair [simp]: "keysFor (insert {|X,Y|} H) = keysFor H"
 | |
| 138 | by (unfold keysFor_def, auto) | |
| 139 | ||
| 140 | lemma keysFor_insert_Crypt [simp]: | |
| 141 | "keysFor (insert (Crypt K X) H) = insert (invKey K) (keysFor H)" | |
| 142 | by (unfold keysFor_def, auto) | |
| 143 | ||
| 144 | lemma keysFor_image_Key [simp]: "keysFor (Key`E) = {}"
 | |
| 145 | by (unfold keysFor_def, auto) | |
| 146 | ||
| 147 | lemma Crypt_imp_invKey_keysFor: "Crypt K X \<in> H ==> invKey K \<in> keysFor H" | |
| 148 | by (unfold keysFor_def, blast) | |
| 149 | ||
| 150 | ||
| 151 | subsection{*Inductive relation "parts"*}
 | |
| 152 | ||
| 153 | lemma MPair_parts: | |
| 154 |      "[| {|X,Y|} \<in> parts H;        
 | |
| 155 | [| X \<in> parts H; Y \<in> parts H |] ==> P |] ==> P" | |
| 156 | by (blast dest: parts.Fst parts.Snd) | |
| 157 | ||
| 158 | declare MPair_parts [elim!] parts.Body [dest!] | |
| 159 | text{*NB These two rules are UNSAFE in the formal sense, as they discard the
 | |
| 160 | compound message. They work well on THIS FILE. | |
| 161 |   @{text MPair_parts} is left as SAFE because it speeds up proofs.
 | |
| 162 | The Crypt rule is normally kept UNSAFE to avoid breaking up certificates.*} | |
| 163 | ||
| 164 | lemma parts_increasing: "H \<subseteq> parts(H)" | |
| 165 | by blast | |
| 166 | ||
| 167 | lemmas parts_insertI = subset_insertI [THEN parts_mono, THEN subsetD, standard] | |
| 168 | ||
| 169 | lemma parts_empty [simp]: "parts{} = {}"
 | |
| 170 | apply safe | |
| 171 | apply (erule parts.induct) | |
| 172 | apply blast+ | |
| 173 | done | |
| 174 | ||
| 175 | lemma parts_emptyE [elim!]: "X\<in> parts{} ==> P"
 | |
| 176 | by simp | |
| 177 | ||
| 178 | text{*WARNING: loops if H = {Y}, therefore must not be repeated!*}
 | |
| 179 | lemma parts_singleton: "X\<in> parts H ==> \<exists>Y\<in>H. X\<in> parts {Y}"
 | |
| 180 | apply (erule parts.induct) | |
| 26807 
4cd176ea28dc
Replaced blast by fast in proof of parts_singleton, since blast looped
 berghofe parents: 
25710diff
changeset | 181 | apply fast+ | 
| 23449 | 182 | done | 
| 183 | ||
| 184 | ||
| 185 | subsubsection{*Unions *}
 | |
| 186 | ||
| 187 | lemma parts_Un_subset1: "parts(G) \<union> parts(H) \<subseteq> parts(G \<union> H)" | |
| 188 | by (intro Un_least parts_mono Un_upper1 Un_upper2) | |
| 189 | ||
| 190 | lemma parts_Un_subset2: "parts(G \<union> H) \<subseteq> parts(G) \<union> parts(H)" | |
| 191 | apply (rule subsetI) | |
| 192 | apply (erule parts.induct, blast+) | |
| 193 | done | |
| 194 | ||
| 195 | lemma parts_Un [simp]: "parts(G \<union> H) = parts(G) \<union> parts(H)" | |
| 196 | by (intro equalityI parts_Un_subset1 parts_Un_subset2) | |
| 197 | ||
| 198 | lemma parts_insert: "parts (insert X H) = parts {X} \<union> parts H"
 | |
| 199 | apply (subst insert_is_Un [of _ H]) | |
| 200 | apply (simp only: parts_Un) | |
| 201 | done | |
| 202 | ||
| 32864 
a226f29d4bdc
re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
 boehmes parents: 
32685diff
changeset | 203 | declare [[ atp_problem_prefix = "Message__parts_insert_two" ]] | 
| 23449 | 204 | lemma parts_insert2: | 
| 205 |      "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: 
25457diff
changeset | 206 | by (metis Un_commute Un_empty_left Un_empty_right Un_insert_left Un_insert_right parts_Un) | 
| 23449 | 207 | |
| 208 | ||
| 209 | lemma parts_UN_subset1: "(\<Union>x\<in>A. parts(H x)) \<subseteq> parts(\<Union>x\<in>A. H x)" | |
| 210 | by (intro UN_least parts_mono UN_upper) | |
| 211 | ||
| 212 | lemma parts_UN_subset2: "parts(\<Union>x\<in>A. H x) \<subseteq> (\<Union>x\<in>A. parts(H x))" | |
| 213 | apply (rule subsetI) | |
| 214 | apply (erule parts.induct, blast+) | |
| 215 | done | |
| 216 | ||
| 217 | lemma parts_UN [simp]: "parts(\<Union>x\<in>A. H x) = (\<Union>x\<in>A. parts(H x))" | |
| 218 | by (intro equalityI parts_UN_subset1 parts_UN_subset2) | |
| 219 | ||
| 220 | text{*Added to simplify arguments to parts, analz and synth.
 | |
| 221 | NOTE: the UN versions are no longer used!*} | |
| 222 | ||
| 223 | ||
| 224 | text{*This allows @{text blast} to simplify occurrences of 
 | |
| 225 |   @{term "parts(G\<union>H)"} in the assumption.*}
 | |
| 226 | lemmas in_parts_UnE = parts_Un [THEN equalityD1, THEN subsetD, THEN UnE] | |
| 227 | declare in_parts_UnE [elim!] | |
| 228 | ||
| 229 | lemma parts_insert_subset: "insert X (parts H) \<subseteq> parts(insert X H)" | |
| 230 | by (blast intro: parts_mono [THEN [2] rev_subsetD]) | |
| 231 | ||
| 232 | subsubsection{*Idempotence and transitivity *}
 | |
| 233 | ||
| 234 | lemma parts_partsD [dest!]: "X\<in> parts (parts H) ==> X\<in> parts H" | |
| 235 | by (erule parts.induct, blast+) | |
| 236 | ||
| 237 | lemma parts_idem [simp]: "parts (parts H) = parts H" | |
| 238 | by blast | |
| 239 | ||
| 32864 
a226f29d4bdc
re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
 boehmes parents: 
32685diff
changeset | 240 | declare [[ atp_problem_prefix = "Message__parts_subset_iff" ]] | 
| 23449 | 241 | lemma parts_subset_iff [simp]: "(parts G \<subseteq> parts H) = (G \<subseteq> parts H)" | 
| 242 | apply (rule iffI) | |
| 243 | 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: 
25457diff
changeset | 244 | apply (metis parts_idem parts_mono) | 
| 23449 | 245 | done | 
| 246 | ||
| 247 | lemma parts_trans: "[| X\<in> parts G; G \<subseteq> parts H |] ==> X\<in> parts H" | |
| 248 | by (blast dest: parts_mono); | |
| 249 | ||
| 250 | ||
| 32864 
a226f29d4bdc
re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
 boehmes parents: 
32685diff
changeset | 251 | declare [[ atp_problem_prefix = "Message__parts_cut" ]] | 
| 23449 | 252 | lemma parts_cut: "[|Y\<in> parts(insert X G); X\<in> parts H|] ==> Y\<in> parts(G \<union> H)" | 
| 35095 | 253 | by (metis Un_insert_left Un_insert_right insert_absorb mem_def parts_Un parts_idem sup1CI) | 
| 23449 | 254 | |
| 255 | ||
| 256 | ||
| 257 | subsubsection{*Rewrite rules for pulling out atomic messages *}
 | |
| 258 | ||
| 259 | lemmas parts_insert_eq_I = equalityI [OF subsetI parts_insert_subset] | |
| 260 | ||
| 261 | ||
| 262 | lemma parts_insert_Agent [simp]: | |
| 263 | "parts (insert (Agent agt) H) = insert (Agent agt) (parts H)" | |
| 264 | apply (rule parts_insert_eq_I) | |
| 265 | apply (erule parts.induct, auto) | |
| 266 | done | |
| 267 | ||
| 268 | lemma parts_insert_Nonce [simp]: | |
| 269 | "parts (insert (Nonce N) H) = insert (Nonce N) (parts H)" | |
| 270 | apply (rule parts_insert_eq_I) | |
| 271 | apply (erule parts.induct, auto) | |
| 272 | done | |
| 273 | ||
| 274 | lemma parts_insert_Number [simp]: | |
| 275 | "parts (insert (Number N) H) = insert (Number N) (parts H)" | |
| 276 | apply (rule parts_insert_eq_I) | |
| 277 | apply (erule parts.induct, auto) | |
| 278 | done | |
| 279 | ||
| 280 | lemma parts_insert_Key [simp]: | |
| 281 | "parts (insert (Key K) H) = insert (Key K) (parts H)" | |
| 282 | apply (rule parts_insert_eq_I) | |
| 283 | apply (erule parts.induct, auto) | |
| 284 | done | |
| 285 | ||
| 286 | lemma parts_insert_Hash [simp]: | |
| 287 | "parts (insert (Hash X) H) = insert (Hash X) (parts H)" | |
| 288 | apply (rule parts_insert_eq_I) | |
| 289 | apply (erule parts.induct, auto) | |
| 290 | done | |
| 291 | ||
| 292 | lemma parts_insert_Crypt [simp]: | |
| 293 | "parts (insert (Crypt K X) H) = | |
| 294 | insert (Crypt K X) (parts (insert X H))" | |
| 295 | apply (rule equalityI) | |
| 296 | apply (rule subsetI) | |
| 297 | apply (erule parts.induct, auto) | |
| 298 | apply (blast intro: parts.Body) | |
| 299 | done | |
| 300 | ||
| 301 | lemma parts_insert_MPair [simp]: | |
| 302 |      "parts (insert {|X,Y|} H) =  
 | |
| 303 |           insert {|X,Y|} (parts (insert X (insert Y H)))"
 | |
| 304 | apply (rule equalityI) | |
| 305 | apply (rule subsetI) | |
| 306 | apply (erule parts.induct, auto) | |
| 307 | apply (blast intro: parts.Fst parts.Snd)+ | |
| 308 | done | |
| 309 | ||
| 310 | lemma parts_image_Key [simp]: "parts (Key`N) = Key`N" | |
| 311 | apply auto | |
| 312 | apply (erule parts.induct, auto) | |
| 313 | done | |
| 314 | ||
| 315 | ||
| 32864 
a226f29d4bdc
re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
 boehmes parents: 
32685diff
changeset | 316 | declare [[ atp_problem_prefix = "Message__msg_Nonce_supply" ]] | 
| 23449 | 317 | lemma msg_Nonce_supply: "\<exists>N. \<forall>n. N\<le>n --> Nonce n \<notin> parts {msg}"
 | 
| 318 | apply (induct_tac "msg") | |
| 319 | apply (simp_all add: parts_insert2) | |
| 320 | apply (metis Suc_n_not_le_n) | |
| 321 | apply (metis le_trans linorder_linear) | |
| 322 | done | |
| 323 | ||
| 324 | subsection{*Inductive relation "analz"*}
 | |
| 325 | ||
| 326 | text{*Inductive definition of "analz" -- what can be broken down from a set of
 | |
| 327 | messages, including keys. A form of downward closure. Pairs can | |
| 328 | be taken apart; messages decrypted with known keys. *} | |
| 329 | ||
| 23755 | 330 | inductive_set | 
| 331 | analz :: "msg set => msg set" | |
| 332 | for H :: "msg set" | |
| 333 | where | |
| 23449 | 334 | Inj [intro,simp] : "X \<in> H ==> X \<in> analz H" | 
| 23755 | 335 |   | Fst:     "{|X,Y|} \<in> analz H ==> X \<in> analz H"
 | 
| 336 |   | Snd:     "{|X,Y|} \<in> analz H ==> Y \<in> analz H"
 | |
| 337 | | Decrypt [dest]: | |
| 23449 | 338 | "[|Crypt K X \<in> analz H; Key(invKey K): analz H|] ==> X \<in> analz H" | 
| 339 | ||
| 340 | ||
| 341 | text{*Monotonicity; Lemma 1 of Lowe's paper*}
 | |
| 342 | lemma analz_mono: "G\<subseteq>H ==> analz(G) \<subseteq> analz(H)" | |
| 343 | apply auto | |
| 344 | apply (erule analz.induct) | |
| 345 | apply (auto dest: analz.Fst analz.Snd) | |
| 346 | done | |
| 347 | ||
| 348 | text{*Making it safe speeds up proofs*}
 | |
| 349 | lemma MPair_analz [elim!]: | |
| 350 |      "[| {|X,Y|} \<in> analz H;        
 | |
| 351 | [| X \<in> analz H; Y \<in> analz H |] ==> P | |
| 352 | |] ==> P" | |
| 353 | by (blast dest: analz.Fst analz.Snd) | |
| 354 | ||
| 355 | lemma analz_increasing: "H \<subseteq> analz(H)" | |
| 356 | by blast | |
| 357 | ||
| 358 | lemma analz_subset_parts: "analz H \<subseteq> parts H" | |
| 359 | apply (rule subsetI) | |
| 360 | apply (erule analz.induct, blast+) | |
| 361 | done | |
| 362 | ||
| 363 | lemmas analz_into_parts = analz_subset_parts [THEN subsetD, standard] | |
| 364 | ||
| 365 | lemmas not_parts_not_analz = analz_subset_parts [THEN contra_subsetD, standard] | |
| 366 | ||
| 367 | ||
| 32864 
a226f29d4bdc
re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
 boehmes parents: 
32685diff
changeset | 368 | declare [[ atp_problem_prefix = "Message__parts_analz" ]] | 
| 23449 | 369 | lemma parts_analz [simp]: "parts (analz H) = parts H" | 
| 370 | apply (rule equalityI) | |
| 371 | apply (metis analz_subset_parts parts_subset_iff) | |
| 372 | apply (metis analz_increasing parts_mono) | |
| 373 | done | |
| 374 | ||
| 375 | ||
| 376 | lemma analz_parts [simp]: "analz (parts H) = parts H" | |
| 377 | apply auto | |
| 378 | apply (erule analz.induct, auto) | |
| 379 | done | |
| 380 | ||
| 381 | lemmas analz_insertI = subset_insertI [THEN analz_mono, THEN [2] rev_subsetD, standard] | |
| 382 | ||
| 383 | subsubsection{*General equational properties *}
 | |
| 384 | ||
| 385 | lemma analz_empty [simp]: "analz{} = {}"
 | |
| 386 | apply safe | |
| 387 | apply (erule analz.induct, blast+) | |
| 388 | done | |
| 389 | ||
| 390 | text{*Converse fails: we can analz more from the union than from the 
 | |
| 391 | separate parts, as a key in one might decrypt a message in the other*} | |
| 392 | lemma analz_Un: "analz(G) \<union> analz(H) \<subseteq> analz(G \<union> H)" | |
| 393 | by (intro Un_least analz_mono Un_upper1 Un_upper2) | |
| 394 | ||
| 395 | lemma analz_insert: "insert X (analz H) \<subseteq> analz(insert X H)" | |
| 396 | by (blast intro: analz_mono [THEN [2] rev_subsetD]) | |
| 397 | ||
| 398 | subsubsection{*Rewrite rules for pulling out atomic messages *}
 | |
| 399 | ||
| 400 | lemmas analz_insert_eq_I = equalityI [OF subsetI analz_insert] | |
| 401 | ||
| 402 | lemma analz_insert_Agent [simp]: | |
| 403 | "analz (insert (Agent agt) H) = insert (Agent agt) (analz H)" | |
| 404 | apply (rule analz_insert_eq_I) | |
| 405 | apply (erule analz.induct, auto) | |
| 406 | done | |
| 407 | ||
| 408 | lemma analz_insert_Nonce [simp]: | |
| 409 | "analz (insert (Nonce N) H) = insert (Nonce N) (analz H)" | |
| 410 | apply (rule analz_insert_eq_I) | |
| 411 | apply (erule analz.induct, auto) | |
| 412 | done | |
| 413 | ||
| 414 | lemma analz_insert_Number [simp]: | |
| 415 | "analz (insert (Number N) H) = insert (Number N) (analz H)" | |
| 416 | apply (rule analz_insert_eq_I) | |
| 417 | apply (erule analz.induct, auto) | |
| 418 | done | |
| 419 | ||
| 420 | lemma analz_insert_Hash [simp]: | |
| 421 | "analz (insert (Hash X) H) = insert (Hash X) (analz H)" | |
| 422 | apply (rule analz_insert_eq_I) | |
| 423 | apply (erule analz.induct, auto) | |
| 424 | done | |
| 425 | ||
| 426 | text{*Can only pull out Keys if they are not needed to decrypt the rest*}
 | |
| 427 | lemma analz_insert_Key [simp]: | |
| 428 | "K \<notin> keysFor (analz H) ==> | |
| 429 | analz (insert (Key K) H) = insert (Key K) (analz H)" | |
| 430 | apply (unfold keysFor_def) | |
| 431 | apply (rule analz_insert_eq_I) | |
| 432 | apply (erule analz.induct, auto) | |
| 433 | done | |
| 434 | ||
| 435 | lemma analz_insert_MPair [simp]: | |
| 436 |      "analz (insert {|X,Y|} H) =  
 | |
| 437 |           insert {|X,Y|} (analz (insert X (insert Y H)))"
 | |
| 438 | apply (rule equalityI) | |
| 439 | apply (rule subsetI) | |
| 440 | apply (erule analz.induct, auto) | |
| 441 | apply (erule analz.induct) | |
| 442 | apply (blast intro: analz.Fst analz.Snd)+ | |
| 443 | done | |
| 444 | ||
| 445 | text{*Can pull out enCrypted message if the Key is not known*}
 | |
| 446 | lemma analz_insert_Crypt: | |
| 447 | "Key (invKey K) \<notin> analz H | |
| 448 | ==> analz (insert (Crypt K X) H) = insert (Crypt K X) (analz H)" | |
| 449 | apply (rule analz_insert_eq_I) | |
| 450 | apply (erule analz.induct, auto) | |
| 451 | ||
| 452 | done | |
| 453 | ||
| 454 | lemma lemma1: "Key (invKey K) \<in> analz H ==> | |
| 455 | analz (insert (Crypt K X) H) \<subseteq> | |
| 456 | insert (Crypt K X) (analz (insert X H))" | |
| 457 | apply (rule subsetI) | |
| 23755 | 458 | apply (erule_tac x = x in analz.induct, auto) | 
| 23449 | 459 | done | 
| 460 | ||
| 461 | lemma lemma2: "Key (invKey K) \<in> analz H ==> | |
| 462 | insert (Crypt K X) (analz (insert X H)) \<subseteq> | |
| 463 | analz (insert (Crypt K X) H)" | |
| 464 | apply auto | |
| 23755 | 465 | apply (erule_tac x = x in analz.induct, auto) | 
| 23449 | 466 | apply (blast intro: analz_insertI analz.Decrypt) | 
| 467 | done | |
| 468 | ||
| 469 | lemma analz_insert_Decrypt: | |
| 470 | "Key (invKey K) \<in> analz H ==> | |
| 471 | analz (insert (Crypt K X) H) = | |
| 472 | insert (Crypt K X) (analz (insert X H))" | |
| 473 | by (intro equalityI lemma1 lemma2) | |
| 474 | ||
| 475 | text{*Case analysis: either the message is secure, or it is not! Effective,
 | |
| 476 | but can cause subgoals to blow up! Use with @{text "split_if"}; apparently
 | |
| 477 | @{text "split_tac"} does not cope with patterns such as @{term"analz (insert
 | |
| 478 | (Crypt K X) H)"} *} | |
| 479 | lemma analz_Crypt_if [simp]: | |
| 480 | "analz (insert (Crypt K X) H) = | |
| 481 | (if (Key (invKey K) \<in> analz H) | |
| 482 | then insert (Crypt K X) (analz (insert X H)) | |
| 483 | else insert (Crypt K X) (analz H))" | |
| 484 | by (simp add: analz_insert_Crypt analz_insert_Decrypt) | |
| 485 | ||
| 486 | ||
| 487 | text{*This rule supposes "for the sake of argument" that we have the key.*}
 | |
| 488 | lemma analz_insert_Crypt_subset: | |
| 489 | "analz (insert (Crypt K X) H) \<subseteq> | |
| 490 | insert (Crypt K X) (analz (insert X H))" | |
| 491 | apply (rule subsetI) | |
| 492 | apply (erule analz.induct, auto) | |
| 493 | done | |
| 494 | ||
| 495 | ||
| 496 | lemma analz_image_Key [simp]: "analz (Key`N) = Key`N" | |
| 497 | apply auto | |
| 498 | apply (erule analz.induct, auto) | |
| 499 | done | |
| 500 | ||
| 501 | ||
| 502 | subsubsection{*Idempotence and transitivity *}
 | |
| 503 | ||
| 504 | lemma analz_analzD [dest!]: "X\<in> analz (analz H) ==> X\<in> analz H" | |
| 505 | by (erule analz.induct, blast+) | |
| 506 | ||
| 507 | lemma analz_idem [simp]: "analz (analz H) = analz H" | |
| 508 | by blast | |
| 509 | ||
| 510 | lemma analz_subset_iff [simp]: "(analz G \<subseteq> analz H) = (G \<subseteq> analz H)" | |
| 511 | apply (rule iffI) | |
| 512 | apply (iprover intro: subset_trans analz_increasing) | |
| 513 | apply (frule analz_mono, simp) | |
| 514 | done | |
| 515 | ||
| 516 | lemma analz_trans: "[| X\<in> analz G; G \<subseteq> analz H |] ==> X\<in> analz H" | |
| 517 | by (drule analz_mono, blast) | |
| 518 | ||
| 519 | ||
| 32864 
a226f29d4bdc
re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
 boehmes parents: 
32685diff
changeset | 520 | declare [[ atp_problem_prefix = "Message__analz_cut" ]] | 
| 23449 | 521 | declare analz_trans[intro] | 
| 522 | lemma analz_cut: "[| Y\<in> analz (insert X H); X\<in> analz H |] ==> Y\<in> analz H" | |
| 523 | (*TOO SLOW | |
| 524 | by (metis analz_idem analz_increasing analz_mono insert_absorb insert_mono insert_subset) --{*317s*}
 | |
| 525 | ??*) | |
| 526 | by (erule analz_trans, blast) | |
| 527 | ||
| 528 | ||
| 529 | text{*This rewrite rule helps in the simplification of messages that involve
 | |
| 530 | the forwarding of unknown components (X). Without it, removing occurrences | |
| 531 | of X can be very complicated. *} | |
| 532 | lemma analz_insert_eq: "X\<in> analz H ==> analz (insert X H) = analz H" | |
| 533 | by (blast intro: analz_cut analz_insertI) | |
| 534 | ||
| 535 | ||
| 536 | text{*A congruence rule for "analz" *}
 | |
| 537 | ||
| 32864 
a226f29d4bdc
re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
 boehmes parents: 
32685diff
changeset | 538 | declare [[ atp_problem_prefix = "Message__analz_subset_cong" ]] | 
| 23449 | 539 | lemma analz_subset_cong: | 
| 540 | "[| analz G \<subseteq> analz G'; analz H \<subseteq> analz H' |] | |
| 541 | ==> analz (G \<union> H) \<subseteq> analz (G' \<union> H')" | |
| 542 | apply simp | |
| 543 | apply (metis Un_absorb2 Un_commute Un_subset_iff Un_upper1 Un_upper2 analz_mono) | |
| 544 | done | |
| 545 | ||
| 546 | ||
| 547 | lemma analz_cong: | |
| 548 | "[| analz G = analz G'; analz H = analz H' | |
| 549 | |] ==> analz (G \<union> H) = analz (G' \<union> H')" | |
| 550 | by (intro equalityI analz_subset_cong, simp_all) | |
| 551 | ||
| 552 | lemma analz_insert_cong: | |
| 553 | "analz H = analz H' ==> analz(insert X H) = analz(insert X H')" | |
| 554 | by (force simp only: insert_def intro!: analz_cong) | |
| 555 | ||
| 556 | text{*If there are no pairs or encryptions then analz does nothing*}
 | |
| 557 | lemma analz_trivial: | |
| 558 |      "[| \<forall>X Y. {|X,Y|} \<notin> H;  \<forall>X K. Crypt K X \<notin> H |] ==> analz H = H"
 | |
| 559 | apply safe | |
| 560 | apply (erule analz.induct, blast+) | |
| 561 | done | |
| 562 | ||
| 563 | text{*These two are obsolete (with a single Spy) but cost little to prove...*}
 | |
| 564 | lemma analz_UN_analz_lemma: | |
| 565 | "X\<in> analz (\<Union>i\<in>A. analz (H i)) ==> X\<in> analz (\<Union>i\<in>A. H i)" | |
| 566 | apply (erule analz.induct) | |
| 567 | apply (blast intro: analz_mono [THEN [2] rev_subsetD])+ | |
| 568 | done | |
| 569 | ||
| 570 | lemma analz_UN_analz [simp]: "analz (\<Union>i\<in>A. analz (H i)) = analz (\<Union>i\<in>A. H i)" | |
| 571 | by (blast intro: analz_UN_analz_lemma analz_mono [THEN [2] rev_subsetD]) | |
| 572 | ||
| 573 | ||
| 574 | subsection{*Inductive relation "synth"*}
 | |
| 575 | ||
| 576 | text{*Inductive definition of "synth" -- what can be built up from a set of
 | |
| 577 | messages. A form of upward closure. Pairs can be built, messages | |
| 578 | encrypted with known keys. Agent names are public domain. | |
| 579 | Numbers can be guessed, but Nonces cannot be. *} | |
| 580 | ||
| 23755 | 581 | inductive_set | 
| 582 | synth :: "msg set => msg set" | |
| 583 | for H :: "msg set" | |
| 584 | where | |
| 23449 | 585 | Inj [intro]: "X \<in> H ==> X \<in> synth H" | 
| 23755 | 586 | | Agent [intro]: "Agent agt \<in> synth H" | 
| 587 | | Number [intro]: "Number n \<in> synth H" | |
| 588 | | Hash [intro]: "X \<in> synth H ==> Hash X \<in> synth H" | |
| 589 |   | MPair  [intro]:   "[|X \<in> synth H;  Y \<in> synth H|] ==> {|X,Y|} \<in> synth H"
 | |
| 590 | | Crypt [intro]: "[|X \<in> synth H; Key(K) \<in> H|] ==> Crypt K X \<in> synth H" | |
| 23449 | 591 | |
| 592 | text{*Monotonicity*}
 | |
| 593 | lemma synth_mono: "G\<subseteq>H ==> synth(G) \<subseteq> synth(H)" | |
| 594 | by (auto, erule synth.induct, auto) | |
| 595 | ||
| 596 | text{*NO @{text Agent_synth}, as any Agent name can be synthesized.  
 | |
| 597 |   The same holds for @{term Number}*}
 | |
| 598 | inductive_cases Nonce_synth [elim!]: "Nonce n \<in> synth H" | |
| 599 | inductive_cases Key_synth [elim!]: "Key K \<in> synth H" | |
| 600 | inductive_cases Hash_synth [elim!]: "Hash X \<in> synth H" | |
| 601 | inductive_cases MPair_synth [elim!]: "{|X,Y|} \<in> synth H"
 | |
| 602 | inductive_cases Crypt_synth [elim!]: "Crypt K X \<in> synth H" | |
| 603 | ||
| 604 | ||
| 605 | lemma synth_increasing: "H \<subseteq> synth(H)" | |
| 606 | by blast | |
| 607 | ||
| 608 | subsubsection{*Unions *}
 | |
| 609 | ||
| 610 | text{*Converse fails: we can synth more from the union than from the 
 | |
| 611 | separate parts, building a compound message using elements of each.*} | |
| 612 | lemma synth_Un: "synth(G) \<union> synth(H) \<subseteq> synth(G \<union> H)" | |
| 613 | by (intro Un_least synth_mono Un_upper1 Un_upper2) | |
| 614 | ||
| 615 | ||
| 32864 
a226f29d4bdc
re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
 boehmes parents: 
32685diff
changeset | 616 | declare [[ atp_problem_prefix = "Message__synth_insert" ]] | 
| 23449 | 617 | |
| 618 | lemma synth_insert: "insert X (synth H) \<subseteq> synth(insert X H)" | |
| 619 | by (metis insert_iff insert_subset subset_insertI synth.Inj synth_mono) | |
| 620 | ||
| 621 | subsubsection{*Idempotence and transitivity *}
 | |
| 622 | ||
| 623 | lemma synth_synthD [dest!]: "X\<in> synth (synth H) ==> X\<in> synth H" | |
| 624 | by (erule synth.induct, blast+) | |
| 625 | ||
| 626 | lemma synth_idem: "synth (synth H) = synth H" | |
| 627 | by blast | |
| 628 | ||
| 629 | lemma synth_subset_iff [simp]: "(synth G \<subseteq> synth H) = (G \<subseteq> synth H)" | |
| 630 | apply (rule iffI) | |
| 631 | apply (iprover intro: subset_trans synth_increasing) | |
| 632 | apply (frule synth_mono, simp add: synth_idem) | |
| 633 | done | |
| 634 | ||
| 635 | lemma synth_trans: "[| X\<in> synth G; G \<subseteq> synth H |] ==> X\<in> synth H" | |
| 636 | by (drule synth_mono, blast) | |
| 637 | ||
| 32864 
a226f29d4bdc
re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
 boehmes parents: 
32685diff
changeset | 638 | declare [[ atp_problem_prefix = "Message__synth_cut" ]] | 
| 23449 | 639 | lemma synth_cut: "[| Y\<in> synth (insert X H); X\<in> synth H |] ==> Y\<in> synth H" | 
| 640 | (*TOO SLOW | |
| 641 | by (metis insert_absorb insert_mono insert_subset synth_idem synth_increasing synth_mono) | |
| 642 | *) | |
| 643 | by (erule synth_trans, blast) | |
| 644 | ||
| 645 | ||
| 646 | lemma Agent_synth [simp]: "Agent A \<in> synth H" | |
| 647 | by blast | |
| 648 | ||
| 649 | lemma Number_synth [simp]: "Number n \<in> synth H" | |
| 650 | by blast | |
| 651 | ||
| 652 | lemma Nonce_synth_eq [simp]: "(Nonce N \<in> synth H) = (Nonce N \<in> H)" | |
| 653 | by blast | |
| 654 | ||
| 655 | lemma Key_synth_eq [simp]: "(Key K \<in> synth H) = (Key K \<in> H)" | |
| 656 | by blast | |
| 657 | ||
| 658 | lemma Crypt_synth_eq [simp]: | |
| 659 | "Key K \<notin> H ==> (Crypt K X \<in> synth H) = (Crypt K X \<in> H)" | |
| 660 | by blast | |
| 661 | ||
| 662 | ||
| 663 | lemma keysFor_synth [simp]: | |
| 664 |     "keysFor (synth H) = keysFor H \<union> invKey`{K. Key K \<in> H}"
 | |
| 665 | by (unfold keysFor_def, blast) | |
| 666 | ||
| 667 | ||
| 668 | subsubsection{*Combinations of parts, analz and synth *}
 | |
| 669 | ||
| 32864 
a226f29d4bdc
re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
 boehmes parents: 
32685diff
changeset | 670 | declare [[ atp_problem_prefix = "Message__parts_synth" ]] | 
| 23449 | 671 | lemma parts_synth [simp]: "parts (synth H) = parts H \<union> synth H" | 
| 672 | apply (rule equalityI) | |
| 673 | apply (rule subsetI) | |
| 674 | apply (erule parts.induct) | |
| 675 | apply (metis UnCI) | |
| 676 | apply (metis MPair_synth UnCI UnE insert_absorb insert_subset parts.Fst parts_increasing) | |
| 677 | apply (metis MPair_synth UnCI UnE insert_absorb insert_subset parts.Snd parts_increasing) | |
| 678 | apply (metis Body Crypt_synth UnCI UnE insert_absorb insert_subset parts_increasing) | |
| 679 | apply (metis Un_subset_iff parts_increasing parts_mono synth_increasing) | |
| 680 | done | |
| 681 | ||
| 682 | ||
| 683 | ||
| 684 | ||
| 32864 
a226f29d4bdc
re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
 boehmes parents: 
32685diff
changeset | 685 | declare [[ atp_problem_prefix = "Message__analz_analz_Un" ]] | 
| 23449 | 686 | lemma analz_analz_Un [simp]: "analz (analz G \<union> H) = analz (G \<union> H)" | 
| 687 | apply (rule equalityI); | |
| 688 | apply (metis analz_idem analz_subset_cong order_eq_refl) | |
| 689 | apply (metis analz_increasing analz_subset_cong order_eq_refl) | |
| 690 | done | |
| 691 | ||
| 32864 
a226f29d4bdc
re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
 boehmes parents: 
32685diff
changeset | 692 | declare [[ atp_problem_prefix = "Message__analz_synth_Un" ]] | 
| 23449 | 693 | declare analz_mono [intro] analz.Fst [intro] analz.Snd [intro] Un_least [intro] | 
| 694 | lemma analz_synth_Un [simp]: "analz (synth G \<union> H) = analz (G \<union> H) \<union> synth G" | |
| 695 | apply (rule equalityI) | |
| 696 | apply (rule subsetI) | |
| 697 | apply (erule analz.induct) | |
| 698 | apply (metis UnCI UnE Un_commute analz.Inj) | |
| 35095 | 699 | apply (metis MPair_synth UnCI UnE Un_commute analz.Fst analz.Inj mem_def) | 
| 700 | apply (metis MPair_synth UnCI UnE Un_commute analz.Inj analz.Snd mem_def) | |
| 23449 | 701 | apply (blast intro: analz.Decrypt) | 
| 24759 | 702 | apply blast | 
| 23449 | 703 | done | 
| 704 | ||
| 32864 
a226f29d4bdc
re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
 boehmes parents: 
32685diff
changeset | 705 | declare [[ atp_problem_prefix = "Message__analz_synth" ]] | 
| 23449 | 706 | lemma analz_synth [simp]: "analz (synth H) = analz H \<union> synth H" | 
| 707 | proof (neg_clausify) | |
| 708 | assume 0: "analz (synth H) \<noteq> analz H \<union> synth H" | |
| 709 | have 1: "\<And>X1 X3. sup (analz (sup X3 X1)) (synth X3) = analz (sup (synth X3) X1)" | |
| 32685 | 710 | by (metis analz_synth_Un) | 
| 23449 | 711 | have 2: "sup (analz H) (synth H) \<noteq> analz (synth H)" | 
| 32685 | 712 | by (metis 0) | 
| 23449 | 713 | have 3: "\<And>X1 X3. sup (synth X3) (analz (sup X3 X1)) = analz (sup (synth X3) X1)" | 
| 32685 | 714 | by (metis 1 Un_commute) | 
| 23449 | 715 | have 4: "\<And>X3. sup (synth X3) (analz X3) = analz (sup (synth X3) {})"
 | 
| 32685 | 716 | by (metis 3 Un_empty_right) | 
| 23449 | 717 | have 5: "\<And>X3. sup (synth X3) (analz X3) = analz (synth X3)" | 
| 32685 | 718 | by (metis 4 Un_empty_right) | 
| 23449 | 719 | have 6: "\<And>X3. sup (analz X3) (synth X3) = analz (synth X3)" | 
| 32685 | 720 | by (metis 5 Un_commute) | 
| 23449 | 721 | show "False" | 
| 722 | by (metis 2 6) | |
| 723 | qed | |
| 724 | ||
| 725 | ||
| 726 | subsubsection{*For reasoning about the Fake rule in traces *}
 | |
| 727 | ||
| 32864 
a226f29d4bdc
re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
 boehmes parents: 
32685diff
changeset | 728 | declare [[ atp_problem_prefix = "Message__parts_insert_subset_Un" ]] | 
| 23449 | 729 | lemma parts_insert_subset_Un: "X\<in> G ==> parts(insert X H) \<subseteq> parts G \<union> parts H" | 
| 730 | proof (neg_clausify) | |
| 731 | assume 0: "X \<in> G" | |
| 732 | assume 1: "\<not> parts (insert X H) \<subseteq> parts G \<union> parts H" | |
| 733 | have 2: "\<not> parts (insert X H) \<subseteq> parts (G \<union> H)" | |
| 734 | by (metis 1 parts_Un) | |
| 735 | have 3: "\<not> insert X H \<subseteq> G \<union> H" | |
| 736 | by (metis 2 parts_mono) | |
| 737 | have 4: "X \<notin> G \<union> H \<or> \<not> H \<subseteq> G \<union> H" | |
| 738 | by (metis 3 insert_subset) | |
| 739 | have 5: "X \<notin> G \<union> H" | |
| 740 | by (metis 4 Un_upper2) | |
| 741 | have 6: "X \<notin> G" | |
| 742 | by (metis 5 UnCI) | |
| 743 | show "False" | |
| 744 | by (metis 6 0) | |
| 745 | qed | |
| 746 | ||
| 32864 
a226f29d4bdc
re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
 boehmes parents: 
32685diff
changeset | 747 | declare [[ atp_problem_prefix = "Message__Fake_parts_insert" ]] | 
| 23449 | 748 | lemma Fake_parts_insert: | 
| 749 | "X \<in> synth (analz H) ==> | |
| 750 | parts (insert X H) \<subseteq> synth (analz H) \<union> parts H" | |
| 751 | proof (neg_clausify) | |
| 752 | assume 0: "X \<in> synth (analz H)" | |
| 753 | assume 1: "\<not> parts (insert X H) \<subseteq> synth (analz H) \<union> parts H" | |
| 754 | have 2: "\<And>X3. parts X3 \<union> synth (analz X3) = parts (synth (analz X3))" | |
| 755 | by (metis parts_synth parts_analz) | |
| 756 | have 3: "\<And>X3. analz X3 \<union> synth (analz X3) = analz (synth (analz X3))" | |
| 757 | by (metis analz_synth analz_idem) | |
| 758 | have 4: "\<And>X3. analz X3 \<subseteq> analz (synth X3)" | |
| 759 | by (metis Un_upper1 analz_synth) | |
| 760 | have 5: "\<not> parts (insert X H) \<subseteq> parts H \<union> synth (analz H)" | |
| 761 | by (metis 1 Un_commute) | |
| 762 | have 6: "\<not> parts (insert X H) \<subseteq> parts (synth (analz H))" | |
| 763 | by (metis 5 2) | |
| 764 | have 7: "\<not> insert X H \<subseteq> synth (analz H)" | |
| 765 | by (metis 6 parts_mono) | |
| 766 | have 8: "X \<notin> synth (analz H) \<or> \<not> H \<subseteq> synth (analz H)" | |
| 767 | by (metis 7 insert_subset) | |
| 768 | have 9: "\<not> H \<subseteq> synth (analz H)" | |
| 769 | by (metis 8 0) | |
| 770 | have 10: "\<And>X3. X3 \<subseteq> analz (synth X3)" | |
| 771 | by (metis analz_subset_iff 4) | |
| 772 | have 11: "\<And>X3. X3 \<subseteq> analz (synth (analz X3))" | |
| 773 | by (metis analz_subset_iff 10) | |
| 774 | have 12: "\<And>X3. analz (synth (analz X3)) = synth (analz X3) \<or> | |
| 775 | \<not> analz X3 \<subseteq> synth (analz X3)" | |
| 776 | by (metis Un_absorb1 3) | |
| 777 | have 13: "\<And>X3. analz (synth (analz X3)) = synth (analz X3)" | |
| 778 | by (metis 12 synth_increasing) | |
| 779 | have 14: "\<And>X3. X3 \<subseteq> synth (analz X3)" | |
| 780 | by (metis 11 13) | |
| 781 | show "False" | |
| 782 | by (metis 9 14) | |
| 783 | qed | |
| 784 | ||
| 785 | lemma Fake_parts_insert_in_Un: | |
| 786 | "[|Z \<in> parts (insert X H); X: synth (analz H)|] | |
| 787 | ==> Z \<in> synth (analz H) \<union> parts H"; | |
| 788 | by (blast dest: Fake_parts_insert [THEN subsetD, dest]) | |
| 789 | ||
| 32864 
a226f29d4bdc
re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
 boehmes parents: 
32685diff
changeset | 790 | declare [[ atp_problem_prefix = "Message__Fake_analz_insert" ]] | 
| 23449 | 791 | declare analz_mono [intro] synth_mono [intro] | 
| 792 | lemma Fake_analz_insert: | |
| 793 | "X\<in> synth (analz G) ==> | |
| 794 | analz (insert X H) \<subseteq> synth (analz G) \<union> analz (G \<union> H)" | |
| 795 | by (metis Un_commute Un_insert_left Un_insert_right Un_upper1 analz_analz_Un analz_mono analz_synth_Un equalityE insert_absorb order_le_less xt1(12)) | |
| 796 | ||
| 32864 
a226f29d4bdc
re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
 boehmes parents: 
32685diff
changeset | 797 | declare [[ atp_problem_prefix = "Message__Fake_analz_insert_simpler" ]] | 
| 23449 | 798 | (*simpler problems? BUT METIS CAN'T PROVE | 
| 799 | lemma Fake_analz_insert_simpler: | |
| 800 | "X\<in> synth (analz G) ==> | |
| 801 | analz (insert X H) \<subseteq> synth (analz G) \<union> analz (G \<union> H)" | |
| 802 | apply (rule subsetI) | |
| 803 | apply (subgoal_tac "x \<in> analz (synth (analz G) \<union> H) ") | |
| 804 | apply (metis Un_commute analz_analz_Un analz_synth_Un) | |
| 805 | apply (metis Un_commute Un_upper1 Un_upper2 analz_cut analz_increasing analz_mono insert_absorb insert_mono insert_subset) | |
| 806 | done | |
| 807 | *) | |
| 808 | ||
| 809 | end |