src/HOL/Auth/OtwayRees_AN.ML
author paulson
Thu, 10 Oct 1996 18:40:34 +0200
changeset 2090 307ebbbec862
child 2106 1a52e2c5897e
permissions -rw-r--r--
Abadi and Needham's variant of Otway-Rees
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
     1
(*  Title:      HOL/Auth/OtwayRees
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
     2
    ID:         $Id$
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
     4
    Copyright   1996  University of Cambridge
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
     5
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
     6
Inductive relation "otway" for the Otway-Rees protocol.
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
     7
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
     8
Simplified version with minimal encryption but explicit messages
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
     9
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    10
From page 11 of
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    11
  Abadi and Needham.  Prudent Engineering Practice for Cryptographic Protocols.
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    12
  IEEE Trans. SE 22 (1), 1996
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    13
*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    14
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    15
open OtwayRees_AN;
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    16
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    17
proof_timing:=true;
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    18
HOL_quantifiers := false;
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    19
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    20
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    21
(*Weak liveness: there are traces that reach the end*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    22
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    23
 "!!A B. [| A ~= B; A ~= Server; B ~= Server |]   \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    24
\        ==> EX K. EX NA. EX evs: otway lost.          \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    25
\             Says B A (Crypt {|Nonce NA, Agent A, Agent B, Key K|} (shrK A)) \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    26
\             : set_of_list evs";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    27
by (REPEAT (resolve_tac [exI,bexI] 1));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    28
by (rtac (otway.Nil RS otway.OR1 RS otway.OR2 RS otway.OR3 RS otway.OR4) 2);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    29
by (ALLGOALS (simp_tac (!simpset setsolver safe_solver)));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    30
by (REPEAT_FIRST (resolve_tac [refl, conjI]));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    31
by (REPEAT_FIRST (fast_tac (!claset addss (!simpset setsolver safe_solver))));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    32
result();
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    33
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    34
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    35
(**** Inductive proofs about otway ****)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    36
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    37
goal thy "!!evs. lost' <= lost ==> otway lost' <= otway lost";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    38
by (rtac subsetI 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    39
by (etac otway.induct 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    40
by (REPEAT_FIRST
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    41
    (best_tac (!claset addIs (impOfSubs (sees_mono RS analz_mono RS synth_mono)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    42
                              :: otway.intrs))));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    43
qed "otway_mono";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    44
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    45
(*Nobody sends themselves messages*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    46
goal thy "!!evs. evs : otway lost ==> ALL A X. Says A A X ~: set_of_list evs";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    47
by (etac otway.induct 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    48
by (Auto_tac());
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    49
qed_spec_mp "not_Says_to_self";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    50
Addsimps [not_Says_to_self];
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    51
AddSEs   [not_Says_to_self RSN (2, rev_notE)];
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    52
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    53
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    54
(** For reasoning about the encrypted portion of messages **)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    55
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    56
goal thy "!!evs. Says S B {|X, X'|} : set_of_list evs ==> \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    57
\                X : analz (sees lost Spy evs)";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    58
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    59
qed "OR4_analz_sees_Spy";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    60
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    61
goal thy "!!evs. Says B' A (Crypt {|N,Agent A,B,K|} K') : set_of_list evs ==> \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    62
\                K : parts (sees lost Spy evs)";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    63
by (fast_tac (!claset addSEs partsEs
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    64
                      addSDs [Says_imp_sees_Spy RS parts.Inj]) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    65
qed "Reveal_parts_sees_Spy";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    66
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    67
(*OR2_analz... and OR4_analz... let us treat those cases using the same 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    68
  argument as for the Fake case.  This is possible for most, but not all,
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    69
  proofs: Fake does not invent new nonces (as in OR2), and of course Fake
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    70
  messages originate from the Spy. *)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    71
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    72
bind_thm ("OR4_parts_sees_Spy",
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    73
          OR4_analz_sees_Spy RS (impOfSubs analz_subset_parts));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    74
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    75
(*We instantiate the variable to "lost".  Leaving it as a Var makes proofs
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    76
  harder to complete, since simplification does less for us.*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    77
val parts_Fake_tac = 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    78
    forw_inst_tac [("lost","lost")] OR4_parts_sees_Spy 6 THEN
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    79
    forw_inst_tac [("lost","lost")] Reveal_parts_sees_Spy 7;
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    80
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    81
(*For proving the easier theorems about X ~: parts (sees lost Spy evs) *)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    82
fun parts_induct_tac i = SELECT_GOAL
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    83
    (DETERM (etac otway.induct 1 THEN parts_Fake_tac THEN
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    84
	     (*Fake message*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    85
	     TRY (best_tac (!claset addDs [impOfSubs analz_subset_parts,
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    86
					   impOfSubs Fake_parts_insert]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    87
                                    addss (!simpset)) 2)) THEN
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    88
     (*Base case*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    89
     fast_tac (!claset addss (!simpset)) 1 THEN
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    90
     ALLGOALS Asm_simp_tac) i;
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    91
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    92
(** Theorems of the form X ~: parts (sees lost Spy evs) imply that NOBODY
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    93
    sends messages containing X! **)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    94
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    95
(*Spy never sees another agent's shared key! (unless it's lost at start)*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    96
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    97
 "!!evs. [| evs : otway lost;  A ~: lost |]    \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    98
\        ==> Key (shrK A) ~: parts (sees lost Spy evs)";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    99
by (parts_induct_tac 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   100
by (Auto_tac());
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   101
qed "Spy_not_see_shrK";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   102
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   103
bind_thm ("Spy_not_analz_shrK",
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   104
          [analz_subset_parts, Spy_not_see_shrK] MRS contra_subsetD);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   105
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   106
Addsimps [Spy_not_see_shrK, Spy_not_analz_shrK];
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   107
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   108
(*We go to some trouble to preserve R in the 3rd and 4th subgoals
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   109
  As usual fast_tac cannot be used because it uses the equalities too soon*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   110
val major::prems = 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   111
goal thy  "[| Key (shrK A) : parts (sees lost Spy evs);       \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   112
\             evs : otway lost;                                 \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   113
\             A:lost ==> R                                  \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   114
\           |] ==> R";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   115
by (rtac ccontr 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   116
by (rtac ([major, Spy_not_see_shrK] MRS rev_notE) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   117
by (swap_res_tac prems 2);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   118
by (ALLGOALS (fast_tac (!claset addIs prems)));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   119
qed "Spy_see_shrK_E";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   120
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   121
bind_thm ("Spy_analz_shrK_E", 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   122
          analz_subset_parts RS subsetD RS Spy_see_shrK_E);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   123
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   124
AddSEs [Spy_see_shrK_E, Spy_analz_shrK_E];
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   125
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   126
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   127
(*** Future keys can't be seen or used! ***)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   128
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   129
(*Nobody can have SEEN keys that will be generated in the future.
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   130
  This has to be proved anew for each protocol description,
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   131
  but should go by similar reasoning every time.  Hardest case is the
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   132
  standard Fake rule.  
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   133
      The Union over C is essential for the induction! *)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   134
goal thy "!!evs. evs : otway lost ==> \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   135
\                length evs <= length evs' --> \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   136
\                          Key (newK evs') ~: (UN C. parts (sees lost C evs))";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   137
by (parts_induct_tac 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   138
by (REPEAT_FIRST (best_tac (!claset addDs [impOfSubs analz_subset_parts,
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   139
                                           impOfSubs parts_insert_subset_Un,
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   140
                                           Suc_leD]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   141
                                    addss (!simpset))));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   142
val lemma = result();
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   143
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   144
(*Variant needed for the main theorem below*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   145
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   146
 "!!evs. [| evs : otway lost;  length evs <= length evs' |]    \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   147
\        ==> Key (newK evs') ~: parts (sees lost C evs)";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   148
by (fast_tac (!claset addDs [lemma]) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   149
qed "new_keys_not_seen";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   150
Addsimps [new_keys_not_seen];
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   151
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   152
(*Another variant: old messages must contain old keys!*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   153
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   154
 "!!evs. [| Says A B X : set_of_list evs;  \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   155
\           Key (newK evt) : parts {X};    \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   156
\           evs : otway lost                 \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   157
\        |] ==> length evt < length evs";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   158
by (rtac ccontr 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   159
by (dtac leI 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   160
by (fast_tac (!claset addSDs [new_keys_not_seen, Says_imp_sees_Spy]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   161
                      addIs  [impOfSubs parts_mono]) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   162
qed "Says_imp_old_keys";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   163
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   164
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   165
(*** Future nonces can't be seen or used! [proofs resemble those above] ***)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   166
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   167
goal thy "!!evs. evs : otway lost ==> \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   168
\                length evs <= length evt --> \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   169
\                Nonce (newN evt) ~: (UN C. parts (sees lost C evs))";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   170
by (etac otway.induct 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   171
(*auto_tac does not work here, as it performs safe_tac first*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   172
by (ALLGOALS (asm_simp_tac (!simpset addsimps [parts_insert2]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   173
                                     addcongs [disj_cong])));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   174
by (REPEAT_FIRST (fast_tac (!claset 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   175
                              addSEs partsEs
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   176
                              addSDs  [Says_imp_sees_Spy RS parts.Inj]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   177
                              addDs  [impOfSubs analz_subset_parts,
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   178
                                      impOfSubs parts_insert_subset_Un,
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   179
                                      Suc_leD]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   180
                              addss (!simpset))));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   181
val lemma = result();
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   182
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   183
(*Variant needed for the main theorem below*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   184
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   185
 "!!evs. [| evs : otway lost;  length evs <= length evs' |]    \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   186
\        ==> Nonce (newN evs') ~: parts (sees lost C evs)";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   187
by (fast_tac (!claset addDs [lemma]) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   188
qed "new_nonces_not_seen";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   189
Addsimps [new_nonces_not_seen];
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   190
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   191
(*Another variant: old messages must contain old nonces!*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   192
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   193
 "!!evs. [| Says A B X : set_of_list evs;  \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   194
\           Nonce (newN evt) : parts {X};    \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   195
\           evs : otway lost                 \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   196
\        |] ==> length evt < length evs";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   197
by (rtac ccontr 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   198
by (dtac leI 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   199
by (fast_tac (!claset addSDs [new_nonces_not_seen, Says_imp_sees_Spy]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   200
                      addIs  [impOfSubs parts_mono]) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   201
qed "Says_imp_old_nonces";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   202
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   203
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   204
(*Nobody can have USED keys that will be generated in the future.
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   205
  ...very like new_keys_not_seen*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   206
goal thy "!!evs. evs : otway lost ==> \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   207
\                length evs <= length evs' --> \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   208
\                newK evs' ~: keysFor (UN C. parts (sees lost C evs))";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   209
by (parts_induct_tac 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   210
(*OR1 and OR3*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   211
by (EVERY (map (fast_tac (!claset addDs [Suc_leD] addss (!simpset))) [4,2]));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   212
(*Fake, OR2, OR4: these messages send unknown (X) components*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   213
by (EVERY 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   214
    (map
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   215
     (best_tac
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   216
      (!claset addDs [impOfSubs (analz_subset_parts RS keysFor_mono),
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   217
                      impOfSubs (parts_insert_subset_Un RS keysFor_mono),
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   218
                      Suc_leD]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   219
               addEs [new_keys_not_seen RS not_parts_not_analz RSN(2,rev_notE)]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   220
               addss (!simpset)))
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   221
     [3,2,1]));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   222
(*Reveal: dummy message*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   223
by (best_tac (!claset addEs  [new_keys_not_seen RSN(2,rev_notE)]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   224
                      addIs  [less_SucI, impOfSubs keysFor_mono]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   225
                      addss (!simpset addsimps [le_def])) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   226
val lemma = result();
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   227
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   228
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   229
 "!!evs. [| evs : otway lost;  length evs <= length evs' |]    \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   230
\        ==> newK evs' ~: keysFor (parts (sees lost C evs))";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   231
by (fast_tac (!claset addSDs [lemma] addss (!simpset)) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   232
qed "new_keys_not_used";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   233
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   234
bind_thm ("new_keys_not_analzd",
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   235
          [analz_subset_parts RS keysFor_mono,
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   236
           new_keys_not_used] MRS contra_subsetD);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   237
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   238
Addsimps [new_keys_not_used, new_keys_not_analzd];
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   239
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   240
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   241
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   242
(*** Proofs involving analz ***)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   243
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   244
(*Describes the form of Key K when the following message is sent.  The use of
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   245
  "parts" strengthens the induction hyp for proving the Fake case.  The
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   246
  assumption A ~: lost prevents its being a Faked message.  (Based
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   247
  on NS_Shared/Says_S_message_form) *)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   248
goal thy
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   249
 "!!evs. evs: otway lost ==>                                           \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   250
\        Crypt {|N, Agent A, B, Key K|} (shrK A) : parts (sees lost Spy evs)  \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   251
\        --> A ~: lost --> (EX evt: otway lost. K = newK evt)";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   252
by (parts_induct_tac 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   253
by (Auto_tac());
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   254
qed_spec_mp "Reveal_message_lemma";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   255
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   256
(*EITHER describes the form of Key K when the following message is sent, 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   257
  OR     reduces it to the Fake case.*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   258
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   259
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   260
 "!!evs. [| Says B' A (Crypt {|N, Agent A, B, Key K|} (shrK A)) \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   261
\            : set_of_list evs;                                 \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   262
\           evs : otway lost |]                                 \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   263
\        ==> (EX evt: otway lost. K = newK evt)                 \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   264
\          | Key K : analz (sees lost Spy evs)";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   265
br (Reveal_message_lemma RS disjCI) 1;
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   266
ba 1;
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   267
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   268
                      addDs [impOfSubs analz_subset_parts]) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   269
by (fast_tac (!claset addSDs [Says_Crypt_lost]) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   270
qed "Reveal_message_form";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   271
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   272
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   273
(*For proofs involving analz.  We again instantiate the variable to "lost".*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   274
val analz_Fake_tac = 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   275
    dres_inst_tac [("lost","lost")] OR4_analz_sees_Spy 6 THEN
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   276
    forw_inst_tac [("lost","lost")] Reveal_message_form 7;
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   277
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   278
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   279
(****
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   280
 The following is to prove theorems of the form
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   281
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   282
          Key K : analz (insert (Key (newK evt)) (sees lost Spy evs)) ==>
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   283
          Key K : analz (sees lost Spy evs)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   284
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   285
 A more general formula must be proved inductively.
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   286
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   287
****)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   288
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   289
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   290
(*NOT useful in this form, but it says that session keys are not used
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   291
  to encrypt messages containing other keys, in the actual protocol.
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   292
  We require that agents should behave like this subsequently also.*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   293
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   294
 "!!evs. evs : otway lost ==> \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   295
\        (Crypt X (newK evt)) : parts (sees lost Spy evs) & \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   296
\        Key K : parts {X} --> Key K : parts (sees lost Spy evs)";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   297
by (etac otway.induct 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   298
by parts_Fake_tac;
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   299
by (ALLGOALS Asm_simp_tac);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   300
(*Deals with Faked messages*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   301
by (best_tac (!claset addSEs partsEs
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   302
                      addDs [impOfSubs parts_insert_subset_Un]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   303
                      addss (!simpset)) 2);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   304
(*Base case and Reveal*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   305
by (Auto_tac());
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   306
result();
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   307
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   308
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   309
(** Session keys are not used to encrypt other session keys **)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   310
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   311
(*The equality makes the induction hypothesis easier to apply*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   312
goal thy  
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   313
 "!!evs. evs : otway lost ==> \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   314
\  ALL K E. (Key K : analz (Key``(newK``E) Un (sees lost Spy evs))) = \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   315
\           (K : newK``E | Key K : analz (sees lost Spy evs))";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   316
by (etac otway.induct 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   317
by analz_Fake_tac;
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   318
by (REPEAT_FIRST (ares_tac [allI, analz_image_newK_lemma]));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   319
by (REPEAT ((eresolve_tac [bexE, disjE] ORELSE' hyp_subst_tac) 7));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   320
by (ALLGOALS (*Takes 28 secs*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   321
    (asm_simp_tac 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   322
     (!simpset addsimps ([insert_Key_singleton, insert_Key_image, pushKey_newK]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   323
                         @ pushes)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   324
               setloop split_tac [expand_if])));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   325
(** LEVEL 5 **)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   326
(*Reveal case 2, OR4, OR2, Fake*) 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   327
by (EVERY (map spy_analz_tac [6, 4, 2]));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   328
(*Reveal case 1, OR3, Base*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   329
by (REPEAT (fast_tac (!claset addIs [image_eqI] addss (!simpset)) 1));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   330
qed_spec_mp "analz_image_newK";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   331
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   332
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   333
goal thy
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   334
 "!!evs. evs : otway lost ==>                               \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   335
\        Key K : analz (insert (Key (newK evt)) (sees lost Spy evs)) = \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   336
\        (K = newK evt | Key K : analz (sees lost Spy evs))";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   337
by (asm_simp_tac (HOL_ss addsimps [pushKey_newK, analz_image_newK, 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   338
                                   insert_Key_singleton]) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   339
by (Fast_tac 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   340
qed "analz_insert_Key_newK";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   341
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   342
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   343
(*** The Key K uniquely identifies the Server's  message. **)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   344
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   345
fun ex_strip_tac i = REPEAT (ares_tac [exI, conjI] i) THEN assume_tac (i+1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   346
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   347
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   348
 "!!evs. evs : otway lost ==>                      \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   349
\      EX A' B' NA' NB'. ALL A B NA NB.                    \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   350
\       Says Server B \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   351
\         {|Crypt {|NA, Agent A, Agent B, K|} (shrK A),                    \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   352
\           Crypt {|NB, Agent A, Agent B, K|} (shrK B)|} : set_of_list evs  \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   353
\       --> A=A' & B=B' & NA=NA' & NB=NB'";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   354
by (etac otway.induct 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   355
by (ALLGOALS (asm_simp_tac (!simpset addsimps [all_conj_distrib])));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   356
by (Step_tac 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   357
(*Remaining cases: OR3 and OR4*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   358
by (ex_strip_tac 2);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   359
by (Fast_tac 2);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   360
by (expand_case_tac "K = ?y" 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   361
by (REPEAT (ares_tac [refl,exI,impI,conjI] 2));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   362
(*...we assume X is a very new message, and handle this case by contradiction*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   363
by (fast_tac (!claset addEs [Says_imp_old_keys RS less_irrefl]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   364
                      delrules [conjI]    (*prevent split-up into 4 subgoals*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   365
                      addss (!simpset addsimps [parts_insertI])) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   366
val lemma = result();
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   367
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   368
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   369
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   370
"!!evs. [| Says Server B                                           \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   371
\            {|Crypt {|NA, Agent A, Agent B, K|} (shrK A),         \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   372
\              Crypt {|NB, Agent A, Agent B, K|} (shrK B)|}        \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   373
\           : set_of_list evs;                                     \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   374
\          Says Server B'                                          \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   375
\            {|Crypt {|NA', Agent A', Agent B', K|} (shrK A'),     \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   376
\              Crypt {|NB', Agent A', Agent B', K|} (shrK B')|}    \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   377
\           : set_of_list evs;                                     \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   378
\          evs : otway lost |]                                     \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   379
\       ==> A=A' & B=B' & NA=NA' & NB=NB'";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   380
by (dtac lemma 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   381
by (REPEAT (etac exE 1));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   382
(*Duplicate the assumption*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   383
by (forw_inst_tac [("psi", "ALL C.?P(C)")] asm_rl 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   384
by (fast_tac (!claset addSDs [spec]) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   385
qed "unique_session_keys";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   386
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   387
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   388
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   389
(**** Authenticity properties relating to NA ****)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   390
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   391
(*If the encrypted message appears then it originated with the Server!*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   392
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   393
 "!!evs. [| A ~: lost;  evs : otway lost |]                 \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   394
\ ==> Crypt {|NA, Agent A, Agent B, Key K|} (shrK A)        \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   395
\      : parts (sees lost Spy evs)                          \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   396
\     --> (EX NB. Says Server B                                     \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   397
\                  {|Crypt {|NA, Agent A, Agent B, Key K|} (shrK A),     \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   398
\                    Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)|}    \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   399
\                  : set_of_list evs)";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   400
by (parts_induct_tac 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   401
by (ALLGOALS (asm_simp_tac (!simpset addsimps [ex_disj_distrib])));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   402
(*OR3*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   403
by (Fast_tac 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   404
qed_spec_mp "NA_Crypt_imp_Server_msg";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   405
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   406
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   407
(*Corollary: if A receives B's OR4 message and the nonce NA agrees
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   408
  then the key really did come from the Server!  CANNOT prove this of the
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   409
  bad form of this protocol, even though we can prove
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   410
  Spy_not_see_encrypted_key*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   411
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   412
 "!!evs. [| Says B' A (Crypt {|NA, Agent A, Agent B, Key K|} (shrK A))  \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   413
\            : set_of_list evs;                                         \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   414
\           A ~: lost;  evs : otway lost |]                             \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   415
\        ==> EX NB. Says Server B                                       \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   416
\                    {|Crypt {|NA, Agent A, Agent B, Key K|} (shrK A),  \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   417
\                      Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)|} \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   418
\                   : set_of_list evs";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   419
by (fast_tac (!claset addSIs [NA_Crypt_imp_Server_msg]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   420
                      addEs  partsEs
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   421
                      addDs  [Says_imp_sees_Spy RS parts.Inj]) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   422
qed "A_trust_OR4";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   423
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   424
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   425
(*Describes the form of K and NA when the Server sends this message.*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   426
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   427
 "!!evs. [| Says Server B \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   428
\           {|Crypt {|NA, Agent A, Agent B, K|} (shrK A),                    \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   429
\             Crypt {|NB, Agent A, Agent B, K|} (shrK B)|} : set_of_list evs; \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   430
\           evs : otway lost |]                                        \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   431
\        ==> (EX evt: otway lost. K = Key(newK evt)) &                  \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   432
\            (EX i. NA = Nonce i) &                  \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   433
\            (EX j. NB = Nonce j)";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   434
by (etac rev_mp 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   435
by (etac otway.induct 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   436
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   437
qed "Says_Server_message_form";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   438
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   439
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   440
(** Crucial secrecy property: Spy does not see the keys sent in msg OR3
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   441
    Does not in itself guarantee security: an attack could violate 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   442
    the premises, e.g. by having A=Spy **)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   443
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   444
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   445
 "!!evs. [| A ~: lost;  B ~: lost;  evs : otway lost;  evt : otway lost |] \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   446
\        ==> Says Server B                                                 \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   447
\             {|Crypt {|NA, Agent A, Agent B, Key K|} (shrK A),            \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   448
\               Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)|}           \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   449
\            : set_of_list evs -->                                         \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   450
\            Says A Spy {|NA, Key K|} ~: set_of_list evs -->               \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   451
\            Key K ~: analz (sees lost Spy evs)";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   452
by (etac otway.induct 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   453
by analz_Fake_tac;
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   454
by (REPEAT_FIRST (eresolve_tac [asm_rl, bexE, disjE] ORELSE' hyp_subst_tac));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   455
by (ALLGOALS
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   456
    (asm_full_simp_tac 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   457
     (!simpset addsimps ([analz_subset_parts RS contra_subsetD,
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   458
                          analz_insert_Key_newK] @ pushes)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   459
               setloop split_tac [expand_if])));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   460
(** LEVEL 4 **)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   461
(*OR3*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   462
by (fast_tac (!claset addSIs [parts_insertI]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   463
                      addEs [Says_imp_old_keys RS less_irrefl]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   464
                      addss (!simpset addsimps [parts_insert2])) 2);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   465
(*Reveal case 2, OR4, Fake*) 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   466
by (REPEAT_FIRST (resolve_tac [conjI, impI] ORELSE' spy_analz_tac));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   467
(*Reveal case 1*) (** LEVEL 6 **)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   468
by (excluded_middle_tac "Aa : lost" 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   469
(*But this contradicts Key K ~: analz (sees lost Spy evsa) *)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   470
by (dtac (Says_imp_sees_Spy RS analz.Inj) 2);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   471
by (fast_tac (!claset addSDs [analz.Decrypt] addss (!simpset)) 2);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   472
(*So now we have  Aa ~: lost *)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   473
by (dtac A_trust_OR4 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   474
by (REPEAT (assume_tac 1));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   475
by (fast_tac (!claset addDs [unique_session_keys] addss (!simpset)) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   476
val lemma = result() RS mp RS mp RSN(2,rev_notE);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   477
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   478
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   479
 "!!evs. [| Says Server B \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   480
\           {|Crypt {|NA, Agent A, Agent B, K|} (shrK A),                    \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   481
\             Crypt {|NB, Agent A, Agent B, K|} (shrK B)|} : set_of_list evs; \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   482
\           Says A Spy {|NA, K|} ~: set_of_list evs;                     \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   483
\           A ~: lost;  B ~: lost;  evs : otway lost |]                  \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   484
\        ==> K ~: analz (sees lost Spy evs)";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   485
by (forward_tac [Says_Server_message_form] 1 THEN assume_tac 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   486
by (fast_tac (!claset addSEs [lemma]) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   487
qed "Spy_not_see_encrypted_key";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   488
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   489
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   490
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   491
 "!!evs. [| C ~: {A,B,Server};                                           \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   492
\           Says Server B \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   493
\           {|Crypt {|NA, Agent A, Agent B, K|} (shrK A),                    \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   494
\             Crypt {|NB, Agent A, Agent B, K|} (shrK B)|} : set_of_list evs; \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   495
\           Says A Spy {|NA, K|} ~: set_of_list evs;                     \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   496
\           A ~: lost;  B ~: lost;  evs : otway lost |]                  \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   497
\        ==> K ~: analz (sees lost C evs)";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   498
by (rtac (subset_insertI RS sees_mono RS analz_mono RS contra_subsetD) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   499
by (rtac (sees_lost_agent_subset_sees_Spy RS analz_mono RS contra_subsetD) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   500
by (FIRSTGOAL (rtac Spy_not_see_encrypted_key));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   501
by (REPEAT_FIRST (fast_tac (!claset addIs [otway_mono RS subsetD])));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   502
qed "Agent_not_see_encrypted_key";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   503
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   504
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   505
(**** Authenticity properties relating to NB ****)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   506
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   507
(*If the encrypted message appears then it originated with the Server!*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   508
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   509
 "!!evs. [| B ~: lost;  evs : otway lost |]                   \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   510
\    ==> Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)       \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   511
\         : parts (sees lost Spy evs)                         \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   512
\        --> (EX NA. Says Server B                                          \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   513
\                     {|Crypt {|NA, Agent A, Agent B, Key K|} (shrK A),     \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   514
\                       Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)|}    \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   515
\                     : set_of_list evs)";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   516
by (parts_induct_tac 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   517
by (ALLGOALS (asm_simp_tac (!simpset addsimps [ex_disj_distrib])));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   518
(*OR3*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   519
by (Fast_tac 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   520
qed_spec_mp "NB_Crypt_imp_Server_msg";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   521
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   522
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   523
(*Guarantee for B: if it gets a message with matching NB then the Server
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   524
  has sent the correct message.*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   525
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   526
 "!!evs. [| B ~: lost;  evs : otway lost;               \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   527
\           Says S B {|X, Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)|} \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   528
\            : set_of_list evs |]                                  \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   529
\        ==> EX NA. Says Server B                                          \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   530
\                     {|Crypt {|NA, Agent A, Agent B, Key K|} (shrK A),     \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   531
\                       Crypt {|NB, Agent A, Agent B, Key K|} (shrK B)|}    \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   532
\                     : set_of_list evs";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   533
by (fast_tac (!claset addSIs [NB_Crypt_imp_Server_msg]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   534
                      addEs  partsEs
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   535
                      addDs  [Says_imp_sees_Spy RS parts.Inj]) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   536
qed "B_trust_OR3";