src/HOL/Auth/Smartcard/EventSC.thy
author wenzelm
Sun, 02 Nov 2014 18:21:45 +0100
changeset 58889 5b7a9633cfa8
parent 58860 fee7cfa69c50
child 61830 4f5ab843cf5b
permissions -rw-r--r--
modernized header uniformly as section;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
58889
5b7a9633cfa8 modernized header uniformly as section;
wenzelm
parents: 58860
diff changeset
     1
section{*Theory of Events for Security Protocols that use smartcards*}
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
     2
53428
3083c611ec40 use case_of_simps
noschinl
parents: 46471
diff changeset
     3
theory EventSC
3083c611ec40 use case_of_simps
noschinl
parents: 46471
diff changeset
     4
imports
3083c611ec40 use case_of_simps
noschinl
parents: 46471
diff changeset
     5
  "../Message"
3083c611ec40 use case_of_simps
noschinl
parents: 46471
diff changeset
     6
  "~~/src/HOL/Library/Simps_Case_Conv"
3083c611ec40 use case_of_simps
noschinl
parents: 46471
diff changeset
     7
begin
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
     8
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
     9
consts  (*Initial states of agents -- parameter of the construction*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    10
  initState :: "agent => msg set"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    11
58310
91ea607a34d8 updated news
blanchet
parents: 58249
diff changeset
    12
datatype card = Card agent
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    13
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    14
text{*Four new events express the traffic between an agent and his card*}
58310
91ea607a34d8 updated news
blanchet
parents: 58249
diff changeset
    15
datatype  
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    16
  event = Says  agent agent msg
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    17
        | Notes agent       msg
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    18
        | Gets  agent       msg
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    19
        | Inputs agent card msg (*Agent sends to card and\<dots>*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    20
        | C_Gets card       msg (*\<dots> card receives it*) 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    21
        | Outpts card agent msg (*Card sends to agent and\<dots>*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    22
        | A_Gets agent      msg (*agent receives it*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    23
    
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    24
consts 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    25
 bad     :: "agent set"  (*compromised agents*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    26
 stolen    :: "card set" (* stolen smart cards *)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    27
 cloned  :: "card set"   (* cloned smart cards*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    28
 secureM :: "bool"(*assumption of secure means between agents and their cards*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    29
20768
1d478c2d621f replaced syntax/translations by abbreviation;
wenzelm
parents: 18886
diff changeset
    30
abbreviation
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 20768
diff changeset
    31
  insecureM :: bool where (*certain protocols make no assumption of secure means*)
20768
1d478c2d621f replaced syntax/translations by abbreviation;
wenzelm
parents: 18886
diff changeset
    32
  "insecureM == \<not>secureM"
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    33
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    34
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    35
text{*Spy has access to his own key for spoof messages, but Server is secure*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    36
specification (bad)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    37
  Spy_in_bad     [iff]: "Spy \<in> bad"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    38
  Server_not_bad [iff]: "Server \<notin> bad"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    39
  apply (rule exI [of _ "{Spy}"], simp) done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    40
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    41
specification (stolen)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    42
  (*The server's card is secure by assumption\<dots>*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    43
  Card_Server_not_stolen [iff]: "Card Server \<notin> stolen"
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26302
diff changeset
    44
  Card_Spy_not_stolen    [iff]: "Card Spy \<notin> stolen"
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    45
  apply blast done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    46
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    47
specification (cloned)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    48
  (*\<dots> the spy's card is secure because she already can use it freely*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    49
  Card_Server_not_cloned [iff]: "Card Server \<notin> cloned"
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26302
diff changeset
    50
  Card_Spy_not_cloned    [iff]: "Card Spy \<notin> cloned"
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    51
  apply blast done
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
primrec (*This definition is extended over the new events, subject to the 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    54
          assumption of secure means*)
39246
9e58f0499f57 modernized primrec
haftmann
parents: 32960
diff changeset
    55
  knows   :: "agent => event list => msg set" (*agents' knowledge*) where
9e58f0499f57 modernized primrec
haftmann
parents: 32960
diff changeset
    56
  knows_Nil:   "knows A [] = initState A" |
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    57
  knows_Cons:  "knows A (ev # evs) =
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26302
diff changeset
    58
         (case ev of
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26302
diff changeset
    59
            Says A' B X => 
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    60
                if (A=A' | A=Spy) then insert X (knows A evs) else knows A evs
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26302
diff changeset
    61
          | Notes A' X  => 
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26302
diff changeset
    62
                if (A=A' | (A=Spy & A'\<in>bad)) then insert X (knows A evs) 
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    63
                                             else knows A evs 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    64
          | Gets A' X   =>
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26302
diff changeset
    65
                if (A=A' & A \<noteq> Spy) then insert X (knows A evs) 
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    66
                                     else knows A evs
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    67
          | Inputs A' C X =>
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26302
diff changeset
    68
              if secureM then
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    69
                if A=A' then insert X (knows A evs) else knows A evs
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26302
diff changeset
    70
              else
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26302
diff changeset
    71
                if (A=A' | A=Spy) then insert X (knows A evs) else knows A evs
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    72
          | C_Gets C X   => knows A evs
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    73
          | Outpts C A' X =>
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26302
diff changeset
    74
              if secureM then
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    75
                if A=A' then insert X (knows A evs) else knows A evs
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    76
              else
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26302
diff changeset
    77
                if A=Spy then insert X (knows A evs) else knows A evs
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    78
          | A_Gets A' X   =>
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26302
diff changeset
    79
                if (A=A' & A \<noteq> Spy) then insert X (knows A evs) 
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    80
                                     else knows A evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    81
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    82
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    83
39246
9e58f0499f57 modernized primrec
haftmann
parents: 32960
diff changeset
    84
primrec
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    85
  (*The set of items that might be visible to someone is easily extended 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    86
    over the new events*)
39246
9e58f0499f57 modernized primrec
haftmann
parents: 32960
diff changeset
    87
  used :: "event list => msg set" where
9e58f0499f57 modernized primrec
haftmann
parents: 32960
diff changeset
    88
  used_Nil:   "used []         = (UN B. parts (initState B))" |
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    89
  used_Cons:  "used (ev # evs) =
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26302
diff changeset
    90
                 (case ev of
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26302
diff changeset
    91
                    Says A B X => parts {X} \<union> (used evs)
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26302
diff changeset
    92
                  | Notes A X  => parts {X} \<union> (used evs)
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26302
diff changeset
    93
                  | Gets A X   => used evs
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    94
                  | Inputs A C X  => parts{X} \<union> (used evs) 
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26302
diff changeset
    95
                  | C_Gets C X   => used evs
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    96
                  | Outpts C A X  => parts{X} \<union> (used evs)
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 26302
diff changeset
    97
                  | A_Gets A X   => used evs)"
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    98
    --{*@{term Gets} always follows @{term Says} in real protocols. 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    99
       Likewise, @{term C_Gets} will always have to follow @{term Inputs}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   100
       and @{term A_Gets} will always have to follow @{term Outpts}*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   101
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   102
lemma Notes_imp_used [rule_format]: "Notes A X \<in> set evs \<longrightarrow> X \<in> used evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   103
apply (induct_tac evs)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   104
apply (auto split: event.split) 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   105
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   106
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   107
lemma Says_imp_used [rule_format]: "Says A B X \<in> set evs \<longrightarrow> X \<in> used evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   108
apply (induct_tac evs)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   109
apply (auto split: event.split) 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   110
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   111
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   112
lemma MPair_used [rule_format]:
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   113
     "MPair X Y \<in> used evs \<longrightarrow> X \<in> used evs & Y \<in> used evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   114
apply (induct_tac evs)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   115
apply (auto split: event.split) 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   116
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   117
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
subsection{*Function @{term knows}*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   120
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   121
(*Simplifying   
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   122
 parts(insert X (knows Spy evs)) = parts{X} \<union> parts(knows Spy evs).
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   123
  This version won't loop with the simplifier.*)
45605
a89b4bc311a5 eliminated obsolete "standard";
wenzelm
parents: 39246
diff changeset
   124
lemmas parts_insert_knows_A = parts_insert [of _ "knows A evs"] for A evs
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   125
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   126
lemma knows_Spy_Says [simp]:
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   127
     "knows Spy (Says A B X # evs) = insert X (knows Spy evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   128
by simp
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   129
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   130
text{*Letting the Spy see "bad" agents' notes avoids redundant case-splits
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   131
      on whether @{term "A=Spy"} and whether @{term "A\<in>bad"}*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   132
lemma knows_Spy_Notes [simp]:
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   133
     "knows Spy (Notes A X # evs) =  
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   134
          (if A\<in>bad then insert X (knows Spy evs) else knows Spy evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   135
by simp
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   136
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   137
lemma knows_Spy_Gets [simp]: "knows Spy (Gets A X # evs) = knows Spy evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   138
by simp
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 knows_Spy_Inputs_secureM [simp]: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   141
     "secureM \<Longrightarrow> knows Spy (Inputs A C X # evs) =  
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   142
        (if A=Spy then insert X (knows Spy evs) else knows Spy evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   143
by simp
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   144
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   145
lemma knows_Spy_Inputs_insecureM [simp]: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   146
     "insecureM \<Longrightarrow> knows Spy (Inputs A C X # evs) = insert X (knows Spy evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   147
by simp
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   148
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   149
lemma knows_Spy_C_Gets [simp]: "knows Spy (C_Gets C X # evs) = knows Spy evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   150
by simp
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 knows_Spy_Outpts_secureM [simp]: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   153
      "secureM \<Longrightarrow> knows Spy (Outpts C A X # evs) = 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   154
         (if A=Spy then insert X (knows Spy evs) else knows Spy evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   155
by simp
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   156
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   157
lemma knows_Spy_Outpts_insecureM [simp]: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   158
      "insecureM \<Longrightarrow> knows Spy (Outpts C A X # evs) = insert X (knows Spy evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   159
by simp
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
lemma knows_Spy_A_Gets [simp]: "knows Spy (A_Gets A X # evs) = knows Spy evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   162
by simp
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
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   165
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   166
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   167
lemma knows_Spy_subset_knows_Spy_Says:
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   168
     "knows Spy evs \<subseteq> knows Spy (Says A B X # evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   169
by (simp add: subset_insertI)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   170
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   171
lemma knows_Spy_subset_knows_Spy_Notes:
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   172
     "knows Spy evs \<subseteq> knows Spy (Notes A X # evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   173
by force
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   174
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   175
lemma knows_Spy_subset_knows_Spy_Gets:
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   176
     "knows Spy evs \<subseteq> knows Spy (Gets A X # evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   177
by (simp add: subset_insertI)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   178
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   179
lemma knows_Spy_subset_knows_Spy_Inputs: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   180
     "knows Spy evs \<subseteq> knows Spy (Inputs A C X # evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   181
by auto
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 knows_Spy_equals_knows_Spy_Gets: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   184
     "knows Spy evs = knows Spy (C_Gets C X # evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   185
by (simp add: subset_insertI)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   186
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   187
lemma knows_Spy_subset_knows_Spy_Outpts: "knows Spy evs \<subseteq> knows Spy (Outpts C A X # evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   188
by auto
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   189
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   190
lemma knows_Spy_subset_knows_Spy_A_Gets: "knows Spy evs \<subseteq> knows Spy (A_Gets A X # evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   191
by (simp add: subset_insertI)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   192
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   193
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   194
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   195
text{*Spy sees what is sent on the traffic*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   196
lemma Says_imp_knows_Spy [rule_format]:
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   197
     "Says A B X \<in> set evs \<longrightarrow> X \<in> knows Spy evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   198
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   199
apply (simp_all (no_asm_simp) split add: event.split)
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
lemma Notes_imp_knows_Spy [rule_format]:
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   203
     "Notes A X \<in> set evs \<longrightarrow> A\<in> bad \<longrightarrow> X \<in> knows Spy evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   204
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   205
apply (simp_all (no_asm_simp) split add: event.split)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   206
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   207
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   208
(*Nothing can be stated on a Gets event*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   209
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   210
lemma Inputs_imp_knows_Spy_secureM [rule_format (no_asm)]: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   211
     "Inputs Spy C X \<in> set evs \<longrightarrow> secureM \<longrightarrow> X \<in> knows Spy evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   212
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   213
apply (simp_all (no_asm_simp) split add: event.split)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   214
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   215
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   216
lemma Inputs_imp_knows_Spy_insecureM [rule_format (no_asm)]:
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   217
     "Inputs A C X \<in> set evs \<longrightarrow> insecureM \<longrightarrow> X \<in> knows Spy evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   218
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   219
apply (simp_all (no_asm_simp) split add: event.split)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   220
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   221
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   222
(*Nothing can be stated on a C_Gets event*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   223
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   224
lemma Outpts_imp_knows_Spy_secureM [rule_format (no_asm)]: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   225
     "Outpts C Spy X \<in> set evs \<longrightarrow> secureM \<longrightarrow> X \<in> knows Spy evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   226
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   227
apply (simp_all (no_asm_simp) split add: event.split)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   228
done
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 Outpts_imp_knows_Spy_insecureM [rule_format (no_asm)]:
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   231
     "Outpts C A X \<in> set evs \<longrightarrow> insecureM \<longrightarrow> X \<in> knows Spy evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   232
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   233
apply (simp_all (no_asm_simp) split add: event.split)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   234
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   235
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   236
(*Nothing can be stated on an A_Gets event*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   237
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   238
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   239
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   240
text{*Elimination rules: derive contradictions from old Says events containing
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   241
  items known to be fresh*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   242
lemmas knows_Spy_partsEs =
46471
2289a3869c88 prefer high-level elim_format;
wenzelm
parents: 45605
diff changeset
   243
     Says_imp_knows_Spy [THEN parts.Inj, elim_format]
2289a3869c88 prefer high-level elim_format;
wenzelm
parents: 45605
diff changeset
   244
     parts.Body [elim_format]
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   245
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   246
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
subsection{*Knowledge of Agents*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   249
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   250
lemma knows_Inputs: "knows A (Inputs A C X # evs) = insert X (knows A evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   251
by simp
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   252
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   253
lemma knows_C_Gets: "knows A (C_Gets C X # evs) = knows A evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   254
by simp
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   255
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   256
lemma knows_Outpts_secureM: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   257
      "secureM \<longrightarrow> knows A (Outpts C A X # evs) = insert X (knows A evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   258
by simp
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   259
26302
68b073052e8c proper naming of knows_Outpts_insecureM, knows_subset_knows_A_Gets;
wenzelm
parents: 21404
diff changeset
   260
lemma knows_Outpts_insecureM: 
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   261
      "insecureM \<longrightarrow> knows Spy (Outpts C A X # evs) = insert X (knows Spy evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   262
by simp
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   263
(*somewhat equivalent to knows_Spy_Outpts_insecureM*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   264
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 knows_subset_knows_Says: "knows A evs \<subseteq> knows A (Says A' B X # evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   269
by (simp add: subset_insertI)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   270
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   271
lemma knows_subset_knows_Notes: "knows A evs \<subseteq> knows A (Notes A' X # evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   272
by (simp add: subset_insertI)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   273
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   274
lemma knows_subset_knows_Gets: "knows A evs \<subseteq> knows A (Gets A' X # evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   275
by (simp add: subset_insertI)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   276
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   277
lemma knows_subset_knows_Inputs: "knows A evs \<subseteq> knows A (Inputs A' C X # evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   278
by (simp add: subset_insertI)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   279
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   280
lemma knows_subset_knows_C_Gets: "knows A evs \<subseteq> knows A (C_Gets C X # evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   281
by (simp add: subset_insertI)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   282
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   283
lemma knows_subset_knows_Outpts: "knows A evs \<subseteq> knows A (Outpts C A' X # evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   284
by (simp add: subset_insertI)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   285
26302
68b073052e8c proper naming of knows_Outpts_insecureM, knows_subset_knows_A_Gets;
wenzelm
parents: 21404
diff changeset
   286
lemma knows_subset_knows_A_Gets: "knows A evs \<subseteq> knows A (A_Gets A' X # evs)"
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   287
by (simp add: subset_insertI)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   288
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   289
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   290
text{*Agents know what they say*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   291
lemma Says_imp_knows [rule_format]: "Says A B X \<in> set evs \<longrightarrow> X \<in> knows A evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   292
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   293
apply (simp_all (no_asm_simp) split add: event.split)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   294
apply blast
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   295
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   296
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   297
text{*Agents know what they note*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   298
lemma Notes_imp_knows [rule_format]: "Notes A X \<in> set evs \<longrightarrow> X \<in> knows A evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   299
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   300
apply (simp_all (no_asm_simp) split add: event.split)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   301
apply blast
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   302
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   303
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   304
text{*Agents know what they receive*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   305
lemma Gets_imp_knows_agents [rule_format]:
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   306
     "A \<noteq> Spy \<longrightarrow> Gets A X \<in> set evs \<longrightarrow> X \<in> knows A evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   307
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   308
apply (simp_all (no_asm_simp) split add: event.split)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   309
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   310
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   311
(*Agents know what they input to their smart card*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   312
lemma Inputs_imp_knows_agents [rule_format (no_asm)]: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   313
     "Inputs A (Card A) X \<in> set evs \<longrightarrow> X \<in> knows A evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   314
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   315
apply (simp_all (no_asm_simp) split add: event.split)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   316
apply blast
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   317
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   318
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   319
(*Nothing to prove about C_Gets*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   320
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   321
(*Agents know what they obtain as output of their smart card,
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   322
  if the means is secure...*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   323
lemma Outpts_imp_knows_agents_secureM [rule_format (no_asm)]: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   324
     "secureM \<longrightarrow> Outpts (Card A) A X \<in> set evs \<longrightarrow> X \<in> knows A evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   325
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   326
apply (simp_all (no_asm_simp) split add: event.split)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   327
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   328
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   329
(*otherwise only the spy knows the outputs*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   330
lemma Outpts_imp_knows_agents_insecureM [rule_format (no_asm)]: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   331
      "insecureM \<longrightarrow> Outpts (Card A) A X \<in> set evs \<longrightarrow> X \<in> knows Spy evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   332
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   333
apply (simp_all (no_asm_simp) split add: event.split)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   334
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   335
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   336
(*end lemmas about agents' knowledge*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   337
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   338
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   339
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   340
lemma parts_knows_Spy_subset_used: "parts (knows Spy evs) \<subseteq> used evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   341
apply (induct_tac "evs", force)  
53428
3083c611ec40 use case_of_simps
noschinl
parents: 46471
diff changeset
   342
apply (simp add: parts_insert_knows_A add: event.split, blast)
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   343
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   344
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   345
lemmas usedI = parts_knows_Spy_subset_used [THEN subsetD, intro]
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   346
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   347
lemma initState_into_used: "X \<in> parts (initState B) \<Longrightarrow> X \<in> used evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   348
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   349
apply (simp_all add: parts_insert_knows_A split add: event.split, blast)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   350
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   351
53428
3083c611ec40 use case_of_simps
noschinl
parents: 46471
diff changeset
   352
simps_of_case used_Cons_simps[simp]: used_Cons
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   353
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   354
lemma used_nil_subset: "used [] \<subseteq> used evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   355
apply simp
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   356
apply (blast intro: initState_into_used)
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
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   361
(*Novel lemmas*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   362
lemma Says_parts_used [rule_format (no_asm)]: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   363
     "Says A B X \<in> set evs \<longrightarrow> (parts  {X}) \<subseteq> used evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   364
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   365
apply (simp_all (no_asm_simp) split add: event.split)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   366
apply blast
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   367
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   368
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   369
lemma Notes_parts_used [rule_format (no_asm)]: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   370
     "Notes A X \<in> set evs \<longrightarrow> (parts  {X}) \<subseteq> used evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   371
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   372
apply (simp_all (no_asm_simp) split add: event.split)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   373
apply blast
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   374
done
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
lemma Outpts_parts_used [rule_format (no_asm)]: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   377
     "Outpts C A X \<in> set evs \<longrightarrow> (parts  {X}) \<subseteq> used evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   378
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   379
apply (simp_all (no_asm_simp) split add: event.split)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   380
apply blast
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   381
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   382
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   383
lemma Inputs_parts_used [rule_format (no_asm)]: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   384
     "Inputs A C X \<in> set evs \<longrightarrow> (parts  {X}) \<subseteq> used evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   385
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   386
apply (simp_all (no_asm_simp) split add: event.split)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   387
apply blast
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   388
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   389
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   390
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   391
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   392
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   393
text{*NOTE REMOVAL--laws above are cleaner, as they don't involve "case"*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   394
declare knows_Cons [simp del]
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   395
        used_Nil [simp del] used_Cons [simp del]
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   396
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   397
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   398
lemma knows_subset_knows_Cons: "knows A evs \<subseteq> knows A (e # evs)"
53428
3083c611ec40 use case_of_simps
noschinl
parents: 46471
diff changeset
   399
by (cases e, auto simp: knows_Cons)
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   400
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   401
lemma initState_subset_knows: "initState A \<subseteq> knows A evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   402
apply (induct_tac evs, simp) 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   403
apply (blast intro: knows_subset_knows_Cons [THEN subsetD])
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   404
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   405
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   406
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   407
text{*For proving @{text new_keys_not_used}*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   408
lemma keysFor_parts_insert:
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   409
     "\<lbrakk> K \<in> keysFor (parts (insert X G));  X \<in> synth (analz H) \<rbrakk>   
58860
fee7cfa69c50 eliminated spurious semicolons;
wenzelm
parents: 58310
diff changeset
   410
      \<Longrightarrow> K \<in> keysFor (parts (G \<union> H)) \<or> Key (invKey K) \<in> parts H" 
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   411
by (force 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   412
    dest!: parts_insert_subset_Un [THEN keysFor_mono, THEN [2] rev_subsetD]
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   413
           analz_subset_parts [THEN keysFor_mono, THEN [2] rev_subsetD]
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   414
    intro: analz_subset_parts [THEN subsetD] parts_mono [THEN [2] rev_subsetD])
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   415
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   416
end