src/HOL/Auth/OtwayRees.ML
author paulson
Mon Oct 07 10:55:51 1996 +0200 (1996-10-07)
changeset 2064 5a5e508e2a2b
parent 2053 6c0594bfa726
child 2071 0debdc018d26
permissions -rw-r--r--
Simple tidying
paulson@1941
     1
(*  Title:      HOL/Auth/OtwayRees
paulson@1941
     2
    ID:         $Id$
paulson@1941
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
paulson@1941
     4
    Copyright   1996  University of Cambridge
paulson@1941
     5
paulson@1941
     6
Inductive relation "otway" for the Otway-Rees protocol.
paulson@1941
     7
paulson@2014
     8
Version that encrypts Nonce NB
paulson@2014
     9
paulson@1941
    10
From page 244 of
paulson@1941
    11
  Burrows, Abadi and Needham.  A Logic of Authentication.
paulson@1941
    12
  Proc. Royal Soc. 426 (1989)
paulson@1941
    13
*)
paulson@1941
    14
paulson@1941
    15
open OtwayRees;
paulson@1941
    16
paulson@1941
    17
proof_timing:=true;
paulson@1941
    18
HOL_quantifiers := false;
paulson@1941
    19
paulson@1996
    20
paulson@2014
    21
(*Weak liveness: there are traces that reach the end*)
paulson@1996
    22
goal thy 
paulson@1996
    23
 "!!A B. [| A ~= B; A ~= Server; B ~= Server |]   \
paulson@2032
    24
\        ==> EX K. EX NA. EX evs: otway lost.          \
paulson@2014
    25
\               Says B A {|Nonce NA, Crypt {|Nonce NA, Key K|} (shrK A)|} \
paulson@2014
    26
\                 : set_of_list evs";
paulson@1996
    27
by (REPEAT (resolve_tac [exI,bexI] 1));
paulson@2032
    28
by (rtac (otway.Nil RS otway.OR1 RS otway.OR2 RS otway.OR3 RS otway.OR4) 2);
paulson@1996
    29
by (ALLGOALS (simp_tac (!simpset setsolver safe_solver)));
paulson@1996
    30
by (REPEAT_FIRST (resolve_tac [refl, conjI]));
paulson@1996
    31
by (ALLGOALS (fast_tac (!claset addss (!simpset setsolver safe_solver))));
paulson@2014
    32
result();
paulson@1996
    33
paulson@1996
    34
paulson@1941
    35
(**** Inductive proofs about otway ****)
paulson@1941
    36
paulson@2032
    37
goal thy "!!evs. lost' <= lost ==> otway lost' <= otway lost";
paulson@2032
    38
by (rtac subsetI 1);
paulson@2032
    39
by (etac otway.induct 1);
paulson@2032
    40
by (REPEAT_FIRST
paulson@2032
    41
    (best_tac (!claset addIs (impOfSubs (sees_mono RS analz_mono RS synth_mono)
paulson@2032
    42
                              :: otway.intrs))));
paulson@2032
    43
qed "otway_mono";
paulson@2032
    44
paulson@1941
    45
(*Nobody sends themselves messages*)
paulson@2032
    46
goal thy "!!evs. evs : otway lost ==> ALL A X. Says A A X ~: set_of_list evs";
paulson@2032
    47
by (etac otway.induct 1);
paulson@1941
    48
by (Auto_tac());
paulson@1941
    49
qed_spec_mp "not_Says_to_self";
paulson@1941
    50
Addsimps [not_Says_to_self];
paulson@1941
    51
AddSEs   [not_Says_to_self RSN (2, rev_notE)];
paulson@1941
    52
paulson@1941
    53
paulson@1941
    54
(** For reasoning about the encrypted portion of messages **)
paulson@1941
    55
paulson@1996
    56
goal thy "!!evs. Says A' B {|N, Agent A, Agent B, X|} : set_of_list evs ==> \
paulson@2032
    57
\                X : analz (sees lost Spy evs)";
paulson@2032
    58
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]) 1);
paulson@2032
    59
qed "OR2_analz_sees_Spy";
paulson@1941
    60
paulson@1996
    61
goal thy "!!evs. Says S B {|N, X, X'|} : set_of_list evs ==> \
paulson@2032
    62
\                X : analz (sees lost Spy evs)";
paulson@2032
    63
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]) 1);
paulson@2032
    64
qed "OR4_analz_sees_Spy";
paulson@1941
    65
paulson@1996
    66
goal thy "!!evs. Says B' A {|N, Crypt {|N,K|} K'|} : set_of_list evs ==> \
paulson@2032
    67
\                K : parts (sees lost Spy evs)";
paulson@1941
    68
by (fast_tac (!claset addSEs partsEs
paulson@2032
    69
                      addSDs [Says_imp_sees_Spy RS parts.Inj]) 1);
paulson@2032
    70
qed "Reveal_parts_sees_Spy";
paulson@1941
    71
paulson@1941
    72
(*OR2_analz... and OR4_analz... let us treat those cases using the same 
paulson@1964
    73
  argument as for the Fake case.  This is possible for most, but not all,
paulson@1964
    74
  proofs: Fake does not invent new nonces (as in OR2), and of course Fake
paulson@2032
    75
  messages originate from the Spy. *)
paulson@1964
    76
paulson@2032
    77
bind_thm ("OR2_parts_sees_Spy",
paulson@2032
    78
          OR2_analz_sees_Spy RS (impOfSubs analz_subset_parts));
paulson@2032
    79
bind_thm ("OR4_parts_sees_Spy",
paulson@2032
    80
          OR4_analz_sees_Spy RS (impOfSubs analz_subset_parts));
paulson@2032
    81
paulson@2032
    82
(*We instantiate the variable to "lost".  Leaving it as a Var makes proofs
paulson@2032
    83
  harder to complete, since simplification does less for us.*)
paulson@2014
    84
val parts_Fake_tac = 
paulson@2032
    85
    let val tac = forw_inst_tac [("lost","lost")] 
paulson@2032
    86
    in  tac OR2_parts_sees_Spy 4 THEN 
paulson@2032
    87
        tac OR4_parts_sees_Spy 6 THEN
paulson@2032
    88
        tac Reveal_parts_sees_Spy 7
paulson@2032
    89
    end;
paulson@1941
    90
paulson@2064
    91
(*For proving the easier theorems about X ~: parts (sees lost Spy evs) *)
paulson@2064
    92
fun parts_induct_tac i = SELECT_GOAL
paulson@2064
    93
    (DETERM (etac otway.induct 1 THEN parts_Fake_tac THEN
paulson@2064
    94
	     (*Fake message*)
paulson@2064
    95
	     TRY (best_tac (!claset addDs [impOfSubs analz_subset_parts,
paulson@2064
    96
					   impOfSubs Fake_parts_insert]
paulson@2064
    97
                                    addss (!simpset)) 2)) THEN
paulson@2064
    98
     (*Base case*)
paulson@2064
    99
     fast_tac (!claset addss (!simpset)) 1 THEN
paulson@2064
   100
     ALLGOALS Asm_simp_tac) i;
