src/HOL/Auth/NS_Shared.ML
author wenzelm
Tue, 06 May 1997 15:27:35 +0200
changeset 3118 24dae6222579
parent 2637 e9b203f854ae
child 3121 cbb6c0c1c58a
permissions -rw-r--r--
fixed ISABELLE_OUTPUT, ISABELLE_PATH (finally?);
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
2323
3ae9b0ccee21 Trivial renamings
paulson
parents: 2284
diff changeset
    19
(*A "possibility property": 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.          \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
    23
\               Says A B (Crypt K {|Nonce N, Nonce N|}) : set_of_list evs";
1997
6efba890341e No longer assumes Alice is not the Enemy in NS3.
paulson
parents: 1967
diff changeset
    24
by (REPEAT (resolve_tac [exI,bexI] 1));
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
    25
by (rtac (ns_shared.Nil RS ns_shared.NS1 RS ns_shared.NS2 RS 
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
    26
          ns_shared.NS3 RS ns_shared.NS4 RS ns_shared.NS5) 2);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
    27
by possibility_tac;
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
    28
result();
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
    29
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    30
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    31
(**** Inductive proofs about ns_shared ****)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    32
2103
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
    33
(*Monotonicity*)
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    34
goal thy "!!evs. lost' <= lost ==> ns_shared lost' <= ns_shared lost";
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    35
by (rtac subsetI 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    36
by (etac ns_shared.induct 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    37
by (REPEAT_FIRST
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    38
    (best_tac (!claset addIs (impOfSubs (sees_mono RS analz_mono RS synth_mono)
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    39
                              :: ns_shared.intrs))));
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    40
qed "ns_shared_mono";
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    41
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    42
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    43
(*Nobody sends themselves messages*)
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    44
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
    45
by (etac ns_shared.induct 1);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    46
by (Auto_tac());
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    47
qed_spec_mp "not_Says_to_self";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    48
Addsimps [not_Says_to_self];
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    49
AddSEs   [not_Says_to_self RSN (2, rev_notE)];
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    50
1943
20574dca5a3e Renaming and simplification
paulson
parents: 1934
diff changeset
    51
(*For reasoning about the encrypted portion of message NS3*)
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
    52
goal thy "!!evs. Says S A (Crypt KA {|N, B, K, X|}) : set_of_list evs \
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
    53
\                ==> X : parts (sees lost Spy evs)";
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
    54
by (fast_tac (!claset addSEs sees_Spy_partsEs) 1);
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    55
qed "NS3_msg_in_parts_sees_Spy";
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    56
                              
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    57
goal thy
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
    58
    "!!evs. Says Server A (Crypt (shrK A) {|NA, B, K, X|}) : set_of_list evs \
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
    59
\           ==> K : parts (sees lost Spy evs)";
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
    60
by (fast_tac (!claset addSEs sees_Spy_partsEs) 1);
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
    61
qed "Oops_parts_sees_Spy";
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    62
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    63
val parts_Fake_tac = 
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    64
    dres_inst_tac [("lost","lost")] NS3_msg_in_parts_sees_Spy 5 THEN
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
    65
    forw_inst_tac [("lost","lost")] Oops_parts_sees_Spy 8;
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    66
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    67
(*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
    68
fun parts_induct_tac i = SELECT_GOAL
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    69
    (DETERM (etac ns_shared.induct 1 THEN parts_Fake_tac THEN
2170
c5e460f1ebb4 Ran expandshort
paulson
parents: 2165
diff changeset
    70
             (*Fake message*)
c5e460f1ebb4 Ran expandshort
paulson
parents: 2165
diff changeset
    71
             TRY (best_tac (!claset addDs [impOfSubs analz_subset_parts,
c5e460f1ebb4 Ran expandshort
paulson
parents: 2165
diff changeset
    72
                                           impOfSubs Fake_parts_insert]
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    73
                                    addss (!simpset)) 2)) THEN
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    74
     (*Base case*)
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    75
     fast_tac (!claset addss (!simpset)) 1 THEN
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    76
     ALLGOALS Asm_simp_tac) i;
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    77
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    78
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
    79
(** 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
    80
    sends messages containing X! **)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    81
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
    82
(*Spy never sees another agent's shared key! (unless it's lost at start)*)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    83
goal thy 
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
    84
 "!!evs. evs : ns_shared lost \
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
    85
\        ==> (Key (shrK A) : parts (sees lost Spy evs)) = (A : lost)";
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
    86
by (parts_induct_tac 1);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    87
by (Auto_tac());
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
    88
qed "Spy_see_shrK";
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
    89
Addsimps [Spy_see_shrK];
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    90
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
    91
goal thy 
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
    92
 "!!evs. evs : ns_shared lost \
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
    93
\        ==> (Key (shrK A) : analz (sees lost Spy evs)) = (A : lost)";
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
    94
by (auto_tac(!claset addDs [impOfSubs analz_subset_parts], !simpset));
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
    95
qed "Spy_analz_shrK";
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
    96
Addsimps [Spy_analz_shrK];
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    97
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
    98
goal thy  "!!A. [| Key (shrK A) : parts (sees lost Spy evs);       \
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
    99
\                  evs : ns_shared lost |] ==> A:lost";
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
   100
by (fast_tac (!claset addDs [Spy_see_shrK]) 1);
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
   101
qed "Spy_see_shrK_D";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   102
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
   103
bind_thm ("Spy_analz_shrK_D", analz_subset_parts RS subsetD RS Spy_see_shrK_D);
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
   104
AddSDs [Spy_see_shrK_D, Spy_analz_shrK_D];
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   105
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   106
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   107
(*Nobody can have used non-existent keys!*)
2160
ad4382e546fc Simplified new_keys_not_seen, etc.: replaced the
paulson
parents: 2131
diff changeset
   108
goal thy "!!evs. evs : ns_shared lost ==>      \
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   109
\         Key K ~: used evs --> K ~: keysFor (parts (sees lost Spy evs))";
2160
ad4382e546fc Simplified new_keys_not_seen, etc.: replaced the
paulson
parents: 2131
diff changeset
   110
by (parts_induct_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   111
(*Fake*)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   112
by (best_tac
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   113
      (!claset addIs [impOfSubs analz_subset_parts]
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   114
               addDs [impOfSubs (analz_subset_parts RS keysFor_mono),
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   115
                      impOfSubs (parts_insert_subset_Un RS keysFor_mono)]
2637
e9b203f854ae reflecting my recent changes of the simplifier and classical reasoner
oheimb
parents: 2558
diff changeset
   116
               unsafe_addss (!simpset)) 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   117
(*NS2, NS4, NS5*)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   118
by (REPEAT (fast_tac (!claset addSEs sees_Spy_partsEs addss (!simpset)) 1));
2160
ad4382e546fc Simplified new_keys_not_seen, etc.: replaced the
paulson
parents: 2131
diff changeset
   119
qed_spec_mp "new_keys_not_used";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   120
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   121
bind_thm ("new_keys_not_analzd",
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   122
          [analz_subset_parts RS keysFor_mono,
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   123
           new_keys_not_used] MRS contra_subsetD);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   124
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   125
Addsimps [new_keys_not_used, new_keys_not_analzd];
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   126
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   127
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   128
(** Lemmas concerning the form of items passed in messages **)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   129
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   130
(*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
   131
goal thy 
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   132
 "!!evs. [| Says Server A (Crypt K' {|N, Agent B, Key K, X|}) \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   133
\             : set_of_list evs;                              \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   134
\           evs : ns_shared lost |]                           \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   135
\        ==> K ~: range shrK &                                \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   136
\            X = (Crypt (shrK B) {|Key K, Agent A|}) &        \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   137
\            K' = shrK A";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   138
by (etac rev_mp 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   139
by (etac ns_shared.induct 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   140
by (Auto_tac());
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   141
qed "Says_Server_message_form";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   142
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   143
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   144
(*If the encrypted message appears then it originated with the Server*)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   145
goal thy
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   146
 "!!evs. [| Crypt (shrK A) {|NA, Agent B, Key K, X|}                   \
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   147
\            : parts (sees lost Spy evs);                              \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   148
\           A ~: lost;  evs : ns_shared lost |]                        \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   149
\         ==> X = (Crypt (shrK B) {|Key K, Agent A|}) &                \
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   150
\             Says Server A                                            \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   151
\              (Crypt (shrK A) {|NA, Agent B, Key K,                   \
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   152
\                                Crypt (shrK B) {|Key K, Agent A|}|})  \
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   153
\             : set_of_list evs";
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   154
by (etac rev_mp 1);
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
   155
by (parts_induct_tac 1);
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   156
by (Auto_tac());
2323
3ae9b0ccee21 Trivial renamings
paulson
parents: 2284
diff changeset
   157
qed "A_trusts_NS2";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   158
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   159
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   160
(*EITHER describes the form of X when the following message is sent, 
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   161
  OR     reduces it to the Fake case.
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   162
  Use Says_Server_message_form if applicable.*)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   163
goal thy 
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   164
 "!!evs. [| Says S A (Crypt (shrK A) {|Nonce NA, Agent B, Key K, X|})      \
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   165
\            : set_of_list evs;  evs : ns_shared lost |]                   \
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   166
\        ==> (K ~: range shrK & X = (Crypt (shrK B) {|Key K, Agent A|}))  \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   167
\            | X : analz (sees lost Spy evs)";
2103
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   168
by (case_tac "A : lost" 1);
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   169
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]
2637
e9b203f854ae reflecting my recent changes of the simplifier and classical reasoner
oheimb
parents: 2558
diff changeset
   170
                      unsafe_addss (!simpset)) 1);
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   171
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
   172
by (fast_tac (!claset addEs  partsEs
2323
3ae9b0ccee21 Trivial renamings
paulson
parents: 2284
diff changeset
   173
                      addSDs [A_trusts_NS2, Says_Server_message_form]
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   174
                      addss (!simpset)) 1);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   175
qed "Says_S_message_form";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   176
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   177
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
   178
(*For proofs involving analz.  We again instantiate the variable to "lost".*)
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
   179
val analz_Fake_tac = 
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
   180
    forw_inst_tac [("lost","lost")] Says_Server_message_form 8 THEN
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
   181
    forw_inst_tac [("lost","lost")] Says_S_message_form 5 THEN 
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   182
    REPEAT_FIRST (eresolve_tac [asm_rl, conjE, disjE] ORELSE' hyp_subst_tac);
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
   183
1934
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
(****
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   186
 The following is to prove theorems of the form
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   187
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   188
  Key K : analz (insert (Key KAB) (sees lost Spy evs)) ==>
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2374
diff changeset
   189
  Key K : analz (sees lost Spy evs)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   190
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   191
 A more general formula must be proved inductively.
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   192
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   193
****)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   194
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   195
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   196
(*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
   197
  to encrypt messages containing other keys, in the actual protocol.
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   198
  We require that agents should behave like this subsequently also.*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   199
goal thy 
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   200
 "!!evs. [| evs : ns_shared lost;  Kab ~: range shrK |] ==> \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   201
\        (Crypt KAB X) : parts (sees lost Spy evs) & \
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   202
\        Key K : parts {X} --> Key K : parts (sees lost Spy evs)";
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   203
by (etac ns_shared.induct 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   204
by parts_Fake_tac;
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   205
by (ALLGOALS Asm_simp_tac);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   206
(*Deals with Faked messages*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   207
by (best_tac (!claset addSEs partsEs
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   208
                      addDs [impOfSubs parts_insert_subset_Un]
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   209
                      addss (!simpset)) 2);
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   210
(*Base, NS4 and NS5*)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   211
by (ALLGOALS (fast_tac (!claset addss (!simpset))));
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   212
result();
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   213
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   214
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   215
(** Session keys are not used to encrypt other session keys **)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   216
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   217
(*The equality makes the induction hypothesis easier to apply*)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   218
goal thy  
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   219
 "!!evs. evs : ns_shared lost ==> \
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   220
\  ALL K KK. KK <= Compl (range shrK) -->                      \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   221
\            (Key K : analz (Key``KK Un (sees lost Spy evs))) = \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   222
\            (K : KK | Key K : analz (sees lost Spy evs))";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   223
by (etac ns_shared.induct 1);
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
   224
by analz_Fake_tac;
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   225
by (REPEAT_FIRST (resolve_tac [allI, impI]));
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   226
by (REPEAT_FIRST (rtac analz_image_freshK_lemma ));
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   227
(*Takes 24 secs*)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   228
by (ALLGOALS (asm_simp_tac analz_image_freshK_ss));
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2374
diff changeset
   229
(*NS4, Fake*) 
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   230
by (EVERY (map spy_analz_tac [3,2]));
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   231
(*Base*)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   232
by (fast_tac (!claset addIs [image_eqI] addss (!simpset)) 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   233
qed_spec_mp "analz_image_freshK";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   234
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   235
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   236
goal thy
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   237
 "!!evs. [| evs : ns_shared lost;  KAB ~: range shrK |] ==>     \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   238
\        Key K : analz (insert (Key KAB) (sees lost Spy evs)) = \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   239
\        (K = KAB | Key K : analz (sees lost Spy evs))";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   240
by (asm_simp_tac (analz_image_freshK_ss addsimps [analz_image_freshK]) 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   241
qed "analz_insert_freshK";
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   242
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   243
2558
6e8d130463e3 Corrected faulty comment
paulson
parents: 2529
diff changeset
   244
(** The session key K uniquely identifies the message **)
1965
789c12ea0b30 Stronger proofs; work for Otway-Rees
paulson
parents: 1943
diff changeset
   245
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   246
goal thy 
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2374
diff changeset
   247
 "!!evs. evs : ns_shared lost ==>                                        \
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2374
diff changeset
   248
\      EX A' NA' B' X'. ALL A NA B X.                                    \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   249
\       Says Server A (Crypt (shrK A) {|NA, Agent B, Key K, X|})         \
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   250
\       : set_of_list evs --> A=A' & NA=NA' & B=B' & X=X'";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   251
by (etac ns_shared.induct 1);
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   252
by (ALLGOALS (asm_simp_tac (!simpset addsimps [all_conj_distrib])));
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
   253
by (Step_tac 1);
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   254
(*NS3*)
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   255
by (ex_strip_tac 2);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   256
by (Fast_tac 2);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   257
(*NS2: it can't be a new key*)
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   258
by (expand_case_tac "K = ?y" 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   259
by (REPEAT (ares_tac [refl,exI,impI,conjI] 2));
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   260
by (fast_tac (!claset delrules [conjI]    (*prevent split-up into 4 subgoals*)
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   261
                      addSEs sees_Spy_partsEs
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   262
                      addss (!simpset addsimps [parts_insertI])) 1);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   263
val lemma = result();
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   264
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   265
(*In messages of this form, the session key uniquely identifies the rest*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   266
goal thy 
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   267
 "!!evs. [| Says Server A                                    \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   268
\             (Crypt (shrK A) {|NA, Agent B, Key K, X|})     \
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   269
\                  : set_of_list evs;                        \ 
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   270
\           Says Server A'                                   \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   271
\             (Crypt (shrK A') {|NA', Agent B', Key K, X'|}) \
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   272
\                  : set_of_list evs;                        \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   273
\           evs : ns_shared lost |] ==> A=A' & NA=NA' & B=B' & X = X'";
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2374
diff changeset
   274
by (prove_unique_tac lemma 1);
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   275
qed "unique_session_keys";
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   276
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   277
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   278
(** 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
   279
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   280
goal thy 
2323
3ae9b0ccee21 Trivial renamings
paulson
parents: 2284
diff changeset
   281
 "!!evs. [| A ~: lost;  B ~: lost;  evs : ns_shared lost |]            \
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   282
\        ==> Says Server A                                             \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   283
\              (Crypt (shrK A) {|NA, Agent B, Key K,                   \
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   284
\                                Crypt (shrK B) {|Key K, Agent A|}|})  \
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   285
\             : set_of_list evs -->                                    \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   286
\        (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
   287
\        Key K ~: analz (sees lost Spy evs)";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   288
by (etac ns_shared.induct 1);
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
   289
by analz_Fake_tac;
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   290
by (ALLGOALS 
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   291
    (asm_simp_tac 
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   292
     (!simpset addsimps ([not_parts_not_analz, analz_insert_freshK] @ pushes)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   293
               setloop split_tac [expand_if])));
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   294
(*NS4, Fake*) 
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   295
by (EVERY (map spy_analz_tac [4,1]));
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   296
(*NS2*)
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   297
by (fast_tac (!claset addSEs sees_Spy_partsEs
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   298
                      addIs [parts_insertI, impOfSubs analz_subset_parts]
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   299
                      addss (!simpset)) 1);
2529
e40ca839758d Simplified Oops case of main theorem
paulson
parents: 2516
diff changeset
   300
(*Oops*)
e40ca839758d Simplified Oops case of main theorem
paulson
parents: 2516
diff changeset
   301
by (fast_tac (!claset addDs [unique_session_keys] addss (!simpset)) 2);
e40ca839758d Simplified Oops case of main theorem
paulson
parents: 2516
diff changeset
   302
(*NS3*) (**LEVEL 6 **)
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   303
by (step_tac (!claset delrules [impCE]) 1);
2323
3ae9b0ccee21 Trivial renamings
paulson
parents: 2284
diff changeset
   304
by (forward_tac [Says_imp_sees_Spy RS parts.Inj RS A_trusts_NS2] 1);
2170
c5e460f1ebb4 Ran expandshort
paulson
parents: 2165
diff changeset
   305
by (assume_tac 2);
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   306
by (fast_tac (!claset addSEs [Says_Crypt_not_lost]) 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   307
by (fast_tac (!claset addDs [unique_session_keys] addss (!simpset)) 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   308
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
   309
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   310
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   311
(*Final version: Server's message in the most abstract form*)
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   312
goal thy 
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   313
 "!!evs. [| Says Server A                                               \
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   314
\            (Crypt K' {|NA, Agent B, Key K, X|}) : set_of_list evs;    \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   315
\           (ALL NB. Says A Spy {|NA, NB, Key K|} ~: set_of_list evs);  \
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   316
\           A ~: lost;  B ~: lost;  evs : ns_shared lost                \
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   317
\        |] ==> Key K ~: analz (sees lost Spy evs)";
2015
d4a8fd8a8065 Simplification of proof of unique_session_keys
paulson
parents: 1999
diff changeset
   318
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
   319
by (fast_tac (!claset addSEs [lemma]) 1);
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   320
qed "Spy_not_see_encrypted_key";
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   321
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   322
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   323
goal thy 
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   324
 "!!evs. [| C ~: {A,B,Server};                                          \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   325
\           Says Server A                                               \
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   326
\            (Crypt K' {|NA, Agent B, Key K, X|}) : set_of_list evs;    \
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   327
\           (ALL NB. Says A Spy {|NA, NB, Key K|} ~: set_of_list evs);  \
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   328
\           A ~: lost;  B ~: lost;  evs : ns_shared lost |]             \
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   329
\        ==> Key K ~: analz (sees lost C evs)";
2032
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   330
by (rtac (subset_insertI RS sees_mono RS analz_mono RS contra_subsetD) 1);
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   331
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
   332
by (FIRSTGOAL (rtac Spy_not_see_encrypted_key));
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   333
by (REPEAT_FIRST (fast_tac (!claset addIs [ns_shared_mono RS subsetD])));
1bbf1bdcaf56 Introduction of "lost" argument
paulson
parents: 2027
diff changeset
   334
qed "Agent_not_see_encrypted_key";
2070
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
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   337
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   338
(**** Guarantees available at various stages of protocol ***)
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   339
2323
3ae9b0ccee21 Trivial renamings
paulson
parents: 2284
diff changeset
   340
A_trusts_NS2 RS conjunct2 RS Spy_not_see_encrypted_key;
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   341
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   342
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   343
(*If the encrypted message appears then it originated with the Server*)
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   344
goal thy
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   345
 "!!evs. [| Crypt (shrK B) {|Key K, Agent A|} : parts (sees lost Spy evs); \
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   346
\           B ~: lost;  evs : ns_shared lost |]                        \
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   347
\         ==> EX NA. Says Server A                                     \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   348
\              (Crypt (shrK A) {|NA, Agent B, Key K,                   \
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   349
\                                Crypt (shrK B) {|Key K, Agent A|}|})  \
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   350
\             : set_of_list evs";
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   351
by (etac rev_mp 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   352
by (etac ns_shared.induct 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   353
by parts_Fake_tac;
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   354
(*Fake case*)
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   355
by (best_tac (!claset addSDs [impOfSubs Fake_parts_insert]
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   356
                      addDs  [impOfSubs analz_subset_parts]
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   357
                      addss  (!simpset)) 2);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   358
by (Auto_tac());
2323
3ae9b0ccee21 Trivial renamings
paulson
parents: 2284
diff changeset
   359
qed "B_trusts_NS3";
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   360
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   361
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   362
goal thy
2103
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   363
 "!!evs. [| B ~: lost;  evs : ns_shared lost |]            \
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   364
\        ==> Key K ~: analz (sees lost Spy evs) -->             \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   365
\            Says Server A (Crypt (shrK A) {|NA, Agent B, Key K, X|})  \
2103
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   366
\            : set_of_list evs --> \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   367
\            Crypt K (Nonce NB) : parts (sees lost Spy evs) -->            \
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   368
\            Says B A (Crypt K (Nonce NB)) : set_of_list evs";
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   369
by (etac ns_shared.induct 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   370
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
   371
by parts_Fake_tac;
2103
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   372
by (TRYALL (rtac impI));
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   373
by (REPEAT_FIRST
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   374
    (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
   375
by (ALLGOALS (asm_simp_tac (!simpset addsimps [all_conj_distrib])));
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   376
(**LEVEL 6**)
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   377
by (fast_tac (!claset addSDs [Crypt_Fake_parts_insert]
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   378
                      addDs [impOfSubs analz_subset_parts]) 1);
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   379
by (Fast_tac 2);
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   380
by (REPEAT_FIRST (rtac impI ORELSE' etac conjE ORELSE' hyp_subst_tac));
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   381
(*Subgoal 1: contradiction from the assumptions  
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   382
  Key K ~: used evsa  and Crypt K (Nonce NB) : parts (sees lost Spy evsa) *)
2170
c5e460f1ebb4 Ran expandshort
paulson
parents: 2165
diff changeset
   383
by (dtac Crypt_imp_invKey_keysFor 1);
2103
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   384
(**LEVEL 10**)
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   385
by (Asm_full_simp_tac 1);
2170
c5e460f1ebb4 Ran expandshort
paulson
parents: 2165
diff changeset
   386
by (rtac disjI1 1);
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   387
by (thin_tac "?PP-->?QQ" 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   388
by (case_tac "Ba : lost" 1);
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   389
by (dtac Says_Crypt_lost 1 THEN assume_tac 1 THEN Fast_tac 1);
2323
3ae9b0ccee21 Trivial renamings
paulson
parents: 2284
diff changeset
   390
by (dtac (Says_imp_sees_Spy RS parts.Inj RS B_trusts_NS3) 1 THEN 
2070
84f4572a6b20 New guarantees for each line of protocol
paulson
parents: 2050
diff changeset
   391
    REPEAT (assume_tac 1));
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2451
diff changeset
   392
by (best_tac (!claset addDs [unique_session_keys]) 1);
2103
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   393
val lemma = result();
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   394
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   395
goal thy
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   396
 "!!evs. [| Crypt K (Nonce NB) : parts (sees lost Spy evs);           \
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   397
\           Says Server A (Crypt (shrK A) {|NA, Agent B, Key K, X|})  \
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
   398
\           : set_of_list evs;                                        \
2103
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   399
\           ALL NB. Says A Spy {|NA, NB, Key K|} ~: set_of_list evs;  \
2131
3106a99d30a5 Changing from the Reveal to the Oops rule
paulson
parents: 2122
diff changeset
   400
\           A ~: lost;  B ~: lost;  evs : ns_shared lost |]           \
2284
80ebd1a213fd Swapped arguments of Crypt (for clarity and because it is conventional)
paulson
parents: 2264
diff changeset
   401
\        ==> Says B A (Crypt K (Nonce NB)) : set_of_list evs";
2103
bfd2e8cca89c Tidied up the proof of A_trust_NS4
paulson
parents: 2070
diff changeset
   402
by (fast_tac (!claset addSIs [lemma RS mp RS mp RS mp]
2170
c5e460f1ebb4 Ran expandshort
paulson
parents: 2165
diff changeset
   403
                      addSEs [Spy_not_see_encrypted_key RSN (2, rev_notE)]) 1);
2323
3ae9b0ccee21 Trivial renamings
paulson
parents: 2284
diff changeset
   404
qed "A_trusts_NS4";