| author | wenzelm | 
| Wed, 14 May 2008 20:31:41 +0200 | |
| changeset 26895 | d066f9db833b | 
| parent 26807 | 4cd176ea28dc | 
| child 27105 | 5f139027c365 | 
| 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 | ||
| 13956 | 10 | header{*Theory of Agents and Messages for Security Protocols*}
 | 
| 11 | ||
| 16417 | 12 | theory Message imports Main begin | 
| 11189 | 13 | |
| 14 | (*Needed occasionally with spy_analz_tac, e.g. in analz_insert_Key_newK*) | |
| 13926 | 15 | lemma [simp] : "A \<union> (B \<union> A) = B \<union> A" | 
| 11189 | 16 | by blast | 
| 1839 | 17 | |
| 18 | types | |
| 19 | key = nat | |
| 20 | ||
| 21 | consts | |
| 14126 
28824746d046
Tidying and replacement of some axioms by specifications
 paulson parents: 
13956diff
changeset | 22 |   all_symmetric :: bool        --{*true if all keys are symmetric*}
 | 
| 
28824746d046
Tidying and replacement of some axioms by specifications
 paulson parents: 
13956diff
changeset | 23 |   invKey        :: "key=>key"  --{*inverse of a symmetric key*}
 | 
| 
28824746d046
Tidying and replacement of some axioms by specifications
 paulson parents: 
13956diff
changeset | 24 | |
| 
28824746d046
Tidying and replacement of some axioms by specifications
 paulson parents: 
13956diff
changeset | 25 | specification (invKey) | 
| 14181 | 26 | invKey [simp]: "invKey (invKey K) = K" | 
| 27 | invKey_symmetric: "all_symmetric --> invKey = id" | |
| 14126 
28824746d046
Tidying and replacement of some axioms by specifications
 paulson parents: 
13956diff
changeset | 28 | by (rule exI [of _ id], auto) | 
| 1839 | 29 | |
| 14126 
28824746d046
Tidying and replacement of some axioms by specifications
 paulson parents: 
13956diff
changeset | 30 | |
| 
28824746d046
Tidying and replacement of some axioms by specifications
 paulson parents: 
13956diff
changeset | 31 | text{*The inverse of a symmetric key is itself; that of a public key
 | 
| 
28824746d046
Tidying and replacement of some axioms by specifications
 paulson parents: 
13956diff
changeset | 32 | is the private key and vice versa*} | 
| 1839 | 33 | |
| 34 | constdefs | |
| 11230 
756c5034f08b
misc tidying; changing the predicate isSymKey to the set symKeys
 paulson parents: 
11192diff
changeset | 35 | symKeys :: "key set" | 
| 
756c5034f08b
misc tidying; changing the predicate isSymKey to the set symKeys
 paulson parents: 
11192diff
changeset | 36 |   "symKeys == {K. invKey K = K}"
 | 
| 1839 | 37 | |
| 16818 | 38 | datatype  --{*We allow any number of friendly agents*}
 | 
| 2032 | 39 | agent = Server | Friend nat | Spy | 
| 1839 | 40 | |
| 3668 | 41 | datatype | 
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 42 |      msg = Agent  agent	    --{*Agent names*}
 | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 43 |          | Number nat       --{*Ordinary integers, timestamps, ...*}
 | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 44 |          | Nonce  nat       --{*Unguessable nonces*}
 | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 45 |          | Key    key       --{*Crypto keys*}
 | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 46 | 	 | Hash   msg       --{*Hashing*}
 | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 47 | 	 | MPair  msg msg   --{*Compound messages*}
 | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 48 | 	 | Crypt  key msg   --{*Encryption, public- or shared-key*}
 | 
| 1839 | 49 | |
| 5234 | 50 | |
| 16818 | 51 | text{*Concrete syntax: messages appear as {|A,B,NA|}, etc...*}
 | 
| 5234 | 52 | syntax | 
| 2516 
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
 paulson parents: 
2484diff
changeset | 53 |   "@MTuple"      :: "['a, args] => 'a * 'b"       ("(2{|_,/ _|})")
 | 
| 1839 | 54 | |
| 9686 | 55 | syntax (xsymbols) | 
| 11189 | 56 |   "@MTuple"      :: "['a, args] => 'a * 'b"       ("(2\<lbrace>_,/ _\<rbrace>)")
 | 
| 9686 | 57 | |
| 1839 | 58 | translations | 
| 59 |   "{|x, y, z|}"   == "{|x, {|y, z|}|}"
 | |
| 60 |   "{|x, y|}"      == "MPair x y"
 | |
| 61 | ||
| 62 | ||
| 2484 | 63 | constdefs | 
| 11189 | 64 |   HPair :: "[msg,msg] => msg"                       ("(4Hash[_] /_)" [0, 1000])
 | 
| 16818 | 65 |     --{*Message Y paired with a MAC computed with the help of X*}
 | 
| 2516 
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
 paulson parents: 
2484diff
changeset | 66 |     "Hash[X] Y == {| Hash{|X,Y|}, Y|}"
 | 
| 2484 | 67 | |
| 11189 | 68 | keysFor :: "msg set => key set" | 
| 16818 | 69 |     --{*Keys useful to decrypt elements of a message set*}
 | 
| 11192 | 70 |   "keysFor H == invKey ` {K. \<exists>X. Crypt K X \<in> H}"
 | 
