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