src/HOL/Auth/OtwayRees_AN.ML
author paulson
Thu Nov 07 10:19:15 1996 +0100 (1996-11-07)
changeset 2166 d276a806cc10
parent 2160 ad4382e546fc
child 2264 f298678bd54a
permissions -rw-r--r--
Tidying up: removing redundant assumptions, etc.
paulson@2090
     1
(*  Title:      HOL/Auth/OtwayRees
paulson@2090
     2
    ID:         $Id$
paulson@2090
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
paulson@2090
     4
    Copyright   1996  University of Cambridge
paulson@2090
     5
paulson@2090
     6
Inductive relation "otway" for the Otway-Rees protocol.
paulson@2090
     7
paulson@2090
     8
Simplified version with minimal encryption but explicit messages
paulson@2090
     9
paulson@2090
    10
From page 11 of
paulson@2090
    11
  Abadi and Needham.  Prudent Engineering Practice for Cryptographic Protocols.
paulson@2090
    12
  IEEE Trans. SE 22 (1), 1996
paulson@2090
    13
*)
paulson@2090
    14
paulson@2090
    15
open OtwayRees_AN;
paulson@2090
    16
paulson@2090
    17
proof_timing:=true;
paulson@2090
    18
HOL_quantifiers := false;
paulson@2090
    19
paulson@2090
    20
paulson@2090
    21
(*Weak liveness: there are traces that reach the end*)
paulson@2090
    22
goal thy 
paulson@2090
    23
 "!!A B. [| A ~= B; A ~= Server; B ~= Server |]   \
paulson@2090
    24
\        ==> EX K. EX NA. EX evs: otway lost.          \
paulson@2090
    25
\             Says B A (Crypt {|Nonce NA, Agent A, Agent B, Key K|} (shrK A)) \
paulson@2090
    26
\             : set_of_list evs";
paulson@2090
    27
by (REPEAT (resolve_tac [exI,bexI] 1));
paulson@2090
    28
by (rtac (otway.Nil RS otway.OR1 RS otway.OR2 RS otway.OR3 RS otway.OR4) 2);
paulson@2090
    29
by (ALLGOALS (simp_tac (!simpset setsolver safe_solver)));
paulson@2090
    30
by (REPEAT_FIRST (resolve_tac [refl, conjI]));
paulson@2090
    31
by (REPEAT_FIRST (fast_tac (!claset addss (!simpset setsolver safe_solver))));
paulson@2090
    32
result();
paulson@2090
    33
paulson@2090
    34
paulson@2090
    35
(**** Inductive proofs about otway ****)
paulson@2090
    36
paulson@2106
    37
(*Monotonicity*)
paulson@2090
    38
goal thy "!!evs. lost' <= lost ==> otway lost' <= otway lost";
paulson@2090
    39
by (rtac subsetI 1);
paulson@2090
    40
by (etac otway.induct 1);
paulson@2090
    41
by (REPEAT_FIRST
paulson@2090
    42
    (best_tac (!claset addIs (impOfSubs (sees_mono RS analz_mono RS synth_mono)
paulson@2090
    43
                              :: otway.intrs))));
paulson@2090
    44
qed "otway_mono";
paulson@2090
    45
paulson@2090
    46
(*Nobody sends themselves messages*)
paulson@2090
    47
goal thy "!!evs. evs : otway lost ==> ALL A X. Says A A X ~: set_of_list evs";
paulson@2090
    48
by (etac otway.induct 1);
paulson@2090
    49
by (Auto_tac());
paulson@2090
    50
qed_spec_mp "not_Says_to_self";
paulson@2090
    51
Addsimps [not_Says_to_self];
paulson@2090
    52
AddSEs   [not_Says_to_self RSN (2, rev_notE)];
paulson@2090
    53
paulson@2090
    54
paulson@2090
    55
(** For reasoning about the encrypted portion of messages **)
paulson@2090
    56
paulson@2090
    57
goal thy "!!evs. Says S B {|X, X'|} : set_of_list evs ==> \
paulson@2090
    58
\                X : analz (sees lost Spy evs)";
paulson@2090
    59
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]) 1);
paulson@2090
    60
qed "OR4_analz_sees_Spy";
paulson@2090
    61