| 1839 | 71 | |
| 16818 | 72 | |
| 73 | subsubsection{*Inductive Definition of All Parts" of a Message*}
 | |
| 1839 | 74 | |
| 23746 | 75 | inductive_set | 
| 76 | parts :: "msg set => msg set" | |
| 77 | for H :: "msg set" | |
| 78 | where | |
| 11192 | 79 | Inj [intro]: "X \<in> H ==> X \<in> parts H" | 
| 23746 | 80 |   | Fst:         "{|X,Y|}   \<in> parts H ==> X \<in> parts H"
 | 
| 81 |   | Snd:         "{|X,Y|}   \<in> parts H ==> Y \<in> parts H"
 | |
| 82 | | Body: "Crypt K X \<in> parts H ==> X \<in> parts H" | |
| 11189 | 83 | |
| 84 | ||
| 16818 | 85 | text{*Monotonicity*}
 | 
| 86 | lemma parts_mono: "G \<subseteq> H ==> parts(G) \<subseteq> parts(H)" | |
| 11189 | 87 | apply auto | 
| 88 | apply (erule parts.induct) | |
| 16818 | 89 | apply (blast dest: parts.Fst parts.Snd parts.Body)+ | 
| 11189 | 90 | done | 
| 1839 | 91 | |
| 92 | ||
| 16818 | 93 | text{*Equations hold because constructors are injective.*}
 | 
| 13926 | 94 | lemma Friend_image_eq [simp]: "(Friend x \<in> Friend`A) = (x:A)" | 
| 95 | by auto | |
| 96 | ||
| 97 | lemma Key_image_eq [simp]: "(Key x \<in> Key`A) = (x\<in>A)" | |
| 98 | by auto | |
| 99 | ||
| 100 | lemma Nonce_Key_image_eq [simp]: "(Nonce x \<notin> Key`A)" | |
| 101 | by auto | |
| 102 | ||
| 103 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 104 | subsubsection{*Inverse of keys *}
 | 
| 13926 | 105 | |
| 106 | lemma invKey_eq [simp]: "(invKey K = invKey K') = (K=K')" | |
| 107 | apply safe | |
| 108 | apply (drule_tac f = invKey in arg_cong, simp) | |
| 109 | done | |
| 110 | ||
| 111 | ||
| 112 | subsection{*keysFor operator*}
 | |
| 113 | ||
| 114 | lemma keysFor_empty [simp]: "keysFor {} = {}"
 | |
| 115 | by (unfold keysFor_def, blast) | |
| 116 | ||
| 117 | lemma keysFor_Un [simp]: "keysFor (H \<union> H') = keysFor H \<union> keysFor H'" | |
| 118 | by (unfold keysFor_def, blast) | |
| 119 | ||
| 120 | lemma keysFor_UN [simp]: "keysFor (\<Union>i\<in>A. H i) = (\<Union>i\<in>A. keysFor (H i))" | |
| 121 | by (unfold keysFor_def, blast) | |
| 122 | ||
| 16818 | 123 | text{*Monotonicity*}
 | 
| 124 | lemma keysFor_mono: "G \<subseteq> H ==> keysFor(G) \<subseteq> keysFor(H)" | |
| 13926 | 125 | by (unfold keysFor_def, blast) | 
| 126 | ||
| 127 | lemma keysFor_insert_Agent [simp]: "keysFor (insert (Agent A) H) = keysFor H" | |
| 128 | by (unfold keysFor_def, auto) | |
| 129 | ||
| 130 | lemma keysFor_insert_Nonce [simp]: "keysFor (insert (Nonce N) H) = keysFor H" | |
| 131 | by (unfold keysFor_def, auto) | |
| 132 | ||
| 133 | lemma keysFor_insert_Number [simp]: "keysFor (insert (Number N) H) = keysFor H" | |
| 134 | by (unfold keysFor_def, auto) | |
| 135 | ||
| 136 | lemma keysFor_insert_Key [simp]: "keysFor (insert (Key K) H) = keysFor H" | |
| 137 | by (unfold keysFor_def, auto) | |
| 138 | ||
| 139 | lemma keysFor_insert_Hash [simp]: "keysFor (insert (Hash X) H) = keysFor H" | |
| 140 | by (unfold keysFor_def, auto) | |
| 141 | ||
| 142 | lemma keysFor_insert_MPair [simp]: "keysFor (insert {|X,Y|} H) = keysFor H"
 | |
| 143 | by (unfold keysFor_def, auto) | |
| 144 | ||
| 145 | lemma keysFor_insert_Crypt [simp]: | |
| 146 | "keysFor (insert (Crypt K X) H) = insert (invKey K) (keysFor H)" | |
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 147 | by (unfold keysFor_def, auto) | 
| 13926 | 148 | |
| 149 | lemma keysFor_image_Key [simp]: "keysFor (Key`E) = {}"
 | |
| 150 | by (unfold keysFor_def, auto) | |
| 151 | ||
| 152 | lemma Crypt_imp_invKey_keysFor: "Crypt K X \<in> H ==> invKey K \<in> keysFor H" | |
| 153 | by (unfold keysFor_def, blast) | |
| 154 | ||
| 155 | ||
| 156 | subsection{*Inductive relation "parts"*}
 | |
| 157 | ||
| 158 | lemma MPair_parts: | |
| 159 |      "[| {|X,Y|} \<in> parts H;        
 | |
| 160 | [| X \<in> parts H; Y \<in> parts H |] ==> P |] ==> P" | |
| 161 | by (blast dest: parts.Fst parts.Snd) | |
| 162 | ||
| 163 | declare MPair_parts [elim!] parts.Body [dest!] | |
| 164 | text{*NB These two rules are UNSAFE in the formal sense, as they discard the
 | |
| 165 | compound message. They work well on THIS FILE. | |
| 166 |   @{text MPair_parts} is left as SAFE because it speeds up proofs.
 | |
| 167 | The Crypt rule is normally kept UNSAFE to avoid breaking up certificates.*} | |
| 168 | ||
| 169 | lemma parts_increasing: "H \<subseteq> parts(H)" | |
| 170 | by blast | |
| 171 | ||
| 172 | lemmas parts_insertI = subset_insertI [THEN parts_mono, THEN subsetD, standard] | |
| 173 | ||
| 174 | lemma parts_empty [simp]: "parts{} = {}"
 | |
| 175 | apply safe | |
| 176 | apply (erule parts.induct, blast+) | |
| 177 | done | |
| 178 | ||
| 179 | lemma parts_emptyE [elim!]: "X\<in> parts{} ==> P"
 | |
| 180 | by simp | |
| 181 | ||
| 16818 | 182 | text{*WARNING: loops if H = {Y}, therefore must not be repeated!*}
 | 
| 13926 | 183 | lemma parts_singleton: "X\<in> parts H ==> \<exists>Y\<in>H. X\<in> parts {Y}"
 | 
| 26807 
4cd176ea28dc
Replaced blast by fast in proof of parts_singleton, since blast looped
 berghofe parents: 
26342diff
changeset | 184 | by (erule parts.induct, fast+) | 
| 13926 | 185 | |
| 186 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 187 | subsubsection{*Unions *}
 | 
| 13926 | 188 | |
| 189 | lemma parts_Un_subset1: "parts(G) \<union> parts(H) \<subseteq> parts(G \<union> H)" | |
| 190 | by (intro Un_least parts_mono Un_upper1 Un_upper2) | |
| 191 | ||
| 192 | lemma parts_Un_subset2: "parts(G \<union> H) \<subseteq> parts(G) \<union> parts(H)" | |
| 193 | apply (rule subsetI) | |
| 194 | apply (erule parts.induct, blast+) | |
| 195 | done | |
| 196 | ||
| 197 | lemma parts_Un [simp]: "parts(G \<union> H) = parts(G) \<union> parts(H)" | |
| 198 | by (intro equalityI parts_Un_subset1 parts_Un_subset2) | |
| 199 | ||
| 200 | lemma parts_insert: "parts (insert X H) = parts {X} \<union> parts H"
 | |
| 201 | apply (subst insert_is_Un [of _ H]) | |
| 202 | apply (simp only: parts_Un) | |
| 203 | done | |
| 204 | ||
| 16818 | 205 | text{*TWO inserts to avoid looping.  This rewrite is better than nothing.
 | 
| 206 | Not suitable for Addsimps: its behaviour can be strange.*} | |
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 207 | lemma parts_insert2: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 208 |      "parts (insert X (insert Y H)) = parts {X} \<union> parts {Y} \<union> parts H"
 | 
| 13926 | 209 | apply (simp add: Un_assoc) | 
| 210 | apply (simp add: parts_insert [symmetric]) | |
| 211 | done | |
| 212 | ||
| 213 | lemma parts_UN_subset1: "(\<Union>x\<in>A. parts(H x)) \<subseteq> parts(\<Union>x\<in>A. H x)" | |
| 214 | by (intro UN_least parts_mono UN_upper) | |
| 215 | ||
| 216 | lemma parts_UN_subset2: "parts(\<Union>x\<in>A. H x) \<subseteq> (\<Union>x\<in>A. parts(H x))" | |
| 217 | apply (rule subsetI) | |
| 218 | apply (erule parts.induct, blast+) | |
| 219 | done | |
| 220 | ||
| 221 | lemma parts_UN [simp]: "parts(\<Union>x\<in>A. H x) = (\<Union>x\<in>A. parts(H x))" | |
| 222 | by (intro equalityI parts_UN_subset1 parts_UN_subset2) | |
| 223 | ||
| 16818 | 224 | text{*Added to simplify arguments to parts, analz and synth.
 | 
| 225 | NOTE: the UN versions are no longer used!*} | |
| 13926 | 226 | |
| 227 | ||
| 228 | text{*This allows @{text blast} to simplify occurrences of 
 | |
| 229 |   @{term "parts(G\<union>H)"} in the assumption.*}
 | |
