| author | berghofe | 
| Wed, 06 Aug 1997 00:29:02 +0200 | |
| changeset 3605 | d372fb6ec393 | 
| parent 3519 | ab0a9fbed4c0 | 
| child 3675 | 70dd312b70b2 | 
| permissions | -rw-r--r-- | 
| 2318 | 1 | (* Title: HOL/Auth/NS_Public | 
| 2 | ID: $Id$ | |
| 3 | Author: Lawrence C Paulson, Cambridge University Computer Laboratory | |
| 4 | Copyright 1996 University of Cambridge | |
| 5 | ||
| 6 | Inductive relation "ns_public" for the Needham-Schroeder Public-Key protocol. | |
| 7 | Version incorporating Lowe's fix (inclusion of B's identify in round 2). | |
| 8 | *) | |
| 9 | ||
| 10 | open NS_Public; | |
| 11 | ||
| 12 | proof_timing:=true; | |
| 13 | HOL_quantifiers := false; | |
| 14 | ||
| 15 | AddIffs [Spy_in_lost]; | |
| 16 | ||
| 17 | (*A "possibility property": there are traces that reach the end*) | |
| 18 | goal thy | |
| 19 | "!!A B. A ~= B ==> EX NB. EX evs: ns_public. \ | |
| 3465 | 20 | \ Says A B (Crypt (pubK B) (Nonce NB)) : set evs"; | 
| 2318 | 21 | by (REPEAT (resolve_tac [exI,bexI] 1)); | 
| 22 | by (rtac (ns_public.Nil RS ns_public.NS1 RS ns_public.NS2 RS ns_public.NS3) 2); | |
| 2516 
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
 paulson parents: 
2497diff
changeset | 23 | by possibility_tac; | 
| 2318 | 24 | result(); | 
| 25 | ||
| 26 | ||
| 27 | (**** Inductive proofs about ns_public ****) | |
| 28 | ||
| 29 | (*Nobody sends themselves messages*) | |
| 3465 | 30 | goal thy "!!evs. evs : ns_public ==> ALL A X. Says A A X ~: set evs"; | 
| 2318 | 31 | by (etac ns_public.induct 1); | 
| 32 | by (Auto_tac()); | |
| 33 | qed_spec_mp "not_Says_to_self"; | |
| 34 | Addsimps [not_Says_to_self]; | |
| 35 | AddSEs [not_Says_to_self RSN (2, rev_notE)]; | |
| 36 | ||
| 37 | ||
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 38 | (*Induction for regularity theorems. If induction formula has the form | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 39 | X ~: analz (sees Spy evs) --> ... then it shortens the proof by discarding | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 40 | needless information about analz (insert X (sees Spy evs)) *) | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 41 | fun parts_induct_tac i = | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 42 | etac ns_public.induct i | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 43 | THEN | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 44 | REPEAT (FIRSTGOAL analz_mono_contra_tac) | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 45 | THEN | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 46 | prove_simple_subgoals_tac i; | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 47 | |
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 48 | |
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 49 | (** Theorems of the form X ~: parts (sees Spy evs) imply that NOBODY | 
| 2318 | 50 | sends messages containing X! **) | 
| 51 | ||
| 52 | (*Spy never sees another agent's private key! (unless it's lost at start)*) | |
| 53 | goal thy | |
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 54 | "!!A. evs: ns_public ==> (Key (priK A) : parts (sees Spy evs)) = (A : lost)"; | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 55 | by (parts_induct_tac 1); | 
| 3121 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 56 | by (Fake_parts_insert_tac 1); | 
| 2318 | 57 | qed "Spy_see_priK"; | 
| 58 | Addsimps [Spy_see_priK]; | |
| 59 | ||
| 60 | goal thy | |
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 61 | "!!A. evs: ns_public ==> (Key (priK A) : analz (sees Spy evs)) = (A : lost)"; | 
| 2318 | 62 | by (auto_tac(!claset addDs [impOfSubs analz_subset_parts], !simpset)); | 
| 63 | qed "Spy_analz_priK"; | |
| 64 | Addsimps [Spy_analz_priK]; | |
| 65 | ||
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 66 | goal thy "!!A. [| Key (priK A) : parts (sees Spy evs); \ | 
| 2318 | 67 | \ evs : ns_public |] ==> A:lost"; | 
| 3121 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 68 | by (blast_tac (!claset addDs [Spy_see_priK]) 1); | 
| 2318 | 69 | qed "Spy_see_priK_D"; | 
| 70 | ||
| 71 | bind_thm ("Spy_analz_priK_D", analz_subset_parts RS subsetD RS Spy_see_priK_D);
 | |
