src/HOL/Auth/Smartcard/EventSC.thy
author wenzelm
Thu, 28 Sep 2006 23:42:35 +0200
changeset 20768 1d478c2d621f
parent 18886 9f27383426db
child 21404 eb85850d3eb7
permissions -rwxr-xr-x
replaced syntax/translations by abbreviation;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
     1
header{*Theory of Events for Security Protocols that use smartcards*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
     2
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
     3
theory EventSC imports "../Message" begin
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
consts  (*Initial states of agents -- parameter of the construction*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
     6
  initState :: "agent => msg set"
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
datatype card = Card agent
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{*Four new events express the traffic between an agent and his card*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    11
datatype  
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    12
  event = Says  agent agent msg
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    13
        | Notes agent       msg
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    14
        | Gets  agent       msg
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    15
        | Inputs agent card msg (*Agent sends to card and\<dots>*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    16
        | C_Gets card       msg (*\<dots> card receives it*) 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    17
        | Outpts card agent msg (*Card sends to agent and\<dots>*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    18
        | A_Gets agent      msg (*agent receives it*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    19
    
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    20
consts 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    21
 bad     :: "agent set"  (*compromised agents*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    22
 knows   :: "agent => event list => msg set" (*agents' knowledge*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    23
 stolen    :: "card set" (* stolen smart cards *)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    24
 cloned  :: "card set"   (* cloned smart cards*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    25
 secureM :: "bool"(*assumption of secure means between agents and their cards*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    26
20768
1d478c2d621f replaced syntax/translations by abbreviation;
wenzelm
parents: 18886
diff changeset
    27
abbreviation
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    28
  insecureM :: bool (*certain protocols make no assumption of secure means*)
20768
1d478c2d621f replaced syntax/translations by abbreviation;
wenzelm
parents: 18886
diff changeset
    29
  "insecureM == \<not>secureM"
18886
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    30
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    31
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    32
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
    33
specification (bad)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    34
  Spy_in_bad     [iff]: "Spy \<in> bad"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    35
  Server_not_bad [iff]: "Server \<notin> bad"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    36
  apply (rule exI [of _ "{Spy}"], simp) done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    37
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    38
specification (stolen)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    39
  (*The server's card is secure by assumption\<dots>*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    40
  Card_Server_not_stolen [iff]: "Card Server \<notin> stolen"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    41
  Card_Spy_not_stolen  	 [iff]: "Card Spy \<notin> stolen"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    42
  apply blast done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    43
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    44
specification (cloned)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    45
  (*\<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
    46
  Card_Server_not_cloned [iff]: "Card Server \<notin> cloned"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    47
  Card_Spy_not_cloned  	 [iff]: "Card Spy \<notin> cloned"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    48
  apply blast done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    49
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    50
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    51
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
    52
          assumption of secure means*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    53
  knows_Nil:   "knows A [] = initState A"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    54
  knows_Cons:  "knows A (ev # evs) =
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    55
	 (case ev of
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    56
	    Says A' B X => 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    57
                if (A=A' | A=Spy) then insert X (knows A evs) else knows A evs
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    58
	  | Notes A' X  => 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    59
	        if (A=A' | (A=Spy & A'\<in>bad)) then insert X (knows A evs) 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    60
                                             else knows A evs 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    61
          | Gets A' X   =>
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    62
		if (A=A' & A \<noteq> Spy) then insert X (knows A evs) 
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
          | Inputs A' C X =>
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    65
	      if secureM then
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    66
                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
    67
	      else
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    68
	        if (A=A' | A=Spy) then insert X (knows A evs) else knows A evs
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    69
          | C_Gets C X   => knows A evs
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    70
          | Outpts C A' X =>
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    71
	      if secureM then
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    72
                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
    73
              else
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    74
	        if A=Spy then insert X (knows A evs) else knows A evs
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    75
          | A_Gets A' X   =>
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    76
		if (A=A' & A \<noteq> Spy) then insert X (knows A evs) 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    77
                                     else knows A evs)"
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
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    80
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    81
consts
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    82
  (*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
    83
    over the new events*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    84
  used :: "event list => msg set"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    85
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    86
primrec
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    87
  used_Nil:   "used []         = (UN B. parts (initState B))"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    88
  used_Cons:  "used (ev # evs) =
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    89
	         (case ev of
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    90
		    Says A B X => parts {X} \<union> (used evs)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    91
		  | Notes A X  => parts {X} \<union> (used evs)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    92
		  | Gets A X   => used evs
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    93
                  | Inputs A C X  => parts{X} \<union> (used evs) 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    94
		  | C_Gets C X   => used evs
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    95
                  | Outpts C A X  => parts{X} \<union> (used evs)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    96
		  | A_Gets A X   => used evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    97
    --{*@{term Gets} always follows @{term Says} in real protocols. 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    98
       Likewise, @{term C_Gets} will always have to follow @{term Inputs}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
    99
       and @{term A_Gets} will always have to follow @{term Outpts}*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   100
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.*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   124
lemmas parts_insert_knows_A = parts_insert [of _ "knows A evs", standard]
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 =
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   243
     Says_imp_knows_Spy [THEN parts.Inj, THEN revcut_rl, standard] 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   244
     parts.Body [THEN revcut_rl, standard]
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_Says: "knows A (Says A B 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_Notes: "knows A (Notes A X # evs) = insert X (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_Gets:
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   257
      "A \<noteq> Spy \<longrightarrow> knows A (Gets 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
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   260
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
   261
by simp
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   262
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   263
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
   264
by simp
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
lemma knows_Outpts_secureM: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   267
      "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
   268
by simp
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   269
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   270
lemma knows_Outpts_secureM: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   271
      "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
   272
by simp
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   273
(*somewhat equivalent to knows_Spy_Outpts_insecureM*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   274
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   275
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
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   278
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
   279
by (simp add: subset_insertI)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   280
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   281
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
   282
by (simp add: subset_insertI)
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
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
   285
by (simp add: subset_insertI)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   286
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   287
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
   288
by (simp add: subset_insertI)
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
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
   291
by (simp add: subset_insertI)
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
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
   294
by (simp add: subset_insertI)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   295
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   296
lemma knows_subset_knows_Gets: "knows A evs \<subseteq> knows A (A_Gets A' X # evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   297
by (simp add: subset_insertI)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   298
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   299
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   300
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   301
text{*Agents know what they say*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   302
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
   303
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   304
apply (simp_all (no_asm_simp) split add: event.split)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   305
apply blast
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   306
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   307
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   308
text{*Agents know what they note*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   309
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
   310
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   311
apply (simp_all (no_asm_simp) split add: event.split)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   312
apply blast
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   313
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   314
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   315
text{*Agents know what they receive*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   316
lemma Gets_imp_knows_agents [rule_format]:
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   317
     "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
   318
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   319
apply (simp_all (no_asm_simp) split add: event.split)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   320
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   321
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   322
(*Agents know what they input to their smart card*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   323
lemma Inputs_imp_knows_agents [rule_format (no_asm)]: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   324
     "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
   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
apply blast
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   328
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   329
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   330
(*Nothing to prove about C_Gets*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   331
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   332
(*Agents know what they obtain as output of their smart card,
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   333
  if the means is secure...*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   334
lemma Outpts_imp_knows_agents_secureM [rule_format (no_asm)]: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   335
     "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
   336
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   337
apply (simp_all (no_asm_simp) split add: event.split)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   338
done
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
(*otherwise only the spy knows the outputs*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   341
lemma Outpts_imp_knows_agents_insecureM [rule_format (no_asm)]: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   342
      "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
   343
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   344
apply (simp_all (no_asm_simp) split add: event.split)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   345
done
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
(*end lemmas about agents' knowledge*)
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
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   350
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   351
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
   352
apply (induct_tac "evs", force)  
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   353
apply (simp add: parts_insert_knows_A knows_Cons add: event.split, blast) 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   354
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   355
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   356
lemmas usedI = parts_knows_Spy_subset_used [THEN subsetD, intro]
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   357
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   358
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
   359
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   360
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
   361
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   362
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   363
lemma used_Says [simp]: "used (Says A B X # evs) = parts{X} \<union> used evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   364
by simp
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   365
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   366
lemma used_Notes [simp]: "used (Notes A X # evs) = parts{X} \<union> used evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   367
by simp
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 used_Gets [simp]: "used (Gets A X # evs) = used evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   370
by simp
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
lemma used_Inputs [simp]: "used (Inputs A C X # evs) = parts{X} \<union> used evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   373
by simp
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
lemma used_C_Gets [simp]: "used (C_Gets C X # evs) = used evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   376
by simp
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   377
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   378
lemma used_Outpts [simp]: "used (Outpts C A X # evs) = parts{X} \<union> used evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   379
by simp
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   380
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   381
lemma used_A_Gets [simp]: "used (A_Gets A X # evs) = used evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   382
by simp
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   383
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   384
lemma used_nil_subset: "used [] \<subseteq> used evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   385
apply simp
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   386
apply (blast intro: initState_into_used)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   387
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   388
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
(*Novel lemmas*)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   392
lemma Says_parts_used [rule_format (no_asm)]: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   393
     "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
   394
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   395
apply (simp_all (no_asm_simp) split add: event.split)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   396
apply blast
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   397
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   398
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   399
lemma Notes_parts_used [rule_format (no_asm)]: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   400
     "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
   401
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   402
apply (simp_all (no_asm_simp) split add: event.split)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   403
apply blast
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
lemma Outpts_parts_used [rule_format (no_asm)]: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   407
     "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
   408
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   409
apply (simp_all (no_asm_simp) split add: event.split)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   410
apply blast
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   411
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   412
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   413
lemma Inputs_parts_used [rule_format (no_asm)]: 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   414
     "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
   415
apply (induct_tac "evs")
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   416
apply (simp_all (no_asm_simp) split add: event.split)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   417
apply blast
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   418
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   419
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   420
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   421
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   422
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   423
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
   424
declare knows_Cons [simp del]
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   425
        used_Nil [simp del] used_Cons [simp del]
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   426
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   427
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   428
lemma knows_subset_knows_Cons: "knows A evs \<subseteq> knows A (e # evs)"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   429
by (induct e, auto simp: knows_Cons)
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   430
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   431
lemma initState_subset_knows: "initState A \<subseteq> knows A evs"
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   432
apply (induct_tac evs, simp) 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   433
apply (blast intro: knows_subset_knows_Cons [THEN subsetD])
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   434
done
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   435
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   436
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   437
text{*For proving @{text new_keys_not_used}*}
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   438
lemma keysFor_parts_insert:
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   439
     "\<lbrakk> K \<in> keysFor (parts (insert X G));  X \<in> synth (analz H) \<rbrakk>   
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   440
      \<Longrightarrow> K \<in> keysFor (parts (G \<union> H)) \<or> Key (invKey K) \<in> parts H"; 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   441
by (force 
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   442
    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
   443
           analz_subset_parts [THEN keysFor_mono, THEN [2] rev_subsetD]
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   444
    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
   445
9f27383426db new and updated protocol proofs by Giamp Bella
paulson
parents:
diff changeset
   446
end