src/HOL/UNITY/Detects.thy
author kuncar
Fri Dec 09 18:07:04 2011 +0100 (2011-12-09)
changeset 45802 b16f976db515
parent 37936 1e4c5015a72e
child 57488 58db442609ac
permissions -rw-r--r--
Quotient_Info stores only relation maps
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
paulson@13798
     8
header{*The Detects Relation*}
paulson@13798
     9
haftmann@16417
    10
theory Detects imports FP SubstAx begin
paulson@8334
    11
paulson@8334
    12
consts
paulson@8334
    13
   op_Detects  :: "['a set, 'a set] => 'a program set"  (infixl "Detects" 60)
paulson@8334
    14
   op_Equality :: "['a set, 'a set] => 'a set"          (infixl "<==>" 60)
paulson@8334
    15
   
paulson@8334
    16
defs
paulson@13805
    17
  Detects_def:  "A Detects B == (Always (-A \<union> B)) \<inter> (B LeadsTo A)"
paulson@13805
    18
  Equality_def: "A <==> B == (-A \<union> B) \<inter> (A \<union> -B)"
paulson@13785
    19
paulson@13785
    20
paulson@13785
    21
(* Corollary from Sectiom 3.6.4 *)
paulson@13785
    22
paulson@13812
    23
lemma Always_at_FP:
paulson@13812
    24
     "[|F \<in> A LeadsTo B; all_total F|] ==> F \<in> Always (-((FP F) \<inter> A \<inter> -B))"
paulson@13785
    25
apply (rule LeadsTo_empty)
paulson@13805
    26
apply (subgoal_tac "F \<in> (FP F \<inter> A \<inter> - B) LeadsTo (B \<inter> (FP F \<inter> -B))")
paulson@13805
    27
apply (subgoal_tac [2] " (FP F \<inter> A \<inter> - B) = (A \<inter> (FP F \<inter> -B))")
paulson@13805
    28
apply (subgoal_tac "(B \<inter> (FP F \<inter> -B)) = {}")
paulson@13785
    29
apply auto
paulson@13785
    30
apply (blast intro: PSP_Stable stable_imp_Stable stable_FP_Int)
paulson@13785
    31
done
paulson@13785
    32
paulson@13785
    33
paulson@13785
    34
lemma Detects_Trans: 
paulson@13805
    35
     "[| F \<in> A Detects B; F \<in> B Detects C |] ==> F \<in> A Detects C"
paulson@13785
    36
apply (unfold Detects_def Int_def)
paulson@13785
    37
apply (simp (no_asm))
paulson@13785
    38
apply safe
paulson@13812
    39
apply (rule_tac [2] LeadsTo_Trans, auto)
paulson@13805
    40
apply (subgoal_tac "F \<in> Always ((-A \<union> B) \<inter> (-B \<union> C))")
paulson@13785
    41
 apply (blast intro: Always_weaken)
paulson@13785
    42
apply (simp add: Always_Int_distrib)
paulson@13785
    43
done
paulson@13785
    44
paulson@13805
    45
lemma Detects_refl: "F \<in> A Detects A"
paulson@13785
    46
apply (unfold Detects_def)
paulson@13785
    47
apply (simp (no_asm) add: Un_commute Compl_partition subset_imp_LeadsTo)
paulson@13785
    48
done
paulson@13785
    49
paulson@13805
    50
lemma Detects_eq_Un: "(A<==>B) = (A \<inter> B) \<union> (-A \<inter> -B)"
paulson@13812
    51
by (unfold Equality_def, blast)
paulson@13785
    52
paulson@13785
    53
(*Not quite antisymmetry: sets A and B agree in all reachable states *)
paulson@13785
    54
lemma Detects_antisym: 
paulson@13805
    55
     "[| F \<in> A Detects B;  F \<in> B Detects A|] ==> F \<in> Always (A <==> B)"
paulson@13785
    56
apply (unfold Detects_def Equality_def)
paulson@13785
    57
apply (simp add: Always_Int_I Un_commute)
paulson@13785
    58
done
paulson@13785
    59
paulson@13785
    60
paulson@13785
    61
(* Theorem from Section 3.8 *)
paulson@13785
    62
paulson@13785
    63
lemma Detects_Always: 
paulson@13812
    64
     "[|F \<in> A Detects B; all_total F|] ==> F \<in> Always (-(FP F) \<union> (A <==> B))"
paulson@13785
    65
apply (unfold Detects_def Equality_def)
paulson@13812
    66
apply (simp add: Un_Int_distrib Always_Int_distrib)
paulson@13785
    67
apply (blast dest: Always_at_FP intro: Always_weaken)
paulson@13785
    68
done
paulson@13785
    69
paulson@13785
    70
(* Theorem from exercise 11.1 Section 11.3.1 *)
paulson@13785
    71
paulson@13785
    72
lemma Detects_Imp_LeadstoEQ: 
paulson@13805
    73
     "F \<in> A Detects B ==> F \<in> UNIV LeadsTo (A <==> B)"
paulson@13785
    74
apply (unfold Detects_def Equality_def)
paulson@13812
    75
apply (rule_tac B = B in LeadsTo_Diff)
paulson@13805
    76
 apply (blast intro: Always_LeadsToI subset_imp_LeadsTo)
paulson@13805
    77
apply (blast intro: Always_LeadsTo_weaken)
paulson@13785
    78
done
paulson@13785
    79
paulson@8334
    80
paulson@8334
    81
end
paulson@8334
    82