paulson@1941
   101
paulson@2032
   102
(** Theorems of the form X ~: parts (sees lost Spy evs) imply that NOBODY
paulson@2014
   103
    sends messages containing X! **)
paulson@1941
   104
paulson@2064
   105
(*Spy never sees another agent's shared key! (unless it's lost at start)*)
paulson@1941
   106
goal thy 
paulson@2032
   107
 "!!evs. [| evs : otway lost;  A ~: lost |]    \
paulson@2032
   108
\        ==> Key (shrK A) ~: parts (sees lost Spy evs)";
paulson@2064
   109
by (parts_induct_tac 1);
paulson@1941
   110
by (Auto_tac());
paulson@2032
   111
qed "Spy_not_see_shrK";
paulson@1941
   112
paulson@2032
   113
bind_thm ("Spy_not_analz_shrK",
paulson@2032
   114
          [analz_subset_parts, Spy_not_see_shrK] MRS contra_subsetD);
paulson@1941
   115
paulson@2032
   116
Addsimps [Spy_not_see_shrK, Spy_not_analz_shrK];
paulson@1941
   117
paulson@1964
   118
(*We go to some trouble to preserve R in the 3rd and 4th subgoals
paulson@1964
   119
  As usual fast_tac cannot be used because it uses the equalities too soon*)
paulson@1941
   120
val major::prems = 
paulson@2032
   121
goal thy  "[| Key (shrK A) : parts (sees lost Spy evs);       \
paulson@2032
   122
\             evs : otway lost;                                 \
paulson@2032
   123
\             A:lost ==> R                                  \
paulson@1941
   124
\           |] ==> R";
paulson@2032
   125
by (rtac ccontr 1);
paulson@2032
   126
by (rtac ([major, Spy_not_see_shrK] MRS rev_notE) 1);
paulson@1941
   127
by (swap_res_tac prems 2);
paulson@1967
   128
by (ALLGOALS (fast_tac (!claset addIs prems)));
paulson@2032
   129
qed "Spy_see_shrK_E";
paulson@1941
   130
paulson@2032
   131
bind_thm ("Spy_analz_shrK_E", 
paulson@2032
   132
          analz_subset_parts RS subsetD RS Spy_see_shrK_E);
paulson@1941
   133
paulson@2032
   134
AddSEs [Spy_see_shrK_E, Spy_analz_shrK_E];
paulson@1941
   135
paulson@1941
   136
paulson@1941
   137