| 17729 | 230 | lemmas in_parts_UnE = parts_Un [THEN equalityD1, THEN subsetD, THEN UnE] | 
| 231 | declare in_parts_UnE [elim!] | |
| 13926 | 232 | |
| 233 | ||
| 234 | lemma parts_insert_subset: "insert X (parts H) \<subseteq> parts(insert X H)" | |
| 235 | by (blast intro: parts_mono [THEN [2] rev_subsetD]) | |
| 236 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 237 | subsubsection{*Idempotence and transitivity *}
 | 
| 13926 | 238 | |
| 239 | lemma parts_partsD [dest!]: "X\<in> parts (parts H) ==> X\<in> parts H" | |
| 240 | by (erule parts.induct, blast+) | |
| 241 | ||
| 242 | lemma parts_idem [simp]: "parts (parts H) = parts H" | |
| 243 | by blast | |
| 244 | ||
| 17689 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 245 | lemma parts_subset_iff [simp]: "(parts G \<subseteq> parts H) = (G \<subseteq> parts H)" | 
| 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 246 | apply (rule iffI) | 
| 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 247 | apply (iprover intro: subset_trans parts_increasing) | 
| 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 248 | apply (frule parts_mono, simp) | 
| 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 249 | done | 
| 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 250 | |
| 13926 | 251 | lemma parts_trans: "[| X\<in> parts G; G \<subseteq> parts H |] ==> X\<in> parts H" | 
| 252 | by (drule parts_mono, blast) | |
| 253 | ||
| 16818 | 254 | text{*Cut*}
 | 
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 255 | lemma parts_cut: | 
| 18492 | 256 | "[| Y\<in> parts (insert X G); X\<in> parts H |] ==> Y\<in> parts (G \<union> H)" | 
| 257 | by (blast intro: parts_trans) | |
| 258 | ||
| 13926 | 259 | |
| 260 | lemma parts_cut_eq [simp]: "X\<in> parts H ==> parts (insert X H) = parts H" | |
| 261 | by (force dest!: parts_cut intro: parts_insertI) | |
| 262 | ||
| 263 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 264 | subsubsection{*Rewrite rules for pulling out atomic messages *}
 | 
| 13926 | 265 | |
| 266 | lemmas parts_insert_eq_I = equalityI [OF subsetI parts_insert_subset] | |
| 267 | ||
| 268 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 269 | lemma parts_insert_Agent [simp]: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 270 | "parts (insert (Agent agt) H) = insert (Agent agt) (parts H)" | 
| 13926 | 271 | apply (rule parts_insert_eq_I) | 
| 272 | apply (erule parts.induct, auto) | |
| 273 | done | |
| 274 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 275 | lemma parts_insert_Nonce [simp]: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 276 | "parts (insert (Nonce N) H) = insert (Nonce N) (parts H)" | 
| 13926 | 277 | apply (rule parts_insert_eq_I) | 
| 278 | apply (erule parts.induct, auto) | |
| 279 | done | |
| 280 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 281 | lemma parts_insert_Number [simp]: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 282 | "parts (insert (Number N) H) = insert (Number N) (parts H)" | 
| 13926 | 283 | apply (rule parts_insert_eq_I) | 
| 284 | apply (erule parts.induct, auto) | |
| 285 | done | |
| 286 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 287 | lemma parts_insert_Key [simp]: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 288 | "parts (insert (Key K) H) = insert (Key K) (parts H)" | 
| 13926 | 289 | apply (rule parts_insert_eq_I) | 
| 290 | apply (erule parts.induct, auto) | |
| 291 | done | |
| 292 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 293 | lemma parts_insert_Hash [simp]: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 294 | "parts (insert (Hash X) H) = insert (Hash X) (parts H)" | 
| 13926 | 295 | apply (rule parts_insert_eq_I) | 
| 296 | apply (erule parts.induct, auto) | |
| 297 | done | |
| 298 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 299 | lemma parts_insert_Crypt [simp]: | 
| 17689 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 300 | "parts (insert (Crypt K X) H) = insert (Crypt K X) (parts (insert X H))" | 
| 13926 | 301 | apply (rule equalityI) | 
| 302 | apply (rule subsetI) | |
| 303 | apply (erule parts.induct, auto) | |
| 17689 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 304 | apply (blast intro: parts.Body) | 
| 13926 | 305 | done | 
| 306 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 307 | lemma parts_insert_MPair [simp]: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 308 |      "parts (insert {|X,Y|} H) =  
 | 
| 13926 | 309 |           insert {|X,Y|} (parts (insert X (insert Y H)))"
 | 
| 310 | apply (rule equalityI) | |
| 311 | apply (rule subsetI) | |
| 312 | apply (erule parts.induct, auto) | |
| 313 | apply (blast intro: parts.Fst parts.Snd)+ | |
| 314 | done | |
| 315 | ||
| 316 | lemma parts_image_Key [simp]: "parts (Key`N) = Key`N" | |
| 317 | apply auto | |
| 318 | apply (erule parts.induct, auto) | |
| 319 | done | |
| 320 | ||
| 321 | ||
| 16818 | 322 | text{*In any message, there is an upper bound N on its greatest nonce.*}
 | 
| 13926 | 323 | lemma msg_Nonce_supply: "\<exists>N. \<forall>n. N\<le>n --> Nonce n \<notin> parts {msg}"
 | 
| 324 | apply (induct_tac "msg") | |
| 325 | apply (simp_all (no_asm_simp) add: exI parts_insert2) | |
| 16818 | 326 |  txt{*MPair case: blast works out the necessary sum itself!*}
 | 
| 22424 | 327 | prefer 2 apply auto apply (blast elim!: add_leE) | 
| 16818 | 328 | txt{*Nonce case*}
 | 
| 329 | apply (rule_tac x = "N + Suc nat" in exI, auto) | |
| 13926 | 330 | done | 
| 331 | ||
| 332 | ||
| 333 | subsection{*Inductive relation "analz"*}
 | |
| 334 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 335 | text{*Inductive definition of "analz" -- what can be broken down from a set of
 | 
| 1839 | 336 | messages, including keys. A form of downward closure. Pairs can | 
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 337 | be taken apart; messages decrypted with known keys. *} | 
| 1839 | 338 | |
| 23746 | 339 | inductive_set | 
| 340 | analz :: "msg set => msg set" | |
| 341 | for H :: "msg set" | |
| 342 | where | |
| 11192 | 343 | Inj [intro,simp] : "X \<in> H ==> X \<in> analz H" | 
| 23746 | 344 |   | Fst:     "{|X,Y|} \<in> analz H ==> X \<in> analz H"
 | 
| 345 |   | Snd:     "{|X,Y|} \<in> analz H ==> Y \<in> analz H"
 | |
