src/HOL/UNITY/Detects.thy
 author paulson Sat Feb 08 16:05:33 2003 +0100 (2003-02-08) changeset 13812 91713a1915ee parent 13805 3786b2fd6808 child 16417 9bc16273c2d4 permissions -rw-r--r--
converting HOL/UNITY to use unconditional fairness
```     1 (*  Title:      HOL/UNITY/Detects
```
```     2     ID:         \$Id\$
```
```     3     Author:     Tanja Vos, Cambridge University Computer Laboratory
```
```     4     Copyright   2000  University of Cambridge
```
```     5
```
```     6 Detects definition (Section 3.8 of Chandy & Misra) using LeadsTo
```
```     7 *)
```
```     8
```
```     9 header{*The Detects Relation*}
```
```    10
```
```    11 theory Detects = FP + SubstAx:
```
```    12
```
```    13 consts
```
```    14    op_Detects  :: "['a set, 'a set] => 'a program set"  (infixl "Detects" 60)
```
```    15    op_Equality :: "['a set, 'a set] => 'a set"          (infixl "<==>" 60)
```
```    16
```
```    17 defs
```
```    18   Detects_def:  "A Detects B == (Always (-A \<union> B)) \<inter> (B LeadsTo A)"
```
```    19   Equality_def: "A <==> B == (-A \<union> B) \<inter> (A \<union> -B)"
```
```    20
```
```    21
```
```    22 (* Corollary from Sectiom 3.6.4 *)
```
```    23
```
```    24 lemma Always_at_FP:
```
```    25      "[|F \<in> A LeadsTo B; all_total F|] ==> F \<in> Always (-((FP F) \<inter> A \<inter> -B))"
```
```    26 apply (rule LeadsTo_empty)
```
```    27 apply (subgoal_tac "F \<in> (FP F \<inter> A \<inter> - B) LeadsTo (B \<inter> (FP F \<inter> -B))")
```
```    28 apply (subgoal_tac [2] " (FP F \<inter> A \<inter> - B) = (A \<inter> (FP F \<inter> -B))")
```
```    29 apply (subgoal_tac "(B \<inter> (FP F \<inter> -B)) = {}")
```
```    30 apply auto
```
```    31 apply (blast intro: PSP_Stable stable_imp_Stable stable_FP_Int)
```
```    32 done
```
```    33
```
```    34
```
```    35 lemma Detects_Trans:
```
```    36      "[| F \<in> A Detects B; F \<in> B Detects C |] ==> F \<in> A Detects C"
```
```    37 apply (unfold Detects_def Int_def)
```
```    38 apply (simp (no_asm))
```
```    39 apply safe
```
```    40 apply (rule_tac [2] LeadsTo_Trans, auto)
```
```    41 apply (subgoal_tac "F \<in> Always ((-A \<union> B) \<inter> (-B \<union> C))")
```
```    42  apply (blast intro: Always_weaken)
```
```    43 apply (simp add: Always_Int_distrib)
```
```    44 done
```
```    45
```
```    46 lemma Detects_refl: "F \<in> A Detects A"
```
```    47 apply (unfold Detects_def)
```
```    48 apply (simp (no_asm) add: Un_commute Compl_partition subset_imp_LeadsTo)
```
```    49 done
```
```    50
```
```    51 lemma Detects_eq_Un: "(A<==>B) = (A \<inter> B) \<union> (-A \<inter> -B)"
```
```    52 by (unfold Equality_def, blast)
```
```    53
```
```    54 (*Not quite antisymmetry: sets A and B agree in all reachable states *)
```
```    55 lemma Detects_antisym:
```
```    56      "[| F \<in> A Detects B;  F \<in> B Detects A|] ==> F \<in> Always (A <==> B)"
```
```    57 apply (unfold Detects_def Equality_def)
```
```    58 apply (simp add: Always_Int_I Un_commute)
```
```    59 done
```
```    60
```
```    61
```
```    62 (* Theorem from Section 3.8 *)
```
```    63
```
```    64 lemma Detects_Always:
```
```    65      "[|F \<in> A Detects B; all_total F|] ==> F \<in> Always (-(FP F) \<union> (A <==> B))"
```
```    66 apply (unfold Detects_def Equality_def)
```
```    67 apply (simp add: Un_Int_distrib Always_Int_distrib)
```
```    68 apply (blast dest: Always_at_FP intro: Always_weaken)
```
```    69 done
```
```    70
```
```    71 (* Theorem from exercise 11.1 Section 11.3.1 *)
```
```    72
```
```    73 lemma Detects_Imp_LeadstoEQ:
```
```    74      "F \<in> A Detects B ==> F \<in> UNIV LeadsTo (A <==> B)"
```
```    75 apply (unfold Detects_def Equality_def)
```
```    76 apply (rule_tac B = B in LeadsTo_Diff)
```
```    77  apply (blast intro: Always_LeadsToI subset_imp_LeadsTo)
```
```    78 apply (blast intro: Always_LeadsTo_weaken)
```
```    79 done
```
```    80
```
```    81
```
```    82 end
```
```    83
```