src/HOL/Auth/NS_Shared.thy
author wenzelm
Fri, 17 Nov 2006 02:20:03 +0100
changeset 21404 eb85850d3eb7
parent 18886 9f27383426db
child 23746 a455e69c31cc
permissions -rw-r--r--
more robust syntax for definition/abbreviation/notation;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     1
(*  Title:      HOL/Auth/NS_Shared
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     2
    ID:         $Id$
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
     3
    Author:     Lawrence C Paulson and Giampaolo Bella 
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     4
    Copyright   1996  University of Cambridge
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     5
*)
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
     6
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
     7
header{*Needham-Schroeder Shared-Key Protocol and the Issues Property*}
14207
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
     8
16417
9bc16273c2d4 migrated theory headers to new format
haftmann
parents: 14207
diff changeset
     9
theory NS_Shared imports Public begin
14207
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
    10
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
    11
text{*
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
    12
From page 247 of
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
    13
  Burrows, Abadi and Needham (1989).  A Logic of Authentication.
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
    14
  Proc. Royal Soc. 426
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
    15
*}
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    16
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
    17
constdefs
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
    18
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
    19
 (* A is the true creator of X if she has sent X and X never appeared on
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
    20
    the trace before this event. Recall that traces grow from head. *)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
    21
  Issues :: "[agent, agent, msg, event list] => bool"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
    22
             ("_ Issues _ with _ on _")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
    23
   "A Issues B with X on evs ==
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
    24
      \<exists>Y. Says A B Y \<in> set evs & X \<in> parts {Y} &
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
    25
      X \<notin> parts (spies (takeWhile (% z. z  \<noteq> Says A B Y) (rev evs)))"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
    26
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
    27
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    28
consts  ns_shared   :: "event list set"
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3465
diff changeset
    29
inductive "ns_shared"
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    30
 intros
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    31
	(*Initial trace is empty*)
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
    32
  Nil:  "[] \<in> ns_shared"
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    33
	(*The spy MAY say anything he CAN say.  We do not expect him to
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    34
	  invent new nonces here, but he can also use NS1.  Common to
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    35
	  all similar protocols.*)
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
    36
  Fake: "\<lbrakk>evsf \<in> ns_shared;  X \<in> synth (analz (spies evsf))\<rbrakk>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
    37
	 \<Longrightarrow> Says Spy B X # evsf \<in> ns_shared"
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    38
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    39
	(*Alice initiates a protocol run, requesting to talk to any B*)
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
    40
  NS1:  "\<lbrakk>evs1 \<in> ns_shared;  Nonce NA \<notin> used evs1\<rbrakk>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
    41
	 \<Longrightarrow> Says A Server \<lbrace>Agent A, Agent B, Nonce NA\<rbrace> # evs1  \<in>  ns_shared"
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    42
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    43
	(*Server's response to Alice's message.
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    44
	  !! It may respond more than once to A's request !!
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    45
	  Server doesn't know who the true sender is, hence the A' in
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    46
	      the sender field.*)
14207
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
    47
  NS2:  "\<lbrakk>evs2 \<in> ns_shared;  Key KAB \<notin> used evs2;  KAB \<in> symKeys;
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
    48
	  Says A' Server \<lbrace>Agent A, Agent B, Nonce NA\<rbrace> \<in> set evs2\<rbrakk>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
    49
	 \<Longrightarrow> Says Server A
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    50
	       (Crypt (shrK A)
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
    51
		  \<lbrace>Nonce NA, Agent B, Key KAB,
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
    52
		    (Crypt (shrK B) \<lbrace>Key KAB, Agent A\<rbrace>)\<rbrace>)
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
    53
	       # evs2 \<in> ns_shared"
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    54
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    55
	 (*We can't assume S=Server.  Agent A "remembers" her nonce.
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
    56
	   Need A \<noteq> Server because we allow messages to self.*)
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
    57
  NS3:  "\<lbrakk>evs3 \<in> ns_shared;  A \<noteq> Server;
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
    58
	  Says S A (Crypt (shrK A) \<lbrace>Nonce NA, Agent B, Key K, X\<rbrace>) \<in> set evs3;
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
    59
	  Says A Server \<lbrace>Agent A, Agent B, Nonce NA\<rbrace> \<in> set evs3\<rbrakk>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
    60
	 \<Longrightarrow> Says A B X # evs3 \<in> ns_shared"
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    61
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    62
	(*Bob's nonce exchange.  He does not know who the message came
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    63
	  from, but responds to A because she is mentioned inside.*)
