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