src/HOL/Auth/NS_Shared.ML
author paulson
Wed, 25 Sep 1996 18:01:18 +0200
changeset 2027 0f11f625063b
parent 2015 d4a8fd8a8065
child 2032 1bbf1bdcaf56
permissions -rw-r--r--
Last working version before "lost"
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     1
(*  Title:      HOL/Auth/NS_Shared
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     2
    ID:         $Id$
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     4
    Copyright   1996  University of Cambridge
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     5
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     6
Inductive relation "ns_shared" for Needham-Schroeder Shared-Key protocol.
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     7
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     8
From page 247 of
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     9
  Burrows, Abadi and Needham.  A Logic of Authentication.
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    10
  Proc. Royal Soc. 426 (1989)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    11
*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    12
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    13
open NS_Shared;
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    14
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    15
proof_timing:=true;
1997
6efba890341e No longer assumes Alice is not the Enemy in NS3.
paulson
parents: 1967
diff changeset
    16
HOL_quantifiers := false;
6efba890341e No longer assumes Alice is not the Enemy in NS3.
paulson
parents: 1967
diff changeset
    17
6efba890341e No longer assumes Alice is not the Enemy in NS3.
paulson
parents: 1967
diff changeset
    18
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
    19
(*Weak liveness: there are traces that reach the end*)
1997
6efba890341e No longer assumes Alice is not the Enemy in NS3.
paulson
parents: 1967
diff changeset
    20
goal thy 
6efba890341e No longer assumes Alice is not the Enemy in NS3.
paulson
parents: 1967
diff changeset
    21
 "!!A B. [| A ~= B; A ~= Server; B ~= Server |]   \
6efba890341e No longer assumes Alice is not the Enemy in NS3.
paulson
parents: 1967
diff changeset
    22
\        ==> EX N K. EX evs: ns_shared.          \
6efba890341e No longer assumes Alice is not the Enemy in NS3.
paulson
parents: 1967
diff changeset
    23
\               Says A B (Crypt {|Nonce N, Nonce N|} K) : set_of_list evs";
6efba890341e No longer assumes Alice is not the Enemy in NS3.
paulson
parents: 1967
diff changeset
    24
by (REPEAT (resolve_tac [exI,bexI] 1));
6efba890341e No longer assumes Alice is not the Enemy in NS3.
paulson
parents: 1967
diff changeset
    25
br (ns_shared.Nil RS ns_shared.NS1 RS ns_shared.NS2 RS ns_shared.NS3 RS ns_shared.NS4 RS ns_shared.NS5) 2;
6efba890341e No longer assumes Alice is not the Enemy in NS3.
paulson
parents: 1967
diff changeset
    26
by (ALLGOALS (simp_tac (!simpset setsolver safe_solver)));
6efba890341e No longer assumes Alice is not the Enemy in NS3.
paulson
parents: 1967
diff changeset
    27
by (REPEAT_FIRST (resolve_tac [refl, conjI]));
6efba890341e No longer assumes Alice is not the Enemy in NS3.
paulson
parents: 1967
diff changeset
    28
by (ALLGOALS (fast_tac (!claset addss (!simpset setsolver safe_solver))));
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
    29
result();
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
    30
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    31
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    32
(**** Inductive proofs about ns_shared ****)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    33
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    34
(*The Enemy can see more than anybody else, except for their initial state*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    35
goal thy 
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    36
 "!!evs. evs : ns_shared ==> \
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    37
\     sees A evs <= initState A Un sees Enemy evs";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    38
be ns_shared.induct 1;
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    39
by (ALLGOALS (fast_tac (!claset addDs [sees_Says_subset_insert RS subsetD] 
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    40
			        addss (!simpset))));
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    41
qed "sees_agent_subset_sees_Enemy";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    42
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    43
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    44
(*Nobody sends themselves messages*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    45
goal thy "!!evs. evs : ns_shared ==> ALL A X. Says A A X ~: set_of_list evs";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    46
be ns_shared.induct 1;
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    47
by (Auto_tac());
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    48
qed_spec_mp "not_Says_to_self";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    49
Addsimps [not_Says_to_self];
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    50
AddSEs   [not_Says_to_self RSN (2, rev_notE)];
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    51
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    52
(*For reasoning about the encrypted portion of message NS3*)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    53
goal thy "!!evs. (Says S A (Crypt {|N, B, K, X|} KA)) : set_of_list evs ==> \
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    54
\                X : parts (sees Enemy evs)";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    55
by (fast_tac (!claset addSEs partsEs
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    56
	              addSDs [Says_imp_sees_Enemy RS parts.Inj]) 1);
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    57
qed "NS3_msg_in_parts_sees_Enemy";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    58
			      
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    59
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
    60
(** Theorems of the form X ~: parts (sees Enemy evs) imply that NOBODY
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
    61
    sends messages containing X! **)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    62
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    63
(*Enemy never sees another agent's shared key!*)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    64
goal thy 
1999
b5efc4108d04 Reformatting
paulson
parents: 1997
diff changeset
    65
 "!!evs. [| evs : ns_shared; A ~: bad |]    \
b5efc4108d04 Reformatting
paulson
parents: 1997
diff changeset
    66
\        ==> Key (shrK A) ~: parts (sees Enemy evs)";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    67
be ns_shared.induct 1;
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    68
bd NS3_msg_in_parts_sees_Enemy 5;
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    69
by (Auto_tac());
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    70
(*Deals with Fake message*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    71
by (best_tac (!claset addDs [impOfSubs analz_subset_parts,
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    72
			     impOfSubs Fake_parts_insert]) 1);
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    73
qed "Enemy_not_see_shrK";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    74
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    75
bind_thm ("Enemy_not_analz_shrK",
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    76
	  [analz_subset_parts, Enemy_not_see_shrK] MRS contra_subsetD);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    77
1967
0ff58b41c037 "bad" set simplifies statements of many theorems
paulson
parents: 1965
diff changeset
    78
Addsimps [Enemy_not_see_shrK, Enemy_not_analz_shrK];
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    79
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
    80
(*We go to some trouble to preserve R in the 3rd and 4th subgoals
1967
0ff58b41c037 "bad" set simplifies statements of many theorems
paulson
parents: 1965
diff changeset
    81
  As usual fast_tac cannot be used because it uses the equalities too soon*)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    82
val major::prems = 
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
    83
goal thy  "[| Key (shrK A) : parts (sees Enemy evs);       \
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
    84
\             evs : ns_shared;                             \
1967
0ff58b41c037 "bad" set simplifies statements of many theorems
paulson
parents: 1965
diff changeset
    85
\             A:bad ==> R                                  \
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    86
\           |] ==> R";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    87
br ccontr 1;
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    88
br ([major, Enemy_not_see_shrK] MRS rev_notE) 1;
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    89
by (swap_res_tac prems 2);
1967
0ff58b41c037 "bad" set simplifies statements of many theorems
paulson
parents: 1965
diff changeset
    90
by (ALLGOALS (fast_tac (!claset addIs prems)));
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    91
qed "Enemy_see_shrK_E";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    92
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    93
bind_thm ("Enemy_analz_shrK_E", 
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    94
	  analz_subset_parts RS subsetD RS Enemy_see_shrK_E);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    95
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    96
AddSEs [Enemy_see_shrK_E, Enemy_analz_shrK_E];
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    97
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    98
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    99
goal thy  
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   100
 "!!evs. evs : ns_shared ==>                              \
1967
0ff58b41c037 "bad" set simplifies statements of many theorems
paulson
parents: 1965
diff changeset
   101
\        (Key (shrK A) : analz (sees Enemy evs)) = (A : bad)";
2027
0f11f625063b Last working version before "lost"
paulson
parents: 2015
diff changeset
   102
by (best_tac (!claset addIs [impOfSubs (subset_insertI RS analz_mono)]
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   103
	              addss (!simpset)) 1);
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
   104
qed "shrK_mem_analz";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   105
1967
0ff58b41c037 "bad" set simplifies statements of many theorems
paulson
parents: 1965
diff changeset
   106
Addsimps [shrK_mem_analz];
0ff58b41c037 "bad" set simplifies statements of many theorems
paulson
parents: 1965
diff changeset
   107
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   108
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   109
(*** Future keys can't be seen or used! ***)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   110
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   111
(*Nobody can have SEEN keys that will be generated in the future.
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   112
  This has to be proved anew for each protocol description,
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   113
  but should go by similar reasoning every time.  Hardest case is the
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   114
  standard Fake rule.  
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   115
      The length comparison, and Union over C, are essential for the 
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   116
  induction! *)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   117
goal thy "!!evs. evs : ns_shared ==> \
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   118
\                length evs <= length evs' --> \
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   119
\                          Key (newK evs') ~: (UN C. parts (sees C evs))";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   120
be ns_shared.induct 1;
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   121
bd NS3_msg_in_parts_sees_Enemy 5;
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   122
(*auto_tac does not work here, as it performs safe_tac first*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   123
by (ALLGOALS Asm_simp_tac);
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   124
by (ALLGOALS (fast_tac (!claset addDs [impOfSubs analz_subset_parts,
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   125
				       impOfSubs parts_insert_subset_Un,
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   126
				       Suc_leD]
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   127
			        addss (!simpset))));
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   128
val lemma = result();
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   129
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   130
(*Variant needed for the main theorem below*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   131
goal thy 
1999
b5efc4108d04 Reformatting
paulson
parents: 1997
diff changeset
   132
 "!!evs. [| evs : ns_shared;  length evs <= length evs' |]    \
b5efc4108d04 Reformatting
paulson
parents: 1997
diff changeset
   133
\        ==> Key (newK evs') ~: parts (sees C evs)";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   134
by (fast_tac (!claset addDs [lemma]) 1);
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   135
qed "new_keys_not_seen";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   136
Addsimps [new_keys_not_seen];
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   137
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   138
(*Another variant: old messages must contain old keys!*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   139
goal thy 
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   140
 "!!evs. [| Says A B X : set_of_list evs;  \
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   141
\           Key (newK evt) : parts {X};    \
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   142
\           evs : ns_shared                 \
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   143
\        |] ==> length evt < length evs";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   144
br ccontr 1;
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   145
bd leI 1;
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   146
by (fast_tac (!claset addSDs [new_keys_not_seen, Says_imp_sees_Enemy]
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   147
                      addIs  [impOfSubs parts_mono]) 1);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   148
qed "Says_imp_old_keys";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   149
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   150
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   151
(*Nobody can have USED keys that will be generated in the future.
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   152
  ...very like new_keys_not_seen*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   153
goal thy "!!evs. evs : ns_shared ==> \
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   154
\                length evs <= length evs' --> \
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   155
\                newK evs' ~: keysFor (UN C. parts (sees C evs))";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   156
be ns_shared.induct 1;
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   157
bd NS3_msg_in_parts_sees_Enemy 5;
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   158
by (ALLGOALS Asm_simp_tac);
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   159
(*NS1 and NS2*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   160
map (by o fast_tac (!claset addDs [Suc_leD] addss (!simpset))) [3,2];
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   161
(*Fake and NS3*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   162
map (by o best_tac
1997
6efba890341e No longer assumes Alice is not the Enemy in NS3.
paulson
parents: 1967
diff changeset
   163
     (!claset addDs [impOfSubs (analz_subset_parts RS keysFor_mono),
2027
0f11f625063b Last working version before "lost"
paulson
parents: 2015
diff changeset
   164
                     impOfSubs (parts_insert_subset_Un RS keysFor_mono),
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   165
		     Suc_leD]
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   166
	      addEs [new_keys_not_seen RS not_parts_not_analz RSN (2,rev_notE)]
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   167
	      addss (!simpset)))
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   168
    [2,1];
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   169
(*NS4 and NS5: nonce exchange*)
1997
6efba890341e No longer assumes Alice is not the Enemy in NS3.
paulson
parents: 1967
diff changeset
   170
by (ALLGOALS (deepen_tac (!claset addSDs [Says_imp_old_keys]
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   171
	                          addIs  [less_SucI, impOfSubs keysFor_mono]
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   172
		                  addss (!simpset addsimps [le_def])) 0));
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   173
val lemma = result();
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   174
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   175
goal thy 
1999
b5efc4108d04 Reformatting
paulson
parents: 1997
diff changeset
   176
 "!!evs. [| evs : ns_shared;  length evs <= length evs' |]    \
b5efc4108d04 Reformatting
paulson
parents: 1997
diff changeset
   177
\        ==> newK evs' ~: keysFor (parts (sees C evs))";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   178
by (fast_tac (!claset addSDs [lemma] addss (!simpset)) 1);
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   179
qed "new_keys_not_used";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   180
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   181
bind_thm ("new_keys_not_analzd",
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   182
	  [analz_subset_parts RS keysFor_mono,
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   183
	   new_keys_not_used] MRS contra_subsetD);
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   184
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   185
Addsimps [new_keys_not_used, new_keys_not_analzd];
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   186
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   187
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   188
(** Lemmas concerning the form of items passed in messages **)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   189
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   190
(*Describes the form of K, X and K' when the Server sends this message.*)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   191
goal thy 
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   192
 "!!evs. [| Says Server A (Crypt {|N, Agent B, K, X|} K') : set_of_list evs; \
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   193
\           evs : ns_shared |]    \
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   194
\        ==> (EX evt:ns_shared. \
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   195
\                  K = Key(newK evt) & \
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   196
\                  X = (Crypt {|K, Agent A|} (shrK B)) & \
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   197
\                  K' = shrK A)";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   198
be rev_mp 1;
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   199
be ns_shared.induct 1;
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   200
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   201
qed "Says_Server_message_form";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   202
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   203
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
   204
(*Describes the form of X when the following message is sent.  The use of
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   205
  "parts" strengthens the induction hyp for proving the Fake case.  The
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   206
  assumptions on A are needed to prevent its being a Faked message.*)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   207
goal thy
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   208
 "!!evs. evs : ns_shared ==>                                              \
1967
0ff58b41c037 "bad" set simplifies statements of many theorems
paulson
parents: 1965
diff changeset
   209
\            Crypt {|Nonce NA, Agent B, Key K, X|} (shrK A)               \
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   210
\               : parts (sees Enemy evs) &                                \
1967
0ff58b41c037 "bad" set simplifies statements of many theorems
paulson
parents: 1965
diff changeset
   211
\            A ~: bad --> \
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   212
\          (EX evt:ns_shared. K = newK evt & \
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
   213
\                             X = (Crypt {|Key K, Agent A|} (shrK B)))";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   214
be ns_shared.induct 1;
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   215
bd NS3_msg_in_parts_sees_Enemy 5;
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   216
(*Fake case*)
1967
0ff58b41c037 "bad" set simplifies statements of many theorems
paulson
parents: 1965
diff changeset
   217
by (best_tac (!claset addSDs [impOfSubs Fake_parts_insert]
0ff58b41c037 "bad" set simplifies statements of many theorems
paulson
parents: 1965
diff changeset
   218
	              addDs  [impOfSubs analz_subset_parts]
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   219
	              addss  (!simpset)) 2);
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   220
by (Auto_tac());
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   221
val lemma = result() RS mp;
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   222
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   223
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   224
(*The following theorem is proved by cases.  If the message was sent with a
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   225
  bad key then the Enemy reads it -- even if he didn't send it in the first
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   226
  place.*)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   227
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   228
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   229
(*EITHER describes the form of X when the following message is sent, 
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   230
  OR     reduces it to the Fake case.
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   231
  Use Says_Server_message_form if applicable.*)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   232
goal thy 
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
   233
 "!!evs. [| Says S A (Crypt {|Nonce NA, Agent B, Key K, X|} (shrK A))    \
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   234
\            : set_of_list evs;  evs : ns_shared |]                      \
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
   235
\        ==> (EX evt:ns_shared. K = newK evt & length evt < length evs & \
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   236
\                               X = (Crypt {|Key K, Agent A|} (shrK B))) | \
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   237
\            X : analz (sees Enemy evs)";
1967
0ff58b41c037 "bad" set simplifies statements of many theorems
paulson
parents: 1965
diff changeset
   238
by (excluded_middle_tac "A : bad" 1);
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   239
by (fast_tac (!claset addSDs [Says_imp_sees_Enemy RS analz.Inj]
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   240
	              addss (!simpset)) 2);
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   241
by (forward_tac [lemma] 1);
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   242
by (fast_tac (!claset addEs  partsEs
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   243
	              addSDs [Says_imp_sees_Enemy RS parts.Inj]) 1);
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   244
by (fast_tac (!claset addIs [Says_imp_old_keys] addss (!simpset)) 1);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   245
qed "Says_S_message_form";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   246
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   247
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   248
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   249
(****
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   250
 The following is to prove theorems of the form
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   251
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   252
          Key K : analz (insert (Key (newK evt)) (sees Enemy evs)) ==>
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   253
          Key K : analz (sees Enemy evs)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   254
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   255
 A more general formula must be proved inductively.
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   256
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   257
****)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   258
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   259
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   260
(*NOT useful in this form, but it says that session keys are not used
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   261
  to encrypt messages containing other keys, in the actual protocol.
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   262
  We require that agents should behave like this subsequently also.*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   263
goal thy 
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   264
 "!!evs. evs : ns_shared ==> \
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   265
\        (Crypt X (newK evt)) : parts (sees Enemy evs) & \
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   266
\        Key K : parts {X} --> Key K : parts (sees Enemy evs)";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   267
be ns_shared.induct 1;
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   268
bd NS3_msg_in_parts_sees_Enemy 5;
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   269
by (ALLGOALS (asm_simp_tac (!simpset addsimps pushes)));
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   270
(*Deals with Faked messages*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   271
by (best_tac (!claset addSEs partsEs
2027
0f11f625063b Last working version before "lost"
paulson
parents: 2015
diff changeset
   272
		      addDs [impOfSubs parts_insert_subset_Un]
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   273
                      addss (!simpset)) 2);
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   274
(*Base, NS4 and NS5*)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   275
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   276
result();
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   277
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   278
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   279
(** Specialized rewriting for this proof **)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   280
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   281
Delsimps [image_insert];
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   282
Addsimps [image_insert RS sym];
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   283
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   284
Delsimps [image_Un];
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   285
Addsimps [image_Un RS sym];
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   286
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   287
goal thy "insert (Key (newK x)) (sees A evs) = \
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   288
\         Key `` (newK``{x}) Un (sees A evs)";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   289
by (Fast_tac 1);
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   290
val insert_Key_singleton = result();
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   291
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   292
goal thy "insert (Key (f x)) (Key``(f``E) Un C) = \
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   293
\         Key `` (f `` (insert x E)) Un C";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   294
by (Fast_tac 1);
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   295
val insert_Key_image = result();
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   296
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   297
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   298
(** Session keys are not used to encrypt other session keys **)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   299
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
   300
(*Lemma for the trivial direction of the if-and-only-if*)
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
   301
goal thy  
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   302
 "!!evs. (Key K : analz (Key``nE Un sEe)) --> \
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   303
\         (K : nE | Key K : analz sEe)  ==>     \
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   304
\        (Key K : analz (Key``nE Un sEe)) = (K : nE | Key K : analz sEe)";
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
   305
by (fast_tac (!claset addSEs [impOfSubs analz_mono]) 1);
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
   306
val lemma = result();
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
   307
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   308
(*The equality makes the induction hypothesis easier to apply*)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   309
goal thy  
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   310
 "!!evs. evs : ns_shared ==> \
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   311
\  ALL K E. (Key K : analz (Key``(newK``E) Un (sees Enemy evs))) = \
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   312
\           (K : newK``E | Key K : analz (sees Enemy evs))";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   313
be ns_shared.induct 1;
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   314
by (forward_tac [Says_S_message_form] 5 THEN assume_tac 5);	
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   315
by (REPEAT ((eresolve_tac [bexE, conjE, disjE] ORELSE' hyp_subst_tac) 5));
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
   316
by (REPEAT_FIRST (resolve_tac [allI, lemma]));
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   317
by (ALLGOALS 
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   318
    (asm_simp_tac 
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   319
     (!simpset addsimps ([insert_Key_singleton, insert_Key_image, pushKey_newK]
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   320
			 @ pushes)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   321
               setloop split_tac [expand_if])));
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
   322
(** LEVEL 5 **)
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   323
(*NS3, Fake subcase*)
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   324
by (enemy_analz_tac 5);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   325
(*Cases NS2 and NS3!!  Simple, thanks to auto case splits*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   326
by (REPEAT (Fast_tac 3));
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   327
(*Fake case*) (** LEVEL 7 **)
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   328
by (enemy_analz_tac 2);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   329
(*Base case*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   330
by (fast_tac (!claset addIs [image_eqI] addss (!simpset)) 1);
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   331
qed_spec_mp "analz_image_newK";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   332
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   333
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   334
goal thy
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   335
 "!!evs. evs : ns_shared ==>                               \
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   336
\        Key K : analz (insert (Key (newK evt)) (sees Enemy evs)) = \
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   337
\        (K = newK evt | Key K : analz (sees Enemy evs))";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   338
by (asm_simp_tac (HOL_ss addsimps [pushKey_newK, analz_image_newK, 
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   339
				   insert_Key_singleton]) 1);
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   340
by (Fast_tac 1);
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   341
qed "analz_insert_Key_newK";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   342
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   343
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   344
(** The session key K uniquely identifies the message, if encrypted
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   345
    with a secure key **)
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   346
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   347
fun ex_strip_tac i = REPEAT (ares_tac [exI, conjI] i) THEN assume_tac (i+1);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   348
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   349
goal thy 
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   350
 "!!evs. evs : ns_shared ==>                             \
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   351
\      EX X'. ALL A X N B.                               \
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   352
\       A ~: bad -->                                     \
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   353
\       Crypt {|N, Agent B, Key K, X|} (shrK A) : parts (sees Enemy evs) --> \
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   354
\       X=X'";
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   355
by (Simp_tac 1);	(*Miniscoping*)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   356
be ns_shared.induct 1;
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   357
by (forward_tac [Says_S_message_form] 5 THEN assume_tac 5);	
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   358
by (ALLGOALS 
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   359
    (asm_simp_tac (!simpset addsimps [all_conj_distrib, ex_disj_distrib,
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   360
				      imp_conj_distrib, parts_insert_sees])));
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   361
by (REPEAT_FIRST (eresolve_tac [exE,disjE]));
2027
0f11f625063b Last working version before "lost"
paulson
parents: 2015
diff changeset
   362
(*NS2: Cextraction of K = newK evsa to global context...*) 
0f11f625063b Last working version before "lost"
paulson
parents: 2015
diff changeset
   363
(** LEVEL 5 **)
0f11f625063b Last working version before "lost"
paulson
parents: 2015
diff changeset
   364
by (excluded_middle_tac "K = newK evsa" 3);
0f11f625063b Last working version before "lost"
paulson
parents: 2015
diff changeset
   365
by (Asm_simp_tac 3);
0f11f625063b Last working version before "lost"
paulson
parents: 2015
diff changeset
   366
be exI 3;
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   367
(*...we assume X is a very new message, and handle this case by contradiction*)
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   368
by (fast_tac (!claset addSEs partsEs
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   369
		      addEs [Says_imp_old_keys RS less_irrefl]
2027
0f11f625063b Last working version before "lost"
paulson
parents: 2015
diff changeset
   370
	              addss (!simpset)) 3);
0f11f625063b Last working version before "lost"
paulson
parents: 2015
diff changeset
   371
(*Base, Fake, NS3*) (** LEVEL 9 **)
0f11f625063b Last working version before "lost"
paulson
parents: 2015
diff changeset
   372
by (REPEAT_FIRST ex_strip_tac);
0f11f625063b Last working version before "lost"
paulson
parents: 2015
diff changeset
   373
bd synth.Inj 4;
0f11f625063b Last working version before "lost"
paulson
parents: 2015
diff changeset
   374
by (REPEAT_FIRST (best_tac (!claset addDs [impOfSubs Fake_parts_insert]
0f11f625063b Last working version before "lost"
paulson
parents: 2015
diff changeset
   375
			            addss (!simpset))));
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   376
val lemma = result();
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   377
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   378
(*In messages of this form, the session key uniquely identifies the rest*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   379
goal thy 
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   380
 "!!evs. [| Says S A          \
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
   381
\             (Crypt {|N, Agent B, Key K, X|} (shrK C))     \
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   382
\                  : set_of_list evs; \ 
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   383
\           Says S' A'                                         \
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
   384
\             (Crypt {|N', Agent B', Key K, X'|} (shrK C')) \
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   385
\                  : set_of_list evs;                         \
1967
0ff58b41c037 "bad" set simplifies statements of many theorems
paulson
parents: 1965
diff changeset
   386
\           evs : ns_shared;  C ~= Enemy;  C ~: bad;  C' ~: bad |] ==> X = X'";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   387
bd lemma 1;
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   388
be exE 1;
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   389
(*Duplicate the assumption*)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   390
by (forw_inst_tac [("psi", "ALL C.?P(C)")] asm_rl 1);
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   391
by (fast_tac (!claset addSDs [Says_imp_sees_Enemy RS parts.Inj]) 1);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   392
qed "unique_session_keys";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   393
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   394
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   395
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   396
(** Crucial secrecy property: Enemy does not see the keys sent in msg NS2 **)
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   397
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   398
goal thy 
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   399
 "!!evs. [| A ~: bad;  B ~: bad;  evs : ns_shared;  evt: ns_shared |]  \
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   400
\        ==> Says Server A                                             \
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   401
\              (Crypt {|N, Agent B, Key(newK evt),                     \
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   402
\                       Crypt {|Key(newK evt), Agent A|} (shrK B)|} (shrK A)) \
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   403
\             : set_of_list evs --> \
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   404
\        Key(newK evt) ~: analz (sees Enemy evs)";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   405
be ns_shared.induct 1;
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   406
by (ALLGOALS 
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   407
    (asm_simp_tac 
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   408
     (!simpset addsimps ([analz_subset_parts RS contra_subsetD,
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   409
			  analz_insert_Key_newK] @ pushes)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   410
               setloop split_tac [expand_if])));
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   411
(*NS2*)
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   412
by (fast_tac (!claset addIs [parts_insertI]
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   413
		      addEs [Says_imp_old_keys RS less_irrefl]
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   414
	              addss (!simpset)) 2);
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   415
(*Fake case*)
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   416
by (enemy_analz_tac 1);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   417
(*NS3: that message from the Server was sent earlier*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   418
by (forward_tac [Says_S_message_form] 1 THEN assume_tac 1);
1967
0ff58b41c037 "bad" set simplifies statements of many theorems
paulson
parents: 1965
diff changeset
   419
by (Step_tac 1);
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   420
by (enemy_analz_tac 2);		(*Prove the Fake subcase*)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   421
by (asm_full_simp_tac
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   422
    (!simpset addsimps (mem_if::analz_insert_Key_newK::pushes)) 1);
1967
0ff58b41c037 "bad" set simplifies statements of many theorems
paulson
parents: 1965
diff changeset
   423
by (Step_tac 1);
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   424
(**LEVEL 9 **)
1997
6efba890341e No longer assumes Alice is not the Enemy in NS3.
paulson
parents: 1967
diff changeset
   425
by (excluded_middle_tac "Aa : bad" 1);
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   426
(*But this contradicts Key(newK evt) ~: analz (sees Enemy evsa) *)
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   427
bd (Says_imp_sees_Enemy RS analz.Inj) 2;
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   428
by (fast_tac (!claset addSDs [analz.Decrypt]
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   429
	              addss (!simpset)) 2);
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   430
(*So now we have  Aa ~: bad *)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   431
bd unique_session_keys 1;
1967
0ff58b41c037 "bad" set simplifies statements of many theorems
paulson
parents: 1965
diff changeset
   432
by (Auto_tac ());
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   433
val lemma = result() RS mp RSN(2,rev_notE);
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   434
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   435
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   436
(*Final version: Server's message in the most abstract form*)
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   437
goal thy 
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   438
 "!!evs. [| Says Server A                                                \
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   439
\            (Crypt {|N, Agent B, K, X|} K') : set_of_list evs;          \
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   440
\           A ~: bad;  B ~: bad;  evs : ns_shared                        \
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   441
\        |] ==>                                                          \
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   442
\     K ~: analz (sees Enemy evs)";
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   443
by (forward_tac [Says_Server_message_form] 1 THEN assume_tac 1);
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   444
by (fast_tac (!claset addSEs [lemma]) 1);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   445
qed "Enemy_not_see_encrypted_key";