src/HOL/Auth/OtwayRees.ML
author paulson
Fri Sep 13 13:20:22 1996 +0200 (1996-09-13)
changeset 1996 33c42cae3dd0
parent 1967 0ff58b41c037
child 1999 b5efc4108d04
permissions -rw-r--r--
Uses the improved enemy_analz_tac of Shared.ML, with simpler proofs
Weak liveness
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@1941
     8
From page 244 of
paulson@1941
     9
  Burrows, Abadi and Needham.  A Logic of Authentication.
paulson@1941
    10
  Proc. Royal Soc. 426 (1989)
paulson@1941
    11
*)
paulson@1941
    12
paulson@1941
    13
open OtwayRees;
paulson@1941
    14
paulson@1941
    15
proof_timing:=true;
paulson@1941
    16
HOL_quantifiers := false;
paulson@1941
    17
paulson@1996
    18
paulson@1996
    19
(** Weak liveness: there are traces that reach the end **)
paulson@1996
    20
paulson@1996
    21
goal thy 
paulson@1996
    22
 "!!A B. [| A ~= B; A ~= Server; B ~= Server |]   \
paulson@1996
    23
\        ==> EX K. EX evs: otway.          \
paulson@1996
    24
\               Says A B (Crypt (Agent A) K) : set_of_list evs";
paulson@1996
    25
by (REPEAT (resolve_tac [exI,bexI] 1));
paulson@1996
    26
br (otway.Nil RS otway.OR1 RS otway.OR2 RS otway.OR3 RS otway.OR4 RS 
paulson@1996
    27
    otway.OR5) 2;
paulson@1996
    28
by (ALLGOALS (simp_tac (!simpset setsolver safe_solver)));
paulson@1996
    29
by (REPEAT_FIRST (resolve_tac [refl, conjI]));
paulson@1996
    30
by (ALLGOALS (fast_tac (!claset addss (!simpset setsolver safe_solver))));
paulson@1996
    31
qed "weak_liveness";
paulson@1996
    32
paulson@1996
    33
paulson@1941
    34
(**** Inductive proofs about otway ****)
paulson@1941
    35
paulson@1941
    36
(*The Enemy can see more than anybody else, except for their initial state*)
paulson@1941
    37
goal thy 
paulson@1941
    38
 "!!evs. evs : otway ==> \
paulson@1941
    39
\     sees A evs <= initState A Un sees Enemy evs";
paulson@1941
    40
be otway.induct 1;
paulson@1941
    41
by (ALLGOALS (fast_tac (!claset addDs [sees_Says_subset_insert RS subsetD] 
paulson@1941
    42
			        addss (!simpset))));
paulson@1941
    43
qed "sees_agent_subset_sees_Enemy";
paulson@1941
    44
paulson@1941
    45
paulson@1941
    46
(*Nobody sends themselves messages*)
paulson@1941
    47
goal thy "!!evs. evs : otway ==> ALL A X. Says A A X ~: set_of_list evs";
paulson@1941
    48
be 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
goal thy "!!evs. evs : otway ==> Notes A X ~: set_of_list evs";
paulson@1941
    55
be otway.induct 1;
paulson@1941
    56
by (Auto_tac());
paulson@1941
    57
qed "not_Notes";
paulson@1941
    58
Addsimps [not_Notes];
paulson@1941
    59
AddSEs   [not_Notes RSN (2, rev_notE)];
paulson@1941
    60
paulson@1941
    61
paulson@1941
    62
(** For reasoning about the encrypted portion of messages **)
paulson@1941
    63
paulson@1996
    64
goal thy "!!evs. Says A' B {|N, Agent A, Agent B, X|} : set_of_list evs ==> \
paulson@1941
    65
\                X : analz (sees Enemy evs)";
paulson@1941
    66
by (fast_tac (!claset addSDs [Says_imp_sees_Enemy RS analz.Inj]) 1);
paulson@1941
    67
qed "OR2_analz_sees_Enemy";
paulson@1941
    68
paulson@1996
    69
goal thy "!!evs. Says S B {|N, X, 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 "OR4_analz_sees_Enemy";
paulson@1941
    73
