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