(*** Future keys can't be seen or used! ***)
paulson@1941
   138
paulson@1941
   139
(*Nobody can have SEEN keys that will be generated in the future.
paulson@1941
   140
  This has to be proved anew for each protocol description,
paulson@1941
   141
  but should go by similar reasoning every time.  Hardest case is the
paulson@1941
   142
  standard Fake rule.  
paulson@2014
   143
      The Union over C is essential for the induction! *)
paulson@2032
   144
goal thy "!!evs. evs : otway lost ==> \
paulson@1941
   145
\                length evs <= length evs' --> \
paulson@2032
   146
\                          Key (newK evs') ~: (UN C. parts (sees lost C evs))";
paulson@2064
   147
by (parts_induct_tac 1);
paulson@1941
   148
by (REPEAT_FIRST (best_tac (!claset addDs [impOfSubs analz_subset_parts,
paulson@2032
   149
                                           impOfSubs parts_insert_subset_Un,
paulson@2032
   150
                                           Suc_leD]
paulson@2032
   151
                                    addss (!simpset))));
paulson@1941
   152
val lemma = result();
paulson@1941
   153
paulson@1941
   154
(*Variant needed for the main theorem below*)
paulson@1941
   155
goal thy 
paulson@2032
   156
 "!!evs. [| evs : otway lost;  length evs <= length evs' |]    \
paulson@2032
   157
\        ==> Key (newK evs') ~: parts (sees lost C evs)";
paulson@1941
   158
by (fast_tac (!claset addDs [lemma]) 1);
paulson@1941
   159
qed "new_keys_not_seen";
paulson@1941
   160
Addsimps [new_keys_not_seen];
paulson@1941
   161
paulson@1941
   162
(*Another variant: old messages must contain old keys!*)
paulson@1941
   163
goal thy 
paulson@1941
   164
 "!!evs. [| Says A B X : set_of_list evs;  \
paulson@1941
   165
\           Key (newK evt) : parts {X};    \
paulson@2032
   166
\           evs : otway lost                 \
paulson@1941
   167
\        |] ==> length evt < length evs";
paulson@2032
   168
by (rtac ccontr 1);
paulson@2032
   169
by (dtac leI 1);
paulson@2032
   170
by (fast_tac (!claset addSDs [new_keys_not_seen, Says_imp_sees_Spy]
paulson@2014
   171
                      addIs  [impOfSubs parts_mono]) 1);
paulson@1941
   172
qed "Says_imp_old_keys";
paulson@1941
   173
paulson@1941
   174
paulson@2014
   175
(*** Future nonces can't be seen or used! [proofs resemble those above] ***)
paulson@2014
   176
paulson@2032
   177
goal thy "!!evs. evs : otway lost ==> \
paulson@2014
   178
\                length evs <= length evt --> \
paulson@2032
   179
\                Nonce (newN evt) ~: (UN C. parts (sees lost C evs))";
paulson@2032
   180
by (etac otway.induct 1);
paulson@2014
   181
(*auto_tac does not work here, as it performs safe_tac first*)
paulson@2032
   182
by (ALLGOALS (asm_simp_tac (!simpset addsimps [parts_insert2]
paulson@2014
   183
                                     addcongs [disj_cong])));
paulson@2014
   184
by (REPEAT_FIRST (fast_tac (!claset 
paulson@2032
   185
                              addSEs partsEs
paulson@2032
   186
                              addSDs  [Says_imp_sees_Spy RS parts.Inj]
paulson@2032
   187
                              addDs  [impOfSubs analz_subset_parts,
paulson@2032
   188
                                      impOfSubs parts_insert_subset_Un,
paulson@2032
   189
                                      Suc_leD]
paulson@2032
   190
                              addss (!simpset))));
paulson@2014
   191
val lemma = result();
paulson@2014
   192
paulson@2014
   193
(*Variant needed for the main theorem below*)
paulson@2014
   194
goal thy 
paulson@2032
   195
 "!!evs. [| evs : otway lost;  length evs <= length evs' |]    \
paulson@2032
   196
\        ==> Nonce (newN evs') ~: parts (sees lost C evs)";
paulson@2014
   197
by (fast_tac (!claset addDs [lemma]) 1);
paulson@2014
   198
qed "new_nonces_not_seen";
paulson@2014
   199
Addsimps [new_nonces_not_seen];
paulson@2014
   200
paulson@2014
   201
(*Another variant: old messages must contain old nonces!*)
paulson@2014
   202
goal thy 
paulson@2014
   203
 "!!evs. [| Says A B X : set_of_list evs;  \
paulson@2014
   204
\           Nonce (newN evt) : parts {X};    \
paulson@2032
   205
\           evs : otway lost                 \
paulson@2014
   206
\        |] ==> length evt < length evs";
paulson@2032
   207
by (rtac ccontr 1);
paulson@2032
   208
by (dtac leI 1);
paulson@2032
   209
by (fast_tac (!claset addSDs [new_nonces_not_seen, Says_imp_sees_Spy]
paulson@2032
   210
                      addIs  [impOfSubs parts_mono]) 1);
paulson@2014
   211
qed "Says_imp_old_nonces";
paulson@2014
   212
paulson@2014
   213
paulson@1941
   214
(*Nobody can have USED keys that will be generated in the future.
paulson@1941
   215
  ...very like new_keys_not_seen*)
paulson@2032
   216
goal thy "!!evs. evs : otway lost ==> \
paulson@1941
   217
\                length evs <= length evs' --> \
paulson@2032
   218
\                newK evs' ~: keysFor (UN C. parts (sees lost C evs))";
paulson@2064
   219
by (parts_induct_tac 1);
paulson@1941
   220
(*OR1 and OR3*)
paulson@1941
   221
by (EVERY (map (fast_tac (!claset addDs [Suc_leD] addss (!simpset))) [4,2]));
paulson@1941
   222
(*Fake, OR2, OR4: these messages send unknown (X) components*)
paulson@1941
   223
by (EVERY 
paulson@1941
   224
    (map
paulson@1941
   225
     (best_tac
paulson@1996
   226
      (!claset addDs [impOfSubs (analz_subset_parts RS keysFor_mono),
paulson@2032
   227
                      impOfSubs (parts_insert_subset_Un RS keysFor_mono),
paulson@2032
   228
                      Suc_leD]
paulson@2032
   229
               addEs [new_keys_not_seen RS not_parts_not_analz RSN(2,rev_notE)]
paulson@2032
   230
               addss (!simpset)))
paulson@1941
   231
     [3,2,1]));
paulson@2014
   232
(*Reveal: dummy message*)
paulson@1996
   233
by (best_tac (!claset addEs  [new_keys_not_seen RSN(2,rev_notE)]
paulson@2032
   234
                      addIs  [less_SucI, impOfSubs keysFor_mono]
paulson@2032
   235
                      addss (!simpset addsimps [le_def])) 1);
paulson@1941
   236
val lemma = result();
paulson@1941
   237
paulson@1941
   238
goal thy 
paulson@2032
   239
 "!!evs. [| evs : otway lost;  length evs <= length evs' |]    \
paulson@2032
   240
\        ==> newK evs' ~: keysFor (parts (sees lost C evs))";
paulson@1941
   241
by (fast_tac (!claset addSDs [lemma] addss (!simpset)) 1);
paulson@1941
   242
qed "new_keys_not_used";
paulson@1941
   243
paulson@1941
   244
bind_thm ("new_keys_not_analzd",
paulson@2032
   245
          [analz_subset_parts RS keysFor_mono,
paulson@2032
   246
           new_keys_not_used] MRS contra_subsetD);
paulson@1941
   247
paulson@1941
   248
Addsimps [new_keys_not_used, new_keys_not_analzd];
paulson@1941
   249
paulson@1941
   250
paulson@2064
   251
paulson@2064
   252
(*** Proofs involving analz ***)
paulson@2064
   253
paulson@2064
   254
(*Describes the form of Key K when the following message is sent.  The use of
paulson@2064
   255
  "parts" strengthens the induction hyp for proving the Fake case.  The
paulson@2064
   256
  assumption A ~: lost prevents its being a Faked message.  (Based
paulson@2064
   257
  on NS_Shared/Says_S_message_form) *)
paulson@2064
   258
goal thy
paulson@2064
   259
 "!!evs. evs: otway lost ==>                                           \
paulson@2064
   260
\          Crypt {|N, Key K|} (shrK A) : parts (sees lost Spy evs) &   \
paulson@2064
   261
\          A ~: lost -->                                               \
paulson@2064
   262
\        (EX evt: otway lost. K = newK evt)";
paulson@2064
   263
by (parts_induct_tac 1);
paulson@2064
   264
by (Auto_tac());
paulson@2064
   265
qed_spec_mp "Reveal_message_lemma";
paulson@2064
   266
paulson@2064
   267
(*EITHER describes the form of Key K when the following message is sent, 
paulson@2064
   268
  OR     reduces it to the Fake case.*)
paulson@2064
   269
paulson@2064
   270
goal thy 
paulson@2064
   271
 "!!evs. [| Says B' A {|N, Crypt {|N, Key K|} (shrK A)|} : set_of_list evs;  \
paulson@2064
   272
\           evs : otway lost |]                      \
paulson@2064
   273
\        ==> (EX evt: otway lost. K = newK evt)          \
paulson@2064
   274
\          | Key K : analz (sees lost Spy evs)";
paulson@2064
   275
br (Reveal_message_lemma RS disjCI) 1;
paulson@2064
   276
ba 1;
paulson@2064
   277
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]
paulson@2064
   278
                      addDs [impOfSubs analz_subset_parts]
paulson@2064
   279
                      addss (!simpset)) 1);
paulson@2064
   280
qed "Reveal_message_form";
paulson@2064
   281
paulson@2064
   282
paulson@2064
   283
(*For proofs involving analz.  We again instantiate the variable to "lost".*)
paulson@2064
   284
val analz_Fake_tac = 
paulson@2064
   285
    dres_inst_tac [("lost","lost")] OR2_analz_sees_Spy 4 THEN 
paulson@2064
   286
    dres_inst_tac [("lost","lost")] OR4_analz_sees_Spy 6 THEN
paulson@2064
   287
    forw_inst_tac [("lost","lost")] Reveal_message_form 7;
paulson@1941
   288
paulson@1941
   289
paulson@1941
   290
(****
paulson@1941
   291
 The following is to prove theorems of the form
paulson@1941
   292
paulson@2032
   293
          Key K : analz (insert (Key (newK evt)) (sees lost Spy evs)) ==>
paulson@2032
   294
          Key K : analz (sees lost Spy evs)
paulson@1941
   295
paulson@1941
   296
 A more general formula must be proved inductively.
paulson@1941
   297
paulson@1941
   298
****)
paulson@1941
   299
