src/HOL/UNITY/Detects.thy
author wenzelm
Thu Jul 23 22:13:42 2015 +0200 (2015-07-23)
changeset 60773 d09c66a0ea10
parent 58889 5b7a9633cfa8
child 61635 c657ee4f59b7
permissions -rw-r--r--
more symbols by default, without xsymbols mode;
wenzelm@37936
     1
(*  Title:      HOL/UNITY/Detects.thy
paulson@8334
     2
    Author:     Tanja Vos, Cambridge University Computer Laboratory
paulson@8334
     3
    Copyright   2000  University of Cambridge
paulson@8334
     4
paulson@8334
     5
Detects definition (Section 3.8 of Chandy & Misra) using LeadsTo
paulson@8334
     6
*)
paulson@8334
     7
wenzelm@58889
     8
section{*The Detects Relation*}
paulson@13798
     9
haftmann@16417
    10
theory Detects imports FP SubstAx begin
paulson@8334
    11
wenzelm@57488
    12
definition Detects :: "['a set, 'a set] => 'a program set"  (infixl "Detects" 60)
wenzelm@57488
    13
  where "A Detects B = (Always (-A \<union> B)) \<inter> (B LeadsTo A)"
wenzelm@57488
    14
wenzelm@57488
    15
definition Equality :: "['a set, 'a set] => 'a set"  (infixl "<==>" 60)
wenzelm@57488
    16
  where "A <==> B = (-A \<union> B) \<inter> (A \<union> -B)"
paulson@13785
    17
paulson@13785
    18
paulson@13785
    19
(* Corollary from Sectiom 3.6.4 *)
paulson@13785
    20
paulson@13812
    21
lemma Always_at_FP:
paulson@13812
    22
     "[|F \<in> A LeadsTo B; all_total F|] ==> F \<in> Always (-((FP F) \<inter> A \<inter> -B))"
paulson@13785
    23
apply (rule LeadsTo_empty)
paulson@13805
    24
apply (subgoal_tac "F \<in> (FP F \<inter> A \<inter> - B) LeadsTo (B \<inter> (FP F \<inter> -B))")
paulson@13805
    25
apply (subgoal_tac [2] " (FP F \<inter> A \<inter> - B) = (A \<inter> (FP F \<inter> -B))")
paulson@13805
    26
apply (subgoal_tac "(B \<inter> (FP F \<inter> -B)) = {}")
paulson@13785
    27
apply auto
paulson@13785
    28
apply (blast intro: PSP_Stable stable_imp_Stable stable_FP_Int)
paulson@13785
    29
done
paulson@13785
    30
paulson@13785
    31
paulson@13785
    32
lemma Detects_Trans: 
paulson@13805
    33
     "[| F \<in> A Detects B; F \<in> B Detects C |] ==> F \<in> A Detects C"
paulson@13785
    34
apply (unfold Detects_def Int_def)
paulson@13785
    35
apply (simp (no_asm))
paulson@13785
    36
apply safe
paulson@13812
    37
apply (rule_tac [2] LeadsTo_Trans, auto)
paulson@13805
    38
apply (subgoal_tac "F \<in> Always ((-A \<union> B) \<inter> (-B \<union> C))")
paulson@13785
    39
 apply (blast intro: Always_weaken)
paulson@13785
    40
apply (simp add: Always_Int_distrib)
paulson@13785
    41
done
paulson@13785
    42
paulson@13805
    43
lemma Detects_refl: "F \<in> A Detects A"
paulson@13785
    44
apply (unfold Detects_def)
paulson@13785
    45
apply (simp (no_asm) add: Un_commute Compl_partition subset_imp_LeadsTo)
paulson@13785
    46
done
paulson@13785
    47
paulson@13805
    48
lemma Detects_eq_Un: "(A<==>B) = (A \<inter> B) \<union> (-A \<inter> -B)"
paulson@13812
    49
by (unfold Equality_def, blast)
paulson@13785
    50
paulson@13785
    51
(*Not quite antisymmetry: sets A and B agree in all reachable states *)
paulson@13785
    52
lemma Detects_antisym: 
paulson@13805
    53
     "[| F \<in> A Detects B;  F \<in> B Detects A|] ==> F \<in> Always (A <==> B)"
paulson@13785
    54
apply (unfold Detects_def Equality_def)
paulson@13785
    55
apply (simp add: Always_Int_I Un_commute)
paulson@13785
    56
done
paulson@13785
    57
paulson@13785
    58
paulson@13785
    59
(* Theorem from Section 3.8 *)
paulson@13785
    60
paulson@13785
    61
lemma Detects_Always: 
paulson@13812
    62
     "[|F \<in> A Detects B; all_total F|] ==> F \<in> Always (-(FP F) \<union> (A <==> B))"
paulson@13785
    63
apply (unfold Detects_def Equality_def)
paulson@13812
    64
apply (simp add: Un_Int_distrib Always_Int_distrib)
paulson@13785
    65
apply (blast dest: Always_at_FP intro: Always_weaken)
paulson@13785
    66
done
paulson@13785
    67
paulson@13785
    68
(* Theorem from exercise 11.1 Section 11.3.1 *)
paulson@13785
    69
paulson@13785
    70
lemma Detects_Imp_LeadstoEQ: 
paulson@13805
    71
     "F \<in> A Detects B ==> F \<in> UNIV LeadsTo (A <==> B)"
paulson@13785
    72
apply (unfold Detects_def Equality_def)
paulson@13812
    73
apply (rule_tac B = B in LeadsTo_Diff)
paulson@13805
    74
 apply (blast intro: Always_LeadsToI subset_imp_LeadsTo)
paulson@13805
    75
apply (blast intro: Always_LeadsTo_weaken)
paulson@13785
    76
done
paulson@13785
    77
paulson@8334
    78
paulson@8334
    79
end
paulson@8334
    80