src/HOL/UNITY/Extend.thy
author paulson
Fri, 31 Jan 2003 20:12:44 +0100
changeset 13798 4c1a53627500
parent 13790 8d7e9fce8c50
child 13805 3786b2fd6808
permissions -rw-r--r--
conversion to new-style theories and tidying
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6297
5b9fbdfe22b7 new theory of extending the state space
paulson
parents:
diff changeset
     1
(*  Title:      HOL/UNITY/Extend.thy
5b9fbdfe22b7 new theory of extending the state space
paulson
parents:
diff changeset
     2
    ID:         $Id$
5b9fbdfe22b7 new theory of extending the state space
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
5b9fbdfe22b7 new theory of extending the state space
paulson
parents:
diff changeset
     4
    Copyright   1998  University of Cambridge
5b9fbdfe22b7 new theory of extending the state space
paulson
parents:
diff changeset
     5
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13790
diff changeset
     6
Extending of state setsExtending of state sets
6297
5b9fbdfe22b7 new theory of extending the state space
paulson
parents:
diff changeset
     7
  function f (forget)    maps the extended state to the original state
5b9fbdfe22b7 new theory of extending the state space
paulson
parents:
diff changeset
     8
  function g (forgotten) maps the extended state to the "extending part"
5b9fbdfe22b7 new theory of extending the state space
paulson
parents:
diff changeset
     9
*)
5b9fbdfe22b7 new theory of extending the state space
paulson
parents:
diff changeset
    10
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13790
diff changeset
    11
header{*Extending State Sets*}
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13790
diff changeset
    12
13790
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    13
theory Extend = Guar:
6297
5b9fbdfe22b7 new theory of extending the state space
paulson
parents:
diff changeset
    14
5b9fbdfe22b7 new theory of extending the state space
paulson
parents:
diff changeset
    15
constdefs
5b9fbdfe22b7 new theory of extending the state space
paulson
parents:
diff changeset
    16
8948
b797cfa3548d restructuring: LessThan.ML mostly moved to HOL/SetInterval.ML
paulson
parents: 8703
diff changeset
    17
  (*MOVE to Relation.thy?*)
b797cfa3548d restructuring: LessThan.ML mostly moved to HOL/SetInterval.ML
paulson
parents: 8703
diff changeset
    18
  Restrict :: "[ 'a set, ('a*'b) set] => ('a*'b) set"
b797cfa3548d restructuring: LessThan.ML mostly moved to HOL/SetInterval.ML
paulson
parents: 8703
diff changeset
    19
    "Restrict A r == r Int (A <*> UNIV)"
b797cfa3548d restructuring: LessThan.ML mostly moved to HOL/SetInterval.ML
paulson
parents: 8703
diff changeset
    20
7482
7badd511844d working snapshot
paulson
parents: 7399
diff changeset
    21
  good_map :: "['a*'b => 'c] => bool"
7badd511844d working snapshot
paulson
parents: 7399
diff changeset
    22
    "good_map h == surj h & (ALL x y. fst (inv h (h (x,y))) = x)"
7badd511844d working snapshot
paulson
parents: 7399
diff changeset
    23
     (*Using the locale constant "f", this is  f (h (x,y))) = x*)
7badd511844d working snapshot
paulson
parents: 7399
diff changeset
    24
  
6297
5b9fbdfe22b7 new theory of extending the state space
paulson
parents:
diff changeset
    25
  extend_set :: "['a*'b => 'c, 'a set] => 'c set"
10834
a7897aebbffc *** empty log message ***
nipkow
parents: 10064
diff changeset
    26
    "extend_set h A == h ` (A <*> UNIV)"
6297
5b9fbdfe22b7 new theory of extending the state space
paulson
parents:
diff changeset
    27
7342
532841541d73 project constants
paulson
parents: 6677
diff changeset
    28
  project_set :: "['a*'b => 'c, 'c set] => 'a set"
532841541d73 project constants
paulson
parents: 6677
diff changeset
    29
    "project_set h C == {x. EX y. h(x,y) : C}"
532841541d73 project constants
paulson
parents: 6677
diff changeset
    30
532841541d73 project constants
paulson
parents: 6677
diff changeset
    31
  extend_act :: "['a*'b => 'c, ('a*'a) set] => ('c*'c) set"
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7546
diff changeset
    32
    "extend_act h == %act. UN (s,s'): act. UN y. {(h(s,y), h(s',y))}"
6297
5b9fbdfe22b7 new theory of extending the state space
paulson
parents:
diff changeset
    33
7878
43b03d412b82 working version with localTo[C] instead of localTo
paulson
parents: 7826
diff changeset
    34
  project_act :: "['a*'b => 'c, ('c*'c) set] => ('a*'a) set"
43b03d412b82 working version with localTo[C] instead of localTo
paulson
parents: 7826
diff changeset
    35
    "project_act h act == {(x,x'). EX y y'. (h(x,y), h(x',y')) : act}"
