src/HOL/Auth/Recur.ML
author paulson
Tue, 27 Feb 2001 16:13:23 +0100
changeset 11185 1b737b4c2108
parent 11150 67387142225e
permissions -rw-r--r--
Some X-symbols for <notin>, <noteq>, <forall>, <exists> Streamlining of Yahalom proofs Removal of redundant proofs
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
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
     9
Pretty.setdepth 30;
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    10
11150
67387142225e Streamlining for the bug fix in Blast.
paulson
parents: 11104
diff changeset
    11
AddDs  [Says_imp_knows_Spy RS parts.Inj, parts.Body];
67387142225e Streamlining for the bug fix in Blast.
paulson
parents: 11104
diff changeset
    12
AddDs  [impOfSubs analz_subset_parts, impOfSubs Fake_parts_insert];
5359
bd539b72d484 Tidying
paulson
parents: 5351
diff changeset
    13
bd539b72d484 Tidying
paulson
parents: 5351
diff changeset
    14
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    15
(** Possibility properties: traces that reach the end 
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    16
        ONE theorem would be more elegant and faster!
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    17
        By induction on a list of agents (no repetitions)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    18
**)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    19
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    20
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    21
(*Simplest case: Alice goes directly to the server*)
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
    22
Goal "\\<exists>K NA. \\<exists>evs \\<in> recur.                                           \
5434
9b4bed3f394c Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents: 5421
diff changeset
    23
\  Says Server A {|Crypt (shrK A) {|Key K, Agent Server, Nonce NA|},   \
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
    24
\                  END|}  \\<in> set evs";
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    25
by (REPEAT (resolve_tac [exI,bexI] 1));
5434
9b4bed3f394c Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents: 5421
diff changeset
    26
by (rtac (recur.Nil RS recur.RA1 RS (respond.One RSN (3,recur.RA3))) 2);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    27
by possibility_tac;
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    28
result();
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    29
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    30
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    31
(*Case two: Alice, Bob and the server*)
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
    32
Goal "\\<exists>K. \\<exists>NA. \\<exists>evs \\<in> recur.                               \
5434
9b4bed3f394c Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents: 5421
diff changeset
    33