paulson@1941
   300
paulson@1941
   301
(*NOT useful in this form, but it says that session keys are not used
paulson@1941
   302
  to encrypt messages containing other keys, in the actual protocol.
paulson@1941
   303
  We require that agents should behave like this subsequently also.*)
paulson@1941
   304
goal thy 
paulson@2032
   305
 "!!evs. evs : otway lost ==> \
paulson@2032
   306
\        (Crypt X (newK evt)) : parts (sees lost Spy evs) & \
paulson@2032
   307
\        Key K : parts {X} --> Key K : parts (sees lost Spy evs)";
paulson@2032
   308
by (etac otway.induct 1);
paulson@2014
   309
by parts_Fake_tac;
paulson@2032
   310
by (ALLGOALS Asm_simp_tac);
paulson@1941
   311
(*Deals with Faked messages*)
paulson@1941
   312
by (best_tac (!claset addSEs partsEs
paulson@2032
   313
                      addDs [impOfSubs parts_insert_subset_Un]
paulson@1964
   314
                      addss (!simpset)) 2);
paulson@2014
   315
(*Base case and Reveal*)
paulson@1964
   316
by (Auto_tac());
paulson@1941
   317
result();
paulson@1941
   318
paulson@1941
   319
paulson@1941
   320
(** Session keys are not used to encrypt other session keys **)
paulson@1941
   321
paulson@2014
   322
(*The equality makes the induction hypothesis easier to apply*)
paulson@1941
   323
goal thy  
paulson@2032
   324
 "!!evs. evs : otway lost ==> \
paulson@2032
   325
\  ALL K E. (Key K : analz (Key``(newK``E) Un (sees lost Spy evs))) = \
paulson@2032
   326
\           (K : newK``E | Key K : analz (sees lost Spy evs))";
paulson@2032
   327
by (etac otway.induct 1);
paulson@2064
   328
by analz_Fake_tac;
paulson@2045
   329
by (REPEAT_FIRST (ares_tac [allI, analz_image_newK_lemma]));
paulson@2014
   330