7342
532841541d73 project constants
paulson
parents: 6677
diff changeset
    36
6297
5b9fbdfe22b7 new theory of extending the state space
paulson
parents:
diff changeset
    37
  extend :: "['a*'b => 'c, 'a program] => 'c program"
5b9fbdfe22b7 new theory of extending the state space
paulson
parents:
diff changeset
    38
    "extend h F == mk_program (extend_set h (Init F),
10834
a7897aebbffc *** empty log message ***
nipkow
parents: 10064
diff changeset
    39
			       extend_act h ` Acts F,
a7897aebbffc *** empty log message ***
nipkow
parents: 10064
diff changeset
    40
			       project_act h -` AllowedActs F)"
6297
5b9fbdfe22b7 new theory of extending the state space
paulson
parents:
diff changeset
    41
7878
43b03d412b82 working version with localTo[C] instead of localTo
paulson
parents: 7826
diff changeset
    42
  (*Argument C allows weak safety laws to be projected*)
7880
62fb24e28e5e exchanged the first two args of "project" and "drop_prog"
paulson
parents: 7878
diff changeset
    43
  project :: "['a*'b => 'c, 'c set, 'c program] => 'a program"
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 8948
diff changeset
    44
    "project h C F ==
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 8948
diff changeset
    45
       mk_program (project_set h (Init F),
10834
a7897aebbffc *** empty log message ***
nipkow
parents: 10064
diff changeset
    46
		   project_act h ` Restrict C ` Acts F,
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 8948
diff changeset
    47
		   {act. Restrict (project_set h C) act :
10834
a7897aebbffc *** empty log message ***
nipkow
parents: 10064
diff changeset
    48
		         project_act h ` Restrict C ` AllowedActs F})"
7342
532841541d73 project constants
paulson
parents: 6677
diff changeset
    49
6297
5b9fbdfe22b7 new theory of extending the state space
paulson
parents:
diff changeset
    50
