src/HOL/Auth/OtwayRees_AN.ML
author paulson
Fri, 13 Dec 1996 11:00:44 +0100
changeset 2378 fc103154ad8f
parent 2375 14539397fc04
child 2417 95f275c8476e
permissions -rw-r--r--
Removed needless quotation marks
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
2331
d6a56ff0d94e Minor renamings
paulson
parents: 2284
diff changeset
    21
(*A "possibility property": there are traces that reach the end*)
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    22
goal thy 
2331
d6a56ff0d94e Minor renamings
paulson
parents: 2284
diff changeset
    23
 "!!A B. [| A ~= B; A ~= Server; B ~= Server |]                               \
d6a56ff0d94e Minor renamings
paulson
parents: 2284
diff changeset
    24
\        ==> EX K. EX NA. EX evs: otway lost.                                 \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
    25
\             Says B A (Crypt (shrK A) {|Nonce NA, Agent A, Agent B, Key K|}) \
2090
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
2106
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
    37
(*Monotonicity*)
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    38
goal thy "!!evs. lost' <= lost ==> otway lost' <= otway lost";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    39
by (rtac subsetI 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    40
by (etac otway.induct 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    41
by (REPEAT_FIRST
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    42
    (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
    43
                              :: otway.intrs))));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    44
qed "otway_mono";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    45
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    46
(*Nobody sends themselves messages*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    47
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
    48
by (etac otway.induct 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    49
by (Auto_tac());
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    50
qed_spec_mp "not_Says_to_self";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    51
Addsimps [not_Says_to_self];
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    52
AddSEs   [not_Says_to_self RSN (2, rev_notE)];
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
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    55
(** For reasoning about the encrypted portion of messages **)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    56
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    57
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
    58
\                X : analz (sees lost Spy evs)";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    59
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
    60
qed "OR4_analz_sees_Spy";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    61
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
    62
goal thy "!!evs. Says Server B {|X, Crypt K' {|NB, a, Agent B, K|}|} \
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
    63
\                  : set_of_list evs ==> K : parts (sees lost Spy evs)";
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    64
by (fast_tac (!claset addSEs partsEs
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    65
                      addSDs [Says_imp_sees_Spy RS parts.Inj]) 1);
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
    66
qed "Oops_parts_sees_Spy";
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    67
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
    68
(*OR4_analz_sees_Spy lets us treat those cases using the same 
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
    69
  argument as for the Fake case.  This is possible for most, but not all,
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
    70
  proofs, since Fake messages originate from the Spy. *)
2090
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
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
    79
    forw_inst_tac [("lost","lost")] Oops_parts_sees_Spy 7;
2090
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 
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
    97
 "!!evs. evs : otway lost \
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
    98
\        ==> (Key (shrK A) : parts (sees lost Spy evs)) = (A : lost)";
2090
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());
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   101
qed "Spy_see_shrK";
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   102
Addsimps [Spy_see_shrK];
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   103
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   104
goal thy 
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   105
 "!!evs. evs : otway lost \
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   106
\        ==> (Key (shrK A) : analz (sees lost Spy evs)) = (A : lost)";
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   107
by (auto_tac(!claset addDs [impOfSubs analz_subset_parts], !simpset));
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   108
qed "Spy_analz_shrK";
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   109
Addsimps [Spy_analz_shrK];
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   110
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   111
goal thy  "!!A. [| Key (shrK A) : parts (sees lost Spy evs);       \
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   112
\                  evs : otway lost |] ==> A:lost";
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   113
by (fast_tac (!claset addDs [Spy_see_shrK]) 1);
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   114
qed "Spy_see_shrK_D";
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   115
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   116
bind_thm ("Spy_analz_shrK_D", analz_subset_parts RS subsetD RS Spy_see_shrK_D);
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   117
AddSDs [Spy_see_shrK_D, Spy_analz_shrK_D];
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   118
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   119
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   120
(*** Future keys can't be seen or used! ***)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   121
2160
ad4382e546fc Simplified new_keys_not_seen, etc.: replaced the
paulson
parents: 2131
diff changeset
   122
(*Nobody can have SEEN keys that will be generated in the future. *)
2331
d6a56ff0d94e Minor renamings
paulson
parents: 2284
diff changeset
   123
goal thy "!!evs. evs : otway lost ==>             \
d6a56ff0d94e Minor renamings
paulson
parents: 2284
diff changeset
   124
\                length evs <= length evs' -->    \
2160
ad4382e546fc Simplified new_keys_not_seen, etc.: replaced the
paulson
parents: 2131
diff changeset
   125
\                Key (newK evs') ~: parts (sees lost Spy evs)";
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   126
by (parts_induct_tac 1);
2264
f298678bd54a Weaking of injectivity assumptions for newK and newN:
paulson
parents: 2166
diff changeset
   127
by (REPEAT_FIRST (best_tac (!claset addEs [leD RS notE]
f298678bd54a Weaking of injectivity assumptions for newK and newN:
paulson
parents: 2166
diff changeset
   128
				    addDs [impOfSubs analz_subset_parts,
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   129
                                           impOfSubs parts_insert_subset_Un,
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   130
                                           Suc_leD]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   131
                                    addss (!simpset))));
2160
ad4382e546fc Simplified new_keys_not_seen, etc.: replaced the
paulson
parents: 2131
diff changeset
   132
qed_spec_mp "new_keys_not_seen";
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   133
Addsimps [new_keys_not_seen];
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   134
2160
ad4382e546fc Simplified new_keys_not_seen, etc.: replaced the
paulson
parents: 2131
diff changeset
   135
(*Variant: old messages must contain old keys!*)
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   136
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   137
 "!!evs. [| Says A B X : set_of_list evs;  \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   138
\           Key (newK evt) : parts {X};    \
2264
f298678bd54a Weaking of injectivity assumptions for newK and newN:
paulson
parents: 2166
diff changeset
   139
\           evs : otway lost               \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   140
\        |] ==> length evt < length evs";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   141
by (rtac ccontr 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   142
by (dtac leI 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   143
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
   144
                      addIs  [impOfSubs parts_mono]) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   145
qed "Says_imp_old_keys";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   146
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   147
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   148
(*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
   149
  ...very like new_keys_not_seen*)
2331
d6a56ff0d94e Minor renamings
paulson
parents: 2284
diff changeset
   150
goal thy "!!evs. evs : otway lost ==>          \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   151
\                length evs <= length evs' --> \
2160
ad4382e546fc Simplified new_keys_not_seen, etc.: replaced the
paulson
parents: 2131
diff changeset
   152
\                newK evs' ~: keysFor (parts (sees lost Spy evs))";
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   153
by (parts_induct_tac 1);
2375
14539397fc04 Streamlined some proofs
paulson
parents: 2331
diff changeset
   154
(*Fake, OR4: these messages send unknown (X) components*)
14539397fc04 Streamlined some proofs
paulson
parents: 2331
diff changeset
   155
by (EVERY
14539397fc04 Streamlined some proofs
paulson
parents: 2331
diff changeset
   156
    (map 
14539397fc04 Streamlined some proofs
paulson
parents: 2331
diff changeset
   157
     (best_tac
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   158
      (!claset addDs [impOfSubs (analz_subset_parts RS keysFor_mono),
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   159
                      impOfSubs (parts_insert_subset_Un RS keysFor_mono),
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   160
                      Suc_leD]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   161
               addEs [new_keys_not_seen RS not_parts_not_analz RSN(2,rev_notE)]
2375
14539397fc04 Streamlined some proofs
paulson
parents: 2331
diff changeset
   162
               addss (!simpset))) [5,1]));
14539397fc04 Streamlined some proofs
paulson
parents: 2331
diff changeset
   163
(*Remaining subgoals*)
14539397fc04 Streamlined some proofs
paulson
parents: 2331
diff changeset
   164
by (REPEAT (fast_tac (!claset addDs [Suc_leD] addss (!simpset)) 1));
2160
ad4382e546fc Simplified new_keys_not_seen, etc.: replaced the
paulson
parents: 2131
diff changeset
   165
qed_spec_mp "new_keys_not_used";
2090
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
bind_thm ("new_keys_not_analzd",
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   168
          [analz_subset_parts RS keysFor_mono,
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   169
           new_keys_not_used] MRS contra_subsetD);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   170
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   171
Addsimps [new_keys_not_used, new_keys_not_analzd];
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   172
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   173
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   174
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   175
(*** Proofs involving analz ***)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   176
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   177
(*Describes the form of K and NA when the Server sends this message.*)
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   178
goal thy 
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   179
 "!!evs. [| Says Server B \
2331
d6a56ff0d94e Minor renamings
paulson
parents: 2284
diff changeset
   180
\           {|Crypt (shrK A) {|NA, Agent A, Agent B, K|},                     \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   181
\             Crypt (shrK B) {|NB, Agent A, Agent B, K|}|} : set_of_list evs; \
2331
d6a56ff0d94e Minor renamings
paulson
parents: 2284
diff changeset
   182
\           evs : otway lost |]                                               \
d6a56ff0d94e Minor renamings
paulson
parents: 2284
diff changeset
   183
\        ==> (EX evt: otway lost. K = Key(newK evt)) & \
d6a56ff0d94e Minor renamings
paulson
parents: 2284
diff changeset
   184
\            (EX i. NA = Nonce i) &                    \
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   185
\            (EX j. NB = Nonce j)";
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   186
by (etac rev_mp 1);
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   187
by (etac otway.induct 1);
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   188
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   189
qed "Says_Server_message_form";
2090
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
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   192
(*For proofs involving analz.  We again instantiate the variable to "lost".*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   193
val analz_Fake_tac = 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   194
    dres_inst_tac [("lost","lost")] OR4_analz_sees_Spy 6 THEN
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   195
    forw_inst_tac [("lost","lost")] Says_Server_message_form 7 THEN
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   196
    assume_tac 7 THEN Full_simp_tac 7 THEN
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   197
    REPEAT ((eresolve_tac [bexE, exE, conjE] ORELSE' hyp_subst_tac) 7);
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   198
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   199
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   200
(****
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   201
 The following is to prove theorems of the form
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
          Key K : analz (insert (Key (newK evt)) (sees lost Spy evs)) ==>
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   204
          Key K : analz (sees lost Spy evs)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   205
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   206
 A more general formula must be proved inductively.
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   207
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   208
****)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   209
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   210
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   211
(** Session keys are not used to encrypt other session keys **)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   212
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   213
(*The equality makes the induction hypothesis easier to apply*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   214
goal thy  
2331
d6a56ff0d94e Minor renamings
paulson
parents: 2284
diff changeset
   215
 "!!evs. evs : otway lost ==>                                         \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   216
\  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
   217
\           (K : newK``E | Key K : analz (sees lost Spy evs))";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   218
by (etac otway.induct 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   219
by analz_Fake_tac;
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   220
by (REPEAT_FIRST (ares_tac [allI, analz_image_newK_lemma]));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   221
by (ALLGOALS (*Takes 28 secs*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   222
    (asm_simp_tac 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   223
     (!simpset addsimps ([insert_Key_singleton, insert_Key_image, pushKey_newK]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   224
                         @ pushes)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   225
               setloop split_tac [expand_if])));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   226
(** LEVEL 5 **)
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   227
(*OR4, Fake*) 
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   228
by (EVERY (map spy_analz_tac [4,2]));
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   229
(*Oops, OR3, Base*)
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   230
by (REPEAT (fast_tac (!claset addIs [image_eqI] addss (!simpset)) 1));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   231
qed_spec_mp "analz_image_newK";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   232
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
goal thy
2331
d6a56ff0d94e Minor renamings
paulson
parents: 2284
diff changeset
   235
 "!!evs. evs : otway lost ==>                                          \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   236
\        Key K : analz (insert (Key (newK evt)) (sees lost Spy evs)) = \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   237
\        (K = newK evt | Key K : analz (sees lost Spy evs))";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   238
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
   239
                                   insert_Key_singleton]) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   240
by (Fast_tac 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   241
qed "analz_insert_Key_newK";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   242
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
(*** The Key K uniquely identifies the Server's  message. **)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   245
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   246
goal thy 
2331
d6a56ff0d94e Minor renamings
paulson
parents: 2284
diff changeset
   247
 "!!evs. evs : otway lost ==>                              \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   248
\      EX A' B' NA' NB'. ALL A B NA NB.                    \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   249
\       Says Server B \
2331
d6a56ff0d94e Minor renamings
paulson
parents: 2284
diff changeset
   250
\         {|Crypt (shrK A) {|NA, Agent A, Agent B, K|},                     \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   251
\           Crypt (shrK B) {|NB, Agent A, Agent B, K|}|} : set_of_list evs  \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   252
\       --> A=A' & B=B' & NA=NA' & NB=NB'";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   253
by (etac otway.induct 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   254
by (ALLGOALS (asm_simp_tac (!simpset addsimps [all_conj_distrib])));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   255
by (Step_tac 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   256
(*Remaining cases: OR3 and OR4*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   257
by (ex_strip_tac 2);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   258
by (Fast_tac 2);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   259
by (expand_case_tac "K = ?y" 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   260
by (REPEAT (ares_tac [refl,exI,impI,conjI] 2));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   261
(*...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
   262
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
   263
                      delrules [conjI]    (*prevent split-up into 4 subgoals*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   264
                      addss (!simpset addsimps [parts_insertI])) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   265
val lemma = result();
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   266
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   267
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   268
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   269
"!!evs. [| Says Server B                                           \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   270
\            {|Crypt (shrK A) {|NA, Agent A, Agent B, K|},         \
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   271
\              Crypt (shrK B) {|NB, Agent A, Agent B, K|}|}        \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   272
\           : set_of_list evs;                                     \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   273
\          Says Server B'                                          \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   274
\            {|Crypt (shrK A') {|NA', Agent A', Agent B', K|},     \
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   275
\              Crypt (shrK B') {|NB', Agent A', Agent B', K|}|}    \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   276
\           : set_of_list evs;                                     \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   277
\          evs : otway lost |]                                     \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   278
\       ==> A=A' & B=B' & NA=NA' & NB=NB'";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   279
by (dtac lemma 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   280
by (REPEAT (etac exE 1));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   281
(*Duplicate the assumption*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   282
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
   283
by (fast_tac (!claset addSDs [spec]) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   284
qed "unique_session_keys";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   285
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
(**** Authenticity properties relating to NA ****)
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
(*If the encrypted message appears then it originated with the Server!*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   291
goal thy 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   292
 "!!evs. [| A ~: lost;  evs : otway lost |]                 \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   293
\ ==> Crypt (shrK A) {|NA, Agent A, Agent B, Key K|}        \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   294
\      : parts (sees lost Spy evs)                          \
2331
d6a56ff0d94e Minor renamings
paulson
parents: 2284
diff changeset
   295
\     --> (EX NB. Says Server B                                          \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   296
\                  {|Crypt (shrK A) {|NA, Agent A, Agent B, Key K|},     \
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   297
\                    Crypt (shrK B) {|NB, Agent A, Agent B, Key K|}|}    \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   298
\                  : set_of_list evs)";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   299
by (parts_induct_tac 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   300
by (ALLGOALS (asm_simp_tac (!simpset addsimps [ex_disj_distrib])));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   301
(*OR3*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   302
by (Fast_tac 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   303
qed_spec_mp "NA_Crypt_imp_Server_msg";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   304
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   305
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   306
(*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
   307
  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
   308
  bad form of this protocol, even though we can prove
2106
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
   309
  Spy_not_see_encrypted_key.  (We can implicitly infer freshness of
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
   310
  the Server's message from its nonce NA.)*)
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   311
goal thy 
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   312
 "!!evs. [| Says B' A (Crypt (shrK A) {|NA, Agent A, Agent B, Key K|})  \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   313
\            : set_of_list evs;                                         \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   314
\           A ~: lost;  evs : otway lost |]                             \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   315
\        ==> EX NB. Says Server B                                       \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   316
\                    {|Crypt (shrK A) {|NA, Agent A, Agent B, Key K|},  \
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   317
\                      Crypt (shrK B) {|NB, Agent A, Agent B, Key K|}|} \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   318
\                   : set_of_list evs";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   319
by (fast_tac (!claset addSIs [NA_Crypt_imp_Server_msg]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   320
                      addEs  partsEs
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   321
                      addDs  [Says_imp_sees_Spy RS parts.Inj]) 1);
2331
d6a56ff0d94e Minor renamings
paulson
parents: 2284
diff changeset
   322
qed "A_trusts_OR4";
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   323
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   324
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   325
(** 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
   326
    Does not in itself guarantee security: an attack could violate 
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   327
    the premises, e.g. by having A=Spy **)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   328
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   329
goal thy 
2166
d276a806cc10 Tidying up: removing redundant assumptions, etc.
paulson
parents: 2160
diff changeset
   330
 "!!evs. [| A ~: lost;  B ~: lost;  evs : otway lost |]                    \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   331
\        ==> Says Server B                                                 \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   332
\             {|Crypt (shrK A) {|NA, Agent A, Agent B, Key K|},            \
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   333
\               Crypt (shrK B) {|NB, Agent A, Agent B, Key K|}|}           \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   334
\            : set_of_list evs -->                                         \
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   335
\            Says B Spy {|NA, NB, Key K|} ~: set_of_list evs -->           \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   336
\            Key K ~: analz (sees lost Spy evs)";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   337
by (etac otway.induct 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   338
by analz_Fake_tac;
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   339
by (ALLGOALS
2375
14539397fc04 Streamlined some proofs
paulson
parents: 2331
diff changeset
   340
    (asm_simp_tac (!simpset addsimps ([not_parts_not_analz,
14539397fc04 Streamlined some proofs
paulson
parents: 2331
diff changeset
   341
				       analz_insert_Key_newK] @ pushes)
14539397fc04 Streamlined some proofs
paulson
parents: 2331
diff changeset
   342
		            setloop split_tac [expand_if])));
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   343
(*OR3*)
2166
d276a806cc10 Tidying up: removing redundant assumptions, etc.
paulson
parents: 2160
diff changeset
   344
by (fast_tac (!claset addEs [Says_imp_old_keys RS less_irrefl]
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   345
                      addss (!simpset addsimps [parts_insert2])) 2);
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   346
(*OR4, Fake*) 
2375
14539397fc04 Streamlined some proofs
paulson
parents: 2331
diff changeset
   347
by (REPEAT_FIRST spy_analz_tac);
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   348
(*Oops*) 
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   349
by (fast_tac (!claset addDs [unique_session_keys] addss (!simpset)) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   350
val lemma = result() RS mp RS mp RSN(2,rev_notE);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   351
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   352
goal thy 
2106
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
   353
 "!!evs. [| Says Server B                                                     \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   354
\            {|Crypt (shrK A) {|NA, Agent A, Agent B, K|},                    \
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   355
\              Crypt (shrK B) {|NB, Agent A, Agent B, K|}|} : set_of_list evs;\
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   356
\           Says B Spy {|NA, NB, K|} ~: set_of_list evs;                      \
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   357
\           A ~: lost;  B ~: lost;  evs : otway lost |]                       \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   358
\        ==> K ~: analz (sees lost Spy evs)";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   359
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
   360
by (fast_tac (!claset addSEs [lemma]) 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   361
qed "Spy_not_see_encrypted_key";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   362
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   363
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   364
goal thy 
2106
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
   365
 "!!evs. [| C ~: {A,B,Server};                                                \
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
   366
\           Says Server B                                                     \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   367
\            {|Crypt (shrK A) {|NA, Agent A, Agent B, K|},                    \
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   368
\              Crypt (shrK B) {|NB, Agent A, Agent B, K|}|} : set_of_list evs;\
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2106
diff changeset
   369
\           Says B Spy {|NA, NB, K|} ~: set_of_list evs;                 \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   370
\           A ~: lost;  B ~: lost;  evs : otway lost |]                  \
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   371
\        ==> K ~: analz (sees lost C evs)";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   372
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
   373
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
   374
by (FIRSTGOAL (rtac Spy_not_see_encrypted_key));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   375
by (REPEAT_FIRST (fast_tac (!claset addIs [otway_mono RS subsetD])));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   376
qed "Agent_not_see_encrypted_key";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   377
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   378
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   379
(**** Authenticity properties relating to NB ****)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   380
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   381
(*If the encrypted message appears then it originated with the Server!*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   382
goal thy 
2106
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
   383
 "!!evs. [| B ~: lost;  evs : otway lost |]                                 \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   384
\    ==> Crypt (shrK B) {|NB, Agent A, Agent B, Key K|}                     \
2106
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
   385
\         : parts (sees lost Spy evs)                                       \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   386
\        --> (EX NA. Says Server B                                          \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   387
\                     {|Crypt (shrK A) {|NA, Agent A, Agent B, Key K|},     \
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   388
\                       Crypt (shrK B) {|NB, Agent A, Agent B, Key K|}|}    \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   389
\                     : set_of_list evs)";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   390
by (parts_induct_tac 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   391
by (ALLGOALS (asm_simp_tac (!simpset addsimps [ex_disj_distrib])));
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   392
(*OR3*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   393
by (Fast_tac 1);
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   394
qed_spec_mp "NB_Crypt_imp_Server_msg";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   395
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   396
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   397
(*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
   398
  has sent the correct message.*)
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   399
goal thy 
2106
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
   400
 "!!evs. [| B ~: lost;  evs : otway lost;                                   \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   401
\           Says S B {|X, Crypt (shrK B) {|NB, Agent A, Agent B, Key K|}|}  \
2106
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
   402
\            : set_of_list evs |]                                           \
1a52e2c5897e Generaly tidying up
paulson
parents: 2090
diff changeset
   403
\        ==> EX NA. Says Server B                                           \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   404
\                     {|Crypt (shrK A) {|NA, Agent A, Agent B, Key K|},     \
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   405
\                       Crypt (shrK B) {|NB, Agent A, Agent B, Key K|}|}    \
2090
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   406
\                     : set_of_list evs";
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   407
by (fast_tac (!claset addSIs [NB_Crypt_imp_Server_msg]
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   408
                      addEs  partsEs
307ebbbec862 Abadi and Needham's variant of Otway-Rees
paulson
parents:
diff changeset
   409
                      addDs  [Says_imp_sees_Spy RS parts.Inj]) 1);
2331
d6a56ff0d94e Minor renamings
paulson
parents: 2284
diff changeset
   410
qed "B_trusts_OR3";