by (REPEAT ((eresolve_tac [bexE, disjE] ORELSE' hyp_subst_tac) 7));
paulson@2014
   331
by (ALLGOALS (*Takes 28 secs*)
paulson@1941
   332
    (asm_simp_tac 
paulson@1941
   333
     (!simpset addsimps ([insert_Key_singleton, insert_Key_image, pushKey_newK]
paulson@2032
   334
                         @ pushes)
paulson@1941
   335
               setloop split_tac [expand_if])));
paulson@2014
   336
(** LEVEL 7 **)
paulson@2014
   337
(*Reveal case 2, OR4, OR2, Fake*) 
paulson@2032
   338
by (EVERY (map spy_analz_tac [7,5,3,2]));
paulson@2014
   339
(*Reveal case 1, OR3, Base*)
paulson@2064
   340
by (REPEAT (fast_tac (!claset addIs [image_eqI] addss (!simpset)) 1));
paulson@1941
   341
qed_spec_mp "analz_image_newK";
paulson@1941
   342
paulson@1941
   343
paulson@1941
   344
goal thy
paulson@2032
   345
 "!!evs. evs : otway lost ==>                               \
paulson@2032
   346
\        Key K : analz (insert (Key (newK evt)) (sees lost Spy evs)) = \
paulson@2032
   347
\        (K = newK evt | Key K : analz (sees lost Spy evs))";
paulson@1941
   348
by (asm_simp_tac (HOL_ss addsimps [pushKey_newK, analz_image_newK, 
paulson@2032
   349
                                   insert_Key_singleton]) 1);
paulson@1941
   350
by (Fast_tac 1);
paulson@1941
   351
qed "analz_insert_Key_newK";
paulson@1941
   352
paulson@1941
   353
paulson@2026
   354
(*** The Key K uniquely identifies the Server's  message. **)
paulson@2014
   355
paulson@2014
   356
fun ex_strip_tac i = REPEAT (ares_tac [exI, conjI] i) THEN assume_tac (i+1);
paulson@2014
   357
paulson@2014
   358
goal thy 
paulson@2032
   359
 "!!evs. evs : otway lost ==>                      \
paulson@2014
   360
\      EX A' B' NA' NB'. ALL A B NA NB.                    \
paulson@2014
   361
\       Says Server B \
paulson@2014
   362
\            {|NA, Crypt {|NA, K|} (shrK A),                      \
paulson@2014
   363
\                  Crypt {|NB, K|} (shrK B)|} : set_of_list evs --> \
paulson@2014
   364
\       A=A' & B=B' & NA=NA' & NB=NB'";
paulson@2032
   365
by (etac otway.induct 1);
paulson@2014
   366
by (ALLGOALS (asm_simp_tac (!simpset addsimps [all_conj_distrib])));
paulson@2014
   367
by (Step_tac 1);
paulson@2014
   368
(*Remaining cases: OR3 and OR4*)
paulson@2014
   369
by (ex_strip_tac 2);
paulson@2014
   370
by (Fast_tac 2);
paulson@2064
   371
by (expand_case_tac "K = ?y" 1);
paulson@2064
   372
by (REPEAT (ares_tac [refl,exI,impI,conjI] 2));
paulson@2014
   373
(*...we assume X is a very new message, and handle this case by contradiction*)
paulson@2014
   374
by (fast_tac (!claset addEs [Says_imp_old_keys RS less_irrefl]
paulson@2032
   375
                      delrules [conjI]    (*prevent split-up into 4 subgoals*)
paulson@2032
   376
                      addss (!simpset addsimps [parts_insertI])) 1);
paulson@2014
   377
val lemma = result();
paulson@2014
   378
paulson@2014
   379
goal thy 
paulson@2014
   380
 "!!evs. [| Says Server B                                          \
paulson@2014
   381
\              {|NA, Crypt {|NA, K|} (shrK A),                     \
paulson@2014
   382
\                    Crypt {|NB, K|} (shrK B)|}                    \
paulson@2014
   383
\            : set_of_list evs;                                    \ 
paulson@2014
   384
\           Says Server B'                                         \
paulson@2014
   385
\              {|NA', Crypt {|NA', K|} (shrK A'),                  \
paulson@2014
   386
\                     Crypt {|NB', K|} (shrK B')|}                 \
paulson@2014
   387
\            : set_of_list evs;                                    \
paulson@2032
   388
\           evs : otway lost |]                                         \
paulson@2014
   389
\        ==> A=A' & B=B' & NA=NA' & NB=NB'";
paulson@2032
   390
by (dtac lemma 1);
paulson@2014
   391
by (REPEAT (etac exE 1));
paulson@2014
   392
(*Duplicate the assumption*)
paulson@2014
   393
by (forw_inst_tac [("psi", "ALL C.?P(C)")] asm_rl 1);
paulson@2014
   394
by (fast_tac (!claset addSDs [spec]) 1);
paulson@2014
   395
qed "unique_session_keys";
paulson@2014
   396
paulson@2014
   397
paulson@2014
   398
paulson@2048
   399
(**** Authenticity properties relating to NA ****)
paulson@2014
   400
paulson@2014
   401
(*Only OR1 can have caused such a part of a message to appear.*)
paulson@2014
   402
goal thy 
paulson@2064
   403
 "!!evs. [| A ~: lost;  evs : otway lost |]                        \
paulson@2064
   404
\        ==> Crypt {|NA, Agent A, Agent B|} (shrK A)               \
paulson@2064
   405
\             : parts (sees lost Spy evs) -->                      \
paulson@2064
   406
\            Says A B {|NA, Agent A, Agent B,                      \
paulson@2014
   407
\                       Crypt {|NA, Agent A, Agent B|} (shrK A)|}  \
paulson@2014
   408
\             : set_of_list evs";
paulson@2064
   409
by (parts_induct_tac 1);
paulson@2014
   410
qed_spec_mp "Crypt_imp_OR1";
paulson@2014
   411
paulson@2014
   412
paulson@2064
   413
(** The Nonce NA uniquely identifies A's message. **)
paulson@2014
   414
paulson@2014
   415
goal thy 
paulson@2032
   416
 "!!evs. [| evs : otway lost; A ~: lost |]               \
paulson@2014
   417
\ ==> EX B'. ALL B.    \
paulson@2048
   418
\        Crypt {|NA, Agent A, Agent B|} (shrK A) : parts (sees lost Spy evs) \
paulson@2048
   419
\        --> B = B'";
paulson@2064
   420
by (parts_induct_tac 1);
paulson@2064
   421
by (simp_tac (!simpset addsimps [all_conj_distrib]) 1); 
paulson@2026
   422
(*OR1: creation of new Nonce.  Move assertion into global context*)
paulson@2064
   423
by (expand_case_tac "NA = ?y" 1);
paulson@2014
   424
by (best_tac (!claset addSEs partsEs
paulson@2032
   425
                      addEs  [new_nonces_not_seen RSN(2,rev_notE)]) 1);
paulson@2014
   426
val lemma = result();
paulson@2014
   427
paulson@2014
   428
goal thy 
paulson@2048
   429
 "!!evs.[| Crypt {|NA, Agent A, Agent B|} (shrK A): parts(sees lost Spy evs); \
paulson@2048
   430
\          Crypt {|NA, Agent A, Agent C|} (shrK A): parts(sees lost Spy evs); \
paulson@2048
   431
\          evs : otway lost;  A ~: lost |]                                    \
paulson@2014
   432
\        ==> B = C";
paulson@2032
   433
by (dtac lemma 1);
paulson@2032
   434
by (assume_tac 1);
paulson@2014
   435
by (etac exE 1);
paulson@2014
   436
(*Duplicate the assumption*)
paulson@2014
   437
by (forw_inst_tac [("psi", "ALL C.?P(C)")] asm_rl 1);
paulson@2014
   438
by (fast_tac (!claset addSDs [spec]) 1);
paulson@2048
   439
qed "unique_NA";
paulson@2014
   440
paulson@2014
   441
paulson@2014
   442
val nonce_not_seen_now = le_refl RSN (2, new_nonces_not_seen) RSN (2,rev_notE);
paulson@2014
   443
paulson@2014
   444
(*It is impossible to re-use a nonce in both OR1 and OR2.  This holds because
paulson@2014
   445
  OR2 encrypts Nonce NB.  It prevents the attack that can occur in the
paulson@2014
   446
  over-simplified version of this protocol: see OtwayRees_Bad.*)
paulson@2014
   447
goal thy 
paulson@2032
   448
 "!!evs. [| A ~: lost;  evs : otway lost |]                            \
paulson@2014
   449
\        ==> Crypt {|NA, Agent A, Agent B|} (shrK A)             \
paulson@2032
   450
\             : parts (sees lost Spy evs) -->                       \
paulson@2014
   451
\            Crypt {|NA', NA, Agent A', Agent A|} (shrK A)       \
paulson@2032
   452
\             ~: parts (sees lost Spy evs)";
paulson@2032
   453
by (etac otway.induct 1);
paulson@2014
   454
by (ALLGOALS (asm_simp_tac (!simpset addsimps [parts_insert2])));
paulson@2014
   455
(*It is hard to generate this proof in a reasonable amount of time*)
paulson@2014
   456
by (step_tac (!claset addSEs [MPair_parts, nonce_not_seen_now]
paulson@2032
   457
                      addSDs [Says_imp_sees_Spy RS parts.Inj]) 1);
paulson@2014
   458
by (REPEAT_FIRST (fast_tac (!claset (*40 seconds??*)
paulson@2032
   459
                            addSDs  [impOfSubs analz_subset_parts,
paulson@2032
   460
                                     impOfSubs parts_insert_subset_Un]
paulson@2032
   461
                            addss  (!simpset))));
paulson@2014
   462
by (REPEAT_FIRST (fast_tac (!claset 
paulson@2032
   463
                              addSEs (partsEs@[nonce_not_seen_now])
paulson@2026
   464
                              addSDs  [impOfSubs parts_insert_subset_Un]
paulson@2014
   465
                              addss (!simpset))));
paulson@2014
   466
qed_spec_mp"no_nonce_OR1_OR2";
paulson@2014
   467
paulson@2014
   468
paulson@2053
   469
(*Crucial property: If the encrypted message appears, and A has used NA
paulson@2053
   470
  to start a run, then it originated with the Server!*)
paulson@2014
   471
goal thy 
paulson@2048
   472
 "!!evs. [| A ~: lost;  A ~= Spy;  evs : otway lost |]                 \
paulson@2048
   473
\    ==> Crypt {|NA, Key K|} (shrK A) : parts (sees lost Spy evs)      \
paulson@2048
   474
\        --> Says A B {|NA, Agent A, Agent B,                          \
paulson@2048
   475
\                       Crypt {|NA, Agent A, Agent B|} (shrK A)|}      \
paulson@2048
   476
\             : set_of_list evs -->                                    \
paulson@2048
   477
\            (EX NB. Says Server B                                     \
paulson@2048
   478
\                 {|NA,                                                \
paulson@2048
   479
\                   Crypt {|NA, Key K|} (shrK A),                      \
paulson@2048
   480
\                   Crypt {|NB, Key K|} (shrK B)|}                     \
paulson@2014
   481
\                   : set_of_list evs)";
paulson@2064
   482
by (parts_induct_tac 1);
paulson@2014
   483
(*OR1: it cannot be a new Nonce, contradiction.*)
paulson@2014
   484
by (fast_tac (!claset addSIs [parts_insertI]
paulson@2032
   485
                      addSEs partsEs
paulson@2032
   486
                      addEs [Says_imp_old_nonces RS less_irrefl]
paulson@2032
   487
                      addss (!simpset)) 1);
paulson@2064
   488
(*OR3 and OR4*) 
paulson@2014
   489
(*OR4*)
paulson@2014
   490
by (REPEAT (Safe_step_tac 2));
paulson@2014
   491
by (REPEAT (best_tac (!claset addSDs [parts_cut]) 3));
paulson@2014
   492
by (fast_tac (!claset addSIs [Crypt_imp_OR1]
paulson@2032
   493
                      addEs  partsEs
paulson@2032
   494
                      addDs [Says_imp_sees_Spy RS parts.Inj]) 2);
paulson@2064
   495
(*OR3*)  (** LEVEL 5 **)
paulson@2064
   496
by (asm_simp_tac (!simpset addsimps [ex_disj_distrib]) 1);
paulson@2014
   497
by (step_tac (!claset delrules [disjCI, impCE]) 1);
paulson@2014
   498
by (fast_tac (!claset addSEs [MPair_parts]
paulson@2032
   499
                      addSDs [Says_imp_sees_Spy RS parts.Inj]
paulson@2014
   500
                      addEs  [no_nonce_OR1_OR2 RSN (2, rev_notE)]
paulson@2048
   501
                      delrules [conjI] (*stop split-up into 4 subgoals*)) 2);
paulson@2048
   502
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS parts.Inj]
paulson@2048
   503
                      addSEs [MPair_parts]
paulson@2048
   504
                      addEs  [unique_NA]) 1);
