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