14207
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
    64
  NS4:  "\<lbrakk>evs4 \<in> ns_shared;  Nonce NB \<notin> used evs4;  K \<in> symKeys;
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
    65
	  Says A' B (Crypt (shrK B) \<lbrace>Key K, Agent A\<rbrace>) \<in> set evs4\<rbrakk>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
    66
	 \<Longrightarrow> Says B A (Crypt K (Nonce NB)) # evs4 \<in> ns_shared"
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
    67
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    68
	(*Alice responds with Nonce NB if she has seen the key before.
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    69
	  Maybe should somehow check Nonce NA again.
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    70
	  We do NOT send NB-1 or similar as the Spy cannot spoof such things.
11465
45d156ede468 Changed 1 to 1' (= Suc 0)
paulson
parents: 11280
diff changeset
    71
	  Letting the Spy add or subtract 1 lets him send all nonces.
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    72
	  Instead we distinguish the messages by sending the nonce twice.*)
14207
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
    73
  NS5:  "\<lbrakk>evs5 \<in> ns_shared;  K \<in> symKeys;
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
    74
	  Says B' A (Crypt K (Nonce NB)) \<in> set evs5;
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
    75
	  Says S  A (Crypt (shrK A) \<lbrace>Nonce NA, Agent B, Key K, X\<rbrace>)
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
    76
	    \<in> set evs5\<rbrakk>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
    77
	 \<Longrightarrow> Says A B (Crypt K \<lbrace>Nonce NB, Nonce NB\<rbrace>) # evs5 \<in> ns_shared"
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    78
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    79
	(*This message models possible leaks of session keys.
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    80
	  The two Nonces identify the protocol run: the rule insists upon
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    81
	  the true senders in order to make them accurate.*)
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
    82
  Oops: "\<lbrakk>evso \<in> ns_shared;  Says B A (Crypt K (Nonce NB)) \<in> set evso;
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
    83
	  Says Server A (Crypt (shrK A) \<lbrace>Nonce NA, Agent B, Key K, X\<rbrace>)
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
    84
	      \<in> set evso\<rbrakk>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
    85
	 \<Longrightarrow> Notes Spy \<lbrace>Nonce NA, Nonce NB, Key K\<rbrace> # evso \<in> ns_shared"
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    86
11150
67387142225e Streamlining for the bug fix in Blast.
paulson
parents: 11117
diff changeset
    87
67387142225e Streamlining for the bug fix in Blast.
paulson
parents: 11117
diff changeset
    88
declare Says_imp_knows_Spy [THEN parts.Inj, dest]
67387142225e Streamlining for the bug fix in Blast.
paulson
parents: 11117
diff changeset
    89
declare parts.Body  [dest]
11251
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11188
diff changeset
    90
declare Fake_parts_insert_in_Un  [dest]
a6816d47f41d converted many HOL/Auth theories to Isar scripts
paulson
parents: 11188
diff changeset
    91
declare analz_into_parts [dest]
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    92
declare image_eq_UN [simp]  (*accelerates proofs involving nested images*)
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    93
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    94
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
    95
text{*A "possibility property": there are traces that reach the end*}
14207
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
    96
lemma "[| A \<noteq> Server; Key K \<notin> used []; K \<in> symKeys |]
14200
d8598e24f8fa Removal of the Key_supply axiom (affects many possbility proofs) and minor
paulson
parents: 13956
diff changeset
    97
       ==> \<exists>N. \<exists>evs \<in> ns_shared.
d8598e24f8fa Removal of the Key_supply axiom (affects many possbility proofs) and minor
paulson
parents: 13956
diff changeset
    98
                    Says A B (Crypt K \<lbrace>Nonce N, Nonce N\<rbrace>) \<in> set evs"
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
    99
apply (intro exI bexI)
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   100
apply (rule_tac [2] ns_shared.Nil
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   101
       [THEN ns_shared.NS1, THEN ns_shared.NS2, THEN ns_shared.NS3,
14200
d8598e24f8fa Removal of the Key_supply axiom (affects many possbility proofs) and minor
paulson
parents: 13956
diff changeset
   102
	THEN ns_shared.NS4, THEN ns_shared.NS5])
14207
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   103
apply (possibility, simp add: used_Cons)
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   104
done
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   105
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   106
(*This version is similar, while instantiating ?K and ?N to epsilon-terms
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   107
lemma "A \<noteq> Server \<Longrightarrow> \<exists>evs \<in> ns_shared.
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   108
                Says A B (Crypt ?K \<lbrace>Nonce ?N, Nonce ?N\<rbrace>) \<in> set evs"
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   109
*)
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   110
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   111
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   112
subsection{*Inductive proofs about @{term ns_shared}*}
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   113
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   114
subsubsection{*Forwarding lemmas, to aid simplification*}
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   115
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   116
text{*For reasoning about the encrypted portion of message NS3*}
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   117
lemma NS3_msg_in_parts_spies:
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   118
     "Says S A (Crypt KA \<lbrace>N, B, K, X\<rbrace>) \<in> set evs \<Longrightarrow> X \<in> parts (spies evs)"
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   119
by blast
11280
6fdc4c4ccec1 minor tweaks
paulson
parents: 11251
diff changeset
   120
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   121
text{*For reasoning about the Oops message*}
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   122
lemma Oops_parts_spies:
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   123
     "Says Server A (Crypt (shrK A) \<lbrace>NA, B, K, X\<rbrace>) \<in> set evs
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   124
            \<Longrightarrow> K \<in> parts (spies evs)"
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   125
by blast
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   126
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   127
text{*Theorems of the form @{term "X \<notin> parts (spies evs)"} imply that NOBODY
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   128
    sends messages containing @{term X}*}
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   129
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   130
text{*Spy never sees another agent's shared key! (unless it's bad at start)*}
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   131
lemma Spy_see_shrK [simp]:
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   132
     "evs \<in> ns_shared \<Longrightarrow> (Key (shrK A) \<in> parts (spies evs)) = (A \<in> bad)"
