src/HOL/UNITY/Guar.thy
author kleing
Tue, 13 May 2003 08:59:21 +0200
changeset 14024 213dcc39358f
parent 13819 78f5885b76a9
child 14112 95d51043d2a3
permissions -rw-r--r--
HOL-Real -> HOL-Complex
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
     1
(*  Title:      HOL/UNITY/Guar.thy
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
     2
    ID:         $Id$
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
     4
    Copyright   1999  University of Cambridge
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
     5
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
     6
From Chandy and Sanders, "Reasoning About Program Composition",
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
     7
Technical Report 2000-003, University of Florida, 2000.
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
     8
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
     9
Revised by Sidi Ehmety on January 2001
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    10
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    11
Added: Compatibility, weakest guarantees, etc.
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    12
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    13
and Weakest existential property,
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    14
from Charpentier and Chandy "Theorems about Composition",
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    15
Fifth International Conference on Mathematics of Program, 2000.
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    16
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    17
*)
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    18
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13792
diff changeset
    19
header{*Guarantees Specifications*}
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13792
diff changeset
    20
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    21
theory Guar = Comp:
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    22
12338
de0f4a63baa5 renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents: 11190
diff changeset
    23
instance program :: (type) order
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    24
  by (intro_classes,
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    25
      (assumption | rule component_refl component_trans component_antisym
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    26
                     program_less_le)+)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    27
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    28
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    29
constdefs
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    30
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    31
  (*Existential and Universal properties.  I formalize the two-program
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    32
    case, proving equivalence with Chandy and Sanders's n-ary definitions*)
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    33
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    34
  ex_prop  :: "'a program set => bool"
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
    35
   "ex_prop X == \<forall>F G. F ok G -->F \<in> X | G \<in> X --> (F\<squnion>G) \<in> X"
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    36
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    37
  strict_ex_prop  :: "'a program set => bool"
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
    38
   "strict_ex_prop X == \<forall>F G.  F ok G --> (F \<in> X | G \<in> X) = (F\<squnion>G \<in> X)"
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    39
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    40
  uv_prop  :: "'a program set => bool"
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
    41
   "uv_prop X == SKIP \<in> X & (\<forall>F G. F ok G --> F \<in> X & G \<in> X --> (F\<squnion>G) \<in> X)"
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    42
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    43
  strict_uv_prop  :: "'a program set => bool"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    44
   "strict_uv_prop X == 
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
    45
      SKIP \<in> X & (\<forall>F G. F ok G --> (F \<in> X & G \<in> X) = (F\<squnion>G \<in> X))"
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    46
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    47
  guar :: "['a program set, 'a program set] => 'a program set"
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
    48
          (infixl "guarantees" 55)  (*higher than membership, lower than Co*)
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
    49
   "X guarantees Y == {F. \<forall>G. F ok G --> F\<squnion>G \<in> X --> F\<squnion>G \<in> Y}"
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    50
  
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    51
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    52
  (* Weakest guarantees *)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    53
   wg :: "['a program, 'a program set] =>  'a program set"
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    54
  "wg F Y == Union({X. F \<in> X guarantees Y})"
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    55
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    56
   (* Weakest existential property stronger than X *)
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    57
   wx :: "('a program) set => ('a program)set"
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    58
   "wx X == Union({Y. Y \<subseteq> X & ex_prop Y})"
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    59
  
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    60
  (*Ill-defined programs can arise through "Join"*)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    61
  welldef :: "'a program set"
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    62
  "welldef == {F. Init F \<noteq> {}}"
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    63
  
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    64
  refines :: "['a program, 'a program, 'a program set] => bool"
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    65
			("(3_ refines _ wrt _)" [10,10,10] 10)
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    66
  "G refines F wrt X ==
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
    67
     \<forall>H. (F ok H  & G ok H & F\<squnion>H \<in> welldef \<inter> X) --> 
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
    68
         (G\<squnion>H \<in> welldef \<inter> X)"
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    69
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    70
  iso_refines :: "['a program, 'a program, 'a program set] => bool"
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    71
                              ("(3_ iso'_refines _ wrt _)" [10,10,10] 10)
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    72
  "G iso_refines F wrt X ==
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    73
   F \<in> welldef \<inter> X --> G \<in> welldef \<inter> X"
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    74
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    75
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    76
lemma OK_insert_iff:
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    77
     "(OK (insert i I) F) = 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    78
      (if i \<in> I then OK I F else OK I F & (F i ok JOIN I F))"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    79
by (auto intro: ok_sym simp add: OK_iff_ok)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    80
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    81
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    82
(*** existential properties ***)
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13792
diff changeset
    83
lemma ex1 [rule_format]: 
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    84
 "[| ex_prop X; finite GG |] ==>  
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    85
     GG \<inter> X \<noteq> {}--> OK GG (%G. G) --> (\<Squnion>G \<in> GG. G) \<in> X"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    86
apply (unfold ex_prop_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    87
apply (erule finite_induct)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    88
apply (auto simp add: OK_insert_iff Int_insert_left)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    89
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    90
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    91
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    92
lemma ex2: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    93
     "\<forall>GG. finite GG & GG \<inter> X \<noteq> {} --> OK GG (%G. G) -->(\<Squnion>G \<in> GG. G):X 
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    94
      ==> ex_prop X"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    95
apply (unfold ex_prop_def, clarify)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    96
apply (drule_tac x = "{F,G}" in spec)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    97
apply (auto dest: ok_sym simp add: OK_iff_ok)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    98
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    99
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   100
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   101
(*Chandy & Sanders take this as a definition*)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   102
lemma ex_prop_finite:
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   103
     "ex_prop X = 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   104
      (\<forall>GG. finite GG & GG \<inter> X \<noteq> {} & OK GG (%G. G)--> (\<Squnion>G \<in> GG. G) \<in> X)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   105
by (blast intro: ex1 ex2)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   106
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   107
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   108
(*Their "equivalent definition" given at the end of section 3*)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   109
lemma ex_prop_equiv: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   110
     "ex_prop X = (\<forall>G. G \<in> X = (\<forall>H. (G component_of H) --> H \<in> X))"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   111
apply auto
13812
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   112
apply (unfold ex_prop_def component_of_def, safe, blast) 
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   113
apply blast 
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   114
apply (subst Join_commute) 
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   115
apply (drule ok_sym, blast) 
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   116
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   117
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   118
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   119
(*** universal properties ***)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   120
lemma uv1 [rule_format]: 
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   121
     "[| uv_prop X; finite GG |] 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   122
      ==> GG \<subseteq> X & OK GG (%G. G) --> (\<Squnion>G \<in> GG. G) \<in> X"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   123
apply (unfold uv_prop_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   124
apply (erule finite_induct)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   125
apply (auto simp add: Int_insert_left OK_insert_iff)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   126
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   127
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   128
lemma uv2: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   129
     "\<forall>GG. finite GG & GG \<subseteq> X & OK GG (%G. G) --> (\<Squnion>G \<in> GG. G) \<in> X  
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   130
      ==> uv_prop X"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   131
apply (unfold uv_prop_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   132
apply (rule conjI)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   133
 apply (drule_tac x = "{}" in spec)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   134
 prefer 2
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   135
 apply clarify 
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   136
 apply (drule_tac x = "{F,G}" in spec)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   137
apply (auto dest: ok_sym simp add: OK_iff_ok)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   138
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   139
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   140
(*Chandy & Sanders take this as a definition*)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   141
lemma uv_prop_finite:
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   142
     "uv_prop X = 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   143
      (\<forall>GG. finite GG & GG \<subseteq> X & OK GG (%G. G) --> (\<Squnion>G \<in> GG. G): X)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   144
by (blast intro: uv1 uv2)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   145
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   146
(*** guarantees ***)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   147
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   148
lemma guaranteesI:
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   149
     "(!!G. [| F ok G; F\<squnion>G \<in> X |] ==> F\<squnion>G \<in> Y)  
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   150
      ==> F \<in> X guarantees Y"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   151
by (simp add: guar_def component_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   152
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   153
lemma guaranteesD: 
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   154
     "[| F \<in> X guarantees Y;  F ok G;  F\<squnion>G \<in> X |]  
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   155
      ==> F\<squnion>G \<in> Y"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   156
by (unfold guar_def component_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   157
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   158
(*This version of guaranteesD matches more easily in the conclusion
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   159
  The major premise can no longer be  F \<subseteq> H since we need to reason about G*)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   160
lemma component_guaranteesD: 
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   161
     "[| F \<in> X guarantees Y;  F\<squnion>G = H;  H \<in> X;  F ok G |]  
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   162
      ==> H \<in> Y"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   163
by (unfold guar_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   164
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   165
lemma guarantees_weaken: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   166
     "[| F \<in> X guarantees X'; Y \<subseteq> X; X' \<subseteq> Y' |] ==> F \<in> Y guarantees Y'"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   167
by (unfold guar_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   168
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   169
lemma subset_imp_guarantees_UNIV: "X \<subseteq> Y ==> X guarantees Y = UNIV"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   170
by (unfold guar_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   171
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   172
(*Equivalent to subset_imp_guarantees_UNIV but more intuitive*)
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   173
lemma subset_imp_guarantees: "X \<subseteq> Y ==> F \<in> X guarantees Y"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   174
by (unfold guar_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   175
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   176
(*Remark at end of section 4.1 *)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   177
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   178
lemma ex_prop_imp: "ex_prop Y ==> (Y = UNIV guarantees Y)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   179
apply (simp (no_asm_use) add: guar_def ex_prop_equiv)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   180
apply safe
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   181
 apply (drule_tac x = x in spec)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   182
 apply (drule_tac [2] x = x in spec)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   183
 apply (drule_tac [2] sym)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   184
apply (auto simp add: component_of_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   185
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   186
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   187
lemma guarantees_imp: "(Y = UNIV guarantees Y) ==> ex_prop(Y)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   188
apply (simp (no_asm_use) add: guar_def ex_prop_equiv)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   189
apply safe
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   190
apply (auto simp add: component_of_def dest: sym)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   191
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   192
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   193
lemma ex_prop_equiv2: "(ex_prop Y) = (Y = UNIV guarantees Y)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   194
apply (rule iffI)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   195
apply (rule ex_prop_imp)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   196
apply (auto simp add: guarantees_imp) 
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   197
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   198
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   199
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   200
(** Distributive laws.  Re-orient to perform miniscoping **)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   201
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   202
lemma guarantees_UN_left: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   203
     "(\<Union>i \<in> I. X i) guarantees Y = (\<Inter>i \<in> I. X i guarantees Y)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   204
by (unfold guar_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   205
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   206
lemma guarantees_Un_left: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   207
     "(X \<union> Y) guarantees Z = (X guarantees Z) \<inter> (Y guarantees Z)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   208
by (unfold guar_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   209
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   210
lemma guarantees_INT_right: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   211
     "X guarantees (\<Inter>i \<in> I. Y i) = (\<Inter>i \<in> I. X guarantees Y i)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   212
by (unfold guar_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   213
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   214
lemma guarantees_Int_right: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   215
     "Z guarantees (X \<inter> Y) = (Z guarantees X) \<inter> (Z guarantees Y)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   216
by (unfold guar_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   217
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   218
lemma guarantees_Int_right_I:
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   219
     "[| F \<in> Z guarantees X;  F \<in> Z guarantees Y |]  
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   220
     ==> F \<in> Z guarantees (X \<inter> Y)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   221
by (simp add: guarantees_Int_right)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   222
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   223
lemma guarantees_INT_right_iff:
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   224
     "(F \<in> X guarantees (INTER I Y)) = (\<forall>i\<in>I. F \<in> X guarantees (Y i))"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   225
by (simp add: guarantees_INT_right)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   226
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   227
lemma shunting: "(X guarantees Y) = (UNIV guarantees (-X \<union> Y))"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   228
by (unfold guar_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   229
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   230
lemma contrapositive: "(X guarantees Y) = -Y guarantees -X"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   231
by (unfold guar_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   232
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   233
(** The following two can be expressed using intersection and subset, which
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   234
    is more faithful to the text but looks cryptic.
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   235
**)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   236
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   237
lemma combining1: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   238
    "[| F \<in> V guarantees X;  F \<in> (X \<inter> Y) guarantees Z |] 
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   239
     ==> F \<in> (V \<inter> Y) guarantees Z"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   240
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   241
by (unfold guar_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   242
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   243
lemma combining2: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   244
    "[| F \<in> V guarantees (X \<union> Y);  F \<in> Y guarantees Z |] 
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   245
     ==> F \<in> V guarantees (X \<union> Z)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   246
by (unfold guar_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   247
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   248
(** The following two follow Chandy-Sanders, but the use of object-quantifiers
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   249
    does not suit Isabelle... **)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   250
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   251
(*Premise should be (!!i. i \<in> I ==> F \<in> X guarantees Y i) *)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   252
lemma all_guarantees: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   253
     "\<forall>i\<in>I. F \<in> X guarantees (Y i) ==> F \<in> X guarantees (\<Inter>i \<in> I. Y i)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   254
by (unfold guar_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   255
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   256
(*Premises should be [| F \<in> X guarantees Y i; i \<in> I |] *)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   257
lemma ex_guarantees: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   258
     "\<exists>i\<in>I. F \<in> X guarantees (Y i) ==> F \<in> X guarantees (\<Union>i \<in> I. Y i)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   259
by (unfold guar_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   260
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   261
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   262
(*** Additional guarantees laws, by lcp ***)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   263
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   264
lemma guarantees_Join_Int: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   265
    "[| F \<in> U guarantees V;  G \<in> X guarantees Y; F ok G |]  
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   266
     ==> F\<squnion>G \<in> (U \<inter> X) guarantees (V \<inter> Y)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   267
apply (unfold guar_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   268
apply (simp (no_asm))
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   269
apply safe
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   270
apply (simp add: Join_assoc)
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   271
apply (subgoal_tac "F\<squnion>G\<squnion>Ga = G\<squnion>(F\<squnion>Ga) ")
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   272
apply (simp add: ok_commute)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   273
apply (simp (no_asm_simp) add: Join_ac)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   274
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   275
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   276
lemma guarantees_Join_Un: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   277
    "[| F \<in> U guarantees V;  G \<in> X guarantees Y; F ok G |]   
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   278
     ==> F\<squnion>G \<in> (U \<union> X) guarantees (V \<union> Y)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   279
apply (unfold guar_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   280
apply (simp (no_asm))
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   281
apply safe
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   282
apply (simp add: Join_assoc)
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   283
apply (subgoal_tac "F\<squnion>G\<squnion>Ga = G\<squnion>(F\<squnion>Ga) ")
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   284
apply (simp add: ok_commute)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   285
apply (simp (no_asm_simp) add: Join_ac)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   286
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   287
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   288
lemma guarantees_JN_INT: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   289
     "[| \<forall>i\<in>I. F i \<in> X i guarantees Y i;  OK I F |]  
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   290
      ==> (JOIN I F) \<in> (INTER I X) guarantees (INTER I Y)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   291
apply (unfold guar_def, auto)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   292
apply (drule bspec, assumption)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   293
apply (rename_tac "i")
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   294
apply (drule_tac x = "JOIN (I-{i}) F\<squnion>G" in spec)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   295
apply (auto intro: OK_imp_ok
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   296
            simp add: Join_assoc [symmetric] JN_Join_diff JN_absorb)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   297
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   298
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   299
lemma guarantees_JN_UN: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   300
    "[| \<forall>i\<in>I. F i \<in> X i guarantees Y i;  OK I F |]  
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   301
     ==> (JOIN I F) \<in> (UNION I X) guarantees (UNION I Y)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   302
apply (unfold guar_def, auto)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   303
apply (drule bspec, assumption)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   304
apply (rename_tac "i")
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   305
apply (drule_tac x = "JOIN (I-{i}) F\<squnion>G" in spec)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   306
apply (auto intro: OK_imp_ok
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   307
            simp add: Join_assoc [symmetric] JN_Join_diff JN_absorb)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   308
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   309
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   310
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   311
(*** guarantees laws for breaking down the program, by lcp ***)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   312
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   313
lemma guarantees_Join_I1: 
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   314
     "[| F \<in> X guarantees Y;  F ok G |] ==> F\<squnion>G \<in> X guarantees Y"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   315
apply (unfold guar_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   316
apply (simp (no_asm))
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   317
apply safe
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   318
apply (simp add: Join_assoc)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   319
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   320
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   321
lemma guarantees_Join_I2:
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   322
     "[| G \<in> X guarantees Y;  F ok G |] ==> F\<squnion>G \<in> X guarantees Y"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   323
apply (simp add: Join_commute [of _ G] ok_commute [of _ G])
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   324
apply (blast intro: guarantees_Join_I1)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   325
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   326
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   327
lemma guarantees_JN_I: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   328
     "[| i \<in> I;  F i \<in> X guarantees Y;  OK I F |]  
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   329
      ==> (\<Squnion>i \<in> I. (F i)) \<in> X guarantees Y"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   330
apply (unfold guar_def, clarify)
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   331
apply (drule_tac x = "JOIN (I-{i}) F\<squnion>G" in spec)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   332
apply (auto intro: OK_imp_ok simp add: JN_Join_diff JN_Join_diff Join_assoc [symmetric])
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   333
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   334
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   335
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   336
(*** well-definedness ***)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   337
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   338
lemma Join_welldef_D1: "F\<squnion>G \<in> welldef ==> F \<in> welldef"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   339
by (unfold welldef_def, auto)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   340
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   341
lemma Join_welldef_D2: "F\<squnion>G \<in> welldef ==> G \<in> welldef"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   342
by (unfold welldef_def, auto)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   343
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   344
(*** refinement ***)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   345
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   346
lemma refines_refl: "F refines F wrt X"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   347
by (unfold refines_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   348
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   349
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   350
(* Goalw [refines_def]
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   351
     "[| H refines G wrt X;  G refines F wrt X |] ==> H refines F wrt X"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   352
by Auto_tac
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   353
qed "refines_trans"; *)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   354
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   355
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   356
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   357
lemma strict_ex_refine_lemma: 
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   358
     "strict_ex_prop X  
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   359
      ==> (\<forall>H. F ok H & G ok H & F\<squnion>H \<in> X --> G\<squnion>H \<in> X)  
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   360
              = (F \<in> X --> G \<in> X)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   361
by (unfold strict_ex_prop_def, auto)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   362
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   363
lemma strict_ex_refine_lemma_v: 
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   364
     "strict_ex_prop X  
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   365
      ==> (\<forall>H. F ok H & G ok H & F\<squnion>H \<in> welldef & F\<squnion>H \<in> X --> G\<squnion>H \<in> X) =  
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   366
          (F \<in> welldef \<inter> X --> G \<in> X)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   367
apply (unfold strict_ex_prop_def, safe)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   368
apply (erule_tac x = SKIP and P = "%H. ?PP H --> ?RR H" in allE)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   369
apply (auto dest: Join_welldef_D1 Join_welldef_D2)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   370
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   371
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   372
lemma ex_refinement_thm:
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   373
     "[| strict_ex_prop X;   
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   374
         \<forall>H. F ok H & G ok H & F\<squnion>H \<in> welldef \<inter> X --> G\<squnion>H \<in> welldef |]  
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   375
      ==> (G refines F wrt X) = (G iso_refines F wrt X)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   376
apply (rule_tac x = SKIP in allE, assumption)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   377
apply (simp add: refines_def iso_refines_def strict_ex_refine_lemma_v)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   378
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   379
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   380
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   381
lemma strict_uv_refine_lemma: 
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   382
     "strict_uv_prop X ==> 
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   383
      (\<forall>H. F ok H & G ok H & F\<squnion>H \<in> X --> G\<squnion>H \<in> X) = (F \<in> X --> G \<in> X)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   384
by (unfold strict_uv_prop_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   385
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   386
lemma strict_uv_refine_lemma_v: 
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   387
     "strict_uv_prop X  
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   388
      ==> (\<forall>H. F ok H & G ok H & F\<squnion>H \<in> welldef & F\<squnion>H \<in> X --> G\<squnion>H \<in> X) =  
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   389
          (F \<in> welldef \<inter> X --> G \<in> X)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   390
apply (unfold strict_uv_prop_def, safe)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   391
apply (erule_tac x = SKIP and P = "%H. ?PP H --> ?RR H" in allE)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   392
apply (auto dest: Join_welldef_D1 Join_welldef_D2)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   393
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   394
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   395
lemma uv_refinement_thm:
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   396
     "[| strict_uv_prop X;   
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   397
         \<forall>H. F ok H & G ok H & F\<squnion>H \<in> welldef \<inter> X --> 
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   398
             G\<squnion>H \<in> welldef |]  
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   399
      ==> (G refines F wrt X) = (G iso_refines F wrt X)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   400
apply (rule_tac x = SKIP in allE, assumption)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   401
apply (simp add: refines_def iso_refines_def strict_uv_refine_lemma_v)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   402
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   403
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   404
(* Added by Sidi Ehmety from Chandy & Sander, section 6 *)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   405
lemma guarantees_equiv: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   406
    "(F \<in> X guarantees Y) = (\<forall>H. H \<in> X \<longrightarrow> (F component_of H \<longrightarrow> H \<in> Y))"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   407
by (unfold guar_def component_of_def, auto)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   408
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   409
lemma wg_weakest: "!!X. F:(X guarantees Y) ==> X \<subseteq> (wg F Y)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   410
by (unfold wg_def, auto)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   411
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   412
lemma wg_guarantees: "F:((wg F Y) guarantees Y)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   413
by (unfold wg_def guar_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   414
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   415
lemma wg_equiv: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   416
  "(H \<in> wg F X) = (F component_of H --> H \<in> X)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   417
apply (unfold wg_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   418
apply (simp (no_asm) add: guarantees_equiv)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   419
apply (rule iffI)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   420
apply (rule_tac [2] x = "{H}" in exI)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   421
apply (blast+)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   422
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   423
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   424
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   425
lemma component_of_wg: "F component_of H ==> (H \<in> wg F X) = (H \<in> X)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   426
by (simp add: wg_equiv)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   427
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   428
lemma wg_finite: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   429
    "\<forall>FF. finite FF & FF \<inter> X \<noteq> {} --> OK FF (%F. F)  
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   430
          --> (\<forall>F\<in>FF. ((\<Squnion>F \<in> FF. F): wg F X) = ((\<Squnion>F \<in> FF. F):X))"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   431
apply clarify
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   432
apply (subgoal_tac "F component_of (\<Squnion>F \<in> FF. F) ")
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   433
apply (drule_tac X = X in component_of_wg, simp)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   434
apply (simp add: component_of_def)
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   435
apply (rule_tac x = "\<Squnion>F \<in> (FF-{F}) . F" in exI)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   436
apply (auto intro: JN_Join_diff dest: ok_sym simp add: OK_iff_ok)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   437
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   438
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   439
lemma wg_ex_prop: "ex_prop X ==> (F \<in> X) = (\<forall>H. H \<in> wg F X)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   440
apply (simp (no_asm_use) add: ex_prop_equiv wg_equiv)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   441
apply blast
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   442
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   443
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   444
(** From Charpentier and Chandy "Theorems About Composition" **)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   445
(* Proposition 2 *)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   446
lemma wx_subset: "(wx X)<=X"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   447
by (unfold wx_def, auto)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   448
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   449
lemma wx_ex_prop: "ex_prop (wx X)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   450
apply (unfold wx_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   451
apply (simp (no_asm) add: ex_prop_equiv)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   452
apply safe
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   453
apply blast
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   454
apply auto
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   455
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   456
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   457
lemma wx_weakest: "\<forall>Z. Z<= X --> ex_prop Z --> Z \<subseteq> wx X"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   458
by (unfold wx_def, auto)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   459
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   460
(* Proposition 6 *)
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   461
lemma wx'_ex_prop: "ex_prop({F. \<forall>G. F ok G --> F\<squnion>G \<in> X})"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   462
apply (unfold ex_prop_def, safe)
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   463
apply (drule_tac x = "G\<squnion>Ga" in spec)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   464
apply (force simp add: ok_Join_iff1 Join_assoc)
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   465
apply (drule_tac x = "F\<squnion>Ga" in spec)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   466
apply (simp (no_asm_use) add: ok_Join_iff1)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   467
apply safe
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   468
apply (simp (no_asm_simp) add: ok_commute)
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   469
apply (subgoal_tac "F\<squnion>G = G\<squnion>F")
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   470
apply (simp (no_asm_simp) add: Join_assoc)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   471
apply (simp (no_asm) add: Join_commute)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   472
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   473
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   474
(* Equivalence with the other definition of wx *)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   475
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   476
lemma wx_equiv: 
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   477
 "wx X = {F. \<forall>G. F ok G --> (F\<squnion>G):X}"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   478
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   479
apply (unfold wx_def, safe)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   480
apply (simp (no_asm_use) add: ex_prop_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   481
apply (drule_tac x = x in spec)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   482
apply (drule_tac x = G in spec)
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   483
apply (frule_tac c = "x\<squnion>G" in subsetD, safe)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   484
apply (simp (no_asm))
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   485
apply (rule_tac x = "{F. \<forall>G. F ok G --> F\<squnion>G \<in> X}" in exI, safe)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   486
apply (rule_tac [2] wx'_ex_prop)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   487
apply (rotate_tac 1)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   488
apply (drule_tac x = SKIP in spec, auto)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   489
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   490
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   491
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   492
(* Propositions 7 to 11 are about this second definition of wx. And
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   493
   they are the same as the ones proved for the first definition of wx by equivalence *)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   494
   
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   495
(* Proposition 12 *)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   496
(* Main result of the paper *)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   497
lemma guarantees_wx_eq: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   498
   "(X guarantees Y) = wx(-X \<union> Y)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   499
apply (unfold guar_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   500
apply (simp (no_asm) add: wx_equiv)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   501
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   502
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   503
(* {* Corollary, but this result has already been proved elsewhere *}
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   504
 "ex_prop(X guarantees Y)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   505
  by (simp_tac (simpset() addsimps [guar_wx_iff, wx_ex_prop]) 1);
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   506
  qed "guarantees_ex_prop";
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   507
*)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   508
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   509
(* Rules given in section 7 of Chandy and Sander's
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   510
    Reasoning About Program composition paper *)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   511
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   512
lemma stable_guarantees_Always:
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   513
     "Init F \<subseteq> A ==> F:(stable A) guarantees (Always A)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   514
apply (rule guaranteesI)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   515
apply (simp (no_asm) add: Join_commute)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   516
apply (rule stable_Join_Always1)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   517
apply (simp_all add: invariant_def Join_stable)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   518
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   519
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   520
(* To be moved to WFair.ML *)
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   521
lemma leadsTo_Basis': "[| F \<in> A co A \<union> B; F \<in> transient A |] ==> F \<in> A leadsTo B"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   522
apply (drule_tac B = "A-B" in constrains_weaken_L)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   523
apply (drule_tac [2] B = "A-B" in transient_strengthen)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   524
apply (rule_tac [3] ensuresI [THEN leadsTo_Basis])
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   525
apply (blast+)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   526
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   527
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   528
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   529
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   530
lemma constrains_guarantees_leadsTo:
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   531
     "F \<in> transient A ==> F \<in> (A co A \<union> B) guarantees (A leadsTo (B-A))"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   532
apply (rule guaranteesI)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   533
apply (rule leadsTo_Basis')
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   534
apply (drule constrains_weaken_R)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   535
prefer 2 apply assumption
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   536
apply blast
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   537
apply (blast intro: Join_transient_I1)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   538
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   539
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   540
end