| 72 | AddSDs [Spy_see_priK_D, Spy_analz_priK_D]; | |
| 73 | ||
| 74 | ||
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 75 | (**** Authenticity properties obtained from NS2 ****) | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 76 | |
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 77 | (*It is impossible to re-use a nonce in both NS1 and NS2, provided the nonce | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 78 | is secret. (Honest users generate fresh nonces.)*) | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 79 | goal thy | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 80 |  "!!evs. [| Crypt (pubK B) {|Nonce NA, Agent A|} : parts (sees Spy evs); \
 | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 81 | \ Nonce NA ~: analz (sees Spy evs); \ | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 82 | \ evs : ns_public |] \ | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 83 | \ ==> Crypt (pubK C) {|NA', Nonce NA, Agent D|} ~: parts (sees Spy evs)";
 | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 84 | by (etac rev_mp 1); | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 85 | by (etac rev_mp 1); | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 86 | by (parts_induct_tac 1); | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 87 | (*NS3*) | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 88 | by (blast_tac (!claset addSEs partsEs) 3); | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 89 | (*NS2*) | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 90 | by (blast_tac (!claset addSEs partsEs) 2); | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 91 | by (Fake_parts_insert_tac 1); | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 92 | qed "no_nonce_NS1_NS2"; | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 93 | |
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 94 | |
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 95 | (*Unicity for NS1: nonce NA identifies agents A and B*) | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 96 | goal thy | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 97 | "!!evs. [| Nonce NA ~: analz (sees Spy evs); evs : ns_public |] \ | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 98 | \ ==> EX A' B'. ALL A B. \ | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 99 | \      Crypt (pubK B) {|Nonce NA, Agent A|} : parts (sees Spy evs) --> \
 | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 100 | \ A=A' & B=B'"; | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 101 | by (etac rev_mp 1); | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 102 | by (parts_induct_tac 1); | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 103 | by (ALLGOALS | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 104 | (asm_simp_tac (!simpset addsimps [all_conj_distrib, parts_insert_sees]))); | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 105 | (*NS1*) | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 106 | by (expand_case_tac "NA = ?y" 2 THEN blast_tac (!claset addSEs partsEs) 2); | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 107 | (*Fake*) | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 108 | by (step_tac (!claset addSIs [analz_insertI]) 1); | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 109 | by (ex_strip_tac 1); | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 110 | by (Fake_parts_insert_tac 1); | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 111 | val lemma = result(); | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 112 | |
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 113 | goal thy | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 114 |  "!!evs. [| Crypt(pubK B)  {|Nonce NA, Agent A|}  : parts(sees Spy evs); \
 | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 115 | \           Crypt(pubK B') {|Nonce NA, Agent A'|} : parts(sees Spy evs); \
 | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 116 | \ Nonce NA ~: analz (sees Spy evs); \ | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 117 | \ evs : ns_public |] \ | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 118 | \ ==> A=A' & B=B'"; | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 119 | by (prove_unique_tac lemma 1); | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 120 | qed "unique_NA"; | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 121 | |
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 122 | |
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 123 | (*Tactic for proving secrecy theorems*) | 
| 2418 
6b6a92d05fb2
New tactics: prove_unique_tac and analz_induct_tac
 paulson parents: 
