src/HOL/Auth/OtwayReesBella.thy
author wenzelm
Thu, 18 Apr 2013 17:07:01 +0200
changeset 51717 9e7d1c139569
parent 45605 a89b4bc311a5
child 51798 ad3a241def73
permissions -rw-r--r--
simplifier uses proper Proof.context instead of historic type simpset;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37936
1e4c5015a72e updated some headers;
wenzelm
parents: 32960
diff changeset
     1
(*  Title:      HOL/Auth/OtwayReesBella.thy
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
     2
    Author:     Giampaolo Bella, Catania University
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
     3
*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
     4
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
     5
header{*Bella's version of the Otway-Rees protocol*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
     6
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
     7
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
     8
theory OtwayReesBella imports Public begin
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
     9
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    10
text{*Bella's modifications to a version of the Otway-Rees protocol taken from
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    11
the BAN paper only concern message 7. The updated protocol makes the goal of
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    12
key distribution of the session key available to A. Investigating the
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    13
principle of Goal Availability undermines the BAN claim about the original
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    14
protocol, that "this protocol does not make use of Kab as an encryption key,
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    15
so neither principal can know whether the key is known to the other". The
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    16
updated protocol makes no use of the session key to encrypt but informs A that
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    17
B knows it.*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    18
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 21588
diff changeset
    19
inductive_set orb :: "event list set"
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 21588
diff changeset
    20
 where
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    21
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    22
  Nil:  "[]\<in> orb"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    23
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 21588
diff changeset
    24
| Fake: "\<lbrakk>evsa\<in> orb;  X\<in> synth (analz (knows Spy evsa))\<rbrakk>
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    25
         \<Longrightarrow> Says Spy B X  # evsa \<in> orb"
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    26
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 21588
diff changeset
    27
| Reception: "\<lbrakk>evsr\<in> orb;  Says A B X \<in> set evsr\<rbrakk>
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    28
              \<Longrightarrow> Gets B X # evsr \<in> orb"
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    29
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 21588
diff changeset
    30
| OR1:  "\<lbrakk>evs1\<in> orb;  Nonce NA \<notin> used evs1\<rbrakk>
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    31
         \<Longrightarrow> Says A B \<lbrace>Nonce M, Agent A, Agent B, 
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    32
                   Crypt (shrK A) \<lbrace>Nonce NA, Nonce M, Agent A, Agent B\<rbrace>\<rbrace> 
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    33
               # evs1 \<in> orb"
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    34
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 21588
diff changeset
    35
| OR2:  "\<lbrakk>evs2\<in> orb;  Nonce NB \<notin> used evs2;
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    36
           Gets B \<lbrace>Nonce M, Agent A, Agent B, X\<rbrace> \<in> set evs2\<rbrakk>
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    37
        \<Longrightarrow> Says B Server 
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    38
                \<lbrace>Nonce M, Agent A, Agent B, X, 
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    39
           Crypt (shrK B) \<lbrace>Nonce NB, Nonce M, Nonce M, Agent A, Agent B\<rbrace>\<rbrace>
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    40
               # evs2 \<in> orb"
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    41
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 21588
diff changeset
    42
| OR3:  "\<lbrakk>evs3\<in> orb;  Key KAB \<notin> used evs3;
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    43
          Gets Server 
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    44
             \<lbrace>Nonce M, Agent A, Agent B, 
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    45
               Crypt (shrK A) \<lbrace>Nonce NA, Nonce M, Agent A, Agent B\<rbrace>, 
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    46
               Crypt (shrK B) \<lbrace>Nonce NB, Nonce M, Nonce M, Agent A, Agent B\<rbrace>\<rbrace>
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    47
          \<in> set evs3\<rbrakk>
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    48
        \<Longrightarrow> Says Server B \<lbrace>Nonce M,
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    49
                    Crypt (shrK B) \<lbrace>Crypt (shrK A) \<lbrace>Nonce NA, Key KAB\<rbrace>,
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    50
                                      Nonce NB, Key KAB\<rbrace>\<rbrace>
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    51
               # evs3 \<in> orb"
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    52
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    53
  (*B can only check that the message he is bouncing is a ciphertext*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    54
  (*Sending M back is omitted*)   
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 21588
diff changeset
    55
| OR4:  "\<lbrakk>evs4\<in> orb; B \<noteq> Server; \<forall> p q. X \<noteq> \<lbrace>p, q\<rbrace>; 
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    56
          Says B Server \<lbrace>Nonce M, Agent A, Agent B, X', 
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    57
                Crypt (shrK B) \<lbrace>Nonce NB, Nonce M, Nonce M, Agent A, Agent B\<rbrace>\<rbrace>
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    58
            \<in> set evs4;
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    59
          Gets B \<lbrace>Nonce M, Crypt (shrK B) \<lbrace>X, Nonce NB, Key KAB\<rbrace>\<rbrace>
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    60
            \<in> set evs4\<rbrakk>
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    61
        \<Longrightarrow> Says B A \<lbrace>Nonce M, X\<rbrace> # evs4 \<in> orb"
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    62
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    63
23746
a455e69c31cc Adapted to new inductive definition package.
berghofe
parents: 21588
diff changeset
    64
| Oops: "\<lbrakk>evso\<in> orb;  
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    65
           Says Server B \<lbrace>Nonce M,
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    66
                    Crypt (shrK B) \<lbrace>Crypt (shrK A) \<lbrace>Nonce NA, Key KAB\<rbrace>,
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    67
                                      Nonce NB, Key KAB\<rbrace>\<rbrace> 
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 30549
diff changeset
    68
             \<in> set evso\<rbrakk>
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    69
 \<Longrightarrow> Notes Spy \<lbrace>Agent A, Agent B, Nonce NA, Nonce NB, Key KAB\<rbrace> # evso 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    70
     \<in> orb"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    71
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    72
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    73
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    74
declare knows_Spy_partsEs [elim]
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    75
declare analz_into_parts [dest]
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    76
declare Fake_parts_insert_in_Un  [dest]
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    77
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    78
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    79
text{*Fragile proof, with backtracking in the possibility call.*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    80
lemma possibility_thm: "\<lbrakk>A \<noteq> Server; B \<noteq> Server; Key K \<notin> used[]\<rbrakk>    
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    81
      \<Longrightarrow>   \<exists> evs \<in> orb.           
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    82
     Says B A \<lbrace>Nonce M, Crypt (shrK A) \<lbrace>Nonce Na, Key K\<rbrace>\<rbrace> \<in> set evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    83
apply (intro exI bexI)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    84
apply (rule_tac [2] orb.Nil
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    85
                    [THEN orb.OR1, THEN orb.Reception,
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    86
                     THEN orb.OR2, THEN orb.Reception,
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    87
                     THEN orb.OR3, THEN orb.Reception, THEN orb.OR4]) 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    88
apply (possibility, simp add: used_Cons)  
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    89
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    90
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    91
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    92
lemma Gets_imp_Says :
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    93
     "\<lbrakk>Gets B X \<in> set evs; evs \<in> orb\<rbrakk> \<Longrightarrow> \<exists>A. Says A B X \<in> set evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    94
apply (erule rev_mp)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    95
apply (erule orb.induct)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    96
apply auto
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    97
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    98
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    99
lemma Gets_imp_knows_Spy: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   100
     "\<lbrakk>Gets B X \<in> set evs; evs \<in> orb\<rbrakk>  \<Longrightarrow> X \<in> knows Spy evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   101
by (blast dest!: Gets_imp_Says Says_imp_knows_Spy)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   102
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   103
declare Gets_imp_knows_Spy [THEN parts.Inj, dest]
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   104
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   105
lemma Gets_imp_knows:
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   106
     "\<lbrakk>Gets B X \<in> set evs; evs \<in> orb\<rbrakk>  \<Longrightarrow> X \<in> knows B evs"
39251
8756b44582e2 Tidied up proofs using sledgehammer, also deleting unnecessary semicolons
paulson
parents: 37936
diff changeset
   107
by (metis Gets_imp_knows_Spy Gets_imp_knows_agents)
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   108
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   109
lemma OR2_analz_knows_Spy: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   110
   "\<lbrakk>Gets B \<lbrace>Nonce M, Agent A, Agent B, X\<rbrace> \<in> set evs; evs \<in> orb\<rbrakk>   
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   111
    \<Longrightarrow> X \<in> analz (knows Spy evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   112
by (blast dest!: Gets_imp_knows_Spy [THEN analz.Inj])
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   113
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   114
lemma OR4_parts_knows_Spy: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   115
   "\<lbrakk>Gets B \<lbrace>Nonce M, Crypt (shrK B) \<lbrace>X, Nonce Nb, Key Kab\<rbrace>\<rbrace>  \<in> set evs; 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   116
      evs \<in> orb\<rbrakk>   \<Longrightarrow> X \<in> parts (knows Spy evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   117
by blast
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   118
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   119
lemma Oops_parts_knows_Spy: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   120
    "Says Server B \<lbrace>Nonce M, Crypt K' \<lbrace>X, Nonce Nb, K\<rbrace>\<rbrace> \<in> set evs  
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   121
     \<Longrightarrow> K \<in> parts (knows Spy evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   122
by blast
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   123
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   124
lemmas OR2_parts_knows_Spy =
45605
a89b4bc311a5 eliminated obsolete "standard";
wenzelm
parents: 44890
diff changeset
   125
    OR2_analz_knows_Spy [THEN analz_into_parts]
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   126
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   127
ML
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   128
{*
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   129
fun parts_explicit_tac i = 
24122
fc7f857d33c8 tuned ML bindings (for multithreading);
wenzelm
parents: 23746
diff changeset
   130
    forward_tac [@{thm Oops_parts_knows_Spy}] (i+7) THEN
fc7f857d33c8 tuned ML bindings (for multithreading);
wenzelm
parents: 23746
diff changeset
   131
    forward_tac [@{thm OR4_parts_knows_Spy}]  (i+6) THEN
fc7f857d33c8 tuned ML bindings (for multithreading);
wenzelm
parents: 23746
diff changeset
   132
    forward_tac [@{thm OR2_parts_knows_Spy}]  (i+4)
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   133
*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   134
 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   135
method_setup parts_explicit = {*
30549
d2d7874648bd simplified method setup;
wenzelm
parents: 30510
diff changeset
   136
    Scan.succeed (K (SIMPLE_METHOD' parts_explicit_tac)) *}
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   137
  "to explicitly state that some message components belong to parts knows Spy"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   138
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   139
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   140
lemma Spy_see_shrK [simp]: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   141
    "evs \<in> orb \<Longrightarrow> (Key (shrK A) \<in> parts (knows Spy evs)) = (A \<in> bad)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   142
by (erule orb.induct, parts_explicit, simp_all, blast+)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   143
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   144
lemma Spy_analz_shrK [simp]: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   145
"evs \<in> orb \<Longrightarrow> (Key (shrK A) \<in> analz (knows Spy evs)) = (A \<in> bad)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   146
by auto
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   147
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   148
lemma Spy_see_shrK_D [dest!]:
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   149
     "[|Key (shrK A) \<in> parts (knows Spy evs);  evs \<in> orb|] ==> A \<in> bad"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   150
by (blast dest: Spy_see_shrK)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   151
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   152
lemma new_keys_not_used [simp]:
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   153
   "\<lbrakk>Key K \<notin> used evs; K \<in> symKeys; evs \<in> orb\<rbrakk>  \<Longrightarrow> K \<notin> keysFor (parts (knows Spy evs))"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   154
apply (erule rev_mp)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   155
apply (erule orb.induct, parts_explicit, simp_all)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   156
apply (force dest!: keysFor_parts_insert)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   157
apply (blast+)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   158
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   159
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   160
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   161
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   162
subsection{* Proofs involving analz *}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   163
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   164
text{*Describes the form of K and NA when the Server sends this message.  Also
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   165
  for Oops case.*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   166
lemma Says_Server_message_form: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   167
"\<lbrakk>Says Server B  \<lbrace>Nonce M, Crypt (shrK B) \<lbrace>X, Nonce Nb, Key K\<rbrace>\<rbrace> \<in> set evs;  
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   168
     evs \<in> orb\<rbrakk>                                            
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   169
 \<Longrightarrow> K \<notin> range shrK & (\<exists> A Na. X=(Crypt (shrK A) \<lbrace>Nonce Na, Key K\<rbrace>))"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   170
by (erule rev_mp, erule orb.induct, simp_all)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   171
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   172
lemma Says_Server_imp_Gets: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   173
 "\<lbrakk>Says Server B \<lbrace>Nonce M, Crypt (shrK B) \<lbrace>Crypt (shrK A) \<lbrace>Nonce Na, Key K\<rbrace>,
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   174
                                             Nonce Nb, Key K\<rbrace>\<rbrace> \<in> set evs;
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   175
    evs \<in> orb\<rbrakk>
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   176
  \<Longrightarrow>  Gets Server \<lbrace>Nonce M, Agent A, Agent B, 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   177
                   Crypt (shrK A) \<lbrace>Nonce Na, Nonce M, Agent A, Agent B\<rbrace>, 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   178
               Crypt (shrK B) \<lbrace>Nonce Nb, Nonce M, Nonce M, Agent A, Agent B\<rbrace>\<rbrace>
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   179
         \<in> set evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   180
by (erule rev_mp, erule orb.induct, simp_all)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   181
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   182
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   183
lemma A_trusts_OR1: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   184
"\<lbrakk>Crypt (shrK A) \<lbrace>Nonce Na, Nonce M, Agent A, Agent B\<rbrace> \<in> parts (knows Spy evs);  
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   185
    A \<notin> bad; evs \<in> orb\<rbrakk>                   
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   186
 \<Longrightarrow> Says A B \<lbrace>Nonce M, Agent A, Agent B, Crypt (shrK A) \<lbrace>Nonce Na, Nonce M, Agent A, Agent B\<rbrace>\<rbrace> \<in> set evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   187
apply (erule rev_mp, erule orb.induct, parts_explicit, simp_all)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   188
apply (blast)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   189
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   190
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   191
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   192
lemma B_trusts_OR2:
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   193
 "\<lbrakk>Crypt (shrK B) \<lbrace>Nonce Nb, Nonce M, Nonce M, Agent A, Agent B\<rbrace>  
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   194
      \<in> parts (knows Spy evs);  B \<notin> bad; evs \<in> orb\<rbrakk>                   
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   195
  \<Longrightarrow> (\<exists> X. Says B Server \<lbrace>Nonce M, Agent A, Agent B, X,  
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   196
              Crypt (shrK B) \<lbrace>Nonce Nb, Nonce M, Nonce M, Agent A, Agent B\<rbrace>\<rbrace> 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   197
          \<in> set evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   198
apply (erule rev_mp, erule orb.induct, parts_explicit, simp_all)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   199
apply (blast+)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   200
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   201
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   202
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   203
lemma B_trusts_OR3: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   204
"\<lbrakk>Crypt (shrK B) \<lbrace>X, Nonce Nb, Key K\<rbrace> \<in> parts (knows Spy evs);  
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   205
   B \<notin> bad; evs \<in> orb\<rbrakk>                   
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   206
\<Longrightarrow> \<exists> M. Says Server B \<lbrace>Nonce M, Crypt (shrK B) \<lbrace>X, Nonce Nb, Key K\<rbrace>\<rbrace> 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   207
         \<in> set evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   208
apply (erule rev_mp, erule orb.induct, parts_explicit, simp_all)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   209
apply (blast+)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   210
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   211
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   212
lemma Gets_Server_message_form: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   213
"\<lbrakk>Gets B \<lbrace>Nonce M, Crypt (shrK B) \<lbrace>X, Nonce Nb, Key K\<rbrace>\<rbrace> \<in> set evs;  
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   214
    evs \<in> orb\<rbrakk>                                              
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   215
 \<Longrightarrow> (K \<notin> range shrK & (\<exists> A Na. X = (Crypt (shrK A) \<lbrace>Nonce Na, Key K\<rbrace>)))    
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   216
             | X \<in> analz (knows Spy evs)"
39251
8756b44582e2 Tidied up proofs using sledgehammer, also deleting unnecessary semicolons
paulson
parents: 37936
diff changeset
   217
by (metis B_trusts_OR3 Crypt_Spy_analz_bad Gets_imp_Says MPair_analz MPair_parts
8756b44582e2 Tidied up proofs using sledgehammer, also deleting unnecessary semicolons
paulson
parents: 37936
diff changeset
   218
          Says_Server_message_form Says_imp_analz_Spy Says_imp_parts_knows_Spy)
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   219
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   220
lemma unique_Na: "\<lbrakk>Says A B  \<lbrace>Nonce M, Agent A, Agent B, Crypt (shrK A) \<lbrace>Nonce Na, Nonce M, Agent A, Agent B\<rbrace>\<rbrace> \<in> set evs;   
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   221
         Says A B' \<lbrace>Nonce M', Agent A, Agent B', Crypt (shrK A) \<lbrace>Nonce Na, Nonce M', Agent A, Agent B'\<rbrace>\<rbrace> \<in> set evs;  
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   222
    A \<notin> bad; evs \<in> orb\<rbrakk> \<Longrightarrow> B=B' & M=M'"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   223
by (erule rev_mp, erule rev_mp, erule orb.induct, simp_all, blast+)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   224
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   225
lemma unique_Nb: "\<lbrakk>Says B Server \<lbrace>Nonce M, Agent A, Agent B, X, Crypt (shrK B) \<lbrace>Nonce Nb, Nonce M, Nonce M, Agent A, Agent B\<rbrace>\<rbrace> \<in> set evs;   
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   226
         Says B Server \<lbrace>Nonce M', Agent A', Agent B, X', Crypt (shrK B) \<lbrace>Nonce Nb,Nonce M', Nonce M', Agent A', Agent B\<rbrace>\<rbrace> \<in> set evs;   
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   227
    B \<notin> bad; evs \<in> orb\<rbrakk> \<Longrightarrow>   M=M' & A=A' & X=X'"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   228
by (erule rev_mp, erule rev_mp, erule orb.induct, simp_all, blast+)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   229
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   230
lemma analz_image_freshCryptK_lemma:
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   231
"(Crypt K X \<in> analz (Key`nE \<union> H)) \<longrightarrow> (Crypt K X \<in> analz H) \<Longrightarrow>  
39251
8756b44582e2 Tidied up proofs using sledgehammer, also deleting unnecessary semicolons
paulson
parents: 37936
diff changeset
   232
        (Crypt K X \<in> analz (Key`nE \<union> H)) = (Crypt K X \<in> analz H)"
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   233
by (blast intro: analz_mono [THEN [2] rev_subsetD])
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   234
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   235
ML
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   236
{*
24122
fc7f857d33c8 tuned ML bindings (for multithreading);
wenzelm
parents: 23746
diff changeset
   237
structure OtwayReesBella =
fc7f857d33c8 tuned ML bindings (for multithreading);
wenzelm
parents: 23746
diff changeset
   238
struct
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   239
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   240
val analz_image_freshK_ss =
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   241
  simpset_of
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   242
   (@{context} delsimps [image_insert, image_Un]
24122
fc7f857d33c8 tuned ML bindings (for multithreading);
wenzelm
parents: 23746
diff changeset
   243
      delsimps [@{thm imp_disjL}]    (*reduces blow-up*)
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   244
      addsimps @{thms analz_image_freshK_simps})
24122
fc7f857d33c8 tuned ML bindings (for multithreading);
wenzelm
parents: 23746
diff changeset
   245
fc7f857d33c8 tuned ML bindings (for multithreading);
wenzelm
parents: 23746
diff changeset
   246
end
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   247
*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   248
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   249
method_setup analz_freshCryptK = {*
30549
d2d7874648bd simplified method setup;
wenzelm
parents: 30510
diff changeset
   250
    Scan.succeed (fn ctxt =>
30510
4120fc59dd85 unified type Proof.method and pervasive METHOD combinators;
wenzelm
parents: 24122
diff changeset
   251
     (SIMPLE_METHOD
21588
cd0dc678a205 simplified method setup;
wenzelm
parents: 20048
diff changeset
   252
      (EVERY [REPEAT_FIRST (resolve_tac [allI, ballI, impI]),
24122
fc7f857d33c8 tuned ML bindings (for multithreading);
wenzelm
parents: 23746
diff changeset
   253
          REPEAT_FIRST (rtac @{thm analz_image_freshCryptK_lemma}),
fc7f857d33c8 tuned ML bindings (for multithreading);
wenzelm
parents: 23746
diff changeset
   254
          ALLGOALS (asm_simp_tac
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45605
diff changeset
   255
            (put_simpset OtwayReesBella.analz_image_freshK_ss ctxt))]))) *}
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   256
  "for proving useful rewrite rule"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   257
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   258
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   259
method_setup disentangle = {*
30549
d2d7874648bd simplified method setup;
wenzelm
parents: 30510
diff changeset
   260
    Scan.succeed
d2d7874648bd simplified method setup;
wenzelm
parents: 30510
diff changeset
   261
     (K (SIMPLE_METHOD
21588
cd0dc678a205 simplified method setup;
wenzelm
parents: 20048
diff changeset
   262
      (REPEAT_FIRST (eresolve_tac [asm_rl, conjE, disjE] 
30549
d2d7874648bd simplified method setup;
wenzelm
parents: 30510
diff changeset
   263
                   ORELSE' hyp_subst_tac)))) *}
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   264
  "for eliminating conjunctions, disjunctions and the like"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   265
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   266
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   267
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   268
lemma analz_image_freshCryptK [rule_format]: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   269
"evs \<in> orb \<Longrightarrow>                              
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   270
     Key K \<notin> analz (knows Spy evs) \<longrightarrow>  
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   271
       (\<forall> KK. KK \<subseteq> - (range shrK) \<longrightarrow>                  
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   272
             (Crypt K X \<in> analz (Key`KK \<union> (knows Spy evs))) =   
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   273
             (Crypt K X \<in> analz (knows Spy evs)))"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   274
apply (erule orb.induct)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   275
apply (analz_mono_contra)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   276
apply (frule_tac [7] Gets_Server_message_form)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   277
apply (frule_tac [9] Says_Server_message_form)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   278
apply disentangle
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   279
apply (drule_tac [5] Gets_imp_knows_Spy [THEN analz.Inj, THEN analz.Snd, THEN analz.Snd, THEN  analz.Snd])
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   280
prefer 8 apply clarify
44890
22f665a2e91c new fastforce replacing fastsimp - less confusing name
nipkow
parents: 39251
diff changeset
   281
apply (analz_freshCryptK, spy_analz, fastforce)
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   282
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   283
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   284
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   285
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   286
lemma analz_insert_freshCryptK: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   287
"\<lbrakk>evs \<in> orb;  Key K \<notin> analz (knows Spy evs);  
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   288
         Seskey \<notin> range shrK\<rbrakk> \<Longrightarrow>   
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   289
         (Crypt K X \<in> analz (insert (Key Seskey) (knows Spy evs))) =  
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   290
         (Crypt K X \<in> analz (knows Spy evs))"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   291
by (simp only: analz_image_freshCryptK analz_image_freshK_simps)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   292
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   293
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   294
lemma analz_hard: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   295
"\<lbrakk>Says A B \<lbrace>Nonce M, Agent A, Agent B,  
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   296
             Crypt (shrK A) \<lbrace>Nonce Na, Nonce M, Agent A, Agent B\<rbrace>\<rbrace> \<in>set evs; 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   297
   Crypt (shrK A) \<lbrace>Nonce Na, Key K\<rbrace> \<in> analz (knows Spy evs);  
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   298
   A \<notin> bad; B \<notin> bad; evs \<in> orb\<rbrakk>                   
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   299
 \<Longrightarrow>  Says B A \<lbrace>Nonce M, Crypt (shrK A) \<lbrace>Nonce Na, Key K\<rbrace>\<rbrace> \<in> set evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   300
apply (erule rev_mp)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   301
apply (erule rev_mp)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   302
apply (erule orb.induct)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   303
apply (frule_tac [7] Gets_Server_message_form)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   304
apply (frule_tac [9] Says_Server_message_form)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   305
apply disentangle
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   306
txt{*letting the simplifier solve OR2*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   307
apply (drule_tac [5] Gets_imp_knows_Spy [THEN analz.Inj, THEN analz.Snd, THEN analz.Snd, THEN analz.Snd])
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   308
apply (simp_all (no_asm_simp) add: analz_insert_eq pushes split_ifs)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   309
apply (spy_analz)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   310
txt{*OR1*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   311
apply blast
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   312
txt{*Oops*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   313
prefer 4 apply (blast dest: analz_insert_freshCryptK)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   314
txt{*OR4 - ii*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   315
prefer 3 apply (blast)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   316
txt{*OR3*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   317
(*adding Gets_imp_ and Says_imp_ for efficiency*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   318
apply (blast dest: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   319
       A_trusts_OR1 unique_Na Key_not_used analz_insert_freshCryptK)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   320
txt{*OR4 - i *}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   321
apply clarify
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   322
apply (simp add: pushes split_ifs)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   323
apply (case_tac "Aaa\<in>bad")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   324
apply (blast dest: analz_insert_freshCryptK)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   325
apply clarify
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   326
apply simp
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   327
apply (case_tac "Ba\<in>bad")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   328
apply (frule Gets_imp_knows_Spy [THEN analz.Inj, THEN analz.Snd, THEN analz.Decrypt, THEN analz.Fst] , assumption)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   329
apply (simp (no_asm_simp))
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   330
apply clarify
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   331
apply (frule Gets_imp_knows_Spy 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   332
             [THEN parts.Inj, THEN parts.Snd, THEN B_trusts_OR3],  
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   333
       assumption, assumption, assumption, erule exE)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   334
apply (frule Says_Server_imp_Gets 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   335
            [THEN Gets_imp_knows_Spy, THEN parts.Inj, THEN parts.Snd, 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   336
            THEN parts.Snd, THEN parts.Snd, THEN parts.Fst, THEN A_trusts_OR1],
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   337
       assumption, assumption, assumption, assumption)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   338
apply (blast dest: Says_Server_imp_Gets B_trusts_OR2 unique_Na unique_Nb)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   339
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   340
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   341
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   342
lemma Gets_Server_message_form': 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   343
"\<lbrakk>Gets B \<lbrace>Nonce M, Crypt (shrK B) \<lbrace>X, Nonce Nb, Key K\<rbrace>\<rbrace>  \<in> set evs;  
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   344
   B \<notin> bad; evs \<in> orb\<rbrakk>                              
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   345
  \<Longrightarrow> K \<notin> range shrK & (\<exists> A Na. X = (Crypt (shrK A) \<lbrace>Nonce Na, Key K\<rbrace>))"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   346
by (blast dest!: B_trusts_OR3 Says_Server_message_form)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   347
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   348
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   349
lemma OR4_imp_Gets: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   350
"\<lbrakk>Says B A \<lbrace>Nonce M, Crypt (shrK A) \<lbrace>Nonce Na, Key K\<rbrace>\<rbrace> \<in> set evs;   
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   351
   B \<notin> bad; evs \<in> orb\<rbrakk>  
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   352
 \<Longrightarrow> (\<exists> Nb. Gets B \<lbrace>Nonce M, Crypt (shrK B) \<lbrace>Crypt (shrK A) \<lbrace>Nonce Na, Key K\<rbrace>,
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   353
                                             Nonce Nb, Key K\<rbrace>\<rbrace> \<in> set evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   354
apply (erule rev_mp, erule orb.induct, parts_explicit, simp_all)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   355
prefer 3 apply (blast dest: Gets_Server_message_form')
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   356
apply blast+
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   357
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   358
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   359
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   360
lemma A_keydist_to_B: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   361
"\<lbrakk>Says A B \<lbrace>Nonce M, Agent A, Agent B,  
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   362
            Crypt (shrK A) \<lbrace>Nonce Na, Nonce M, Agent A, Agent B\<rbrace>\<rbrace> \<in>set evs; 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   363
   Gets A \<lbrace>Nonce M, Crypt (shrK A) \<lbrace>Nonce Na, Key K\<rbrace>\<rbrace> \<in> set evs;    
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   364
   A \<notin> bad; B \<notin> bad; evs \<in> orb\<rbrakk>  
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   365
  \<Longrightarrow> Key K \<in> analz (knows B evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   366
apply (drule Gets_imp_knows_Spy [THEN analz.Inj, THEN analz.Snd], assumption)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   367
apply (drule analz_hard, assumption, assumption, assumption, assumption)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   368
apply (drule OR4_imp_Gets, assumption, assumption)
44890
22f665a2e91c new fastforce replacing fastsimp - less confusing name
nipkow
parents: 39251
diff changeset
   369
apply (fastforce dest!: Gets_imp_knows [THEN analz.Inj] analz.Decrypt)
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   370
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   371
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   372
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   373
text{*Other properties as for the original protocol*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   374
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   375
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   376
end