paulson@1996
    74
goal thy "!!evs. Says B' A {|N, Crypt {|N,K|} K'|} : set_of_list evs ==> \
paulson@1941
    75
\                K : parts (sees Enemy evs)";
paulson@1941
    76
by (fast_tac (!claset addSEs partsEs
paulson@1941
    77
	              addSDs [Says_imp_sees_Enemy RS parts.Inj]) 1);
paulson@1941
    78
qed "OR5_parts_sees_Enemy";
paulson@1941
    79
paulson@1941
    80
(*OR2_analz... and OR4_analz... let us treat those cases using the same 
paulson@1964
    81
  argument as for the Fake case.  This is possible for most, but not all,
paulson@1964
    82
  proofs: Fake does not invent new nonces (as in OR2), and of course Fake
paulson@1964
    83
  messages originate from the Enemy. *)
paulson@1964
    84
paulson@1941
    85
val OR2_OR4_tac = 
paulson@1941
    86
    dtac (OR2_analz_sees_Enemy RS (impOfSubs analz_subset_parts)) 4 THEN
paulson@1941
    87
    dtac (OR4_analz_sees_Enemy RS (impOfSubs analz_subset_parts)) 6;
paulson@1941
    88
paulson@1941
    89
paulson@1941
    90
(*** Shared keys are not betrayed ***)
paulson@1941
    91
paulson@1964
    92
(*Enemy never sees another agent's shared key! (unless it is leaked at start)*)
paulson@1941
    93
goal thy 
paulson@1967
    94
 "!!evs. [| evs : otway;  A ~: bad |] ==> \
paulson@1941
    95
\        Key (shrK A) ~: parts (sees Enemy evs)";
paulson@1941
    96
be otway.induct 1;
paulson@1941
    97
by OR2_OR4_tac;
paulson@1941
    98
by (Auto_tac());
paulson@1941
    99
(*Deals with Fake message*)
paulson@1941
   100
by (best_tac (!claset addDs [impOfSubs analz_subset_parts,
paulson@1941
   101
			     impOfSubs Fake_parts_insert]) 1);
paulson@1941
   102
qed "Enemy_not_see_shrK";
paulson@1941
   103
paulson@1941
   104
bind_thm ("Enemy_not_analz_shrK",
paulson@1941
   105
	  [analz_subset_parts, Enemy_not_see_shrK] MRS contra_subsetD);
paulson@1941
   106
paulson@1967
   107
Addsimps [Enemy_not_see_shrK, Enemy_not_analz_shrK];
paulson@1941
   108
paulson@1964
   109
(*We go to some trouble to preserve R in the 3rd and 4th subgoals
paulson@1964
   110
  As usual fast_tac cannot be used because it uses the equalities too soon*)
paulson@1941
   111
val major::prems = 
paulson@1964
   112
goal thy  "[| Key (shrK A) : parts (sees Enemy evs);       \
paulson@1964
   113
\             evs : otway;                                 \
paulson@1967
   114
\             A:bad ==> R                                  \
paulson@1941
   115
\           |] ==> R";
paulson@1941
   116
br ccontr 1;
paulson@1941
   117
br ([major, Enemy_not_see_shrK] MRS rev_notE) 1;
paulson@1941
   118
by (swap_res_tac prems 2);
paulson@1967
   119
by (ALLGOALS (fast_tac (!claset addIs prems)));
paulson@1941
   120
qed "Enemy_see_shrK_E";
paulson@1941
   121
paulson@1941
   122
bind_thm ("Enemy_analz_shrK_E", 
paulson@1941
   123
	  analz_subset_parts RS subsetD RS Enemy_see_shrK_E);
paulson@1941
   124
paulson@1941
   125
AddSEs [Enemy_see_shrK_E, Enemy_analz_shrK_E];
paulson@1941
   126
paulson@1941
   127
paulson@1941
   128
