src/HOL/UNITY/Union.thy
changeset 69313 b021008c5397
parent 67613 ce654b0e6d69
child 69597 ff784d5a5bfb
equal deleted inserted replaced
69312:e0f68a507683 69313:b021008c5397
    34   where "\<bottom> = mk_program (UNIV, {}, UNIV)"
    34   where "\<bottom> = mk_program (UNIV, {}, UNIV)"
    35 
    35 
    36   (*Characterizes safety properties.  Used with specifying Allowed*)
    36   (*Characterizes safety properties.  Used with specifying Allowed*)
    37 definition
    37 definition
    38   safety_prop :: "'a program set => bool"
    38   safety_prop :: "'a program set => bool"
    39   where "safety_prop X \<longleftrightarrow> SKIP \<in> X \<and> (\<forall>G. Acts G \<subseteq> UNION X Acts \<longrightarrow> G \<in> X)"
    39   where "safety_prop X \<longleftrightarrow> SKIP \<in> X \<and> (\<forall>G. Acts G \<subseteq> \<Union>(Acts ` X) \<longrightarrow> G \<in> X)"
    40 
    40 
    41 syntax
    41 syntax
    42   "_JOIN1" :: "[pttrns, 'b set] => 'b set"              ("(3\<Squnion>_./ _)" 10)
    42   "_JOIN1" :: "[pttrns, 'b set] => 'b set"              ("(3\<Squnion>_./ _)" 10)
    43   "_JOIN"  :: "[pttrn, 'a set, 'b set] => 'b set"       ("(3\<Squnion>_\<in>_./ _)" 10)
    43   "_JOIN"  :: "[pttrn, 'a set, 'b set] => 'b set"       ("(3\<Squnion>_\<in>_./ _)" 10)
    44 translations
    44 translations
   374 
   374 
   375 subsection\<open>@{term safety_prop}, for reasoning about
   375 subsection\<open>@{term safety_prop}, for reasoning about
   376  given instances of "ok"\<close>
   376  given instances of "ok"\<close>
   377 
   377 
   378 lemma safety_prop_Acts_iff:
   378 lemma safety_prop_Acts_iff:
   379      "safety_prop X ==> (Acts G \<subseteq> insert Id (UNION X Acts)) = (G \<in> X)"
   379      "safety_prop X ==> (Acts G \<subseteq> insert Id (\<Union>(Acts ` X))) = (G \<in> X)"
   380 by (auto simp add: safety_prop_def)
   380 by (auto simp add: safety_prop_def)
   381 
   381 
   382 lemma safety_prop_AllowedActs_iff_Allowed:
   382 lemma safety_prop_AllowedActs_iff_Allowed:
   383      "safety_prop X ==> (UNION X Acts \<subseteq> AllowedActs F) = (X \<subseteq> Allowed F)"
   383      "safety_prop X ==> (\<Union>(Acts ` X) \<subseteq> AllowedActs F) = (X \<subseteq> Allowed F)"
   384 by (auto simp add: Allowed_def safety_prop_Acts_iff [symmetric])
   384 by (auto simp add: Allowed_def safety_prop_Acts_iff [symmetric])
   385 
   385 
   386 lemma Allowed_eq:
   386 lemma Allowed_eq:
   387      "safety_prop X ==> Allowed (mk_program (init, acts, UNION X Acts)) = X"
   387      "safety_prop X ==> Allowed (mk_program (init, acts, \<Union>(Acts ` X))) = X"
   388 by (simp add: Allowed_def safety_prop_Acts_iff)
   388 by (simp add: Allowed_def safety_prop_Acts_iff)
   389 
   389 
   390 (*For safety_prop to hold, the property must be satisfiable!*)
   390 (*For safety_prop to hold, the property must be satisfiable!*)
   391 lemma safety_prop_constrains [iff]: "safety_prop (A co B) = (A \<subseteq> B)"
   391 lemma safety_prop_constrains [iff]: "safety_prop (A co B) = (A \<subseteq> B)"
   392 by (simp add: safety_prop_def constrains_def, blast)
   392 by (simp add: safety_prop_def constrains_def, blast)
   424 lemma safety_prop_INTER1 [simp]:
   424 lemma safety_prop_INTER1 [simp]:
   425   "(\<And>i. safety_prop (X i)) \<Longrightarrow> safety_prop (\<Inter>i. X i)"
   425   "(\<And>i. safety_prop (X i)) \<Longrightarrow> safety_prop (\<Inter>i. X i)"
   426   by (rule safety_prop_INTER) simp
   426   by (rule safety_prop_INTER) simp
   427 
   427 
   428 lemma def_prg_Allowed:
   428 lemma def_prg_Allowed:
   429      "[| F == mk_program (init, acts, UNION X Acts) ; safety_prop X |]  
   429      "[| F == mk_program (init, acts, \<Union>(Acts ` X)) ; safety_prop X |]  
   430       ==> Allowed F = X"
   430       ==> Allowed F = X"
   431 by (simp add: Allowed_eq)
   431 by (simp add: Allowed_eq)
   432 
   432 
   433 lemma Allowed_totalize [simp]: "Allowed (totalize F) = Allowed F"
   433 lemma Allowed_totalize [simp]: "Allowed (totalize F) = Allowed F"
   434 by (simp add: Allowed_def) 
   434 by (simp add: Allowed_def) 
   435 
   435 
   436 lemma def_total_prg_Allowed:
   436 lemma def_total_prg_Allowed:
   437      "[| F = mk_total_program (init, acts, UNION X Acts) ; safety_prop X |]  
   437      "[| F = mk_total_program (init, acts, \<Union>(Acts ` X)) ; safety_prop X |]  
   438       ==> Allowed F = X"
   438       ==> Allowed F = X"
   439 by (simp add: mk_total_program_def def_prg_Allowed) 
   439 by (simp add: mk_total_program_def def_prg_Allowed) 
   440 
   440 
   441 lemma def_UNION_ok_iff:
   441 lemma def_UNION_ok_iff:
   442      "[| F = mk_program(init,acts,UNION X Acts); safety_prop X |]  
   442      "[| F = mk_program(init,acts,\<Union>(Acts ` X)); safety_prop X |]  
   443       ==> F ok G = (G \<in> X & acts \<subseteq> AllowedActs G)"
   443       ==> F ok G = (G \<in> X & acts \<subseteq> AllowedActs G)"
   444 by (auto simp add: ok_def safety_prop_Acts_iff)
   444 by (auto simp add: ok_def safety_prop_Acts_iff)
   445 
   445 
   446 text\<open>The union of two total programs is total.\<close>
   446 text\<open>The union of two total programs is total.\<close>
   447 lemma totalize_Join: "totalize F\<squnion>totalize G = totalize (F\<squnion>G)"
   447 lemma totalize_Join: "totalize F\<squnion>totalize G = totalize (F\<squnion>G)"