src/HOL/Auth/Yahalom.ML
author paulson
Fri, 17 Jan 1997 12:49:31 +0100
changeset 2516 4d68fbe6378b
parent 2454 92f43ed48935
child 2637 e9b203f854ae
permissions -rw-r--r--
Now with Andy Gordon's treatment of freshness to replace newN/K
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1995
c80e58e78d9c Addition of Yahalom protocol
paulson
parents: 1985
diff changeset
     1
(*  Title:      HOL/Auth/Yahalom
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
     2
    ID:         $Id$
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
     4
    Copyright   1996  University of Cambridge
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
     5
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
     6
Inductive relation "otway" for the Yahalom protocol.
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
     7
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
     8
From page 257 of
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
     9
  Burrows, Abadi and Needham.  A Logic of Authentication.
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    10
  Proc. Royal Soc. 426 (1989)
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    11
*)
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    12
1995
c80e58e78d9c Addition of Yahalom protocol
paulson
parents: 1985
diff changeset
    13
open Yahalom;
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    14
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    15
proof_timing:=true;
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    16
HOL_quantifiers := false;
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
    17
Pretty.setdepth 25;
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    18
1995
c80e58e78d9c Addition of Yahalom protocol
paulson
parents: 1985
diff changeset
    19
2322
fbe6dd4abddc Trivial renamings
paulson
parents: 2284
diff changeset
    20
(*A "possibility property": there are traces that reach the end*)
1995
c80e58e78d9c Addition of Yahalom protocol
paulson
parents: 1985
diff changeset
    21
goal thy 
c80e58e78d9c Addition of Yahalom protocol
paulson
parents: 1985
diff changeset
    22
 "!!A B. [| A ~= B; A ~= Server; B ~= Server |]   \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    23
\        ==> EX X NB K. EX evs: yahalom lost.          \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
    24
\               Says A B {|X, Crypt K (Nonce NB)|} : set_of_list evs";
1995
c80e58e78d9c Addition of Yahalom protocol
paulson
parents: 1985
diff changeset
    25
by (REPEAT (resolve_tac [exI,bexI] 1));
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
    26
by (rtac (yahalom.Nil RS yahalom.YM1 RS yahalom.YM2 RS yahalom.YM3 RS 
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
    27
          yahalom.YM4) 2);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
    28
by possibility_tac;
2013
4b7a432fb3ed Proof of Says_imp_old_keys is now more robust
paulson
parents: 2001
diff changeset
    29
result();
1995
c80e58e78d9c Addition of Yahalom protocol
paulson
parents: 1985
diff changeset
    30
c80e58e78d9c Addition of Yahalom protocol
paulson
parents: 1985
diff changeset
    31
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    32
(**** Inductive proofs about yahalom ****)
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    33
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
    34
(*Monotonicity*)
2045
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
    35
goal thy "!!evs. lost' <= lost ==> yahalom lost' <= yahalom lost";
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
    36
by (rtac subsetI 1);
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
    37
by (etac yahalom.induct 1);
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
    38
by (REPEAT_FIRST
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
    39
    (best_tac (!claset addIs (impOfSubs (sees_mono RS analz_mono RS synth_mono)
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
    40
                              :: yahalom.intrs))));
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
    41
qed "yahalom_mono";
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
    42
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    43
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    44
(*Nobody sends themselves messages*)
2051
067bf19a71b7 Simplified main theorem by abstracting out newK
paulson
parents: 2045
diff changeset
    45
goal thy "!!evs. evs: yahalom lost ==> ALL A X. Says A A X ~: set_of_list evs";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    46
by (etac yahalom.induct 1);
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    47
by (Auto_tac());
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    48
qed_spec_mp "not_Says_to_self";
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    49
Addsimps [not_Says_to_self];
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    50
AddSEs   [not_Says_to_self RSN (2, rev_notE)];
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    51
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    52
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    53
(** For reasoning about the encrypted portion of messages **)
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    54
1995
c80e58e78d9c Addition of Yahalom protocol
paulson
parents: 1985
diff changeset
    55
(*Lets us treat YM4 using a similar argument as for the Fake case.*)
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
    56
goal thy "!!evs. Says S A {|Crypt (shrK A) Y, X|} : set_of_list evs ==> \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    57
\                X : analz (sees lost Spy evs)";
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    58
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]) 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    59
qed "YM4_analz_sees_Spy";
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    60
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
    61
bind_thm ("YM4_parts_sees_Spy",
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
    62
          YM4_analz_sees_Spy RS (impOfSubs analz_subset_parts));
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
    63
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
    64
(*Relates to both YM4 and Oops*)
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
    65
goal thy "!!evs. Says S A {|Crypt (shrK A) {|B, K, NA, NB|}, X|} \
1995
c80e58e78d9c Addition of Yahalom protocol
paulson
parents: 1985
diff changeset
    66
\                  : set_of_list evs ==> \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    67
\                K : parts (sees lost Spy evs)";
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    68
by (fast_tac (!claset addSEs partsEs
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    69
                      addSDs [Says_imp_sees_Spy RS parts.Inj]) 1);
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
    70
qed "YM4_Key_parts_sees_Spy";
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
    71
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
    72
(*We instantiate the variable to "lost".  Leaving it as a Var makes proofs
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
    73
  harder: the simplifier does less.*)
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
    74
val parts_Fake_tac = 
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
    75
    forw_inst_tac [("lost","lost")] YM4_parts_sees_Spy 6 THEN
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
    76
    forw_inst_tac [("lost","lost")] YM4_Key_parts_sees_Spy 7;
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    77
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
    78
(*For proving the easier theorems about X ~: parts (sees lost Spy evs) *)
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
    79