2374diff
changeset | 124 | fun analz_induct_tac i = | 
| 3121 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 125 | etac ns_public.induct i THEN | 
| 2418 
6b6a92d05fb2
New tactics: prove_unique_tac and analz_induct_tac
 paulson parents: 
2374diff
changeset | 126 | ALLGOALS (asm_simp_tac | 
| 2516 
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
 paulson parents: 
2497diff
changeset | 127 | (!simpset addsimps [not_parts_not_analz] | 
| 2451 
ce85a2aafc7a
Extensive tidying and simplification, largely stemming from
 paulson parents: 
2418diff
changeset | 128 | setloop split_tac [expand_if])); | 
| 2318 | 129 | |
| 130 | ||
| 131 | (*Secrecy: Spy does not see the nonce sent in msg NS1 if A and B are secure*) | |
| 132 | goal thy | |
| 3466 
30791e5a69c4
Corrected indentations and margins after the renaming of "set_of_list"
 paulson parents: 
3465diff
changeset | 133 |  "!!evs. [| Says A B (Crypt(pubK B) {|Nonce NA, Agent A|}) : set evs;         \
 | 
| 2536 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 134 | \ A ~: lost; B ~: lost; evs : ns_public |] \ | 
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 135 | \ ==> Nonce NA ~: analz (sees Spy evs)"; | 
| 2536 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 136 | by (etac rev_mp 1); | 
| 2418 
6b6a92d05fb2
New tactics: prove_unique_tac and analz_induct_tac
 paulson parents: 
2374diff
changeset | 137 | by (analz_induct_tac 1); | 
| 2318 | 138 | (*NS3*) | 
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 139 | by (blast_tac (!claset addDs [Says_imp_sees_Spy RS parts.Inj] | 
| 3121 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 140 | addEs [no_nonce_NS1_NS2 RSN (2, rev_notE)]) 4); | 
| 2536 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 141 | (*NS2*) | 
| 3121 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 142 | by (blast_tac (!claset addSEs [MPair_parts] | 
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 143 | addDs [Says_imp_sees_Spy RS parts.Inj, | 
| 3121 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 144 | parts.Body, unique_NA]) 3); | 
| 2318 | 145 | (*NS1*) | 
| 3121 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 146 | by (blast_tac (!claset addSEs sees_Spy_partsEs | 
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 147 | addIs [impOfSubs analz_subset_parts]) 2); | 
| 2318 | 148 | (*Fake*) | 
| 2497 | 149 | by (spy_analz_tac 1); | 
| 2536 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 150 | qed "Spy_not_see_NA"; | 
| 2318 | 151 | |
| 152 | ||
| 153 | (*Authentication for A: if she receives message 2 and has used NA | |
| 154 | to start a run, then B has sent message 2.*) | |
| 155 | goal thy | |
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 156 |  "!!evs. [| Says A B (Crypt (pubK B) {|Nonce NA, Agent A|}) : set evs;  \
 | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 157 | \           Says B' A (Crypt(pubK A) {|Nonce NA, Nonce NB, Agent B|})   \
 | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 158 | \ : set evs; \ | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 159 | \ A ~: lost; B ~: lost; evs : ns_public |] \ | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 160 | \        ==> Says B A (Crypt(pubK A) {|Nonce NA, Nonce NB, Agent B|})   \
 | 
