--- a/src/HOL/Auth/OtwayRees.ML Fri Jan 17 11:50:09 1997 +0100
+++ b/src/HOL/Auth/OtwayRees.ML Fri Jan 17 12:49:31 1997 +0100
@@ -26,9 +26,7 @@
\ : set_of_list evs";
by (REPEAT (resolve_tac [exI,bexI] 1));
by (rtac (otway.Nil RS otway.OR1 RS otway.OR2 RS otway.OR3 RS otway.OR4) 2);
-by (ALLGOALS (simp_tac (!simpset setsolver safe_solver)));
-by (REPEAT_FIRST (resolve_tac [refl, conjI]));
-by (REPEAT_FIRST (fast_tac (!claset addss (!simpset setsolver safe_solver))));
+by possibility_tac;
result();
@@ -59,15 +57,14 @@
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]) 1);
qed "OR2_analz_sees_Spy";
-goal thy "!!evs. Says S B {|N, X, X'|} : set_of_list evs \
+goal thy "!!evs. Says S B {|N, X, Crypt (shrK B) X'|} : set_of_list evs \
\ ==> X : analz (sees lost Spy evs)";
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]) 1);
qed "OR4_analz_sees_Spy";
goal thy "!!evs. Says Server B {|NA, X, Crypt K' {|NB,K|}|} : set_of_list evs \
\ ==> K : parts (sees lost Spy evs)";
-by (fast_tac (!claset addSEs partsEs
- addSDs [Says_imp_sees_Spy RS parts.Inj]) 1);
+by (fast_tac (!claset addSEs sees_Spy_partsEs) 1);
qed "Oops_parts_sees_Spy";
(*OR2_analz... and OR4_analz... let us treat those cases using the same
@@ -84,9 +81,9 @@
harder to complete, since simplification does less for us.*)
val parts_Fake_tac =
let val tac = forw_inst_tac [("lost","lost")]
- in tac OR2_parts_sees_Spy 4 THEN
- tac OR4_parts_sees_Spy 6 THEN
- tac Oops_parts_sees_Spy 7
+ in tac OR2_parts_sees_Spy 4 THEN
+ tac OR4_parts_sees_Spy 6 THEN
+ tac Oops_parts_sees_Spy 7
end;
(*For proving the easier theorems about X ~: parts (sees lost Spy evs) *)
@@ -128,77 +125,18 @@
AddSDs [Spy_see_shrK_D, Spy_analz_shrK_D];
-(*** Future keys can't be seen or used! ***)
-
-(*Nobody can have SEEN keys that will be generated in the future. *)
-goal thy "!!i. evs : otway lost ==> \
-\ length evs <= i --> Key (newK i) ~: parts (sees lost Spy evs)";
-by (parts_induct_tac 1);
-by (REPEAT_FIRST (best_tac (!claset addEs [leD RS notE]
- addDs [impOfSubs analz_subset_parts,
- impOfSubs parts_insert_subset_Un,
- Suc_leD]
- addss (!simpset))));
-qed_spec_mp "new_keys_not_seen";
-Addsimps [new_keys_not_seen];
-
-(*Variant: old messages must contain old keys!*)
-goal thy
- "!!evs. [| Says A B X : set_of_list evs; \
-\ Key (newK i) : parts {X}; \
-\ evs : otway lost \
-\ |] ==> i < length evs";
-by (rtac ccontr 1);
-by (dtac leI 1);
-by (fast_tac (!claset addSDs [new_keys_not_seen, Says_imp_sees_Spy]
- addIs [impOfSubs parts_mono]) 1);
-qed "Says_imp_old_keys";
-
-
-(*** Future nonces can't be seen or used! ***)
-
-goal thy "!!evs. evs : otway lost ==> \
-\ length evs <= i --> \
-\ Nonce (newN i) ~: parts (sees lost Spy evs)";
+(*Nobody can have used non-existent keys!*)
+goal thy "!!evs. evs : otway lost ==> \
+\ Key K ~: used evs --> K ~: keysFor (parts (sees lost Spy evs))";
by (parts_induct_tac 1);
-by (REPEAT_FIRST (fast_tac (!claset
- addSEs partsEs
- addSDs [Says_imp_sees_Spy RS parts.Inj]
- addEs [leD RS notE]
- addDs [impOfSubs analz_subset_parts,
- impOfSubs parts_insert_subset_Un,
- Suc_leD]
- addss (!simpset))));
-qed_spec_mp "new_nonces_not_seen";
-Addsimps [new_nonces_not_seen];
-
-(*Variant: old messages must contain old nonces!*)
-goal thy "!!evs. [| Says A B X : set_of_list evs; \
-\ Nonce (newN i) : parts {X}; \
-\ evs : otway lost \
-\ |] ==> i < length evs";
-by (rtac ccontr 1);
-by (dtac leI 1);
-by (fast_tac (!claset addSDs [new_nonces_not_seen, Says_imp_sees_Spy]
- addIs [impOfSubs parts_mono]) 1);
-qed "Says_imp_old_nonces";
-
-
-(*Nobody can have USED keys that will be generated in the future.
- ...very like new_keys_not_seen*)
-goal thy "!!i. evs : otway lost ==> \
-\ length evs <= i --> newK i ~: keysFor(parts(sees lost Spy evs))";
-by (parts_induct_tac 1);
-(*OR1 and OR3*)
-by (EVERY (map (fast_tac (!claset addDs [Suc_leD] addss (!simpset))) [4,2]));
-(*Fake, OR2, OR4: these messages send unknown (X) components*)
-by (REPEAT
- (best_tac
- (!claset addDs [impOfSubs (analz_subset_parts RS keysFor_mono),
- impOfSubs (parts_insert_subset_Un RS keysFor_mono),
- Suc_leD]
- addEs [new_keys_not_seen RS not_parts_not_analz RSN(2,rev_notE)]
- addss (!simpset)) 1));
+(*Fake*)
+by (best_tac
+ (!claset addIs [impOfSubs analz_subset_parts]
+ addDs [impOfSubs (analz_subset_parts RS keysFor_mono),
+ impOfSubs (parts_insert_subset_Un RS keysFor_mono)]
+ addss (!simpset)) 1);
+(*OR1-3*)
+by (REPEAT (fast_tac (!claset addss (!simpset)) 1));
qed_spec_mp "new_keys_not_used";
bind_thm ("new_keys_not_analzd",
@@ -214,11 +152,10 @@
(*Describes the form of K and NA when the Server sends this message. Also
for Oops case.*)
goal thy
- "!!evs. [| Says Server B \
-\ {|NA, X, Crypt (shrK B) {|NB, K|}|} : set_of_list evs; \
+ "!!evs. [| Says Server B \
+\ {|NA, X, Crypt (shrK B) {|NB, Key K|}|} : set_of_list evs; \
\ evs : otway lost |] \
-\ ==> (EX n. K = Key(newK n)) & \
-\ (EX i. NA = Nonce i) & (EX j. NB = Nonce j)";
+\ ==> K ~: range shrK & (EX i. NA = Nonce i) & (EX j. NB = Nonce j)";
by (etac rev_mp 1);
by (etac otway.induct 1);
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
@@ -230,14 +167,14 @@
dres_inst_tac [("lost","lost")] OR2_analz_sees_Spy 4 THEN
dres_inst_tac [("lost","lost")] OR4_analz_sees_Spy 6 THEN
forw_inst_tac [("lost","lost")] Says_Server_message_form 7 THEN
- assume_tac 7 THEN Full_simp_tac 7 THEN
+ assume_tac 7 THEN
REPEAT ((eresolve_tac [exE, conjE] ORELSE' hyp_subst_tac) 7);
(****
The following is to prove theorems of the form
- Key K : analz (insert (Key (newK i)) (sees lost Spy evs)) ==>
+ Key K : analz (insert (Key KAB) (sees lost Spy evs)) ==>
Key K : analz (sees lost Spy evs)
A more general formula must be proved inductively.
@@ -248,32 +185,28 @@
(*The equality makes the induction hypothesis easier to apply*)
goal thy
- "!!evs. evs : otway lost ==> \
-\ ALL K E. (Key K : analz (Key``(newK``E) Un (sees lost Spy evs))) = \
-\ (K : newK``E | Key K : analz (sees lost Spy evs))";
+ "!!evs. evs : otway lost ==> \
+\ ALL K KK. KK <= Compl (range shrK) --> \
+\ (Key K : analz (Key``KK Un (sees lost Spy evs))) = \
+\ (K : KK | Key K : analz (sees lost Spy evs))";
by (etac otway.induct 1);
by analz_Fake_tac;
-by (REPEAT_FIRST (ares_tac [allI, analz_image_newK_lemma]));
-by (ALLGOALS (*Takes 11 secs*)
- (asm_simp_tac
- (!simpset addsimps [Un_assoc RS sym,
- insert_Key_singleton, insert_Key_image, pushKey_newK]
- setloop split_tac [expand_if])));
-(*OR4, OR2, Fake*)
-by (EVERY (map spy_analz_tac [5,3,2]));
-(*Oops, OR3, Base*)
-by (REPEAT (fast_tac (!claset addIs [image_eqI] addss (!simpset)) 1));
-qed_spec_mp "analz_image_newK";
+by (REPEAT_FIRST (resolve_tac [allI, impI]));
+by (REPEAT_FIRST (rtac analz_image_freshK_lemma ));
+by (ALLGOALS (asm_simp_tac analz_image_freshK_ss));
+(*Base*)
+by (fast_tac (!claset addIs [image_eqI] addss (!simpset)) 1);
+(*Fake, OR2, OR4*)
+by (REPEAT (spy_analz_tac 1));
+qed_spec_mp "analz_image_freshK";
goal thy
- "!!evs. evs : otway lost ==> \
-\ Key K : analz (insert (Key(newK i)) (sees lost Spy evs)) = \
-\ (K = newK i | Key K : analz (sees lost Spy evs))";
-by (asm_simp_tac (HOL_ss addsimps [pushKey_newK, analz_image_newK,
- insert_Key_singleton]) 1);
-by (Fast_tac 1);
-qed "analz_insert_Key_newK";
+ "!!evs. [| evs : otway lost; KAB ~: range shrK |] ==> \
+\ Key K : analz (insert (Key KAB) (sees lost Spy evs)) = \
+\ (K = KAB | Key K : analz (sees lost Spy evs))";
+by (asm_simp_tac (analz_image_freshK_ss addsimps [analz_image_freshK]) 1);
+qed "analz_insert_freshK";
(*** The Key K uniquely identifies the Server's message. **)
@@ -291,8 +224,8 @@
by (Fast_tac 2);
by (expand_case_tac "K = ?y" 1);
by (REPEAT (ares_tac [refl,exI,impI,conjI] 2));
-(*...we assume X is a very new message, and handle this case by contradiction*)
-by (fast_tac (!claset addEs [Says_imp_old_keys RS less_irrefl]
+(*...we assume X is a recent message, and handle this case by contradiction*)
+by (fast_tac (!claset addSEs sees_Spy_partsEs
delrules [conjI] (*prevent split-up into 4 subgoals*)
addss (!simpset addsimps [parts_insertI])) 1);
val lemma = result();
@@ -333,8 +266,7 @@
by (simp_tac (!simpset addsimps [all_conj_distrib]) 1);
(*OR1: creation of new Nonce. Move assertion into global context*)
by (expand_case_tac "NA = ?y" 1);
-by (best_tac (!claset addSEs partsEs
- addEs [new_nonces_not_seen RSN(2,rev_notE)]) 1);
+by (best_tac (!claset addSEs sees_Spy_partsEs) 1);
val lemma = result();
goal thy
@@ -346,8 +278,6 @@
qed "unique_NA";
-val nonce_not_seen_now = le_refl RSN (2, new_nonces_not_seen) RSN (2,rev_notE);
-
(*It is impossible to re-use a nonce in both OR1 and OR2. This holds because
OR2 encrypts Nonce NB. It prevents the attack that can occur in the
over-simplified version of this protocol: see OtwayRees_Bad.*)
@@ -358,7 +288,7 @@
\ Crypt (shrK A) {|NA', NA, Agent A', Agent A|} \
\ ~: parts (sees lost Spy evs)";
by (parts_induct_tac 1);
-by (REPEAT (fast_tac (!claset addSEs (partsEs@[nonce_not_seen_now])
+by (REPEAT (fast_tac (!claset addSEs sees_Spy_partsEs
addSDs [impOfSubs parts_insert_subset_Un]
addss (!simpset)) 1));
qed_spec_mp"no_nonce_OR1_OR2";
@@ -380,16 +310,14 @@
by (parts_induct_tac 1);
(*OR1: it cannot be a new Nonce, contradiction.*)
by (fast_tac (!claset addSIs [parts_insertI]
- addSEs partsEs
- addEs [Says_imp_old_nonces RS less_irrefl]
+ addSEs sees_Spy_partsEs
addss (!simpset)) 1);
(*OR3 and OR4*)
(*OR4*)
by (REPEAT (Safe_step_tac 2));
by (REPEAT (best_tac (!claset addSDs [parts_cut]) 3));
by (fast_tac (!claset addSIs [Crypt_imp_OR1]
- addEs partsEs
- addDs [Says_imp_sees_Spy RS parts.Inj]) 2);
+ addEs sees_Spy_partsEs) 2);
(*OR3*) (** LEVEL 5 **)
by (asm_simp_tac (!simpset addsimps [ex_disj_distrib]) 1);
by (step_tac (!claset delrules [disjCI, impCE]) 1);
@@ -420,8 +348,7 @@
\ Crypt (shrK B) {|NB, Key K|}|} \
\ : set_of_list evs";
by (fast_tac (!claset addSIs [NA_Crypt_imp_Server_msg]
- addEs partsEs
- addDs [Says_imp_sees_Spy RS parts.Inj]) 1);
+ addEs sees_Spy_partsEs) 1);
qed "A_trusts_OR4";
@@ -439,11 +366,13 @@
by (etac otway.induct 1);
by analz_Fake_tac;
by (ALLGOALS
- (asm_simp_tac (!simpset addsimps [not_parts_not_analz,
- analz_insert_Key_newK]
- setloop split_tac [expand_if])));
+ (asm_simp_tac (!simpset addcongs [conj_cong]
+ addsimps [not_parts_not_analz, analz_insert_freshK]
+ setloop split_tac [expand_if])));
(*OR3*)
-by (fast_tac (!claset addEs [Says_imp_old_keys RS less_irrefl]
+by (fast_tac (!claset delrules [impCE]
+ addSEs sees_Spy_partsEs
+ addIs [impOfSubs analz_subset_parts]
addss (!simpset addsimps [parts_insert2])) 3);
(*OR4, OR2, Fake*)
by (REPEAT_FIRST spy_analz_tac);
@@ -453,12 +382,12 @@
val lemma = result() RS mp RS mp RSN(2,rev_notE);
goal thy
- "!!evs. [| Says Server B \
-\ {|NA, Crypt (shrK A) {|NA, K|}, \
-\ Crypt (shrK B) {|NB, K|}|} : set_of_list evs; \
-\ Says B Spy {|NA, NB, K|} ~: set_of_list evs; \
+ "!!evs. [| Says Server B \
+\ {|NA, Crypt (shrK A) {|NA, Key K|}, \
+\ Crypt (shrK B) {|NB, Key K|}|} : set_of_list evs; \
+\ Says B Spy {|NA, NB, Key K|} ~: set_of_list evs; \
\ A ~: lost; B ~: lost; evs : otway lost |] \
-\ ==> K ~: analz (sees lost Spy evs)";
+\ ==> Key K ~: analz (sees lost Spy evs)";
by (forward_tac [Says_Server_message_form] 1 THEN assume_tac 1);
by (fast_tac (!claset addSEs [lemma]) 1);
qed "Spy_not_see_encrypted_key";
@@ -467,11 +396,11 @@
goal thy
"!!evs. [| C ~: {A,B,Server}; \
\ Says Server B \
-\ {|NA, Crypt (shrK A) {|NA, K|}, \
-\ Crypt (shrK B) {|NB, K|}|} : set_of_list evs; \
-\ Says B Spy {|NA, NB, K|} ~: set_of_list evs; \
+\ {|NA, Crypt (shrK A) {|NA, Key K|}, \
+\ Crypt (shrK B) {|NB, Key K|}|} : set_of_list evs; \
+\ Says B Spy {|NA, NB, Key K|} ~: set_of_list evs; \
\ A ~: lost; B ~: lost; evs : otway lost |] \
-\ ==> K ~: analz (sees lost C evs)";
+\ ==> Key K ~: analz (sees lost C evs)";
by (rtac (subset_insertI RS sees_mono RS analz_mono RS contra_subsetD) 1);
by (rtac (sees_lost_agent_subset_sees_Spy RS analz_mono RS contra_subsetD) 1);
by (FIRSTGOAL (rtac Spy_not_see_encrypted_key));
@@ -507,7 +436,7 @@
by (simp_tac (!simpset addsimps [all_conj_distrib]) 1);
(*OR2: creation of new Nonce. Move assertion into global context*)
by (expand_case_tac "NB = ?y" 1);
-by (fast_tac (!claset addSEs (nonce_not_seen_now::partsEs)) 1);
+by (deepen_tac (!claset addSEs sees_Spy_partsEs) 3 1);
val lemma = result();
goal thy
@@ -537,8 +466,7 @@
by (parts_induct_tac 1);
(*OR1: it cannot be a new Nonce, contradiction.*)
by (fast_tac (!claset addSIs [parts_insertI]
- addSEs partsEs
- addEs [Says_imp_old_nonces RS less_irrefl]
+ addSEs sees_Spy_partsEs
addss (!simpset)) 1);
(*OR4*)
by (fast_tac (!claset addSEs [MPair_parts, Crypt_imp_OR2]) 2);
@@ -570,8 +498,7 @@
\ Crypt (shrK B) {|NB, Key K|}|} \
\ : set_of_list evs";
by (fast_tac (!claset addSIs [NB_Crypt_imp_Server_msg]
- addEs partsEs
- addDs [Says_imp_sees_Spy RS parts.Inj]) 1);
+ addEs sees_Spy_partsEs) 1);
qed "B_trusts_OR3";