paulson@2131
    62
goal thy "!!evs. Says Server B {|X, Crypt {|NB, a, Agent B, K|} K'|} \
paulson@2131
    63
\                  : set_of_list evs ==> K : parts (sees lost Spy evs)";
paulson@2090
    64
by (fast_tac (!claset addSEs partsEs
paulson@2090
    65
                      addSDs [Says_imp_sees_Spy RS parts.Inj]) 1);
paulson@2131
    66
qed "Oops_parts_sees_Spy";
paulson@2090
    67
paulson@2131
    68
(*OR4_analz_sees_Spy lets us treat those cases using the same 
paulson@2090
    69
  argument as for the Fake case.  This is possible for most, but not all,
paulson@2131
    70
  proofs, since Fake messages originate from the Spy. *)
paulson@2090
    71
paulson@2090
    72
bind_thm ("OR4_parts_sees_Spy",
paulson@2090
    73
          OR4_analz_sees_Spy RS (impOfSubs analz_subset_parts));
paulson@2090
    74
paulson@2090
    75
(*We instantiate the variable to "lost".  Leaving it as a Var makes proofs
paulson@2090
    76
  harder to complete, since simplification does less for us.*)
paulson@2090
    77
val parts_Fake_tac = 
paulson@2090
    78
    forw_inst_tac [("lost","lost")] OR4_parts_sees_Spy 6 THEN
paulson@2131
    79
    forw_inst_tac [("lost","lost")] Oops_parts_sees_Spy 7;
paulson@2090
    80
paulson@2090
    81
(*For proving the easier theorems about X ~: parts (sees lost Spy evs) *)
paulson@2090
    82
fun parts_induct_tac i = SELECT_GOAL
paulson@2090
    83
    (DETERM (etac otway.induct 1 THEN parts_Fake_tac THEN
paulson@2090
    84
	     (*Fake message*)
paulson@2090
    85
	     TRY (best_tac (!claset addDs [impOfSubs analz_subset_parts,
paulson@2090
    86
					   impOfSubs Fake_parts_insert]
paulson@2090
    87
                                    addss (!simpset)) 2)) THEN
paulson@2090
    88
     (*Base case*)
paulson@2090
    89
     fast_tac (!claset addss (!simpset)) 1 THEN
paulson@2090
    90
     ALLGOALS Asm_simp_tac) i;
paulson@2090
    91
paulson@2090
    92
(** Theorems of the form X ~: parts (sees lost Spy evs) imply that NOBODY
paulson@2090
    93
    sends messages containing X! **)
paulson@2090
    94
paulson@2090
    95
(*Spy never sees another agent's shared key! (unless it's lost at start)*)
paulson@2090
    96
goal thy 
paulson@2131
    97
 "!!evs. evs : otway lost \
paulson@2131
    98
\        ==> (Key (shrK A) : parts (sees lost Spy evs)) = (A : lost)";
paulson@2090
    99
by (parts_induct_tac 1);
paulson@2090
   100
by (Auto_tac());
paulson@2131
   101
qed "Spy_see_shrK";
paulson@2131
   102
Addsimps [Spy_see_shrK];
paulson@2090
   103
paulson@2131
   104
goal thy 
paulson@2131
   105
 "!!evs. evs : otway lost \
paulson@2131
   106
\        ==> (Key (shrK A) : analz (sees lost Spy evs)) = (A : lost)";
paulson@2131
   107
by (auto_tac(!claset addDs [impOfSubs analz_subset_parts], !simpset));
paulson@2131
   108
qed "Spy_analz_shrK";
paulson@2131
   109
Addsimps [Spy_analz_shrK];
paulson@2090
   110
paulson@2131
   111
goal thy  "!!A. [| Key (shrK A) : parts (sees lost Spy evs);       \
paulson@2131
   112
\                  evs : otway lost |] ==> A:lost";
paulson@2131
   113
by (fast_tac (!claset addDs [Spy_see_shrK]) 1);
paulson@2131
   114
qed "Spy_see_shrK_D";
paulson@2090
   115
paulson@2131
   116
bind_thm ("Spy_analz_shrK_D", analz_subset_parts RS subsetD RS Spy_see_shrK_D);
paulson@2131
   117
