src/HOL/UNITY/Comp.thy
author paulson
Fri, 31 Jan 2003 20:12:44 +0100
changeset 13798 4c1a53627500
parent 13792 d1811693899c
child 13805 3786b2fd6808
permissions -rw-r--r--
conversion to new-style theories and tidying
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5597
a12b25c53df1 composition theory
paulson
parents:
diff changeset
     1
(*  Title:      HOL/UNITY/Comp.thy
a12b25c53df1 composition theory
paulson
parents:
diff changeset
     2
    ID:         $Id$
a12b25c53df1 composition theory
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
a12b25c53df1 composition theory
paulson
parents:
diff changeset
     4
    Copyright   1998  University of Cambridge
a12b25c53df1 composition theory
paulson
parents:
diff changeset
     5
a12b25c53df1 composition theory
paulson
parents:
diff changeset
     6
Composition
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
     7
From Chandy and Sanders, "Reasoning About Program Composition",
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
     8
Technical Report 2000-003, University of Florida, 2000.
5597
a12b25c53df1 composition theory
paulson
parents:
diff changeset
     9
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    10
Revised by Sidi Ehmety on January  2001 
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    11
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    12
Added: a strong form of the <= relation (component_of) and localize 
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    13
5597
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    14
*)
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    15
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13792
diff changeset
    16
header{*Composition: Basic Primitives*}
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13792
diff changeset
    17
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    18
theory Comp = Union:
5597
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    19
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    20
instance program :: (type) ord ..
5597
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    21
7399
cf780c2bcccf changed "component" infix in HOL/UNITY/Comp.thy to be overloaded <
paulson
parents: 7364
diff changeset
    22
defs
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    23
  component_def:          "F <= H == EX G. F Join G = H"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    24
  strict_component_def:   "(F < (H::'a program)) == (F <= H & F ~= H)"
5612
e981ca6f7332 Finished proofs to end of section 5.1 of Chandy and Sanders
paulson
parents: 5597
diff changeset
    25
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    26
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7399
diff changeset
    27
constdefs
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    28
  component_of :: "'a program=>'a program=> bool"
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    29
                                    (infixl "component'_of" 50)
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    30
  "F component_of H == EX G. F ok G & F Join G = H"
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    31
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    32
  strict_component_of :: "'a program\<Rightarrow>'a program=> bool"
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    33
                                    (infixl "strict'_component'_of" 50)
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    34
  "F strict_component_of H == F component_of H & F~=H"
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    35
  
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7399
diff changeset
    36
  preserves :: "('a=>'b) => 'a program set"
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7399
diff changeset
    37
    "preserves v == INT z. stable {s. v s = z}"
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7399
diff changeset
    38
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    39
  localize  :: "('a=>'b) => 'a program => 'a program"
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    40
  "localize v F == mk_program(Init F, Acts F,
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    41
			      AllowedActs F Int (UN G:preserves v. Acts G))"
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    42
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7399
diff changeset
    43
  funPair      :: "['a => 'b, 'a => 'c, 'a] => 'b * 'c"
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    44
  "funPair f g == %x. (f x, g x)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    45
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    46
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13792
diff changeset
    47
subsection{*The component relation*}
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    48
lemma componentI: 
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    49
     "H <= F | H <= G ==> H <= (F Join G)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    50
apply (unfold component_def, auto)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    51
apply (rule_tac x = "G Join Ga" in exI)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    52
apply (rule_tac [2] x = "G Join F" in exI)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    53
apply (auto simp add: Join_ac)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    54
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    55
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    56
lemma component_eq_subset: 
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    57
     "(F <= G) =  
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    58
      (Init G <= Init F & Acts F <= Acts G & AllowedActs G <= AllowedActs F)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    59
