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