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