| author | huffman | 
| Tue, 23 Aug 2011 16:47:48 -0700 | |
| changeset 44466 | 0e5c27f07529 | 
| parent 41774 | 13b97824aec6 | 
| child 51717 | 9e7d1c139569 | 
| permissions | -rw-r--r-- | 
| 32631 | 1 | (* Author: Giampaolo Bella, Catania University | 
| 18886 | 2 | *) | 
| 3 | ||
| 4 | header{*Theory of smartcards*}
 | |
| 5 | ||
| 32631 | 6 | theory Smartcard | 
| 41413 
64cd30d6b0b8
explicit file specifications -- avoid secondary load path;
 wenzelm parents: 
39246diff
changeset | 7 | imports EventSC "../All_Symmetric" | 
| 32631 | 8 | begin | 
| 18886 | 9 | |
| 10 | text{*  
 | |
| 11 | As smartcards handle long-term (symmetric) keys, this theoy extends and | |
| 12 | supersedes theory Private.thy | |
| 13 | ||
| 14 | An agent is bad if she reveals her PIN to the spy, not the shared key that | |
| 15 | is embedded in her card. An agent's being bad implies nothing about her | |
| 16 | smartcard, which independently may be stolen or cloned. | |
| 17 | *} | |
| 18 | ||
| 41774 | 19 | axiomatization | 
| 20 | shrK :: "agent => key" and (*long-term keys saved in smart cards*) | |
| 21 | crdK :: "card => key" and (*smart cards' symmetric keys*) | |
| 22 | pin :: "agent => key" and (*pin to activate the smart cards*) | |
| 18886 | 23 | |
| 24 | (*Mostly for Shoup-Rubin*) | |
| 41774 | 25 | Pairkey :: "agent * agent => nat" and | 
| 18886 | 26 | pairK :: "agent * agent => key" | 
| 41774 | 27 | where | 
| 28 |   inj_shrK: "inj shrK" and  --{*No two smartcards store the same key*}
 | |
| 29 |   inj_crdK: "inj crdK" and  --{*Nor do two cards*}
 | |
| 30 |   inj_pin : "inj pin" and   --{*Nor do two agents have the same pin*}
 | |
| 18886 | 31 | |
| 32 | (*pairK is injective on each component, if we assume encryption to be a PRF | |
| 33 | or at least collision free *) | |
| 41774 | 34 | inj_pairK [iff]: "(pairK(A,B) = pairK(A',B')) = (A = A' & B = B')" and | 
| 35 | comm_Pairkey [iff]: "Pairkey(A,B) = Pairkey(B,A)" and | |
| 18886 | 36 | |
| 37 | (*long-term keys differ from each other*) | |
| 41774 | 38 | pairK_disj_crdK [iff]: "pairK(A,B) \<noteq> crdK C" and | 
| 39 | pairK_disj_shrK [iff]: "pairK(A,B) \<noteq> shrK P" and | |
| 40 | pairK_disj_pin [iff]: "pairK(A,B) \<noteq> pin P" and | |
| 41 | shrK_disj_crdK [iff]: "shrK P \<noteq> crdK C" and | |
| 42 | shrK_disj_pin [iff]: "shrK P \<noteq> pin Q" and | |
| 18886 | 43 | crdK_disj_pin [iff]: "crdK C \<noteq> pin P" | 
| 44 | ||
| 35416 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 haftmann parents: 
32960diff
changeset | 45 | definition legalUse :: "card => bool" ("legalUse (_)") where
 | 
| 18886 | 46 | "legalUse C == C \<notin> stolen" | 
| 47 | ||
| 35416 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 haftmann parents: 
32960diff
changeset | 48 | primrec illegalUse :: "card => bool" where | 
| 
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
 haftmann parents: 
32960diff
changeset | 49 | illegalUse_def: "illegalUse (Card A) = ( (Card A \<in> stolen \<and> A \<in> bad) \<or> Card A \<in> cloned )" | 
| 18886 | 50 | |
| 51 | ||
| 52 | text{*initState must be defined with care*}
 | |
| 39246 | 53 | |
| 54 | overloading | |
| 55 | initState \<equiv> initState | |
| 56 | begin | |
| 57 | ||
| 58 | primrec initState where | |
| 18886 | 59 | (*Server knows all long-term keys; adding cards' keys may be redundant but | 
| 60 | helps prove crdK_in_initState and crdK_in_used to distinguish cards' keys | |
| 61 | from fresh (session) keys*) | |
| 62 | initState_Server: "initState Server = | |
| 63 | (Key`(range shrK \<union> range crdK \<union> range pin \<union> range pairK)) \<union> | |
| 39246 | 64 | (Nonce`(range Pairkey))" | | 
| 18886 | 65 | |
| 66 | (*Other agents know only their own*) | |
| 39246 | 67 |   initState_Friend:  "initState (Friend i) = {Key (pin (Friend i))}" |
 | 
| 18886 | 68 | |
| 69 | (*Spy knows bad agents' pins, cloned cards' keys, pairKs, and Pairkeys *) | |
| 70 | initState_Spy: "initState Spy = | |
| 71 |                  (Key`((pin`bad) \<union> (pin `{A. Card A \<in> cloned}) \<union> 
 | |
| 72 |                                       (shrK`{A. Card A \<in> cloned}) \<union> 
 | |
| 73 | (crdK`cloned) \<union> | |
| 74 |                         (pairK`{(X,A). Card A \<in> cloned})))
 | |
