src/HOL/Auth/Kerberos_BAN.thy
author chaieb
Sat Oct 20 12:09:33 2007 +0200 (2007-10-20)
changeset 25112 98824cc791c0
parent 23746 a455e69c31cc
child 25134 3d4953e88449
permissions -rw-r--r--
fixed proofs
paulson@5053
     1
(*  Title:      HOL/Auth/Kerberos_BAN
paulson@5053
     2
    ID:         $Id$
paulson@5053
     3
    Author:     Giampaolo Bella, Cambridge University Computer Laboratory
paulson@5053
     4
    Copyright   1998  University of Cambridge
paulson@5053
     5
*)
paulson@5053
     6
paulson@14207
     7
header{*The Kerberos Protocol, BAN Version*}
paulson@14207
     8
haftmann@16417
     9
theory Kerberos_BAN imports Public begin
paulson@5053
    10
paulson@14207
    11
text{*From page 251 of
paulson@14207
    12
  Burrows, Abadi and Needham (1989).  A Logic of Authentication.
paulson@14207
    13
  Proc. Royal Soc. 426
paulson@14207
    14
paulson@18886
    15
  Confidentiality (secrecy) and authentication properties are also
paulson@18886
    16
  given in a termporal version: strong guarantees in a little abstracted 
paulson@18886
    17
  - but very realistic - model.
paulson@14207
    18
*}
paulson@14207
    19
paulson@18886
    20
(* Temporal model of accidents: session keys can be leaked
paulson@18886
    21
                                ONLY when they have expired *)
paulson@5053
    22
paulson@5053
    23
consts
paulson@5053
    24
paulson@5053
    25
    (*Duration of the session key*)
paulson@18886
    26
    sesKlife   :: nat
paulson@5053
    27
paulson@5053
    28
    (*Duration of the authenticator*)
paulson@18886
    29
    authlife :: nat
paulson@5053
    30
paulson@14126
    31
text{*The ticket should remain fresh for two journeys on the network at least*}
paulson@18886
    32
specification (sesKlife)
paulson@18886
    33
  sesKlife_LB [iff]: "2 \<le> sesKlife"
paulson@14126
    34
    by blast
paulson@5053
    35
paulson@14126
    36
text{*The authenticator only for one journey*}
paulson@18886
    37
specification (authlife)
paulson@18886
    38
  authlife_LB [iff]:    "0 < authlife"
paulson@14126
    39
    by blast
paulson@14126
    40
wenzelm@20768
    41
abbreviation
wenzelm@21404
    42
  CT :: "event list=>nat" where
wenzelm@20768
    43
  "CT == length "
paulson@14207
    44
wenzelm@21404
    45
abbreviation
wenzelm@21404
    46
  expiredK :: "[nat, event list] => bool" where
wenzelm@20768
    47
  "expiredK T evs == sesKlife + T < CT evs"
paulson@18886
    48
wenzelm@21404
    49
abbreviation
wenzelm@21404
    50
  expiredA :: "[nat, event list] => bool" where
wenzelm@20768
    51
  "expiredA T evs == authlife + T < CT evs"
paulson@18886
    52
paulson@18886
    53
paulson@18886
    54
constdefs
paulson@5053
    55
paulson@18886
    56
 (* A is the true creator of X if she has sent X and X never appeared on
paulson@18886
    57
    the trace before this event. Recall that traces grow from head. *)
paulson@18886
    58
  Issues :: "[agent, agent, msg, event list] => bool"
paulson@18886
    59
             ("_ Issues _ with _ on _")
paulson@18886
    60
   "A Issues B with X on evs ==
paulson@18886
    61
      \<exists>Y. Says A B Y \<in> set evs & X \<in> parts {Y} &
paulson@18886
    62
      X \<notin> parts (spies (takeWhile (% z. z  \<noteq> Says A B Y) (rev evs)))"
paulson@5053
    63
paulson@18886
    64
 (* Yields the subtrace of a given trace from its beginning to a given event *)
paulson@18886
    65
  before :: "[event, event list] => event list" ("before _ on _")
paulson@18886
    66
   "before ev on evs ==  takeWhile (% z. z ~= ev) (rev evs)"
paulson@18886
    67
paulson@18886
    68
 (* States than an event really appears only once on a trace *)
paulson@18886
    69
  Unique :: "[event, event list] => bool" ("Unique _ on _")
paulson@18886
    70
   "Unique ev on evs == 
paulson@18886
    71
      ev \<notin> set (tl (dropWhile (% z. z \<noteq> ev) evs))"
paulson@18886
    72
paulson@18886
    73
berghofe@23746
    74
inductive_set bankerberos :: "event list set"
berghofe@23746
    75
 where
paulson@13926
    76
paulson@18886
    77
   Nil:  "[] \<in> bankerberos"
paulson@13926
    78
berghofe@23746
    79
 | Fake: "\<lbrakk> evsf \<in> bankerberos;  X \<in> synth (analz (spies evsf)) \<rbrakk>
paulson@18886
    80
	  \<Longrightarrow> Says Spy B X # evsf \<in> bankerberos"
paulson@13926
    81
paulson@13926
    82
berghofe@23746
    83
 | BK1:  "\<lbrakk> evs1 \<in> bankerberos \<rbrakk>
paulson@18886
    84
	  \<Longrightarrow> Says A Server \<lbrace>Agent A, Agent B\<rbrace> # evs1
paulson@18886
    85
		\<in>  bankerberos"
paulson@18886
    86
paulson@18886
    87
berghofe@23746
    88
 | BK2:  "\<lbrakk> evs2 \<in> bankerberos;  Key K \<notin> used evs2; K \<in> symKeys;
paulson@18886
    89
	     Says A' Server \<lbrace>Agent A, Agent B\<rbrace> \<in> set evs2 \<rbrakk>
paulson@18886
    90
	  \<Longrightarrow> Says Server A
paulson@13926
    91
		(Crypt (shrK A)
paulson@18886
    92
		   \<lbrace>Number (CT evs2), Agent B, Key K,
paulson@18886
    93
		    (Crypt (shrK B) \<lbrace>Number (CT evs2), Agent A, Key K\<rbrace>)\<rbrace>)
paulson@18886
    94
		# evs2 \<in> bankerberos"
paulson@13926
    95
paulson@13926
    96
berghofe@23746
    97
 | BK3:  "\<lbrakk> evs3 \<in> bankerberos;
paulson@18886
    98
	     Says S A (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, Ticket\<rbrace>)
