src/HOL/Auth/NS_Shared.ML
author paulson
Thu, 24 Oct 1996 10:31:17 +0200
changeset 2122 cb302f6c9c06
parent 2103 bfd2e8cca89c
child 2131 3106a99d30a5
permissions -rw-r--r--
Moved ex_strip_tac to the common part
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 |]   \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    22
\        ==> EX N K. EX evs: ns_shared lost.          \
1997
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));
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    25
by (rtac (ns_shared.Nil RS ns_shared.NS1 RS ns_shared.NS2 RS ns_shared.NS3 RS ns_shared.NS4 RS ns_shared.NS5) 2);
1997
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
2103
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
    34
(*Monotonicity*)
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    35
goal thy "!!evs. lost' <= lost ==> ns_shared lost' <= ns_shared lost";
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    36
by (rtac subsetI 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    37
by (etac ns_shared.induct 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    38
by (REPEAT_FIRST
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    39
    (best_tac (!claset addIs (impOfSubs (sees_mono RS analz_mono RS synth_mono)
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    40
                              :: ns_shared.intrs))));
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    41
qed "ns_shared_mono";
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    42
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    43
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    44
(*Nobody sends themselves messages*)
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    45
goal thy "!!evs. evs : ns_shared lost ==> ALL A X. Says A A X ~: set_of_list evs";
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    46
by (etac ns_shared.induct 1);
1934
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 ==> \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    54
\                X : parts (sees lost Spy evs)";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    55
by (fast_tac (!claset addSEs partsEs
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    56
                      addSDs [Says_imp_sees_Spy RS parts.Inj]) 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    57
qed "NS3_msg_in_parts_sees_Spy";
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    58
                              
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    59
goal thy
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    60
    "!!evs. Says S A (Crypt {|NA, B, K, X|} (shrK A)) : set_of_list evs ==> \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    61
\                K : parts (sees lost Spy evs)";
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    62
by (fast_tac (!claset addSEs partsEs
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    63
                      addSDs [Says_imp_sees_Spy RS parts.Inj]) 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    64
qed "Reveal_parts_sees_Spy";
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    65
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    66
val parts_Fake_tac = 
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    67
    dres_inst_tac [("lost","lost")] NS3_msg_in_parts_sees_Spy 5 THEN
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    68
    forw_inst_tac [("lost","lost")] Reveal_parts_sees_Spy 8;
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    69
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    70
(*For proving the easier theorems about X ~: parts (sees lost Spy evs) *)
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    71
fun parts_induct_tac i = SELECT_GOAL
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    72
    (DETERM (etac ns_shared.induct 1 THEN parts_Fake_tac THEN
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    73
	     (*Fake message*)
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    74
	     TRY (best_tac (!claset addDs [impOfSubs analz_subset_parts,
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    75
					   impOfSubs Fake_parts_insert]
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    76
                                    addss (!simpset)) 2)) THEN
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    77
     (*Base case*)
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    78
     fast_tac (!claset addss (!simpset)) 1 THEN
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    79
     ALLGOALS Asm_simp_tac) i;
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    80
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    81
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    82
(** Theorems of the form X ~: parts (sees lost Spy evs) imply that NOBODY
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
    83
    sends messages containing X! **)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    84
2103
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
    85
(*Spy never sees another agent's shared key!*)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    86
goal thy 
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    87
 "!!evs. [| evs : ns_shared lost; A ~: lost |]    \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    88
\        ==> Key (shrK A) ~: parts (sees lost Spy evs)";
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    89
by (parts_induct_tac 1);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    90
by (Auto_tac());
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    91
qed "Spy_not_see_shrK";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    92
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    93
bind_thm ("Spy_not_analz_shrK",
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    94
          [analz_subset_parts, Spy_not_see_shrK] MRS contra_subsetD);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    95
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    96
Addsimps [Spy_not_see_shrK, Spy_not_analz_shrK];
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    97
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
    98
(*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
    99
  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
   100
val major::prems = 
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   101
goal thy  "[| Key (shrK A) : parts (sees lost Spy evs);       \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   102
\             evs : ns_shared lost;                             \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   103
\             A:lost ==> R                                  \
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   104
\           |] ==> R";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   105
by (rtac ccontr 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   106
by (rtac ([major, Spy_not_see_shrK] MRS rev_notE) 1);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   107
by (swap_res_tac prems 2);
1967
0ff58b41c037 "bad" set simplifies statements of many theorems
paulson
parents: 1965
diff changeset
   108
by (ALLGOALS (fast_tac (!claset addIs prems)));
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   109
qed "Spy_see_shrK_E";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   110
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   111
bind_thm ("Spy_analz_shrK_E", 
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   112
          analz_subset_parts RS subsetD RS Spy_see_shrK_E);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   113
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   114
AddSEs [Spy_see_shrK_E, Spy_analz_shrK_E];
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   115
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   116
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   117
goal thy  
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   118
 "!!evs. evs : ns_shared lost ==>                              \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   119
\        (Key (shrK A) : analz (sees lost Spy evs)) = (A : lost)";
2027
0f11f625063b Last working version before "lost"
paulson
parents: 2015
diff changeset
   120
by (best_tac (!claset addIs [impOfSubs (subset_insertI RS analz_mono)]
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   121
                      addss (!simpset)) 1);
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
   122
qed "shrK_mem_analz";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   123
1967
0ff58b41c037 "bad" set simplifies statements of many theorems
paulson
parents: 1965
diff changeset
   124
Addsimps [shrK_mem_analz];
0ff58b41c037 "bad" set simplifies statements of many theorems
paulson
parents: 1965
diff changeset
   125
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   126
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   127
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   128
(*** Future keys can't be seen or used! ***)
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
(*Nobody can have SEEN keys that will be generated in the future.
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   131
  This has to be proved anew for each protocol description,
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   132
  but should go by similar reasoning every time.  Hardest case is the
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   133
  standard Fake rule.  
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   134
      The length comparison, and Union over C, are essential for the 
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   135
  induction! *)
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   136
goal thy "!!evs. evs : ns_shared lost ==> \
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   137
\                length evs <= length evs' --> \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   138
\                          Key (newK evs') ~: (UN C. parts (sees lost C evs))";
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   139
by (parts_induct_tac 1);
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   140
by (ALLGOALS (fast_tac (!claset addDs [impOfSubs analz_subset_parts,
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   141
                                       impOfSubs parts_insert_subset_Un,
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   142
                                       Suc_leD]
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   143
                                addss (!simpset))));
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   144
val lemma = result();
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   145
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   146
(*Variant needed for the main theorem below*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   147
goal thy 
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   148
 "!!evs. [| evs : ns_shared lost;  length evs <= length evs' |]    \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   149
\        ==> Key (newK evs') ~: parts (sees lost C evs)";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   150
by (fast_tac (!claset addDs [lemma]) 1);
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   151
qed "new_keys_not_seen";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   152
Addsimps [new_keys_not_seen];
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   153
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   154
(*Another variant: old messages must contain old keys!*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   155
goal thy 
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   156
 "!!evs. [| Says A B X : set_of_list evs;  \
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   157
\           Key (newK evt) : parts {X};    \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   158
\           evs : ns_shared lost                 \
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   159
\        |] ==> length evt < length evs";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   160
by (rtac ccontr 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   161
by (dtac leI 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   162
by (fast_tac (!claset addSDs [new_keys_not_seen, Says_imp_sees_Spy]
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   163
                      addIs  [impOfSubs parts_mono]) 1);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   164
qed "Says_imp_old_keys";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   165
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   166
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   167
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   168
(*** Future nonces can't be seen or used! [proofs resemble those above] ***)
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   169
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   170
goal thy "!!evs. evs : ns_shared lost ==> \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   171
\                length evs <= length evt --> \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   172
\                Nonce (newN evt) ~: (UN C. parts (sees lost C evs))";
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   173
by (etac ns_shared.induct 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   174
(*auto_tac does not work here, as it performs safe_tac first*)
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   175
by (ALLGOALS (asm_simp_tac (!simpset addsimps [parts_insert2]
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   176
                                     addcongs [disj_cong])));
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   177
by (REPEAT_FIRST (fast_tac (!claset 
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   178
                              addSEs partsEs
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   179
                              addSDs  [Says_imp_sees_Spy RS parts.Inj]
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   180
                              addDs  [impOfSubs analz_subset_parts,
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   181
                                      impOfSubs parts_insert_subset_Un,
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   182
                                      Suc_leD]
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   183
                              addss (!simpset))));
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   184
val lemma = result();
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   185
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   186
(*Variant needed below*)
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   187
goal thy 
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   188
 "!!evs. [| evs : ns_shared lost;  length evs <= length evs' |]    \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   189
\        ==> Nonce (newN evs') ~: parts (sees lost C evs)";
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   190
by (fast_tac (!claset addDs [lemma]) 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   191
qed "new_nonces_not_seen";
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   192
Addsimps [new_nonces_not_seen];
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   193
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   194
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   195
(*Nobody can have USED keys that will be generated in the future.
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   196
  ...very like new_keys_not_seen*)
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   197
goal thy "!!evs. evs : ns_shared lost ==> \
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   198
\                length evs <= length evs' --> \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   199
\                newK evs' ~: keysFor (UN C. parts (sees lost C evs))";
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   200
by (parts_induct_tac 1);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   201
(*NS1 and NS2*)
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   202
by (EVERY (map (fast_tac (!claset addDs [Suc_leD] addss (!simpset))) [3,2]));
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   203
(*Fake and NS3*)
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   204
by (EVERY 
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   205
    (map
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   206
     (best_tac
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   207
      (!claset addDs [impOfSubs (analz_subset_parts RS keysFor_mono),
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   208
                      impOfSubs (parts_insert_subset_Un RS keysFor_mono),
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   209
                      Suc_leD]
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   210
               addEs [new_keys_not_seen RS not_parts_not_analz RSN(2,rev_notE)]
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   211
               addss (!simpset)))
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   212
     [2,1]));
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   213
(*NS4 and NS5: nonce exchange*)
1997
6efba890341e No longer assumes Alice is not the Enemy in NS3.
paulson
parents: 1967
diff changeset
   214
by (ALLGOALS (deepen_tac (!claset addSDs [Says_imp_old_keys]
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   215
                                  addIs  [less_SucI, impOfSubs keysFor_mono]
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   216
                                  addss (!simpset addsimps [le_def])) 1));
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   217
val lemma = result();
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   218
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   219
goal thy 
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   220
 "!!evs. [| evs : ns_shared lost;  length evs <= length evs' |]    \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   221
\        ==> newK evs' ~: keysFor (parts (sees lost C evs))";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   222
by (fast_tac (!claset addSDs [lemma] addss (!simpset)) 1);
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   223
qed "new_keys_not_used";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   224
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   225
bind_thm ("new_keys_not_analzd",
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   226
          [analz_subset_parts RS keysFor_mono,
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   227
           new_keys_not_used] MRS contra_subsetD);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   228
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   229
Addsimps [new_keys_not_used, new_keys_not_analzd];
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   230
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   231
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   232
(** Lemmas concerning the form of items passed in messages **)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   233
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   234
(*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
   235
goal thy 
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   236
 "!!evs. [| Says Server A (Crypt {|N, Agent B, K, X|} K') : set_of_list evs; \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   237
\           evs : ns_shared lost |]    \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   238
\        ==> (EX evt: ns_shared lost. \
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   239
\                  K = Key(newK evt) & \
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   240
\                  X = (Crypt {|K, Agent A|} (shrK B)) & \
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   241
\                  K' = shrK A)";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   242
by (etac rev_mp 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   243
by (etac ns_shared.induct 1);
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   244
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   245
qed "Says_Server_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
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   248
(*If the encrypted message appears then it originated with the Server*)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   249
goal thy
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   250
 "!!evs. [| Crypt {|NA, Agent B, Key K, X|} (shrK A)                   \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   251
\            : parts (sees lost Spy evs);                              \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   252
\           A ~: lost;  evs : ns_shared lost |]                        \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   253
\         ==> X = (Crypt {|Key K, Agent A|} (shrK B)) &                \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   254
\             Says Server A                                            \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   255
\              (Crypt {|NA, Agent B, Key K,                            \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   256
\                       Crypt {|Key K, Agent A|} (shrK B)|} (shrK A))  \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   257
\             : set_of_list evs";
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   258
by (etac rev_mp 1);
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   259
by (etac ns_shared.induct 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   260
by parts_Fake_tac;
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   261
(*Fake case*)
1967
0ff58b41c037 "bad" set simplifies statements of many theorems
paulson
parents: 1965
diff changeset
   262
by (best_tac (!claset addSDs [impOfSubs Fake_parts_insert]
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   263
                      addDs  [impOfSubs analz_subset_parts]
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   264
                      addss  (!simpset)) 2);
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   265
by (Auto_tac());
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   266
qed "A_trust_NS2";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   267
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   268
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   269
(*EITHER describes the form of X when the following message is sent, 
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   270
  OR     reduces it to the Fake case.
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   271
  Use Says_Server_message_form if applicable.*)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   272
goal thy 
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   273
 "!!evs. [| Says S A (Crypt {|Nonce NA, Agent B, Key K, X|} (shrK A))      \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   274
\            : set_of_list evs;  evs : ns_shared lost |]                   \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   275
\        ==> (EX evt: ns_shared lost. K = newK evt &                       \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   276
\                               length evt < length evs &                  \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   277
\                               X = (Crypt {|Key K, Agent A|} (shrK B)))   \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   278
\          | X : analz (sees lost Spy evs)";
2103
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   279
by (case_tac "A : lost" 1);
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   280
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]
2103
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   281
                      addss (!simpset)) 1);
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   282
by (forward_tac [Says_imp_sees_Spy RS parts.Inj] 1);
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   283
by (fast_tac (!claset addEs  partsEs
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   284
                      addSDs [A_trust_NS2, Says_Server_message_form]
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   285
		      addIs [Says_imp_old_keys]
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   286
                      addss (!simpset)) 1);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   287
qed "Says_S_message_form";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   288
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   289
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   290
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
 The following is to prove theorems of the form
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   293
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   294
          Key K : analz (insert (Key (newK evt)) (sees lost Spy evs)) ==>
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   295
          Key K : analz (sees lost Spy evs)
1934
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
 A more general formula must be proved inductively.
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   298
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   299
****)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   300
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   301
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   302
(*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
   303
  to encrypt messages containing other keys, in the actual protocol.
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   304
  We require that agents should behave like this subsequently also.*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   305
goal thy 
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   306
 "!!evs. evs : ns_shared lost ==> \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   307
\        (Crypt X (newK evt)) : parts (sees lost Spy evs) & \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   308
\        Key K : parts {X} --> Key K : parts (sees lost Spy evs)";
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   309
by (etac ns_shared.induct 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   310
by parts_Fake_tac;
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   311
by (ALLGOALS Asm_simp_tac);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   312
(*Deals with Faked messages*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   313
by (best_tac (!claset addSEs partsEs
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   314
                      addDs [impOfSubs parts_insert_subset_Un]
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   315
                      addss (!simpset)) 2);
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   316
(*Base, NS4 and NS5*)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   317
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   318
result();
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   319
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   320
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   321
(** Session keys are not used to encrypt other session keys **)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   322
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   323
(*Describes the form of Key K when the following message is sent.  The use of
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   324
  "parts" strengthens the induction hyp for proving the Fake case.  The
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   325
  assumption A ~: lost prevents its being a Faked message. *)
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   326
goal thy
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   327
 "!!evs. evs: ns_shared lost ==>                                           \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   328
\        Crypt {|NA, Agent B, Key K, X|} (shrK A)          \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   329
\          : parts (sees lost Spy evs)   &   A ~: lost              \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   330
\        --> (EX evt: ns_shared lost. K = newK evt)";
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   331
by (parts_induct_tac 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   332
by (Auto_tac());
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   333
val lemma = result() RS mp;
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   334
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   335
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   336
(*EITHER describes the form of Key K when the following message is sent, 
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   337
  OR     reduces it to the Fake case.*)
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   338
goal thy 
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   339
 "!!evs. [| Says S A (Crypt {|NA, Agent B, Key K, X|} (shrK A))  \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   340
\           : set_of_list evs;  \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   341
\           evs : ns_shared lost |]                      \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   342
\        ==> (EX evt: ns_shared lost. K = newK evt)          \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   343
\          | Key K : analz (sees lost Spy evs)";
2103
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   344
by (case_tac "A : lost" 1);
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   345
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]
2103
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   346
                      addss (!simpset)) 1);
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   347
by (forward_tac [lemma] 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   348
by (fast_tac (!claset addEs  partsEs
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   349
                      addSDs [Says_imp_sees_Spy RS parts.Inj]) 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   350
by (Fast_tac 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   351
qed "Reveal_message_form";
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   352
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   353
(*The equality makes the induction hypothesis easier to apply*)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   354
goal thy  
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   355
 "!!evs. evs : ns_shared lost ==> \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   356
\  ALL K E. (Key K : analz (Key``(newK``E) Un (sees lost Spy evs))) = \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   357
\           (K : newK``E | Key K : analz (sees lost Spy evs))";
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   358
by (etac ns_shared.induct 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   359
by (forward_tac [Says_S_message_form] 5 THEN assume_tac 5);     
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   360
by (dtac Reveal_message_form 8);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   361
by (REPEAT_FIRST (eresolve_tac [bexE, conjE, disjE] ORELSE' hyp_subst_tac));
2045
ae1030e66745 Removed some dead wood. Transferred lemmas used to prove analz_image_newK
paulson
parents: 2032
diff changeset
   362
by (REPEAT_FIRST (resolve_tac [allI, analz_image_newK_lemma]));
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   363
by (ALLGOALS 
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   364
    (asm_simp_tac 
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   365
     (!simpset addsimps ([insert_Key_singleton, insert_Key_image, pushKey_newK]
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   366
                         @ pushes)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   367
               setloop split_tac [expand_if])));
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   368
(** LEVEL 6 **)
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   369
(*Reveal case 2, NS3, Fake*) 
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   370
by (EVERY (map spy_analz_tac [7,5,2]));
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   371
by (REPEAT (fast_tac (!claset addIs [image_eqI] addss (!simpset)) 1));
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   372
(*NS3, NS2, Base*)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   373
by (REPEAT (Fast_tac 3));
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   374
qed_spec_mp "analz_image_newK";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   375
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   376
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   377
goal thy
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   378
 "!!evs. evs : ns_shared lost ==>                               \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   379
\        Key K : analz (insert (Key (newK evt)) (sees lost Spy evs)) = \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   380
\        (K = newK evt | Key K : analz (sees lost Spy evs))";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   381
by (asm_simp_tac (HOL_ss addsimps [pushKey_newK, analz_image_newK, 
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   382
                                   insert_Key_singleton]) 1);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   383
by (Fast_tac 1);
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   384
qed "analz_insert_Key_newK";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   385
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   386
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   387
(** The session key K uniquely identifies the message, if encrypted
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   388
    with a secure key **)
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   389
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   390
goal thy 
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   391
 "!!evs. evs : ns_shared lost ==>                                            \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   392
\      EX A' NA' B' X'. ALL A NA B X.                                        \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   393
\       Says Server A (Crypt {|NA, Agent B, Key K, X|} (shrK A))         \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   394
\       : set_of_list evs --> A=A' & NA=NA' & B=B' & X=X'";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   395
by (etac ns_shared.induct 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   396
by (forward_tac [Says_S_message_form] 5 THEN assume_tac 5);     
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   397
by (REPEAT_FIRST (eresolve_tac [conjE, bexE, disjE] ORELSE' hyp_subst_tac));
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   398
by (ALLGOALS (asm_simp_tac (!simpset addsimps [all_conj_distrib])));
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   399
by (step_tac (!claset delrules [conjI]) 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   400
(*NS3*)
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   401
by (ex_strip_tac 2);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   402
by (Fast_tac 2);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   403
(*NS2: it can't be a new key*)
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   404
by (expand_case_tac "K = ?y" 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   405
by (REPEAT (ares_tac [refl,exI,impI,conjI] 2));
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   406
by (fast_tac (!claset addEs [Says_imp_old_keys RS less_irrefl]
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   407
                      delrules [conjI]    (*prevent split-up into 4 subgoals*)
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   408
                      addss (!simpset addsimps [parts_insertI])) 1);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   409
val lemma = result();
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   410
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   411
(*In messages of this form, the session key uniquely identifies the rest*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   412
goal thy 
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   413
 "!!evs. [| Says Server A                                    \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   414
\             (Crypt {|NA, Agent B, Key K, X|} (shrK A))     \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   415
\                  : set_of_list evs;                        \ 
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   416
\           Says Server A'                                   \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   417
\             (Crypt {|NA', Agent B', Key K, X'|} (shrK A')) \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   418
\                  : set_of_list evs;                        \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   419
\           evs : ns_shared lost |] ==> A=A' & NA=NA' & B=B' & X = X'";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   420
by (dtac lemma 1);
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   421
by (REPEAT (etac exE 1));
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   422
(*Duplicate the assumption*)
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   423
by (forw_inst_tac [("psi", "ALL A.?P(A)")] asm_rl 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   424
by (fast_tac (!claset addSDs [ spec] 
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   425
	              delrules [conjI] addss (!simpset)) 1);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   426
qed "unique_session_keys";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   427
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   428
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   429
(** Crucial secrecy property: Spy does not see the keys sent in msg NS2 **)
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   430
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   431
goal thy 
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   432
 "!!evs. [| A ~: lost;  B ~: lost;  \
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   433
\           evs : ns_shared lost;  evt: ns_shared lost |]  \
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   434
\        ==> Says Server A                                             \
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   435
\              (Crypt {|NA, Agent B, Key K,                            \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   436
\                       Crypt {|Key K, Agent A|} (shrK B)|} (shrK A))  \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   437
\             : set_of_list evs -->                                    \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   438
\        (ALL NB. Says A Spy {|NA, NB, Key K|} ~: set_of_list evs) --> \
2050
1b3343fa1278 Moved sees_lost_agent_subset_sees_Spy to common file, and simplified main thm
paulson
parents: 2045
diff changeset
   439
\        Key K ~: analz (sees lost Spy evs)";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   440
by (etac ns_shared.induct 1);
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   441
by (forward_tac [Reveal_message_form] 8);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   442
by (forward_tac [Says_S_message_form] 5 THEN assume_tac 5);     
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   443
by (REPEAT_FIRST (eresolve_tac [asm_rl, bexE, disjE] ORELSE' hyp_subst_tac));
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   444
by (ALLGOALS 
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   445
    (asm_simp_tac 
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   446
     (!simpset addsimps ([analz_subset_parts RS contra_subsetD,
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   447
                          analz_insert_Key_newK] @ pushes)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   448
               setloop split_tac [expand_if])));
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   449
(*NS2*)
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   450
by (fast_tac (!claset addIs [parts_insertI]
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   451
                      addEs [Says_imp_old_keys RS less_irrefl]
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   452
                      addss (!simpset)) 2);
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   453
(*Revl case 2, OR4, OR2, Fake*) 
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   454
by (REPEAT_FIRST (resolve_tac [conjI, impI] ORELSE' spy_analz_tac));
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   455
(*NS3 and Revl subcases*) (**LEVEL 7 **)
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   456
by (step_tac (!claset delrules [impCE]) 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   457
by (full_simp_tac (!simpset addsimps [all_conj_distrib]) 2);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   458
be conjE 2;
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   459
by (mp_tac 2);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   460
(**LEVEL 11 **)
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   461
by (forward_tac [Says_imp_sees_Spy RS parts.Inj RS A_trust_NS2] 2);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   462
ba 3;
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   463
by (fast_tac (!claset addSEs [Says_Crypt_not_lost]) 2);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   464
by (fast_tac (!claset addDs [unique_session_keys] addss (!simpset)) 2);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   465
(*NS3*)
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   466
by (forward_tac [Says_imp_sees_Spy RS parts.Inj RS A_trust_NS2] 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   467
ba 2;
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   468
by (fast_tac (!claset addSEs [Says_Crypt_not_lost]) 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   469
by (fast_tac (!claset addDs [unique_session_keys] addss (!simpset)) 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   470
val lemma = result() RS mp RS mp RSN(2,rev_notE);
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   471
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   472
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   473
(*Final version: Server's message in the most abstract form*)
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   474
goal thy 
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   475
 "!!evs. [| Says Server A                                               \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   476
\            (Crypt {|NA, Agent B, K, X|} K') : set_of_list evs;        \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   477
\           (ALL NB. Says A Spy {|NA, NB, K|} ~: set_of_list evs);      \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   478
\           A ~: lost;  B ~: lost;  evs : ns_shared lost                \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   479
\        |] ==> K ~: analz (sees lost Spy evs)";
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   480
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
   481
by (fast_tac (!claset addSEs [lemma]) 1);
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   482
qed "Spy_not_see_encrypted_key";
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   483
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   484
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   485
goal thy 
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   486
 "!!evs. [| C ~: {A,B,Server};                                          \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   487
\           Says Server A                                               \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   488
\            (Crypt {|NA, Agent B, K, X|} K') : set_of_list evs;        \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   489
\           (ALL NB. Says A Spy {|NA, NB, K|} ~: set_of_list evs);      \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   490
\           A ~: lost;  B ~: lost;  evs : ns_shared lost |]             \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   491
\        ==> K ~: analz (sees lost C evs)";
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   492
by (rtac (subset_insertI RS sees_mono RS analz_mono RS contra_subsetD) 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   493
by (rtac (sees_lost_agent_subset_sees_Spy RS analz_mono RS contra_subsetD) 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   494
by (FIRSTGOAL (rtac Spy_not_see_encrypted_key));
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   495
by (REPEAT_FIRST (fast_tac (!claset addIs [ns_shared_mono RS subsetD])));
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   496
qed "Agent_not_see_encrypted_key";
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   497
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   498
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   499
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   500
(**** Guarantees available at various stages of protocol ***)
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   501
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   502
A_trust_NS2 RS conjunct2 RS Spy_not_see_encrypted_key;
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   503
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   504
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   505
(*If the encrypted message appears then it originated with the Server*)
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   506
goal thy
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   507
 "!!evs. [| Crypt {|Key K, Agent A|} (shrK B) : parts (sees lost Spy evs); \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   508
\           B ~: lost;  evs : ns_shared lost |]                        \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   509
\         ==> EX NA. Says Server A                                     \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   510
\              (Crypt {|NA, Agent B, Key K,                            \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   511
\                       Crypt {|Key K, Agent A|} (shrK B)|} (shrK A))  \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   512
\             : set_of_list evs";
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   513
by (etac rev_mp 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   514
by (etac ns_shared.induct 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   515
by parts_Fake_tac;
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   516
(*Fake case*)
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   517
by (best_tac (!claset addSDs [impOfSubs Fake_parts_insert]
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   518
                      addDs  [impOfSubs analz_subset_parts]
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   519
                      addss  (!simpset)) 2);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   520
by (Auto_tac());
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   521
qed "B_trust_NS3";
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   522
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   523
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   524
goal thy
2103
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   525
 "!!evs. [| B ~: lost;  evs : ns_shared lost |]            \
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   526
\        ==> Key K ~: analz (sees lost Spy evs) -->             \
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   527
\            Says Server A (Crypt {|NA, Agent B, Key K, X|} (shrK A))  \
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   528
\            : set_of_list evs --> \
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   529
\            Crypt (Nonce NB) K : parts (sees lost Spy evs) -->            \
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   530
\            Says B A (Crypt (Nonce NB) K) : set_of_list evs";
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   531
by (etac ns_shared.induct 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   532
by (forward_tac [Says_S_message_form] 5 THEN assume_tac 5);     
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   533
by parts_Fake_tac;
2103
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   534
by (TRYALL (rtac impI));
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   535
by (REPEAT_FIRST
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   536
    (dtac (sees_subset_sees_Says RS analz_mono RS contra_subsetD)));
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   537
by (ALLGOALS (asm_simp_tac (!simpset addsimps [all_conj_distrib])));
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   538
(**LEVEL 6**)
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   539
by (fast_tac (!claset addSDs [Crypt_Fake_parts_insert]
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   540
                      addDs [impOfSubs analz_subset_parts]) 1);
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   541
by (Fast_tac 2);
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   542
by (REPEAT_FIRST (rtac impI ORELSE' etac conjE ORELSE' hyp_subst_tac));
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   543
(*Contradiction from the assumption   
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   544
   Crypt (Nonce NB) (newK evsa) : parts (sees lost Spy evsa) *)
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   545
bd Crypt_imp_invKey_keysFor 1;
2103
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   546
(**LEVEL 10**)
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   547
by (Asm_full_simp_tac 1);
2103
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   548
br disjI1 1;
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   549
by (thin_tac "?PP-->?QQ" 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   550
by (case_tac "Ba : lost" 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   551
by (dtac Says_Crypt_lost 1 THEN assume_tac 1 THEN Fast_tac 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   552
by (dtac (Says_imp_sees_Spy RS parts.Inj RS B_trust_NS3) 1 THEN 
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   553
    REPEAT (assume_tac 1));
2103
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   554
by (fast_tac (!claset addDs [unique_session_keys]) 1);
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   555
val lemma = result();
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   556
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   557
goal thy
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   558
 "!!evs. [| Crypt (Nonce NB) K : parts (sees lost Spy evs);            \
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   559
\           Says Server A (Crypt {|NA, Agent B, Key K, X|} (shrK A))  \
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   560
\           : set_of_list evs;            \
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   561
\           ALL NB. Says A Spy {|NA, NB, Key K|} ~: set_of_list evs;  \
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   562
\           A ~: lost;  B ~: lost;  evs : ns_shared lost |]            \
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   563
\        ==> Says B A (Crypt (Nonce NB) K) : set_of_list evs";
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   564
by (fast_tac (!claset addSIs [lemma RS mp RS mp RS mp]
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   565
		      addSEs [Spy_not_see_encrypted_key RSN (2, rev_notE)]) 1);
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   566
qed "A_trust_NS4";