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