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