src/HOL/Auth/Recur.ML
author paulson
Thu, 19 Dec 1996 11:58:39 +0100
changeset 2451 ce85a2aafc7a
parent 2449 d30ad12b1397
child 2455 9c4444bfd44e
permissions -rw-r--r--
Extensive tidying and simplification, largely stemming from changing newN and newK to take an integer argument
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
     1
(*  Title:      HOL/Auth/Recur
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
     2
    ID:         $Id$
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
     4
    Copyright   1996  University of Cambridge
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
     5
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
     6
Inductive relation "recur" for the Recursive Authentication protocol.
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
     7
*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
     8
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
     9
open Recur;
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    10
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    11
proof_timing:=true;
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    12
HOL_quantifiers := false;
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    13
Pretty.setdepth 25;
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    14
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    15
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    16
(** Possibility properties: traces that reach the end 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    17
	ONE theorem would be more elegant and faster!
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    18
	By induction on a list of agents (no repetitions)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    19
**)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    20
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    21
(*Simplest case: Alice goes directly to the server*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    22
goal thy 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    23
 "!!A. A ~= Server   \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    24
\ ==> EX K NA. EX evs: recur lost.          \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    25
\     Says Server A {|Agent A,              \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    26
\                     Crypt (shrK A) {|Key K, Agent Server, Nonce NA|}, \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    27
\                       Agent Server|}      \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    28
\         : set_of_list evs";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    29
by (REPEAT (resolve_tac [exI,bexI] 1));
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
    30
by (rtac (recur.Nil RS recur.RA1 RS 
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
    31
	  (respond.One RSN (4,recur.RA3))) 2);
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    32
by (ALLGOALS (simp_tac (!simpset setsolver safe_solver)));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    33
by (REPEAT_FIRST (eq_assume_tac ORELSE' resolve_tac [refl, conjI]));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    34
result();
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    35
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    36
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    37
(*Case two: Alice, Bob and the server*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    38
goal thy 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    39
 "!!A B. [| A ~= B; A ~= Server; B ~= Server |]   \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    40
\ ==> EX K. EX NA. EX evs: recur lost.          \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    41
\       Says B A {|Agent A, Crypt (shrK A) {|Key K, Agent B, Nonce NA|}, \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    42
\                       Agent Server|}                          \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    43
\         : set_of_list evs";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    44
by (REPEAT (resolve_tac [exI,bexI] 1));
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
    45
by (rtac (recur.Nil RS recur.RA1 RS recur.RA2 RS 
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
    46
	  (respond.One RS respond.Cons RSN (4,recur.RA3)) RS
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
    47
	  recur.RA4) 2);
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    48
by (REPEAT
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    49
    (REPEAT_FIRST (eq_assume_tac ORELSE' resolve_tac [refl, conjI])
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    50
     THEN
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    51
     ALLGOALS (asm_simp_tac (!simpset setsolver safe_solver))));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    52
result();
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    53
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    54
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    55
(*Case three: Alice, Bob, Charlie and the server*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    56
goal thy 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    57
 "!!A B. [| A ~= B; A ~= Server; B ~= Server |]   \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    58
\ ==> EX K. EX NA. EX evs: recur lost.          \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    59
\       Says B A {|Agent A, Crypt (shrK A) {|Key K, Agent B, Nonce NA|}, \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    60
\                       Agent Server|}                          \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    61
\         : set_of_list evs";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    62
by (REPEAT (resolve_tac [exI,bexI] 1));
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
    63
by (rtac (recur.Nil RS recur.RA1 RS recur.RA2 RS recur.RA2 RS 
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    64
	  (respond.One RS respond.Cons RS respond.Cons RSN
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
    65
	   (4,recur.RA3)) RS recur.RA4 RS recur.RA4) 2);
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    66
by (REPEAT	(*SLOW: 37 seconds*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    67
    (REPEAT_FIRST (eq_assume_tac ORELSE' resolve_tac [refl, conjI])
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    68
     THEN
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    69
     ALLGOALS (asm_simp_tac (!simpset setsolver safe_solver))));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    70
by (ALLGOALS 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    71
    (SELECT_GOAL (DEPTH_SOLVE
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    72
		  (swap_res_tac [refl, conjI, disjI1, disjI2] 1 APPEND 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    73
		   etac not_sym 1))));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    74
result();
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    75
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    76
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    77
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    78
(**** Inductive proofs about recur ****)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    79
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    80
(*Monotonicity*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    81
goal thy "!!evs. lost' <= lost ==> recur lost' <= recur lost";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    82
by (rtac subsetI 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    83
by (etac recur.induct 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    84
by (REPEAT_FIRST
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    85
    (best_tac (!claset addIs (impOfSubs (sees_mono RS analz_mono RS synth_mono)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    86
                              :: recur.intrs))));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    87
qed "recur_mono";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    88
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    89
(*Nobody sends themselves messages*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    90
goal thy "!!evs. evs : recur lost ==> ALL A X. Says A A X ~: set_of_list evs";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    91
by (etac recur.induct 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    92
by (Auto_tac());
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    93
qed_spec_mp "not_Says_to_self";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    94
Addsimps [not_Says_to_self];
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    95
AddSEs   [not_Says_to_self RSN (2, rev_notE)];
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    96
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    97
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    98
(*Simple inductive reasoning about responses*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    99
goal thy "!!j. (j,PA,RB) : respond i ==> RB : responses i";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   100
by (etac respond.induct 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   101
by (REPEAT (ares_tac responses.intrs 1));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   102
qed "respond_imp_responses";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   103
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   104
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   105
(** For reasoning about the encrypted portion of messages **)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   106
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   107
val RA2_analz_sees_Spy = Says_imp_sees_Spy RS analz.Inj |> standard;
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   108
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   109
goal thy "!!evs. Says C' B {|Agent B, X, Agent B, X', RA|} : set_of_list evs \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   110
\                ==> RA : analz (sees lost Spy evs)";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   111
by (fast_tac (!claset addSDs [Says_imp_sees_Spy RS analz.Inj]) 1);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   112
qed "RA4_analz_sees_Spy";
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   113
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   114
(*RA2_analz... and RA4_analz... let us treat those cases using the same 
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   115
  argument as for the Fake case.  This is possible for most, but not all,
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   116
  proofs: Fake does not invent new nonces (as in RA2), and of course Fake
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   117
  messages originate from the Spy. *)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   118
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   119
bind_thm ("RA2_parts_sees_Spy",
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   120
          RA2_analz_sees_Spy RS (impOfSubs analz_subset_parts));
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   121
bind_thm ("RA4_parts_sees_Spy",
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   122
          RA4_analz_sees_Spy RS (impOfSubs analz_subset_parts));
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   123
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   124
(*We instantiate the variable to "lost".  Leaving it as a Var makes proofs
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   125
  harder to complete, since simplification does less for us.*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   126
val parts_Fake_tac = 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   127
    let val tac = forw_inst_tac [("lost","lost")] 
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   128
    in  tac RA2_parts_sees_Spy 4              THEN
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   129
	forward_tac [respond_imp_responses] 5 THEN
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   130
	tac RA4_parts_sees_Spy 6
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   131
    end;
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   132
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   133
(*For proving the easier theorems about X ~: parts (sees lost Spy evs) *)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   134
fun parts_induct_tac i = SELECT_GOAL
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   135
    (DETERM (etac recur.induct 1 THEN parts_Fake_tac THEN
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   136
             (*Fake message*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   137
             TRY (best_tac (!claset addDs [impOfSubs analz_subset_parts,
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   138
                                           impOfSubs Fake_parts_insert]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   139
                                    addss (!simpset)) 2)) THEN
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   140
     (*Base case*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   141
     fast_tac (!claset addss (!simpset)) 1 THEN
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   142
     ALLGOALS Asm_simp_tac) i;
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   143
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   144
(** Theorems of the form X ~: parts (sees lost Spy evs) imply that NOBODY
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   145
    sends messages containing X! **)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   146
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   147
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   148
(** Spy never sees another agent's long-term key (unless initially lost) **)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   149
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   150
goal thy 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   151
 "!!evs. (j,PB,RB) : respond i \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   152
\  ==> Key K : parts {RB} --> (EX j'. K = newK2(i,j') & j<=j')";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   153
be respond.induct 1;
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   154
by (Auto_tac());
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   155
by (best_tac (!claset addDs [Suc_leD]) 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   156
qed_spec_mp "Key_in_parts_respond";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   157
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   158
goal thy 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   159
 "!!evs. evs : recur lost \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   160
\        ==> (Key (shrK A) : parts (sees lost Spy evs)) = (A : lost)";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   161
by (parts_induct_tac 1);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   162
(*RA2*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   163
by (best_tac (!claset addSEs partsEs addSDs [parts_cut]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   164
                      addss (!simpset)) 1);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   165
(*RA3*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   166
by (fast_tac (!claset addDs [Key_in_parts_respond]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   167
                      addss (!simpset addsimps [parts_insert_sees])) 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   168
qed "Spy_see_shrK";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   169
Addsimps [Spy_see_shrK];
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   170
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   171
goal thy 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   172
 "!!evs. evs : recur lost \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   173
\        ==> (Key (shrK A) : analz (sees lost Spy evs)) = (A : lost)";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   174
by (auto_tac(!claset addDs [impOfSubs analz_subset_parts], !simpset));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   175
qed "Spy_analz_shrK";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   176
Addsimps [Spy_analz_shrK];
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   177
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   178
goal thy  "!!A. [| Key (shrK A) : parts (sees lost Spy evs);       \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   179
\                  evs : recur lost |] ==> A:lost";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   180
by (fast_tac (!claset addDs [Spy_see_shrK]) 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   181
qed "Spy_see_shrK_D";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   182
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   183
bind_thm ("Spy_analz_shrK_D", analz_subset_parts RS subsetD RS Spy_see_shrK_D);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   184
AddSDs [Spy_see_shrK_D, Spy_analz_shrK_D];
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   185
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   186
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   187
(*** Future keys can't be seen or used! ***)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   188
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   189
(*Nobody can have SEEN keys that will be generated in the future. *)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   190
goal thy "!!evs. evs : recur lost ==> \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   191
\                length evs <= i -->   \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   192
\                Key (newK2(i,j)) ~: parts (sees lost Spy evs)";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   193
by (parts_induct_tac 1);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   194
(*RA2*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   195
by (best_tac (!claset addSEs partsEs 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   196
	              addSDs [parts_cut]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   197
                      addDs  [Suc_leD]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   198
                      addss  (!simpset addsimps [parts_insert2])) 3);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   199
(*Fake*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   200
by (best_tac (!claset addDs [impOfSubs analz_subset_parts,
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   201
			     impOfSubs parts_insert_subset_Un,
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   202
			     Suc_leD]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   203
		      addss (!simpset)) 1);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   204
(*For RA3*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   205
by (asm_simp_tac (!simpset addsimps [parts_insert_sees]) 2);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   206
(*RA1-RA4*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   207
by (REPEAT (best_tac (!claset addDs [Key_in_parts_respond, Suc_leD]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   208
		              addss (!simpset)) 1));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   209
qed_spec_mp "new_keys_not_seen";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   210
Addsimps [new_keys_not_seen];
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   211
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   212
(*Variant: old messages must contain old keys!*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   213
goal thy 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   214
 "!!evs. [| Says A B X : set_of_list evs;     \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   215
\           Key (newK2(i,j)) : parts {X};     \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   216
\           evs : recur lost                 \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   217
\        |] ==> i < length evs";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   218
by (rtac ccontr 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   219
by (dtac leI 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   220
by (fast_tac (!claset addSDs [new_keys_not_seen, Says_imp_sees_Spy]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   221
                      addIs  [impOfSubs parts_mono]) 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   222
qed "Says_imp_old_keys";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   223
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   224
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   225
(*** Future nonces can't be seen or used! ***)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   226
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   227
goal thy 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   228
 "!!evs. (j, PB, RB) : respond i \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   229
\        ==> Nonce N : parts {RB} --> Nonce N : parts {PB}";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   230
be respond.induct 1;
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   231
by (Auto_tac());
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   232
qed_spec_mp "Nonce_in_parts_respond";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   233
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   234
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   235
goal thy "!!i. evs : recur lost ==> \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   236
\              length evs <= i --> Nonce(newN i) ~: parts (sees lost Spy evs)";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   237
by (parts_induct_tac 1);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   238
(*For RA3*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   239
by (asm_simp_tac (!simpset addsimps [parts_insert_sees]) 4);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   240
by (deepen_tac (!claset addSDs [Says_imp_sees_Spy RS parts.Inj]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   241
                        addDs  [Nonce_in_parts_respond, parts_cut, Suc_leD]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   242
			addss (!simpset)) 0 4);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   243
(*Fake*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   244
by (fast_tac (!claset addDs  [impOfSubs analz_subset_parts,
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   245
			      impOfSubs parts_insert_subset_Un,
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   246
			      Suc_leD]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   247
		      addss (!simpset)) 1);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   248
(*RA1, RA2, RA4*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   249
by (REPEAT_FIRST  (fast_tac (!claset 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   250
                              addSEs partsEs
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   251
                              addEs [leD RS notE]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   252
                              addDs [Suc_leD]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   253
                              addss (!simpset))));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   254
qed_spec_mp "new_nonces_not_seen";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   255
Addsimps [new_nonces_not_seen];
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   256
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   257
(*Variant: old messages must contain old nonces!*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   258
goal thy "!!evs. [| Says A B X : set_of_list evs;    \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   259
\                   Nonce (newN i) : parts {X};      \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   260
\                   evs : recur lost                 \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   261
\                |] ==> i < length evs";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   262
by (rtac ccontr 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   263
by (dtac leI 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   264
by (fast_tac (!claset addSDs [new_nonces_not_seen, Says_imp_sees_Spy]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   265
                      addIs  [impOfSubs parts_mono]) 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   266
qed "Says_imp_old_nonces";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   267
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   268
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   269
(** Nobody can have USED keys that will be generated in the future. **)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   270
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   271
goal thy
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   272
 "!!evs. (j,PB,RB) : respond i \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   273
\        ==> K : keysFor (parts {RB}) --> (EX A. K = shrK A)";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   274
be (respond_imp_responses RS responses.induct) 1;
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   275
by (Auto_tac());
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   276
qed_spec_mp "Key_in_keysFor_parts_respond";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   277
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   278
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   279
goal thy "!!i. evs : recur lost ==>          \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   280
\       length evs <= i --> newK2(i,j) ~: keysFor (parts (sees lost Spy evs))";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   281
by (parts_induct_tac 1);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   282
(*RA3*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   283
by (fast_tac (!claset addDs  [Key_in_keysFor_parts_respond, Suc_leD]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   284
		      addss  (!simpset addsimps [parts_insert_sees])) 4);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   285
(*RA2*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   286
by (fast_tac (!claset addSEs partsEs 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   287
	              addDs  [Suc_leD] addss (!simpset)) 3);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   288
(*Fake, RA1, RA4*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   289
by (REPEAT 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   290
    (best_tac
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   291
      (!claset addDs [impOfSubs (analz_subset_parts RS keysFor_mono),
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   292
                      impOfSubs (parts_insert_subset_Un RS keysFor_mono),
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   293
                      Suc_leD]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   294
               addEs [new_keys_not_seen RS not_parts_not_analz RSN(2,rev_notE)]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   295
               addss (!simpset)) 1));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   296
qed_spec_mp "new_keys_not_used";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   297
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   298
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   299
bind_thm ("new_keys_not_analzd",
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   300
          [analz_subset_parts RS keysFor_mono,
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   301
           new_keys_not_used] MRS contra_subsetD);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   302
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   303
Addsimps [new_keys_not_used, new_keys_not_analzd];
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   304
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   305
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   306
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   307
(*** Proofs involving analz ***)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   308
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   309
(*For proofs involving analz.  We again instantiate the variable to "lost".*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   310
val analz_Fake_tac = 
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   311
    dres_inst_tac [("lost","lost")] RA2_analz_sees_Spy 4 THEN 
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   312
    forward_tac [respond_imp_responses] 5                THEN
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   313
    dres_inst_tac [("lost","lost")] RA4_analz_sees_Spy 6;
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   314
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   315
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   316
(** Session keys are not used to encrypt other session keys **)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   317
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   318
(*Version for "responses" relation.  Handles case RA3 in the theorem below.  
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   319
  Note that it holds for *any* set H (not just "sees lost Spy evs")
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   320
  satisfying the inductive hypothesis.*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   321
goal thy  
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   322
 "!!evs. [| RB : responses i;                             \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   323
\           ALL K I. (Key K : analz (Key``(newK``I) Un H)) = \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   324
\           (K : newK``I | Key K : analz H) |]                \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   325
\       ==> ALL K I. (Key K : analz (insert RB (Key``(newK``I) Un H))) = \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   326
\           (K : newK``I | Key K : analz (insert RB H))";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   327
be responses.induct 1;
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   328
by (ALLGOALS
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   329
    (asm_simp_tac 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   330
     (!simpset addsimps [insert_Key_singleton, insert_Key_image, 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   331
			 Un_assoc RS sym, pushKey_newK]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   332
               setloop split_tac [expand_if])));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   333
by (fast_tac (!claset addIs [image_eqI] addss (!simpset)) 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   334
qed "resp_analz_image_newK_lemma";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   335
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   336
(*Version for the protocol.  Proof is almost trivial, thanks to the lemma.*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   337
goal thy  
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   338
 "!!evs. evs : recur lost ==>                                            \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   339
\  ALL K I. (Key K : analz (Key``(newK``I) Un (sees lost Spy evs))) = \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   340
\           (K : newK``I | Key K : analz (sees lost Spy evs))";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   341
by (etac recur.induct 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   342
by analz_Fake_tac;
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   343
be ssubst 4;	(*RA2: DELETE needless definition of PA!*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   344
by (REPEAT_FIRST (ares_tac [allI, analz_image_newK_lemma]));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   345
by (ALLGOALS (asm_simp_tac (!simpset addsimps [resp_analz_image_newK_lemma])));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   346
(*Base*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   347
by (fast_tac (!claset addIs [image_eqI] addss (!simpset)) 1);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   348
(*RA4, RA2, Fake*) 
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   349
by (REPEAT (spy_analz_tac 1));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   350
val raw_analz_image_newK = result();
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   351
qed_spec_mp "analz_image_newK";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   352
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   353
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   354
(*Instance of the lemma with H replaced by (sees lost Spy evs):
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   355
   [| RB : responses i;  evs : recur lost |]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   356
   ==> Key xa : analz (insert RB (Key``newK``x Un sees lost Spy evs)) =
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   357
       (xa : newK``x | Key xa : analz (insert RB (sees lost Spy evs))) 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   358
*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   359
bind_thm ("resp_analz_image_newK",
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   360
	  raw_analz_image_newK RSN
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   361
	    (2, resp_analz_image_newK_lemma) RS spec RS spec);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   362
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   363
goal thy
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   364
 "!!evs. evs : recur lost ==>                               \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   365
\        Key K : analz (insert (Key (newK x)) (sees lost Spy evs)) = \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   366
\        (K = newK x | Key K : analz (sees lost Spy evs))";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   367
by (asm_simp_tac (HOL_ss addsimps [pushKey_newK, analz_image_newK, 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   368
                                   insert_Key_singleton]) 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   369
by (Fast_tac 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   370
qed "analz_insert_Key_newK";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   371
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   372
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   373
(** Nonces cannot appear before their time, even hashed!
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   374
    One is tempted to add the rule
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   375
	"Hash X : parts H ==> X : parts H"
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   376
    but we'd then lose theorems like Spy_see_shrK
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   377
***)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   378
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   379
goal thy "!!i. evs : recur lost ==>              \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   380
\                length evs <= i -->             \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   381
\                (Nonce (newN i) : parts {X} --> \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   382
\                 Hash X ~: parts (sees lost Spy evs))";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   383
be recur.induct 1;
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   384
be ssubst 4;	(*RA2: DELETE needless definition of PA!*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   385
by parts_Fake_tac;
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   386
(*RA3 requires a further induction*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   387
be responses.induct 5;
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   388
by (ALLGOALS Asm_simp_tac);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   389
(*RA2*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   390
by (best_tac (!claset addDs  [Suc_leD, parts_cut]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   391
                      addEs  [leD RS notE,
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   392
			      new_nonces_not_seen RSN(2,rev_notE)]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   393
		      addss (!simpset)) 4);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   394
(*Fake*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   395
by (best_tac (!claset addSDs  [impOfSubs analz_subset_parts,
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   396
			      impOfSubs parts_insert_subset_Un,
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   397
			      Suc_leD]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   398
		      addss (!simpset)) 2);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   399
(*Five others!*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   400
by (REPEAT (fast_tac (!claset addEs [leD RS notE]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   401
		              addDs [Suc_leD] 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   402
			      addss (!simpset)) 1));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   403
bind_thm ("Hash_new_nonces_not_seen",
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   404
	  result() RS mp RS mp RSN (2, rev_notE));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   405
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   406
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   407
(** The Nonce NA uniquely identifies A's message. 
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   408
    This theorem applies to rounds RA1 and RA2!
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   409
**)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   410
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   411
goal thy 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   412
 "!!evs. [| evs : recur lost; A ~: lost |]               \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   413
\ ==> EX B' P'. ALL B P.    \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   414
\        Hash {|Key(shrK A), Agent A, Agent B, Nonce NA, P|} \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   415
\          : parts (sees lost Spy evs)  -->  B=B' & P=P'";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   416
be recur.induct 1;
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   417
be ssubst 4;	(*RA2: DELETE needless definition of PA!*)
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   418
(*For better simplification of RA2*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   419
by (res_inst_tac [("x1","XA")] (insert_commute RS ssubst) 4);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   420
by parts_Fake_tac;
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   421
(*RA3 requires a further induction*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   422
be responses.induct 5;
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   423
by (ALLGOALS Asm_simp_tac);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   424
by (step_tac (!claset addSEs partsEs) 1);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   425
(*RA3: inductive case*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   426
by (best_tac (!claset addss  (!simpset)) 5);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   427
(*Fake*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   428
by (best_tac (!claset addSIs [exI]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   429
                      addDs [impOfSubs analz_subset_parts,
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   430
			     impOfSubs Fake_parts_insert]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   431
		      addss (!simpset)) 2);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   432
(*Base*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   433
by (fast_tac (!claset addss (!simpset)) 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   434
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   435
by (ALLGOALS (simp_tac (!simpset addsimps [all_conj_distrib]))); 
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   436
(*RA1: creation of new Nonce.  Move assertion into global context*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   437
by (expand_case_tac "NA = ?y" 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   438
by (best_tac (!claset addSIs [exI]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   439
                      addEs  [Hash_new_nonces_not_seen]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   440
		      addss (!simpset)) 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   441
by (best_tac (!claset addss  (!simpset)) 1);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   442
(*RA2: creation of new Nonce*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   443
by (expand_case_tac "NA = ?y" 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   444
by (best_tac (!claset addSIs [exI]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   445
                      addDs  [parts_cut]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   446
		      addEs  [Hash_new_nonces_not_seen]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   447
		      addss  (!simpset)) 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   448
by (best_tac (!claset addss  (!simpset)) 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   449
val lemma = result();
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   450
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   451
goal thy 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   452
 "!!evs.[| Hash {|Key(shrK A), Agent A, Agent B, Nonce NA, P|}   \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   453
\            : parts (sees lost Spy evs);                        \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   454
\          Hash {|Key(shrK A), Agent A, Agent B', Nonce NA, P'|} \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   455
\            : parts (sees lost Spy evs);                        \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   456
\          evs : recur lost;  A ~: lost |]                      \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   457
\        ==> B=B' & P=P'";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   458
by (prove_unique_tac lemma 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   459
qed "unique_NA";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   460
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   461
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   462
(*** Lemmas concerning the Server's response
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   463
      (relations "respond" and "responses") 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   464
***)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   465
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   466
(*The response never contains Hashes*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   467
goal thy
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   468
 "!!evs. (j,PB,RB) : respond i \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   469
\        ==> Hash {|Key (shrK B), M|} : parts (insert RB H) --> \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   470
\            Hash {|Key (shrK B), M|} : parts H";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   471
be (respond_imp_responses RS responses.induct) 1;
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   472
by (Auto_tac());
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   473
bind_thm ("Hash_in_parts_respond", result() RSN (2, rev_mp));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   474
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   475
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   476
goal thy
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   477
 "!!evs. [| RB : responses i;  evs : recur lost |] \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   478
\ ==> (Key (shrK B) : analz (insert RB (sees lost Spy evs))) = (B:lost)";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   479
be responses.induct 1;
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   480
by (ALLGOALS
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   481
    (asm_simp_tac 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   482
     (!simpset addsimps [resp_analz_image_newK, insert_Key_singleton]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   483
               setloop split_tac [expand_if])));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   484
qed "shrK_in_analz_respond";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   485
Addsimps [shrK_in_analz_respond];
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   486
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   487
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   488
goal thy  
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   489
 "!!evs. [| RB : responses i;                             \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   490
\           ALL K I. (Key K : analz (Key``(newK``I) Un H)) = \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   491
\           (K : newK``I | Key K : analz H) |]                \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   492
\       ==> (Key K : analz (insert RB H)) --> \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   493
\                  (Key K : parts{RB} | Key K : analz H)";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   494
be responses.induct 1;
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   495
by (ALLGOALS
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   496
    (asm_simp_tac 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   497
     (!simpset addsimps [read_instantiate [("H", "?ff``?xx")] parts_insert,
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   498
			 resp_analz_image_newK_lemma,
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   499
			 insert_Key_singleton, insert_Key_image, 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   500
			 Un_assoc RS sym, pushKey_newK]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   501
               setloop split_tac [expand_if])));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   502
(*The "Message" simpset gives the standard treatment of "image"*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   503
by (simp_tac (simpset_of "Message") 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   504
by (fast_tac (!claset delrules [allE]) 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   505
qed "resp_analz_insert_lemma";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   506
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   507
bind_thm ("resp_analz_insert",
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   508
	  raw_analz_image_newK RSN
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   509
	    (2, resp_analz_insert_lemma) RSN(2, rev_mp));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   510
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   511
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   512
(*The Server does not send such messages.  This theorem lets us avoid
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   513
  assuming B~=Server in RA4.*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   514
goal thy 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   515
 "!!evs. evs : recur lost       \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   516
\ ==> ALL C X Y P. Says Server C {|X, Agent Server, Agent C, Y, P|} \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   517
\                  ~: set_of_list evs";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   518
by (etac recur.induct 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   519
be (respond.induct) 5;
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   520
by (Auto_tac());
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   521
qed_spec_mp "Says_Server_not";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   522
AddSEs [Says_Server_not RSN (2,rev_notE)];
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   523
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   524
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   525
goal thy 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   526
 "!!i. (j,PB,RB) : respond i               \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   527
\  ==> EX A' B'. ALL A B N.                \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   528
\        Crypt (shrK A) {|Key K, Agent B, N|} : parts {RB} \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   529
\          -->   (A'=A & B'=B) | (A'=B & B'=A)";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   530
be respond.induct 1;
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   531
by (ALLGOALS (asm_full_simp_tac (!simpset addsimps [all_conj_distrib]))); 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   532
(*Base case*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   533
by (Fast_tac 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   534
by (Step_tac 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   535
by (expand_case_tac "K = ?y" 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   536
by (best_tac (!claset addSIs [exI]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   537
                      addSEs partsEs
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   538
                      addDs [Key_in_parts_respond]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   539
                      addss (!simpset)) 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   540
by (expand_case_tac "K = ?y" 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   541
by (REPEAT (ares_tac [exI] 2));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   542
by (ex_strip_tac 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   543
be respond.elim 1;
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   544
by (REPEAT_FIRST (etac Pair_inject ORELSE' hyp_subst_tac));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   545
by (ALLGOALS (asm_full_simp_tac 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   546
	      (!simpset addsimps [all_conj_distrib, ex_disj_distrib]))); 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   547
by (Fast_tac 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   548
by (Fast_tac 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   549
val lemma = result();
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   550
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   551
goal thy 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   552
 "!!RB. [| Crypt (shrK A) {|Key K, Agent B, N|} : parts {RB};    \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   553
\          Crypt (shrK A') {|Key K, Agent B', N'|} : parts {RB};   \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   554
\          (j,PB,RB) : respond i |]               \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   555
\ ==>   (A'=A & B'=B) | (A'=B & B'=A)";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   556
by (prove_unique_tac lemma 1);	(*33 seconds, due to the disjunctions*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   557
qed "unique_session_keys";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   558
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   559
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   560
(** Crucial secrecy property: Spy does not see the keys sent in msg RA3
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   561
    Does not in itself guarantee security: an attack could violate 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   562
    the premises, e.g. by having A=Spy **)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   563
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   564
goal thy 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   565
 "!!j. (j, {|Hash {|Key(shrK A), Agent A, B, NA, P|}, X|}, RA) : respond i \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   566
\ ==> Crypt (shrK A) {|Key (newK2 (i,j)), B, NA|} : parts {RA}";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   567
be respond.elim 1;
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   568
by (ALLGOALS Asm_full_simp_tac);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   569
qed "newK2_respond_lemma";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   570
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   571
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   572
goal thy 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   573
 "!!evs. [| (j,PB,RB) : respond (length evs);  evs : recur lost |]       \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   574
\        ==> ALL A A' N. A ~: lost & A' ~: lost -->  \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   575
\            Crypt (shrK A) {|Key K, Agent A', N|} : parts{RB} -->  \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   576
\            Key K ~: analz (insert RB (sees lost Spy evs))";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   577
be respond.induct 1;
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   578
by (forward_tac [respond_imp_responses] 2);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   579
by (ALLGOALS
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   580
    (asm_simp_tac 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   581
     (!simpset addsimps 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   582
	  ([analz_image_newK, not_parts_not_analz,
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   583
	    read_instantiate [("H", "?ff``?xx")] parts_insert,
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   584
	    Un_assoc RS sym, resp_analz_image_newK,
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   585
	    insert_Key_singleton, analz_insert_Key_newK])
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   586
      setloop split_tac [expand_if])));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   587
by (ALLGOALS (simp_tac (simpset_of "Message")));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   588
by (Fast_tac 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   589
by (step_tac (!claset addSEs [MPair_parts]) 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   590
(** LEVEL 6 **)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   591
by (fast_tac (!claset addDs [resp_analz_insert, Key_in_parts_respond]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   592
                      addSEs [new_keys_not_seen RS not_parts_not_analz 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   593
			      RSN(2,rev_notE)]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   594
                      addss (!simpset)) 4);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   595
by (fast_tac (!claset addSDs [newK2_respond_lemma]) 3);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   596
by (best_tac (!claset addSEs partsEs
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   597
                      addDs [Key_in_parts_respond]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   598
                      addss (!simpset)) 2);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   599
by (thin_tac "ALL x.?P(x)" 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   600
be respond.elim 1;
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   601
by (fast_tac (!claset addss (!simpset)) 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   602
by (step_tac (!claset addss (!simpset)) 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   603
by (best_tac (!claset addSEs partsEs
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   604
                      addDs [Key_in_parts_respond]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   605
                      addss (!simpset)) 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   606
qed_spec_mp "respond_Spy_not_see_encrypted_key";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   607
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   608
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   609
goal thy
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   610
 "!!evs. [| A ~: lost;  A' ~: lost;  \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   611
\           evs : recur lost |]       \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   612
\        ==> Says Server B RB : set_of_list evs -->   \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   613
\            Crypt (shrK A) {|Key K, Agent A', N|} : parts{RB} -->  \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   614
\            Key K ~: analz (sees lost Spy evs)";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   615
by (etac recur.induct 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   616
by analz_Fake_tac;
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   617
be ssubst 4;	(*RA2: DELETE needless definition of PA!*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   618
by (ALLGOALS
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   619
    (asm_simp_tac
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   620
     (!simpset addsimps [not_parts_not_analz, analz_insert_Key_newK] 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   621
               setloop split_tac [expand_if])));
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   622
(*RA4*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   623
by (spy_analz_tac 4);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   624
(*Fake*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   625
by (spy_analz_tac 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   626
by (step_tac (!claset delrules [impCE]) 1);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   627
(*RA2*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   628
by (spy_analz_tac 1);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   629
(*RA3, case 2: K is an old key*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   630
by (fast_tac (!claset addSDs [resp_analz_insert]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   631
		      addSEs partsEs
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   632
                      addDs [Key_in_parts_respond]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   633
	              addEs [Says_imp_old_keys RS less_irrefl]) 2);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   634
(*RA3, case 1: use lemma previously proved by induction*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   635
by (fast_tac (!claset addSEs [respond_Spy_not_see_encrypted_key RSN
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   636
			      (2,rev_notE)]) 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   637
bind_thm ("Spy_not_see_encrypted_key", result() RS mp RSN (2, rev_mp));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   638
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   639
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   640
goal thy 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   641
 "!!evs. [| Says Server B RB : set_of_list evs;   \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   642
\           Crypt (shrK A) {|Key K, Agent A', N|} : parts{RB};  \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   643
\            C ~: {A,A',Server};                                           \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   644
\           A ~: lost;  A' ~: lost;  evs : recur lost |]                 \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   645
\        ==> Key K ~: analz (sees lost C evs)";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   646
by (rtac (subset_insertI RS sees_mono RS analz_mono RS contra_subsetD) 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   647
by (rtac (sees_lost_agent_subset_sees_Spy RS analz_mono RS contra_subsetD) 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   648
by (FIRSTGOAL (rtac Spy_not_see_encrypted_key));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   649
by (REPEAT_FIRST (fast_tac (!claset addIs [recur_mono RS subsetD])));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   650
qed "Agent_not_see_encrypted_key";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   651
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   652
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   653
(**** Authenticity properties for Agents ****)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   654
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   655
(*Only RA1 or RA2 can have caused such a part of a message to appear.*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   656
goal thy 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   657
 "!!evs. [| Hash {|Key(shrK A), Agent A, Agent B, NA, P|}         \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   658
\             : parts (sees lost Spy evs);                        \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   659
\            A ~: lost;  evs : recur lost |]                        \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   660
\        ==> Says A B {|Hash{|Key(shrK A), Agent A, Agent B, NA, P|},  \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   661
\                       Agent A, Agent B, NA, P|}  \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   662
\             : set_of_list evs";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   663
be rev_mp 1;
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   664
by (parts_induct_tac 1);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   665
(*RA3*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   666
by (fast_tac (!claset addSDs [Hash_in_parts_respond]) 2);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   667
(*RA2*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   668
by ((REPEAT o CHANGED)     (*Push in XA*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   669
    (res_inst_tac [("x1","XA")] (insert_commute RS ssubst) 1));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   670
by (best_tac (!claset addSEs partsEs 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   671
                      addDs [parts_cut]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   672
                      addss  (!simpset)) 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   673
qed_spec_mp "Hash_auth_sender";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   674
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   675
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   676
goal thy "!!i. {|Hash {|Key (shrK Server), M|}, M|} : responses i ==> R";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   677
be setup_induction 1;
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   678
be responses.induct 1;
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   679
by (ALLGOALS Asm_simp_tac); 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   680
qed "responses_no_Hash_Server";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   681
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   682
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   683
val nonce_not_seen_now = le_refl RSN (2, new_nonces_not_seen) RSN (2,rev_notE);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   684
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   685
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   686
(** These two results should subsume (for all agents) the guarantees proved
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   687
    separately for A and B in the Otway-Rees protocol.
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   688
**)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   689
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   690
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   691
(*Crucial property: If the encrypted message appears, and A has used NA
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   692
  in a run, then it originated with the Server!*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   693
goal thy 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   694
 "!!evs. [| A ~: lost;  A ~= Spy;  evs : recur lost |]                 \
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   695
\    ==> Crypt (shrK A) {|Key K, Agent A', NA|} : parts (sees lost Spy evs) \
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   696
\        --> Says A B {|Hash{|Key(shrK A), Agent A, Agent B, NA, P|},  \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   697
\                       Agent A, Agent B, NA, P|}      \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   698
\             : set_of_list evs                                    \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   699
\         --> (EX C RC. Says Server C RC : set_of_list evs &  \
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   700
\                       Crypt (shrK A) {|Key K, Agent A', NA|} : parts {RC})";
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   701
by (parts_induct_tac 1);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   702
(*RA4*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   703
by (best_tac (!claset addSEs [MPair_parts]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   704
	              addSDs [Hash_auth_sender]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   705
		      addSIs [disjI2]) 4);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   706
(*RA1: it cannot be a new Nonce, contradiction.*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   707
by (fast_tac (!claset delrules [impCE]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   708
	              addSEs [nonce_not_seen_now, MPair_parts]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   709
                      addDs  [parts.Body]) 1);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   710
(*RA2: it cannot be a new Nonce, contradiction.*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   711
by ((REPEAT o CHANGED)     (*Push in XA*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   712
    (res_inst_tac [("x1","XA")] (insert_commute RS ssubst) 1));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   713
by (deepen_tac (!claset delrules [impCE]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   714
                      addSIs [disjI2]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   715
	              addSEs [MPair_parts]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   716
                      addDs  [parts_cut, parts.Body]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   717
                      addss  (!simpset)) 0 1);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   718
(*RA3*)  (** LEVEL 5 **)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   719
by (REPEAT (safe_step_tac (!claset addSEs [responses_no_Hash_Server]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   720
	                           delrules [impCE]) 1));
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   721
by (full_simp_tac (!simpset addsimps [parts_insert_sees]) 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   722
by (Fast_tac 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   723
qed_spec_mp "Crypt_imp_Server_msg";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   724
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   725
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   726
(*Corollary: if A receives B's message and the nonce NA agrees
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   727
  then the key really did come from the Server!*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   728
goal thy 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   729
 "!!evs. [| Says B' A RA : set_of_list evs;                        \
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   730
\           Crypt (shrK A) {|Key K, Agent A', NA|} : parts {RA};    \
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   731
\           Says A B {|Hash{|Key(shrK A), Agent A, Agent B, NA, P|},  \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   732
\                       Agent A, Agent B, NA, P|}   \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   733
\            : set_of_list evs;                                    \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   734
\           A ~: lost;  A ~= Spy;  evs : recur lost |]             \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   735
\        ==> EX C RC. Says Server C RC : set_of_list evs &  \
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   736
\                       Crypt (shrK A) {|Key K, Agent A', NA|} : parts {RC}";
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   737
by (best_tac (!claset addSIs [Crypt_imp_Server_msg]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   738
                      addDs  [Says_imp_sees_Spy RS parts.Inj RSN (2,parts_cut)]
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   739
                      addss  (!simpset)) 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   740
qed "Agent_trust";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   741
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   742
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   743
(*Overall guarantee: if A receives B's message and the nonce NA agrees
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   744
  then the only other agent who knows the key is B.*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   745
goal thy 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   746
 "!!evs. [| Says B' A RA : set_of_list evs;                           \
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   747
\           Crypt (shrK A) {|Key K, Agent A', NA|} : parts {RA};      \
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   748
\           Says A B {|Hash{|Key(shrK A), Agent A, Agent B, NA, P|},  \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   749
\                      Agent A, Agent B, NA, P|}                      \
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   750
\            : set_of_list evs;                                       \
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   751
\           C ~: {A,A',Server};                                       \
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   752
\           A ~: lost;  A' ~: lost;  A ~= Spy;  evs : recur lost |]   \
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   753
\        ==> Key K ~: analz (sees lost C evs)";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   754
by (dtac Agent_trust 1 THEN REPEAT_FIRST assume_tac);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   755
by (fast_tac (!claset addSEs [Agent_not_see_encrypted_key RSN(2,rev_notE)]) 1);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   756
qed "Agent_secrecy";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   757