apply (unfold component_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    60
apply (force intro!: exI program_equalityI)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    61
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    62
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    63
lemma component_SKIP [iff]: "SKIP <= F"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    64
apply (unfold component_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    65
apply (force intro: Join_SKIP_left)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    66
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    67
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    68
lemma component_refl [iff]: "F <= (F :: 'a program)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    69
apply (unfold component_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    70
apply (blast intro: Join_SKIP_right)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    71
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    72
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    73
lemma SKIP_minimal: "F <= SKIP ==> F = SKIP"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    74
by (auto intro!: program_equalityI simp add: component_eq_subset)
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 component_Join1: "F <= (F Join G)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    77
by (unfold component_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    78
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    79
lemma component_Join2: "G <= (F Join G)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    80
apply (unfold component_def)
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13792
diff changeset
    81
apply (simp add: Join_commute, blast)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    82
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    83
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    84
lemma Join_absorb1: "F<=G ==> F Join G = G"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    85
by (auto simp add: component_def Join_left_absorb)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    86
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    87
lemma Join_absorb2: "G<=F ==> F Join G = F"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    88
by (auto simp add: Join_ac component_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    89
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    90
lemma JN_component_iff: "((JOIN I F) <= H) = (ALL i: I. F i <= H)"
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13792
diff changeset
    91
by (simp add: component_eq_subset, blast)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    92
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    93
lemma component_JN: "i : I ==> (F i) <= (JN i:I. (F i))"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    94
apply (unfold component_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    95
apply (blast intro: JN_absorb)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    96
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    97
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    98
lemma component_trans: "[| F <= G; G <= H |] ==> F <= (H :: 'a program)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    99
apply (unfold component_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   100
apply (blast intro: Join_assoc [symmetric])
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   101
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   102
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   103
lemma component_antisym: "[| F <= G; G <= F |] ==> F = (G :: 'a program)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   104
apply (simp (no_asm_use) add: component_eq_subset)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   105
apply (blast intro!: program_equalityI)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   106
done
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
lemma Join_component_iff: "((F Join G) <= H) = (F <= H & G <= H)"
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13792
diff changeset
   109
by (simp add: component_eq_subset, blast)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   110
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   111
lemma component_constrains: "[| F <= G; G : A co B |] ==> F : A co B"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   112
by (auto simp add: constrains_def component_eq_subset)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   113
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   114
(*Used in Guar.thy to show that programs are partially ordered*)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   115
lemmas program_less_le = strict_component_def [THEN meta_eq_to_obj_eq]
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   116
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   117
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13792
diff changeset
   118
subsection{*The preserves property*}
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   119
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   120
lemma preservesI: "(!!z. F : stable {s. v s = z}) ==> F : preserves v"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   121
by (unfold preserves_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   122
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   123
lemma preserves_imp_eq: 
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   124
     "[| F : preserves v;  act : Acts F;  (s,s') : act |] ==> v s = v s'"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   125
apply (unfold preserves_def stable_def constrains_def, force)
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 Join_preserves [iff]: 
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   129
     "(F Join G : preserves v) = (F : preserves v & G : preserves v)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   130
apply (unfold preserves_def, auto)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   131
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   132
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   133
lemma JN_preserves [iff]:
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   134
     "(JOIN I F : preserves v) = (ALL i:I. F i : preserves v)"
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13792
diff changeset
   135
apply (simp add: JN_stable preserves_def, blast)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   136
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   137
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   138
lemma SKIP_preserves [iff]: "SKIP : preserves v"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   139
by (auto simp add: preserves_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   140
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   141
lemma funPair_apply [simp]: "(funPair f g) x = (f x, g x)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   142
by (simp add:  funPair_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   143
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   144
lemma preserves_funPair: "preserves (funPair v w) = preserves v Int preserves w"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   145
by (auto simp add: preserves_def stable_def constrains_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   146
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   147
(* (F : preserves (funPair v w)) = (F : preserves v Int preserves w) *)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   148
declare preserves_funPair [THEN eqset_imp_iff, iff]
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   149
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   150
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   151
lemma funPair_o_distrib: "(funPair f g) o h = funPair (f o h) (g o h)"
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13792
diff changeset
   152
by (simp add: funPair_def o_def)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   153
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   154
lemma fst_o_funPair [simp]: "fst o (funPair f g) = f"
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13792
diff changeset
   155
by (simp add: funPair_def o_def)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   156
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   157
lemma snd_o_funPair [simp]: "snd o (funPair f g) = g"
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13792
diff changeset
   158
by (simp add: funPair_def o_def)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   159
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   160
lemma subset_preserves_o: "preserves v <= preserves (w o v)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   161
by (force simp add: preserves_def stable_def constrains_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   162
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   163
lemma preserves_subset_stable: "preserves v <= stable {s. P (v s)}"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   164
apply (auto simp add: preserves_def stable_def constrains_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   165
apply (rename_tac s' s)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   166
apply (subgoal_tac "v s = v s'")
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   167
apply (force+)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   168
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   169
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   170
lemma preserves_subset_increasing: "preserves v <= increasing v"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   171
by (auto simp add: preserves_subset_stable [THEN subsetD] increasing_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   172
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   173
lemma preserves_id_subset_stable: "preserves id <= stable A"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   174
by (force simp add: preserves_def stable_def constrains_def)
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
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   177
(** For use with def_UNION_ok_iff **)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   178
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   179
lemma safety_prop_preserves [iff]: "safety_prop (preserves v)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   180
by (auto intro: safety_prop_INTER1 simp add: preserves_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   181
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   182
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   183
(** Some lemmas used only in Client.ML **)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   184
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   185
lemma stable_localTo_stable2:
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   186
     "[| F : stable {s. P (v s) (w s)};    
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   187
         G : preserves v;  G : preserves w |]                
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   188
      ==> F Join G : stable {s. P (v s) (w s)}"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   189
apply (simp (no_asm_simp))
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   190
apply (subgoal_tac "G: preserves (funPair v w) ")
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   191
 prefer 2 apply simp 
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   192
apply (drule_tac P1 = "split ?Q" in  preserves_subset_stable [THEN subsetD], auto)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   193
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   194
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   195
lemma Increasing_preserves_Stable:
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   196
     "[| F : stable {s. v s <= w s};  G : preserves v;        
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   197
         F Join G : Increasing w |]                
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   198
      ==> F Join G : Stable {s. v s <= w s}"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   199
apply (auto simp add: stable_def Stable_def Increasing_def Constrains_def all_conj_distrib)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   200
apply (blast intro: constrains_weaken)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   201
(*The G case remains*)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   202
apply (auto simp add: preserves_def stable_def constrains_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   203
apply (case_tac "act: Acts F", blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   204
(*We have a G-action, so delete assumptions about F-actions*)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   205
apply (erule_tac V = "ALL act:Acts F. ?P act" in thin_rl)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   206
apply (erule_tac V = "ALL z. ALL act:Acts F. ?P z act" in thin_rl)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   207
apply (subgoal_tac "v x = v xa")
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   208
prefer 2 apply blast
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   209
apply auto
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   210
apply (erule order_trans, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   211
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   212
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   213
(** component_of **)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   214
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   215
(*  component_of is stronger than <= *)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   216
lemma component_of_imp_component: "F component_of H ==> F <= H"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   217
by (unfold component_def component_of_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   218
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   219
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   220
(* component_of satisfies many of the <='s properties *)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   221
lemma component_of_refl [simp]: "F component_of F"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   222
apply (unfold component_of_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   223
apply (rule_tac x = SKIP in exI, auto)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   224
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   225
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   226
lemma component_of_SKIP [simp]: "SKIP component_of F"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   227
by (unfold component_of_def, auto)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   228
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   229
lemma component_of_trans: 
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   230
     "[| F component_of G; G component_of H |] ==> F component_of H"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   231
apply (unfold component_of_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   232
apply (blast intro: Join_assoc [symmetric])
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   233
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   234
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   235
lemmas strict_component_of_eq =
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   236
    strict_component_of_def [THEN meta_eq_to_obj_eq, standard]
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   237
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   238
(** localize **)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   239
lemma localize_Init_eq [simp]: "Init (localize v F) = Init F"
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13792
diff changeset
   240
by (simp add: localize_def)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   241
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   242
lemma localize_Acts_eq [simp]: "Acts (localize v F) = Acts F"
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13792
diff changeset
   243
by (simp add: localize_def)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   244
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   245
lemma localize_AllowedActs_eq [simp]: 
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   246
 "AllowedActs (localize v F) = AllowedActs F Int (UN G:(preserves v). Acts G)"
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13792
diff changeset
   247
by (unfold localize_def, auto)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   248
5597
a12b25c53df1 composition theory
paulson
parents:
diff changeset
   249
end