AddSDs [Spy_see_shrK_D, Spy_analz_shrK_D];
paulson@2090
   118
paulson@2090
   119
paulson@2090
   120
(*** Future keys can't be seen or used! ***)
paulson@2090
   121
paulson@2160
   122
(*Nobody can have SEEN keys that will be generated in the future. *)
paulson@2090
   123
goal thy "!!evs. evs : otway lost ==> \
paulson@2090
   124
\                length evs <= length evs' --> \
paulson@2160
   125
\                Key (newK evs') ~: parts (sees lost Spy evs)";
paulson@2090
   126
by (parts_induct_tac 1);
paulson@2090
   127
by (REPEAT_FIRST (best_tac (!claset addDs [impOfSubs analz_subset_parts,
paulson@2090
   128
                                           impOfSubs parts_insert_subset_Un,
paulson@2090
   129
                                           Suc_leD]
paulson@2090
   130
                                    addss (!simpset))));
paulson@2160
   131
qed_spec_mp "new_keys_not_seen";
paulson@2090
   132
Addsimps [new_keys_not_seen];
paulson@2090
   133
paulson@2160
   134
(*Variant: old messages must contain old keys!*)
paulson@2090
   135
goal thy 
paulson@2090
   136
 "!!evs. [| Says A B X : set_of_list evs;  \
paulson@2090
   137
\           Key (newK evt) : parts {X};    \
paulson@2090
   138
\           evs : otway lost                 \
paulson@2090
   139
\        |] ==> length evt < length evs";
paulson@2090
   140
by (rtac ccontr 1);
paulson@2090
   141
by (dtac leI 1);
paulson@2090
   142
by (fast_tac (!claset addSDs [new_keys_not_seen, Says_imp_sees_Spy]
paulson@2090
   143
                      addIs  [impOfSubs parts_mono]) 1);
paulson@2090
   144
qed "Says_imp_old_keys";
paulson@2090
   145
paulson@2090
   146
paulson@2090
   147
(*Nobody can have USED keys that will be generated in the future.
paulson@2090
   148
  ...very like new_keys_not_seen*)
paulson@2090
   149
goal thy "!!evs. evs : otway lost ==> \
paulson@2090
   150
\                length evs <= length evs' --> \
paulson@2160
   151
\                newK evs' ~: keysFor (parts (sees lost Spy evs))";
paulson@2090
   152
by (parts_induct_tac 1);
paulson@2090
   153
(*OR1 and OR3*)
paulson@2090
   154
by (EVERY (map (fast_tac (!claset addDs [Suc_leD] addss (!simpset))) [4,2]));
paulson@2090
   155
(*Fake, OR2, OR4: these messages send unknown (X) components*)
paulson@2106
   156
by (REPEAT
paulson@2106
   157
    (best_tac
paulson@2090
   158
      (!claset addDs [impOfSubs (analz_subset_parts RS keysFor_mono),
paulson@2090
   159
                      impOfSubs (parts_insert_subset_Un RS keysFor_mono),
paulson@2090
   160
                      Suc_leD]
paulson@2090
   161
               addEs [new_keys_not_seen RS not_parts_not_analz RSN(2,rev_notE)]
paulson@2106
   162
               addss (!simpset)) 1));
paulson@2160
   163
qed_spec_mp "new_keys_not_used";
paulson@2090
   164
paulson@2090
   165
bind_thm ("new_keys_not_analzd",
paulson@2090
   166
          [analz_subset_parts RS keysFor_mono,
paulson@2090
   167
           new_keys_not_used] MRS contra_subsetD);
paulson@2090
   168
paulson@2090
   169
Addsimps [new_keys_not_used, new_keys_not_analzd];
paulson@2090
   170
paulson@2090
   171
paulson@2090
   172
paulson@2090
   173
(*** Proofs involving analz ***)
paulson@2090
   174
paulson@2131
   175
(*Describes the form of K and NA when the Server sends this message.*)
paulson@2090
   176
goal thy 
paulson@2131
   177
 "!!evs. [| Says Server B \
paulson@2131
   178
\           {|Crypt {|NA, Agent A, Agent B, K|} (shrK A),                    \
paulson@2131
   179
\             Crypt {|NB, Agent A, Agent B, K|} (shrK B)|} : set_of_list evs; \
paulson@2131
   180
\           evs : otway lost |]                                        \
paulson@2131
   181
