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