\       Says B A {|Crypt (shrK A) {|Key K, Agent B, Nonce NA|}, \
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
    34
\                  END|}  \\<in> set evs";
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    35
by (cut_facts_tac [Nonce_supply2, Key_supply2] 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    36
by (REPEAT (eresolve_tac [exE, conjE] 1));
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    37
by (REPEAT (resolve_tac [exI,bexI] 1));
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
    38
by (rtac (recur.Nil RS recur.RA1 RS recur.RA2 RS 
5434
9b4bed3f394c Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents: 5421
diff changeset
    39
          (respond.One RS respond.Cons RSN (3,recur.RA3)) RS
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    40
          recur.RA4) 2);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    41
by basic_possibility_tac;
5351
paulson
parents: 5223
diff changeset
    42
by (DEPTH_SOLVE (eresolve_tac [asm_rl, less_not_refl2, less_not_refl3] 1));
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    43
result();
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    44
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    45
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    46
(*Case three: Alice, Bob, Charlie and the server
2533
2d5604a51562 Simplified proofs
paulson
parents: 2516
diff changeset
    47
  TOO SLOW to run every time!
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
    48
Goal "\\<exists>K. \\<exists>NA. \\<exists>evs \\<in> recur.                                      \
5434
9b4bed3f394c Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents: 5421
diff changeset
    49
\       Says B A {|Crypt (shrK A) {|Key K, Agent B, Nonce NA|},        \
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
    50
\                  END|}  \\<in> set evs";
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    51
by (cut_facts_tac [Nonce_supply3, Key_supply3] 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    52
by (REPEAT (eresolve_tac [exE, conjE] 1));
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    53
by (REPEAT (resolve_tac [exI,bexI] 1));
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
    54
by (rtac (recur.Nil RS recur.RA1 RS recur.RA2 RS recur.RA2 RS 
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    55
          (respond.One RS respond.Cons RS respond.Cons RSN
5434
9b4bed3f394c Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents: 5421
diff changeset
    56
           (3,recur.RA3)) RS recur.RA4 RS recur.RA4) 2);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    57
by basic_possibility_tac;
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    58
by (DEPTH_SOLVE (swap_res_tac [refl, conjI, disjCI] 1 
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    59
		 ORELSE
5351
paulson
parents: 5223
diff changeset
    60
		 eresolve_tac [asm_rl, less_not_refl2, less_not_refl3] 1));
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    61
result();
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    62
****************)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    63
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    64
(**** Inductive proofs about recur ****)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    65
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
    66
Goal "(PA,RB,KAB) \\<in> respond evs ==> Key KAB \\<notin> used evs";
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    67
by (etac respond.induct 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    68
by (REPEAT (assume_tac 1));
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    69
qed "respond_imp_not_used";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    70
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
    71
Goal "[| Key K \\<in> parts {RB};  (PB,RB,K') \\<in> respond evs |] ==> Key K \\<notin> used evs";
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    72
by (etac rev_mp 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    73
by (etac respond.induct 1);
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
    74
by (auto_tac(claset() addDs [Key_not_used, respond_imp_not_used],
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
    75
             simpset()));
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    76
qed_spec_mp "Key_in_parts_respond";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    77
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    78
(*Simple inductive reasoning about responses*)
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
    79
Goal "(PA,RB,KAB) \\<in> respond evs ==> RB \\<in> responses evs";
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    80
by (etac respond.induct 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    81
by (REPEAT (ares_tac (respond_imp_not_used::responses.intrs) 1));
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    82
qed "respond_imp_responses";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    83
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    84
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    85
(** For reasoning about the encrypted portion of messages **)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    86
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3681
diff changeset
    87
val RA2_analz_spies = Says_imp_spies RS analz.Inj |> standard;
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    88
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
    89
Goal "Says C' B {|Crypt K X, X', RA|} \\<in> set evs ==> RA \\<in> analz (spies evs)";
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
    90
by (blast_tac (claset() addSDs [Says_imp_spies RS analz.Inj]) 1);
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3681
diff changeset
    91
qed "RA4_analz_spies";
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    92
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
    93
(*RA2_analz... and RA4_analz... let us treat those cases using the same 
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    94
  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
    95
  proofs: Fake does not invent new nonces (as in RA2), and of course Fake
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    96
  messages originate from the Spy. *)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    97
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3681
diff changeset
    98
bind_thm ("RA2_parts_spies",
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3681
diff changeset
    99
          RA2_analz_spies RS (impOfSubs analz_subset_parts));
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3681
diff changeset
   100
bind_thm ("RA4_parts_spies",
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3681
diff changeset
   101
          RA4_analz_spies RS (impOfSubs analz_subset_parts));
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   102
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   103
(*For proving the easier theorems about X \\<notin> parts (spies evs).*)
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
   104
fun parts_induct_tac i = 
5359
bd539b72d484 Tidying
paulson
parents: 5351
diff changeset
   105
  EVERY [etac recur.induct i,
7499
23e090051cb8 isatool expandshort;
wenzelm
parents: 7057
diff changeset
   106
	 ftac RA4_parts_spies (i+5),
23e090051cb8 isatool expandshort;
wenzelm
parents: 7057
diff changeset
   107
	 ftac respond_imp_responses (i+4),
23e090051cb8 isatool expandshort;
wenzelm
parents: 7057
diff changeset
   108
	 ftac RA2_parts_spies (i+3),
5359
bd539b72d484 Tidying
paulson
parents: 5351
diff changeset
   109
	 prove_simple_subgoals_tac i];
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   110
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   111
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   112
(** Theorems of the form X \\<notin> parts (spies evs) imply that NOBODY
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   113
    sends messages containing X! **)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   114
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   115
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3681
diff changeset
   116
(** Spy never sees another agent's shared key! (unless it's bad at start) **)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   117
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   118
Goal "evs \\<in> recur ==> (Key (shrK A) \\<in> parts (spies evs)) = (A \\<in> bad)";
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
   119
by (parts_induct_tac 1);
5359
bd539b72d484 Tidying
paulson
parents: 5351
diff changeset
   120
by Auto_tac;
2550
8d8344bcf98a Re-ordering of certificates so that session keys appear in decreasing order
paulson
parents: 2533
diff changeset
   121
(*RA3*)
5359
bd539b72d484 Tidying
paulson
parents: 5351
diff changeset
   122
by (auto_tac (claset() addDs [Key_in_parts_respond],
bd539b72d484 Tidying
paulson
parents: 5351
diff changeset
   123
	      simpset() addsimps [parts_insert_spies]));
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   124
qed "Spy_see_shrK";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   125
Addsimps [Spy_see_shrK];
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   126
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   127
Goal "evs \\<in> recur ==> (Key (shrK A) \\<in> analz (spies evs)) = (A \\<in> bad)";
5359
bd539b72d484 Tidying
paulson
parents: 5351
diff changeset
   128
by Auto_tac;
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   129
qed "Spy_analz_shrK";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   130
Addsimps [Spy_analz_shrK];
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   131
4471
0abf9d3f4391 Tidied using rev_iffD1
paulson
parents: 4449
diff changeset
   132
AddSDs [Spy_see_shrK RSN (2, rev_iffD1), 
0abf9d3f4391 Tidied using rev_iffD1
paulson
parents: 4449
diff changeset
   133
	Spy_analz_shrK RSN (2, rev_iffD1)];
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   134
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   135
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   136
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   137
(*** Proofs involving analz ***)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   138
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
   139
(*For proofs involving analz.*)
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3681
diff changeset
   140
val analz_spies_tac = 
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3681
diff changeset
   141
    dtac RA2_analz_spies 4 THEN 
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   142
    ftac respond_imp_responses 5 THEN
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3681
diff changeset
   143
    dtac RA4_analz_spies 6;
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   144
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   145
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   146
(** Session keys are not used to encrypt other session keys **)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   147
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   148
(*Version for "responses" relation.  Handles case RA3 in the theorem below.  
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3681
diff changeset
   149
  Note that it holds for *any* set H (not just "spies evs")
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   150
  satisfying the inductive hypothesis.*)
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   151
Goal "[| RB \\<in> responses evs;                             \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   152
\        \\<forall>K KK. KK \\<subseteq> - (range shrK) -->              \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   153
\                  (Key K \\<in> analz (Key`KK Un H)) =      \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   154
\                  (K \\<in> KK | Key K \\<in> analz H) |]         \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   155
\    ==> \\<forall>K KK. KK \\<subseteq> - (range shrK) -->              \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   156
\                  (Key K \\<in> analz (insert RB (Key`KK Un H))) = \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   157
\                  (K \\<in> KK | Key K \\<in> analz (insert RB H))";
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   158
by (etac responses.induct 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   159
by (ALLGOALS (asm_simp_tac analz_image_freshK_ss));
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   160
qed "resp_analz_image_freshK_lemma";
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   161
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   162
(*Version for the protocol.  Proof is almost trivial, thanks to the lemma.*)
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   163
Goal "evs \\<in> recur ==>                                 \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   164
\  \\<forall>K KK. KK \\<subseteq> - (range shrK) -->                 \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   165
\         (Key K \\<in> analz (Key`KK Un (spies evs))) =  \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   166
\         (K \\<in> KK | Key K \\<in> analz (spies evs))";
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   167
by (etac recur.induct 1);
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3681
diff changeset
   168
by analz_spies_tac;
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   169
by (REPEAT_FIRST (resolve_tac [allI, impI]));
4552
bb8ff763c93d Simplified proofs by omitting PA = {|XA, ...|} from RA2
paulson
parents: 4509
diff changeset
   170
by (REPEAT_FIRST (rtac analz_image_freshK_lemma));
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   171
by (ALLGOALS 
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   172
    (asm_simp_tac
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   173
     (analz_image_freshK_ss addsimps [resp_analz_image_freshK_lemma])));
3451
d10f100676d8 Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents: 3207
diff changeset
   174
(*Fake*) 
d10f100676d8 Made proofs more concise by replacing calls to spy_analz_tac by uses of
paulson
parents: 3207
diff changeset
   175
by (spy_analz_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   176
val raw_analz_image_freshK = result();
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   177
qed_spec_mp "analz_image_freshK";
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   178
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   179
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3681
diff changeset
   180
(*Instance of the lemma with H replaced by (spies evs):
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   181
   [| RB \\<in> responses evs;  evs \\<in> recur; |]
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   182
   ==> KK \\<subseteq> - (range shrK) --> 
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   183
       Key K \\<in> analz (insert RB (Key`KK Un spies evs)) =
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   184
       (K \\<in> KK | Key K \\<in> analz (insert RB (spies evs))) 
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   185
*)
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   186
bind_thm ("resp_analz_image_freshK",
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   187
          raw_analz_image_freshK RSN
3961
6a8996fb7d99 Many minor speedups:
paulson
parents: 3919
diff changeset
   188
            (2, resp_analz_image_freshK_lemma) RS spec RS spec RS mp);
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   189
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   190
Goal "[| evs \\<in> recur;  KAB \\<notin> range shrK |] ==>           \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   191
\     Key K \\<in> analz (insert (Key KAB) (spies evs)) =      \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   192
\     (K = KAB | Key K \\<in> analz (spies evs))";
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   193
by (asm_simp_tac (analz_image_freshK_ss addsimps [analz_image_freshK]) 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   194
qed "analz_insert_freshK";
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   195
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   196
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   197
(*Everything that's hashed is already in past traffic. *)
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   198
Goal "[| Hash {|Key(shrK A), X|} \\<in> parts (spies evs);  \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   199
\        evs \\<in> recur;  A \\<notin> bad |] ==> X \\<in> parts (spies evs)";
2550
8d8344bcf98a Re-ordering of certificates so that session keys appear in decreasing order
paulson
parents: 2533
diff changeset
   200
by (etac rev_mp 1);
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
   201
by (parts_induct_tac 1);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   202
(*RA3 requires a further induction*)
3121
cbb6c0c1c58a Conversion to use blast_tac (with other improvements)
paulson
parents: 2637
diff changeset
   203
by (etac responses.induct 2);
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   204
by (ALLGOALS Asm_simp_tac);
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   205
(*Fake*)
5434
9b4bed3f394c Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents: 5421
diff changeset
   206
by (blast_tac (claset() addIs [parts_insertI]) 1);
2550
8d8344bcf98a Re-ordering of certificates so that session keys appear in decreasing order
paulson
parents: 2533
diff changeset
   207
qed "Hash_imp_body";
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   208
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   209
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   210
(** The Nonce NA uniquely identifies A's message. 
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   211
    This theorem applies to steps RA1 and RA2!
2455
9c4444bfd44e Simplification and generalization of the guarantees.
paulson
parents: 2451
diff changeset
   212
9c4444bfd44e Simplification and generalization of the guarantees.
paulson
parents: 2451
diff changeset
   213
  Unicity is not used in other proofs but is desirable in its own right.
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   214
**)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   215
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   216
Goal
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   217
  "[| Hash {|Key(shrK A), Agent A, B, NA, P|} \\<in> parts (spies evs); \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   218
\     Hash {|Key(shrK A), Agent A, B',NA, P'|} \\<in> parts (spies evs); \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   219
\     evs \\<in> recur;  A \\<notin> bad |]                                    \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   220
\   ==> B=B' & P=P'";
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   221
by (etac rev_mp 1);
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   222
by (etac rev_mp 1);
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
   223
by (parts_induct_tac 1);
5359
bd539b72d484 Tidying
paulson
parents: 5351
diff changeset
   224
by (Blast_tac 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   225
by (etac responses.induct 3);
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   226
by (Asm_full_simp_tac 4); 
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   227
(*RA1,2: creation of new Nonce*)
5359
bd539b72d484 Tidying
paulson
parents: 5351
diff changeset
   228
by (REPEAT (blast_tac (claset() addSDs [Hash_imp_body]) 1));
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   229
qed "unique_NA";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   230
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   231
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   232
(*** Lemmas concerning the Server's response
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   233
      (relations "respond" and "responses") 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   234
***)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   235
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   236
Goal "[| RB \\<in> responses evs;  evs \\<in> recur |] \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   237
\ ==> (Key (shrK B) \\<in> analz (insert RB (spies evs))) = (B:bad)";
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   238
by (etac responses.induct 1);
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   239
by (ALLGOALS
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   240
    (asm_simp_tac 
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   241
     (analz_image_freshK_ss addsimps [Spy_analz_shrK,
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   242
                                      resp_analz_image_freshK])));
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   243
qed "shrK_in_analz_respond";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   244
Addsimps [shrK_in_analz_respond];
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   245
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   246
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   247
Goal "[| RB \\<in> responses evs;                         \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   248
\        \\<forall>K KK. KK \\<subseteq> - (range shrK) -->          \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   249
\                  (Key K \\<in> analz (Key`KK Un H)) =  \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   250
\                  (K \\<in> KK | Key K \\<in> analz H) |]     \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   251
\    ==> (Key K \\<in> analz (insert RB H)) -->           \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   252
\        (Key K \\<in> parts{RB} | Key K \\<in> analz H)";
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   253
by (etac responses.induct 1);
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   254
by (ALLGOALS
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   255
    (asm_simp_tac 
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   256
     (analz_image_freshK_ss addsimps [resp_analz_image_freshK_lemma])));
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   257
(*Simplification using two distinct treatments of "image"*)
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   258
by (simp_tac (simpset() addsimps [parts_insert2]) 1);
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   259
by (blast_tac (claset() delrules [allE]) 1);
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   260
qed "resp_analz_insert_lemma";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   261
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   262
bind_thm ("resp_analz_insert",
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   263
          raw_analz_image_freshK RSN
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   264
            (2, resp_analz_insert_lemma) RSN(2, rev_mp));
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   265
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   266
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   267
(*The last key returned by respond indeed appears in a certificate*)
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   268
Goal "(Hash[Key(shrK A)] {|Agent A, B, NA, P|}, RA, K) \\<in> respond evs \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   269
\   ==> Crypt (shrK A) {|Key K, B, NA|} \\<in> parts {RA}";
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   270
by (etac respond.elim 1);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   271
by (ALLGOALS Asm_full_simp_tac);
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   272
qed "respond_certificate";
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   273
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   274
(*This unicity proof differs from all the others in the HOL/Auth directory.
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   275
  The conclusion isn't quite unicity but duplicity, in that there are two
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   276
  possibilities.  Also, the presence of two different matching messages in 
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   277
  the inductive step complicates the case analysis.  Unusually for such proofs,
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   278
  the quantifiers appear to be necessary.*)
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   279
Goal "(PB,RB,KXY) \\<in> respond evs ==> \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   280
\     \\<forall>A B N. Crypt (shrK A) {|Key K, Agent B, N|} \\<in> parts {RB} -->      \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   281
\     (\\<forall>A' B' N'. Crypt (shrK A') {|Key K, Agent B', N'|} \\<in> parts {RB} --> \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   282
\     (A'=A & B'=B) | (A'=B & B'=A))";
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   283
by (etac respond.induct 1);
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   284
by (ALLGOALS (asm_full_simp_tac (simpset() addsimps [all_conj_distrib]))); 
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   285
by (blast_tac (claset() addDs [respond_certificate]) 1); 
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   286
qed_spec_mp "unique_lemma";
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   287
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   288
Goal "[| Crypt (shrK A) {|Key K, Agent B, N|} \\<in> parts {RB};      \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   289
\        Crypt (shrK A') {|Key K, Agent B', N'|} \\<in> parts {RB};   \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   290
\        (PB,RB,KXY) \\<in> respond evs |]                            \
5359
bd539b72d484 Tidying
paulson
parents: 5351
diff changeset
   291
\     ==> (A'=A & B'=B) | (A'=B & B'=A)";
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   292
by (rtac unique_lemma 1); 
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   293
by Auto_tac;  
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   294
qed "unique_session_keys";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   295
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   296
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   297
(** Crucial secrecy property: Spy does not see the keys sent in msg RA3
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   298
    Does not in itself guarantee security: an attack could violate 
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   299
    the premises, e.g. by having A=Spy **)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   300
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   301
Goal "[| (PB,RB,KAB) \\<in> respond evs;  evs \\<in> recur |]              \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   302
\     ==> \\<forall>A A' N. A \\<notin> bad & A' \\<notin> bad -->                   \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   303
\         Crypt (shrK A) {|Key K, Agent A', N|} \\<in> parts{RB} -->  \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   304
\         Key K \\<notin> analz (insert RB (spies evs))";
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   305
by (etac respond.induct 1);
7499
23e090051cb8 isatool expandshort;
wenzelm
parents: 7057
diff changeset
   306
by (ftac respond_imp_responses 2);
23e090051cb8 isatool expandshort;
wenzelm
parents: 7057
diff changeset
   307
by (ftac respond_imp_not_used 2);
3961
6a8996fb7d99 Many minor speedups:
paulson
parents: 3919
diff changeset
   308
by (ALLGOALS (*6 seconds*)
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   309
    (asm_simp_tac 
3961
6a8996fb7d99 Many minor speedups:
paulson
parents: 3919
diff changeset
   310
     (analz_image_freshK_ss 
4831
dae4d63a1318 Renamed expand_const -> split_const.
nipkow
parents: 4598
diff changeset
   311
        addsimps split_ifs
3961
6a8996fb7d99 Many minor speedups:
paulson
parents: 3919
diff changeset
   312
	addsimps 
6a8996fb7d99 Many minor speedups:
paulson
parents: 3919
diff changeset
   313
          [shrK_in_analz_respond, resp_analz_image_freshK, parts_insert2])));
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   314
by (ALLGOALS (simp_tac (simpset() addsimps [ex_disj_distrib])));
3681
61c7469fd0b0 New proof of respond_Spy_not_see_session_key
paulson
parents: 3519
diff changeset
   315
(** LEVEL 5 **)
5359
bd539b72d484 Tidying
paulson
parents: 5351
diff changeset
   316
by (Blast_tac 1);
3961
6a8996fb7d99 Many minor speedups:
paulson
parents: 3919
diff changeset
   317
by (REPEAT_FIRST (resolve_tac [allI, conjI, impI]));
6a8996fb7d99 Many minor speedups:
paulson
parents: 3919
diff changeset
   318
by (ALLGOALS Clarify_tac);
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   319
by (blast_tac (claset() addSDs [resp_analz_insert]) 3);
7057
b9ddbb925939 tweaked proofs to handle new freeness reasoning for data c onstructors
paulson
parents: 5535
diff changeset
   320
by (blast_tac (claset() addSDs [respond_certificate]) 2);
3961
6a8996fb7d99 Many minor speedups:
paulson
parents: 3919
diff changeset
   321
by (Asm_full_simp_tac 1);
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   322
(*by unicity, either B=Aa or B=A', a contradiction if B \\<in> bad*)
3961
6a8996fb7d99 Many minor speedups:
paulson
parents: 3919
diff changeset
   323
by (blast_tac
11150
67387142225e Streamlining for the bug fix in Blast.
paulson
parents: 11104
diff changeset
   324
    (claset() addDs [respond_certificate RSN (2, unique_session_keys)]) 1);
2533
2d5604a51562 Simplified proofs
paulson
parents: 2516
diff changeset
   325
qed_spec_mp "respond_Spy_not_see_session_key";
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   326
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   327
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   328
Goal "[| Crypt (shrK A) {|Key K, Agent A', N|} \\<in> parts (spies evs); \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   329
\        A \\<notin> bad;  A' \\<notin> bad;  evs \\<in> recur |]                      \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   330
\     ==> Key K \\<notin> analz (spies evs)";
2550
8d8344bcf98a Re-ordering of certificates so that session keys appear in decreasing order
paulson
parents: 2533
diff changeset
   331
by (etac rev_mp 1);
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   332
by (etac recur.induct 1);
3683
aafe719dff14 Global change: lost->bad and sees Spy->spies
paulson
parents: 3681
diff changeset
   333
by analz_spies_tac;
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   334
by (ALLGOALS
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   335
    (asm_simp_tac
5535
678999604ee9 deleted needless parentheses
paulson
parents: 5492
diff changeset
   336
     (simpset() addsimps split_ifs @ [analz_insert_eq, analz_insert_freshK])));
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   337
(*RA4*)
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   338
by (Blast_tac 5);
2533
2d5604a51562 Simplified proofs
paulson
parents: 2516
diff changeset
   339
(*RA2*)
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   340
by (Blast_tac 3);
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   341
(*Fake*)
2533
2d5604a51562 Simplified proofs
paulson
parents: 2516
diff changeset
   342
by (spy_analz_tac 2);
2d5604a51562 Simplified proofs
paulson
parents: 2516
diff changeset
   343
(*Base*)
7057
b9ddbb925939 tweaked proofs to handle new freeness reasoning for data c onstructors
paulson
parents: 5535
diff changeset
   344
by (Force_tac 1);
2533
2d5604a51562 Simplified proofs
paulson
parents: 2516
diff changeset
   345
(*RA3 remains*)
4556
e7a4683c0026 Tidying, mostly to do with handling a more specific version of Fake_parts_insert
paulson
parents: 4552
diff changeset
   346
by (simp_tac (simpset() addsimps [parts_insert_spies]) 1);
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   347
by (safe_tac (claset() delrules [impCE]));
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   348
(*RA3, case 2: K is an old key*)
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   349
by (blast_tac (claset() addSDs [resp_analz_insert]
4556
e7a4683c0026 Tidying, mostly to do with handling a more specific version of Fake_parts_insert
paulson
parents: 4552
diff changeset
   350
                        addDs  [Key_in_parts_respond]) 2);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   351
(*RA3, case 1: use lemma previously proved by induction*)
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   352
by (blast_tac (claset() addSEs [respond_Spy_not_see_session_key RSN
3121
cbb6c0c1c58a Conversion to use blast_tac (with other improvements)
paulson
parents: 2637
diff changeset
   353
			       (2,rev_notE)]) 1);
2550
8d8344bcf98a Re-ordering of certificates so that session keys appear in decreasing order
paulson
parents: 2533
diff changeset
   354
qed "Spy_not_see_session_key";
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   355
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   356
(**** Authenticity properties for Agents ****)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   357
2481
ee461c8bc9c3 Now uses HPair
paulson
parents: 2455
diff changeset
   358
(*The response never contains Hashes*)
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   359
Goal "[| Hash {|Key (shrK B), M|} \\<in> parts (insert RB H); \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   360
\        (PB,RB,K) \\<in> respond evs |]                      \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   361
\     ==> Hash {|Key (shrK B), M|} \\<in> parts H";
2550
8d8344bcf98a Re-ordering of certificates so that session keys appear in decreasing order
paulson
parents: 2533
diff changeset
   362
by (etac rev_mp 1);
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   363
by (etac (respond_imp_responses RS responses.induct) 1);
4477
b3e5857d8d99 New Auto_tac (by Oheimb), and new syntax (without parens), and expandshort
paulson
parents: 4471
diff changeset
   364
by Auto_tac;
2550
8d8344bcf98a Re-ordering of certificates so that session keys appear in decreasing order
paulson
parents: 2533
diff changeset
   365
qed "Hash_in_parts_respond";
2481
ee461c8bc9c3 Now uses HPair
paulson
parents: 2455
diff changeset
   366
2533
2d5604a51562 Simplified proofs
paulson
parents: 2516
diff changeset
   367
(*Only RA1 or RA2 can have caused such a part of a message to appear.
2d5604a51562 Simplified proofs
paulson
parents: 2516
diff changeset
   368
  This result is of no use to B, who cannot verify the Hash.  Moreover,
2d5604a51562 Simplified proofs
paulson
parents: 2516
diff changeset
   369
  it can say nothing about how recent A's message is.  It might later be
2d5604a51562 Simplified proofs
paulson
parents: 2516
diff changeset
   370
  used to prove B's presence to A at the run's conclusion.*)
5076
fbc9d95b62ba Ran isatool fixgoal
paulson
parents: 4831
diff changeset
   371
Goalw [HPair_def]
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   372
 "[| Hash {|Key(shrK A), Agent A, Agent B, NA, P|} \\<in> parts(spies evs); \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   373
\        A \\<notin> bad;  evs \\<in> recur |]                      \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   374
\  ==> Says A B (Hash[Key(shrK A)] {|Agent A, Agent B, NA, P|}) \\<in> set evs";
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   375
by (etac rev_mp 1);
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
   376
by (parts_induct_tac 1);
5359
bd539b72d484 Tidying
paulson
parents: 5351
diff changeset
   377
by (Blast_tac 1);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   378
(*RA3*)
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   379
by (blast_tac (claset() addSDs [Hash_in_parts_respond]) 1);
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   380
qed_spec_mp "Hash_auth_sender";
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   381
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
   382
(** These two results subsume (for all agents) the guarantees proved
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   383
    separately for A and B in the Otway-Rees protocol.
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   384
**)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   385
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
   386
2533
2d5604a51562 Simplified proofs
paulson
parents: 2516
diff changeset
   387
(*Certificates can only originate with the Server.*)
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   388
Goal "[| Crypt (shrK A) Y \\<in> parts (spies evs);    \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   389
\        A \\<notin> bad;  evs \\<in> recur |]                \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   390
\     ==> \\<exists>C RC. Says Server C RC \\<in> set evs  &  \
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 10833
diff changeset
   391
\                  Crypt (shrK A) Y \\<in> parts {RC}";
2550
8d8344bcf98a Re-ordering of certificates so that session keys appear in decreasing order
paulson
parents: 2533
diff changeset
   392
by (etac rev_mp 1);
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3516
diff changeset
   393
by (parts_induct_tac 1);
5359
bd539b72d484 Tidying
paulson
parents: 5351
diff changeset
   394
by (Blast_tac 1);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   395
(*RA4*)
3121
cbb6c0c1c58a Conversion to use blast_tac (with other improvements)
paulson
parents: 2637
diff changeset
   396
by (Blast_tac 4);
2455
9c4444bfd44e Simplification and generalization of the guarantees.
paulson
parents: 2451
diff changeset
   397
(*RA3*)
4091
771b1f6422a8 isatool fixclasimp;
wenzelm
parents: 3961
diff changeset
   398
by (full_simp_tac (simpset() addsimps [parts_insert_spies]) 3
3121
cbb6c0c1c58a Conversion to use blast_tac (with other improvements)
paulson
parents: 2637
diff changeset
   399
    THEN Blast_tac 3);
2455
9c4444bfd44e Simplification and generalization of the guarantees.
paulson
parents: 2451
diff changeset
   400
(*RA1*)
3121
cbb6c0c1c58a Conversion to use blast_tac (with other improvements)
paulson
parents: 2637
diff changeset
   401
by (Blast_tac 1);
2451
ce85a2aafc7a Extensive tidying and simplification, largely stemming from
paulson
parents: 2449
diff changeset
   402
(*RA2: it cannot be a new Nonce, contradiction.*)
3121
cbb6c0c1c58a Conversion to use blast_tac (with other improvements)
paulson
parents: 2637
diff changeset
   403
by (Blast_tac 1);
2550
8d8344bcf98a Re-ordering of certificates so that session keys appear in decreasing order
paulson
parents: 2533
diff changeset
   404
qed "Cert_imp_Server_msg";