\        ==> (EX evt: otway lost. K = Key(newK evt)) &                  \
paulson@2131
   182
\            (EX i. NA = Nonce i) &                  \
paulson@2131
   183
\            (EX j. NB = Nonce j)";
paulson@2131
   184
by (etac rev_mp 1);
paulson@2131
   185
by (etac otway.induct 1);
paulson@2131
   186
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
paulson@2131
   187
qed "Says_Server_message_form";
paulson@2090
   188
paulson@2090
   189
paulson@2090
   190
(*For proofs involving analz.  We again instantiate the variable to "lost".*)
paulson@2090
   191
val analz_Fake_tac = 
paulson@2090
   192
    dres_inst_tac [("lost","lost")] OR4_analz_sees_Spy 6 THEN
paulson@2131
   193
    forw_inst_tac [("lost","lost")] Says_Server_message_form 7 THEN
paulson@2131
   194
    assume_tac 7 THEN Full_simp_tac 7 THEN
paulson@2131
   195
    REPEAT ((eresolve_tac [bexE, exE, conjE] ORELSE' hyp_subst_tac) 7);
paulson@2090
   196
paulson@2090
   197
paulson@2090
   198
(****
paulson@2090
   199
 The following is to prove theorems of the form
paulson@2090
   200
paulson@2090
   201
          Key K : analz (insert (Key (newK evt)) (sees lost Spy evs)) ==>
paulson@2090
   202
          Key K : analz (sees lost Spy evs)
paulson@2090
   203
paulson@2090
   204
 A more general formula must be proved inductively.
paulson@2090
   205
paulson@2090
   206
****)
paulson@2090
   207
paulson@2090
   208
paulson@2090
   209
(** Session keys are not used to encrypt other session keys **)
paulson@2090
   210
paulson@2090
   211
(*The equality makes the induction hypothesis easier to apply*)
paulson@2090
   212
goal thy  
paulson@2090
   213
 "!!evs. evs : otway lost ==> \
paulson@2090
   214
\  ALL K E. (Key K : analz (Key``(newK``E) Un (sees lost Spy evs))) = \
paulson@2090
   215
\           (K : newK``E | Key K : analz (sees lost Spy evs))";
paulson@2090
   216
by (etac otway.induct 1);
paulson@2090
   217
by analz_Fake_tac;
paulson@2090
   218
by (REPEAT_FIRST (ares_tac [allI, analz_image_newK_lemma]));
paulson@2090
   219
by (ALLGOALS (*Takes 28 secs*)
paulson@2090
   220
    (asm_simp_tac 
paulson@2090
   221
     (!simpset addsimps ([insert_Key_singleton, insert_Key_image, pushKey_newK]
paulson@2090
   222
                         @ pushes)
paulson@2090
   223
               setloop split_tac [expand_if])));
paulson@2090
   224
(** LEVEL 5 **)
paulson@2131
   225
(*OR4, Fake*) 
paulson@2131
   226
by (EVERY (map spy_analz_tac [4,2]));
paulson@2131
   227
(*Oops, OR3, Base*)
paulson@2090
   228
by (REPEAT (fast_tac (!claset addIs [image_eqI] addss (!simpset)) 1));
paulson@2090
   229
qed_spec_mp "analz_image_newK";
paulson@2090
   230
paulson@2090
   231
paulson@2090
   232
goal thy
paulson@2090
   233
 "!!evs. evs : otway lost ==>                               \
paulson@2090
   234
\        Key K : analz (insert (Key (newK evt)) (sees lost Spy evs)) = \
paulson@2090
   235
\        (K = newK evt | Key K : analz (sees lost Spy evs))";
paulson@2090
   236
by (asm_simp_tac (HOL_ss addsimps [pushKey_newK, analz_image_newK, 
paulson@2090
   237
                                   insert_Key_singleton]) 1);
paulson@2090
   238
by (Fast_tac 1);
paulson@2090
   239
qed "analz_insert_Key_newK";
paulson@2090
   240
paulson@2090
   241
paulson@2090
   242
(*** The Key K uniquely identifies the Server's  message. **)
paulson@2090
   243
paulson@2090
   244
goal thy 
paulson@2090
   245
 "!!evs. evs : otway lost ==>                      \
paulson@2090
   246
\      EX A' B' NA' NB'. ALL A B NA NB.                    \
paulson@2090
   247
\       Says Server B \
paulson@2090
   248
\         {|Crypt {|NA, Agent A, Agent B, K|} (shrK A),                    \
paulson@2090
   249
\           Crypt {|NB, Agent A, Agent B, K|} (shrK B)|} : set_of_list evs  \
paulson@2090
   250
\       --> A=A' & B=B' & NA=NA' & NB=NB'";
paulson@2090
   251
by (etac otway.induct 1);
paulson@2090
   252
by (ALLGOALS (asm_simp_tac (!simpset addsimps [all_conj_distrib])));
paulson@2090
   253
by (Step_tac 1);
paulson@2090
   254
(*Remaining cases: OR3 and OR4*)
paulson@2090
   255
by (ex_strip_tac 2);
paulson@2090
   256
by (Fast_tac 2);
paulson@2090
   257
by (expand_case_tac "K = ?y" 1);
paulson@2090
   258
by (REPEAT (ares_tac [refl,exI,impI,conjI] 2));
paulson@2090
   259
(*...we assume X is a very new message, and handle this case by contradiction*)
paulson@2090
   260
by (fast_tac (!claset addEs [Says_imp_old_keys RS less_irrefl]
paulson@2090
   261
                      delrules [conjI]    (*prevent split-up into 4 subgoals*)
paulson@2090
   262
                      addss (!simpset addsimps [parts_insertI])) 1);
paulson@2090
   263
val lemma = result();
paulson@2090
   264
paulson@2090
   265
paulson@2090
   266
goal thy 
paulson@2090
   267
"!!evs. [| Says Server B                                           \
paulson@2090
   268
\            {|Crypt {|NA, Agent A, Agent B, K|} (shrK A),         \
paulson@2090
   269
\              Crypt {|NB, Agent A, Agent B, K|} (shrK B)|}        \
paulson@2090
   270
\           : set_of_list evs;                                     \
paulson@2090
   271
\          Says Server B'                                          \
paulson@2090
   272
\            {|Crypt {|NA', Agent A', Agent B', K|} (shrK A'),     \
paulson@2090
   273
\              Crypt {|NB', Agent A', Agent B', K|} (shrK B')|}    \
paulson@2090
   274
\           : set_of_list evs;                                     \
paulson@2090
   275
\          evs : otway lost |]                                     \
paulson@2090
   276
\       ==> A=A' & B=B' & NA=NA' & NB=NB'";
paulson@2090
   277
by (dtac lemma 1);
paulson@2090
   278
by (REPEAT (etac exE 1));
paulson@2090
   279
(*Duplicate the assumption*)
paulson@2090
   280
by (forw_inst_tac [("psi", "ALL C.?P(C)")] asm_rl 1);
paulson@2090
   281
by (fast_tac (!claset addSDs [spec]) 1);
paulson@2090
   282
qed "unique_session_keys";
paulson@2090
   283
paulson@2090
   284
paulson@2090
   285
paulson@2090
   286
(**** Authenticity properties relating to NA ****)
paulson@2090
   287
paulson@2090
   288
(*If the encrypted message appears then it originated with the Server!*)
paulson@2090
   289
goal thy 
paulson@2090
   290
 "!!evs. [| A ~: lost;  evs : otway lost |]                 \
paulson@2090
   291
\ ==> Crypt {|NA, Agent A, Agent B, Key K|} (shrK A)        \
paulson@2090
   292
\      : parts (sees lost Spy evs)                          \
paulson@2090
   293
\     --> (EX NB. Says Server B                                     \
paulson@2090
   294
\                  {|Crypt {|NA, Agent A, Agent B, Key K|} (shrK A),     \
paulson@2090
   295
\                    Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)|}    \
paulson@2090
   296
\                  : set_of_list evs)";
paulson@2090
   297
by (parts_induct_tac 1);
paulson@2090
   298
by (ALLGOALS (asm_simp_tac (!simpset addsimps [ex_disj_distrib])));
paulson@2090
   299
(*OR3*)
paulson@2090
   300
by (Fast_tac 1);
paulson@2090
   301
qed_spec_mp "NA_Crypt_imp_Server_msg";
paulson@2090
   302
paulson@2090
   303
paulson@2090
   304
(*Corollary: if A receives B's OR4 message and the nonce NA agrees
paulson@2090
   305
  then the key really did come from the Server!  CANNOT prove this of the
paulson@2090
   306
  bad form of this protocol, even though we can prove
paulson@2106
   307
  Spy_not_see_encrypted_key.  (We can implicitly infer freshness of
paulson@2106
   308
  the Server's message from its nonce NA.)*)
paulson@2090
   309
goal thy 
paulson@2090
   310
 "!!evs. [| Says B' A (Crypt {|NA, Agent A, Agent B, Key K|} (shrK A))  \
paulson@2090
   311
\            : set_of_list evs;                                         \
paulson@2090
   312
\           A ~: lost;  evs : otway lost |]                             \
paulson@2090
   313
\        ==> EX NB. Says Server B                                       \
paulson@2090
   314
\                    {|Crypt {|NA, Agent A, Agent B, Key K|} (shrK A),  \
paulson@2090
   315
\                      Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)|} \
paulson@2090
   316
\                   : set_of_list evs";
paulson@2090
   317
by (fast_tac (!claset addSIs [NA_Crypt_imp_Server_msg]
paulson@2090
   318
                      addEs  partsEs
paulson@2090
   319
                      addDs  [Says_imp_sees_Spy RS parts.Inj]) 1);
paulson@2090
   320
qed "A_trust_OR4";
paulson@2090
   321
paulson@2090
   322
paulson@2090
   323
(** Crucial secrecy property: Spy does not see the keys sent in msg OR3
paulson@2090
   324
    Does not in itself guarantee security: an attack could violate 
paulson@2090
   325
    the premises, e.g. by having A=Spy **)
paulson@2090
   326
paulson@2090
   327
goal thy 
paulson@2166
   328
 "!!evs. [| A ~: lost;  B ~: lost;  evs : otway lost |]                    \
paulson@2090
   329
\        ==> Says Server B                                                 \
paulson@2090
   330
\             {|Crypt {|NA, Agent A, Agent B, Key K|} (shrK A),            \
paulson@2090
   331
\               Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)|}           \
paulson@2090
   332
