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