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