| 3465 | 161 | \ : set evs"; | 
| 2536 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 162 | by (etac rev_mp 1); | 
| 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 163 | (*prepare induction over Crypt (pubK A) {|NA,NB,B|} : parts H*)
 | 
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 164 | by (etac (Says_imp_sees_Spy RS parts.Inj RS rev_mp) 1); | 
| 2318 | 165 | by (etac ns_public.induct 1); | 
| 166 | by (ALLGOALS Asm_simp_tac); | |
| 167 | (*NS1*) | |
| 3121 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 168 | by (blast_tac (!claset addSEs sees_Spy_partsEs) 2); | 
| 2318 | 169 | (*Fake*) | 
| 3121 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 170 | by (blast_tac (!claset addSDs [impOfSubs Fake_parts_insert] | 
| 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 171 | addDs [Spy_not_see_NA, | 
| 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 172 | impOfSubs analz_subset_parts]) 1); | 
| 2318 | 173 | qed "A_trusts_NS2"; | 
| 174 | ||
| 175 | (*If the encrypted message appears then it originated with Alice in NS1*) | |
| 176 | goal thy | |
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 177 |  "!!evs. [| Crypt (pubK B) {|Nonce NA, Agent A|} : parts (sees Spy evs); \
 | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 178 | \ Nonce NA ~: analz (sees Spy evs); \ | 
| 2536 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 179 | \ evs : ns_public |] \ | 
| 3465 | 180 | \   ==> Says A B (Crypt (pubK B) {|Nonce NA, Agent A|}) : set evs";
 | 
| 2536 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 181 | by (etac rev_mp 1); | 
| 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 182 | by (etac rev_mp 1); | 
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 183 | by (parts_induct_tac 1); | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 184 | by (Fake_parts_insert_tac 1); | 
| 2536 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 185 | qed "B_trusts_NS1"; | 
| 2318 | 186 | |
| 187 | ||
| 188 | ||
| 189 | (**** Authenticity properties obtained from NS2 ****) | |
| 190 | ||
| 2480 | 191 | (*Unicity for NS2: nonce NB identifies nonce NA and agents A, B | 
| 2318 | 192 | [unicity of B makes Lowe's fix work] | 
| 193 | [proof closely follows that for unique_NA] *) | |
| 194 | goal thy | |
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 195 | "!!evs. [| Nonce NB ~: analz (sees Spy evs); evs : ns_public |] \ | 
| 2536 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 196 | \ ==> EX A' NA' B'. ALL A NA B. \ | 
| 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 197 | \      Crypt (pubK A) {|Nonce NA, Nonce NB, Agent B|}                       \
 | 
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 198 | \ : parts (sees Spy evs) --> A=A' & NA=NA' & B=B'"; | 
| 2536 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 199 | by (etac rev_mp 1); | 
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 200 | by (parts_induct_tac 1); | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 201 | by (ALLGOALS | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 202 | (asm_simp_tac (!simpset addsimps [all_conj_distrib, parts_insert_sees]))); | 
| 2318 | 203 | (*NS2*) | 
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 204 | by (expand_case_tac "NB = ?y" 2 THEN blast_tac (!claset addSEs partsEs) 2); | 
| 2318 | 205 | (*Fake*) | 
| 2374 | 206 | by (step_tac (!claset addSIs [analz_insertI]) 1); | 
| 2318 | 207 | by (ex_strip_tac 1); | 
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 208 | by (Fake_parts_insert_tac 1); | 
| 2318 | 209 | val lemma = result(); | 
| 210 | ||
| 211 | goal thy | |
| 212 |  "!!evs. [| Crypt(pubK A)  {|Nonce NA, Nonce NB, Agent B|}   \
 | |
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 213 | \ : parts(sees Spy evs); \ | 
| 2318 | 214 | \           Crypt(pubK A') {|Nonce NA', Nonce NB, Agent B'|} \
 | 
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 215 | \ : parts(sees Spy evs); \ | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 216 | \ Nonce NB ~: analz (sees Spy evs); \ | 
| 2318 | 217 | \ evs : ns_public |] \ | 
| 218 | \ ==> A=A' & NA=NA' & B=B'"; | |
| 2418 
6b6a92d05fb2
New tactics: prove_unique_tac and analz_induct_tac
 paulson parents: 
2374diff
changeset | 219 | by (prove_unique_tac lemma 1); | 
| 2318 | 220 | qed "unique_NB"; | 
| 221 | ||
| 222 | ||
| 223 | (*Secrecy: Spy does not see the nonce sent in msg NS2 if A and B are secure*) | |
| 224 | goal thy | |
| 2536 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 225 |  "!!evs. [| Says B A (Crypt (pubK A) {|Nonce NA, Nonce NB, Agent B|}) \
 | 
| 3466 
30791e5a69c4
Corrected indentations and margins after the renaming of "set_of_list"
 paulson parents: 
3465diff
changeset | 226 | \ : set evs; \ | 
| 2536 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 227 | \ A ~: lost; B ~: lost; evs : ns_public |] \ | 
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 228 | \ ==> Nonce NB ~: analz (sees Spy evs)"; | 
| 2536 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 229 | by (etac rev_mp 1); | 
| 2418 
6b6a92d05fb2
New tactics: prove_unique_tac and analz_induct_tac
 paulson parents: 
