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