src/HOL/UNITY/Union.thy
changeset 36866 426d5781bb25
parent 35434 a4babce15c67
child 44928 7ef6505bde7f
equal deleted inserted replaced
36865:7330e4eefbd7 36866:426d5781bb25
     7 
     7 
     8 header{*Unions of Programs*}
     8 header{*Unions of Programs*}
     9 
     9 
    10 theory Union imports SubstAx FP begin
    10 theory Union imports SubstAx FP begin
    11 
    11 
    12 constdefs
       
    13 
       
    14   (*FIXME: conjoin Init F \<inter> Init G \<noteq> {} *) 
    12   (*FIXME: conjoin Init F \<inter> Init G \<noteq> {} *) 
       
    13 definition
    15   ok :: "['a program, 'a program] => bool"      (infixl "ok" 65)
    14   ok :: "['a program, 'a program] => bool"      (infixl "ok" 65)
    16     "F ok G == Acts F \<subseteq> AllowedActs G &
    15   where "F ok G == Acts F \<subseteq> AllowedActs G &
    17                Acts G \<subseteq> AllowedActs F"
    16                Acts G \<subseteq> AllowedActs F"
    18 
    17 
    19   (*FIXME: conjoin (\<Inter>i \<in> I. Init (F i)) \<noteq> {} *) 
    18   (*FIXME: conjoin (\<Inter>i \<in> I. Init (F i)) \<noteq> {} *) 
       
    19 definition
    20   OK  :: "['a set, 'a => 'b program] => bool"
    20   OK  :: "['a set, 'a => 'b program] => bool"
    21     "OK I F == (\<forall>i \<in> I. \<forall>j \<in> I-{i}. Acts (F i) \<subseteq> AllowedActs (F j))"
    21   where "OK I F = (\<forall>i \<in> I. \<forall>j \<in> I-{i}. Acts (F i) \<subseteq> AllowedActs (F j))"
    22 
    22 
       
    23 definition
    23   JOIN  :: "['a set, 'a => 'b program] => 'b program"
    24   JOIN  :: "['a set, 'a => 'b program] => 'b program"
    24     "JOIN I F == mk_program (\<Inter>i \<in> I. Init (F i), \<Union>i \<in> I. Acts (F i),
    25   where "JOIN I F = mk_program (\<Inter>i \<in> I. Init (F i), \<Union>i \<in> I. Acts (F i),
    25                              \<Inter>i \<in> I. AllowedActs (F i))"
    26                              \<Inter>i \<in> I. AllowedActs (F i))"
    26 
    27 
       
    28 definition
    27   Join :: "['a program, 'a program] => 'a program"      (infixl "Join" 65)
    29   Join :: "['a program, 'a program] => 'a program"      (infixl "Join" 65)
    28     "F Join G == mk_program (Init F \<inter> Init G, Acts F \<union> Acts G,
    30   where "F Join G = mk_program (Init F \<inter> Init G, Acts F \<union> Acts G,
    29                              AllowedActs F \<inter> AllowedActs G)"
    31                              AllowedActs F \<inter> AllowedActs G)"
    30 
    32 
       
    33 definition
    31   SKIP :: "'a program"
    34   SKIP :: "'a program"
    32     "SKIP == mk_program (UNIV, {}, UNIV)"
    35   where "SKIP = mk_program (UNIV, {}, UNIV)"
    33 
    36 
    34   (*Characterizes safety properties.  Used with specifying Allowed*)
    37   (*Characterizes safety properties.  Used with specifying Allowed*)
       
    38 definition
    35   safety_prop :: "'a program set => bool"
    39   safety_prop :: "'a program set => bool"
    36     "safety_prop X == SKIP: X & (\<forall>G. Acts G \<subseteq> UNION X Acts --> G \<in> X)"
    40   where "safety_prop X <-> SKIP: X & (\<forall>G. Acts G \<subseteq> UNION X Acts --> G \<in> X)"
    37 
    41 
    38 notation (xsymbols)
    42 notation (xsymbols)
    39   SKIP  ("\<bottom>") and
    43   SKIP  ("\<bottom>") and
    40   Join  (infixl "\<squnion>" 65)
    44   Join  (infixl "\<squnion>" 65)
    41 
    45 
   418 
   422 
   419 lemma Allowed_totalize [simp]: "Allowed (totalize F) = Allowed F"
   423 lemma Allowed_totalize [simp]: "Allowed (totalize F) = Allowed F"
   420 by (simp add: Allowed_def) 
   424 by (simp add: Allowed_def) 
   421 
   425 
   422 lemma def_total_prg_Allowed:
   426 lemma def_total_prg_Allowed:
   423      "[| F == mk_total_program (init, acts, UNION X Acts) ; safety_prop X |]  
   427      "[| F = mk_total_program (init, acts, UNION X Acts) ; safety_prop X |]  
   424       ==> Allowed F = X"
   428       ==> Allowed F = X"
   425 by (simp add: mk_total_program_def def_prg_Allowed) 
   429 by (simp add: mk_total_program_def def_prg_Allowed) 
   426 
   430 
   427 lemma def_UNION_ok_iff:
   431 lemma def_UNION_ok_iff:
   428      "[| F == mk_program(init,acts,UNION X Acts); safety_prop X |]  
   432      "[| F = mk_program(init,acts,UNION X Acts); safety_prop X |]  
   429       ==> F ok G = (G \<in> X & acts \<subseteq> AllowedActs G)"
   433       ==> F ok G = (G \<in> X & acts \<subseteq> AllowedActs G)"
   430 by (auto simp add: ok_def safety_prop_Acts_iff)
   434 by (auto simp add: ok_def safety_prop_Acts_iff)
   431 
   435 
   432 text{*The union of two total programs is total.*}
   436 text{*The union of two total programs is total.*}
   433 lemma totalize_Join: "totalize F\<squnion>totalize G = totalize (F\<squnion>G)"
   437 lemma totalize_Join: "totalize F\<squnion>totalize G = totalize (F\<squnion>G)"