2374diff
changeset | 230 | by (analz_induct_tac 1); | 
| 2318 | 231 | (*NS3*) | 
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 232 | by (blast_tac (!claset addDs [Says_imp_sees_Spy RS parts.Inj, unique_NB]) 4); | 
| 2318 | 233 | (*NS1*) | 
| 3121 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 234 | by (blast_tac (!claset addSEs sees_Spy_partsEs) 2); | 
| 2318 | 235 | (*Fake*) | 
| 2497 | 236 | by (spy_analz_tac 1); | 
| 2318 | 237 | (*NS2*) | 
| 238 | by (Step_tac 1); | |
| 3121 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 239 | by (blast_tac (!claset addSEs sees_Spy_partsEs) 3); | 
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 240 | by (blast_tac (!claset addSDs [Says_imp_sees_Spy RS parts.Inj] | 
| 3121 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 241 | addEs [no_nonce_NS1_NS2 RSN (2, rev_notE)]) 2); | 
| 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 242 | by (blast_tac (!claset addSIs [impOfSubs analz_subset_parts]) 1); | 
| 2536 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 243 | qed "Spy_not_see_NB"; | 
| 2318 | 244 | |
| 245 | ||
| 246 | (*Authentication for B: if he receives message 3 and has used NB | |
| 247 | in message 2, then A has sent message 3.*) | |
| 248 | goal thy | |
| 2536 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 249 |  "!!evs. [| Says B A  (Crypt (pubK A) {|Nonce NA, Nonce NB, Agent B|}) \
 | 
| 3466 
30791e5a69c4
Corrected indentations and margins after the renaming of "set_of_list"
 paulson parents: 
3465diff
changeset | 250 | \ : set evs; \ | 
| 
30791e5a69c4
Corrected indentations and margins after the renaming of "set_of_list"
 paulson parents: 
3465diff
changeset | 251 | \ Says A' B (Crypt (pubK B) (Nonce NB)): set evs; \ | 
| 2536 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 252 | \ A ~: lost; B ~: lost; evs : ns_public |] \ | 
| 3465 | 253 | \ ==> Says A B (Crypt (pubK B) (Nonce NB)) : set evs"; | 
| 2536 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 254 | by (etac rev_mp 1); | 
| 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 255 | (*prepare induction over Crypt (pubK B) NB : parts H*) | 
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 256 | by (etac (Says_imp_sees_Spy RS parts.Inj RS rev_mp) 1); | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 257 | by (parts_induct_tac 1); | 
| 2318 | 258 | (*NS1*) | 
| 3121 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 259 | by (blast_tac (!claset addSEs sees_Spy_partsEs) 2); | 
| 2318 | 260 | (*Fake*) | 
| 3121 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 261 | by (blast_tac (!claset addSDs [impOfSubs Fake_parts_insert] | 
| 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 262 | addDs [Spy_not_see_NB, | 
| 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 263 | impOfSubs analz_subset_parts]) 1); | 
| 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 264 | (*NS3; not clear why blast_tac needs to be preceeded by Step_tac*) | 
| 2318 | 265 | by (Step_tac 1); | 
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 266 | by (blast_tac (!claset addDs [Says_imp_sees_Spy RS parts.Inj, | 
| 3121 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 267 | Spy_not_see_NB, unique_NB]) 1); | 
| 2318 | 268 | qed "B_trusts_NS3"; | 
| 269 | ||
| 270 | ||
| 271 | (**** Overall guarantee for B*) | |
| 272 | ||
| 3121 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 273 | (*Matches only NS2, not NS1 (or NS3)*) | 
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 274 | val Says_imp_sees_Spy' = | 
| 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 275 |     read_instantiate [("X","Crypt ?K {|?XX,?YY,?ZZ|}")] Says_imp_sees_Spy;
 | 