paulson@2048
   505
qed_spec_mp "NA_Crypt_imp_Server_msg";
paulson@2014
   506
paulson@2014
   507
paulson@2053
   508
(*Corollary: if A receives B's OR4 message and the nonce NA agrees
paulson@2014
   509
  then the key really did come from the Server!  CANNOT prove this of the
paulson@2048
   510
  bad form of this protocol, even though we can prove
paulson@2032
   511
  Spy_not_see_encrypted_key*)
paulson@2014
   512
goal thy 
paulson@2053
   513
 "!!evs. [| Says B' A {|NA, Crypt {|NA, Key K|} (shrK A)|}         \
paulson@2053
   514
\            : set_of_list evs;                                    \
paulson@2053
   515
\           Says A B {|NA, Agent A, Agent B,                       \
paulson@2053
   516
\                      Crypt {|NA, Agent A, Agent B|} (shrK A)|}   \
paulson@2053
   517
\            : set_of_list evs;                                    \
paulson@2053
   518
\           A ~: lost;  A ~= Spy;  evs : otway lost |]             \
paulson@2053
   519
\        ==> EX NB. Says Server B                                  \
paulson@2048
   520
\                     {|NA,                                        \
paulson@2048
   521
\                       Crypt {|NA, Key K|} (shrK A),              \
paulson@2048
   522
\                       Crypt {|NB, Key K|} (shrK B)|}             \
paulson@2053
   523
\                       : set_of_list evs";
paulson@2048
   524
by (fast_tac (!claset addSIs [NA_Crypt_imp_Server_msg]
paulson@2032
   525
                      addEs  partsEs
paulson@2032
   526
                      addDs  [Says_imp_sees_Spy RS parts.Inj]) 1);
paulson@2064
   527
qed "A_trust_OR4";
paulson@2014
   528
paulson@2014
   529
paulson@2014
   530
(*Describes the form of K and NA when the Server sends this message.*)
paulson@1941
   531
goal thy 
paulson@1941
   532
 "!!evs. [| Says Server B \
paulson@1941
   533
\            {|NA, Crypt {|NA, K|} (shrK A),                      \
paulson@1941
   534
\                  Crypt {|NB, K|} (shrK B)|} : set_of_list evs;  \
paulson@2032
   535
\           evs : otway lost |]                                        \
paulson@2032
   536
\        ==> (EX evt: otway lost. K = Key(newK evt)) &                  \
paulson@2048
   537
\            (EX i. NA = Nonce i) &                  \
paulson@2048
   538
\            (EX j. NB = Nonce j)";
paulson@2032
   539
by (etac rev_mp 1);
paulson@2032
   540
by (etac otway.induct 1);
paulson@2048
   541
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
paulson@1941
   542
qed "Says_Server_message_form";
paulson@1941
   543
paulson@1941
   544
paulson@2048
   545
(** Crucial secrecy property: Spy does not see the keys sent in msg OR3
paulson@2048
   546
    Does not in itself guarantee security: an attack could violate 
paulson@2048
   547
    the premises, e.g. by having A=Spy **)
paulson@2014
   548
paulson@1941
   549
goal thy 
paulson@2032
   550
 "!!evs. [| A ~: lost;  B ~: lost;  evs : otway lost;  evt : otway lost |] \
paulson@2048
   551
\        ==> Says Server B                                                 \
paulson@2048
   552
\              {|NA, Crypt {|NA, Key K|} (shrK A),                         \
paulson@2048
   553
\                Crypt {|NB, Key K|} (shrK B)|} : set_of_list evs -->      \
paulson@2048
   554
\            Says A Spy {|NA, Key K|} ~: set_of_list evs -->               \
paulson@2048
   555
\            Key K ~: analz (sees lost Spy evs)";
paulson@2032
   556
by (etac otway.induct 1);
paulson@2064
   557
by analz_Fake_tac;
paulson@2014
   558
