src/Doc/Tutorial/Protocol/Event.thy
changeset 63648 f9f3006a5579
parent 62392 747d36865c2c
child 67406 23307fd33906
equal deleted inserted replaced
63647:437bd400d808 63648:f9f3006a5579
   123 
   123 
   124 text{*Spy sees what is sent on the traffic*}
   124 text{*Spy sees what is sent on the traffic*}
   125 lemma Says_imp_knows_Spy [rule_format]:
   125 lemma Says_imp_knows_Spy [rule_format]:
   126      "Says A B X \<in> set evs --> X \<in> knows Spy evs"
   126      "Says A B X \<in> set evs --> X \<in> knows Spy evs"
   127 apply (induct_tac "evs")
   127 apply (induct_tac "evs")
   128 apply (simp_all (no_asm_simp) split add: event.split)
   128 apply (simp_all (no_asm_simp) split: event.split)
   129 done
   129 done
   130 
   130 
   131 lemma Notes_imp_knows_Spy [rule_format]:
   131 lemma Notes_imp_knows_Spy [rule_format]:
   132      "Notes A X \<in> set evs --> A: bad --> X \<in> knows Spy evs"
   132      "Notes A X \<in> set evs --> A: bad --> X \<in> knows Spy evs"
   133 apply (induct_tac "evs")
   133 apply (induct_tac "evs")
   134 apply (simp_all (no_asm_simp) split add: event.split)
   134 apply (simp_all (no_asm_simp) split: event.split)
   135 done
   135 done
   136 
   136 
   137 
   137 
   138 text{*Elimination rules: derive contradictions from old Says events containing
   138 text{*Elimination rules: derive contradictions from old Says events containing
   139   items known to be fresh*}
   139   items known to be fresh*}
   172 by (simp add: subset_insertI)
   172 by (simp add: subset_insertI)
   173 
   173 
   174 text{*Agents know what they say*}
   174 text{*Agents know what they say*}
   175 lemma Says_imp_knows [rule_format]: "Says A B X \<in> set evs --> X \<in> knows A evs"
   175 lemma Says_imp_knows [rule_format]: "Says A B X \<in> set evs --> X \<in> knows A evs"
   176 apply (induct_tac "evs")
   176 apply (induct_tac "evs")
   177 apply (simp_all (no_asm_simp) split add: event.split)
   177 apply (simp_all (no_asm_simp) split: event.split)
   178 apply blast
   178 apply blast
   179 done
   179 done
   180 
   180 
   181 text{*Agents know what they note*}
   181 text{*Agents know what they note*}
   182 lemma Notes_imp_knows [rule_format]: "Notes A X \<in> set evs --> X \<in> knows A evs"
   182 lemma Notes_imp_knows [rule_format]: "Notes A X \<in> set evs --> X \<in> knows A evs"
   183 apply (induct_tac "evs")
   183 apply (induct_tac "evs")
   184 apply (simp_all (no_asm_simp) split add: event.split)
   184 apply (simp_all (no_asm_simp) split: event.split)
   185 apply blast
   185 apply blast
   186 done
   186 done
   187 
   187 
   188 text{*Agents know what they receive*}
   188 text{*Agents know what they receive*}
   189 lemma Gets_imp_knows_agents [rule_format]:
   189 lemma Gets_imp_knows_agents [rule_format]:
   190      "A \<noteq> Spy --> Gets A X \<in> set evs --> X \<in> knows A evs"
   190      "A \<noteq> Spy --> Gets A X \<in> set evs --> X \<in> knows A evs"
   191 apply (induct_tac "evs")
   191 apply (induct_tac "evs")
   192 apply (simp_all (no_asm_simp) split add: event.split)
   192 apply (simp_all (no_asm_simp) split: event.split)
   193 done
   193 done
   194 
   194 
   195 
   195 
   196 text{*What agents DIFFERENT FROM Spy know 
   196 text{*What agents DIFFERENT FROM Spy know 
   197   was either said, or noted, or got, or known initially*}
   197   was either said, or noted, or got, or known initially*}
   198 lemma knows_imp_Says_Gets_Notes_initState [rule_format]:
   198 lemma knows_imp_Says_Gets_Notes_initState [rule_format]:
   199      "[| X \<in> knows A evs; A \<noteq> Spy |] ==> EX B.  
   199      "[| X \<in> knows A evs; A \<noteq> Spy |] ==> EX B.  
   200   Says A B X \<in> set evs | Gets A X \<in> set evs | Notes A X \<in> set evs | X \<in> initState A"
   200   Says A B X \<in> set evs | Gets A X \<in> set evs | Notes A X \<in> set evs | X \<in> initState A"
   201 apply (erule rev_mp)
   201 apply (erule rev_mp)
   202 apply (induct_tac "evs")
   202 apply (induct_tac "evs")
   203 apply (simp_all (no_asm_simp) split add: event.split)
   203 apply (simp_all (no_asm_simp) split: event.split)
   204 apply blast
   204 apply blast
   205 done
   205 done
   206 
   206 
   207 text{*What the Spy knows -- for the time being --
   207 text{*What the Spy knows -- for the time being --
   208   was either said or noted, or known initially*}
   208   was either said or noted, or known initially*}
   209 lemma knows_Spy_imp_Says_Notes_initState [rule_format]:
   209 lemma knows_Spy_imp_Says_Notes_initState [rule_format]:
   210      "[| X \<in> knows Spy evs |] ==> EX A B.  
   210      "[| X \<in> knows Spy evs |] ==> EX A B.  
   211   Says A B X \<in> set evs | Notes A X \<in> set evs | X \<in> initState Spy"
   211   Says A B X \<in> set evs | Notes A X \<in> set evs | X \<in> initState Spy"
   212 apply (erule rev_mp)
   212 apply (erule rev_mp)
   213 apply (induct_tac "evs")
   213 apply (induct_tac "evs")
   214 apply (simp_all (no_asm_simp) split add: event.split)
   214 apply (simp_all (no_asm_simp) split: event.split)
   215 apply blast
   215 apply blast
   216 done
   216 done
   217 
   217 
   218 lemma parts_knows_Spy_subset_used: "parts (knows Spy evs) \<subseteq> used evs"
   218 lemma parts_knows_Spy_subset_used: "parts (knows Spy evs) \<subseteq> used evs"
   219 apply (induct_tac "evs", force)  
   219 apply (induct_tac "evs", force)  
   222 
   222 
   223 lemmas usedI = parts_knows_Spy_subset_used [THEN subsetD, intro]
   223 lemmas usedI = parts_knows_Spy_subset_used [THEN subsetD, intro]
   224 
   224 
   225 lemma initState_into_used: "X \<in> parts (initState B) ==> X \<in> used evs"
   225 lemma initState_into_used: "X \<in> parts (initState B) ==> X \<in> used evs"
   226 apply (induct_tac "evs")
   226 apply (induct_tac "evs")
   227 apply (simp_all add: parts_insert_knows_A split add: event.split, blast)
   227 apply (simp_all add: parts_insert_knows_A split: event.split, blast)
   228 done
   228 done
   229 
   229 
   230 lemma used_Says [simp]: "used (Says A B X # evs) = parts{X} \<union> used evs"
   230 lemma used_Says [simp]: "used (Says A B X # evs) = parts{X} \<union> used evs"
   231 by simp
   231 by simp
   232 
   232