src/HOL/UNITY/Comp.thy
author haftmann
Mon, 20 Apr 2009 09:32:07 +0200
changeset 30952 7ab2716dd93b
parent 24147 edc90be09ac1
child 32960 69916a850301
permissions -rw-r--r--
power operation on functions with syntax o^; power operation on relations with syntax ^^
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
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
    10
Revised by Sidi Ehmety on January  2001
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    11
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
    12
Added: a strong form of the \<subseteq> relation (component_of) and localize
11190
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
30952
7ab2716dd93b power operation on functions with syntax o^; power operation on relations with syntax ^^
haftmann
parents: 24147
diff changeset
    18
theory Comp
7ab2716dd93b power operation on functions with syntax o^; power operation on relations with syntax ^^
haftmann
parents: 24147
diff changeset
    19
imports Union
7ab2716dd93b power operation on functions with syntax o^; power operation on relations with syntax ^^
haftmann
parents: 24147
diff changeset
    20
begin
5597
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    21
30952
7ab2716dd93b power operation on functions with syntax o^; power operation on relations with syntax ^^
haftmann
parents: 24147
diff changeset
    22
instantiation program :: (type) ord
7ab2716dd93b power operation on functions with syntax o^; power operation on relations with syntax ^^
haftmann
parents: 24147
diff changeset
    23
begin
5597
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    24
30952
7ab2716dd93b power operation on functions with syntax o^; power operation on relations with syntax ^^
haftmann
parents: 24147
diff changeset
    25
definition
7ab2716dd93b power operation on functions with syntax o^; power operation on relations with syntax ^^
haftmann
parents: 24147
diff changeset
    26
  component_def: "F \<le> H <-> (\<exists>G. F\<squnion>G = H)"
5612
e981ca6f7332 Finished proofs to end of section 5.1 of Chandy and Sanders
paulson
parents: 5597
diff changeset
    27
30952
7ab2716dd93b power operation on functions with syntax o^; power operation on relations with syntax ^^
haftmann
parents: 24147
diff changeset
    28
definition
7ab2716dd93b power operation on functions with syntax o^; power operation on relations with syntax ^^
haftmann
parents: 24147
diff changeset
    29
  strict_component_def: "F < (H::'a program) <-> (F \<le> H & F \<noteq> H)"
7ab2716dd93b power operation on functions with syntax o^; power operation on relations with syntax ^^
haftmann
parents: 24147
diff changeset
    30
7ab2716dd93b power operation on functions with syntax o^; power operation on relations with syntax ^^
haftmann
parents: 24147
diff changeset
    31
instance ..
7ab2716dd93b power operation on functions with syntax o^; power operation on relations with syntax ^^
haftmann
parents: 24147
diff changeset
    32
7ab2716dd93b power operation on functions with syntax o^; power operation on relations with syntax ^^
haftmann
parents: 24147
diff changeset
    33
end
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    34
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7399
diff changeset
    35
constdefs
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    36
  component_of :: "'a program =>'a program=> bool"
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    37
                                    (infixl "component'_of" 50)
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
    38
  "F component_of H == \<exists>G. F ok G & F\<squnion>G = H"
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    39
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    40
  strict_component_of :: "'a program\<Rightarrow>'a program=> bool"
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    41
                                    (infixl "strict'_component'_of" 50)
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    42
  "F strict_component_of H == F component_of H & F\<noteq>H"
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
    43
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7399
diff changeset
    44
  preserves :: "('a=>'b) => 'a program set"
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    45
    "preserves v == \<Inter>z. stable {s. v s = z}"
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7399
diff changeset
    46
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    47
  localize  :: "('a=>'b) => 'a program => 'a program"
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    48
  "localize v F == mk_program(Init F, Acts F,
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    49
			      AllowedActs F \<inter> (\<Union>G \<in> preserves v. Acts G))"
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    50
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7399
diff changeset
    51
  funPair      :: "['a => 'b, 'a => 'c, 'a] => 'b * 'c"
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 8128
diff changeset
    52
  "funPair f g == %x. (f x, g x)"
13792
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
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13792
diff changeset
    55
subsection{*The component relation*}
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
    56
lemma componentI: "H \<le> F | H \<le> G ==> H \<le> (F\<squnion>G)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    57
apply (unfold component_def, auto)
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
    58
apply (rule_tac x = "G\<squnion>Ga" in exI)
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
    59
apply (rule_tac [2] x = "G\<squnion>F" in exI)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    60
apply (auto simp add: Join_ac)
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
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
    63