fun parts_induct_tac i = SELECT_GOAL
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
    80
    (DETERM (etac yahalom.induct 1 THEN parts_Fake_tac THEN
2170
c5e460f1ebb4 Ran expandshort
paulson
parents: 2160
diff changeset
    81
             (*Fake message*)
c5e460f1ebb4 Ran expandshort
paulson
parents: 2160
diff changeset
    82
             TRY (best_tac (!claset addDs [impOfSubs analz_subset_parts,
c5e460f1ebb4 Ran expandshort
paulson
parents: 2160
diff changeset
    83
                                           impOfSubs Fake_parts_insert]
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
    84
                                    addss (!simpset)) 2)) THEN
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
    85
     (*Base case*)
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
    86
     fast_tac (!claset addss (!simpset)) 1 THEN
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
    87
     ALLGOALS Asm_simp_tac) i;
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    88
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    89
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
    90
(** Theorems of the form X ~: parts (sees lost Spy evs) imply that NOBODY
2013
4b7a432fb3ed Proof of Says_imp_old_keys is now more robust
paulson
parents: 2001
diff changeset
    91
    sends messages containing X! **)
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    92
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
    93
(*Spy never sees another agent's shared key! (unless it's lost at start)*)
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    94
goal thy 
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
    95
 "!!evs. evs : yahalom lost \
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
    96
\        ==> (Key (shrK A) : parts (sees lost Spy evs)) = (A : lost)";
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
    97
by (parts_induct_tac 1);
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
    98
by (Auto_tac());
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
    99