paulson@13926
    99
	       \<in> set evs3;
paulson@18886
   100
	     Says A Server \<lbrace>Agent A, Agent B\<rbrace> \<in> set evs3;
paulson@18886
   101
	     \<not> expiredK Tk evs3 \<rbrakk>
paulson@18886
   102
	  \<Longrightarrow> Says A B \<lbrace>Ticket, Crypt K \<lbrace>Agent A, Number (CT evs3)\<rbrace> \<rbrace>
paulson@18886
   103
	       # evs3 \<in> bankerberos"
paulson@13926
   104
paulson@13926
   105
berghofe@23746
   106
 | BK4:  "\<lbrakk> evs4 \<in> bankerberos;
paulson@18886
   107
	     Says A' B \<lbrace>(Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>),
paulson@18886
   108
			 (Crypt K \<lbrace>Agent A, Number Ta\<rbrace>) \<rbrace>: set evs4;
paulson@18886
   109
	     \<not> expiredK Tk evs4;  \<not> expiredA Ta evs4 \<rbrakk>
paulson@18886
   110
	  \<Longrightarrow> Says B A (Crypt K (Number Ta)) # evs4
paulson@18886
   111
		\<in> bankerberos"
paulson@5053
   112
paulson@13926
   113
	(*Old session keys may become compromised*)
berghofe@23746
   114
 | Oops: "\<lbrakk> evso \<in> bankerberos;
paulson@18886
   115
         Says Server A (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, Ticket\<rbrace>)
paulson@13926
   116
	       \<in> set evso;
paulson@18886
   117
	     expiredK Tk evso \<rbrakk>
paulson@18886
   118
	  \<Longrightarrow> Notes Spy \<lbrace>Number Tk, Key K\<rbrace> # evso \<in> bankerberos"
paulson@13926
   119
paulson@13926
   120
paulson@14207
   121
declare Says_imp_knows_Spy [THEN parts.Inj, dest]
paulson@14200
   122
declare parts.Body [dest]
paulson@14200
   123
declare analz_into_parts [dest]
paulson@14200
   124
declare Fake_parts_insert_in_Un [dest]
paulson@13926
   125
paulson@14207
   126
text{*A "possibility property": there are traces that reach the end.*}
paulson@18886
   127
lemma "\<lbrakk>Key K \<notin> used []; K \<in> symKeys\<rbrakk>
paulson@18886
   128
       \<Longrightarrow> \<exists>Timestamp. \<exists>evs \<in> bankerberos.
paulson@14207
   129
             Says B A (Crypt K (Number Timestamp))
paulson@13926
   130
                  \<in> set evs"
paulson@18886
   131
apply (cut_tac sesKlife_LB)
paulson@13926
   132
apply (intro exI bexI)
paulson@14207
   133
apply (rule_tac [2]
paulson@18886
   134
           bankerberos.Nil [THEN bankerberos.BK1, THEN bankerberos.BK2,
paulson@18886
   135
                             THEN bankerberos.BK3, THEN bankerberos.BK4])
chaieb@25112
   136
apply (possibility, simp_all (no_asm_simp) add: used_Cons neq0_conv)
paulson@13926
   137
done
paulson@13926
   138
paulson@18886
   139
subsection{*Lemmas for reasoning about predicate "Issues"*}
paulson@13926
   140
paulson@18886
   141
lemma spies_Says_rev: "spies (evs @ [Says A B X]) = insert X (spies evs)"
paulson@18886
   142
apply (induct_tac "evs")
paulson@18886
   143
apply (induct_tac [2] "a", auto)
paulson@18886
   144
done
paulson@18886
   145
paulson@18886
   146
lemma spies_Gets_rev: "spies (evs @ [Gets A X]) = spies evs"
paulson@18886
   147
apply (induct_tac "evs")
paulson@18886
   148
apply (induct_tac [2] "a", auto)
paulson@18886
   149
done
paulson@18886
   150
paulson@18886
   151
lemma spies_Notes_rev: "spies (evs @ [Notes A X]) =
paulson@18886
   152
          (if A:bad then insert X (spies evs) else spies evs)"
paulson@18886
   153
apply (induct_tac "evs")
paulson@18886
   154
apply (induct_tac [2] "a", auto)
paulson@18886
   155
done
paulson@18886
   156
paulson@18886
   157
lemma spies_evs_rev: "spies evs = spies (rev evs)"
paulson@18886
   158
apply (induct_tac "evs")
paulson@18886
   159
apply (induct_tac [2] "a")
paulson@18886
   160
apply (simp_all (no_asm_simp) add: spies_Says_rev spies_Gets_rev spies_Notes_rev)
paulson@18886
   161
done
paulson@18886
   162
paulson@18886
   163
lemmas parts_spies_evs_revD2 = spies_evs_rev [THEN equalityD2, THEN parts_mono]
paulson@18886
   164
paulson@18886
   165
lemma spies_takeWhile: "spies (takeWhile P evs) <=  spies evs"
paulson@18886
   166
apply (induct_tac "evs")
paulson@18886
   167
apply (induct_tac [2] "a", auto)
paulson@18886
   168
txt{* Resembles @{text"used_subset_append"} in theory Event.*}
paulson@18886
   169
done
paulson@18886
   170
paulson@18886
   171
lemmas parts_spies_takeWhile_mono = spies_takeWhile [THEN parts_mono]
paulson@18886
   172
paulson@18886
   173
paulson@18886
   174
text{*Lemmas for reasoning about predicate "before"*}
paulson@18886
   175
lemma used_Says_rev: "used (evs @ [Says A B X]) = parts {X} \<union> (used evs)";
paulson@18886
   176
apply (induct_tac "evs")
paulson@18886
   177
apply simp
paulson@18886
   178
apply (induct_tac "a")
paulson@18886
   179
apply auto
paulson@18886
   180
done
paulson@13926
   181
paulson@18886
   182
lemma used_Notes_rev: "used (evs @ [Notes A X]) = parts {X} \<union> (used evs)";
paulson@18886
   183
apply (induct_tac "evs")
paulson@18886
   184
apply simp
paulson@18886
   185
apply (induct_tac "a")
paulson@18886
   186
apply auto
paulson@18886
   187
done
paulson@18886
   188
paulson@18886
   189
lemma used_Gets_rev: "used (evs @ [Gets B X]) = used evs";
paulson@18886
   190
apply (induct_tac "evs")
paulson@18886
   191
apply simp
paulson@18886
   192
