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