src/HOL/Auth/NS_Public.ML
changeset 4422 21238c9d363e
parent 4197 1547bc6daa5a
child 4449 df30e75f670f
equal deleted inserted replaced
4421:88639289be39 4422:21238c9d363e
    55 by (parts_induct_tac 1);
    55 by (parts_induct_tac 1);
    56 by (Fake_parts_insert_tac 1);
    56 by (Fake_parts_insert_tac 1);
    57 qed "Spy_see_priK";
    57 qed "Spy_see_priK";
    58 Addsimps [Spy_see_priK];
    58 Addsimps [Spy_see_priK];
    59 
    59 
       
    60 AddDs [impOfSubs analz_subset_parts];
       
    61 AddDs [Says_imp_spies RS parts.Inj];
       
    62 AddDs [impOfSubs Fake_parts_insert];
       
    63 
    60 goal thy 
    64 goal thy 
    61  "!!A. evs: ns_public ==> (Key (priK A) : analz (spies evs)) = (A : bad)";
    65  "!!A. evs: ns_public ==> (Key (priK A) : analz (spies evs)) = (A : bad)";
    62 by (auto_tac(claset() addDs [impOfSubs analz_subset_parts], simpset()));
    66 by (Auto_tac());
    63 qed "Spy_analz_priK";
    67 qed "Spy_analz_priK";
    64 Addsimps [Spy_analz_priK];
    68 Addsimps [Spy_analz_priK];
    65 
    69 
    66 goal thy  "!!A. [| Key (priK A) : parts (spies evs);       \
    70 goal thy  "!!A. [| Key (priK A) : parts (spies evs);       \
    67 \                  evs : ns_public |] ==> A:bad";
    71 \                  evs : ns_public |] ==> A:bad";
   133 \           A ~: bad;  B ~: bad;  evs : ns_public |]                        \
   137 \           A ~: bad;  B ~: bad;  evs : ns_public |]                        \
   134 \        ==>  Nonce NA ~: analz (spies evs)";
   138 \        ==>  Nonce NA ~: analz (spies evs)";
   135 by (etac rev_mp 1);
   139 by (etac rev_mp 1);
   136 by (analz_induct_tac 1);
   140 by (analz_induct_tac 1);
   137 (*NS3*)
   141 (*NS3*)
   138 by (blast_tac (claset() addDs  [Says_imp_spies RS parts.Inj]
   142 by (blast_tac (claset() addEs  [no_nonce_NS1_NS2 RSN (2, rev_notE)]) 4);
   139                        addEs  [no_nonce_NS1_NS2 RSN (2, rev_notE)]) 4);
       
   140 (*NS2*)
   143 (*NS2*)
   141 by (blast_tac (claset() addSEs [MPair_parts]
   144 by (blast_tac (claset() addSEs [MPair_parts]
   142 		       addDs  [Says_imp_spies RS parts.Inj,
   145 		        addDs  [parts.Body, unique_NA]) 3);
   143 			       parts.Body, unique_NA]) 3);
   146 (*NS1*)
   144 (*NS1*)
   147 by (blast_tac (claset() addSEs spies_partsEs) 2);
   145 by (blast_tac (claset() addSEs spies_partsEs
       
   146                        addIs  [impOfSubs analz_subset_parts]) 2);
       
   147 (*Fake*)
   148 (*Fake*)
   148 by (spy_analz_tac 1);
   149 by (spy_analz_tac 1);
   149 qed "Spy_not_see_NA";
   150 qed "Spy_not_see_NA";
   150 
   151 
   151 
   152 
   164 by (etac ns_public.induct 1);
   165 by (etac ns_public.induct 1);
   165 by (ALLGOALS Asm_simp_tac);
   166 by (ALLGOALS Asm_simp_tac);
   166 (*NS1*)
   167 (*NS1*)
   167 by (blast_tac (claset() addSEs spies_partsEs) 2);
   168 by (blast_tac (claset() addSEs spies_partsEs) 2);
   168 (*Fake*)
   169 (*Fake*)
   169 by (blast_tac (claset() addSDs [impOfSubs Fake_parts_insert]
   170 by (blast_tac (claset() addDs [Spy_not_see_NA]) 1);
   170                        addDs  [Spy_not_see_NA, 
       
   171 			       impOfSubs analz_subset_parts]) 1);
       
   172 qed "A_trusts_NS2";
   171 qed "A_trusts_NS2";
   173 
   172 
   174 (*If the encrypted message appears then it originated with Alice in NS1*)
   173 (*If the encrypted message appears then it originated with Alice in NS1*)
   175 goal thy 
   174 goal thy 
   176  "!!evs. [| Crypt (pubK B) {|Nonce NA, Agent A|} : parts (spies evs); \
   175  "!!evs. [| Crypt (pubK B) {|Nonce NA, Agent A|} : parts (spies evs); \
   196 \      Crypt (pubK A) {|Nonce NA, Nonce NB, Agent B|} : parts (spies evs) \
   195 \      Crypt (pubK A) {|Nonce NA, Nonce NB, Agent B|} : parts (spies evs) \
   197 \         -->  A=A' & NA=NA' & B=B'";
   196 \         -->  A=A' & NA=NA' & B=B'";
   198 by (etac rev_mp 1);
   197 by (etac rev_mp 1);
   199 by (parts_induct_tac 1);
   198 by (parts_induct_tac 1);
   200 by (ALLGOALS
   199 by (ALLGOALS
   201     (asm_simp_tac (simpset() addsimps [all_conj_distrib, parts_insert_spies])));
   200     (asm_simp_tac (simpset() addsimps [all_conj_distrib, 
       
   201 				       parts_insert_spies])));
   202 (*NS2*)
   202 (*NS2*)
   203 by (expand_case_tac "NB = ?y" 2 THEN blast_tac (claset() addSEs partsEs) 2);
   203 by (expand_case_tac "NB = ?y" 2 THEN blast_tac (claset() addSEs partsEs) 2);
   204 (*Fake*)
   204 (*Fake*)
   205 by (Clarify_tac 1);
   205 by (Clarify_tac 1);
   206 by (ex_strip_tac 1);
   206 by (ex_strip_tac 1);
   226 \           A ~: bad;  B ~: bad;  evs : ns_public |]                \
   226 \           A ~: bad;  B ~: bad;  evs : ns_public |]                \
   227 \ ==> Nonce NB ~: analz (spies evs)";
   227 \ ==> Nonce NB ~: analz (spies evs)";
   228 by (etac rev_mp 1);
   228 by (etac rev_mp 1);
   229 by (analz_induct_tac 1);
   229 by (analz_induct_tac 1);
   230 (*NS3*)
   230 (*NS3*)
   231 by (blast_tac (claset() addDs [Says_imp_spies RS parts.Inj, unique_NB]) 4);
   231 by (blast_tac (claset() addDs [unique_NB]) 4);
   232 (*NS2: by freshness and unicity of NB*)
   232 (*NS2: by freshness and unicity of NB*)
   233 by (blast_tac (claset() addDs [Says_imp_spies RS parts.Inj]
   233 by (blast_tac (claset() addEs [no_nonce_NS1_NS2 RSN (2, rev_notE)]
   234                        addEs [no_nonce_NS1_NS2 RSN (2, rev_notE)]
   234                         addEs partsEs) 3);
   235                        addEs partsEs
       
   236 		       addIs [impOfSubs analz_subset_parts]) 3);
       
   237 (*NS1*)
   235 (*NS1*)
   238 by (blast_tac (claset() addSEs spies_partsEs) 2);
   236 by (blast_tac (claset() addSEs spies_partsEs) 2);
   239 (*Fake*)
   237 (*Fake*)
   240 by (spy_analz_tac 1);
   238 by (spy_analz_tac 1);
   241 qed "Spy_not_see_NB";
   239 qed "Spy_not_see_NB";
       
   240 
       
   241 AddDs [Spy_not_see_NB];
   242 
   242 
   243 
   243 
   244 (*Authentication for B: if he receives message 3 and has used NB
   244 (*Authentication for B: if he receives message 3 and has used NB
   245   in message 2, then A has sent message 3.*)
   245   in message 2, then A has sent message 3.*)
   246 goal thy 
   246 goal thy 
   252 by (etac rev_mp 1);
   252 by (etac rev_mp 1);
   253 (*prepare induction over Crypt (pubK B) NB : parts H*)
   253 (*prepare induction over Crypt (pubK B) NB : parts H*)
   254 by (etac (Says_imp_spies RS parts.Inj RS rev_mp) 1);
   254 by (etac (Says_imp_spies RS parts.Inj RS rev_mp) 1);
   255 by (parts_induct_tac 1);
   255 by (parts_induct_tac 1);
   256 by (ALLGOALS Clarify_tac);
   256 by (ALLGOALS Clarify_tac);
   257 (*NS3: because NB determines A (this use of unique_NB is more robust) *)
   257 (*NS3: because NB determines A*)
   258 by (blast_tac (claset() addDs [Says_imp_spies RS parts.Inj, Spy_not_see_NB]
   258 by (blast_tac (claset() addDs [unique_NB]) 3);
   259 			addIs [unique_NB RS conjunct1]) 3);
       
   260 (*NS1: by freshness*)
   259 (*NS1: by freshness*)
   261 by (blast_tac (claset() addSEs spies_partsEs) 2);
   260 by (blast_tac (claset() addSEs spies_partsEs) 2);
   262 (*Fake*)
   261 (*Fake*)
   263 by (blast_tac (claset() addSDs [impOfSubs Fake_parts_insert]
   262 by (Blast_tac 1);
   264                         addDs  [Spy_not_see_NB, 
       
   265 			        impOfSubs analz_subset_parts]) 1);
       
   266 qed "B_trusts_NS3";
   263 qed "B_trusts_NS3";
   267 
   264 
   268 
   265 
   269 (**** Overall guarantee for B*)
   266 (**** Overall guarantee for B*)
   270 
   267 
   286 by (etac (Says_imp_spies RS parts.Inj RS rev_mp) 1);
   283 by (etac (Says_imp_spies RS parts.Inj RS rev_mp) 1);
   287 by (etac ns_public.induct 1);
   284 by (etac ns_public.induct 1);
   288 by (ALLGOALS Asm_simp_tac);
   285 by (ALLGOALS Asm_simp_tac);
   289 by (ALLGOALS Clarify_tac);
   286 by (ALLGOALS Clarify_tac);
   290 (*NS3: because NB determines A and NA*)
   287 (*NS3: because NB determines A and NA*)
   291 by (blast_tac (claset() addDs [Says_imp_spies RS parts.Inj, 
   288 by (blast_tac (claset() addDs [unique_NB]) 3);
   292                                Spy_not_see_NB, unique_NB]) 3);
   289 (*NS1*)
   293 (*NS1*)
   290 by (blast_tac (claset() addSEs spies_partsEs) 2);
   294 by (blast_tac (claset() addSEs spies_partsEs) 2);
   291 (*Fake*)
   295 (*Fake*)
   292 by (Blast_tac 1);
   296 by (blast_tac (claset() addSDs [impOfSubs Fake_parts_insert]
       
   297                         addDs  [Spy_not_see_NB, 
       
   298 			        impOfSubs analz_subset_parts]) 1);
       
   299 qed "B_trusts_protocol";
   293 qed "B_trusts_protocol";
   300 
   294