13507
febb8e5d2a9d tidying of Isar scripts
paulson
parents: 11655
diff changeset
   133
apply (erule ns_shared.induct, force, drule_tac [4] NS3_msg_in_parts_spies, simp_all, blast+)
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   134
done
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   135
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   136
lemma Spy_analz_shrK [simp]:
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   137
     "evs \<in> ns_shared \<Longrightarrow> (Key (shrK A) \<in> analz (spies evs)) = (A \<in> bad)"
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   138
by auto
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   139
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   140
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   141
text{*Nobody can have used non-existent keys!*}
14207
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   142
lemma new_keys_not_used [simp]:
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   143
    "[|Key K \<notin> used evs; K \<in> symKeys; evs \<in> ns_shared|]
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   144
     ==> K \<notin> keysFor (parts (spies evs))"
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   145
apply (erule rev_mp)
13507
febb8e5d2a9d tidying of Isar scripts
paulson
parents: 11655
diff changeset
   146
apply (erule ns_shared.induct, force, drule_tac [4] NS3_msg_in_parts_spies, simp_all)
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   147
txt{*Fake, NS2, NS4, NS5*}
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   148
apply (force dest!: keysFor_parts_insert, blast+)
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   149
done
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   150
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   151
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   152
subsubsection{*Lemmas concerning the form of items passed in messages*}
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   153
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   154
text{*Describes the form of K, X and K' when the Server sends this message.*}
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   155
lemma Says_Server_message_form:
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   156
     "\<lbrakk>Says Server A (Crypt K' \<lbrace>N, Agent B, Key K, X\<rbrace>) \<in> set evs;
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   157
       evs \<in> ns_shared\<rbrakk>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   158
      \<Longrightarrow> K \<notin> range shrK \<and>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   159
          X = (Crypt (shrK B) \<lbrace>Key K, Agent A\<rbrace>) \<and>
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   160
          K' = shrK A"
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   161
by (erule rev_mp, erule ns_shared.induct, auto)
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   162
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   163
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   164
text{*If the encrypted message appears then it originated with the Server*}
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   165
lemma A_trusts_NS2:
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   166
     "\<lbrakk>Crypt (shrK A) \<lbrace>NA, Agent B, Key K, X\<rbrace> \<in> parts (spies evs);
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   167
       A \<notin> bad;  evs \<in> ns_shared\<rbrakk>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   168
      \<Longrightarrow> Says Server A (Crypt (shrK A) \<lbrace>NA, Agent B, Key K, X\<rbrace>) \<in> set evs"
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   169
apply (erule rev_mp)
13507
febb8e5d2a9d tidying of Isar scripts
paulson
parents: 11655
diff changeset
   170
apply (erule ns_shared.induct, force, drule_tac [4] NS3_msg_in_parts_spies, auto)
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   171
done
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   172
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   173
lemma cert_A_form:
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   174
     "\<lbrakk>Crypt (shrK A) \<lbrace>NA, Agent B, Key K, X\<rbrace> \<in> parts (spies evs);
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   175
       A \<notin> bad;  evs \<in> ns_shared\<rbrakk>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   176
      \<Longrightarrow> K \<notin> range shrK \<and>  X = (Crypt (shrK B) \<lbrace>Key K, Agent A\<rbrace>)"
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   177
by (blast dest!: A_trusts_NS2 Says_Server_message_form)
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   178
14207
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   179
text{*EITHER describes the form of X when the following message is sent,
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   180
  OR     reduces it to the Fake case.
14207
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   181
  Use @{text Says_Server_message_form} if applicable.*}
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   182
lemma Says_S_message_form:
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   183
     "\<lbrakk>Says S A (Crypt (shrK A) \<lbrace>Nonce NA, Agent B, Key K, X\<rbrace>) \<in> set evs;
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   184
       evs \<in> ns_shared\<rbrakk>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   185
      \<Longrightarrow> (K \<notin> range shrK \<and> X = (Crypt (shrK B) \<lbrace>Key K, Agent A\<rbrace>))
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   186
          \<or> X \<in> analz (spies evs)"
14207
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   187
by (blast dest: Says_imp_knows_Spy analz_shrK_Decrypt cert_A_form analz.Inj)
11150
67387142225e Streamlining for the bug fix in Blast.
paulson
parents: 11117
diff changeset
   188
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   189
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   190
(*Alternative version also provable
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   191
lemma Says_S_message_form2:
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   192
  "\<lbrakk>Says S A (Crypt (shrK A) \<lbrace>Nonce NA, Agent B, Key K, X\<rbrace>) \<in> set evs;
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   193
    evs \<in> ns_shared\<rbrakk>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   194
   \<Longrightarrow> Says Server A (Crypt (shrK A) \<lbrace>Nonce NA, Agent B, Key K, X\<rbrace>) \<in> set evs
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   195
       \<or> X \<in> analz (spies evs)"
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   196
apply (case_tac "A \<in> bad")
13507
febb8e5d2a9d tidying of Isar scripts
paulson
parents: 11655
diff changeset
   197
apply (force dest!: Says_imp_knows_Spy [THEN analz.Inj])
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   198
by (blast dest!: A_trusts_NS2 Says_Server_message_form)
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   199
*)
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   200
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   201
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   202
(****
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   203
 SESSION KEY COMPROMISE THEOREM.  To prove theorems of the form
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   204
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   205
  Key K \<in> analz (insert (Key KAB) (spies evs)) \<Longrightarrow>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   206
  Key K \<in> analz (spies evs)
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   207
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   208
 A more general formula must be proved inductively.
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   209
****)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   210
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   211
text{*NOT useful in this form, but it says that session keys are not used
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   212
  to encrypt messages containing other keys, in the actual protocol.
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   213
  We require that agents should behave like this subsequently also.*}
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   214
lemma  "\<lbrakk>evs \<in> ns_shared;  Kab \<notin> range shrK\<rbrakk> \<Longrightarrow>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   215
         (Crypt KAB X) \<in> parts (spies evs) \<and>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   216
         Key K \<in> parts {X} \<longrightarrow> Key K \<in> parts (spies evs)"
13507
febb8e5d2a9d tidying of Isar scripts
paulson
parents: 11655
diff changeset
   217
apply (erule ns_shared.induct, force, drule_tac [4] NS3_msg_in_parts_spies, simp_all)
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   218
txt{*Fake*}
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   219
apply (blast dest: parts_insert_subset_Un)
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   220
txt{*Base, NS4 and NS5*}
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   221
apply auto
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   222
done
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   223
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   224
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   225
subsubsection{*Session keys are not used to encrypt other session keys*}
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   226
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   227
text{*The equality makes the induction hypothesis easier to apply*}
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   228
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   229
lemma analz_image_freshK [rule_format]:
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   230
 "evs \<in> ns_shared \<Longrightarrow>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   231
   \<forall>K KK. KK \<subseteq> - (range shrK) \<longrightarrow>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   232
             (Key K \<in> analz (Key`KK \<union> (spies evs))) =
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   233
             (K \<in> KK \<or> Key K \<in> analz (spies evs))"
14207
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   234
apply (erule ns_shared.induct)
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   235
apply (drule_tac [8] Says_Server_message_form)
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   236
apply (erule_tac [5] Says_S_message_form [THEN disjE], analz_freshK, spy_analz)
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   237
txt{*NS2, NS3*}
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   238
apply blast+; 
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   239
done
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   240
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   241
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   242
lemma analz_insert_freshK:
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   243
     "\<lbrakk>evs \<in> ns_shared;  KAB \<notin> range shrK\<rbrakk> \<Longrightarrow>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   244
       (Key K \<in> analz (insert (Key KAB) (spies evs))) =
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   245
       (K = KAB \<or> Key K \<in> analz (spies evs))"
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   246
by (simp only: analz_image_freshK analz_image_freshK_simps)
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   247
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   248
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   249
subsubsection{*The session key K uniquely identifies the message*}
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   250
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   251
text{*In messages of this form, the session key uniquely identifies the rest*}
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   252
lemma unique_session_keys:
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   253
     "\<lbrakk>Says Server A (Crypt (shrK A) \<lbrace>NA, Agent B, Key K, X\<rbrace>) \<in> set evs;
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   254
       Says Server A' (Crypt (shrK A') \<lbrace>NA', Agent B', Key K, X'\<rbrace>) \<in> set evs;
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   255
       evs \<in> ns_shared\<rbrakk> \<Longrightarrow> A=A' \<and> NA=NA' \<and> B=B' \<and> X = X'"
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   256
by (erule rev_mp, erule rev_mp, erule ns_shared.induct, simp_all, blast+)
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   257
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   258
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   259
subsubsection{*Crucial secrecy property: Spy doesn't see the keys sent in NS2*}
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   260
13956
8fe7e12290e1 improved presentation of HOL/Auth theories
paulson
parents: 13935
diff changeset
   261
text{*Beware of @{text "[rule_format]"} and the universal quantifier!*}
11150
67387142225e Streamlining for the bug fix in Blast.
paulson
parents: 11117
diff changeset
   262
lemma secrecy_lemma:
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   263
     "\<lbrakk>Says Server A (Crypt (shrK A) \<lbrace>NA, Agent B, Key K,
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   264
                                      Crypt (shrK B) \<lbrace>Key K, Agent A\<rbrace>\<rbrace>)
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   265
              \<in> set evs;
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   266
         A \<notin> bad;  B \<notin> bad;  evs \<in> ns_shared\<rbrakk>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   267
      \<Longrightarrow> (\<forall>NB. Notes Spy \<lbrace>NA, NB, Key K\<rbrace> \<notin> set evs) \<longrightarrow>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   268
         Key K \<notin> analz (spies evs)"
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   269
apply (erule rev_mp)
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   270
apply (erule ns_shared.induct, force)
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   271
apply (frule_tac [7] Says_Server_message_form)
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   272
apply (frule_tac [4] Says_S_message_form)
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   273
apply (erule_tac [5] disjE)
14207
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   274
apply (simp_all add: analz_insert_eq analz_insert_freshK pushes split_ifs, spy_analz)
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   275
txt{*NS2*}
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   276
apply blast
14207
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   277
txt{*NS3, Server sub-case*}
11188
5d539f1682c3 streamlined a proof
paulson
parents: 11150
diff changeset
   278
apply (blast dest!: Crypt_Spy_analz_bad A_trusts_NS2
5d539f1682c3 streamlined a proof
paulson
parents: 11150
diff changeset
   279
	     dest:  Says_imp_knows_Spy analz.Inj unique_session_keys)
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   280
txt{*NS3, Spy sub-case; also Oops*}
11280
6fdc4c4ccec1 minor tweaks
paulson
parents: 11251
diff changeset
   281
apply (blast dest: unique_session_keys)+
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   282
done
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   283
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   284
11188
5d539f1682c3 streamlined a proof
paulson
parents: 11150
diff changeset
   285
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   286
text{*Final version: Server's message in the most abstract form*}
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   287
lemma Spy_not_see_encrypted_key:
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   288
     "\<lbrakk>Says Server A (Crypt K' \<lbrace>NA, Agent B, Key K, X\<rbrace>) \<in> set evs;
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   289
       \<forall>NB. Notes Spy \<lbrace>NA, NB, Key K\<rbrace> \<notin> set evs;
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   290
       A \<notin> bad;  B \<notin> bad;  evs \<in> ns_shared\<rbrakk>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   291
      \<Longrightarrow> Key K \<notin> analz (spies evs)"
11150
67387142225e Streamlining for the bug fix in Blast.
paulson
parents: 11117
diff changeset
   292
by (blast dest: Says_Server_message_form secrecy_lemma)
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   293
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   294
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   295
subsection{*Guarantees available at various stages of protocol*}
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   296
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   297
text{*If the encrypted message appears then it originated with the Server*}
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   298
lemma B_trusts_NS3:
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   299
     "\<lbrakk>Crypt (shrK B) \<lbrace>Key K, Agent A\<rbrace> \<in> parts (spies evs);
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   300
       B \<notin> bad;  evs \<in> ns_shared\<rbrakk>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   301
      \<Longrightarrow> \<exists>NA. Says Server A
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   302
               (Crypt (shrK A) \<lbrace>NA, Agent B, Key K,
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   303
                                 Crypt (shrK B) \<lbrace>Key K, Agent A\<rbrace>\<rbrace>)
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   304
              \<in> set evs"
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   305
apply (erule rev_mp)
13507
febb8e5d2a9d tidying of Isar scripts
paulson
parents: 11655
diff changeset
   306
apply (erule ns_shared.induct, force, drule_tac [4] NS3_msg_in_parts_spies, auto)
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   307
done
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   308
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   309
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   310
lemma A_trusts_NS4_lemma [rule_format]:
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   311
   "evs \<in> ns_shared \<Longrightarrow>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   312
      Key K \<notin> analz (spies evs) \<longrightarrow>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   313
      Says Server A (Crypt (shrK A) \<lbrace>NA, Agent B, Key K, X\<rbrace>) \<in> set evs \<longrightarrow>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   314
      Crypt K (Nonce NB) \<in> parts (spies evs) \<longrightarrow>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   315
      Says B A (Crypt K (Nonce NB)) \<in> set evs"
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   316
apply (erule ns_shared.induct, force, drule_tac [4] NS3_msg_in_parts_spies)
14207
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   317
apply (analz_mono_contra, simp_all, blast)
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   318
txt{*NS2: contradiction from the assumptions @{term "Key K \<notin> used evs2"} and
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   319
    @{term "Crypt K (Nonce NB) \<in> parts (spies evs2)"} *} 
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   320
apply (force dest!: Crypt_imp_keysFor)
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   321
txt{*NS4*}
13935
paulson
parents: 13926
diff changeset
   322
apply (blast dest: B_trusts_NS3
paulson
parents: 13926
diff changeset
   323
	           Says_imp_knows_Spy [THEN analz.Inj]
11150
67387142225e Streamlining for the bug fix in Blast.
paulson
parents: 11117
diff changeset
   324
                   Crypt_Spy_analz_bad unique_session_keys)
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   325
done
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   326
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   327
text{*This version no longer assumes that K is secure*}
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   328
lemma A_trusts_NS4:
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   329
     "\<lbrakk>Crypt K (Nonce NB) \<in> parts (spies evs);
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   330
       Crypt (shrK A) \<lbrace>NA, Agent B, Key K, X\<rbrace> \<in> parts (spies evs);
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   331
       \<forall>NB. Notes Spy \<lbrace>NA, NB, Key K\<rbrace> \<notin> set evs;
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   332
       A \<notin> bad;  B \<notin> bad;  evs \<in> ns_shared\<rbrakk>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   333
      \<Longrightarrow> Says B A (Crypt K (Nonce NB)) \<in> set evs"
11280
6fdc4c4ccec1 minor tweaks
paulson
parents: 11251
diff changeset
   334
by (blast intro: A_trusts_NS4_lemma
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   335
          dest: A_trusts_NS2 Spy_not_see_encrypted_key)
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   336
14207
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   337
text{*If the session key has been used in NS4 then somebody has forwarded
11280
6fdc4c4ccec1 minor tweaks
paulson
parents: 11251
diff changeset
   338
  component X in some instance of NS4.  Perhaps an interesting property,
14207
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   339
  but not needed (after all) for the proofs below.*}
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   340
theorem NS4_implies_NS3 [rule_format]:
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   341
  "evs \<in> ns_shared \<Longrightarrow>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   342
     Key K \<notin> analz (spies evs) \<longrightarrow>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   343
     Says Server A (Crypt (shrK A) \<lbrace>NA, Agent B, Key K, X\<rbrace>) \<in> set evs \<longrightarrow>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   344
     Crypt K (Nonce NB) \<in> parts (spies evs) \<longrightarrow>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   345
     (\<exists>A'. Says A' B X \<in> set evs)"
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   346
apply (erule ns_shared.induct, force)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   347
apply (drule_tac [4] NS3_msg_in_parts_spies)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   348
apply analz_mono_contra
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   349
apply (simp_all add: ex_disj_distrib, blast)
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   350
txt{*NS2*}
14207
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   351
apply (blast dest!: new_keys_not_used Crypt_imp_keysFor)
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   352
txt{*NS4*}
13935
paulson
parents: 13926
diff changeset
   353
apply (blast dest: B_trusts_NS3
11280
6fdc4c4ccec1 minor tweaks
paulson
parents: 11251
diff changeset
   354
	     dest: Says_imp_knows_Spy [THEN analz.Inj]
11150
67387142225e Streamlining for the bug fix in Blast.
paulson
parents: 11117
diff changeset
   355
                   unique_session_keys Crypt_Spy_analz_bad)
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   356
done
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   357
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   358
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   359
lemma B_trusts_NS5_lemma [rule_format]:
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   360
  "\<lbrakk>B \<notin> bad;  evs \<in> ns_shared\<rbrakk> \<Longrightarrow>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   361
     Key K \<notin> analz (spies evs) \<longrightarrow>
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   362
     Says Server A
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   363
	  (Crypt (shrK A) \<lbrace>NA, Agent B, Key K,
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   364
			    Crypt (shrK B) \<lbrace>Key K, Agent A\<rbrace>\<rbrace>) \<in> set evs \<longrightarrow>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   365
     Crypt K \<lbrace>Nonce NB, Nonce NB\<rbrace> \<in> parts (spies evs) \<longrightarrow>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   366
     Says A B (Crypt K \<lbrace>Nonce NB, Nonce NB\<rbrace>) \<in> set evs"
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   367
apply (erule ns_shared.induct, force)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   368
apply (drule_tac [4] NS3_msg_in_parts_spies)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   369
apply (analz_mono_contra, simp_all, blast)
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   370
txt{*NS2*}
14207
f20fbb141673 Conversion of all main protocols from "Shared" to "Public".
paulson
parents: 14200
diff changeset
   371
apply (blast dest!: new_keys_not_used Crypt_imp_keysFor)
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   372
txt{*NS5*}
11150
67387142225e Streamlining for the bug fix in Blast.
paulson
parents: 11117
diff changeset
   373
apply (blast dest!: A_trusts_NS2
11280
6fdc4c4ccec1 minor tweaks
paulson
parents: 11251
diff changeset
   374
	     dest: Says_imp_knows_Spy [THEN analz.Inj]
11150
67387142225e Streamlining for the bug fix in Blast.
paulson
parents: 11117
diff changeset
   375
                   unique_session_keys Crypt_Spy_analz_bad)
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   376
done
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   377
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   378
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   379
text{*Very strong Oops condition reveals protocol's weakness*}
11104
f2024fed9f0c partial conversion to Isar script style
paulson
parents: 5434
diff changeset
   380
lemma B_trusts_NS5:
13926
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   381
     "\<lbrakk>Crypt K \<lbrace>Nonce NB, Nonce NB\<rbrace> \<in> parts (spies evs);
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   382
       Crypt (shrK B) \<lbrace>Key K, Agent A\<rbrace> \<in> parts (spies evs);
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   383
       \<forall>NA NB. Notes Spy \<lbrace>NA, NB, Key K\<rbrace> \<notin> set evs;
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   384
       A \<notin> bad;  B \<notin> bad;  evs \<in> ns_shared\<rbrakk>
6e62e5357a10 converting more HOL-Auth to new-style theories
paulson
parents: 13507
diff changeset
   385
      \<Longrightarrow> Says A B (Crypt K \<lbrace>Nonce NB, Nonce NB\<rbrace>) \<in> set evs"
11280
6fdc4c4ccec1 minor tweaks
paulson
parents: 11251
diff changeset
   386
by (blast intro: B_trusts_NS5_lemma
11150
67387142225e Streamlining for the bug fix in Blast.
paulson
parents: 11117
diff changeset
   387
          dest: B_trusts_NS3 Spy_not_see_encrypted_key)
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   388
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   389
text{*Unaltered so far wrt original version*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   390
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   391
subsection{*Lemmas for reasoning about predicate "Issues"*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   392
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   393
lemma spies_Says_rev: "spies (evs @ [Says A B X]) = insert X (spies evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   394
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   395
apply (induct_tac [2] "a", auto)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   396
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   397
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   398
lemma spies_Gets_rev: "spies (evs @ [Gets A X]) = spies evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   399
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   400
apply (induct_tac [2] "a", auto)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   401
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   402
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   403
lemma spies_Notes_rev: "spies (evs @ [Notes A X]) =
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   404
          (if A:bad then insert X (spies evs) else spies evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   405
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   406
apply (induct_tac [2] "a", auto)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   407
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   408
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   409
lemma spies_evs_rev: "spies evs = spies (rev evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   410
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   411
apply (induct_tac [2] "a")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   412
apply (simp_all (no_asm_simp) add: spies_Says_rev spies_Gets_rev spies_Notes_rev)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   413
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   414
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   415
lemmas parts_spies_evs_revD2 = spies_evs_rev [THEN equalityD2, THEN parts_mono]
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   416
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   417
lemma spies_takeWhile: "spies (takeWhile P evs) <=  spies evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   418
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   419
apply (induct_tac [2] "a", auto)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   420
txt{* Resembles @{text"used_subset_append"} in theory Event.*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   421
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   422
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   423
lemmas parts_spies_takeWhile_mono = spies_takeWhile [THEN parts_mono]
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   424
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   425
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   426
subsection{*Guarantees of non-injective agreement on the session key, and
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   427
of key distribution. They also express forms of freshness of certain messages,
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   428
namely that agents were alive after something happened.*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   429
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   430
lemma B_Issues_A:
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   431
     "\<lbrakk> Says B A (Crypt K (Nonce Nb)) \<in> set evs;
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   432
         Key K \<notin> analz (spies evs);
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   433
         A \<notin> bad;  B \<notin> bad; evs \<in> ns_shared \<rbrakk>
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   434
      \<Longrightarrow> B Issues A with (Crypt K (Nonce Nb)) on evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   435
apply (simp (no_asm) add: Issues_def)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   436
apply (rule exI)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   437
apply (rule conjI, assumption)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   438
apply (simp (no_asm))
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   439
apply (erule rev_mp)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   440
apply (erule rev_mp)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   441
apply (erule ns_shared.induct, analz_mono_contra)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   442
apply (simp_all)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   443
txt{*fake*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   444
apply blast
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   445
apply (simp_all add: takeWhile_tail)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   446
txt{*NS3 remains by pure coincidence!*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   447
apply (force dest!: A_trusts_NS2 Says_Server_message_form)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   448
txt{*NS4 would be the non-trivial case can be solved by Nb being used*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   449
apply (blast dest: parts_spies_takeWhile_mono [THEN subsetD]
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   450
                   parts_spies_evs_revD2 [THEN subsetD])
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   451
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   452
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   453
text{*Tells A that B was alive after she sent him the session key.  The
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   454
session key must be assumed confidential for this deduction to be meaningful,
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   455
but that assumption can be relaxed by the appropriate argument.
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   456
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   457
Precisely, the theorem guarantees (to A) key distribution of the session key
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   458
to B. It also guarantees (to A) non-injective agreement of B with A on the
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   459
session key. Both goals are available to A in the sense of Goal Availability.
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   460
*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   461
lemma A_authenticates_and_keydist_to_B:
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   462
     "\<lbrakk>Crypt K (Nonce NB) \<in> parts (spies evs);
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   463
       Crypt (shrK A) \<lbrace>NA, Agent B, Key K, X\<rbrace> \<in> parts (spies evs);
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   464
       Key K \<notin> analz(knows Spy evs);
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   465
       A \<notin> bad;  B \<notin> bad;  evs \<in> ns_shared\<rbrakk>
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   466
      \<Longrightarrow> B Issues A with (Crypt K (Nonce NB)) on evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   467
by (blast intro: A_trusts_NS4_lemma B_Issues_A dest: A_trusts_NS2)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   468
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   469
lemma A_trusts_NS5:
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   470
  "\<lbrakk> Crypt K \<lbrace>Nonce NB, Nonce NB\<rbrace> \<in> parts(spies evs);
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   471
     Crypt (shrK A) \<lbrace>Nonce NA, Agent B, Key K, X\<rbrace> \<in> parts(spies evs);
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   472
     Key K \<notin> analz (spies evs);
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   473
     A \<notin> bad; B \<notin> bad; evs \<in> ns_shared \<rbrakk>
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   474
 \<Longrightarrow> Says A B (Crypt K \<lbrace>Nonce NB, Nonce NB\<rbrace>) \<in> set evs";
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   475
apply (erule rev_mp)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   476
apply (erule rev_mp)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   477
apply (erule rev_mp)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   478
apply (erule ns_shared.induct, analz_mono_contra)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   479
apply (frule_tac [5] Says_S_message_form)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   480
apply (simp_all)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   481
txt{*Fake*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   482
apply blast
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   483
txt{*NS2*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   484
apply (force dest!: Crypt_imp_keysFor)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   485
txt{*NS3, much quicker having installed @{term Says_S_message_form} before simplication*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   486
apply fastsimp
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   487
txt{*NS5, the most important case, can be solved by unicity*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   488
apply (case_tac "Aa \<in> bad")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   489
apply (force dest!: Says_imp_spies [THEN analz.Inj, THEN analz.Decrypt, THEN analz.Snd, THEN analz.Snd, THEN analz.Fst])
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   490
apply (blast dest: A_trusts_NS2 unique_session_keys)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   491
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   492
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   493
lemma A_Issues_B:
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   494
     "\<lbrakk> Says A B (Crypt K \<lbrace>Nonce NB, Nonce NB\<rbrace>) \<in> set evs;
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   495
        Key K \<notin> analz (spies evs);
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   496
        A \<notin> bad;  B \<notin> bad; evs \<in> ns_shared \<rbrakk>
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   497
    \<Longrightarrow> A Issues B with (Crypt K \<lbrace>Nonce NB, Nonce NB\<rbrace>) on evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   498
apply (simp (no_asm) add: Issues_def)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   499
apply (rule exI)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   500
apply (rule conjI, assumption)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   501
apply (simp (no_asm))
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   502
apply (erule rev_mp)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   503
apply (erule rev_mp)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   504
apply (erule ns_shared.induct, analz_mono_contra)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   505
apply (simp_all)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   506
txt{*fake*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   507
apply blast
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   508
apply (simp_all add: takeWhile_tail)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   509
txt{*NS3 remains by pure coincidence!*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   510
apply (force dest!: A_trusts_NS2 Says_Server_message_form)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   511
txt{*NS5 is the non-trivial case and cannot be solved as in @{term B_Issues_A}! because NB is not fresh. We need @{term A_trusts_NS5}, proved for this very purpose*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   512
apply (blast dest: A_trusts_NS5 parts_spies_takeWhile_mono [THEN subsetD]
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   513
        parts_spies_evs_revD2 [THEN subsetD])
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   514
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   515
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   516
text{*Tells B that A was alive after B issued NB.
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   517
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   518
Precisely, the theorem guarantees (to B) key distribution of the session key to A. It also guarantees (to B) non-injective agreement of A with B on the session key. Both goals are available to B in the sense of Goal Availability.
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   519
*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   520
lemma B_authenticates_and_keydist_to_A:
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   521
     "\<lbrakk>Crypt K \<lbrace>Nonce NB, Nonce NB\<rbrace> \<in> parts (spies evs);
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   522
       Crypt (shrK B) \<lbrace>Key K, Agent A\<rbrace> \<in> parts (spies evs);
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   523
       Key K \<notin> analz (spies evs);
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   524
       A \<notin> bad;  B \<notin> bad;  evs \<in> ns_shared\<rbrakk>
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   525
   \<Longrightarrow> A Issues B with (Crypt K \<lbrace>Nonce NB, Nonce NB\<rbrace>) on evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   526
by (blast intro: A_Issues_B B_trusts_NS5_lemma dest: B_trusts_NS3)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents: 17778
diff changeset
   527
1934
58573e7041b4 Separation of theory Event into two parts:
paulson
parents:
diff changeset
   528
end