| 346 | | Decrypt [dest]: | |
| 11192 | 347 | "[|Crypt K X \<in> analz H; Key(invKey K): analz H|] ==> X \<in> analz H" | 
| 1839 | 348 | |
| 349 | ||
| 16818 | 350 | text{*Monotonicity; Lemma 1 of Lowe's paper*}
 | 
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 351 | lemma analz_mono: "G\<subseteq>H ==> analz(G) \<subseteq> analz(H)" | 
| 11189 | 352 | apply auto | 
| 353 | apply (erule analz.induct) | |
| 16818 | 354 | apply (auto dest: analz.Fst analz.Snd) | 
| 11189 | 355 | done | 
| 356 | ||
| 13926 | 357 | text{*Making it safe speeds up proofs*}
 | 
| 358 | lemma MPair_analz [elim!]: | |
| 359 |      "[| {|X,Y|} \<in> analz H;        
 | |
| 360 | [| X \<in> analz H; Y \<in> analz H |] ==> P | |
| 361 | |] ==> P" | |
| 362 | by (blast dest: analz.Fst analz.Snd) | |
| 363 | ||
| 364 | lemma analz_increasing: "H \<subseteq> analz(H)" | |
| 365 | by blast | |
| 366 | ||
| 367 | lemma analz_subset_parts: "analz H \<subseteq> parts H" | |
| 368 | apply (rule subsetI) | |
| 369 | apply (erule analz.induct, blast+) | |
| 370 | done | |
| 371 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 372 | lemmas analz_into_parts = analz_subset_parts [THEN subsetD, standard] | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 373 | |
| 13926 | 374 | lemmas not_parts_not_analz = analz_subset_parts [THEN contra_subsetD, standard] | 
| 375 | ||
| 376 | ||
| 377 | lemma parts_analz [simp]: "parts (analz H) = parts H" | |
| 378 | apply (rule equalityI) | |
| 379 | apply (rule analz_subset_parts [THEN parts_mono, THEN subset_trans], simp) | |
| 380 | apply (blast intro: analz_increasing [THEN parts_mono, THEN subsetD]) | |
| 381 | done | |
| 382 | ||
| 383 | lemma analz_parts [simp]: "analz (parts H) = parts H" | |
| 384 | apply auto | |
| 385 | apply (erule analz.induct, auto) | |
| 386 | done | |
| 387 | ||
| 388 | lemmas analz_insertI = subset_insertI [THEN analz_mono, THEN [2] rev_subsetD, standard] | |
| 389 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 390 | subsubsection{*General equational properties *}
 | 
| 13926 | 391 | |
| 392 | lemma analz_empty [simp]: "analz{} = {}"
 | |
| 393 | apply safe | |
| 394 | apply (erule analz.induct, blast+) | |
| 395 | done | |
| 396 | ||
| 16818 | 397 | text{*Converse fails: we can analz more from the union than from the 
 | 
| 398 | separate parts, as a key in one might decrypt a message in the other*} | |
| 13926 | 399 | lemma analz_Un: "analz(G) \<union> analz(H) \<subseteq> analz(G \<union> H)" | 
| 400 | by (intro Un_least analz_mono Un_upper1 Un_upper2) | |
| 401 | ||
| 402 | lemma analz_insert: "insert X (analz H) \<subseteq> analz(insert X H)" | |
| 403 | by (blast intro: analz_mono [THEN [2] rev_subsetD]) | |
| 404 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 405 | subsubsection{*Rewrite rules for pulling out atomic messages *}
 | 
| 13926 | 406 | |
| 407 | lemmas analz_insert_eq_I = equalityI [OF subsetI analz_insert] | |
| 408 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 409 | lemma analz_insert_Agent [simp]: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 410 | "analz (insert (Agent agt) H) = insert (Agent agt) (analz H)" | 
| 13926 | 411 | apply (rule analz_insert_eq_I) | 
| 412 | apply (erule analz.induct, auto) | |
| 413 | done | |
| 414 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 415 | lemma analz_insert_Nonce [simp]: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 416 | "analz (insert (Nonce N) H) = insert (Nonce N) (analz H)" | 
| 13926 | 417 | apply (rule analz_insert_eq_I) | 
| 418 | apply (erule analz.induct, auto) | |
| 419 | done | |
| 420 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 421 | lemma analz_insert_Number [simp]: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 422 | "analz (insert (Number N) H) = insert (Number N) (analz H)" | 
| 13926 | 423 | apply (rule analz_insert_eq_I) | 
| 424 | apply (erule analz.induct, auto) | |
| 425 | done | |
| 426 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 427 | lemma analz_insert_Hash [simp]: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 428 | "analz (insert (Hash X) H) = insert (Hash X) (analz H)" | 
| 13926 | 429 | apply (rule analz_insert_eq_I) | 
| 430 | apply (erule analz.induct, auto) | |
| 431 | done | |
| 432 | ||
| 16818 | 433 | text{*Can only pull out Keys if they are not needed to decrypt the rest*}
 | 
| 13926 | 434 | lemma analz_insert_Key [simp]: | 
| 435 | "K \<notin> keysFor (analz H) ==> | |
| 436 | analz (insert (Key K) H) = insert (Key K) (analz H)" | |
| 437 | apply (unfold keysFor_def) | |
| 438 | apply (rule analz_insert_eq_I) | |
| 439 | apply (erule analz.induct, auto) | |
| 440 | done | |
| 441 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 442 | lemma analz_insert_MPair [simp]: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 443 |      "analz (insert {|X,Y|} H) =  
 | 
| 13926 | 444 |           insert {|X,Y|} (analz (insert X (insert Y H)))"
 | 
| 445 | apply (rule equalityI) | |
| 446 | apply (rule subsetI) | |
| 447 | apply (erule analz.induct, auto) | |
| 448 | apply (erule analz.induct) | |
| 449 | apply (blast intro: analz.Fst analz.Snd)+ | |
| 450 | done | |
| 451 | ||
| 16818 | 452 | text{*Can pull out enCrypted message if the Key is not known*}
 | 