lemma component_eq_subset:
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
    64
     "(F \<le> G) =
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    65
      (Init G \<subseteq> Init F & Acts F \<subseteq> Acts G & AllowedActs G \<subseteq> AllowedActs F)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    66
apply (unfold component_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    67
apply (force intro!: exI program_equalityI)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    68
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    69
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    70
lemma component_SKIP [iff]: "SKIP \<le> F"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    71
apply (unfold component_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    72
apply (force intro: Join_SKIP_left)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    73
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    74
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    75
lemma component_refl [iff]: "F \<le> (F :: 'a program)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    76
apply (unfold component_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    77
apply (blast intro: Join_SKIP_right)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    78
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    79
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    80
lemma SKIP_minimal: "F \<le> SKIP ==> F = SKIP"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    81
by (auto intro!: program_equalityI simp add: component_eq_subset)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    82
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
    83
lemma component_Join1: "F \<le> (F\<squnion>G)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    84
by (unfold component_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    85
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
    86
lemma component_Join2: "G \<le> (F\<squnion>G)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    87
apply (unfold component_def)
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13792
diff changeset
    88
apply (simp add: Join_commute, blast)
13792
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
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
    91
lemma Join_absorb1: "F \<le> G ==> F\<squnion>G = G"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    92
by (auto simp add: component_def Join_left_absorb)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    93
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
    94
lemma Join_absorb2: "G \<le> F ==> F\<squnion>G = F"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    95
by (auto simp add: Join_ac component_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    96
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    97
lemma JN_component_iff: "((JOIN I F) \<le> H) = (\<forall>i \<in> I. F i \<le> H)"
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13792
diff changeset
    98
by (simp add: component_eq_subset, blast)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
    99
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   100
lemma component_JN: "i \<in> I ==> (F i) \<le> (\<Squnion>i \<in> I. (F i))"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   101
apply (unfold component_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   102
apply (blast intro: JN_absorb)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   103
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   104
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   105
lemma component_trans: "[| F \<le> G; G \<le> H |] ==> F \<le> (H :: 'a program)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   106
apply (unfold component_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   107
apply (blast intro: Join_assoc [symmetric])
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   108
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   109
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   110
lemma component_antisym: "[| F \<le> G; G \<le> F |] ==> F = (G :: 'a program)"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   111
apply (simp (no_asm_use) add: component_eq_subset)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   112
apply (blast intro!: program_equalityI)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   113
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   114
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   115
lemma Join_component_iff: "((F\<squnion>G) \<le> H) = (F \<le> H & G \<le> H)"
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13792
diff changeset
   116
by (simp add: component_eq_subset, blast)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   117
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   118
lemma component_constrains: "[| F \<le> G; G \<in> A co B |] ==> F \<in> A co B"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   119
by (auto simp add: constrains_def component_eq_subset)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   120
13874
0da2141606c6 More on progress sets
paulson
parents: 13819
diff changeset
   121
lemma component_stable: "[| F \<le> G; G \<in> stable A |] ==> F \<in> stable A"
0da2141606c6 More on progress sets
paulson
parents: 13819
diff changeset
   122
by (auto simp add: stable_def component_constrains)
0da2141606c6 More on progress sets
paulson
parents: 13819
diff changeset
   123
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   124
(*Used in Guar.thy to show that programs are partially ordered*)
30952
7ab2716dd93b power operation on functions with syntax o^; power operation on relations with syntax ^^
haftmann
parents: 24147
diff changeset
   125
lemmas program_less_le = strict_component_def
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   126
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   127
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13792
diff changeset
   128
subsection{*The preserves property*}
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   129
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   130
lemma preservesI: "(!!z. F \<in> stable {s. v s = z}) ==> F \<in> preserves v"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   131
by (unfold preserves_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   132
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   133
lemma preserves_imp_eq:
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   134
     "[| F \<in> preserves v;  act \<in> Acts F;  (s,s') \<in> act |] ==> v s = v s'"
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   135
by (unfold preserves_def stable_def constrains_def, force)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   136
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   137
lemma Join_preserves [iff]:
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   138
     "(F\<squnion>G \<in> preserves v) = (F \<in> preserves v & G \<in> preserves v)"
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   139
by (unfold preserves_def, auto)
13792
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 JN_preserves [iff]:
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   142
     "(JOIN I F \<in> preserves v) = (\<forall>i \<in> I. F i \<in> preserves v)"
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   143
by (simp add: JN_stable preserves_def, blast)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   144
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   145
lemma SKIP_preserves [iff]: "SKIP \<in> preserves v"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   146
by (auto simp add: preserves_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 funPair_apply [simp]: "(funPair f g) x = (f x, g x)"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   149
by (simp add:  funPair_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   150
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   151
lemma preserves_funPair: "preserves (funPair v w) = preserves v \<inter> preserves w"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   152
by (auto simp add: preserves_def stable_def constrains_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   153
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   154
(* (F \<in> preserves (funPair v w)) = (F \<in> preserves v \<inter> preserves w) *)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   155
declare preserves_funPair [THEN eqset_imp_iff, iff]
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
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   158
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
   159
by (simp add: funPair_def o_def)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   160
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   161
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
   162
by (simp add: funPair_def o_def)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   163
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   164
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
   165
by (simp add: funPair_def o_def)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   166
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   167
lemma subset_preserves_o: "preserves v \<subseteq> preserves (w o v)"
13792
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
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   170
lemma preserves_subset_stable: "preserves v \<subseteq> stable {s. P (v s)}"
13792
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
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   177
lemma preserves_subset_increasing: "preserves v \<subseteq> increasing v"
13792
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
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   180
lemma preserves_id_subset_stable: "preserves id \<subseteq> stable A"
13792
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
24147
edc90be09ac1 misc cleanup of ML bindings (for multihreading);
wenzelm
parents: 16417
diff changeset
   190
(** Some lemmas used only in Client.thy **)
13792
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:
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   193
     "[| F \<in> stable {s. P (v s) (w s)};
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   194
         G \<in> preserves v;  G \<in> preserves w |]
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   195
      ==> F\<squnion>G \<in> stable {s. P (v s) (w s)}"
13812
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   196
apply simp
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   197
apply (subgoal_tac "G \<in> preserves (funPair v w) ")
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   198
 prefer 2 apply simp
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   199
apply (drule_tac P1 = "split ?Q" in preserves_subset_stable [THEN subsetD], 
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   200
       auto)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   201
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   202
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   203
lemma Increasing_preserves_Stable:
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   204
     "[| F \<in> stable {s. v s \<le> w s};  G \<in> preserves v; F\<squnion>G \<in> Increasing w |]
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   205
      ==> F\<squnion>G \<in> Stable {s. v s \<le> w s}"
13792
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
(*We have a G-action, so delete assumptions about F-actions*)
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   211
apply (erule_tac V = "\<forall>act \<in> Acts F. ?P act" in thin_rl)
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   212
apply (erule_tac V = "\<forall>z. \<forall>act \<in> Acts F. ?P z act" in thin_rl)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   213
apply (subgoal_tac "v x = v xa")
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   214
 apply auto
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   215
apply (erule order_trans, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   216
done
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
(** component_of **)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   219
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   220
(*  component_of is stronger than \<le> *)
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   221
lemma component_of_imp_component: "F component_of H ==> F \<le> H"
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   222
by (unfold component_def component_of_def, blast)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   223
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   224
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   225
(* component_of satisfies many of the same properties as \<le> *)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   226
lemma component_of_refl [simp]: "F component_of F"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   227
apply (unfold component_of_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   228
apply (rule_tac x = SKIP in exI, auto)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   229
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   230
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   231
lemma component_of_SKIP [simp]: "SKIP component_of F"
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   232
by (unfold component_of_def, auto)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   233
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   234
lemma component_of_trans:
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   235
     "[| 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
   236
apply (unfold component_of_def)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   237
apply (blast intro: Join_assoc [symmetric])
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   238
done
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   239
30952
7ab2716dd93b power operation on functions with syntax o^; power operation on relations with syntax ^^
haftmann
parents: 24147
diff changeset
   240
lemmas strict_component_of_eq = strict_component_of_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
(** localize **)
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   243
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
   244
by (simp add: localize_def)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   245
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   246
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
   247
by (simp add: localize_def)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   248
13819
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   249
lemma localize_AllowedActs_eq [simp]:
78f5885b76a9 minor revisions
paulson
parents: 13812
diff changeset
   250
   "AllowedActs (localize v F) = AllowedActs F \<inter> (\<Union>G \<in> preserves v. Acts G)"
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13792
diff changeset
   251
by (unfold localize_def, auto)
13792
d1811693899c converted more UNITY theories to new-style
paulson
parents: 12338
diff changeset
   252
5597
a12b25c53df1 composition theory
paulson
parents:
diff changeset
   253
end