src/HOL/UNITY/Detects.thy
author krauss
Fri Nov 24 13:44:51 2006 +0100 (2006-11-24)
changeset 21512 3786eb1b69d6
parent 16417 9bc16273c2d4
child 37936 1e4c5015a72e
permissions -rw-r--r--
Lemma "fundef_default_value" uses predicate instead of set.
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
haftmann@16417
    11
theory Detects imports FP SubstAx begin
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@13812
    24
lemma Always_at_FP:
paulson@13812
    25
     "[|F \<in> A LeadsTo B; all_total F|] ==> F \<in> Always (-((FP F) \<inter> A \<inter> -B))"
paulson@13785
    26
apply (rule LeadsTo_empty)
paulson@13805
    27
apply (subgoal_tac "F \<in> (FP F \<inter> A \<inter> - B) LeadsTo (B \<inter> (FP F \<inter> -B))")
paulson@13805
    28
apply (subgoal_tac [2] " (FP F \<inter> A \<inter> - B) = (A \<inter> (FP F \<inter> -B))")
paulson@13805
    29
apply (subgoal_tac "(B \<inter> (FP F \<inter> -B)) = {}")
paulson@13785
    30
apply auto
paulson@13785
    31
apply (blast intro: PSP_Stable stable_imp_Stable stable_FP_Int)
paulson@13785
    32
done
paulson@13785
    33
paulson@13785
    34
paulson@13785
    35
lemma Detects_Trans: 
paulson@13805
    36
     "[| F \<in> A Detects B; F \<in> B Detects C |] ==> F \<in> A Detects C"
paulson@13785
    37
apply (unfold Detects_def Int_def)
paulson@13785
    38
apply (simp (no_asm))
paulson@13785
    39
apply safe
paulson@13812
    40
apply (rule_tac [2] LeadsTo_Trans, 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@13812
    52
by (unfold Equality_def, blast)
paulson@13785
    53
paulson@13785
    54
(*Not quite antisymmetry: sets A and B agree in all reachable states *)
paulson@13785
    55
lemma Detects_antisym: 
paulson@13805
    56
     "[| F \<in> A Detects B;  F \<in> B Detects A|] ==> F \<in> Always (A <==> B)"
paulson@13785
    57
apply (unfold Detects_def Equality_def)
paulson@13785
    58
apply (simp add: Always_Int_I Un_commute)
paulson@13785
    59
done
paulson@13785
    60
paulson@13785
    61
paulson@13785
    62
(* Theorem from Section 3.8 *)
paulson@13785
    63
paulson@13785
    64
lemma Detects_Always: 
paulson@13812
    65
     "[|F \<in> A Detects B; all_total F|] ==> F \<in> Always (-(FP F) \<union> (A <==> B))"
paulson@13785
    66
apply (unfold Detects_def Equality_def)
paulson@13812
    67
apply (simp add: Un_Int_distrib Always_Int_distrib)
paulson@13785
    68
apply (blast dest: Always_at_FP intro: Always_weaken)
paulson@13785
    69
done
paulson@13785
    70
paulson@13785
    71
(* Theorem from exercise 11.1 Section 11.3.1 *)
paulson@13785
    72
paulson@13785
    73
lemma Detects_Imp_LeadstoEQ: 
paulson@13805
    74
     "F \<in> A Detects B ==> F \<in> UNIV LeadsTo (A <==> B)"
paulson@13785
    75
apply (unfold Detects_def Equality_def)
paulson@13812
    76
apply (rule_tac B = B in LeadsTo_Diff)
paulson@13805
    77
 apply (blast intro: Always_LeadsToI subset_imp_LeadsTo)
paulson@13805
    78
apply (blast intro: Always_LeadsTo_weaken)
paulson@13785
    79
done
paulson@13785
    80
paulson@8334
    81
paulson@8334
    82
end
paulson@8334
    83