| 13926 | 453 | lemma analz_insert_Crypt: | 
| 454 | "Key (invKey K) \<notin> analz H | |
| 455 | ==> analz (insert (Crypt K X) H) = insert (Crypt K X) (analz H)" | |
| 456 | apply (rule analz_insert_eq_I) | |
| 457 | apply (erule analz.induct, auto) | |
| 458 | ||
| 459 | done | |
| 460 | ||
| 461 | lemma lemma1: "Key (invKey K) \<in> analz H ==> | |
| 462 | analz (insert (Crypt K X) H) \<subseteq> | |
| 463 | insert (Crypt K X) (analz (insert X H))" | |
| 464 | apply (rule subsetI) | |
| 23746 | 465 | apply (erule_tac x = x in analz.induct, auto) | 
| 13926 | 466 | done | 
| 467 | ||
| 468 | lemma lemma2: "Key (invKey K) \<in> analz H ==> | |
| 469 | insert (Crypt K X) (analz (insert X H)) \<subseteq> | |
| 470 | analz (insert (Crypt K X) H)" | |
| 471 | apply auto | |
| 23746 | 472 | apply (erule_tac x = x in analz.induct, auto) | 
| 13926 | 473 | apply (blast intro: analz_insertI analz.Decrypt) | 
| 474 | done | |
| 475 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 476 | lemma analz_insert_Decrypt: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 477 | "Key (invKey K) \<in> analz H ==> | 
| 13926 | 478 | analz (insert (Crypt K X) H) = | 
| 479 | insert (Crypt K X) (analz (insert X H))" | |
| 480 | by (intro equalityI lemma1 lemma2) | |
| 481 | ||
| 16818 | 482 | text{*Case analysis: either the message is secure, or it is not! Effective,
 | 
| 483 | but can cause subgoals to blow up! Use with @{text "split_if"}; apparently
 | |
| 484 | @{text "split_tac"} does not cope with patterns such as @{term"analz (insert
 | |
| 485 | (Crypt K X) H)"} *} | |
| 13926 | 486 | lemma analz_Crypt_if [simp]: | 
| 487 | "analz (insert (Crypt K X) H) = | |
| 488 | (if (Key (invKey K) \<in> analz H) | |
| 489 | then insert (Crypt K X) (analz (insert X H)) | |
| 490 | else insert (Crypt K X) (analz H))" | |
| 491 | by (simp add: analz_insert_Crypt analz_insert_Decrypt) | |
| 492 | ||
| 493 | ||
| 16818 | 494 | text{*This rule supposes "for the sake of argument" that we have the key.*}
 | 
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 495 | lemma analz_insert_Crypt_subset: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 496 | "analz (insert (Crypt K X) H) \<subseteq> | 
| 13926 | 497 | insert (Crypt K X) (analz (insert X H))" | 
| 498 | apply (rule subsetI) | |
| 499 | apply (erule analz.induct, auto) | |
| 500 | done | |
| 501 | ||
| 502 | ||
| 503 | lemma analz_image_Key [simp]: "analz (Key`N) = Key`N" | |
| 504 | apply auto | |
| 505 | apply (erule analz.induct, auto) | |
| 506 | done | |
| 507 | ||
| 508 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 509 | subsubsection{*Idempotence and transitivity *}
 | 
| 13926 | 510 | |
| 511 | lemma analz_analzD [dest!]: "X\<in> analz (analz H) ==> X\<in> analz H" | |
| 512 | by (erule analz.induct, blast+) | |
| 513 | ||
| 514 | lemma analz_idem [simp]: "analz (analz H) = analz H" | |
| 515 | by blast | |
| 516 | ||
| 17689 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 517 | lemma analz_subset_iff [simp]: "(analz G \<subseteq> analz H) = (G \<subseteq> analz H)" | 
| 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 518 | apply (rule iffI) | 
| 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 519 | apply (iprover intro: subset_trans analz_increasing) | 
| 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 520 | apply (frule analz_mono, simp) | 
| 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 521 | done | 
| 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 522 | |
| 13926 | 523 | lemma analz_trans: "[| X\<in> analz G; G \<subseteq> analz H |] ==> X\<in> analz H" | 
| 524 | by (drule analz_mono, blast) | |
| 525 | ||
| 16818 | 526 | text{*Cut; Lemma 2 of Lowe*}
 | 
| 13926 | 527 | lemma analz_cut: "[| Y\<in> analz (insert X H); X\<in> analz H |] ==> Y\<in> analz H" | 
| 528 | by (erule analz_trans, blast) | |
| 529 | ||
| 530 | (*Cut can be proved easily by induction on | |
| 531 | "Y: analz (insert X H) ==> X: analz H --> Y: analz H" | |
| 532 | *) | |
| 533 | ||
| 16818 | 534 | text{*This rewrite rule helps in the simplification of messages that involve
 | 
| 13926 | 535 | the forwarding of unknown components (X). Without it, removing occurrences | 
| 16818 | 536 | of X can be very complicated. *} | 
| 13926 | 537 | lemma analz_insert_eq: "X\<in> analz H ==> analz (insert X H) = analz H" | 
| 538 | by (blast intro: analz_cut analz_insertI) | |
| 539 | ||
| 540 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 541 | text{*A congruence rule for "analz" *}
 | 
| 13926 | 542 | |
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 543 | lemma analz_subset_cong: | 
| 17689 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 544 | "[| analz G \<subseteq> analz G'; analz H \<subseteq> analz H' |] | 
| 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 545 | ==> analz (G \<union> H) \<subseteq> analz (G' \<union> H')" | 
| 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 546 | apply simp | 
| 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 547 | apply (iprover intro: conjI subset_trans analz_mono Un_upper1 Un_upper2) | 
| 13926 | 548 | done | 
| 549 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 550 | lemma analz_cong: | 
| 17689 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 551 | "[| analz G = analz G'; analz H = analz H' |] | 
| 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 552 | ==> analz (G \<union> H) = analz (G' \<union> H')" | 
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 553 | by (intro equalityI analz_subset_cong, simp_all) | 
| 13926 | 554 | |
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 555 | lemma analz_insert_cong: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 556 | "analz H = analz H' ==> analz(insert X H) = analz(insert X H')" | 
| 13926 | 557 | by (force simp only: insert_def intro!: analz_cong) | 
| 558 | ||
| 16818 | 559 | text{*If there are no pairs or encryptions then analz does nothing*}
 | 
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 560 | lemma analz_trivial: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 561 |      "[| \<forall>X Y. {|X,Y|} \<notin> H;  \<forall>X K. Crypt K X \<notin> H |] ==> analz H = H"
 | 
| 13926 | 562 | apply safe | 
| 563 | apply (erule analz.induct, blast+) | |
| 564 | done | |
| 565 | ||
| 16818 | 566 | text{*These two are obsolete (with a single Spy) but cost little to prove...*}
 | 
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 567 | lemma analz_UN_analz_lemma: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 568 | "X\<in> analz (\<Union>i\<in>A. analz (H i)) ==> X\<in> analz (\<Union>i\<in>A. H i)" | 
| 13926 | 569 | apply (erule analz.induct) | 
| 570 | apply (blast intro: analz_mono [THEN [2] rev_subsetD])+ | |
| 571 | done | |
| 572 | ||
| 573 | lemma analz_UN_analz [simp]: "analz (\<Union>i\<in>A. analz (H i)) = analz (\<Union>i\<in>A. H i)" | |
| 574 | by (blast intro: analz_UN_analz_lemma analz_mono [THEN [2] rev_subsetD]) | |
| 575 | ||
| 576 | ||
| 577 | subsection{*Inductive relation "synth"*}
 | |
| 578 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 579 | text{*Inductive definition of "synth" -- what can be built up from a set of
 | 
| 1839 | 580 | messages. A form of upward closure. Pairs can be built, messages | 
| 3668 | 581 | encrypted with known keys. Agent names are public domain. | 
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 582 | Numbers can be guessed, but Nonces cannot be. *} | 
| 1839 | 583 | |
| 23746 | 584 | inductive_set | 
| 585 | synth :: "msg set => msg set" | |
| 586 | for H :: "msg set" | |
| 587 | where | |
| 11192 | 588 | Inj [intro]: "X \<in> H ==> X \<in> synth H" | 
| 23746 | 589 | | Agent [intro]: "Agent agt \<in> synth H" | 
| 590 | | Number [intro]: "Number n \<in> synth H" | |
| 591 | | Hash [intro]: "X \<in> synth H ==> Hash X \<in> synth H" | |
| 592 |   | MPair  [intro]:   "[|X \<in> synth H;  Y \<in> synth H|] ==> {|X,Y|} \<in> synth H"
 | |
| 593 | | Crypt [intro]: "[|X \<in> synth H; Key(K) \<in> H|] ==> Crypt K X \<in> synth H" | |
| 11189 | 594 | |
| 16818 | 595 | text{*Monotonicity*}
 | 
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 596 | lemma synth_mono: "G\<subseteq>H ==> synth(G) \<subseteq> synth(H)" | 
| 16818 | 597 | by (auto, erule synth.induct, auto) | 
| 11189 | 598 | |
| 16818 | 599 | text{*NO @{text Agent_synth}, as any Agent name can be synthesized.  
 | 
| 600 |   The same holds for @{term Number}*}
 | |
| 11192 | 601 | inductive_cases Nonce_synth [elim!]: "Nonce n \<in> synth H" | 
| 602 | inductive_cases Key_synth [elim!]: "Key K \<in> synth H" | |
| 603 | inductive_cases Hash_synth [elim!]: "Hash X \<in> synth H" | |
| 604 | inductive_cases MPair_synth [elim!]: "{|X,Y|} \<in> synth H"
 | |
| 605 | inductive_cases Crypt_synth [elim!]: "Crypt K X \<in> synth H" | |
| 11189 | 606 | |
| 13926 | 607 | |
| 608 | lemma synth_increasing: "H \<subseteq> synth(H)" | |
| 609 | by blast | |
| 610 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 611 | subsubsection{*Unions *}
 | 
| 13926 | 612 | |
| 16818 | 613 | text{*Converse fails: we can synth more from the union than from the 
 | 
| 614 | separate parts, building a compound message using elements of each.*} | |
| 13926 | 615 | lemma synth_Un: "synth(G) \<union> synth(H) \<subseteq> synth(G \<union> H)" | 
| 616 | by (intro Un_least synth_mono Un_upper1 Un_upper2) | |
| 617 | ||
| 618 | lemma synth_insert: "insert X (synth H) \<subseteq> synth(insert X H)" | |
| 619 | by (blast intro: synth_mono [THEN [2] rev_subsetD]) | |
| 620 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 621 | subsubsection{*Idempotence and transitivity *}
 | 
| 13926 | 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 | ||
| 17689 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 629 | lemma synth_subset_iff [simp]: "(synth G \<subseteq> synth H) = (G \<subseteq> synth H)" | 
| 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 630 | apply (rule iffI) | 
| 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 631 | apply (iprover intro: subset_trans synth_increasing) | 
| 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 632 | apply (frule synth_mono, simp add: synth_idem) | 
| 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 633 | done | 
| 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 634 | |
| 13926 | 635 | lemma synth_trans: "[| X\<in> synth G; G \<subseteq> synth H |] ==> X\<in> synth H" | 
| 636 | by (drule synth_mono, blast) | |
| 637 | ||
| 16818 | 638 | text{*Cut; Lemma 2 of Lowe*}
 | 
| 13926 | 639 | lemma synth_cut: "[| Y\<in> synth (insert X H); X\<in> synth H |] ==> Y\<in> synth H" | 
| 640 | by (erule synth_trans, blast) | |
| 641 | ||
| 642 | lemma Agent_synth [simp]: "Agent A \<in> synth H" | |
| 643 | by blast | |
| 644 | ||
| 645 | lemma Number_synth [simp]: "Number n \<in> synth H" | |
| 646 | by blast | |
| 647 | ||
| 648 | lemma Nonce_synth_eq [simp]: "(Nonce N \<in> synth H) = (Nonce N \<in> H)" | |
| 649 | by blast | |
| 650 | ||
| 651 | lemma Key_synth_eq [simp]: "(Key K \<in> synth H) = (Key K \<in> H)" | |
| 652 | by blast | |
| 653 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 654 | lemma Crypt_synth_eq [simp]: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 655 | "Key K \<notin> H ==> (Crypt K X \<in> synth H) = (Crypt K X \<in> H)" | 
| 13926 | 656 | by blast | 
| 657 | ||
| 658 | ||
| 659 | lemma keysFor_synth [simp]: | |
| 660 |     "keysFor (synth H) = keysFor H \<union> invKey`{K. Key K \<in> H}"
 | |
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 661 | by (unfold keysFor_def, blast) | 
| 13926 | 662 | |
| 663 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 664 | subsubsection{*Combinations of parts, analz and synth *}
 | 
| 13926 | 665 | |
| 666 | lemma parts_synth [simp]: "parts (synth H) = parts H \<union> synth H" | |
| 667 | apply (rule equalityI) | |
| 668 | apply (rule subsetI) | |
| 669 | apply (erule parts.induct) | |
| 670 | apply (blast intro: synth_increasing [THEN parts_mono, THEN subsetD] | |
| 671 | parts.Fst parts.Snd parts.Body)+ | |
| 672 | done | |
| 673 | ||
| 674 | lemma analz_analz_Un [simp]: "analz (analz G \<union> H) = analz (G \<union> H)" | |
| 675 | apply (intro equalityI analz_subset_cong)+ | |
| 676 | apply simp_all | |
| 677 | done | |
| 678 | ||
| 679 | lemma analz_synth_Un [simp]: "analz (synth G \<union> H) = analz (G \<union> H) \<union> synth G" | |
| 680 | apply (rule equalityI) | |
| 681 | apply (rule subsetI) | |
| 682 | apply (erule analz.induct) | |
| 683 | prefer 5 apply (blast intro: analz_mono [THEN [2] rev_subsetD]) | |
| 684 | apply (blast intro: analz.Fst analz.Snd analz.Decrypt)+ | |
| 685 | done | |
| 686 | ||
| 687 | lemma analz_synth [simp]: "analz (synth H) = analz H \<union> synth H" | |
| 688 | apply (cut_tac H = "{}" in analz_synth_Un)
 | |
| 689 | apply (simp (no_asm_use)) | |
| 690 | done | |
| 691 | ||
| 692 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 693 | subsubsection{*For reasoning about the Fake rule in traces *}
 | 
| 13926 | 694 | |
| 695 | lemma parts_insert_subset_Un: "X\<in> G ==> parts(insert X H) \<subseteq> parts G \<union> parts H" | |
| 696 | by (rule subset_trans [OF parts_mono parts_Un_subset2], blast) | |
| 697 | ||
| 16818 | 698 | text{*More specifically for Fake.  Very occasionally we could do with a version
 | 
| 699 |   of the form  @{term"parts{X} \<subseteq> synth (analz H) \<union> parts H"} *}
 | |
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 700 | lemma Fake_parts_insert: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 701 | "X \<in> synth (analz H) ==> | 
| 13926 | 702 | parts (insert X H) \<subseteq> synth (analz H) \<union> parts H" | 
| 703 | apply (drule parts_insert_subset_Un) | |
| 704 | apply (simp (no_asm_use)) | |
| 705 | apply blast | |
| 706 | done | |
| 707 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 708 | lemma Fake_parts_insert_in_Un: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 709 | "[|Z \<in> parts (insert X H); X: synth (analz H)|] | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 710 | ==> Z \<in> synth (analz H) \<union> parts H"; | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 711 | by (blast dest: Fake_parts_insert [THEN subsetD, dest]) | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 712 | |
| 16818 | 713 | text{*@{term H} is sometimes @{term"Key ` KK \<union> spies evs"}, so can't put 
 | 
| 714 |   @{term "G=H"}.*}
 | |
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 715 | lemma Fake_analz_insert: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 716 | "X\<in> synth (analz G) ==> | 
| 13926 | 717 | analz (insert X H) \<subseteq> synth (analz G) \<union> analz (G \<union> H)" | 
| 718 | apply (rule subsetI) | |
| 719 | apply (subgoal_tac "x \<in> analz (synth (analz G) \<union> H) ") | |
| 720 | prefer 2 apply (blast intro: analz_mono [THEN [2] rev_subsetD] analz_mono [THEN synth_mono, THEN [2] rev_subsetD]) | |
| 721 | apply (simp (no_asm_use)) | |
| 722 | apply blast | |
| 723 | done | |
| 724 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 725 | lemma analz_conj_parts [simp]: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 726 | "(X \<in> analz H & X \<in> parts H) = (X \<in> analz H)" | 
| 14145 
2e31b8cc8788
ZhouGollmann: new example (fair non-repudiation protocol)
 paulson parents: 
14126diff
changeset | 727 | by (blast intro: analz_subset_parts [THEN subsetD]) | 
| 13926 | 728 | |
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 729 | lemma analz_disj_parts [simp]: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 730 | "(X \<in> analz H | X \<in> parts H) = (X \<in> parts H)" | 
| 14145 
2e31b8cc8788
ZhouGollmann: new example (fair non-repudiation protocol)
 paulson parents: 
14126diff
changeset | 731 | by (blast intro: analz_subset_parts [THEN subsetD]) | 
| 13926 | 732 | |
| 16818 | 733 | text{*Without this equation, other rules for synth and analz would yield
 | 
| 734 | redundant cases*} | |
| 13926 | 735 | lemma MPair_synth_analz [iff]: | 
| 736 |      "({|X,Y|} \<in> synth (analz H)) =  
 | |
| 737 | (X \<in> synth (analz H) & Y \<in> synth (analz H))" | |
| 738 | by blast | |
| 739 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 740 | lemma Crypt_synth_analz: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 741 | "[| Key K \<in> analz H; Key (invKey K) \<in> analz H |] | 
| 13926 | 742 | ==> (Crypt K X \<in> synth (analz H)) = (X \<in> synth (analz H))" | 
| 743 | by blast | |
| 744 | ||
| 745 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 746 | lemma Hash_synth_analz [simp]: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 747 | "X \<notin> synth (analz H) | 
| 13926 | 748 |       ==> (Hash{|X,Y|} \<in> synth (analz H)) = (Hash{|X,Y|} \<in> analz H)"
 | 
| 749 | by blast | |
| 750 | ||
| 751 | ||
| 752 | subsection{*HPair: a combination of Hash and MPair*}
 | |
| 753 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 754 | subsubsection{*Freeness *}
 | 
| 13926 | 755 | |
| 756 | lemma Agent_neq_HPair: "Agent A ~= Hash[X] Y" | |
| 757 | by (unfold HPair_def, simp) | |
| 758 | ||
| 759 | lemma Nonce_neq_HPair: "Nonce N ~= Hash[X] Y" | |
| 760 | by (unfold HPair_def, simp) | |
| 761 | ||
| 762 | lemma Number_neq_HPair: "Number N ~= Hash[X] Y" | |
| 763 | by (unfold HPair_def, simp) | |
| 764 | ||
| 765 | lemma Key_neq_HPair: "Key K ~= Hash[X] Y" | |
| 766 | by (unfold HPair_def, simp) | |
| 767 | ||
| 768 | lemma Hash_neq_HPair: "Hash Z ~= Hash[X] Y" | |
| 769 | by (unfold HPair_def, simp) | |
| 770 | ||
| 771 | lemma Crypt_neq_HPair: "Crypt K X' ~= Hash[X] Y" | |
| 772 | by (unfold HPair_def, simp) | |
| 773 | ||
| 774 | lemmas HPair_neqs = Agent_neq_HPair Nonce_neq_HPair Number_neq_HPair | |
| 775 | Key_neq_HPair Hash_neq_HPair Crypt_neq_HPair | |
| 776 | ||
| 777 | declare HPair_neqs [iff] | |
| 778 | declare HPair_neqs [symmetric, iff] | |
| 779 | ||
| 780 | lemma HPair_eq [iff]: "(Hash[X'] Y' = Hash[X] Y) = (X' = X & Y'=Y)" | |
| 781 | by (simp add: HPair_def) | |
| 782 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 783 | lemma MPair_eq_HPair [iff]: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 784 |      "({|X',Y'|} = Hash[X] Y) = (X' = Hash{|X,Y|} & Y'=Y)"
 | 
| 13926 | 785 | by (simp add: HPair_def) | 
| 786 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 787 | lemma HPair_eq_MPair [iff]: | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 788 |      "(Hash[X] Y = {|X',Y'|}) = (X' = Hash{|X,Y|} & Y'=Y)"
 | 
| 13926 | 789 | by (auto simp add: HPair_def) | 
| 790 | ||
| 791 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 792 | subsubsection{*Specialized laws, proved in terms of those for Hash and MPair *}
 | 
| 13926 | 793 | |
| 794 | lemma keysFor_insert_HPair [simp]: "keysFor (insert (Hash[X] Y) H) = keysFor H" | |
| 795 | by (simp add: HPair_def) | |
| 796 | ||
| 797 | lemma parts_insert_HPair [simp]: | |
| 798 | "parts (insert (Hash[X] Y) H) = | |
| 799 |      insert (Hash[X] Y) (insert (Hash{|X,Y|}) (parts (insert Y H)))"
 | |
| 800 | by (simp add: HPair_def) | |
| 801 | ||
| 802 | lemma analz_insert_HPair [simp]: | |
| 803 | "analz (insert (Hash[X] Y) H) = | |
| 804 |      insert (Hash[X] Y) (insert (Hash{|X,Y|}) (analz (insert Y H)))"
 | |
| 805 | by (simp add: HPair_def) | |
| 806 | ||
| 807 | lemma HPair_synth_analz [simp]: | |
| 808 | "X \<notin> synth (analz H) | |
| 809 | ==> (Hash[X] Y \<in> synth (analz H)) = | |
| 810 |         (Hash {|X, Y|} \<in> analz H & Y \<in> synth (analz H))"
 | |
| 811 | by (simp add: HPair_def) | |
| 812 | ||
| 813 | ||
| 16818 | 814 | text{*We do NOT want Crypt... messages broken up in protocols!!*}
 | 
| 13926 | 815 | declare parts.Body [rule del] | 
| 816 | ||
| 817 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 818 | text{*Rewrites to push in Key and Crypt messages, so that other messages can
 | 
| 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 819 |     be pulled out using the @{text analz_insert} rules*}
 | 
| 13926 | 820 | ML | 
| 821 | {*
 | |
| 822 | fun insComm x y = inst "x" x (inst "y" y insert_commute); | |
| 823 | ||
| 824 | bind_thms ("pushKeys",
 | |
| 825 | map (insComm "Key ?K") | |
| 826 | ["Agent ?C", "Nonce ?N", "Number ?N", | |
| 827 | "Hash ?X", "MPair ?X ?Y", "Crypt ?X ?K'"]); | |
| 828 | ||
| 829 | bind_thms ("pushCrypts",
 | |
| 830 | map (insComm "Crypt ?X ?K") | |
| 831 | ["Agent ?C", "Nonce ?N", "Number ?N", | |
| 832 | "Hash ?X'", "MPair ?X' ?Y"]); | |
| 833 | *} | |
| 834 | ||
| 835 | text{*Cannot be added with @{text "[simp]"} -- messages should not always be
 | |
| 836 | re-ordered. *} | |
| 837 | lemmas pushes = pushKeys pushCrypts | |
| 838 | ||
| 839 | ||
| 840 | subsection{*Tactics useful for many protocol proofs*}
 | |
| 841 | ML | |
| 842 | {*
 | |
| 24122 | 843 | structure Message = | 
| 844 | struct | |
| 13926 | 845 | |
| 846 | (*Prove base case (subgoal i) and simplify others. A typical base case | |
| 847 | concerns Crypt K X \<notin> Key`shrK`bad and cannot be proved by rewriting | |
| 848 | alone.*) | |
| 849 | fun prove_simple_subgoals_tac i = | |
| 26342 | 850 |     CLASIMPSET' (fn (cs, ss) => force_tac (cs, ss addsimps [@{thm image_eq_UN}])) i THEN
 | 
| 851 | ALLGOALS (SIMPSET' asm_simp_tac) | |
| 13926 | 852 | |
| 853 | (*Analysis of Fake cases. Also works for messages that forward unknown parts, | |
| 854 | but this application is no longer necessary if analz_insert_eq is used. | |
| 855 | Abstraction over i is ESSENTIAL: it delays the dereferencing of claset | |
| 856 | DEPENDS UPON "X" REFERRING TO THE FRADULENT MESSAGE *) | |
| 857 | ||
| 858 | (*Apply rules to break down assumptions of the form | |
| 859 | Y \<in> parts(insert X H) and Y \<in> analz(insert X H) | |
| 860 | *) | |
| 861 | val Fake_insert_tac = | |
| 24122 | 862 |     dresolve_tac [impOfSubs @{thm Fake_analz_insert},
 | 
| 863 |                   impOfSubs @{thm Fake_parts_insert}] THEN'
 | |
| 864 |     eresolve_tac [asm_rl, @{thm synth.Inj}];
 | |
| 13926 | 865 | |
| 866 | fun Fake_insert_simp_tac ss i = | |
| 867 | REPEAT (Fake_insert_tac i) THEN asm_full_simp_tac ss i; | |
| 868 | ||
| 869 | fun atomic_spy_analz_tac (cs,ss) = SELECT_GOAL | |
| 870 | (Fake_insert_simp_tac ss 1 | |
| 871 | THEN | |
| 872 | IF_UNSOLVED (Blast.depth_tac | |
| 24122 | 873 | 		  (cs addIs [@{thm analz_insertI},
 | 
| 874 | 				   impOfSubs @{thm analz_subset_parts}]) 4 1))
 | |
| 13926 | 875 | |
| 876 | (*The explicit claset and simpset arguments help it work with Isar*) | |
| 877 | fun gen_spy_analz_tac (cs,ss) i = | |
| 878 | DETERM | |
| 879 | (SELECT_GOAL | |
| 880 | (EVERY | |
| 881 | [ (*push in occurrences of X...*) | |
| 882 | (REPEAT o CHANGED) | |
| 883 |            (res_inst_tac [("x1","X")] (insert_commute RS ssubst) 1),
 | |
| 884 | (*...allowing further simplifications*) | |
| 885 | simp_tac ss 1, | |
| 886 | REPEAT (FIRSTGOAL (resolve_tac [allI,impI,notI,conjI,iffI])), | |
| 887 | DEPTH_SOLVE (atomic_spy_analz_tac (cs,ss) 1)]) i) | |
| 888 | ||
| 26342 | 889 | val spy_analz_tac = CLASIMPSET' gen_spy_analz_tac; | 
| 24122 | 890 | |
| 891 | end | |
| 13926 | 892 | *} | 
| 893 | ||
| 16818 | 894 | text{*By default only @{text o_apply} is built-in.  But in the presence of
 | 
| 895 | eta-expansion this means that some terms displayed as @{term "f o g"} will be
 | |
| 896 | rewritten, and others will not!*} | |
| 13926 | 897 | declare o_def [simp] | 
| 898 | ||
| 11189 | 899 | |
| 13922 | 900 | lemma Crypt_notin_image_Key [simp]: "Crypt K X \<notin> Key ` A" | 
| 901 | by auto | |
| 902 | ||
| 903 | lemma Hash_notin_image_Key [simp] :"Hash X \<notin> Key ` A" | |
| 904 | by auto | |
| 905 | ||
| 14200 
d8598e24f8fa
Removal of the Key_supply axiom (affects many possbility proofs) and minor
 paulson parents: 
14181diff
changeset | 906 | lemma synth_analz_mono: "G\<subseteq>H ==> synth (analz(G)) \<subseteq> synth (analz(H))" | 
| 17689 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 907 | by (iprover intro: synth_mono analz_mono) | 
| 13922 | 908 | |
| 909 | lemma Fake_analz_eq [simp]: | |
| 910 | "X \<in> synth(analz H) ==> synth (analz (insert X H)) = synth (analz H)" | |
| 911 | apply (drule Fake_analz_insert[of _ _ "H"]) | |
| 912 | apply (simp add: synth_increasing[THEN Un_absorb2]) | |
| 913 | apply (drule synth_mono) | |
| 914 | apply (simp add: synth_idem) | |
| 17689 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 915 | apply (rule equalityI) | 
| 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 916 | apply (simp add: ); | 
| 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 917 | apply (rule synth_analz_mono, blast) | 
| 13922 | 918 | done | 
| 919 | ||
| 920 | text{*Two generalizations of @{text analz_insert_eq}*}
 | |
| 921 | lemma gen_analz_insert_eq [rule_format]: | |
| 922 | "X \<in> analz H ==> ALL G. H \<subseteq> G --> analz (insert X G) = analz G"; | |
| 923 | by (blast intro: analz_cut analz_insertI analz_mono [THEN [2] rev_subsetD]) | |
| 924 | ||
| 925 | lemma synth_analz_insert_eq [rule_format]: | |
| 926 | "X \<in> synth (analz H) | |
| 927 | ==> ALL G. H \<subseteq> G --> (Key K \<in> analz (insert X G)) = (Key K \<in> analz G)"; | |
| 928 | apply (erule synth.induct) | |
| 929 | apply (simp_all add: gen_analz_insert_eq subset_trans [OF _ subset_insertI]) | |
| 930 | done | |
| 931 | ||
| 932 | lemma Fake_parts_sing: | |
| 13926 | 933 |      "X \<in> synth (analz H) ==> parts{X} \<subseteq> synth (analz H) \<union> parts H";
 | 
| 13922 | 934 | apply (rule subset_trans) | 
| 17689 
a04b5b43625e
streamlined theory; conformance to recent publication
 paulson parents: 
16818diff
changeset | 935 | apply (erule_tac [2] Fake_parts_insert) | 
| 20648 | 936 | apply (rule parts_mono, blast) | 
| 13922 | 937 | done | 
| 938 | ||
| 14145 
2e31b8cc8788
ZhouGollmann: new example (fair non-repudiation protocol)
 paulson parents: 
14126diff
changeset | 939 | lemmas Fake_parts_sing_imp_Un = Fake_parts_sing [THEN [2] rev_subsetD] | 
| 
2e31b8cc8788
ZhouGollmann: new example (fair non-repudiation protocol)
 paulson parents: 
14126diff
changeset | 940 | |
| 11189 | 941 | method_setup spy_analz = {*
 | 
| 11270 
a315a3862bb4
better treatment of methods: uses Method.ctxt_args to refer to current
 paulson parents: 
11264diff
changeset | 942 | Method.ctxt_args (fn ctxt => | 
| 24122 | 943 | Method.SIMPLE_METHOD (Message.gen_spy_analz_tac (local_clasimpset_of ctxt) 1)) *} | 
| 11189 | 944 | "for proving the Fake case when analz is involved" | 
| 1839 | 945 | |
| 11264 | 946 | method_setup atomic_spy_analz = {*
 | 
| 11270 
a315a3862bb4
better treatment of methods: uses Method.ctxt_args to refer to current
 paulson parents: 
11264diff
changeset | 947 | Method.ctxt_args (fn ctxt => | 
| 24122 | 948 | Method.SIMPLE_METHOD (Message.atomic_spy_analz_tac (local_clasimpset_of ctxt) 1)) *} | 
| 11264 | 949 | "for debugging spy_analz" | 
| 950 | ||
| 951 | method_setup Fake_insert_simp = {*
 | |
| 11270 
a315a3862bb4
better treatment of methods: uses Method.ctxt_args to refer to current
 paulson parents: 
11264diff
changeset | 952 | Method.ctxt_args (fn ctxt => | 
| 24122 | 953 | Method.SIMPLE_METHOD (Message.Fake_insert_simp_tac (local_simpset_of ctxt) 1)) *} | 
| 11264 | 954 | "for debugging spy_analz" | 
| 955 | ||
| 1839 | 956 | end |