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