qed "Spy_see_shrK";
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   100
Addsimps [Spy_see_shrK];
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   101
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   102
goal thy 
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   103
 "!!evs. evs : yahalom lost \
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   104
\        ==> (Key (shrK A) : analz (sees lost Spy evs)) = (A : lost)";
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   105
by (auto_tac(!claset addDs [impOfSubs analz_subset_parts], !simpset));
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   106
qed "Spy_analz_shrK";
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   107
Addsimps [Spy_analz_shrK];
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   108
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   109
goal thy  "!!A. [| Key (shrK A) : parts (sees lost Spy evs);       \
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   110
\                  evs : yahalom lost |] ==> A:lost";
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   111
by (fast_tac (!claset addDs [Spy_see_shrK]) 1);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   112
qed "Spy_see_shrK_D";
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   113
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   114
bind_thm ("Spy_analz_shrK_D", analz_subset_parts RS subsetD RS Spy_see_shrK_D);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   115
AddSDs [Spy_see_shrK_D, Spy_analz_shrK_D];
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   116
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   117
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   118
(*Nobody can have used non-existent keys!*)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   119
goal thy "!!evs. evs : yahalom lost ==>          \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   120
\         Key K ~: used evs --> K ~: keysFor (parts (sees lost Spy evs))";
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   121
by (parts_induct_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   122
(*YM4: Key K is not fresh!*)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   123
by (fast_tac (!claset addSEs sees_Spy_partsEs) 3);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   124
(*YM3*)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   125
by (fast_tac (!claset addss (!simpset)) 2);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   126
(*Fake*)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   127
by (best_tac
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   128
      (!claset addIs [impOfSubs analz_subset_parts]
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   129
               addDs [impOfSubs (analz_subset_parts RS keysFor_mono),
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   130
                      impOfSubs (parts_insert_subset_Un RS keysFor_mono)]
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   131
               addss (!simpset)) 1);
2160
ad4382e546fc Simplified new_keys_not_seen, etc.: replaced the
paulson
parents: 2156
diff changeset
   132
qed_spec_mp "new_keys_not_used";
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   133
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   134
bind_thm ("new_keys_not_analzd",
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   135
          [analz_subset_parts RS keysFor_mono,
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   136
           new_keys_not_used] MRS contra_subsetD);
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   137
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   138
Addsimps [new_keys_not_used, new_keys_not_analzd];
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   139
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   140
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   141
(*Describes the form of K when the Server sends this message.  Useful for
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   142
  Oops as well as main secrecy property.*)
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   143
goal thy 
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   144
 "!!evs. [| Says Server A {|Crypt (shrK A) {|Agent B, Key K, NA, NB|}, X|} \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   145
\             : set_of_list evs;                                           \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   146
\           evs : yahalom lost |]                                          \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   147
\        ==> K ~: range shrK";
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   148
by (etac rev_mp 1);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   149
by (etac yahalom.induct 1);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   150
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   151
qed "Says_Server_message_form";
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   152
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   153
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   154
(*For proofs involving analz.  We again instantiate the variable to "lost".*)
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   155
val analz_Fake_tac = 
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   156
    forw_inst_tac [("lost","lost")] YM4_analz_sees_Spy 6 THEN
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   157
    forw_inst_tac [("lost","lost")] Says_Server_message_form 7 THEN
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   158
    assume_tac 7 THEN REPEAT ((etac exE ORELSE' hyp_subst_tac) 7);
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   159
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   160
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   161
(****
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   162
 The following is to prove theorems of the form
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   163
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   164
  Key K : analz (insert (Key KAB) (sees lost Spy evs)) ==>
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2377
diff changeset
   165
  Key K : analz (sees lost Spy evs)
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   166
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   167
 A more general formula must be proved inductively.
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   168
****)
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   169
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   170
(** Session keys are not used to encrypt other session keys **)
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   171
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   172
goal thy  
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   173
 "!!evs. evs : yahalom lost ==> \
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   174
\  ALL K KK. KK <= Compl (range shrK) -->                      \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   175
\            (Key K : analz (Key``KK Un (sees lost Spy evs))) = \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   176
\            (K : KK | Key K : analz (sees lost Spy evs))";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   177
by (etac yahalom.induct 1);
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   178
by analz_Fake_tac;
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   179
by (REPEAT_FIRST (resolve_tac [allI, impI]));
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   180
by (REPEAT_FIRST (rtac analz_image_freshK_lemma ));
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   181
by (ALLGOALS (asm_simp_tac analz_image_freshK_ss));
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   182
(*Base*)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   183
by (fast_tac (!claset addIs [image_eqI] addss (!simpset)) 1);
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   184
(*YM4, Fake*) 
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   185
by (REPEAT (spy_analz_tac 1));
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   186
qed_spec_mp "analz_image_freshK";
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   187
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   188
goal thy
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   189
 "!!evs. [| evs : yahalom lost;  KAB ~: range shrK |] ==>             \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   190
\        Key K : analz (insert (Key KAB) (sees lost Spy evs)) = \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   191
\        (K = KAB | Key K : analz (sees lost Spy evs))";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   192
by (asm_simp_tac (analz_image_freshK_ss addsimps [analz_image_freshK]) 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   193
qed "analz_insert_freshK";
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   194
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   195
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   196
(*** The Key K uniquely identifies the Server's  message. **)
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   197
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   198
goal thy 
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   199
 "!!evs. evs : yahalom lost ==>                                     \
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   200
\      EX A' B' NA' NB' X'. ALL A B NA NB X.                             \
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   201
\          Says Server A                                            \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   202
\           {|Crypt (shrK A) {|Agent B, Key K, NA, NB|}, X|}        \
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   203
\          : set_of_list evs --> A=A' & B=B' & NA=NA' & NB=NB' & X=X'";
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   204
by (etac yahalom.induct 1);
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   205
by (ALLGOALS (asm_simp_tac (!simpset addsimps [all_conj_distrib])));
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   206
by (Step_tac 1);
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   207
by (ex_strip_tac 2);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   208
by (Fast_tac 2);
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   209
(*Remaining case: YM3*)
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   210
by (expand_case_tac "K = ?y" 1);
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   211
by (REPEAT (ares_tac [refl,exI,impI,conjI] 2));
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   212
(*...we assume X is a recent message and handle this case by contradiction*)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   213
by (fast_tac (!claset addSEs sees_Spy_partsEs
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   214
                      delrules [conjI]    (*prevent split-up into 4 subgoals*)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   215
                      addss (!simpset addsimps [parts_insertI])) 1);
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   216
val lemma = result();
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   217
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   218
goal thy 
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   219
"!!evs. [| Says Server A                                            \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   220
\           {|Crypt (shrK A) {|Agent B, Key K, NA, NB|}, X|}        \
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   221
\           : set_of_list evs;                                      \
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   222
\          Says Server A'                                           \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   223
\           {|Crypt (shrK A') {|Agent B', Key K, NA', NB'|}, X'|}   \
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   224
\           : set_of_list evs;                                      \
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   225
\          evs : yahalom lost |]                                    \
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   226
\       ==> A=A' & B=B' & NA=NA' & NB=NB'";
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2377
diff changeset
   227
by (prove_unique_tac lemma 1);
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   228
qed "unique_session_keys";
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   229
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   230
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   231
(*If the encrypted message appears then it originated with the Server*)
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   232
goal thy
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   233
 "!!evs. [| Crypt (shrK A) {|Agent B, Key K, NA, NB|}                  \
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   234
\            : parts (sees lost Spy evs);                              \
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   235
\           A ~: lost;  evs : yahalom lost |]                          \
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   236
\         ==> Says Server A                                            \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   237
\              {|Crypt (shrK A) {|Agent B, Key K, NA, NB|},            \
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   238
\                Crypt (shrK B) {|Agent A, Key K|}|}                   \
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   239
\             : set_of_list evs";
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   240
by (etac rev_mp 1);
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   241
by (parts_induct_tac 1);
2322
fbe6dd4abddc Trivial renamings
paulson
parents: 2284
diff changeset
   242
qed "A_trusts_YM3";
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   243
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   244
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   245
(** Crucial secrecy property: Spy does not see the keys sent in msg YM3 **)
2013
4b7a432fb3ed Proof of Says_imp_old_keys is now more robust
paulson
parents: 2001
diff changeset
   246
4b7a432fb3ed Proof of Says_imp_old_keys is now more robust
paulson
parents: 2001
diff changeset
   247
goal thy 
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   248
 "!!evs. [| A ~: lost;  B ~: lost;  evs : yahalom lost |]         \
2051
067bf19a71b7 Simplified main theorem by abstracting out newK
paulson
parents: 2045
diff changeset
   249
\        ==> Says Server A                                        \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   250
\              {|Crypt (shrK A) {|Agent B, Key K, NA, NB|},       \
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   251
\                Crypt (shrK B) {|Agent A, Key K|}|}              \
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   252
\             : set_of_list evs -->                               \
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   253
\            Says A Spy {|NA, NB, Key K|} ~: set_of_list evs -->  \
2051
067bf19a71b7 Simplified main theorem by abstracting out newK
paulson
parents: 2045
diff changeset
   254
\            Key K ~: analz (sees lost Spy evs)";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   255
by (etac yahalom.induct 1);
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   256
by analz_Fake_tac;
2013
4b7a432fb3ed Proof of Says_imp_old_keys is now more robust
paulson
parents: 2001
diff changeset
   257
by (ALLGOALS
4b7a432fb3ed Proof of Says_imp_old_keys is now more robust
paulson
parents: 2001
diff changeset
   258
    (asm_simp_tac 
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   259
     (!simpset addsimps [not_parts_not_analz, analz_insert_freshK]
2013
4b7a432fb3ed Proof of Says_imp_old_keys is now more robust
paulson
parents: 2001
diff changeset
   260
               setloop split_tac [expand_if])));
4b7a432fb3ed Proof of Says_imp_old_keys is now more robust
paulson
parents: 2001
diff changeset
   261
(*YM3*)
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   262
by (fast_tac (!claset delrules [impCE]
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   263
                      addSEs sees_Spy_partsEs
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   264
                      addIs [impOfSubs analz_subset_parts]
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   265
                      addss (!simpset addsimps [parts_insert2])) 2);
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   266
(*OR4, Fake*) 
2377
ad9d2dedaeaa Streamlined many proofs
paulson
parents: 2322
diff changeset
   267
by (REPEAT_FIRST spy_analz_tac);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2377
diff changeset
   268
(*Oops*)
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   269
by (fast_tac (!claset delrules [disjE] 
2170
c5e460f1ebb4 Ran expandshort
paulson
parents: 2160
diff changeset
   270
                      addDs [unique_session_keys]
c5e460f1ebb4 Ran expandshort
paulson
parents: 2160
diff changeset
   271
                      addss (!simpset)) 1);
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   272
val lemma = result() RS mp RS mp RSN(2,rev_notE);
2013
4b7a432fb3ed Proof of Says_imp_old_keys is now more robust
paulson
parents: 2001
diff changeset
   273
4b7a432fb3ed Proof of Says_imp_old_keys is now more robust
paulson
parents: 2001
diff changeset
   274
4b7a432fb3ed Proof of Says_imp_old_keys is now more robust
paulson
parents: 2001
diff changeset
   275
(*Final version: Server's message in the most abstract form*)
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents:
diff changeset
   276
goal thy 
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   277
 "!!evs. [| Says Server A                                         \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   278
\              {|Crypt (shrK A) {|Agent B, Key K, NA, NB|},       \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   279
\                Crypt (shrK B) {|Agent A, Key K|}|}              \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   280
\             : set_of_list evs;                                  \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   281
\           Says A Spy {|NA, NB, Key K|} ~: set_of_list evs;      \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   282
\           A ~: lost;  B ~: lost;  evs : yahalom lost |]         \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   283
\        ==> Key K ~: analz (sees lost Spy evs)";
2013
4b7a432fb3ed Proof of Says_imp_old_keys is now more robust
paulson
parents: 2001
diff changeset
   284
by (forward_tac [Says_Server_message_form] 1 THEN assume_tac 1);
4b7a432fb3ed Proof of Says_imp_old_keys is now more robust
paulson
parents: 2001
diff changeset
   285
by (fast_tac (!claset addSEs [lemma]) 1);
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   286
qed "Spy_not_see_encrypted_key";
2001
974167c1d2c4 Reformatting; proved B_gets_secure_key
paulson
parents: 1995
diff changeset
   287
974167c1d2c4 Reformatting; proved B_gets_secure_key
paulson
parents: 1995
diff changeset
   288
2045
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
   289
goal thy 
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   290
 "!!evs. [| C ~: {A,B,Server};                                    \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   291
\           Says Server A                                         \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   292
\              {|Crypt (shrK A) {|Agent B, Key K, NA, NB|},       \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   293
\                Crypt (shrK B) {|Agent A, Key K|}|}              \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   294
\             : set_of_list evs;                                  \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   295
\           Says A Spy {|NA, NB, Key K|} ~: set_of_list evs;      \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   296
\           A ~: lost;  B ~: lost;  evs : yahalom lost |]         \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   297
\        ==> Key K ~: analz (sees lost C evs)";
2045
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
   298
by (rtac (subset_insertI RS sees_mono RS analz_mono RS contra_subsetD) 1);
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
   299
by (rtac (sees_lost_agent_subset_sees_Spy RS analz_mono RS contra_subsetD) 1);
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
   300
by (FIRSTGOAL (rtac Spy_not_see_encrypted_key));
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
   301
by (REPEAT_FIRST (fast_tac (!claset addIs [yahalom_mono RS subsetD])));
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
   302
qed "Agent_not_see_encrypted_key";
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
   303
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
   304
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   305
(*** Security Guarantee for B upon receiving YM4 ***)
2013
4b7a432fb3ed Proof of Says_imp_old_keys is now more robust
paulson
parents: 2001
diff changeset
   306
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   307
(*B knows, by the first part of A's message, that the Server distributed 
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   308
  the key for A and B.  But this part says nothing about nonces.*)
2001
974167c1d2c4 Reformatting; proved B_gets_secure_key
paulson
parents: 1995
diff changeset
   309
goal thy 
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   310
 "!!evs. [| Crypt (shrK B) {|Agent A, Key K|} : parts (sees lost Spy evs); \
2051
067bf19a71b7 Simplified main theorem by abstracting out newK
paulson
parents: 2045
diff changeset
   311
\           B ~: lost;  evs : yahalom lost |]                           \
2001
974167c1d2c4 Reformatting; proved B_gets_secure_key
paulson
parents: 1995
diff changeset
   312
\        ==> EX NA NB. Says Server A                                    \
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2377
diff changeset
   313
\                        {|Crypt (shrK A) {|Agent B, Key K,             \
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   314
\                                           Nonce NA, Nonce NB|},       \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   315
\                          Crypt (shrK B) {|Agent A, Key K|}|}          \
2013
4b7a432fb3ed Proof of Says_imp_old_keys is now more robust
paulson
parents: 2001
diff changeset
   316
\                       : set_of_list evs";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   317
by (etac rev_mp 1);
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   318
by (parts_induct_tac 1);
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   319
(*YM3*)
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   320
by (Fast_tac 1);
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   321
qed "B_trusts_YM4_shrK";
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   322
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   323
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   324
(** The Nonce NB uniquely identifies B's message. **)
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   325
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   326
goal thy 
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2377
diff changeset
   327
 "!!evs. evs : yahalom lost ==> \
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2377
diff changeset
   328
\   EX NA' A' B'. ALL NA A B. \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   329
\      Crypt (shrK B) {|Agent A, Nonce NA, NB|} : parts(sees lost Spy evs) \
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   330
\      --> B ~: lost --> NA = NA' & A = A' & B = B'";
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2377
diff changeset
   331
by (etac yahalom.induct 1 THEN parts_Fake_tac);
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2377
diff changeset
   332
(*Fake: the tactic in parts_induct_tac works, but takes 4 times longer*)
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2377
diff changeset
   333
by (REPEAT (etac exE 2) THEN 
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2377
diff changeset
   334
    best_tac (!claset addSIs [exI]
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   335
                      addDs [impOfSubs Fake_parts_insert]
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   336
                      addss (!simpset)) 2);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2377
diff changeset
   337
(*Base case*)
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2377
diff changeset
   338
by (fast_tac (!claset addss (!simpset)) 1);
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2377
diff changeset
   339
by (ALLGOALS (asm_simp_tac (!simpset addsimps [all_conj_distrib]))); 
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   340
(*YM2: creation of new Nonce.  Move assertion into global context*)
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   341
by (expand_case_tac "NB = ?y" 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   342
by (REPEAT (resolve_tac [exI, conjI, impI, refl] 1));
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   343
by (fast_tac (!claset addSEs sees_Spy_partsEs) 1);
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   344
val lemma = result();
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   345
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   346
goal thy 
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   347
 "!!evs.[| Crypt (shrK B) {|Agent A, Nonce NA, NB|} \
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   348
\                  : parts (sees lost Spy evs);         \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   349
\          Crypt (shrK B') {|Agent A', Nonce NA', NB|} \
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   350
\                  : parts (sees lost Spy evs);         \
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   351
\          evs : yahalom lost;  B ~: lost;  B' ~: lost |]  \
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   352
\        ==> NA' = NA & A' = A & B' = B";
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2377
diff changeset
   353
by (prove_unique_tac lemma 1);
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   354
qed "unique_NB";
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   355
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   356
fun lost_tac s =
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   357
    case_tac ("(" ^ s ^ ") : lost") THEN'
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   358
    SELECT_GOAL 
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   359
      (REPEAT_DETERM (dtac (Says_imp_sees_Spy RS analz.Inj) 1) THEN
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   360
       REPEAT_DETERM (etac MPair_analz 1) THEN
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   361
       THEN_BEST_FIRST 
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   362
         (dres_inst_tac [("A", s)] Crypt_Spy_analz_lost 1 THEN assume_tac 1)
2170
c5e460f1ebb4 Ran expandshort
paulson
parents: 2160
diff changeset
   363
         (has_fewer_prems 1, size_of_thm)
c5e460f1ebb4 Ran expandshort
paulson
parents: 2160
diff changeset
   364
         (Step_tac 1));
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   365
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   366
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   367
(*Variant useful for proving secrecy of NB*)
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   368
goal thy 
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   369
 "!!evs.[| Says C D   {|X,  Crypt (shrK B) {|Agent A, Nonce NA, NB|}|} \
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   370
\          : set_of_list evs;  B ~: lost;         \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   371
\          Says C' D' {|X', Crypt (shrK B') {|Agent A', Nonce NA', NB|}|} \
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   372
\          : set_of_list evs;                           \
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   373
\          NB ~: analz (sees lost Spy evs);             \
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   374
\          evs : yahalom lost |]  \
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   375
\        ==> NA' = NA & A' = A & B' = B";
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   376
by (lost_tac "B'" 1);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   377
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS parts.Inj]
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   378
                      addSEs [MPair_parts]
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   379
                      addDs  [unique_NB]) 1);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   380
