src/HOL/Auth/Recur.thy
author paulson
Thu, 03 May 2001 11:53:42 +0200
changeset 11281 f2a284b2d588
parent 11270 a315a3862bb4
child 11655 923e4d0d36d5
permissions -rw-r--r--
minor tweaks
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
     1
(*  Title:      HOL/Auth/Recur
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
     2
    ID:         $Id$
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
     4
    Copyright   1996  University of Cambridge
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
     5
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
     6
Inductive relation "recur" for the Recursive Authentication protocol.
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
     7
*)
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
     8
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
     9
theory Recur = Shared:
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    10
5434
9b4bed3f394c Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents: 5359
diff changeset
    11
(*End marker for message bundles*)
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    12
syntax        END :: "msg"
5434
9b4bed3f394c Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents: 5359
diff changeset
    13
translations "END" == "Number 0"
9b4bed3f394c Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents: 5359
diff changeset
    14
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    15
(*Two session keys are distributed to each agent except for the initiator,
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    16
        who receives one.
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    17
  Perhaps the two session keys could be bundled into a single message.
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    18
*)
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    19
consts     respond :: "event list => (msg*msg*key)set"
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    20
inductive "respond evs" (*Server's response to the nested message*)
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    21
  intros
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    22
   One:  "Key KAB \<notin> used evs
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    23
          ==> (Hash[Key(shrK A)] {|Agent A, Agent B, Nonce NA, END|},
5434
9b4bed3f394c Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents: 5359
diff changeset
    24
               {|Crypt (shrK A) {|Key KAB, Agent B, Nonce NA|}, END|},
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    25
               KAB)   \<in> respond evs"
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    26
2532
cde25bf71cc1 Improved layout and updated comments
paulson
parents: 2516
diff changeset
    27
    (*The most recent session key is passed up to the caller*)
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    28
   Cons: "[| (PA, RA, KAB) \<in> respond evs;
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    29
             Key KBC \<notin> used evs;  Key KBC \<notin> parts {RA};
5434
9b4bed3f394c Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents: 5359
diff changeset
    30
             PA = Hash[Key(shrK A)] {|Agent A, Agent B, Nonce NA, P|} |]
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    31
          ==> (Hash[Key(shrK B)] {|Agent B, Agent C, Nonce NB, PA|},
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    32
               {|Crypt (shrK B) {|Key KBC, Agent C, Nonce NB|},
2550
8d8344bcf98a Re-ordering of certificates so that session keys appear in decreasing order
paulson
parents: 2532
diff changeset
    33
                 Crypt (shrK B) {|Key KAB, Agent A, Nonce NB|},
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    34
                 RA|},
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    35
               KBC)
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    36
              \<in> respond evs"
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    37
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    38
2481
ee461c8bc9c3 Now uses HPair
paulson
parents: 2451
diff changeset
    39
(*Induction over "respond" can be difficult due to the complexity of the
2532
cde25bf71cc1 Improved layout and updated comments
paulson
parents: 2516
diff changeset
    40
  subgoals.  Set "responses" captures the general form of certificates.
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    41
*)
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    42
consts     responses :: "event list => msg set"
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    43
inductive "responses evs"
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    44
  intros
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    45
    (*Server terminates lists*)
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    46
   Nil:  "END \<in> responses evs"
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    47
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    48
   Cons: "[| RA \<in> responses evs;  Key KAB \<notin> used evs |]
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    49
          ==> {|Crypt (shrK B) {|Key KAB, Agent A, Nonce NB|},
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    50
                RA|}  \<in> responses evs"
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    51
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    52
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    53
consts     recur   :: "event list set"
3519
ab0a9fbed4c0 Changing "lost" from a parameter of protocol definitions to a constant.
paulson
parents: 3466
diff changeset
    54
inductive "recur"
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    55
  intros
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    56
         (*Initial trace is empty*)
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    57
   Nil:  "[] \<in> recur"
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    58
2532
cde25bf71cc1 Improved layout and updated comments
paulson
parents: 2516
diff changeset
    59
         (*The spy MAY say anything he CAN say.  Common to
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    60
           all similar protocols.*)
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    61
   Fake: "[| evsf \<in> recur;  X \<in> synth (analz (knows Spy evsf)) |]
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    62
          ==> Says Spy B X  # evsf \<in> recur"
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    63
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    64
         (*Alice initiates a protocol run.
5434
9b4bed3f394c Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents: 5359
diff changeset
    65
           END is a placeholder to terminate the nesting.*)
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    66
   RA1:  "[| evs1: recur;  Nonce NA \<notin> used evs1 |]