by (REPEAT_FIRST (eresolve_tac [asm_rl, bexE, disjE] ORELSE' hyp_subst_tac));
paulson@1964
   559
by (ALLGOALS
paulson@1941
   560
    (asm_full_simp_tac 
paulson@1941
   561
     (!simpset addsimps ([analz_subset_parts RS contra_subsetD,
paulson@2032
   562
                          analz_insert_Key_newK] @ pushes)
paulson@1941
   563
               setloop split_tac [expand_if])));
paulson@2014
   564
(** LEVEL 6 **)
paulson@1941
   565
(*OR3*)
paulson@2014
   566
by (fast_tac (!claset addSIs [parts_insertI]
paulson@2032
   567
                      addEs [Says_imp_old_keys RS less_irrefl]
paulson@2048
   568
                      addss (!simpset addsimps [parts_insert2])) 3);
paulson@2014
   569
(*Reveal case 2, OR4, OR2, Fake*) 
paulson@2032
   570
by (REPEAT_FIRST (resolve_tac [conjI, impI] ORELSE' spy_analz_tac));
paulson@2014
   571
(*Reveal case 1*) (** LEVEL 8 **)
paulson@2032
   572
by (excluded_middle_tac "Aa : lost" 1);
paulson@2048
   573
(*But this contradicts Key K ~: analz (sees lost Spy evsa) *)
paulson@2032
   574
by (dtac (Says_imp_sees_Spy RS analz.Inj) 2);
paulson@2014
   575
by (fast_tac (!claset addSDs [analz.Decrypt] addss (!simpset)) 2);
paulson@2032
   576
(*So now we have  Aa ~: lost *)
paulson@2064
   577
by (dtac A_trust_OR4 1);
paulson@2014
   578
by (REPEAT (assume_tac 1));
paulson@2014
   579
by (fast_tac (!claset addDs [unique_session_keys] addss (!simpset)) 1);
paulson@2014
   580
val lemma = result() RS mp RS mp RSN(2,rev_notE);
paulson@2014
   581
paulson@2014
   582
goal thy 
paulson@2014
   583
 "!!evs. [| Says Server B \
paulson@2048
   584
\            {|NA, Crypt {|NA, K|} (shrK A),                             \
paulson@2048
   585
\                  Crypt {|NB, K|} (shrK B)|} : set_of_list evs;         \
paulson@2048
   586
\           Says A Spy {|NA, K|} ~: set_of_list evs;                     \
paulson@2032
   587
\           A ~: lost;  B ~: lost;  evs : otway lost |]                  \
paulson@2032
   588
\        ==> K ~: analz (sees lost Spy evs)";
paulson@2014
   589
by (forward_tac [Says_Server_message_form] 1 THEN assume_tac 1);
paulson@2014
   590
by (fast_tac (!claset addSEs [lemma]) 1);
paulson@2032
   591
qed "Spy_not_see_encrypted_key";
paulson@2032
   592
paulson@1945
   593
paulson@2032
   594
goal thy 
paulson@2048
   595
 "!!evs. [| C ~: {A,B,Server};                                           \
paulson@2048
   596
\           Says Server B                                                \
paulson@2048
   597
\            {|NA, Crypt {|NA, K|} (shrK A),                             \
paulson@2048
   598
\                  Crypt {|NB, K|} (shrK B)|} : set_of_list evs;         \
paulson@2048
   599
\           Says A Spy {|NA, K|} ~: set_of_list evs;                     \
paulson@2032
   600
\           A ~: lost;  B ~: lost;  evs : otway lost |]                  \
paulson@2032
   601
\        ==> K ~: analz (sees lost C evs)";
paulson@2032
   602
by (rtac (subset_insertI RS sees_mono RS analz_mono RS contra_subsetD) 1);
paulson@2032
   603
by (rtac (sees_lost_agent_subset_sees_Spy RS analz_mono RS contra_subsetD) 1);
paulson@2032
   604
by (FIRSTGOAL (rtac Spy_not_see_encrypted_key));
paulson@2032
   605
by (REPEAT_FIRST (fast_tac (!claset addIs [otway_mono RS subsetD])));
paulson@2032
   606
qed "Agent_not_see_encrypted_key";
paulson@1945
   607
paulson@1945
   608
paulson@2048
   609
(**** Authenticity properties relating to NB ****)
paulson@2048
   610
paulson@2048
   611
(*Only OR2 can have caused such a part of a message to appear.  We do not
paulson@2048
   612
  know anything about X'.*)
paulson@2048
   613
goal thy 
paulson@2048
   614
 "!!evs. [| B ~: lost;  evs : otway lost |]                    \
paulson@2048
   615
\        ==> Crypt {|NA, NB, Agent A, Agent B|} (shrK B)       \
paulson@2048
   616
\             : parts (sees lost Spy evs) -->                  \
paulson@2048
   617
\            (EX X'. Says B Server                             \
paulson@2048
   618
\             {|NA, Agent A, Agent B, X',                      \
paulson@2048
   619
\               Crypt {|NA, NB, Agent A, Agent B|} (shrK B)|}  \
paulson@2048
   620
\             : set_of_list evs)";
paulson@2064
   621
by (parts_induct_tac 1);
paulson@2064
   622
by (auto_tac (!claset, !simpset addcongs [conj_cong]));
paulson@2048
   623
qed_spec_mp "Crypt_imp_OR2";
paulson@2048
   624
paulson@2048
   625
paulson@2048
   626
(** The Nonce NB uniquely identifies B's  message. **)
paulson@2048
   627
paulson@2048
   628
goal thy 
paulson@2048
   629
 "!!evs. [| evs : otway lost; B ~: lost |]               \
paulson@2064
   630
\ ==> EX NA' A'. ALL NA A.                               \
paulson@2048
   631
\      Crypt {|NA, NB, Agent A, Agent B|} (shrK B) : parts(sees lost Spy evs) \
paulson@2048
   632
\      --> NA = NA' & A = A'";
paulson@2064
   633
by (parts_induct_tac 1);
paulson@2064
   634
by (simp_tac (!simpset addsimps [all_conj_distrib]) 1); 
paulson@2048
   635
(*OR2: creation of new Nonce.  Move assertion into global context*)
paulson@2064
   636
by (expand_case_tac "NB = ?y" 1);
paulson@2048
   637
by (fast_tac (!claset addSEs (nonce_not_seen_now::partsEs)) 1);
paulson@2048
   638
val lemma = result();
paulson@2048
   639
paulson@2048
   640
goal thy 
paulson@2048
   641
 "!!evs.[| Crypt {|NA, NB, Agent A, Agent B|} (shrK B) \
paulson@2048
   642
\                  : parts(sees lost Spy evs);         \
paulson@2048
   643
\          Crypt {|NC, NB, Agent C, Agent B|} (shrK B) \
paulson@2048
   644
\                  : parts(sees lost Spy evs);         \
paulson@2048
   645
\          evs : otway lost;  B ~: lost |]             \
paulson@2048
   646
\        ==> NC = NA & C = A";
paulson@2048
   647
by (dtac lemma 1);
paulson@2048
   648
by (assume_tac 1);
paulson@2048
   649
by (REPEAT (etac exE 1));
paulson@2048
   650
(*Duplicate the assumption*)
paulson@2048
   651
by (forw_inst_tac [("psi", "ALL C.?P(C)")] asm_rl 1);
paulson@2048
   652
by (fast_tac (!claset addSDs [spec]) 1);
paulson@2048
   653
qed "unique_NB";
paulson@2048
   654
paulson@2048
   655
paulson@2048
   656
(*If the encrypted message appears, and B has used Nonce NB,
paulson@2048
   657
  then it originated with the Server!*)
paulson@2048
   658
goal thy 
paulson@2048
   659
 "!!evs. [| B ~: lost;  B ~= Spy;  evs : otway lost |]                   \
paulson@2048
   660
\    ==> Crypt {|NB, Key K|} (shrK B) : parts (sees lost Spy evs)        \
paulson@2048
   661
\        --> (ALL X'. Says B Server                                      \
paulson@2048
   662
\                       {|NA, Agent A, Agent B, X',                      \
paulson@2048
   663
\                         Crypt {|NA, NB, Agent A, Agent B|} (shrK B)|}  \
paulson@2048
   664
\             : set_of_list evs                                          \
paulson@2048
   665
\             --> Says Server B                                          \
paulson@2048
   666
\                  {|NA, Crypt {|NA, Key K|} (shrK A),                   \
paulson@2048
   667
\                        Crypt {|NB, Key K|} (shrK B)|}                  \
paulson@2048
   668
\                   : set_of_list evs)";
paulson@2064
   669
by (parts_induct_tac 1);
paulson@2048
   670
(*OR1: it cannot be a new Nonce, contradiction.*)
paulson@2048
   671
by (fast_tac (!claset addSIs [parts_insertI]
paulson@2048
   672
                      addSEs partsEs
paulson@2048
   673
                      addEs [Says_imp_old_nonces RS less_irrefl]
paulson@2048
   674
                      addss (!simpset)) 1);
paulson@2048
   675
(*OR3 and OR4*)  (** LEVEL 5 **)
paulson@2048
   676
(*OR4*)
paulson@2048
   677
by (REPEAT (Safe_step_tac 2));
paulson@2048
   678
br (Crypt_imp_OR2 RS exE) 2;
paulson@2048
   679
by (REPEAT (fast_tac (!claset addEs partsEs) 2));
paulson@2048
   680
(*OR3*)  (** LEVEL 8 **)
paulson@2048
   681
by (step_tac (!claset delrules [disjCI, impCE]) 1);
paulson@2048
   682
by (fast_tac (!claset delrules [conjI] (*stop split-up*)) 3); 
paulson@2048
   683
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS parts.Inj]
paulson@2048
   684
                      addSEs [MPair_parts]
paulson@2048
   685
                      addDs  [unique_NB]) 2);
