src/HOL/UNITY/Comp.thy
author paulson
Wed, 29 Jan 2003 16:34:51 +0100
changeset 13792 d1811693899c
parent 12338 de0f4a63baa5
child 13798 4c1a53627500
permissions -rw-r--r--
converted more UNITY theories to new-style
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
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    16
theory Comp = Union:
5597
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    17
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    18
instance program :: (type) ord ..
5597
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    19
7399
cf780c2bcccf changed "component" infix in HOL/UNITY/Comp.thy to be overloaded <
paulson
parents: 7364
diff changeset
    20
defs
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    21
  component_def:          "F <= H == EX G. F Join G = H"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    22
  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
    23
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    24
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7399
diff changeset
    25
constdefs
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    26
  component_of :: "'a program=>'a program=> bool"
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    27
                                    (infixl "component'_of" 50)
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    28
  "F component_of H == EX G. F ok G & F Join G = H"
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    29
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    30
  strict_component_of :: "'a program\<Rightarrow>'a program=> bool"
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    31
                                    (infixl "strict'_component'_of" 50)
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    32
  "F strict_component_of H == F component_of H & F~=H"
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    33
  
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7399
diff changeset
    34
  preserves :: "('a=>'b) => 'a program set"
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7399
diff changeset
    35
    "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
    36
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    37
  localize  :: "('a=>'b) => 'a program => 'a program"
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    38
  "localize v F == mk_program(Init F, Acts F,
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    39
			      AllowedActs F Int (UN G:preserves v. Acts G))"
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    40
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7399
diff changeset
    41
  funPair      :: "['a => 'b, 'a => 'c, 'a] => 'b * 'c"
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    42
  "funPair f g == %x. (f x, g x)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    43
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    44
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    45
(*** component <= ***)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    46
lemma componentI: 
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    47
     "H <= F | H <= G ==> H <= (F Join G)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    48