5434
9b4bed3f394c Got rid of not_Says_to_self and most uses of ~= in definitions and theorems
paulson
parents: 5359
diff changeset
    67
          ==> Says A B (Hash[Key(shrK A)] {|Agent A, Agent B, Nonce NA, END|})
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    68
              # evs1 \<in> recur"
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    69
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    70
         (*Bob's response to Alice's message.  C might be the Server.
4552
bb8ff763c93d Simplified proofs by omitting PA = {|XA, ...|} from RA2
paulson
parents: 3683
diff changeset
    71
           We omit PA = {|XA, Agent A, Agent B, Nonce NA, P|} because
bb8ff763c93d Simplified proofs by omitting PA = {|XA, ...|} from RA2
paulson
parents: 3683
diff changeset
    72
           it complicates proofs, so B may respond to any message at all!*)
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    73
   RA2:  "[| evs2: recur;  Nonce NB \<notin> used evs2;
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    74
             Says A' B PA \<in> set evs2 |]
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    75
          ==> Says B C (Hash[Key(shrK B)] {|Agent B, Agent C, Nonce NB, PA|})
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    76
              # evs2 \<in> recur"
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    77
2550
8d8344bcf98a Re-ordering of certificates so that session keys appear in decreasing order
paulson
parents: 2532
diff changeset
    78
         (*The Server receives Bob's message and prepares a response.*)
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    79
   RA3:  "[| evs3: recur;  Says B' Server PB \<in> set evs3;
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    80
             (PB,RB,K) \<in> respond evs3 |]
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    81
          ==> Says Server B RB # evs3 \<in> recur"
2449
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    82
d30ad12b1397 Recursive Authentication Protocol
paulson
parents:
diff changeset
    83
         (*Bob receives the returned message and compares the Nonces with
2516
4d68fbe6378b Now with Andy Gordon's treatment of freshness to replace newN/K
paulson
parents: 2485
diff changeset
    84
           those in the message he previously sent the Server.*)
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    85
   RA4:  "[| evs4: recur;
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    86
             Says B  C {|XH, Agent B, Agent C, Nonce NB,
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    87
                         XA, Agent A, Agent B, Nonce NA, P|} \<in> set evs4;
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    88
             Says C' B {|Crypt (shrK B) {|Key KBC, Agent C, Nonce NB|},
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    89
                         Crypt (shrK B) {|Key KAB, Agent A, Nonce NB|},
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    90
                         RA|} \<in> set evs4 |]
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    91
          ==> Says B A RA # evs4 \<in> recur"
5359
bd539b72d484 Tidying
paulson
parents: 4552
diff changeset
    92