\            : set_of_list evs -->                                         \
paulson@2131
   333
\            Says B Spy {|NA, NB, Key K|} ~: set_of_list evs -->           \
paulson@2090
   334
\            Key K ~: analz (sees lost Spy evs)";
paulson@2090
   335
by (etac otway.induct 1);
paulson@2090
   336
by analz_Fake_tac;
paulson@2090
   337
by (ALLGOALS
paulson@2090
   338
    (asm_full_simp_tac 
paulson@2090
   339
     (!simpset addsimps ([analz_subset_parts RS contra_subsetD,
paulson@2090
   340
                          analz_insert_Key_newK] @ pushes)
paulson@2090
   341
               setloop split_tac [expand_if])));
paulson@2090
   342
(*OR3*)
paulson@2166
   343
by (fast_tac (!claset addEs [Says_imp_old_keys RS less_irrefl]
paulson@2090
   344
                      addss (!simpset addsimps [parts_insert2])) 2);
paulson@2131
   345
(*OR4, Fake*) 
paulson@2090
   346
by (REPEAT_FIRST (resolve_tac [conjI, impI] ORELSE' spy_analz_tac));
paulson@2131
   347
(*Oops*) 
paulson@2090
   348
by (fast_tac (!claset addDs [unique_session_keys] addss (!simpset)) 1);
paulson@2090
   349
val lemma = result() RS mp RS mp RSN(2,rev_notE);
paulson@2090
   350
paulson@2090
   351
goal thy 
paulson@2106
   352
 "!!evs. [| Says Server B                                                     \
paulson@2131
   353
\            {|Crypt {|NA, Agent A, Agent B, K|} (shrK A),                    \
paulson@2131
   354
\              Crypt {|NB, Agent A, Agent B, K|} (shrK B)|} : set_of_list evs;\
paulson@2131
   355
\           Says B Spy {|NA, NB, K|} ~: set_of_list evs;                      \
paulson@2131
   356
\           A ~: lost;  B ~: lost;  evs : otway lost |]                       \
paulson@2090
   357
\        ==> K ~: analz (sees lost Spy evs)";
paulson@2090
   358
by (forward_tac [Says_Server_message_form] 1 THEN assume_tac 1);
paulson@2090
   359
by (fast_tac (!claset addSEs [lemma]) 1);
paulson@2090
   360
qed "Spy_not_see_encrypted_key";
paulson@2090
   361
paulson@2090
   362
paulson@2090
   363
goal thy 
paulson@2106
   364
 "!!evs. [| C ~: {A,B,Server};                                                \
paulson@2106
   365
\           Says Server B                                                     \
paulson@2131
   366
\            {|Crypt {|NA, Agent A, Agent B, K|} (shrK A),                    \
paulson@2131
   367
\              Crypt {|NB, Agent A, Agent B, K|} (shrK B)|} : set_of_list evs;\
paulson@2131
   368
\           Says B Spy {|NA, NB, K|} ~: set_of_list evs;                 \
paulson@2090
   369
\           A ~: lost;  B ~: lost;  evs : otway lost |]                  \
paulson@2090
   370