apply (induct_tac "a")
paulson@18886
   193
apply auto
paulson@18886
   194
done
paulson@18886
   195
paulson@18886
   196
lemma used_evs_rev: "used evs = used (rev evs)"
paulson@18886
   197
apply (induct_tac "evs")
paulson@18886
   198
apply simp
paulson@18886
   199
apply (induct_tac "a")
paulson@18886
   200
apply (simp add: used_Says_rev)
paulson@18886
   201
apply (simp add: used_Gets_rev)
paulson@18886
   202
apply (simp add: used_Notes_rev)
paulson@18886
   203
done
paulson@18886
   204
paulson@18886
   205
lemma used_takeWhile_used [rule_format]: 
paulson@18886
   206
      "x : used (takeWhile P X) --> x : used X"
paulson@18886
   207
apply (induct_tac "X")
paulson@18886
   208
apply simp
paulson@18886
   209
apply (induct_tac "a")
paulson@18886
   210
apply (simp_all add: used_Nil)
paulson@18886
   211
apply (blast dest!: initState_into_used)+
paulson@18886
   212
done
paulson@18886
   213
paulson@18886
   214
lemma set_evs_rev: "set evs = set (rev evs)"
paulson@18886
   215
apply auto
paulson@18886
   216
done
paulson@18886
   217
paulson@18886
   218
lemma takeWhile_void [rule_format]:
paulson@18886
   219
      "x \<notin> set evs \<longrightarrow> takeWhile (\<lambda>z. z \<noteq> x) evs = evs"
paulson@18886
   220
apply auto
paulson@18886
   221
done
paulson@18886
   222
paulson@18886
   223
(**** Inductive proofs about bankerberos ****)
paulson@18886
   224
paulson@18886
   225
text{*Forwarding Lemma for reasoning about the encrypted portion of message BK3*}
paulson@18886
   226
lemma BK3_msg_in_parts_spies:
paulson@18886
   227
     "Says S A (Crypt KA \<lbrace>Timestamp, B, K, X\<rbrace>) \<in> set evs
paulson@18886
   228
      \<Longrightarrow> X \<in> parts (spies evs)"
paulson@18886
   229
apply blast
paulson@18886
   230
done
paulson@14207
   231
paulson@13926
   232
lemma Oops_parts_spies:
paulson@18886
   233
     "Says Server A (Crypt (shrK A) \<lbrace>Timestamp, B, K, X\<rbrace>) \<in> set evs
paulson@18886
   234
      \<Longrightarrow> K \<in> parts (spies evs)"
paulson@18886
   235
apply blast
paulson@18886
   236
done
paulson@13926
   237
paulson@14207
   238
text{*Spy never sees another agent's shared key! (unless it's bad at start)*}
paulson@13926
   239
lemma Spy_see_shrK [simp]:
paulson@18886
   240
     "evs \<in> bankerberos \<Longrightarrow> (Key (shrK A) \<in> parts (spies evs)) = (A \<in> bad)"
paulson@18886
   241
apply (erule bankerberos.induct)
paulson@14207
   242
apply (frule_tac [7] Oops_parts_spies)
paulson@18886
   243
apply (frule_tac [5] BK3_msg_in_parts_spies, simp_all, blast+)
paulson@13926
   244
done
paulson@5053
   245
paulson@5053
   246
paulson@13926
   247
lemma Spy_analz_shrK [simp]:
paulson@18886
   248
     "evs \<in> bankerberos \<Longrightarrow> (Key (shrK A) \<in> analz (spies evs)) = (A \<in> bad)"
paulson@18886
   249
apply auto
paulson@18886
   250
done
paulson@13926
   251
paulson@13926
   252
lemma Spy_see_shrK_D [dest!]:
paulson@18886
   253
     "\<lbrakk> Key (shrK A) \<in> parts (spies evs);
paulson@18886
   254
                evs \<in> bankerberos \<rbrakk> \<Longrightarrow> A:bad"
paulson@18886
   255
apply (blast dest: Spy_see_shrK)
paulson@18886
   256
done
paulson@13926
   257
paulson@13926
   258
lemmas Spy_analz_shrK_D = analz_subset_parts [THEN subsetD, THEN Spy_see_shrK_D,  dest!]
paulson@13926
   259
paulson@13926
   260
paulson@14207
   261
text{*Nobody can have used non-existent keys!*}
paulson@14207
   262
lemma new_keys_not_used [simp]:
paulson@18886
   263
    "\<lbrakk>Key K \<notin> used evs; K \<in> symKeys; evs \<in> bankerberos\<rbrakk>
paulson@18886
   264
     \<Longrightarrow> K \<notin> keysFor (parts (spies evs))"
paulson@14207
   265
apply (erule rev_mp)
paulson@18886
   266
apply (erule bankerberos.induct)
paulson@14207
   267
apply (frule_tac [7] Oops_parts_spies)
paulson@18886
   268
apply (frule_tac [5] BK3_msg_in_parts_spies, simp_all)
paulson@14207
   269
txt{*Fake*}
paulson@13926
   270
apply (force dest!: keysFor_parts_insert)
paulson@18886
   271
txt{*BK2, BK3, BK4*}
paulson@14207
   272
apply (force dest!: analz_shrK_Decrypt)+
paulson@13926
   273
done
paulson@13926
   274
paulson@14207
   275
subsection{* Lemmas concerning the form of items passed in messages *}
paulson@13926
   276
paulson@14207
   277