| 75 |            \<union> (Nonce`(Pairkey`{(A,B). Card A \<in> cloned & Card B \<in> cloned}))"
 | |
| 76 | ||
| 39246 | 77 | end | 
| 18886 | 78 | |
| 79 | text{*Still relying on axioms*}
 | |
| 41774 | 80 | axiomatization where | 
| 81 | Key_supply_ax: "finite KK \<Longrightarrow> \<exists> K. K \<notin> KK & Key K \<notin> used evs" and | |
| 18886 | 82 | |
| 83 | (*Needed because of Spy's knowledge of Pairkeys*) | |
| 84 | Nonce_supply_ax: "finite NN \<Longrightarrow> \<exists> N. N \<notin> NN & Nonce N \<notin> used evs" | |
| 85 | ||
| 86 | ||
| 87 | ||
| 88 | ||
| 89 | ||
| 90 | ||
| 91 | ||
| 92 | subsection{*Basic properties of shrK*}
 | |
| 93 | ||
| 94 | (*Injectiveness: Agents' long-term keys are distinct.*) | |
| 95 | declare inj_shrK [THEN inj_eq, iff] | |
| 96 | declare inj_crdK [THEN inj_eq, iff] | |
| 97 | declare inj_pin [THEN inj_eq, iff] | |
| 98 | ||
| 99 | lemma invKey_K [simp]: "invKey K = K" | |
| 100 | apply (insert isSym_keys) | |
| 101 | apply (simp add: symKeys_def) | |
| 102 | done | |
| 103 | ||
| 104 | ||
| 105 | lemma analz_Decrypt' [dest]: | |
| 106 | "\<lbrakk> Crypt K X \<in> analz H; Key K \<in> analz H \<rbrakk> \<Longrightarrow> X \<in> analz H" | |
| 107 | by auto | |
| 108 | ||
| 109 | text{*Now cancel the @{text dest} attribute given to
 | |
| 110 |  @{text analz.Decrypt} in its declaration.*}
 | |
| 111 | declare analz.Decrypt [rule del] | |
| 112 | ||
| 113 | text{*Rewrites should not refer to  @{term "initState(Friend i)"} because
 | |
| 114 | that expression is not in normal form.*} | |
| 115 | ||
| 116 | text{*Added to extend initstate with set of nonces*}
 | |
| 117 | lemma parts_image_Nonce [simp]: "parts (Nonce`N) = Nonce`N" | |
| 118 | apply auto | |
| 119 | apply (erule parts.induct) | |
| 120 | apply auto | |
| 121 | done | |
| 122 | ||
| 123 | lemma keysFor_parts_initState [simp]: "keysFor (parts (initState C)) = {}"
 | |
| 124 | apply (unfold keysFor_def) | |
| 125 | apply (induct_tac "C", auto) | |
| 126 | done | |
| 127 | ||
| 128 | (*Specialized to shared-key model: no @{term invKey}*)
 | |
| 129 | lemma keysFor_parts_insert: | |
| 130 | "\<lbrakk> K \<in> keysFor (parts (insert X G)); X \<in> synth (analz H) \<rbrakk> | |
| 41774 | 131 | \<Longrightarrow> K \<in> keysFor (parts (G \<union> H)) | Key K \<in> parts H" | 
| 18886 | 132 | by (force dest: EventSC.keysFor_parts_insert) | 
| 133 | ||
| 134 | lemma Crypt_imp_keysFor: "Crypt K X \<in> H \<Longrightarrow> K \<in> keysFor H" | |
| 135 | by (drule Crypt_imp_invKey_keysFor, simp) | |
| 136 | ||
| 137 | ||
| 138 | subsection{*Function "knows"*}
 | |
| 139 | ||
| 140 | (*Spy knows the pins of bad agents!*) | |
| 141 | lemma Spy_knows_bad [intro!]: "A \<in> bad \<Longrightarrow> Key (pin A) \<in> knows Spy evs" | |
| 142 | apply (induct_tac "evs") | |
| 143 | apply (simp_all (no_asm_simp) add: imageI knows_Cons split add: event.split) | |
| 144 | done | |
| 145 | ||
| 146 | (*Spy knows the long-term keys of cloned cards!*) | |
| 147 | lemma Spy_knows_cloned [intro!]: | |
| 148 | "Card A \<in> cloned \<Longrightarrow> Key (crdK (Card A)) \<in> knows Spy evs & | |
| 149 | Key (shrK A) \<in> knows Spy evs & | |
| 150 | Key (pin A) \<in> knows Spy evs & | |
| 151 | (\<forall> B. Key (pairK(B,A)) \<in> knows Spy evs)" | |
| 152 | apply (induct_tac "evs") | |
| 153 | apply (simp_all (no_asm_simp) add: imageI knows_Cons split add: event.split) | |
| 154 | done | |
| 155 | ||
| 156 | lemma Spy_knows_cloned1 [intro!]: "C \<in> cloned \<Longrightarrow> Key (crdK C) \<in> knows Spy evs" | |
| 157 | apply (induct_tac "evs") | |
| 158 | apply (simp_all (no_asm_simp) add: imageI knows_Cons split add: event.split) | |
| 159 | done | |
| 160 | ||
| 161 | lemma Spy_knows_cloned2 [intro!]: "\<lbrakk> Card A \<in> cloned; Card B \<in> cloned \<rbrakk> | |
| 162 | \<Longrightarrow> Nonce (Pairkey(A,B))\<in> knows Spy evs" | |
| 163 | apply (induct_tac "evs") | |
| 164 | apply (simp_all (no_asm_simp) add: imageI knows_Cons split add: event.split) | |
| 165 | done | |
| 166 | ||
| 167 | (*Spy only knows pins of bad agents!*) | |
| 168 | lemma Spy_knows_Spy_bad [intro!]: "A\<in> bad \<Longrightarrow> Key (pin A) \<in> knows Spy evs" | |
| 169 | apply (induct_tac "evs") | |
| 170 | apply (simp_all (no_asm_simp) add: imageI knows_Cons split add: event.split) | |
| 171 | done | |
| 172 | ||
| 173 | ||
| 174 | (*For case analysis on whether or not an agent is compromised*) | |
| 175 | lemma Crypt_Spy_analz_bad: | |
| 176 | "\<lbrakk> Crypt (pin A) X \<in> analz (knows Spy evs); A\<in>bad \<rbrakk> | |
| 177 | \<Longrightarrow> X \<in> analz (knows Spy evs)" | |
| 178 | apply (force dest!: analz.Decrypt) | |
| 179 | done | |
| 180 | ||
| 181 | (** Fresh keys never clash with other keys **) | |
| 182 | ||
| 183 | lemma shrK_in_initState [iff]: "Key (shrK A) \<in> initState Server" | |
| 184 | apply (induct_tac "A") | |
| 185 | apply auto | |
| 186 | done | |
| 187 | ||
| 188 | lemma shrK_in_used [iff]: "Key (shrK A) \<in> used evs" | |
| 189 | apply (rule initState_into_used) | |
| 190 | apply blast | |
| 191 | done | |
| 192 | ||
| 193 | lemma crdK_in_initState [iff]: "Key (crdK A) \<in> initState Server" | |
| 194 | apply (induct_tac "A") | |
| 195 | apply auto | |
| 196 | done | |
| 197 | ||
| 198 | lemma crdK_in_used [iff]: "Key (crdK A) \<in> used evs" | |
| 199 | apply (rule initState_into_used) | |
| 200 | apply blast | |
| 201 | done | |
| 202 | ||
| 203 | lemma pin_in_initState [iff]: "Key (pin A) \<in> initState A" | |
| 204 | apply (induct_tac "A") | |
| 205 | apply auto | |
| 206 | done | |
| 207 | ||
| 208 | lemma pin_in_used [iff]: "Key (pin A) \<in> used evs" | |
| 209 | apply (rule initState_into_used) | |
| 210 | apply blast | |
| 211 | done | |
| 212 | ||
| 213 | lemma pairK_in_initState [iff]: "Key (pairK X) \<in> initState Server" | |
| 214 | apply (induct_tac "X") | |
| 215 | apply auto | |
| 216 | done | |
| 217 | ||
| 218 | lemma pairK_in_used [iff]: "Key (pairK X) \<in> used evs" | |
| 219 | apply (rule initState_into_used) | |
| 220 | apply blast | |
| 221 | done | |
| 222 | ||
| 223 | ||
| 224 | ||
| 225 | (*Used in parts_induct_tac and analz_Fake_tac to distinguish session keys | |
| 226 | from long-term shared keys*) | |
| 227 | lemma Key_not_used [simp]: "Key K \<notin> used evs \<Longrightarrow> K \<notin> range shrK" | |
| 228 | by blast | |
| 229 | ||
| 230 | lemma shrK_neq [simp]: "Key K \<notin> used evs \<Longrightarrow> shrK B \<noteq> K" | |
| 231 | by blast | |
| 232 | ||
| 233 | lemma crdK_not_used [simp]: "Key K \<notin> used evs \<Longrightarrow> K \<notin> range crdK" | |
| 234 | apply clarify | |
| 235 | done | |
| 236 | ||
| 237 | lemma crdK_neq [simp]: "Key K \<notin> used evs \<Longrightarrow> crdK C \<noteq> K" | |
| 238 | apply clarify | |
| 239 | done | |
| 240 | ||
| 241 | lemma pin_not_used [simp]: "Key K \<notin> used evs \<Longrightarrow> K \<notin> range pin" | |
| 242 | apply clarify | |
| 243 | done | |
| 244 | ||
| 245 | lemma pin_neq [simp]: "Key K \<notin> used evs \<Longrightarrow> pin A \<noteq> K" | |
| 246 | apply clarify | |
| 247 | done | |
| 248 | ||
| 249 | lemma pairK_not_used [simp]: "Key K \<notin> used evs \<Longrightarrow> K \<notin> range pairK" | |
| 250 | apply clarify | |
| 251 | done | |
| 252 | ||
| 253 | lemma pairK_neq [simp]: "Key K \<notin> used evs \<Longrightarrow> pairK(A,B) \<noteq> K" | |
| 254 | apply clarify | |
| 255 | done | |
| 256 | ||
| 257 | declare shrK_neq [THEN not_sym, simp] | |
| 258 | declare crdK_neq [THEN not_sym, simp] | |
| 259 | declare pin_neq [THEN not_sym, simp] | |
| 260 | declare pairK_neq [THEN not_sym, simp] | |
| 261 | ||
| 262 | ||
| 263 | subsection{*Fresh nonces*}
 | |
| 264 | ||
| 265 | lemma Nonce_notin_initState [iff]: "Nonce N \<notin> parts (initState (Friend i))" | |
| 266 | by auto | |
| 267 | ||
| 268 | ||
| 269 | (*This lemma no longer holds of smartcard protocols, where the cards can store | |
| 270 | nonces. | |
| 271 | ||
| 272 | lemma Nonce_notin_used_empty [simp]: "Nonce N \<notin> used []" | |
| 273 | apply (simp (no_asm) add: used_Nil) | |
| 274 | done | |
| 275 | ||
| 276 | So, we must use old-style supply fresh nonce theorems relying on the appropriate axiom*) | |
| 277 | ||
| 278 | ||
| 279 | subsection{*Supply fresh nonces for possibility theorems.*}
 | |
| 280 | ||
| 281 | ||
| 282 | lemma Nonce_supply1: "\<exists>N. Nonce N \<notin> used evs" | |
| 22265 | 283 | apply (rule finite.emptyI [THEN Nonce_supply_ax, THEN exE], blast) | 
| 18886 | 284 | done | 
| 285 | ||
| 286 | lemma Nonce_supply2: | |
| 287 | "\<exists>N N'. Nonce N \<notin> used evs & Nonce N' \<notin> used evs' & N \<noteq> N'" | |
| 22265 | 288 | apply (cut_tac evs = evs in finite.emptyI [THEN Nonce_supply_ax]) | 
| 18886 | 289 | apply (erule exE) | 
| 22265 | 290 | apply (cut_tac evs = evs' in finite.emptyI [THEN finite.insertI, THEN Nonce_supply_ax]) | 
| 18886 | 291 | apply auto | 
| 292 | done | |
| 293 | ||
| 294 | ||
| 295 | lemma Nonce_supply3: "\<exists>N N' N''. Nonce N \<notin> used evs & Nonce N' \<notin> used evs' & | |
| 296 | Nonce N'' \<notin> used evs'' & N \<noteq> N' & N' \<noteq> N'' & N \<noteq> N''" | |
| 22265 | 297 | apply (cut_tac evs = evs in finite.emptyI [THEN Nonce_supply_ax]) | 
| 18886 | 298 | apply (erule exE) | 
| 22265 | 299 | apply (cut_tac evs = evs' and a1 = N in finite.emptyI [THEN finite.insertI, THEN Nonce_supply_ax]) | 
| 18886 | 300 | apply (erule exE) | 
| 22265 | 301 | apply (cut_tac evs = evs'' and a1 = Na and a2 = N in finite.emptyI [THEN finite.insertI, THEN finite.insertI, THEN Nonce_supply_ax]) | 
| 18886 | 302 | apply blast | 
| 303 | done | |
| 304 | ||
| 305 | lemma Nonce_supply: "Nonce (@ N. Nonce N \<notin> used evs) \<notin> used evs" | |
| 22265 | 306 | apply (rule finite.emptyI [THEN Nonce_supply_ax, THEN exE]) | 
| 18886 | 307 | apply (rule someI, blast) | 
| 308 | done | |
| 309 | ||
| 310 | ||
| 311 | ||
| 312 | text{*Unlike the corresponding property of nonces, we cannot prove
 | |
| 313 |     @{term "finite KK \<Longrightarrow> \<exists>K. K \<notin> KK & Key K \<notin> used evs"}.
 | |
| 314 | We have infinitely many agents and there is nothing to stop their | |
| 315 | long-term keys from exhausting all the natural numbers. Instead, | |
| 316 | possibility theorems must assume the existence of a few keys.*} | |
| 317 | ||
| 318 | ||
| 319 | subsection{*Specialized Rewriting for Theorems About @{term analz} and Image*}
 | |
| 320 | ||
| 321 | lemma subset_Compl_range_shrK: "A \<subseteq> - (range shrK) \<Longrightarrow> shrK x \<notin> A" | |
| 322 | by blast | |
| 323 | ||
| 324 | lemma subset_Compl_range_crdK: "A \<subseteq> - (range crdK) \<Longrightarrow> crdK x \<notin> A" | |
| 325 | apply blast | |
| 326 | done | |
| 327 | ||
| 328 | lemma subset_Compl_range_pin: "A \<subseteq> - (range pin) \<Longrightarrow> pin x \<notin> A" | |
| 329 | apply blast | |
| 330 | done | |
| 331 | ||
| 332 | lemma subset_Compl_range_pairK: "A \<subseteq> - (range pairK) \<Longrightarrow> pairK x \<notin> A" | |
| 333 | apply blast | |
| 334 | done | |
| 335 | lemma insert_Key_singleton: "insert (Key K) H = Key ` {K} \<union> H"
 | |
| 336 | by blast | |
| 337 | ||
| 338 | lemma insert_Key_image: "insert (Key K) (Key`KK \<union> C) = Key`(insert K KK) \<union> C" | |
| 339 | by blast | |
| 340 | ||
| 341 | (** Reverse the normal simplification of "image" to build up (not break down) | |
| 342 | the set of keys. Use analz_insert_eq with (Un_upper2 RS analz_mono) to | |
| 343 | erase occurrences of forwarded message components (X). **) | |
| 344 | ||
| 345 | lemmas analz_image_freshK_simps = | |
| 346 |        simp_thms mem_simps --{*these two allow its use with @{text "only:"}*}
 | |
| 347 | disj_comms | |
| 348 | image_insert [THEN sym] image_Un [THEN sym] empty_subsetI insert_subset | |
| 349 | analz_insert_eq Un_upper2 [THEN analz_mono, THEN [2] rev_subsetD] | |
| 350 | insert_Key_singleton subset_Compl_range_shrK subset_Compl_range_crdK | |
| 351 | subset_Compl_range_pin subset_Compl_range_pairK | |
| 352 | Key_not_used insert_Key_image Un_assoc [THEN sym] | |
| 353 | ||
| 354 | (*Lemma for the trivial direction of the if-and-only-if*) | |
| 355 | lemma analz_image_freshK_lemma: | |
| 356 | "(Key K \<in> analz (Key`nE \<union> H)) \<longrightarrow> (K \<in> nE | Key K \<in> analz H) \<Longrightarrow> | |
| 357 | (Key K \<in> analz (Key`nE \<union> H)) = (K \<in> nE | Key K \<in> analz H)" | |
| 358 | by (blast intro: analz_mono [THEN [2] rev_subsetD]) | |
| 359 | ||
| 24122 | 360 | |
| 361 | subsection{*Tactics for possibility theorems*}
 | |
| 362 | ||
| 18886 | 363 | ML | 
| 364 | {*
 | |
| 24122 | 365 | structure Smartcard = | 
| 366 | struct | |
| 367 | ||
| 368 | (*Omitting used_Says makes the tactic much faster: it leaves expressions | |
| 369 | such as Nonce ?N \<notin> used evs that match Nonce_supply*) | |
| 370 | fun possibility_tac ctxt = | |
| 371 | (REPEAT | |
| 32149 
ef59550a55d3
renamed simpset_of to global_simpset_of, and local_simpset_of to simpset_of -- same for claset and clasimpset;
 wenzelm parents: 
30549diff
changeset | 372 | (ALLGOALS (simp_tac (simpset_of ctxt | 
| 24122 | 373 |       delsimps [@{thm used_Says}, @{thm used_Notes}, @{thm used_Gets},
 | 
| 374 |         @{thm used_Inputs}, @{thm used_C_Gets}, @{thm used_Outpts}, @{thm used_A_Gets}] 
 | |
| 375 | setSolver safe_solver)) | |
| 376 | THEN | |
| 377 | REPEAT_FIRST (eq_assume_tac ORELSE' | |
| 378 |                    resolve_tac [refl, conjI, @{thm Nonce_supply}])))
 | |
| 379 | ||
| 380 | (*For harder protocols (such as Recur) where we have to set up some | |
| 381 | nonces and keys initially*) | |
| 382 | fun basic_possibility_tac ctxt = | |
| 383 | REPEAT | |
| 32149 
ef59550a55d3
renamed simpset_of to global_simpset_of, and local_simpset_of to simpset_of -- same for claset and clasimpset;
 wenzelm parents: 
30549diff
changeset | 384 | (ALLGOALS (asm_simp_tac (simpset_of ctxt setSolver safe_solver)) | 
| 24122 | 385 | THEN | 
| 386 | REPEAT_FIRST (resolve_tac [refl, conjI])) | |
| 18886 | 387 | |
| 388 | val analz_image_freshK_ss = | |
| 23894 
1a4167d761ac
tactics: avoid dynamic reference to accidental theory context (via ML_Context.the_context etc.);
 wenzelm parents: 
22265diff
changeset | 389 |      @{simpset} delsimps [image_insert, image_Un]
 | 
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
32631diff
changeset | 390 |                delsimps [@{thm imp_disjL}]    (*reduces blow-up*)
 | 
| 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
32631diff
changeset | 391 |                addsimps @{thms analz_image_freshK_simps}
 | 
| 24122 | 392 | end | 
| 18886 | 393 | *} | 
| 394 | ||
| 395 | ||
| 396 | (*Lets blast_tac perform this step without needing the simplifier*) | |
| 397 | lemma invKey_shrK_iff [iff]: | |
| 398 | "(Key (invKey K) \<in> X) = (Key K \<in> X)" | |
| 399 | by auto | |
| 400 | ||
| 401 | (*Specialized methods*) | |
| 402 | ||
| 403 | method_setup analz_freshK = {*
 | |
| 30549 | 404 | Scan.succeed (fn ctxt => | 
| 30510 
4120fc59dd85
unified type Proof.method and pervasive METHOD combinators;
 wenzelm parents: 
24122diff
changeset | 405 | (SIMPLE_METHOD | 
| 21588 | 406 | (EVERY [REPEAT_FIRST (resolve_tac [allI, ballI, impI]), | 
| 24122 | 407 |           REPEAT_FIRST (rtac @{thm analz_image_freshK_lemma}),
 | 
| 408 | ALLGOALS (asm_simp_tac (Simplifier.context ctxt Smartcard.analz_image_freshK_ss))]))) *} | |
| 18886 | 409 | "for proving the Session Key Compromise theorem" | 
| 410 | ||
| 411 | method_setup possibility = {*
 | |
| 30549 | 412 | Scan.succeed (fn ctxt => | 
| 30510 
4120fc59dd85
unified type Proof.method and pervasive METHOD combinators;
 wenzelm parents: 
24122diff
changeset | 413 | SIMPLE_METHOD (Smartcard.possibility_tac ctxt)) *} | 
| 23894 
1a4167d761ac
tactics: avoid dynamic reference to accidental theory context (via ML_Context.the_context etc.);
 wenzelm parents: 
22265diff
changeset | 414 | "for proving possibility theorems" | 
| 
1a4167d761ac
tactics: avoid dynamic reference to accidental theory context (via ML_Context.the_context etc.);
 wenzelm parents: 
22265diff
changeset | 415 | |
| 
1a4167d761ac
tactics: avoid dynamic reference to accidental theory context (via ML_Context.the_context etc.);
 wenzelm parents: 
22265diff
changeset | 416 | method_setup basic_possibility = {*
 | 
| 30549 | 417 | Scan.succeed (fn ctxt => | 
| 30510 
4120fc59dd85
unified type Proof.method and pervasive METHOD combinators;
 wenzelm parents: 
24122diff
changeset | 418 | SIMPLE_METHOD (Smartcard.basic_possibility_tac ctxt)) *} | 
| 18886 | 419 | "for proving possibility theorems" | 
| 420 | ||
| 421 | lemma knows_subset_knows_Cons: "knows A evs \<subseteq> knows A (e # evs)" | |
| 23894 
1a4167d761ac
tactics: avoid dynamic reference to accidental theory context (via ML_Context.the_context etc.);
 wenzelm parents: 
22265diff
changeset | 422 | by (induct e) (auto simp: knows_Cons) | 
| 18886 | 423 | |
| 424 | (*Needed for actual protocols that will follow*) | |
| 425 | declare shrK_disj_crdK[THEN not_sym, iff] | |
| 426 | declare shrK_disj_pin[THEN not_sym, iff] | |
| 427 | declare pairK_disj_shrK[THEN not_sym, iff] | |
| 428 | declare pairK_disj_crdK[THEN not_sym, iff] | |
| 429 | declare pairK_disj_pin[THEN not_sym, iff] | |
| 430 | declare crdK_disj_pin[THEN not_sym, iff] | |
| 431 | ||
| 432 | declare legalUse_def [iff] illegalUse_def [iff] | |
| 433 | ||
| 434 | end |