apply (unfold component_def, auto)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    49
apply (rule_tac x = "G Join Ga" in exI)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    50
apply (rule_tac [2] x = "G Join F" in exI)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    51
apply (auto simp add: Join_ac)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    52
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    53
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    54
lemma component_eq_subset: 
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    55
     "(F <= G) =  
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    56
      (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
    57
apply (unfold component_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    58
apply (force intro!: exI program_equalityI)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    59
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    60
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    61
lemma component_SKIP [iff]: "SKIP <= F"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    62
apply (unfold component_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    63
apply (force intro: Join_SKIP_left)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    64
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    65
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    66
lemma component_refl [iff]: "F <= (F :: 'a program)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    67
apply (unfold component_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    68
apply (blast intro: Join_SKIP_right)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    69
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    70
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    71
lemma SKIP_minimal: "F <= SKIP ==> F = SKIP"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    72
by (auto intro!: program_equalityI simp add: component_eq_subset)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    73
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    74
lemma component_Join1: "F <= (F Join G)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    75
by (unfold component_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    76
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    77
lemma component_Join2: "G <= (F Join G)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    78
apply (unfold component_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    79
apply (simp (no_asm) add: Join_commute)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    80
apply blast
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    81
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    82
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    83
lemma Join_absorb1: "F<=G ==> F Join G = G"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    84
by (auto simp add: component_def Join_left_absorb)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    85
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    86
lemma Join_absorb2: "G<=F ==> F Join G = F"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    87
by (auto simp add: Join_ac component_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    88
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    89
lemma JN_component_iff: "((JOIN I F) <= H) = (ALL i: I. F i <= H)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    90
apply (simp (no_asm) add: component_eq_subset)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    91
apply blast
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    92
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    93
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    94
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
    95
apply (unfold component_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    96
apply (blast intro: JN_absorb)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    97
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    98
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    99
lemma component_trans: "[| F <= G; G <= H |] ==> F <= (H :: 'a program)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   100
apply (unfold component_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   101
apply (blast intro: Join_assoc [symmetric])
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   102
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   103
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   104
lemma component_antisym: "[| F <= G; G <= F |] ==> F = (G :: 'a program)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   105
apply (simp (no_asm_use) add: component_eq_subset)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   106
apply (blast intro!: program_equalityI)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   107
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   108
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   109
lemma Join_component_iff: "((F Join G) <= H) = (F <= H & G <= H)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   110
apply (simp (no_asm) add: component_eq_subset)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   111
apply blast
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   112
done
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
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
   115
by (auto simp add: constrains_def component_eq_subset)
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
(*Used in Guar.thy to show that programs are partially ordered*)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   118
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
   119
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   120
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   121
(*** preserves ***)
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 preservesI: "(!!z. F : stable {s. v s = z}) ==> F : preserves v"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   124
by (unfold preserves_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   125
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   126
lemma preserves_imp_eq: 
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   127
     "[| 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
   128
apply (unfold preserves_def stable_def constrains_def, force)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   129
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   130
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   131
lemma Join_preserves [iff]: 
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   132
     "(F Join G : preserves v) = (F : preserves v & G : preserves v)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   133
apply (unfold preserves_def, auto)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   134
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   135
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   136
lemma JN_preserves [iff]:
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   137
     "(JOIN I F : preserves v) = (ALL i:I. F i : preserves v)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   138
apply (simp (no_asm) add: JN_stable preserves_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   139
apply blast
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   140
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   141
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   142
lemma SKIP_preserves [iff]: "SKIP : preserves v"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   143
by (auto simp add: preserves_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   144
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   145
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
   146
by (simp add:  funPair_def)
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 preserves_funPair: "preserves (funPair v w) = preserves v Int preserves w"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   149
by (auto simp add: preserves_def stable_def constrains_def, blast)
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
(* (F : preserves (funPair v w)) = (F : preserves v Int preserves w) *)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   152
declare preserves_funPair [THEN eqset_imp_iff, iff]
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
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   155
lemma funPair_o_distrib: "(funPair f g) o h = funPair (f o h) (g o h)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   156
apply (simp (no_asm) add: funPair_def o_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   157
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   158
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   159
lemma fst_o_funPair [simp]: "fst o (funPair f g) = f"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   160
apply (simp (no_asm) add: funPair_def o_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   161
done
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 snd_o_funPair [simp]: "snd o (funPair f g) = g"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   164
apply (simp (no_asm) add: funPair_def o_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   165
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   166
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   167
lemma subset_preserves_o: "preserves v <= preserves (w o v)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   168
by (force simp add: preserves_def stable_def constrains_def)
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_stable: "preserves v <= stable {s. P (v s)}"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   171
apply (auto simp add: preserves_def stable_def constrains_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   172
apply (rename_tac s' s)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   173
apply (subgoal_tac "v s = v s'")
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   174
apply (force+)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   175
done
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
lemma preserves_subset_increasing: "preserves v <= increasing v"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   178
by (auto simp add: preserves_subset_stable [THEN subsetD] increasing_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   179
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   180
lemma preserves_id_subset_stable: "preserves id <= stable A"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   181
by (force simp add: preserves_def stable_def constrains_def)
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
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   184
(** For use with def_UNION_ok_iff **)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   185
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   186
lemma safety_prop_preserves [iff]: "safety_prop (preserves v)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   187
by (auto intro: safety_prop_INTER1 simp add: preserves_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   188
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   189
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   190
(** Some lemmas used only in Client.ML **)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   191
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   192
lemma stable_localTo_stable2:
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   193
     "[| F : stable {s. P (v s) (w s)};    
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   194
         G : preserves v;  G : preserves w |]                
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   195
      ==> F Join G : stable {s. P (v s) (w s)}"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   196
apply (simp (no_asm_simp))
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   197
apply (subgoal_tac "G: preserves (funPair v w) ")
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   198
 prefer 2 apply simp 
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   199
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
   200
done
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 Increasing_preserves_Stable:
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   203
     "[| F : stable {s. v s <= w s};  G : preserves v;        
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   204
         F Join G : Increasing w |]                
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   205
      ==> F Join G : Stable {s. v s <= w s}"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   206
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
   207
apply (blast intro: constrains_weaken)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   208
(*The G case remains*)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   209
apply (auto simp add: preserves_def stable_def constrains_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   210
apply (case_tac "act: Acts F", blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   211
(*We have a G-action, so delete assumptions about F-actions*)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   212
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
   213
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
   214
apply (subgoal_tac "v x = v xa")
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   215
prefer 2 apply blast
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   216
apply auto
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   217
apply (erule order_trans, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   218
done
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 **)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   221
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   222
(*  component_of is stronger than <= *)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   223
lemma component_of_imp_component: "F component_of H ==> F <= H"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   224
by (unfold component_def component_of_def, blast)
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
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   227
(* component_of satisfies many of the <='s properties *)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   228
lemma component_of_refl [simp]: "F component_of F"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   229
apply (unfold component_of_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   230
apply (rule_tac x = SKIP in exI, auto)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   231
done
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
lemma component_of_SKIP [simp]: "SKIP component_of F"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   234
by (unfold component_of_def, auto)
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
lemma component_of_trans: 
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   237
     "[| 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
   238
apply (unfold component_of_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   239
apply (blast intro: Join_assoc [symmetric])
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   240
done
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
lemmas strict_component_of_eq =
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   243
    strict_component_of_def [THEN meta_eq_to_obj_eq, standard]
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
(** localize **)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   246
lemma localize_Init_eq [simp]: "Init (localize v F) = Init F"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   247
apply (unfold localize_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   248
apply (simp (no_asm))
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   249
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   250
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   251
lemma localize_Acts_eq [simp]: "Acts (localize v F) = Acts F"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   252
apply (unfold localize_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   253
apply (simp (no_asm))
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   254
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   255
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   256
lemma localize_AllowedActs_eq [simp]: 
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   257
 "AllowedActs (localize v F) = AllowedActs F Int (UN G:(preserves v). Acts G)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   258
apply (unfold localize_def, auto)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   259
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   260
5597
a12b25c53df1 composition theory
paulson
parents:
diff changeset
   261
end