qed "Says_unique_NB";
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   381
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   382
goal thy 
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   383
 "!!evs. [| B ~: lost;  evs : yahalom lost  |]               \
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   384
\ ==>  Nonce NB ~: analz (sees lost Spy evs) -->  \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   385
\      Crypt (shrK B) {|Agent A, Nonce NA, Nonce NB|} : parts (sees lost Spy evs) \
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   386
\ --> Crypt (shrK B') {|Agent A', Nonce NB, NB'|} ~: parts (sees lost Spy evs)";
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   387
by (etac yahalom.induct 1);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   388
by parts_Fake_tac;
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   389
by (REPEAT_FIRST 
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   390
    (rtac impI THEN' 
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   391
     dtac (sees_subset_sees_Says RS analz_mono RS contra_subsetD) THEN'
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   392
     mp_tac));
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   393
by (best_tac (!claset addDs [impOfSubs analz_subset_parts,
2170
c5e460f1ebb4 Ran expandshort
paulson
parents: 2160
diff changeset
   394
                             impOfSubs Fake_parts_insert]
c5e460f1ebb4 Ran expandshort
paulson
parents: 2160
diff changeset
   395
                      addss (!simpset)) 2);
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   396
by (ALLGOALS Asm_simp_tac);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   397
by (fast_tac (!claset addss (!simpset)) 1);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   398
by (fast_tac (!claset addDs [Says_imp_sees_Spy RS analz.Inj]
2170
c5e460f1ebb4 Ran expandshort
paulson
parents: 2160
diff changeset
   399
                      addSIs [parts_insertI]
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   400
                      addSEs partsEs
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   401
                      addss (!simpset)) 1);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   402
val no_nonce_YM1_YM2 = standard (result() RS mp RSN (2, rev_mp) RS notE);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   403
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   404
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   405
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   406
(**** Towards proving secrecy of Nonce NB ****)
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   407
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   408
(*B knows, by the second part of A's message, that the Server distributed 
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   409
  the key quoting nonce NB.  This part says nothing about agent names. 
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   410
  Secrecy of NB is crucial.*)
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   411
goal thy 
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   412
 "!!evs. evs : yahalom lost                                             \
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   413
\        ==> Nonce NB ~: analz (sees lost Spy evs) -->                  \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   414
\            Crypt K (Nonce NB) : parts (sees lost Spy evs) -->         \
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   415
\            (EX A B NA. Says Server A                                  \
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   416
\                        {|Crypt (shrK A) {|Agent B, Key K,             \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   417
\                                  Nonce NA, Nonce NB|},                \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   418
\                          Crypt (shrK B) {|Agent A, Key K|}|}          \
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   419
\                       : set_of_list evs)";
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   420
by (etac yahalom.induct 1);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   421
by parts_Fake_tac;
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   422
by (fast_tac (!claset addss (!simpset)) 1);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   423
by (REPEAT_FIRST
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   424
    (rtac impI THEN'
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   425
     dtac (sees_subset_sees_Says RS analz_mono RS contra_subsetD)));
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   426
by (ALLGOALS Asm_simp_tac);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   427
(*Fake, YM3, YM4*)
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   428
by (Fast_tac 2);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   429
by (fast_tac (!claset addSDs [impOfSubs Fake_parts_insert]
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   430
                      addDs [impOfSubs analz_subset_parts]
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   431
                      addss (!simpset)) 1);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   432
(*YM4*)
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   433
by (Step_tac 1);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   434
by (lost_tac "A" 1);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   435
by (fast_tac (!claset addDs [Says_imp_sees_Spy RS parts.Inj RS parts.Fst RS
2322
fbe6dd4abddc Trivial renamings
paulson
parents: 2284
diff changeset
   436
                             A_trusts_YM3]) 1);
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   437
val B_trusts_YM4_newK = result() RS mp RSN (2, rev_mp);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   438
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   439
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   440
(*This is the original version of the result above.  But it is of little
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   441
  value because it assumes secrecy of K, which we cannot be assured of
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   442
  until we know that K is fresh -- which we do not know at the point this
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   443
  result is applied.*)
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   444
goal thy 
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   445
 "!!evs. evs : yahalom lost                                             \
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   446
\        ==> Key K ~: analz (sees lost Spy evs) -->                     \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   447
\            Crypt K (Nonce NB) : parts (sees lost Spy evs) -->         \
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   448
\            (EX A B NA. Says Server A                                  \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   449
\                        {|Crypt (shrK A) {|Agent B, Key K,                      \
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   450
\                                  Nonce NA, Nonce NB|},       \
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   451
\                          Crypt (shrK B) {|Agent A, Key K|}|}          \
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   452
\                       : set_of_list evs)";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2026
diff changeset
   453
by (etac yahalom.induct 1);
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   454
by parts_Fake_tac;
2001
974167c1d2c4 Reformatting; proved B_gets_secure_key
paulson
parents: 1995
diff changeset
   455
by (fast_tac (!claset addss (!simpset)) 1);
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   456
by (TRYALL (rtac impI));
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   457
by (REPEAT_FIRST
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   458
    (dtac (sees_subset_sees_Says RS analz_mono RS contra_subsetD)));
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   459
by (ALLGOALS Asm_simp_tac);
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   460
(*Fake, YM3, YM4*)
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   461
by (fast_tac (!claset addSDs [Crypt_Fake_parts_insert]
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   462
                      addDs  [impOfSubs analz_subset_parts]) 1);
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   463
by (Fast_tac 1);
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   464
(*YM4*)
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   465
by (Step_tac 1);
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   466
by (lost_tac "A" 1);
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   467
by (fast_tac (!claset addDs [Says_imp_sees_Spy RS parts.Inj RS parts.Fst RS
2322
fbe6dd4abddc Trivial renamings
paulson
parents: 2284
diff changeset
   468
                             A_trusts_YM3]) 1);
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   469
result() RS mp RSN (2, rev_mp);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   470
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   471
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   472
(*YM3 can only be triggered by YM2*)
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   473
goal thy 
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   474
 "!!evs. [| Says Server A                                           \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   475
\            {|Crypt (shrK A) {|Agent B, k, na, nb|}, X|} : set_of_list evs; \
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   476
\           evs : yahalom lost |]                                        \
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   477
\        ==> EX B'. Says B' Server                                       \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   478
\                      {| Agent B, Crypt (shrK B) {|Agent A, na, nb|} |} \
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   479
\                   : set_of_list evs";
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   480
by (etac rev_mp 1);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   481
by (etac yahalom.induct 1);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   482
by (ALLGOALS Asm_simp_tac);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   483
by (ALLGOALS Fast_tac);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   484
qed "Says_Server_imp_YM2";
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   485
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   486
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   487
(** Dedicated tactics for the nonce secrecy proofs **)
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   488
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   489
val no_nonce_tac = SELECT_GOAL
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   490
   (REPEAT (resolve_tac [impI, notI] 1) THEN
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   491
    REPEAT (hyp_subst_tac 1) THEN
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   492
    etac (Says_imp_sees_Spy RS parts.Inj RS parts.Snd RS no_nonce_YM1_YM2) 1
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   493
    THEN
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   494
    etac (Says_imp_sees_Spy RS parts.Inj RS parts.Snd) 4
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   495
    THEN 
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   496
    REPEAT_FIRST assume_tac);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   497
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   498
val not_analz_insert = subset_insertI RS analz_mono RS contra_subsetD;
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   499
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   500
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   501
(*The only nonces that can be found with the help of session keys are
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   502
  those distributed as nonce NB by the Server.  The form of the theorem
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   503
  recalls analz_image_freshK, but it is much more complicated.*)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   504
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   505
(*As with analz_image_freshK, we take some pains to express the property
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   506
  as a logical equivalence so that the simplifier can apply it.*)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   507
