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