locale Extend =
13790
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    51
  fixes f     :: "'c => 'a"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    52
    and g     :: "'c => 'b"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    53
    and h     :: "'a*'b => 'c"    (*isomorphism between 'a * 'b and 'c *)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    54
    and slice :: "['c set, 'b] => 'a set"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    55
  assumes
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    56
    good_h:  "good_map h"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    57
  defines f_def: "f z == fst (inv h z)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    58
      and g_def: "g z == snd (inv h z)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    59
      and slice_def: "slice Z y == {x. h(x,y) : Z}"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    60
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    61
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    62
(** These we prove OUTSIDE the locale. **)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    63
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    64
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13790
diff changeset
    65
subsection{*Restrict*}
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13790
diff changeset
    66
(*MOVE to Relation.thy?*)
13790
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    67
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    68
lemma Restrict_iff [iff]: "((x,y): Restrict A r) = ((x,y): r & x: A)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    69
by (unfold Restrict_def, blast)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    70
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    71
lemma Restrict_UNIV [simp]: "Restrict UNIV = id"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    72
apply (rule ext)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    73
apply (auto simp add: Restrict_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    74
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    75
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    76
lemma Restrict_empty [simp]: "Restrict {} r = {}"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    77
by (auto simp add: Restrict_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    78
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    79
lemma Restrict_Int [simp]: "Restrict A (Restrict B r) = Restrict (A Int B) r"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    80
by (unfold Restrict_def, blast)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    81
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    82
lemma Restrict_triv: "Domain r <= A ==> Restrict A r = r"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    83
by (unfold Restrict_def, auto)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    84
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    85
lemma Restrict_subset: "Restrict A r <= r"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    86
by (unfold Restrict_def, auto)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    87
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    88
lemma Restrict_eq_mono: 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    89
     "[| A <= B;  Restrict B r = Restrict B s |]  
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    90
      ==> Restrict A r = Restrict A s"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    91
by (unfold Restrict_def, blast)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    92
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    93
lemma Restrict_imageI: 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    94
     "[| s : RR;  Restrict A r = Restrict A s |]  
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    95
      ==> Restrict A r : Restrict A ` RR"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    96
by (unfold Restrict_def image_def, auto)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    97
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    98
lemma Domain_Restrict [simp]: "Domain (Restrict A r) = A Int Domain r"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
    99
by blast
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   100
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   101
lemma Image_Restrict [simp]: "(Restrict A r) `` B = r `` (A Int B)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   102
by blast
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   103
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   104
lemma insert_Id_image_Acts: "f Id = Id ==> insert Id (f`Acts F) = f ` Acts F"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   105
by (blast intro: sym [THEN image_eqI])
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   106
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   107
(*Possibly easier than reasoning about "inv h"*)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   108
lemma good_mapI: 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   109
     assumes surj_h: "surj h"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   110
	 and prem:   "!! x x' y y'. h(x,y) = h(x',y') ==> x=x'"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   111
     shows "good_map h"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   112
apply (simp add: good_map_def) 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   113
apply (safe intro!: surj_h)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   114
apply (rule prem)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   115
apply (subst surjective_pairing [symmetric])
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   116
apply (subst surj_h [THEN surj_f_inv_f])
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   117
apply (rule refl)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   118
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   119
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   120
lemma good_map_is_surj: "good_map h ==> surj h"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   121
by (unfold good_map_def, auto)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   122
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   123
(*A convenient way of finding a closed form for inv h*)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   124
lemma fst_inv_equalityI: 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   125
     assumes surj_h: "surj h"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   126
	 and prem:   "!! x y. g (h(x,y)) = x"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   127
     shows "fst (inv h z) = g z"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   128
apply (unfold inv_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   129
apply (rule_tac y1 = z in surj_h [THEN surjD, THEN exE])
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   130
apply (rule someI2)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   131
apply (drule_tac [2] f = g in arg_cong)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   132
apply (auto simp add: prem)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   133
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   134
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   135
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13790
diff changeset
   136
subsection{*Trivial properties of f, g, h*}
13790
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   137
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   138
lemma (in Extend) f_h_eq [simp]: "f(h(x,y)) = x" 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   139
by (simp add: f_def good_h [unfolded good_map_def, THEN conjunct2])
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   140
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   141
lemma (in Extend) h_inject1 [dest]: "h(x,y) = h(x',y') ==> x=x'"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   142
apply (drule_tac f = f in arg_cong)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   143
apply (simp add: f_def good_h [unfolded good_map_def, THEN conjunct2])
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   144
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   145
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   146
lemma (in Extend) h_f_g_equiv: "h(f z, g z) == z"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   147
by (simp add: f_def g_def 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   148
            good_h [unfolded good_map_def, THEN conjunct1, THEN surj_f_inv_f])
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   149
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   150
lemma (in Extend) h_f_g_eq: "h(f z, g z) = z"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   151
by (simp add: h_f_g_equiv)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   152
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   153
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   154
lemma (in Extend) split_extended_all:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   155
     "(!!z. PROP P z) == (!!u y. PROP P (h (u, y)))"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   156
proof 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   157
   assume allP: "\<And>z. PROP P z"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   158
   fix u y
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   159
   show "PROP P (h (u, y))" by (rule allP)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   160
 next
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   161
   assume allPh: "\<And>u y. PROP P (h(u,y))"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   162
   fix z
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   163
   have Phfgz: "PROP P (h (f z, g z))" by (rule allPh)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   164
   show "PROP P z" by (rule Phfgz [unfolded h_f_g_equiv])
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   165
qed 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   166
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   167
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   168
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13790
diff changeset
   169
subsection{*@{term extend_set}: basic properties*}
13790
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   170
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   171
lemma project_set_iff [iff]:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   172
     "(x : project_set h C) = (EX y. h(x,y) : C)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   173
by (simp add: project_set_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   174
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   175
lemma extend_set_mono: "A<=B ==> extend_set h A <= extend_set h B"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   176
by (unfold extend_set_def, blast)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   177
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   178
lemma (in Extend) mem_extend_set_iff [iff]: "z : extend_set h A = (f z : A)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   179
apply (unfold extend_set_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   180
apply (force intro: h_f_g_eq [symmetric])
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   181
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   182
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   183
lemma (in Extend) extend_set_strict_mono [iff]:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   184
     "(extend_set h A <= extend_set h B) = (A <= B)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   185
by (unfold extend_set_def, force)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   186
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   187
lemma extend_set_empty [simp]: "extend_set h {} = {}"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   188
by (unfold extend_set_def, auto)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   189
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   190
lemma (in Extend) extend_set_eq_Collect: "extend_set h {s. P s} = {s. P(f s)}"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   191
by auto
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   192
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   193
lemma (in Extend) extend_set_sing: "extend_set h {x} = {s. f s = x}"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   194
by auto
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   195
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   196
lemma (in Extend) extend_set_inverse [simp]:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   197
     "project_set h (extend_set h C) = C"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   198
by (unfold extend_set_def, auto)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   199
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   200
lemma (in Extend) extend_set_project_set:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   201
     "C <= extend_set h (project_set h C)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   202
apply (unfold extend_set_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   203
apply (auto simp add: split_extended_all, blast)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   204
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   205
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   206
lemma (in Extend) inj_extend_set: "inj (extend_set h)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   207
apply (rule inj_on_inverseI)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   208
apply (rule extend_set_inverse)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   209
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   210
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   211
lemma (in Extend) extend_set_UNIV_eq [simp]: "extend_set h UNIV = UNIV"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   212
apply (unfold extend_set_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   213
apply (auto simp add: split_extended_all)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   214
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   215
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13790
diff changeset
   216
subsection{*@{term project_set}: basic properties*}
13790
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   217
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   218
(*project_set is simply image!*)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   219
lemma (in Extend) project_set_eq: "project_set h C = f ` C"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   220
by (auto intro: f_h_eq [symmetric] simp add: split_extended_all)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   221
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   222
(*Converse appears to fail*)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   223
lemma (in Extend) project_set_I: "!!z. z : C ==> f z : project_set h C"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   224
by (auto simp add: split_extended_all)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   225
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   226
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13790
diff changeset
   227
subsection{*More laws*}
13790
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   228
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   229
(*Because A and B could differ on the "other" part of the state, 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   230
   cannot generalize to 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   231
      project_set h (A Int B) = project_set h A Int project_set h B
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   232
*)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   233
lemma (in Extend) project_set_extend_set_Int:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   234
     "project_set h ((extend_set h A) Int B) = A Int (project_set h B)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   235
by auto
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   236
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   237
(*Unused, but interesting?*)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   238
lemma (in Extend) project_set_extend_set_Un:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   239
     "project_set h ((extend_set h A) Un B) = A Un (project_set h B)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   240
by auto
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   241
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   242
lemma project_set_Int_subset:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   243
     "project_set h (A Int B) <= (project_set h A) Int (project_set h B)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   244
by auto
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   245
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   246
lemma (in Extend) extend_set_Un_distrib:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   247
     "extend_set h (A Un B) = extend_set h A Un extend_set h B"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   248
by auto
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   249
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   250
lemma (in Extend) extend_set_Int_distrib:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   251
     "extend_set h (A Int B) = extend_set h A Int extend_set h B"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   252
by auto
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   253
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   254
lemma (in Extend) extend_set_INT_distrib:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   255
     "extend_set h (INTER A B) = (INT x:A. extend_set h (B x))"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   256
by auto
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   257
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   258
lemma (in Extend) extend_set_Diff_distrib:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   259
     "extend_set h (A - B) = extend_set h A - extend_set h B"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   260
by auto
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   261
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   262
lemma (in Extend) extend_set_Union:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   263
     "extend_set h (Union A) = (UN X:A. extend_set h X)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   264
by blast
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   265
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   266
lemma (in Extend) extend_set_subset_Compl_eq:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   267
     "(extend_set h A <= - extend_set h B) = (A <= - B)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   268
by (unfold extend_set_def, auto)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   269
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   270
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13790
diff changeset
   271
subsection{*@{term extend_act}*}
13790
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   272
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   273
(*Can't strengthen it to
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   274
  ((h(s,y), h(s',y')) : extend_act h act) = ((s, s') : act & y=y')
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   275
  because h doesn't have to be injective in the 2nd argument*)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   276
lemma (in Extend) mem_extend_act_iff [iff]: 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   277
     "((h(s,y), h(s',y)) : extend_act h act) = ((s, s') : act)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   278
by (unfold extend_act_def, auto)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   279
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   280
(*Converse fails: (z,z') would include actions that changed the g-part*)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   281
lemma (in Extend) extend_act_D: 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   282
     "(z, z') : extend_act h act ==> (f z, f z') : act"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   283
by (unfold extend_act_def, auto)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   284
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   285
lemma (in Extend) extend_act_inverse [simp]: 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   286
     "project_act h (extend_act h act) = act"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   287
by (unfold extend_act_def project_act_def, blast)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   288
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   289
lemma (in Extend) project_act_extend_act_restrict [simp]: 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   290
     "project_act h (Restrict C (extend_act h act)) =  
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   291
      Restrict (project_set h C) act"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   292
by (unfold extend_act_def project_act_def, blast)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   293
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   294
lemma (in Extend) subset_extend_act_D: 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   295
     "act' <= extend_act h act ==> project_act h act' <= act"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   296
by (unfold extend_act_def project_act_def, force)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   297
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   298
lemma (in Extend) inj_extend_act: "inj (extend_act h)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   299
apply (rule inj_on_inverseI)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   300
apply (rule extend_act_inverse)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   301
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   302
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   303
lemma (in Extend) extend_act_Image [simp]: 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   304
     "extend_act h act `` (extend_set h A) = extend_set h (act `` A)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   305
by (unfold extend_set_def extend_act_def, force)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   306
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   307
lemma (in Extend) extend_act_strict_mono [iff]:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   308
     "(extend_act h act' <= extend_act h act) = (act'<=act)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   309
by (unfold extend_act_def, auto)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   310
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   311
declare (in Extend) inj_extend_act [THEN inj_eq, iff]
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   312
(*This theorem is  (extend_act h act' = extend_act h act) = (act'=act) *)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   313
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   314
lemma Domain_extend_act: 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   315
    "Domain (extend_act h act) = extend_set h (Domain act)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   316
by (unfold extend_set_def extend_act_def, force)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   317
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   318
lemma (in Extend) extend_act_Id [simp]: 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   319
    "extend_act h Id = Id"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   320
apply (unfold extend_act_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   321
apply (force intro: h_f_g_eq [symmetric])
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   322
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   323
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   324
lemma (in Extend) project_act_I: 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   325
     "!!z z'. (z, z') : act ==> (f z, f z') : project_act h act"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   326
apply (unfold project_act_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   327
apply (force simp add: split_extended_all)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   328
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   329
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   330
lemma (in Extend) project_act_Id [simp]: "project_act h Id = Id"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   331
by (unfold project_act_def, force)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   332
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   333
lemma (in Extend) Domain_project_act: 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   334
  "Domain (project_act h act) = project_set h (Domain act)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   335
apply (unfold project_act_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   336
apply (force simp add: split_extended_all)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   337
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   338
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   339
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   340
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13790
diff changeset
   341
subsection{*extend ****)
13790
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   342
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13790
diff changeset
   343
(*** Basic properties*}
13790
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   344
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   345
lemma Init_extend [simp]:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   346
     "Init (extend h F) = extend_set h (Init F)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   347
by (unfold extend_def, auto)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   348
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   349
lemma Init_project [simp]:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   350
     "Init (project h C F) = project_set h (Init F)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   351
by (unfold project_def, auto)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   352
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   353
lemma (in Extend) Acts_extend [simp]:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   354
     "Acts (extend h F) = (extend_act h ` Acts F)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   355
by (simp add: extend_def insert_Id_image_Acts)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   356
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   357
lemma (in Extend) AllowedActs_extend [simp]:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   358
     "AllowedActs (extend h F) = project_act h -` AllowedActs F"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   359
by (simp add: extend_def insert_absorb)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   360
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   361
lemma Acts_project [simp]:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   362
     "Acts(project h C F) = insert Id (project_act h ` Restrict C ` Acts F)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   363
by (auto simp add: project_def image_iff)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   364
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   365
lemma (in Extend) AllowedActs_project [simp]:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   366
     "AllowedActs(project h C F) =  
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   367
        {act. Restrict (project_set h C) act  
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   368
               : project_act h ` Restrict C ` AllowedActs F}"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   369
apply (simp (no_asm) add: project_def image_iff)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   370
apply (subst insert_absorb)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   371
apply (auto intro!: bexI [of _ Id] simp add: project_act_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   372
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   373
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   374
lemma (in Extend) Allowed_extend:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   375
     "Allowed (extend h F) = project h UNIV -` Allowed F"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   376
apply (simp (no_asm) add: AllowedActs_extend Allowed_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   377
apply blast
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   378
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   379
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   380
lemma (in Extend) extend_SKIP [simp]: "extend h SKIP = SKIP"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   381
apply (unfold SKIP_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   382
apply (rule program_equalityI, auto)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   383
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   384
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   385
lemma project_set_UNIV [simp]: "project_set h UNIV = UNIV"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   386
by auto
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   387
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   388
lemma project_set_Union:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   389
     "project_set h (Union A) = (UN X:A. project_set h X)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   390
by blast
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   391
6297
5b9fbdfe22b7 new theory of extending the state space
paulson
parents:
diff changeset
   392
13790
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   393
(*Converse FAILS: the extended state contributing to project_set h C
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   394
  may not coincide with the one contributing to project_act h act*)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   395
lemma (in Extend) project_act_Restrict_subset:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   396
     "project_act h (Restrict C act) <=  
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   397
      Restrict (project_set h C) (project_act h act)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   398
by (auto simp add: project_act_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   399
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   400
lemma (in Extend) project_act_Restrict_Id_eq:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   401
     "project_act h (Restrict C Id) = Restrict (project_set h C) Id"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   402
by (auto simp add: project_act_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   403
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   404
lemma (in Extend) project_extend_eq:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   405
     "project h C (extend h F) =  
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   406
      mk_program (Init F, Restrict (project_set h C) ` Acts F,  
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   407
                  {act. Restrict (project_set h C) act 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   408
                          : project_act h ` Restrict C ` 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   409
                                     (project_act h -` AllowedActs F)})"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   410
apply (rule program_equalityI)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   411
  apply simp
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   412
 apply (simp add: image_eq_UN)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   413
apply (simp add: project_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   414
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   415
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   416
lemma (in Extend) extend_inverse [simp]:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   417
     "project h UNIV (extend h F) = F"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   418
apply (simp (no_asm_simp) add: project_extend_eq image_eq_UN
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   419
          subset_UNIV [THEN subset_trans, THEN Restrict_triv])
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   420
apply (rule program_equalityI)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   421
apply (simp_all (no_asm))
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   422
apply (subst insert_absorb)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   423
apply (simp (no_asm) add: bexI [of _ Id])
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   424
apply auto
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   425
apply (rename_tac "act")
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   426
apply (rule_tac x = "extend_act h act" in bexI, auto)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   427
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   428
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   429
lemma (in Extend) inj_extend: "inj (extend h)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   430
apply (rule inj_on_inverseI)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   431
apply (rule extend_inverse)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   432
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   433
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   434
lemma (in Extend) extend_Join [simp]:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   435
     "extend h (F Join G) = extend h F Join extend h G"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   436
apply (rule program_equalityI)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   437
apply (simp (no_asm) add: extend_set_Int_distrib)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   438
apply (simp add: image_Un, auto)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   439
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   440
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   441
lemma (in Extend) extend_JN [simp]:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   442
     "extend h (JOIN I F) = (JN i:I. extend h (F i))"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   443
apply (rule program_equalityI)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   444
  apply (simp (no_asm) add: extend_set_INT_distrib)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   445
 apply (simp add: image_UN, auto)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   446
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   447
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   448
(** These monotonicity results look natural but are UNUSED **)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   449
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   450
lemma (in Extend) extend_mono: "F <= G ==> extend h F <= extend h G"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   451
by (force simp add: component_eq_subset)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   452
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   453
lemma (in Extend) project_mono: "F <= G ==> project h C F <= project h C G"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   454
by (simp add: component_eq_subset, blast)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   455
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   456
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13790
diff changeset
   457
subsection{*Safety: co, stable*}
13790
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   458
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   459
lemma (in Extend) extend_constrains:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   460
     "(extend h F : (extend_set h A) co (extend_set h B)) =  
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   461
      (F : A co B)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   462
by (simp add: constrains_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   463
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   464
lemma (in Extend) extend_stable:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   465
     "(extend h F : stable (extend_set h A)) = (F : stable A)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   466
by (simp add: stable_def extend_constrains)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   467
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   468
lemma (in Extend) extend_invariant:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   469
     "(extend h F : invariant (extend_set h A)) = (F : invariant A)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   470
by (simp add: invariant_def extend_stable)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   471
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   472
(*Projects the state predicates in the property satisfied by  extend h F.
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   473
  Converse fails: A and B may differ in their extra variables*)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   474
lemma (in Extend) extend_constrains_project_set:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   475
     "extend h F : A co B ==> F : (project_set h A) co (project_set h B)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   476
by (auto simp add: constrains_def, force)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   477
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   478
lemma (in Extend) extend_stable_project_set:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   479
     "extend h F : stable A ==> F : stable (project_set h A)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   480
by (simp add: stable_def extend_constrains_project_set)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   481
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   482
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13790
diff changeset
   483
subsection{*Weak safety primitives: Co, Stable*}
13790
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   484
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   485
lemma (in Extend) reachable_extend_f:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   486
     "p : reachable (extend h F) ==> f p : reachable F"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   487
apply (erule reachable.induct)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   488
apply (auto intro: reachable.intros simp add: extend_act_def image_iff)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   489
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   490
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   491
lemma (in Extend) h_reachable_extend:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   492
     "h(s,y) : reachable (extend h F) ==> s : reachable F"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   493
by (force dest!: reachable_extend_f)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   494
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   495
lemma (in Extend) reachable_extend_eq: 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   496
     "reachable (extend h F) = extend_set h (reachable F)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   497
apply (unfold extend_set_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   498
apply (rule equalityI)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   499
apply (force intro: h_f_g_eq [symmetric] dest!: reachable_extend_f, clarify)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   500
apply (erule reachable.induct)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   501
apply (force intro: reachable.intros)+
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   502
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   503
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   504
lemma (in Extend) extend_Constrains:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   505
     "(extend h F : (extend_set h A) Co (extend_set h B)) =   
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   506
      (F : A Co B)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   507
by (simp add: Constrains_def reachable_extend_eq extend_constrains 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   508
              extend_set_Int_distrib [symmetric])
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   509
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   510
lemma (in Extend) extend_Stable:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   511
     "(extend h F : Stable (extend_set h A)) = (F : Stable A)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   512
by (simp add: Stable_def extend_Constrains)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   513
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   514
lemma (in Extend) extend_Always:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   515
     "(extend h F : Always (extend_set h A)) = (F : Always A)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   516
by (simp (no_asm_simp) add: Always_def extend_Stable)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   517
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   518
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   519
(** Safety and "project" **)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   520
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   521
(** projection: monotonicity for safety **)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   522
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   523
lemma project_act_mono:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   524
     "D <= C ==>  
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   525
      project_act h (Restrict D act) <= project_act h (Restrict C act)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   526
by (auto simp add: project_act_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   527
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   528
lemma (in Extend) project_constrains_mono:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   529
     "[| D <= C; project h C F : A co B |] ==> project h D F : A co B"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   530
apply (auto simp add: constrains_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   531
apply (drule project_act_mono, blast)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   532
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   533
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   534
lemma (in Extend) project_stable_mono:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   535
     "[| D <= C;  project h C F : stable A |] ==> project h D F : stable A"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   536
by (simp add: stable_def project_constrains_mono)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   537
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   538
(*Key lemma used in several proofs about project and co*)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   539
lemma (in Extend) project_constrains: 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   540
     "(project h C F : A co B)  =   
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   541
      (F : (C Int extend_set h A) co (extend_set h B) & A <= B)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   542
apply (unfold constrains_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   543
apply (auto intro!: project_act_I simp add: ball_Un)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   544
apply (force intro!: project_act_I dest!: subsetD)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   545
(*the <== direction*)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   546
apply (unfold project_act_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   547
apply (force dest!: subsetD)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   548
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   549
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   550
lemma (in Extend) project_stable: 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   551
     "(project h UNIV F : stable A) = (F : stable (extend_set h A))"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   552
apply (unfold stable_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   553
apply (simp (no_asm) add: project_constrains)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   554
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   555
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   556
lemma (in Extend) project_stable_I:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   557
     "F : stable (extend_set h A) ==> project h C F : stable A"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   558
apply (drule project_stable [THEN iffD2])
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   559
apply (blast intro: project_stable_mono)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   560
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   561
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   562
lemma (in Extend) Int_extend_set_lemma:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   563
     "A Int extend_set h ((project_set h A) Int B) = A Int extend_set h B"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   564
by (auto simp add: split_extended_all)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   565
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   566
(*Strange (look at occurrences of C) but used in leadsETo proofs*)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   567
lemma project_constrains_project_set:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   568
     "G : C co B ==> project h C G : project_set h C co project_set h B"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   569
by (simp add: constrains_def project_def project_act_def, blast)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   570
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   571
lemma project_stable_project_set:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   572
     "G : stable C ==> project h C G : stable (project_set h C)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   573
by (simp add: stable_def project_constrains_project_set)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   574
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   575
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13790
diff changeset
   576
subsection{*Progress: transient, ensures*}
13790
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   577
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   578
lemma (in Extend) extend_transient:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   579
     "(extend h F : transient (extend_set h A)) = (F : transient A)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   580
by (auto simp add: transient_def extend_set_subset_Compl_eq Domain_extend_act)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   581
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   582
lemma (in Extend) extend_ensures:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   583
     "(extend h F : (extend_set h A) ensures (extend_set h B)) =  
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   584
      (F : A ensures B)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   585
by (simp add: ensures_def extend_constrains extend_transient 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   586
        extend_set_Un_distrib [symmetric] extend_set_Diff_distrib [symmetric])
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   587
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   588
lemma (in Extend) leadsTo_imp_extend_leadsTo:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   589
     "F : A leadsTo B  
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   590
      ==> extend h F : (extend_set h A) leadsTo (extend_set h B)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   591
apply (erule leadsTo_induct)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   592
  apply (simp add: leadsTo_Basis extend_ensures)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   593
 apply (blast intro: leadsTo_Trans)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   594
apply (simp add: leadsTo_UN extend_set_Union)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   595
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   596
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13790
diff changeset
   597
subsection{*Proving the converse takes some doing!*}
13790
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   598
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   599
lemma (in Extend) slice_iff [iff]: "(x : slice C y) = (h(x,y) : C)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   600
by (simp (no_asm) add: slice_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   601
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   602
lemma (in Extend) slice_Union: "slice (Union S) y = (UN x:S. slice x y)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   603
by auto
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   604
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   605
lemma (in Extend) slice_extend_set: "slice (extend_set h A) y = A"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   606
by auto
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   607
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   608
lemma (in Extend) project_set_is_UN_slice:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   609
     "project_set h A = (UN y. slice A y)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   610
by auto
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   611
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   612
lemma (in Extend) extend_transient_slice:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   613
     "extend h F : transient A ==> F : transient (slice A y)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   614
apply (unfold transient_def, auto)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   615
apply (rule bexI, auto)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   616
apply (force simp add: extend_act_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   617
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   618
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   619
(*Converse?*)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   620
lemma (in Extend) extend_constrains_slice:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   621
     "extend h F : A co B ==> F : (slice A y) co (slice B y)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   622
by (auto simp add: constrains_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   623
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   624
lemma (in Extend) extend_ensures_slice:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   625
     "extend h F : A ensures B ==> F : (slice A y) ensures (project_set h B)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   626
apply (auto simp add: ensures_def extend_constrains extend_transient)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   627
apply (erule_tac [2] extend_transient_slice [THEN transient_strengthen])
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   628
apply (erule extend_constrains_slice [THEN constrains_weaken], auto)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   629
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   630
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   631
lemma (in Extend) leadsTo_slice_project_set:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   632
     "ALL y. F : (slice B y) leadsTo CU ==> F : (project_set h B) leadsTo CU"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   633
apply (simp (no_asm) add: project_set_is_UN_slice)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   634
apply (blast intro: leadsTo_UN)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   635
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   636
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13790
diff changeset
   637
lemma (in Extend) extend_leadsTo_slice [rule_format]:
13790
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   638
     "extend h F : AU leadsTo BU  
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   639
      ==> ALL y. F : (slice AU y) leadsTo (project_set h BU)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   640
apply (erule leadsTo_induct)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   641
  apply (blast intro: extend_ensures_slice leadsTo_Basis)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   642
 apply (blast intro: leadsTo_slice_project_set leadsTo_Trans)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   643
apply (simp add: leadsTo_UN slice_Union)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   644
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   645
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   646
lemma (in Extend) extend_leadsTo:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   647
     "(extend h F : (extend_set h A) leadsTo (extend_set h B)) =  
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   648
      (F : A leadsTo B)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   649
apply safe
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   650
apply (erule_tac [2] leadsTo_imp_extend_leadsTo)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   651
apply (drule extend_leadsTo_slice)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   652
apply (simp add: slice_extend_set)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   653
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   654
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   655
lemma (in Extend) extend_LeadsTo:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   656
     "(extend h F : (extend_set h A) LeadsTo (extend_set h B)) =   
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   657
      (F : A LeadsTo B)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   658
by (simp add: LeadsTo_def reachable_extend_eq extend_leadsTo
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   659
              extend_set_Int_distrib [symmetric])
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   660
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   661
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13790
diff changeset
   662
subsection{*preserves*}
13790
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   663
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   664
lemma (in Extend) project_preserves_I:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   665
     "G : preserves (v o f) ==> project h C G : preserves v"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   666
by (auto simp add: preserves_def project_stable_I extend_set_eq_Collect)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   667
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   668
(*to preserve f is to preserve the whole original state*)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   669
lemma (in Extend) project_preserves_id_I:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   670
     "G : preserves f ==> project h C G : preserves id"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   671
by (simp add: project_preserves_I)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   672
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   673
lemma (in Extend) extend_preserves:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   674
     "(extend h G : preserves (v o f)) = (G : preserves v)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   675
by (auto simp add: preserves_def extend_stable [symmetric] 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   676
                   extend_set_eq_Collect)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   677
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   678
lemma (in Extend) inj_extend_preserves: "inj h ==> (extend h G : preserves g)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   679
by (auto simp add: preserves_def extend_def extend_act_def stable_def 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   680
                   constrains_def g_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   681
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   682
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13790
diff changeset
   683
subsection{*Guarantees*}
13790
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   684
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   685
lemma (in Extend) project_extend_Join:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   686
     "project h UNIV ((extend h F) Join G) = F Join (project h UNIV G)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   687
apply (rule program_equalityI)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   688
  apply (simp add: project_set_extend_set_Int)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   689
 apply (simp add: image_eq_UN UN_Un, auto)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   690
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   691
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   692
lemma (in Extend) extend_Join_eq_extend_D:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   693
     "(extend h F) Join G = extend h H ==> H = F Join (project h UNIV G)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   694
apply (drule_tac f = "project h UNIV" in arg_cong)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   695
apply (simp add: project_extend_Join)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   696
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   697
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   698
(** Strong precondition and postcondition; only useful when
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   699
    the old and new state sets are in bijection **)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   700
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   701
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   702
lemma (in Extend) ok_extend_imp_ok_project:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   703
     "extend h F ok G ==> F ok project h UNIV G"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   704
apply (auto simp add: ok_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   705
apply (drule subsetD)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   706
apply (auto intro!: rev_image_eqI)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   707
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   708
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   709
lemma (in Extend) ok_extend_iff: "(extend h F ok extend h G) = (F ok G)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   710
apply (simp add: ok_def, safe)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   711
apply (force+)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   712
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   713
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   714
lemma (in Extend) OK_extend_iff: "OK I (%i. extend h (F i)) = (OK I F)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   715
apply (unfold OK_def, safe)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   716
apply (drule_tac x = i in bspec)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   717
apply (drule_tac [2] x = j in bspec)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   718
apply (force+)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   719
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   720
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   721
lemma (in Extend) guarantees_imp_extend_guarantees:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   722
     "F : X guarantees Y ==>  
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   723
      extend h F : (extend h ` X) guarantees (extend h ` Y)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   724
apply (rule guaranteesI, clarify)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   725
apply (blast dest: ok_extend_imp_ok_project extend_Join_eq_extend_D 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   726
                   guaranteesD)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   727
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   728
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   729
lemma (in Extend) extend_guarantees_imp_guarantees:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   730
     "extend h F : (extend h ` X) guarantees (extend h ` Y)  
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   731
      ==> F : X guarantees Y"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   732
apply (auto simp add: guar_def)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   733
apply (drule_tac x = "extend h G" in spec)
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   734
apply (simp del: extend_Join 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   735
            add: extend_Join [symmetric] ok_extend_iff 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   736
                 inj_extend [THEN inj_image_mem_iff])
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   737
done
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   738
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   739
lemma (in Extend) extend_guarantees_eq:
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   740
     "(extend h F : (extend h ` X) guarantees (extend h ` Y)) =  
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   741
      (F : X guarantees Y)"
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   742
by (blast intro: guarantees_imp_extend_guarantees 
8d7e9fce8c50 converting UNITY to new-style theories
paulson
parents: 10834
diff changeset
   743
                 extend_guarantees_imp_guarantees)
6297
5b9fbdfe22b7 new theory of extending the state space
paulson
parents:
diff changeset
   744
5b9fbdfe22b7 new theory of extending the state space
paulson
parents:
diff changeset
   745
end