bd539b72d484 Tidying
paulson
parents: 4552
diff changeset
    93
   (*No "oops" message can easily be expressed.  Each session key is
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
    94
     associated--in two separate messages--with two nonces.  This is
5359
bd539b72d484 Tidying
paulson
parents: 4552
diff changeset
    95
     one try, but it isn't that useful.  Re domino attack, note that
bd539b72d484 Tidying
paulson
parents: 4552
diff changeset
    96
     Recur.ML proves that each session key is secure provided the two
bd539b72d484 Tidying
paulson
parents: 4552
diff changeset
    97
     peers are, even if there are compromised agents elsewhere in
bd539b72d484 Tidying
paulson
parents: 4552
diff changeset
    98
     the chain.  Oops cases proved using parts_cut, Key_in_keysFor_parts,
bd539b72d484 Tidying
paulson
parents: 4552
diff changeset
    99
     etc.
bd539b72d484 Tidying
paulson
parents: 4552
diff changeset
   100
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   101
   Oops:  "[| evso: recur;  Says Server B RB \<in> set evso;
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   102
	      RB \<in> responses evs';  Key K \<in> parts {RB} |]
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   103
           ==> Notes Spy {|Key K, RB|} # evso \<in> recur"
5359
bd539b72d484 Tidying
paulson
parents: 4552
diff changeset
   104
  *)
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   105
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   106
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   107
declare Says_imp_knows_Spy [THEN analz.Inj, dest]
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   108
declare parts.Body  [dest]
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   109
declare analz_into_parts [dest]
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   110
declare Fake_parts_insert_in_Un  [dest]
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   111
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   112
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   113
(** Possibility properties: traces that reach the end
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   114
        ONE theorem would be more elegant and faster!
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   115
        By induction on a list of agents (no repetitions)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   116
**)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   117
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   118
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   119
(*Simplest case: Alice goes directly to the server*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   120
lemma "\<exists>K NA. \<exists>evs \<in> recur.
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   121
   Says Server A {|Crypt (shrK A) {|Key K, Agent Server, Nonce NA|},
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   122
                   END|}  \<in> set evs"
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   123
apply (intro exI bexI)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   124
apply (rule_tac [2] recur.Nil [THEN recur.RA1, 
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   125
                               THEN recur.RA3 [OF _ _ respond.One]])
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   126
apply possibility
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   127
done
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   128
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   129
11270
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   130
(*Case two: Alice, Bob and the server*)
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   131
lemma "\<exists>K. \<exists>NA. \<exists>evs \<in> recur.
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   132
        Says B A {|Crypt (shrK A) {|Key K, Agent B, Nonce NA|},
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   133
                   END|}  \<in> set evs"
11281
f2a284b2d588 minor tweaks
paulson
parents: 11270
diff changeset
   134
apply (cut_tac Nonce_supply2 Key_supply2)
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   135
apply clarify
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   136
apply (intro exI bexI)
11270
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   137
apply (rule_tac [2] 
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   138
          recur.Nil [THEN recur.RA1, 
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   139
                     THEN recur.RA2,
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   140
                     THEN recur.RA3 [OF _ _ respond.One [THEN respond.Cons]],
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   141
                     THEN recur.RA4])
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   142
apply (tactic "basic_possibility_tac")
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   143
apply (tactic
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   144
      "DEPTH_SOLVE (eresolve_tac [asm_rl, less_not_refl2, less_not_refl3] 1)")
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   145
done
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   146
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   147
(*Case three: Alice, Bob, Charlie and the server
11270
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   148
  Rather slow (16 seconds) to run every time...
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   149
lemma "\<exists>K. \<exists>NA. \<exists>evs \<in> recur.
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   150
        Says B A {|Crypt (shrK A) {|Key K, Agent B, Nonce NA|},
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   151
                   END|}  \<in> set evs"
11270
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   152
apply (tactic "cut_facts_tac [Nonce_supply3, Key_supply3] 1")
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   153
apply clarify
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   154
apply (intro exI bexI)
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   155
apply (rule_tac [2] 
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   156
          recur.Nil [THEN recur.RA1, 
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   157
                     THEN recur.RA2, THEN recur.RA2,
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   158
                     THEN recur.RA3 
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   159
                          [OF _ _ respond.One 
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   160
                                  [THEN respond.Cons, THEN respond.Cons]],
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   161
                     THEN recur.RA4, THEN recur.RA4])
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   162
apply (tactic "basic_possibility_tac")
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   163
apply (tactic
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   164
      "DEPTH_SOLVE (swap_res_tac [refl, conjI, disjCI] 1 ORELSE \
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   165
\                   eresolve_tac [asm_rl, less_not_refl2, less_not_refl3] 1)")
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   166
done
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   167
*)
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   168
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   169
(**** Inductive proofs about recur ****)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   170
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   171
lemma respond_imp_not_used: "(PA,RB,KAB) \<in> respond evs ==> Key KAB \<notin> used evs"
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   172
by (erule respond.induct, simp_all)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   173
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   174
lemma Key_in_parts_respond [rule_format]:
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   175
   "[| Key K \<in> parts {RB};  (PB,RB,K') \<in> respond evs |] ==> Key K \<notin> used evs"
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   176
apply (erule rev_mp, erule respond.induct)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   177
apply (auto dest: Key_not_used respond_imp_not_used)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   178
done
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   179
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   180
(*Simple inductive reasoning about responses*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   181
lemma respond_imp_responses:
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   182
     "(PA,RB,KAB) \<in> respond evs ==> RB \<in> responses evs"
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   183
apply (erule respond.induct)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   184
apply (blast intro!: respond_imp_not_used responses.intros)+
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   185
done
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   186
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   187
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   188
(** For reasoning about the encrypted portion of messages **)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   189
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   190
lemmas RA2_analz_spies = Says_imp_spies [THEN analz.Inj]
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   191
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   192
lemma RA4_analz_spies:
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   193
     "Says C' B {|Crypt K X, X', RA|} \<in> set evs ==> RA \<in> analz (spies evs)"
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   194
by blast
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   195
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   196
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   197
(*RA2_analz... and RA4_analz... let us treat those cases using the same
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   198
  argument as for the Fake case.  This is possible for most, but not all,
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   199
  proofs: Fake does not invent new nonces (as in RA2), and of course Fake
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   200
  messages originate from the Spy. *)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   201
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   202
lemmas RA2_parts_spies =  RA2_analz_spies [THEN analz_into_parts]
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   203
lemmas RA4_parts_spies =  RA4_analz_spies [THEN analz_into_parts]
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   204
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   205
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   206
(** Theorems of the form X \<notin> parts (spies evs) imply that NOBODY
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   207
    sends messages containing X! **)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   208
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   209
(** Spy never sees another agent's shared key! (unless it's bad at start) **)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   210
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   211
lemma Spy_see_shrK [simp]:
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   212
     "evs \<in> recur ==> (Key (shrK A) \<in> parts (spies evs)) = (A \<in> bad)"
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   213
apply (erule recur.induct)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   214
apply auto
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   215
(*RA3.  It's ugly to call auto twice, but it seems necessary.*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   216
apply (auto dest: Key_in_parts_respond simp add: parts_insert_spies)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   217
done
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   218
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   219
lemma Spy_analz_shrK [simp]:
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   220
     "evs \<in> recur ==> (Key (shrK A) \<in> analz (spies evs)) = (A \<in> bad)"
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   221
by auto
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   222
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   223
lemma Spy_see_shrK_D [dest!]:
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   224
     "[|Key (shrK A) \<in> parts (knows Spy evs);  evs \<in> recur|] ==> A \<in> bad"
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   225
by (blast dest: Spy_see_shrK)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   226
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   227
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   228
(*** Proofs involving analz ***)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   229
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   230
(** Session keys are not used to encrypt other session keys **)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   231
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   232
(*Version for "responses" relation.  Handles case RA3 in the theorem below.
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   233
  Note that it holds for *any* set H (not just "spies evs")
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   234
  satisfying the inductive hypothesis.*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   235
lemma resp_analz_image_freshK_lemma:
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   236
     "[| RB \<in> responses evs;
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   237
         \<forall>K KK. KK \<subseteq> - (range shrK) -->
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   238
                   (Key K \<in> analz (Key`KK Un H)) =
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   239
                   (K \<in> KK | Key K \<in> analz H) |]
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   240
     ==> \<forall>K KK. KK \<subseteq> - (range shrK) -->
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   241
                   (Key K \<in> analz (insert RB (Key`KK Un H))) =
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   242
                   (K \<in> KK | Key K \<in> analz (insert RB H))"
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   243
by (erule responses.induct,
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   244
    simp_all del: image_insert
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   245
	     add: analz_image_freshK_simps)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   246
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   247
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   248
(*Version for the protocol.  Proof is almost trivial, thanks to the lemma.*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   249
lemma raw_analz_image_freshK:
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   250
 "evs \<in> recur ==>
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   251
   \<forall>K KK. KK \<subseteq> - (range shrK) -->
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   252
          (Key K \<in> analz (Key`KK Un (spies evs))) =
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   253
          (K \<in> KK | Key K \<in> analz (spies evs))"
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   254
apply (erule recur.induct)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   255
apply (drule_tac [4] RA2_analz_spies,
11281
f2a284b2d588 minor tweaks
paulson
parents: 11270
diff changeset
   256
       drule_tac [5] respond_imp_responses,
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   257
       drule_tac [6] RA4_analz_spies)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   258
apply analz_freshK
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   259
apply spy_analz
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   260
(*RA3*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   261
apply (simp_all add: resp_analz_image_freshK_lemma)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   262
done
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   263
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   265
(*Instance of the lemma with H replaced by (spies evs):
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   266
   [| RB \<in> responses evs;  evs \<in> recur; |]
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   267
   ==> KK \<subseteq> - (range shrK) -->
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   268
       Key K \<in> analz (insert RB (Key`KK Un spies evs)) =
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   269
       (K \<in> KK | Key K \<in> analz (insert RB (spies evs)))
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   270
*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   271
lemmas resp_analz_image_freshK =  
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   272
       resp_analz_image_freshK_lemma [OF _ raw_analz_image_freshK]
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   273
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   274
lemma analz_insert_freshK:
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   275
     "[| evs \<in> recur;  KAB \<notin> range shrK |]
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   276
      ==> Key K \<in> analz (insert (Key KAB) (spies evs)) =
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   277
          (K = KAB | Key K \<in> analz (spies evs))"
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   278
by (simp del: image_insert
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   279
         add: analz_image_freshK_simps raw_analz_image_freshK)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   280
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   281
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   282
(*Everything that's hashed is already in past traffic. *)
11270
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   283
lemma Hash_imp_body:
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   284
     "[| Hash {|Key(shrK A), X|} \<in> parts (spies evs);
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   285
         evs \<in> recur;  A \<notin> bad |] ==> X \<in> parts (spies evs)"
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   286
apply (erule rev_mp)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   287
apply (erule recur.induct,
11281
f2a284b2d588 minor tweaks
paulson
parents: 11270
diff changeset
   288
       drule_tac [6] RA4_parts_spies,
f2a284b2d588 minor tweaks
paulson
parents: 11270
diff changeset
   289
       drule_tac [5] respond_imp_responses,
f2a284b2d588 minor tweaks
paulson
parents: 11270
diff changeset
   290
       drule_tac [4] RA2_parts_spies)
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   291
(*RA3 requires a further induction*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   292
apply (erule_tac [5] responses.induct)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   293
apply simp_all
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   294
(*Nil*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   295
apply force
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   296
(*Fake*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   297
apply (blast intro: parts_insertI)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   298
done
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   299
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   300
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   301
(** The Nonce NA uniquely identifies A's message.
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   302
    This theorem applies to steps RA1 and RA2!
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   303
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   304
  Unicity is not used in other proofs but is desirable in its own right.
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   305
**)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   306
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   307
lemma unique_NA:
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   308
  "[| Hash {|Key(shrK A), Agent A, B, NA, P|} \<in> parts (spies evs);
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   309
      Hash {|Key(shrK A), Agent A, B',NA, P'|} \<in> parts (spies evs);
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   310
      evs \<in> recur;  A \<notin> bad |]
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   311
    ==> B=B' & P=P'"
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   312
apply (erule rev_mp, erule rev_mp)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   313
apply (erule recur.induct,
11281
f2a284b2d588 minor tweaks
paulson
parents: 11270
diff changeset
   314
       drule_tac [5] respond_imp_responses)
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   315
apply (force, simp_all)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   316
(*Fake*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   317
apply blast
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   318
apply (erule_tac [3] responses.induct)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   319
(*RA1,2: creation of new Nonce*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   320
apply simp_all
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   321
apply (blast dest!: Hash_imp_body)+
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   322
done
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   323
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   324
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   325
(*** Lemmas concerning the Server's response
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   326
      (relations "respond" and "responses")
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   327
***)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   328
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   329
lemma shrK_in_analz_respond [simp]:
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   330
     "[| RB \<in> responses evs;  evs \<in> recur |]
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   331
  ==> (Key (shrK B) \<in> analz (insert RB (spies evs))) = (B:bad)"
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   332
by (erule responses.induct,
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   333
    simp_all del: image_insert
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   334
             add: analz_image_freshK_simps resp_analz_image_freshK)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   335
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   336
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   337
lemma resp_analz_insert_lemma:
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   338
     "[| Key K \<in> analz (insert RB H);
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   339
         \<forall>K KK. KK \<subseteq> - (range shrK) -->
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   340
                   (Key K \<in> analz (Key`KK Un H)) =
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   341
                   (K \<in> KK | Key K \<in> analz H);
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   342
         RB \<in> responses evs |]
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   343
     ==> (Key K \<in> parts{RB} | Key K \<in> analz H)"
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   344
apply (erule rev_mp, erule responses.induct)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   345
apply (simp_all del: image_insert
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   346
             add: analz_image_freshK_simps resp_analz_image_freshK_lemma)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   347
(*Simplification using two distinct treatments of "image"*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   348
apply (simp add: parts_insert2)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   349
apply blast
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   350
done
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   351
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   352
lemmas resp_analz_insert =
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   353
       resp_analz_insert_lemma [OF _ raw_analz_image_freshK]
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   354
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   355
(*The last key returned by respond indeed appears in a certificate*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   356
lemma respond_certificate:
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   357
     "(Hash[Key(shrK A)] {|Agent A, B, NA, P|}, RA, K) \<in> respond evs
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   358
      ==> Crypt (shrK A) {|Key K, B, NA|} \<in> parts {RA}"
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   359
apply (ind_cases "(X, RA, K) \<in> respond evs")
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   360
apply simp_all
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   361
done
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   362
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   363
(*This unicity proof differs from all the others in the HOL/Auth directory.
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   364
  The conclusion isn't quite unicity but duplicity, in that there are two
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   365
  possibilities.  Also, the presence of two different matching messages in
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   366
  the inductive step complicates the case analysis.  Unusually for such proofs,
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   367
  the quantifiers appear to be necessary.*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   368
lemma unique_lemma [rule_format]:
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   369
     "(PB,RB,KXY) \<in> respond evs ==>
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   370
      \<forall>A B N. Crypt (shrK A) {|Key K, Agent B, N|} \<in> parts {RB} -->
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   371
      (\<forall>A' B' N'. Crypt (shrK A') {|Key K, Agent B', N'|} \<in> parts {RB} -->
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   372
      (A'=A & B'=B) | (A'=B & B'=A))"
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   373
apply (erule respond.induct)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   374
apply (simp_all add: all_conj_distrib)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   375
apply (blast dest: respond_certificate)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   376
done
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   377
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   378
lemma unique_session_keys:
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   379
     "[| Crypt (shrK A) {|Key K, Agent B, N|} \<in> parts {RB};
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   380
         Crypt (shrK A') {|Key K, Agent B', N'|} \<in> parts {RB};
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   381
         (PB,RB,KXY) \<in> respond evs |]
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   382
      ==> (A'=A & B'=B) | (A'=B & B'=A)"
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   383
by (rule unique_lemma, auto)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   384
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   385
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   386
(** Crucial secrecy property: Spy does not see the keys sent in msg RA3
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   387
    Does not in itself guarantee security: an attack could violate
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   388
    the premises, e.g. by having A=Spy **)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   389
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   390
lemma respond_Spy_not_see_session_key [rule_format]:
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   391
     "[| (PB,RB,KAB) \<in> respond evs;  evs \<in> recur |]
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   392
      ==> \<forall>A A' N. A \<notin> bad & A' \<notin> bad -->
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   393
          Crypt (shrK A) {|Key K, Agent A', N|} \<in> parts{RB} -->
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   394
          Key K \<notin> analz (insert RB (spies evs))"
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   395
apply (erule respond.induct)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   396
apply (frule_tac [2] respond_imp_responses)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   397
apply (frule_tac [2] respond_imp_not_used)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   398
apply (simp_all del: image_insert
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   399
                add: analz_image_freshK_simps split_ifs shrK_in_analz_respond
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   400
                     resp_analz_image_freshK parts_insert2)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   401
apply (simp_all add: ex_disj_distrib)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   402
(** LEVEL 5 **)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   403
(*Base case of respond*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   404
apply blast
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   405
(*Inductive step of respond*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   406
apply (intro allI conjI impI)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   407
apply simp_all
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   408
(*by unicity, either B=Aa or B=A', a contradiction if B \<in> bad*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   409
apply (blast dest: unique_session_keys [OF _ respond_certificate])
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   410
apply (blast dest!: respond_certificate)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   411
apply (blast dest!: resp_analz_insert)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   412
done
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   413
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   414
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   415
lemma Spy_not_see_session_key:
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   416
     "[| Crypt (shrK A) {|Key K, Agent A', N|} \<in> parts (spies evs);
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   417
         A \<notin> bad;  A' \<notin> bad;  evs \<in> recur |]
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   418
      ==> Key K \<notin> analz (spies evs)"
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   419
apply (erule rev_mp)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   420
apply (erule recur.induct)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   421
apply (drule_tac [4] RA2_analz_spies,
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   422
       frule_tac [5] respond_imp_responses,
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   423
       drule_tac [6] RA4_analz_spies,
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   424
       simp_all add: split_ifs analz_insert_eq analz_insert_freshK)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   425
(*Base*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   426
apply force
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   427
(*Fake*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   428
apply spy_analz
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   429
(*RA2*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   430
apply blast 
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   431
(*RA3 remains*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   432
apply (simp add: parts_insert_spies)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   433
(*Now we split into two cases.  A single blast could do it, but it would take
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   434
  a CPU minute.*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   435
apply (safe del: impCE)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   436
(*RA3, case 1: use lemma previously proved by induction*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   437
apply (blast elim: rev_notE [OF _ respond_Spy_not_see_session_key])
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   438
(*RA3, case 2: K is an old key*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   439
apply (blast dest: resp_analz_insert dest: Key_in_parts_respond)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   440
(*RA4*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   441
apply blast 
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   442
done
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   443
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   444
(**** Authenticity properties for Agents ****)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   445
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   446
(*The response never contains Hashes*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   447
lemma Hash_in_parts_respond:
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   448
     "[| Hash {|Key (shrK B), M|} \<in> parts (insert RB H);
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   449
         (PB,RB,K) \<in> respond evs |]
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   450
      ==> Hash {|Key (shrK B), M|} \<in> parts H"
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   451
apply (erule rev_mp)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   452
apply (erule respond_imp_responses [THEN responses.induct])
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   453
apply auto
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   454
done
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   455
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   456
(*Only RA1 or RA2 can have caused such a part of a message to appear.
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   457
  This result is of no use to B, who cannot verify the Hash.  Moreover,
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   458
  it can say nothing about how recent A's message is.  It might later be
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   459
  used to prove B's presence to A at the run's conclusion.*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   460
lemma Hash_auth_sender [rule_format]:
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   461
     "[| Hash {|Key(shrK A), Agent A, Agent B, NA, P|} \<in> parts(spies evs);
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   462
         A \<notin> bad;  evs \<in> recur |]
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   463
      ==> Says A B (Hash[Key(shrK A)] {|Agent A, Agent B, NA, P|}) \<in> set evs"
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   464
apply (unfold HPair_def)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   465
apply (erule rev_mp)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   466
apply (erule recur.induct,
11281
f2a284b2d588 minor tweaks
paulson
parents: 11270
diff changeset
   467
       drule_tac [6] RA4_parts_spies,
f2a284b2d588 minor tweaks
paulson
parents: 11270
diff changeset
   468
       drule_tac [4] RA2_parts_spies,
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   469
       simp_all)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   470
(*Nil*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   471
apply force
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   472
(*Fake, RA3*)
11281
f2a284b2d588 minor tweaks
paulson
parents: 11270
diff changeset
   473
apply (blast dest: Hash_in_parts_respond)+
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   474
done
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   475
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   476
(** These two results subsume (for all agents) the guarantees proved
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   477
    separately for A and B in the Otway-Rees protocol.
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   478
**)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   479
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   480
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   481
(*Certificates can only originate with the Server.*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   482
lemma Cert_imp_Server_msg:
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   483
     "[| Crypt (shrK A) Y \<in> parts (spies evs);
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   484
         A \<notin> bad;  evs \<in> recur |]
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   485
      ==> \<exists>C RC. Says Server C RC \<in> set evs  &
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   486
                   Crypt (shrK A) Y \<in> parts {RC}"
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   487
apply (erule rev_mp, erule recur.induct, simp_all)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   488
(*Nil*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   489
apply force
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   490
(*Fake*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   491
apply blast
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   492
(*RA1*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   493
apply blast
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   494
(*RA2: it cannot be a new Nonce, contradiction.*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   495
apply blast
11270
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   496
(*RA3*) (*Pity that the proof is so brittle: this step requires the rewriting,
a315a3862bb4 better treatment of methods: uses Method.ctxt_args to refer to current
paulson
parents: 11264
diff changeset
   497
          which however would break all other steps.*)
11264
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   498
apply (simp add: parts_insert_spies, blast)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   499
(*RA4*)
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   500
apply blast
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   501
done
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   502
a47a9288f3f6 (rough) conversion of Auth/Recur to Isar format
paulson
parents: 11185
diff changeset
   503
end