\        ==> K ~: analz (sees lost C evs)";
paulson@2090
   371
by (rtac (subset_insertI RS sees_mono RS analz_mono RS contra_subsetD) 1);
paulson@2090
   372
by (rtac (sees_lost_agent_subset_sees_Spy RS analz_mono RS contra_subsetD) 1);
paulson@2090
   373
by (FIRSTGOAL (rtac Spy_not_see_encrypted_key));
paulson@2090
   374
by (REPEAT_FIRST (fast_tac (!claset addIs [otway_mono RS subsetD])));
paulson@2090
   375
qed "Agent_not_see_encrypted_key";
paulson@2090
   376
paulson@2090
   377
paulson@2090
   378
(**** Authenticity properties relating to NB ****)
paulson@2090
   379
paulson@2090
   380
(*If the encrypted message appears then it originated with the Server!*)
paulson@2090
   381
goal thy 
paulson@2106
   382
 "!!evs. [| B ~: lost;  evs : otway lost |]                                 \
paulson@2106
   383
\    ==> Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)                     \
paulson@2106
   384
\         : parts (sees lost Spy evs)                                       \
paulson@2090
   385
\        --> (EX NA. Says Server B                                          \
paulson@2090
   386
\                     {|Crypt {|NA, Agent A, Agent B, Key K|} (shrK A),     \
paulson@2090
   387
\                       Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)|}    \
paulson@2090
   388