| 3121 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 276 | |
| 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 277 | |
| 2318 | 278 | (*If B receives NS3 and the nonce NB agrees with the nonce he joined with | 
| 2536 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 279 | NA, then A initiated the run using NA. SAME proof as B_trusts_NS3!*) | 
| 2318 | 280 | goal thy | 
| 2536 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 281 |  "!!evs. [| Says B A  (Crypt (pubK A) {|Nonce NA, Nonce NB, Agent B|}) \
 | 
| 3466 
30791e5a69c4
Corrected indentations and margins after the renaming of "set_of_list"
 paulson parents: 
3465diff
changeset | 282 | \ : set evs; \ | 
| 
30791e5a69c4
Corrected indentations and margins after the renaming of "set_of_list"
 paulson parents: 
3465diff
changeset | 283 | \ Says A' B (Crypt (pubK B) (Nonce NB)): set evs; \ | 
| 2536 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 284 | \ A ~: lost; B ~: lost; evs : ns_public |] \ | 
| 3465 | 285 | \    ==> Says A B (Crypt (pubK B) {|Nonce NA, Agent A|}) : set evs";
 | 
| 2536 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 286 | by (etac rev_mp 1); | 
| 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 287 | (*prepare induction over Crypt (pubK B) {|NB|} : parts H*)
 | 
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 288 | by (etac (Says_imp_sees_Spy RS parts.Inj RS rev_mp) 1); | 
| 2318 | 289 | by (etac ns_public.induct 1); | 
| 290 | by (ALLGOALS Asm_simp_tac); | |
| 291 | (*Fake, NS2, NS3*) | |
| 292 | (*NS1*) | |
| 3121 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 293 | by (blast_tac (!claset addSEs sees_Spy_partsEs) 2); | 
| 2318 | 294 | (*Fake*) | 
| 295 | by (REPEAT_FIRST (resolve_tac [impI, conjI])); | |
| 3121 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 296 | by (Blast_tac 1); | 
| 2318 | 297 | by (forward_tac [Spy_not_see_NB] 1 THEN REPEAT (assume_tac 1)); | 
| 3121 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 298 | by (blast_tac (!claset addSIs [disjI2] | 
| 2516 
4d68fbe6378b
Now with Andy Gordon's treatment of freshness to replace newN/K
 paulson parents: 
2497diff
changeset | 299 | addDs [impOfSubs analz_subset_parts, | 
| 3121 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 300 | impOfSubs Fake_parts_insert]) 1); | 
| 2318 | 301 | (*NS3*) | 
| 302 | by (Step_tac 1); | |
| 303 | by (forward_tac [Spy_not_see_NB] 1 THEN REPEAT (assume_tac 1)); | |
| 3519 
ab0a9fbed4c0
Changing "lost" from a parameter of protocol definitions to a constant.
 paulson parents: 
3516diff
changeset | 304 | by (blast_tac (!claset addSDs [Says_imp_sees_Spy' RS parts.Inj] | 
| 3121 
cbb6c0c1c58a
Conversion to use blast_tac (with other improvements)
 paulson parents: 
2637diff
changeset | 305 | addDs [unique_NB]) 1); | 
| 2536 
1e04eb7f7eb1
Tidied proofs by using "etac rev_mp" instead of applying rev_mp to result()
 paulson parents: 
2516diff
changeset | 306 | qed "B_trusts_protocol"; | 
| 2318 | 307 |