text{*Describes the form of K, X and K' when the Server sends this message.*}
paulson@13926
   278
lemma Says_Server_message_form:
paulson@18886
   279
     "\<lbrakk> Says Server A (Crypt K' \<lbrace>Number Tk, Agent B, Key K, Ticket\<rbrace>)
paulson@18886
   280
         \<in> set evs; evs \<in> bankerberos \<rbrakk>
paulson@18886
   281
      \<Longrightarrow> K' = shrK A & K \<notin> range shrK &
paulson@18886
   282
          Ticket = (Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>) &
paulson@18886
   283
          Key K \<notin> used(before
paulson@18886
   284
                  Says Server A (Crypt K' \<lbrace>Number Tk, Agent B, Key K, Ticket\<rbrace>)
paulson@18886
   285
                  on evs) &
paulson@18886
   286
          Tk = CT(before 
paulson@18886
   287
                  Says Server A (Crypt K' \<lbrace>Number Tk, Agent B, Key K, Ticket\<rbrace>)
paulson@18886
   288
                  on evs)"
paulson@18886
   289
apply (unfold before_def)
paulson@13926
   290
apply (erule rev_mp)
paulson@18886
   291
apply (erule bankerberos.induct, simp_all)
paulson@18886
   292
txt{*We need this simplification only for Message 2*}
paulson@18886
   293
apply (simp (no_asm) add: takeWhile_tail)
paulson@18886
   294
apply auto
paulson@18886
   295
txt{*Two subcases of Message 2. Subcase: used before*}
paulson@18886
   296
apply (blast dest: used_evs_rev [THEN equalityD2, THEN contra_subsetD] 
paulson@18886
   297
                   used_takeWhile_used)
paulson@18886
   298
txt{*subcase: CT before*}
paulson@18886
   299
apply (fastsimp dest!: set_evs_rev [THEN equalityD2, THEN contra_subsetD, THEN takeWhile_void])
paulson@13926
   300
done
paulson@5053
   301
paulson@5053
   302
paulson@14207
   303
text{*If the encrypted message appears then it originated with the Server
paulson@13926
   304
  PROVIDED that A is NOT compromised!
paulson@18886
   305
  This allows A to verify freshness of the session key.
paulson@14207
   306
*}
paulson@18886
   307
lemma Kab_authentic:
paulson@18886
   308
     "\<lbrakk> Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, X\<rbrace>
paulson@14207
   309
           \<in> parts (spies evs);
paulson@18886
   310
         A \<notin> bad;  evs \<in> bankerberos \<rbrakk>
paulson@18886
   311
       \<Longrightarrow> Says Server A (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, X\<rbrace>)
paulson@13926
   312
             \<in> set evs"
paulson@13926
   313
apply (erule rev_mp)
paulson@18886
   314
apply (erule bankerberos.induct)
paulson@14207
   315
apply (frule_tac [7] Oops_parts_spies)
paulson@18886
   316
apply (frule_tac [5] BK3_msg_in_parts_spies, simp_all, blast)
paulson@13926
   317
done
paulson@13926
   318
paulson@13926
   319
paulson@14207
   320
text{*If the TICKET appears then it originated with the Server*}
paulson@14207
   321
text{*FRESHNESS OF THE SESSION KEY to B*}
paulson@18886
   322
lemma ticket_authentic:
paulson@18886
   323
     "\<lbrakk> Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace> \<in> parts (spies evs);
paulson@18886
   324
         B \<notin> bad;  evs \<in> bankerberos \<rbrakk>
paulson@18886
   325
       \<Longrightarrow> Says Server A
paulson@18886
   326
            (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K,
paulson@18886
   327
                          Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>\<rbrace>)
paulson@13926
   328
           \<in> set evs"
paulson@13926
   329
apply (erule rev_mp)
paulson@18886
   330
apply (erule bankerberos.induct)
paulson@14207
   331
apply (frule_tac [7] Oops_parts_spies)
paulson@18886
   332
apply (frule_tac [5] BK3_msg_in_parts_spies, simp_all, blast)
paulson@13926
   333
done
paulson@13926
   334
paulson@13926
   335
paulson@14207
   336
text{*EITHER describes the form of X when the following message is sent,
paulson@13926
   337
  OR     reduces it to the Fake case.
paulson@14207
   338
  Use @{text Says_Server_message_form} if applicable.*}
paulson@13926
   339
lemma Says_S_message_form:
paulson@18886
   340
     "\<lbrakk> Says S A (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, X\<rbrace>)
paulson@14207
   341
            \<in> set evs;
paulson@18886
   342
         evs \<in> bankerberos \<rbrakk>
paulson@18886
   343
 \<Longrightarrow> (K \<notin> range shrK & X = (Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>))
paulson@13926
   344
          | X \<in> analz (spies evs)"
paulson@13926
   345
apply (case_tac "A \<in> bad")
paulson@13926
   346
apply (force dest!: Says_imp_spies [THEN analz.Inj])
paulson@13926
   347
apply (frule Says_imp_spies [THEN parts.Inj])
paulson@18886
   348
apply (blast dest!: Kab_authentic Says_Server_message_form)
paulson@13926
   349
done
paulson@13926
   350
paulson@5053
   351
paulson@5053
   352
paulson@13926
   353
(****
paulson@13926
   354
 The following is to prove theorems of the form
paulson@13926
   355
paulson@18886
   356
  Key K \<in> analz (insert (Key KAB) (spies evs)) \<Longrightarrow>
paulson@13926
   357
  Key K \<in> analz (spies evs)
paulson@13926
   358
paulson@13926
   359
 A more general formula must be proved inductively.
paulson@13926
   360
paulson@13926
   361
****)
paulson@13926
   362
paulson@14207
   363
text{* Session keys are not used to encrypt other session keys *}
paulson@13926
   364
lemma analz_image_freshK [rule_format (no_asm)]:
paulson@18886
   365
     "evs \<in> bankerberos \<Longrightarrow>
paulson@18886
   366
   \<forall>K KK. KK \<subseteq> - (range shrK) \<longrightarrow>
paulson@14207
   367
          (Key K \<in> analz (Key`KK Un (spies evs))) =
paulson@13926
   368
          (K \<in> KK | Key K \<in> analz (spies evs))"
paulson@18886
   369
apply (erule bankerberos.induct)
paulson@13926
   370
apply (drule_tac [7] Says_Server_message_form)
paulson@14207
   371
apply (erule_tac [5] Says_S_message_form [THEN disjE], analz_freshK, spy_analz, auto) 
paulson@13926
   372
done
paulson@13926
   373
paulson@13926
   374
paulson@13926
   375
lemma analz_insert_freshK:
paulson@18886
   376
     "\<lbrakk> evs \<in> bankerberos;  KAB \<notin> range shrK \<rbrakk> \<Longrightarrow>
paulson@14207
   377
      (Key K \<in> analz (insert (Key KAB) (spies evs))) =
paulson@13926
   378
      (K = KAB | Key K \<in> analz (spies evs))"
paulson@18886
   379
apply (simp only: analz_image_freshK analz_image_freshK_simps)
paulson@18886
   380
done
paulson@13926
   381
paulson@14207
   382
text{* The session key K uniquely identifies the message *}
paulson@13926
   383
lemma unique_session_keys:
paulson@18886
   384
     "\<lbrakk> Says Server A
paulson@18886
   385
           (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, X\<rbrace>) \<in> set evs;
paulson@14207
   386
         Says Server A'
paulson@18886
   387
          (Crypt (shrK A') \<lbrace>Number Tk', Agent B', Key K, X'\<rbrace>) \<in> set evs;
paulson@18886
   388
         evs \<in> bankerberos \<rbrakk> \<Longrightarrow> A=A' & Tk=Tk' & B=B' & X = X'"
paulson@13926
   389
apply (erule rev_mp)
paulson@13926
   390
apply (erule rev_mp)
paulson@18886
   391
apply (erule bankerberos.induct)
paulson@14207
   392
apply (frule_tac [7] Oops_parts_spies)
paulson@18886
   393
apply (frule_tac [5] BK3_msg_in_parts_spies, simp_all)
paulson@18886
   394
txt{*BK2: it can't be a new key*}
paulson@18886
   395
apply blast
paulson@18886
   396
done
paulson@18886
   397
paulson@18886
   398
lemma Server_Unique:
paulson@18886
   399
     "\<lbrakk> Says Server A
paulson@18886
   400
            (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, Ticket\<rbrace>) \<in> set evs;
paulson@18886
   401
        evs \<in> bankerberos \<rbrakk> \<Longrightarrow> 
paulson@18886
   402
   Unique Says Server A (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, Ticket\<rbrace>)
paulson@18886
   403
   on evs"
paulson@18886
   404
apply (erule rev_mp, erule bankerberos.induct, simp_all add: Unique_def)
paulson@13926
   405
apply blast
paulson@13926
   406
done
paulson@13926
   407
paulson@13926
   408
paulson@18886
   409
subsection{*Non-temporal guarantees, explicitly relying on non-occurrence of
paulson@18886
   410
oops events - refined below by temporal guarantees*}
paulson@18886
   411
paulson@18886
   412
text{*Non temporal treatment of confidentiality*}
paulson@18886
   413
paulson@18886
   414
text{* Lemma: the session key sent in msg BK2 would be lost by oops
paulson@14207
   415
    if the spy could see it! *}
paulson@18886
   416
lemma lemma_conf [rule_format (no_asm)]:
paulson@18886
   417
     "\<lbrakk> A \<notin> bad;  B \<notin> bad;  evs \<in> bankerberos \<rbrakk>
paulson@18886
   418
  \<Longrightarrow> Says Server A
paulson@18886
   419
          (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K,
paulson@18886
   420
                            Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>\<rbrace>)
paulson@18886
   421
         \<in> set evs \<longrightarrow>
paulson@18886
   422
      Key K \<in> analz (spies evs) \<longrightarrow> Notes Spy \<lbrace>Number Tk, Key K\<rbrace> \<in> set evs"
paulson@18886
   423
apply (erule bankerberos.induct)
paulson@18886
   424
apply (frule_tac [7] Says_Server_message_form)
paulson@18886
   425
apply (frule_tac [5] Says_S_message_form [THEN disjE])
paulson@18886
   426
apply (simp_all (no_asm_simp) add: analz_insert_eq analz_insert_freshK pushes)
paulson@18886
   427
txt{*Fake*}
paulson@18886
   428
apply spy_analz
paulson@18886
   429
txt{*BK2*}
paulson@18886
   430
apply (blast intro: parts_insertI)
paulson@18886
   431
txt{*BK3*}
paulson@18886
   432
apply (case_tac "Aa \<in> bad")
paulson@18886
   433
 prefer 2 apply (blast dest: Kab_authentic unique_session_keys)
paulson@18886
   434
apply (blast dest: Says_imp_spies [THEN analz.Inj] Crypt_Spy_analz_bad elim!: MPair_analz)
paulson@18886
   435
txt{*Oops*}
paulson@18886
   436
apply (blast dest: unique_session_keys)
paulson@18886
   437
done
paulson@18886
   438
paulson@18886
   439
paulson@18886
   440
text{*Confidentiality for the Server: Spy does not see the keys sent in msg BK2
paulson@18886
   441
as long as they have not expired.*}
paulson@18886
   442
lemma Confidentiality_S:
paulson@18886
   443
     "\<lbrakk> Says Server A
paulson@18886
   444
          (Crypt K' \<lbrace>Number Tk, Agent B, Key K, Ticket\<rbrace>) \<in> set evs;
paulson@18886
   445
        Notes Spy \<lbrace>Number Tk, Key K\<rbrace> \<notin> set evs;
paulson@18886
   446
         A \<notin> bad;  B \<notin> bad;  evs \<in> bankerberos
paulson@18886
   447
      \<rbrakk> \<Longrightarrow> Key K \<notin> analz (spies evs)"
paulson@18886
   448
apply (frule Says_Server_message_form, assumption)
paulson@18886
   449
apply (blast intro: lemma_conf)
paulson@18886
   450
done
paulson@18886
   451
paulson@18886
   452
text{*Confidentiality for Alice*}
paulson@18886
   453
lemma Confidentiality_A:
paulson@18886
   454
     "\<lbrakk> Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, X\<rbrace> \<in> parts (spies evs);
paulson@18886
   455
        Notes Spy \<lbrace>Number Tk, Key K\<rbrace> \<notin> set evs;
paulson@18886
   456
        A \<notin> bad;  B \<notin> bad;  evs \<in> bankerberos
paulson@18886
   457
      \<rbrakk> \<Longrightarrow> Key K \<notin> analz (spies evs)"
paulson@18886
   458
apply (blast dest!: Kab_authentic Confidentiality_S)
paulson@18886
   459
done
paulson@18886
   460
paulson@18886
   461
text{*Confidentiality for Bob*}
paulson@18886
   462
lemma Confidentiality_B:
paulson@18886
   463
     "\<lbrakk> Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>
paulson@18886
   464
          \<in> parts (spies evs);
paulson@18886
   465
        Notes Spy \<lbrace>Number Tk, Key K\<rbrace> \<notin> set evs;
paulson@18886
   466
        A \<notin> bad;  B \<notin> bad;  evs \<in> bankerberos
paulson@18886
   467
      \<rbrakk> \<Longrightarrow> Key K \<notin> analz (spies evs)"
paulson@18886
   468
apply (blast dest!: ticket_authentic Confidentiality_S)
paulson@18886
   469
done
paulson@18886
   470
paulson@18886
   471
text{*Non temporal treatment of authentication*}
paulson@13926
   472
paulson@18886
   473
text{*Lemmas @{text lemma_A} and @{text lemma_B} in fact are common to both temporal and non-temporal treatments*}
paulson@18886
   474
lemma lemma_A [rule_format]:
paulson@18886
   475
     "\<lbrakk> A \<notin> bad; B \<notin> bad; evs \<in> bankerberos \<rbrakk>
paulson@18886
   476
      \<Longrightarrow>
paulson@18886
   477
         Key K \<notin> analz (spies evs) \<longrightarrow>
paulson@18886
   478
         Says Server A (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, X\<rbrace>)
paulson@18886
   479
         \<in> set evs \<longrightarrow>
paulson@18886
   480
          Crypt K \<lbrace>Agent A, Number Ta\<rbrace> \<in> parts (spies evs) \<longrightarrow>
paulson@18886
   481
         Says A B \<lbrace>X, Crypt K \<lbrace>Agent A, Number Ta\<rbrace>\<rbrace>
paulson@18886
   482
             \<in> set evs"
paulson@18886
   483
apply (erule bankerberos.induct)
paulson@18886
   484
apply (frule_tac [7] Oops_parts_spies)
paulson@18886
   485
apply (frule_tac [5] Says_S_message_form)
paulson@18886
   486
apply (frule_tac [6] BK3_msg_in_parts_spies, analz_mono_contra)
paulson@18886
   487
apply (simp_all (no_asm_simp) add: all_conj_distrib)
paulson@18886
   488
txt{*Fake*}
paulson@18886
   489
apply blast
paulson@18886
   490
txt{*BK2*}
paulson@18886
   491
apply (force dest: Crypt_imp_invKey_keysFor)
paulson@18886
   492
txt{*BK3*}
paulson@18886
   493
apply (blast dest: Kab_authentic unique_session_keys)
paulson@18886
   494
done
paulson@18886
   495
lemma lemma_B [rule_format]:
paulson@18886
   496
     "\<lbrakk> B \<notin> bad;  evs \<in> bankerberos \<rbrakk>
paulson@18886
   497
      \<Longrightarrow> Key K \<notin> analz (spies evs) \<longrightarrow>
paulson@18886
   498
          Says Server A (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, X\<rbrace>)
paulson@18886
   499
          \<in> set evs \<longrightarrow>
paulson@18886
   500
          Crypt K (Number Ta) \<in> parts (spies evs) \<longrightarrow>
paulson@18886
   501
          Says B A (Crypt K (Number Ta)) \<in> set evs"
paulson@18886
   502
apply (erule bankerberos.induct)
paulson@18886
   503
apply (frule_tac [7] Oops_parts_spies)
paulson@18886
   504
apply (frule_tac [5] Says_S_message_form)
paulson@18886
   505
apply (drule_tac [6] BK3_msg_in_parts_spies, analz_mono_contra)
paulson@18886
   506
apply (simp_all (no_asm_simp) add: all_conj_distrib)
paulson@18886
   507
txt{*Fake*}
paulson@18886
   508
apply blast
paulson@18886
   509
txt{*BK2*} 
paulson@18886
   510
apply (force dest: Crypt_imp_invKey_keysFor)
paulson@18886
   511
txt{*BK4*}
paulson@18886
   512
apply (blast dest: ticket_authentic unique_session_keys
paulson@18886
   513
                   Says_imp_spies [THEN analz.Inj] Crypt_Spy_analz_bad)
paulson@18886
   514
done
paulson@18886
   515
paulson@18886
   516
paulson@18886
   517
text{*The "r" suffix indicates theorems where the confidentiality assumptions are relaxed by the corresponding arguments.*}
paulson@18886
   518
paulson@18886
   519
paulson@18886
   520
text{*Authentication of A to B*}
paulson@18886
   521
lemma B_authenticates_A_r:
paulson@18886
   522
     "\<lbrakk> Crypt K \<lbrace>Agent A, Number Ta\<rbrace> \<in> parts (spies evs);
paulson@18886
   523
         Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>  \<in> parts (spies evs);
paulson@18886
   524
        Notes Spy \<lbrace>Number Tk, Key K\<rbrace> \<notin> set evs;
paulson@18886
   525
         A \<notin> bad;  B \<notin> bad;  evs \<in> bankerberos \<rbrakk>
paulson@18886
   526
      \<Longrightarrow> Says A B \<lbrace>Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>,
paulson@18886
   527
                     Crypt K \<lbrace>Agent A, Number Ta\<rbrace>\<rbrace> \<in> set evs"
paulson@18886
   528
apply (blast dest!: ticket_authentic
paulson@18886
   529
          intro!: lemma_A
paulson@18886
   530
          elim!: Confidentiality_S [THEN [2] rev_notE])
paulson@18886
   531
done
paulson@18886
   532
paulson@18886
   533
paulson@18886
   534
text{*Authentication of B to A*}
paulson@18886
   535
lemma A_authenticates_B_r:
paulson@18886
   536
     "\<lbrakk> Crypt K (Number Ta) \<in> parts (spies evs);
paulson@18886
   537
        Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, X\<rbrace> \<in> parts (spies evs);
paulson@18886
   538
        Notes Spy \<lbrace>Number Tk, Key K\<rbrace> \<notin> set evs;
paulson@18886
   539
        A \<notin> bad;  B \<notin> bad;  evs \<in> bankerberos \<rbrakk>
paulson@18886
   540
      \<Longrightarrow> Says B A (Crypt K (Number Ta)) \<in> set evs"
paulson@18886
   541
apply (blast dest!: Kab_authentic
paulson@18886
   542
          intro!: lemma_B elim!: Confidentiality_S [THEN [2] rev_notE])
paulson@18886
   543
done
paulson@18886
   544
paulson@18886
   545
lemma B_authenticates_A:
paulson@18886
   546
     "\<lbrakk> Crypt K \<lbrace>Agent A, Number Ta\<rbrace> \<in> parts (spies evs);
paulson@18886
   547
         Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>  \<in> parts (spies evs);
paulson@18886
   548
        Key K \<notin> analz (spies evs);
paulson@18886
   549
         A \<notin> bad;  B \<notin> bad;  evs \<in> bankerberos \<rbrakk>
paulson@18886
   550
      \<Longrightarrow> Says A B \<lbrace>Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>,
paulson@18886
   551
                     Crypt K \<lbrace>Agent A, Number Ta\<rbrace>\<rbrace> \<in> set evs"
paulson@18886
   552
apply (blast dest!: ticket_authentic intro!: lemma_A)
paulson@18886
   553
done
paulson@18886
   554
paulson@18886
   555
lemma A_authenticates_B:
paulson@18886
   556
     "\<lbrakk> Crypt K (Number Ta) \<in> parts (spies evs);
paulson@18886
   557
        Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, X\<rbrace> \<in> parts (spies evs);
paulson@18886
   558
        Key K \<notin> analz (spies evs);
paulson@18886
   559
        A \<notin> bad;  B \<notin> bad;  evs \<in> bankerberos \<rbrakk>
paulson@18886
   560
      \<Longrightarrow> Says B A (Crypt K (Number Ta)) \<in> set evs"
paulson@18886
   561
apply (blast dest!: Kab_authentic intro!: lemma_B)
paulson@18886
   562
done
paulson@18886
   563
paulson@18886
   564
subsection{*Temporal guarantees, relying on a temporal check that insures that
paulson@18886
   565
no oops event occurred. These are available in the sense of goal availability*}
paulson@18886
   566
paulson@18886
   567
paulson@18886
   568
text{*Temporal treatment of confidentiality*}
paulson@18886
   569
paulson@18886
   570
text{* Lemma: the session key sent in msg BK2 would be EXPIRED
paulson@18886
   571
    if the spy could see it! *}
paulson@18886
   572
lemma lemma_conf_temporal [rule_format (no_asm)]:
paulson@18886
   573
     "\<lbrakk> A \<notin> bad;  B \<notin> bad;  evs \<in> bankerberos \<rbrakk>
paulson@18886
   574
  \<Longrightarrow> Says Server A
paulson@18886
   575
          (Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K,
paulson@18886
   576
                            Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>\<rbrace>)
paulson@18886
   577
         \<in> set evs \<longrightarrow>
paulson@18886
   578
      Key K \<in> analz (spies evs) \<longrightarrow> expiredK Tk evs"
paulson@18886
   579
apply (erule bankerberos.induct)
paulson@13926
   580
apply (frule_tac [7] Says_Server_message_form)
paulson@13926
   581
apply (frule_tac [5] Says_S_message_form [THEN disjE])
paulson@13926
   582
apply (simp_all (no_asm_simp) add: less_SucI analz_insert_eq analz_insert_freshK pushes)
paulson@13926
   583
txt{*Fake*}
paulson@13926
   584
apply spy_analz
paulson@18886
   585
txt{*BK2*}
paulson@13926
   586
apply (blast intro: parts_insertI less_SucI)
paulson@18886
   587
txt{*BK3*}
paulson@13926
   588
apply (case_tac "Aa \<in> bad")
paulson@18886
   589
 prefer 2 apply (blast dest: Kab_authentic unique_session_keys)
paulson@13926
   590
apply (blast dest: Says_imp_spies [THEN analz.Inj] Crypt_Spy_analz_bad elim!: MPair_analz intro: less_SucI)
paulson@18886
   591
txt{*Oops: PROOF FAILS if unsafe intro below*}
paulson@13926
   592
apply (blast dest: unique_session_keys intro!: less_SucI)
paulson@13926
   593
done
paulson@5053
   594
paulson@5053
   595
paulson@18886
   596
text{*Confidentiality for the Server: Spy does not see the keys sent in msg BK2
paulson@14207
   597
as long as they have not expired.*}
paulson@18886
   598
lemma Confidentiality_S_temporal:
paulson@18886
   599
     "\<lbrakk> Says Server A
paulson@18886
   600
          (Crypt K' \<lbrace>Number T, Agent B, Key K, X\<rbrace>) \<in> set evs;
paulson@18886
   601
         \<not> expiredK T evs;
paulson@18886
   602
         A \<notin> bad;  B \<notin> bad;  evs \<in> bankerberos
paulson@18886
   603
      \<rbrakk> \<Longrightarrow> Key K \<notin> analz (spies evs)"
paulson@13926
   604
apply (frule Says_Server_message_form, assumption)
paulson@18886
   605
apply (blast intro: lemma_conf_temporal)
paulson@13926
   606
done
paulson@13926
   607
paulson@14207
   608
text{*Confidentiality for Alice*}
paulson@18886
   609
lemma Confidentiality_A_temporal:
paulson@18886
   610
     "\<lbrakk> Crypt (shrK A) \<lbrace>Number T, Agent B, Key K, X\<rbrace> \<in> parts (spies evs);
paulson@18886
   611
         \<not> expiredK T evs;
paulson@18886
   612
         A \<notin> bad;  B \<notin> bad;  evs \<in> bankerberos
paulson@18886
   613
      \<rbrakk> \<Longrightarrow> Key K \<notin> analz (spies evs)"
paulson@18886
   614
apply (blast dest!: Kab_authentic Confidentiality_S_temporal)
paulson@18886
   615
done
paulson@13926
   616
paulson@14207
   617
text{*Confidentiality for Bob*}
paulson@18886
   618
lemma Confidentiality_B_temporal:
paulson@18886
   619
     "\<lbrakk> Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>
paulson@14207
   620
          \<in> parts (spies evs);
paulson@18886
   621
        \<not> expiredK Tk evs;
paulson@18886
   622
        A \<notin> bad;  B \<notin> bad;  evs \<in> bankerberos
paulson@18886
   623
      \<rbrakk> \<Longrightarrow> Key K \<notin> analz (spies evs)"
paulson@18886
   624
apply (blast dest!: ticket_authentic Confidentiality_S_temporal)
paulson@18886
   625
done
paulson@18886
   626
paulson@18886
   627
text{*Temporal treatment of authentication*}
paulson@18886
   628
paulson@18886
   629
text{*Authentication of A to B*}
paulson@18886
   630
lemma B_authenticates_A_temporal:
paulson@18886
   631
     "\<lbrakk> Crypt K \<lbrace>Agent A, Number Ta\<rbrace> \<in> parts (spies evs);
paulson@18886
   632
         Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>
paulson@18886
   633
         \<in> parts (spies evs);
paulson@18886
   634
         \<not> expiredK Tk evs;
paulson@18886
   635
         A \<notin> bad;  B \<notin> bad;  evs \<in> bankerberos \<rbrakk>
paulson@18886
   636
      \<Longrightarrow> Says A B \<lbrace>Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>,
paulson@18886
   637
                     Crypt K \<lbrace>Agent A, Number Ta\<rbrace>\<rbrace> \<in> set evs"
paulson@18886
   638
apply (blast dest!: ticket_authentic
paulson@18886
   639
          intro!: lemma_A
paulson@18886
   640
          elim!: Confidentiality_S_temporal [THEN [2] rev_notE])
paulson@18886
   641
done
paulson@18886
   642
paulson@18886
   643
text{*Authentication of B to A*}
paulson@18886
   644
lemma A_authenticates_B_temporal:
paulson@18886
   645
     "\<lbrakk> Crypt K (Number Ta) \<in> parts (spies evs);
paulson@18886
   646
         Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, X\<rbrace>
paulson@18886
   647
         \<in> parts (spies evs);
paulson@18886
   648
         \<not> expiredK Tk evs;
paulson@18886
   649
         A \<notin> bad;  B \<notin> bad;  evs \<in> bankerberos \<rbrakk>
paulson@18886
   650
      \<Longrightarrow> Says B A (Crypt K (Number Ta)) \<in> set evs"
paulson@18886
   651
apply (blast dest!: Kab_authentic
paulson@18886
   652
          intro!: lemma_B elim!: Confidentiality_S_temporal [THEN [2] rev_notE])
paulson@18886
   653
done
paulson@18886
   654
paulson@18886
   655
subsection{*Treatment of the key distribution goal using trace inspection. All
paulson@18886
   656
guarantees are in non-temporal form, hence non available, though their temporal
paulson@18886
   657
form is trivial to derive. These guarantees also convey a stronger form of 
paulson@18886
   658
authentication - non-injective agreement on the session key*}
paulson@13926
   659
paulson@5053
   660
paulson@18886
   661
lemma B_Issues_A:
paulson@18886
   662
     "\<lbrakk> Says B A (Crypt K (Number Ta)) \<in> set evs;
paulson@18886
   663
         Key K \<notin> analz (spies evs);
paulson@18886
   664
         A \<notin> bad;  B \<notin> bad; evs \<in> bankerberos \<rbrakk>
paulson@18886
   665
      \<Longrightarrow> B Issues A with (Crypt K (Number Ta)) on evs"
paulson@18886
   666
apply (simp (no_asm) add: Issues_def)
paulson@18886
   667
apply (rule exI)
paulson@18886
   668
apply (rule conjI, assumption)
paulson@18886
   669
apply (simp (no_asm))
paulson@18886
   670
apply (erule rev_mp)
paulson@18886
   671
apply (erule rev_mp)
paulson@18886
   672
apply (erule bankerberos.induct, analz_mono_contra)
paulson@18886
   673
apply (simp_all (no_asm_simp))
paulson@18886
   674
txt{*fake*}
paulson@13926
   675
apply blast
paulson@18886
   676
txt{*K4 obviously is the non-trivial case*}
paulson@18886
   677
apply (simp add: takeWhile_tail)
paulson@18886
   678
apply (blast dest: ticket_authentic parts_spies_takeWhile_mono [THEN subsetD] parts_spies_evs_revD2 [THEN subsetD] intro: A_authenticates_B_temporal)
paulson@18886
   679
done
paulson@18886
   680
paulson@18886
   681
lemma A_authenticates_and_keydist_to_B:
paulson@18886
   682
     "\<lbrakk> Crypt K (Number Ta) \<in> parts (spies evs);
paulson@18886
   683
        Crypt (shrK A) \<lbrace>Number Tk, Agent B, Key K, X\<rbrace> \<in> parts (spies evs);
paulson@18886
   684
         Key K \<notin> analz (spies evs);
paulson@18886
   685
         A \<notin> bad;  B \<notin> bad; evs \<in> bankerberos \<rbrakk>
paulson@18886
   686
      \<Longrightarrow> B Issues A with (Crypt K (Number Ta)) on evs"
paulson@18886
   687
apply (blast dest!: A_authenticates_B B_Issues_A)
paulson@13926
   688
done
paulson@13926
   689
paulson@13926
   690
paulson@18886
   691
lemma A_Issues_B:
paulson@18886
   692
     "\<lbrakk> Says A B \<lbrace>Ticket, Crypt K \<lbrace>Agent A, Number Ta\<rbrace>\<rbrace>
paulson@18886
   693
           \<in> set evs;
paulson@18886
   694
         Key K \<notin> analz (spies evs);
paulson@18886
   695
         A \<notin> bad;  B \<notin> bad;  evs \<in> bankerberos \<rbrakk>
paulson@18886
   696
   \<Longrightarrow> A Issues B with (Crypt K \<lbrace>Agent A, Number Ta\<rbrace>) on evs"
paulson@18886
   697
apply (simp (no_asm) add: Issues_def)
paulson@18886
   698
apply (rule exI)
paulson@18886
   699
apply (rule conjI, assumption)
paulson@18886
   700
apply (simp (no_asm))
paulson@18886
   701
apply (erule rev_mp)
paulson@18886
   702
apply (erule rev_mp)
paulson@18886
   703
apply (erule bankerberos.induct, analz_mono_contra)
paulson@18886
   704
apply (simp_all (no_asm_simp))
paulson@18886
   705
txt{*fake*}
paulson@13926
   706
apply blast
paulson@18886
   707
txt{*K3 is the non trivial case*}
paulson@18886
   708
apply (simp add: takeWhile_tail)
paulson@18886
   709
apply auto (*Technically unnecessary, merely clarifies the subgoal as it is presemted in the book*)
paulson@18886
   710
apply (blast dest: Kab_authentic Says_Server_message_form parts_spies_takeWhile_mono [THEN subsetD] parts_spies_evs_revD2 [THEN subsetD] 
paulson@18886
   711
             intro!: B_authenticates_A)
paulson@13926
   712
done
paulson@13926
   713
paulson@18886
   714
paulson@18886
   715
lemma B_authenticates_and_keydist_to_A:
paulson@18886
   716
     "\<lbrakk> Crypt K \<lbrace>Agent A, Number Ta\<rbrace> \<in> parts (spies evs);
paulson@18886
   717
        Crypt (shrK B) \<lbrace>Number Tk, Agent A, Key K\<rbrace>  \<in> parts (spies evs);
paulson@18886
   718
        Key K \<notin> analz (spies evs);
paulson@18886
   719
        A \<notin> bad;  B \<notin> bad;  evs \<in> bankerberos \<rbrakk>
paulson@18886
   720
   \<Longrightarrow> A Issues B with (Crypt K \<lbrace>Agent A, Number Ta\<rbrace>) on evs"
paulson@18886
   721
apply (blast dest: B_authenticates_A A_Issues_B)
paulson@18886
   722
done
paulson@18886
   723
paulson@18886
   724
paulson@18886
   725
paulson@5053
   726
paulson@5053
   727
end