paulson@2048
   686
by (fast_tac (!claset addSEs [MPair_parts]
paulson@2048
   687
                      addSDs [Says_imp_sees_Spy RS parts.Inj]
paulson@2048
   688
                      addSEs  [no_nonce_OR1_OR2 RSN (2, rev_notE)]
paulson@2048
   689
                      delrules [conjI, impCE] (*stop split-up*)) 1);
paulson@2048
   690
qed_spec_mp "NB_Crypt_imp_Server_msg";
paulson@2048
   691
paulson@2048
   692
paulson@2048
   693
(*Guarantee for B: if it gets a message with matching NB then the Server
paulson@2048
   694
  has sent the correct message.*)
paulson@2048
   695
goal thy 
paulson@2048
   696
 "!!evs. [| B ~: lost;  B ~= Spy;  evs : otway lost;               \
paulson@2048
   697
\           Says S B {|NA, X, Crypt {|NB, Key K|} (shrK B)|}       \
paulson@2048
   698
\            : set_of_list evs;                                    \
paulson@2048
   699
\           Says B Server {|NA, Agent A, Agent B, X',              \
paulson@2048
   700
\                           Crypt {|NA, NB, Agent A, Agent B|}     \
paulson@2048
   701
\                                 (shrK B)|}                       \
paulson@2048
   702
\            : set_of_list evs |]                                  \
paulson@2048
   703
\        ==> Says Server B                                         \
paulson@2048
   704
\                 {|NA,                                            \
paulson@2048
   705
\                   Crypt {|NA, Key K|} (shrK A),                  \
paulson@2048
   706
\                   Crypt {|NB, Key K|} (shrK B)|}                 \
paulson@2048
   707
\                   : set_of_list evs";
paulson@2048
   708
by (fast_tac (!claset addSIs [NB_Crypt_imp_Server_msg]
paulson@2048
   709
                      addEs  partsEs
paulson@2048
   710
                      addDs  [Says_imp_sees_Spy RS parts.Inj]) 1);
paulson@2064
   711
qed "B_trust_OR3";
paulson@2048
   712
paulson@2048
   713
paulson@2064
   714
B_trust_OR3 RS Spy_not_see_encrypted_key;
paulson@2048
   715
paulson@2048
   716
paulson@2026
   717
(** A session key uniquely identifies a pair of senders in the message
paulson@2048
   718
    encrypted by a good agent C.  NEEDED?  INTERESTING?**)
paulson@1945
   719
goal thy 
paulson@2032
   720
 "!!evs. evs : otway lost ==>                                           \
paulson@2026
   721
\      EX A B. ALL C N.                                            \
paulson@2032
   722
\         C ~: lost -->                                             \
paulson@2032
   723
\         Crypt {|N, Key K|} (shrK C) : parts (sees lost Spy evs) --> \
paulson@2026
   724
\         C=A | C=B";
paulson@2032
   725
by (Simp_tac 1);        (*Miniscoping*)
paulson@2032
   726
by (etac otway.induct 1);
paulson@2064
   727
by analz_Fake_tac;
paulson@2032
   728
(*spy_analz_tac just does not work here: it is an entirely different proof!*)
paulson@1945
   729
by (ALLGOALS 
paulson@2026
   730
    (asm_simp_tac (!simpset addsimps [all_conj_distrib, ex_disj_distrib,
paulson@2032
   731
                                      imp_conj_distrib, parts_insert_sees,
paulson@2032
   732
                                      parts_insert2])));
paulson@1945
   733
by (REPEAT_FIRST (etac exE));
paulson@2026
   734
(*OR3: extraction of K = newK evsa to global context...*) (** LEVEL 6 **)
paulson@2064
   735
by (expand_case_tac "K = ?y" 4);
paulson@2064
   736
by (REPEAT (ares_tac [exI] 5));
paulson@1945
   737
(*...we prove this case by contradiction: the key is too new!*)
paulson@2026
   738
by (fast_tac (!claset addSEs partsEs
paulson@2032
   739
                      addEs [Says_imp_old_keys RS less_irrefl]
paulson@2032
   740
                      addss (!simpset)) 4);
paulson@2026
   741
(*Base, Fake, OR2, OR4*)
paulson@2026
   742
by (REPEAT_FIRST ex_strip_tac);
paulson@2032
   743
by (dtac synth.Inj 4);
paulson@2032
   744
by (dtac synth.Inj 3);
paulson@2026
   745
(*Now in effect there are three Fake cases*)
paulson@2026
   746
by (REPEAT_FIRST (best_tac (!claset addDs [impOfSubs Fake_parts_insert]
paulson@2032
   747
                                    delrules [disjCI, disjE]
paulson@2032
   748
                                    addss (!simpset))));
paulson@2014
   749
qed "key_identifies_senders";
paulson@2032
   750
paulson@2032
   751