(*** Future keys can't be seen or used! ***)
paulson@1941
   129
paulson@1941
   130
(*Nobody can have SEEN keys that will be generated in the future.
paulson@1941
   131
  This has to be proved anew for each protocol description,
paulson@1941
   132
  but should go by similar reasoning every time.  Hardest case is the
paulson@1941
   133
  standard Fake rule.  
paulson@1941
   134
      The length comparison, and Union over C, are essential for the 
paulson@1941
   135
  induction! *)
paulson@1941
   136
goal thy "!!evs. evs : otway ==> \
paulson@1941
   137
\                length evs <= length evs' --> \
paulson@1941
   138
\                          Key (newK evs') ~: (UN C. parts (sees C evs))";
paulson@1941
   139
be otway.induct 1;
paulson@1941
   140
by OR2_OR4_tac;
paulson@1941
   141
(*auto_tac does not work here, as it performs safe_tac first*)
paulson@1941
   142
by (ALLGOALS Asm_simp_tac);
paulson@1941
   143
by (REPEAT_FIRST (best_tac (!claset addDs [impOfSubs analz_subset_parts,
paulson@1941
   144
				       impOfSubs parts_insert_subset_Un,
paulson@1941
   145
				       Suc_leD]
paulson@1941
   146
			        addss (!simpset))));
paulson@1941
   147
val lemma = result();
paulson@1941
   148
paulson@1941
   149
(*Variant needed for the main theorem below*)
paulson@1941
   150
goal thy 
paulson@1941
   151
 "!!evs. [| evs : otway;  length evs <= length evs' |] ==> \
paulson@1941
   152
\        Key (newK evs') ~: parts (sees C evs)";
paulson@1941
   153
by (fast_tac (!claset addDs [lemma]) 1);
paulson@1941
   154
qed "new_keys_not_seen";
paulson@1941
   155
Addsimps [new_keys_not_seen];
paulson@1941
   156
paulson@1941
   157
(*Another variant: old messages must contain old keys!*)
paulson@1941
   158
goal thy 
paulson@1941
   159
 "!!evs. [| Says A B X : set_of_list evs;  \
paulson@1941
   160
\           Key (newK evt) : parts {X};    \
paulson@1941
   161
\           evs : otway                 \
paulson@1941
   162
\        |] ==> length evt < length evs";
paulson@1941
   163
br ccontr 1;
paulson@1941
   164
by (fast_tac (!claset addSDs [new_keys_not_seen, Says_imp_sees_Enemy]
paulson@1941
   165
	              addIs [impOfSubs parts_mono, leI]) 1);
paulson@1941
   166
qed "Says_imp_old_keys";
paulson@1941
   167
paulson@1941
   168
paulson@1941
   169
(*Nobody can have USED keys that will be generated in the future.
paulson@1941
   170
  ...very like new_keys_not_seen*)
paulson@1941
   171
goal thy "!!evs. evs : otway ==> \
paulson@1941
   172
\                length evs <= length evs' --> \
paulson@1941
   173
\                newK evs' ~: keysFor (UN C. parts (sees C evs))";
paulson@1941
   174
be otway.induct 1;
paulson@1941
   175
by OR2_OR4_tac;
paulson@1941
   176
bd OR5_parts_sees_Enemy 7;
paulson@1941
   177
by (ALLGOALS Asm_simp_tac);
paulson@1941
   178
(*OR1 and OR3*)
paulson@1941
   179
by (EVERY (map (fast_tac (!claset addDs [Suc_leD] addss (!simpset))) [4,2]));
paulson@1941
   180
(*Fake, OR2, OR4: these messages send unknown (X) components*)
paulson@1941
   181
by (EVERY 
paulson@1941
   182
    (map
paulson@1941
   183
     (best_tac
paulson@1996
   184
      (!claset addDs [impOfSubs (analz_subset_parts RS keysFor_mono),
paulson@1941
   185
		      impOfSubs (parts_insert_subset_Un RS keysFor_mono),
paulson@1941
   186
		      Suc_leD]
paulson@1941
   187
	       addEs [new_keys_not_seen RS not_parts_not_analz RSN(2,rev_notE)]
paulson@1941
   188
	       addss (!simpset)))
paulson@1941
   189
     [3,2,1]));
paulson@1941
   190
(*OR5: dummy message*)
paulson@1996
   191
by (best_tac (!claset addEs  [new_keys_not_seen RSN(2,rev_notE)]
paulson@1996
   192
		      addIs  [less_SucI, impOfSubs keysFor_mono]
paulson@1996
   193
		      addss (!simpset addsimps [le_def])) 1);
paulson@1941
   194
val lemma = result();
paulson@1941
   195
paulson@1941
   196
goal thy 
paulson@1941
   197
 "!!evs. [| evs : otway;  length evs <= length evs' |] ==> \
paulson@1941
   198
\        newK evs' ~: keysFor (parts (sees C evs))";
paulson@1941
   199
by (fast_tac (!claset addSDs [lemma] addss (!simpset)) 1);
paulson@1941
   200
qed "new_keys_not_used";
paulson@1941
   201
paulson@1941
   202
bind_thm ("new_keys_not_analzd",
paulson@1941
   203
	  [analz_subset_parts RS keysFor_mono,
paulson@1941
   204
	   new_keys_not_used] MRS contra_subsetD);
paulson@1941
   205
paulson@1941
   206
Addsimps [new_keys_not_used, new_keys_not_analzd];
paulson@1941
   207
paulson@1941
   208
paulson@1941
   209
(** Lemmas concerning the form of items passed in messages **)
paulson@1941
   210
paulson@1941
   211
paulson@1941
   212
(****
paulson@1941
   213
 The following is to prove theorems of the form
paulson@1941
   214
paulson@1964
   215
          Key K : analz (insert (Key (newK evt)) (sees Enemy evs)) ==>
paulson@1964
   216
          Key K : analz (sees Enemy evs)
paulson@1941
   217
paulson@1941
   218
 A more general formula must be proved inductively.
paulson@1941
   219
paulson@1941
   220
****)
paulson@1941
   221
paulson@1941
   222
paulson@1941
   223
(*NOT useful in this form, but it says that session keys are not used
paulson@1941
   224
  to encrypt messages containing other keys, in the actual protocol.
paulson@1941
   225
  We require that agents should behave like this subsequently also.*)
paulson@1941
   226
goal thy 
paulson@1941
   227
 "!!evs. evs : otway ==> \
paulson@1941
   228
\        (Crypt X (newK evt)) : parts (sees Enemy evs) & \
paulson@1941
   229
\        Key K : parts {X} --> Key K : parts (sees Enemy evs)";
paulson@1941
   230
be otway.induct 1;
paulson@1941
   231
by OR2_OR4_tac;
paulson@1941
   232
by (ALLGOALS (asm_simp_tac (!simpset addsimps pushes)));
paulson@1941
   233
(*Deals with Faked messages*)
paulson@1941
   234
by (best_tac (!claset addSEs partsEs
paulson@1941
   235
		      addDs [impOfSubs analz_subset_parts,
paulson@1941
   236
                             impOfSubs parts_insert_subset_Un]
paulson@1964
   237
                      addss (!simpset)) 2);
paulson@1964
   238
(*Base case and OR5*)
paulson@1964
   239
by (Auto_tac());
paulson@1941
   240
result();
paulson@1941
   241
paulson@1941
   242
paulson@1941
   243
(** Specialized rewriting for this proof **)
paulson@1941
   244
paulson@1941
   245
Delsimps [image_insert];
paulson@1941
   246
Addsimps [image_insert RS sym];
paulson@1941
   247
paulson@1964
   248
Delsimps [image_Un];
paulson@1964
   249
Addsimps [image_Un RS sym];
paulson@1964
   250
paulson@1941
   251
goal thy "insert (Key (newK x)) (sees A evs) = \
paulson@1941
   252
\         Key `` (newK``{x}) Un (sees A evs)";
paulson@1941
   253
by (Fast_tac 1);
paulson@1941
   254
val insert_Key_singleton = result();
paulson@1941
   255
paulson@1941
   256
goal thy "insert (Key (f x)) (Key``(f``E) Un C) = \
paulson@1941
   257
\         Key `` (f `` (insert x E)) Un C";
paulson@1941
   258
by (Fast_tac 1);
paulson@1941
   259
val insert_Key_image = result();
paulson@1941
   260
paulson@1941
   261
paulson@1941
   262
(*This lets us avoid analyzing the new message -- unless we have to!*)
paulson@1941
   263
(*NEEDED??*)
paulson@1941
   264
goal thy "synth (analz (sees Enemy evs)) <=   \
paulson@1941
   265
\         synth (analz (sees Enemy (Says A B X # evs)))";
paulson@1941
   266
by (Simp_tac 1);
paulson@1941
   267
br (subset_insertI RS analz_mono RS synth_mono) 1;
paulson@1941
   268
qed "synth_analz_thin";
paulson@1941
   269
paulson@1941
   270
AddIs [impOfSubs synth_analz_thin];
paulson@1941
   271
paulson@1941
   272
paulson@1941
   273
paulson@1941
   274
(** Session keys are not used to encrypt other session keys **)
paulson@1941
   275
paulson@1941
   276
(*Lemma for the trivial direction of the if-and-only-if*)
paulson@1941
   277
goal thy  
paulson@1964
   278
 "!!evs. (Key K : analz (Key``nE Un sEe)) --> \
paulson@1964
   279
\         (K : nE | Key K : analz sEe)  ==>     \
paulson@1964
   280
\        (Key K : analz (Key``nE Un sEe)) = (K : nE | Key K : analz sEe)";
paulson@1941
   281
by (fast_tac (!claset addSEs [impOfSubs analz_mono]) 1);
paulson@1941
   282
val lemma = result();
paulson@1941
   283
paulson@1964
   284
paulson@1941
   285
goal thy  
paulson@1941
   286
 "!!evs. evs : otway ==> \
paulson@1964
   287
\  ALL K E. (Key K : analz (Key``(newK``E) Un (sees Enemy evs))) = \
paulson@1964
   288
\           (K : newK``E | Key K : analz (sees Enemy evs))";
paulson@1941
   289
be otway.induct 1;
paulson@1941
   290
bd OR2_analz_sees_Enemy 4;
paulson@1941
   291
bd OR4_analz_sees_Enemy 6;
paulson@1941
   292
by (REPEAT_FIRST (resolve_tac [allI, lemma]));
paulson@1964
   293
by (ALLGOALS (*Takes 35 secs*)
paulson@1941
   294
    (asm_simp_tac 
paulson@1941
   295
     (!simpset addsimps ([insert_Key_singleton, insert_Key_image, pushKey_newK]
paulson@1941
   296
			 @ pushes)
paulson@1941
   297
               setloop split_tac [expand_if])));
paulson@1996
   298
(*OR4, OR2, Fake*) 
paulson@1996
   299
by (EVERY (map enemy_analz_tac [5,3,2]));
paulson@1941
   300
(*OR3*)
paulson@1996
   301
by (Fast_tac 2);
paulson@1996
   302
(*Base case*) 
paulson@1941
   303
by (fast_tac (!claset addIs [image_eqI] addss (!simpset)) 1);
paulson@1941
   304
qed_spec_mp "analz_image_newK";
paulson@1941
   305
paulson@1941
   306
paulson@1941
   307
goal thy
paulson@1941
   308
 "!!evs. evs : otway ==>                               \
paulson@1964
   309
\        Key K : analz (insert (Key (newK evt)) (sees Enemy evs)) = \
paulson@1964
   310
\        (K = newK evt | Key K : analz (sees Enemy evs))";
paulson@1941
   311
by (asm_simp_tac (HOL_ss addsimps [pushKey_newK, analz_image_newK, 
paulson@1941
   312
				   insert_Key_singleton]) 1);
paulson@1941
   313
by (Fast_tac 1);
paulson@1941
   314
qed "analz_insert_Key_newK";
paulson@1941
   315
paulson@1941
   316
paulson@1941
   317
(*Describes the form *and age* of K when the following message is sent*)
paulson@1941
   318
goal thy 
paulson@1941
   319
 "!!evs. [| Says Server B \
paulson@1941
   320
\            {|NA, Crypt {|NA, K|} (shrK A),                      \
paulson@1941
   321
\                  Crypt {|NB, K|} (shrK B)|} : set_of_list evs;  \
paulson@1941
   322
\           evs : otway |]                                        \
paulson@1941
   323
\        ==> (EX evt:otway. K = Key(newK evt) & \
paulson@1941
   324
\                           length evt < length evs) &            \
paulson@1941
   325
\            (EX i. NA = Nonce i)";
paulson@1941
   326
be rev_mp 1;
paulson@1941
   327
be otway.induct 1;
paulson@1941
   328
by (ALLGOALS (fast_tac (!claset addIs [less_SucI] addss (!simpset))));
paulson@1941
   329
qed "Says_Server_message_form";
paulson@1941
   330
paulson@1941
   331
paulson@1941
   332
(*Crucial secrecy property: Enemy does not see the keys sent in msg OR3*)
paulson@1941
   333
goal thy 
paulson@1967
   334
 "!!evs. [| Says Server A \
paulson@1967
   335
\            {|NA, Crypt {|NA, K|} (shrK B),                      \
paulson@1967
   336
\                  Crypt {|NB, K|} (shrK A)|} : set_of_list evs;  \
paulson@1967
   337
\           A ~: bad;  B ~: bad;  evs : otway |] ==>              \
paulson@1964
   338
\     K ~: analz (sees Enemy evs)";
paulson@1941
   339
be rev_mp 1;
paulson@1941
   340
be otway.induct 1;
paulson@1941
   341
bd OR2_analz_sees_Enemy 4;
paulson@1941
   342
bd OR4_analz_sees_Enemy 6;
paulson@1941
   343
by (ALLGOALS Asm_simp_tac);
paulson@1941
   344
(*Next 3 steps infer that K has the form "Key (newK evs'" ... *)
paulson@1941
   345
by (REPEAT_FIRST (resolve_tac [conjI, impI]));
paulson@1941
   346
by (TRYALL (forward_tac [Says_Server_message_form] THEN' assume_tac));
paulson@1941
   347
by (REPEAT_FIRST (eresolve_tac [bexE, exE, conjE] ORELSE' hyp_subst_tac));
paulson@1964
   348
by (ALLGOALS
paulson@1941
   349
    (asm_full_simp_tac 
paulson@1941
   350
     (!simpset addsimps ([analz_subset_parts RS contra_subsetD,
paulson@1941
   351
			  analz_insert_Key_newK] @ pushes)
paulson@1941
   352
               setloop split_tac [expand_if])));
paulson@1996
   353
(*OR4, OR2, Fake*) 
paulson@1996
   354
by (EVERY (map enemy_analz_tac [4,2,1]));
paulson@1941
   355
(*OR3*)
paulson@1996
   356
by (fast_tac (!claset addSEs [less_irrefl]) 1);
paulson@1941
   357
qed "Enemy_not_see_encrypted_key";
paulson@1945
   358
paulson@1945
   359
paulson@1945
   360
paulson@1945
   361
(*** Session keys are issued at most once, and identify the principals ***)
paulson@1945
   362
paulson@1945
   363
(** First, two lemmas for the Fake, OR2 and OR4 cases **)
paulson@1945
   364
paulson@1945
   365
goal thy 
paulson@1964
   366
 "!!evs. [| X : synth (analz (sees Enemy evs));                \
paulson@1964
   367
\           Crypt X' (shrK C) : parts{X};                      \
paulson@1967
   368
\           C ~: bad;  evs : otway |]  \
paulson@1945
   369
\        ==> Crypt X' (shrK C) : parts (sees Enemy evs)";
paulson@1945
   370
by (best_tac (!claset addSEs [impOfSubs analz_subset_parts]
paulson@1945
   371
	              addDs [impOfSubs parts_insert_subset_Un]
paulson@1945
   372
                      addss (!simpset)) 1);
paulson@1945
   373
qed "Crypt_Fake_parts";
paulson@1945
   374
paulson@1945
   375
goal thy 
paulson@1945
   376
 "!!evs. [| Crypt X' K : parts (sees A evs);  evs : otway |]  \
paulson@1945
   377
\        ==> EX S S' Y. Says S S' Y : set_of_list evs &       \
paulson@1945
   378
\            Crypt X' K : parts {Y}";
paulson@1945
   379
bd parts_singleton 1;
paulson@1945
   380
by (fast_tac (!claset addSDs [seesD] addss (!simpset)) 1);
paulson@1945
   381
qed "Crypt_parts_singleton";
paulson@1945
   382
paulson@1945
   383
fun ex_strip_tac i = REPEAT (ares_tac [exI, conjI] i) THEN assume_tac (i+1);
paulson@1945
   384
paulson@1945
   385
(*The Key K uniquely identifies a pair of senders in the message encrypted by
paulson@1945
   386
  C, but if C=Enemy then he could send all sorts of nonsense.*)
paulson@1945
   387
goal thy 
paulson@1964
   388
 "!!evs. evs : otway ==>                                     \
paulson@1964
   389
\      EX A B. ALL C.                                        \
paulson@1967
   390
\         C ~: bad -->                                       \
paulson@1945
   391
\         (ALL S S' X. Says S S' X : set_of_list evs -->     \
paulson@1945
   392
\           (EX NA. Crypt {|NA, Key K|} (shrK C) : parts{X}) --> C=A | C=B)";
paulson@1945
   393
by (Simp_tac 1);
paulson@1945
   394
be otway.induct 1;
paulson@1945
   395
bd OR2_analz_sees_Enemy 4;
paulson@1945
   396
bd OR4_analz_sees_Enemy 6;
paulson@1945
   397
by (ALLGOALS 
paulson@1945
   398
    (asm_simp_tac (!simpset addsimps [all_conj_distrib, imp_conj_distrib])));
paulson@1945
   399
by (REPEAT_FIRST (etac exE));
paulson@1945
   400
(*OR4*)
paulson@1945
   401
by (ex_strip_tac 4);
paulson@1945
   402
by (fast_tac (!claset addSDs [synth.Inj RS Crypt_Fake_parts, 
paulson@1945
   403
			      Crypt_parts_singleton]) 4);
paulson@1945
   404
(*OR3: Case split propagates some context to other subgoal...*)
paulson@1945
   405
	(** LEVEL 8 **)
paulson@1945
   406
by (excluded_middle_tac "K = newK evsa" 3);
paulson@1945
   407
by (Asm_simp_tac 3);
paulson@1945
   408
by (REPEAT (ares_tac [exI] 3));
paulson@1945
   409
(*...we prove this case by contradiction: the key is too new!*)
paulson@1945
   410
by (fast_tac (!claset addIs [impOfSubs (subset_insertI RS parts_mono)]
paulson@1945
   411
		      addSEs partsEs
paulson@1945
   412
		      addEs [Says_imp_old_keys RS less_irrefl]
paulson@1945
   413
	              addss (!simpset)) 3);
paulson@1945
   414
(*OR2*) (** LEVEL 12 **)
paulson@1996
   415
(*enemy_analz_tac just does not work here: it is an entirely different proof!*)
paulson@1945
   416
by (ex_strip_tac 2);
paulson@1996
   417
by (res_inst_tac [("x1","X")] (insert_commute RS ssubst) 2);
paulson@1945
   418
by (Simp_tac 2);
paulson@1945
   419
by (fast_tac (!claset addSDs [synth.Inj RS Crypt_Fake_parts, 
paulson@1945
   420
			      Crypt_parts_singleton]) 2);
paulson@1945
   421
(*Fake*) (** LEVEL 16 **)
paulson@1945
   422
by (ex_strip_tac 1);
paulson@1945
   423
by (fast_tac (!claset addSDs [Crypt_Fake_parts, Crypt_parts_singleton]) 1);
paulson@1945
   424
qed "unique_session_keys";
paulson@1945
   425
paulson@1945
   426
(*It seems strange but this theorem is NOT needed to prove the main result!*)