\                     : set_of_list evs)";
paulson@2090
   389
by (parts_induct_tac 1);
paulson@2090
   390
by (ALLGOALS (asm_simp_tac (!simpset addsimps [ex_disj_distrib])));
paulson@2090
   391
(*OR3*)
paulson@2090
   392
by (Fast_tac 1);
paulson@2090
   393
qed_spec_mp "NB_Crypt_imp_Server_msg";
paulson@2090
   394
paulson@2090
   395
paulson@2090
   396
(*Guarantee for B: if it gets a message with matching NB then the Server
paulson@2090
   397
  has sent the correct message.*)
paulson@2090
   398
goal thy 
paulson@2106
   399
 "!!evs. [| B ~: lost;  evs : otway lost;                                   \
paulson@2106
   400
\           Says S B {|X, Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)|}  \
paulson@2106
   401
\            : set_of_list evs |]                                           \
paulson@2106
   402
\        ==> EX NA. Says Server B                                           \
paulson@2090
   403
\                     {|Crypt {|NA, Agent A, Agent B, Key K|} (shrK A),     \
paulson@2090
   404
\                       Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)|}    \
paulson@2090
   405
\                     : set_of_list evs";
paulson@2090
   406
by (fast_tac (!claset addSIs [NB_Crypt_imp_Server_msg]
paulson@2090
   407
                      addEs  partsEs
paulson@2090
   408
                      addDs  [Says_imp_sees_Spy RS parts.Inj]) 1);
paulson@2090
   409
qed "B_trust_OR3";