goal thy  
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   508
 "!!evs. P --> (X : analz (G Un H)) --> (X : analz H)  ==> \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   509
\        P --> (X : analz (G Un H)) = (X : analz H)";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   510
by (fast_tac (!claset addSEs [impOfSubs analz_mono]) 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   511
qed "Nonce_secrecy_lemma";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   512
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   513
goal thy 
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   514
 "!!evs. evs : yahalom lost ==>                                          \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   515
\        (ALL KK. KK <= Compl (range shrK) -->                               \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   516
\             (ALL K: KK. ALL A B na X.                                       \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   517
\                 Says Server A                                              \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   518
\                     {|Crypt (shrK A) {|Agent B, Key K, na, Nonce NB|}, X|} \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   519
\                 ~: set_of_list evs)   -->  \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   520
\             (Nonce NB : analz (Key``KK Un (sees lost Spy evs))) =      \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   521
\             (Nonce NB : analz (sees lost Spy evs)))";
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   522
by (etac yahalom.induct 1);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   523
by analz_Fake_tac;
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   524
by (REPEAT_FIRST (resolve_tac [impI RS allI]));
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   525
by (REPEAT_FIRST (rtac Nonce_secrecy_lemma ));
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   526
by (rtac ccontr 7);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   527
by (subgoal_tac "ALL A B na X.                                       \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   528
\                 Says Server A                                              \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   529
\                     {|Crypt (shrK A) {|Agent B, Key K, na, Nonce NB|}, X|} \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   530
\                 ~: set_of_list evsa" 7);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   531
by (eres_inst_tac [("P","?PP-->?QQ")] notE 7);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   532
by (subgoal_tac "ALL A B na X.                                       \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   533
\                 Says Server A                                              \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   534
\                    {|Crypt (shrK A) {|Agent B, Key KAB, na, Nonce NB|}, X|} \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   535
\                 ~: set_of_list evsa" 5);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2377
diff changeset
   536
by (ALLGOALS  (*22 seconds*)
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   537
    (asm_simp_tac 
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   538
     (analz_image_freshK_ss  addsimps
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   539
             ([all_conj_distrib, 
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   540
               not_parts_not_analz, analz_image_freshK]
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   541
              @ pushes @ ball_simps))));
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   542
(*Base*)
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   543
by (fast_tac (!claset addss (!simpset)) 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   544
(*Fake*) (** LEVEL 10 **)
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   545
by (spy_analz_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   546
(*YM3*)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   547
by (fast_tac (!claset addSEs sees_Spy_partsEs) 1);
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   548
(*Oops*)
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   549
(*20 secs*)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   550
by (fast_tac (!claset delrules [ballE] addDs [unique_session_keys]
2170
c5e460f1ebb4 Ran expandshort
paulson
parents: 2160
diff changeset
   551
                      addss (!simpset)) 2);
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   552
(*YM4*)
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   553
(** LEVEL 13 **)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   554
by (REPEAT (resolve_tac [impI, allI] 1));
2377
ad9d2dedaeaa Streamlined many proofs
paulson
parents: 2322
diff changeset
   555
by (dtac (impOfSubs Fake_analz_insert) 1 THEN etac synth.Inj 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   556
by (stac insert_commute 1);
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   557
by (eres_inst_tac [("P","Nonce NB : ?HH")] rev_mp 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   558
by (asm_simp_tac (analz_image_freshK_ss 
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   559
                  addsimps [analz_insertI, analz_image_freshK]) 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   560
by (step_tac (!claset addSDs [not_analz_insert]) 1);
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   561
by (lost_tac "A" 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   562
(** LEVEL 20 **)
2322
fbe6dd4abddc Trivial renamings
paulson
parents: 2284
diff changeset
   563
by (dtac (Says_imp_sees_Spy RS parts.Inj RS parts.Fst RS A_trusts_YM3) 1
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   564
    THEN REPEAT (assume_tac 1));
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   565
by (thin_tac "All ?PP" 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   566
by (Fast_tac 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   567
qed_spec_mp "Nonce_secrecy";
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   568
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   569
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   570
(*Version required below: if NB can be decrypted using a session key then it
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   571
  was distributed with that key.  The more general form above is required
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   572
  for the induction to carry through.*)
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   573
goal thy 
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   574
 "!!evs. [| Says Server A                                              \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   575
\            {|Crypt (shrK A) {|Agent B, Key KAB, na, Nonce NB'|}, X|} \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   576
\           : set_of_list evs;                                         \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   577
\           Nonce NB : analz (insert (Key KAB) (sees lost Spy evs));   \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   578
\           Nonce NB ~: analz (sees lost Spy evs);                     \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   579
\           KAB ~: range shrK;  evs : yahalom lost |]                  \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   580
\        ==>  NB = NB'";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   581
by (rtac ccontr 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   582
by (subgoal_tac "ALL A B na X.                                       \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   583
\                 Says Server A                                              \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   584
\                    {|Crypt (shrK A) {|Agent B, Key KAB, na, Nonce NB|}, X|} \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   585
\                 ~: set_of_list evs" 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   586
by (eres_inst_tac [("P","Nonce NB : ?HH")] rev_mp 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   587
by (asm_simp_tac (analz_image_freshK_ss 
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   588
                  addsimps ([Nonce_secrecy] @ ball_simps)) 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   589
by (auto_tac (!claset addDs [unique_session_keys], (!simpset)));
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   590
qed "single_Nonce_secrecy";
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   591
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   592
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   593
goal thy 
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   594
 "!!evs. [| A ~: lost;  B ~: lost;  Spy: lost;  evs : yahalom lost |]  \
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   595
\ ==> Says B Server                                                    \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   596
\          {|Agent B, Crypt (shrK B) {|Agent A, Nonce NA, Nonce NB|}|} \
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   597
\     : set_of_list evs -->                               \
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   598
\     (ALL k. Says A Spy {|Nonce NA, Nonce NB, k|} ~: set_of_list evs) -->  \
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   599
\     Nonce NB ~: analz (sees lost Spy evs)";
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   600
by (etac yahalom.induct 1);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   601
by analz_Fake_tac;
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   602
by (ALLGOALS
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   603
    (asm_simp_tac 
2377
ad9d2dedaeaa Streamlined many proofs
paulson
parents: 2322
diff changeset
   604
     (!simpset addsimps ([not_parts_not_analz,
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   605
                          analz_insert_freshK] @ pushes)
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   606
               setloop split_tac [expand_if])));
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   607
by (fast_tac (!claset addSIs [parts_insertI]
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   608
                      addSEs sees_Spy_partsEs
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   609
                      addss (!simpset)) 2);
2377
ad9d2dedaeaa Streamlined many proofs
paulson
parents: 2322
diff changeset
   610
(*Proof of YM2*) (** LEVEL 4 **)
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   611
by (deepen_tac (!claset addDs [Says_imp_sees_Spy RS analz.Inj,
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   612
                               impOfSubs analz_subset_parts]
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   613
                        addSEs partsEs) 3 2);
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   614
(*Prove YM3 by showing that no NB can also be an NA*)
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   615
by (REPEAT (Safe_step_tac 2 ORELSE no_nonce_tac 2));
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   616
by (deepen_tac (!claset addDs [Says_unique_NB]) 1 2);
2377
ad9d2dedaeaa Streamlined many proofs
paulson
parents: 2322
diff changeset
   617
(*Fake*)
ad9d2dedaeaa Streamlined many proofs
paulson
parents: 2322
diff changeset
   618
by (spy_analz_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   619
(*YM4*) (** LEVEL 8 **)
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   620
by (res_inst_tac [("x1","X")] (insert_commute RS ssubst) 1);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   621
by (simp_tac (!simpset setloop split_tac [expand_if]) 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   622
(*43 secs??*)
2377
ad9d2dedaeaa Streamlined many proofs
paulson
parents: 2322
diff changeset
   623
by (SELECT_GOAL (REPEAT_FIRST (spy_analz_tac ORELSE' Safe_step_tac)) 1);
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   624
by (lost_tac "Aa" 1);
2322
fbe6dd4abddc Trivial renamings
paulson
parents: 2284
diff changeset
   625
by (dtac (Says_imp_sees_Spy RS parts.Inj RS parts.Fst RS A_trusts_YM3) 1);
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   626
by (forward_tac [Says_Server_message_form] 3);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   627
by (forward_tac [Says_Server_imp_YM2] 4);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   628
(** LEVEL 15 **)
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   629
by (REPEAT_FIRST ((eresolve_tac [asm_rl, bexE, exE, disjE])));
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   630
by (lost_tac "Ba" 1);
2170
c5e460f1ebb4 Ran expandshort
paulson
parents: 2160
diff changeset
   631
by (dtac (Says_imp_sees_Spy RS parts.Inj RS parts.Snd RS unique_NB) 1);
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   632
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS parts.Inj]
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   633
                      addSEs [MPair_parts]) 1);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   634
by (REPEAT (assume_tac 1 ORELSE Safe_step_tac 1)); 
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   635
(** LEVEL 20 **)
2170
c5e460f1ebb4 Ran expandshort
paulson
parents: 2160
diff changeset
   636
by (dtac Spy_not_see_encrypted_key 1);
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   637
by (REPEAT (assume_tac 1 ORELSE Fast_tac 1)); 
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   638
by (spy_analz_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   639
(*Oops case*) (** LEVEL 23 **)
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   640
by (full_simp_tac (!simpset addsimps [all_conj_distrib]) 1);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   641
by (step_tac (!claset delrules [disjE, conjI]) 1);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   642
by (forward_tac [Says_Server_imp_YM2] 1 THEN assume_tac 1 THEN etac exE 1);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   643
by (expand_case_tac "NB = NBa" 1);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   644
by (deepen_tac (!claset addDs [Says_unique_NB]) 1 1);
2170
c5e460f1ebb4 Ran expandshort
paulson
parents: 2160
diff changeset
   645
by (rtac conjI 1);
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   646
by (no_nonce_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   647
(** LEVEL 30 **)
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   648
by (thin_tac "?PP|?QQ" 1);  (*subsumption!*)
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   649
by (fast_tac (!claset addSDs [single_Nonce_secrecy]) 1);
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   650
val Spy_not_see_NB = result() RSN(2,rev_mp) RSN(2,rev_mp) |> standard;
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   651
2001
974167c1d2c4 Reformatting; proved B_gets_secure_key
paulson
parents: 1995
diff changeset
   652
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   653
(*What can B deduce from receipt of YM4?  Note how the two components of
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   654
  the message contribute to a single conclusion about the Server's message.
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   655
  It's annoying that the "Says A Spy" assumption must quantify over 
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   656
  ALL POSSIBLE keys instead of our particular K (though at least the
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   657
  nonces are forced to agree with NA and NB). *)
2001
974167c1d2c4 Reformatting; proved B_gets_secure_key
paulson
parents: 1995
diff changeset
   658
goal thy 
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   659
 "!!evs. [| Says B Server                                               \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   660
\            {|Agent B, Crypt (shrK B) {|Agent A, Nonce NA, Nonce NB|}|}  \
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   661
\           : set_of_list evs;       \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   662
\           Says A' B {|Crypt (shrK B) {|Agent A, Key K|},              \
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   663
\                       Crypt K (Nonce NB)|} : set_of_list evs;         \
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   664
\           ALL k. Says A Spy {|Nonce NA, Nonce NB, k|} ~: set_of_list evs; \
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   665
\           A ~: lost;  B ~: lost;  Spy: lost;  evs : yahalom lost |]   \
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   666
\         ==> Says Server A                                             \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   667
\                     {|Crypt (shrK A) {|Agent B, Key K,                \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2454
diff changeset
   668
\                               Nonce NA, Nonce NB|},                   \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2269
diff changeset
   669
\                       Crypt (shrK B) {|Agent A, Key K|}|}             \
2001
974167c1d2c4 Reformatting; proved B_gets_secure_key
paulson
parents: 1995
diff changeset
   670
\                   : set_of_list evs";
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   671
by (forward_tac [Spy_not_see_NB] 1 THEN REPEAT (assume_tac 1));
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   672
by (etac (Says_imp_sees_Spy RS parts.Inj RS MPair_parts) 1 THEN
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   673
    dtac B_trusts_YM4_shrK 1);
2170
c5e460f1ebb4 Ran expandshort
paulson
parents: 2160
diff changeset
   674
by (dtac B_trusts_YM4_newK 3);
2110
d01151e66cd4 Addition of Reveal message
paulson
parents: 2060
diff changeset
   675
by (REPEAT_FIRST (eresolve_tac [asm_rl, exE]));
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   676
by (forward_tac [Says_Server_imp_YM2] 1 THEN assume_tac 1);
2170
c5e460f1ebb4 Ran expandshort
paulson
parents: 2160
diff changeset
   677
by (dtac unique_session_keys 1 THEN REPEAT (assume_tac 1));
2133
f00a688760b9 Simplified proofs
paulson
parents: 2110
diff changeset
   678
by (deepen_tac (!claset addDs [Says_unique_NB] addss (!simpset)) 0 1);
2322
fbe6dd4abddc Trivial renamings
paulson
parents: 2284
diff changeset
   679
qed "B_trusts_YM4";