src/HOL/UNITY/Union.ML
author paulson
Tue, 30 Nov 1999 16:54:10 +0100
changeset 8041 e3237d8c18d6
parent 7964 6b3e345c47b3
child 8042 ecdedff41e67
permissions -rw-r--r--
working version with new theory ELT
paulson@5252
     1
(*  Title:      HOL/UNITY/Union.ML
paulson@5252
     2
    ID:         $Id$
paulson@5252
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
paulson@5252
     4
    Copyright   1998  University of Cambridge
paulson@5252
     5
paulson@5252
     6
Unions of programs
paulson@5252
     7
paulson@5252
     8
From Misra's Chapter 5: Asynchronous Compositions of Programs
paulson@5252
     9
*)
paulson@5252
    10
paulson@6012
    11
Addcongs [UN_cong, INT_cong];
paulson@5252
    12
paulson@6295
    13
paulson@5867
    14
(** SKIP **)
paulson@5867
    15
paulson@6295
    16
Goal "Init SKIP = UNIV";
paulson@5648
    17
by (simp_tac (simpset() addsimps [SKIP_def]) 1);
paulson@5611
    18
qed "Init_SKIP";
paulson@5611
    19
paulson@6295
    20
Goal "Acts SKIP = {Id}";
paulson@5648
    21
by (simp_tac (simpset() addsimps [SKIP_def]) 1);
paulson@5648
    22
qed "Acts_SKIP";
paulson@5648
    23
paulson@6295
    24
Addsimps [Init_SKIP, Acts_SKIP];
paulson@5648
    25
paulson@6295
    26
Goal "reachable SKIP = UNIV";
paulson@6012
    27
by (force_tac (claset() addEs [reachable.induct]
paulson@6012
    28
			addIs reachable.intrs, simpset()) 1);
paulson@5867
    29
qed "reachable_SKIP";
paulson@5867
    30
paulson@5867
    31
Addsimps [reachable_SKIP];
paulson@5867
    32
paulson@6836
    33
(** SKIP and safety properties **)
paulson@6836
    34
paulson@6836
    35
Goalw [constrains_def] "(SKIP : A co B) = (A<=B)";
paulson@6836
    36
by Auto_tac;
paulson@6836
    37
qed "SKIP_in_constrains_iff";
paulson@6836
    38
AddIffs [SKIP_in_constrains_iff];
paulson@6836
    39
paulson@6836
    40
Goalw [Constrains_def] "(SKIP : A Co B) = (A<=B)";
paulson@6836
    41
by Auto_tac;
paulson@6836
    42
qed "SKIP_in_Constrains_iff";
paulson@6836
    43
AddIffs [SKIP_in_Constrains_iff];
paulson@6836
    44
paulson@6836
    45
Goalw [stable_def] "SKIP : stable A";
paulson@6836
    46
by Auto_tac;
paulson@6836
    47
qed "SKIP_in_stable";
paulson@6836
    48
AddIffs [SKIP_in_stable, SKIP_in_stable RS stable_imp_Stable];
paulson@6836
    49
paulson@5867
    50
paulson@6012
    51
(** Join **)
paulson@6012
    52
paulson@6295
    53
Goal "Init (F Join G) = Init F Int Init G";
paulson@6012
    54
by (simp_tac (simpset() addsimps [Join_def]) 1);
paulson@5313
    55
qed "Init_Join";
paulson@5252
    56
paulson@6295
    57
Goal "Acts (F Join G) = Acts F Un Acts G";
paulson@5596
    58
by (auto_tac (claset(), simpset() addsimps [Join_def]));
paulson@5313
    59
qed "Acts_Join";
paulson@5252
    60
paulson@7537
    61
Addsimps [Init_Join, Acts_Join];
paulson@6295
    62
paulson@6012
    63
paulson@6012
    64
(** JN **)
paulson@6012
    65
paulson@6295
    66
Goalw [JOIN_def, SKIP_def] "(JN i:{}. F i) = SKIP";
paulson@6012
    67
by Auto_tac;
paulson@6012
    68
qed "JN_empty";
paulson@6012
    69
Addsimps [JN_empty];
paulson@6012
    70
paulson@6633
    71
Goal "(JN i:insert a I. F i) = (F a) Join (JN i:I. F i)";
paulson@6295
    72
by (rtac program_equalityI 1);
paulson@6295
    73
by (ALLGOALS (simp_tac (simpset() addsimps [JOIN_def, Join_def])));
paulson@6295
    74
qed "JN_insert";
paulson@6295
    75
Addsimps[JN_empty, JN_insert];
paulson@6012
    76
paulson@5611
    77
Goal "Init (JN i:I. F i) = (INT i:I. Init (F i))";
paulson@6295
    78
by (simp_tac (simpset() addsimps [JOIN_def]) 1);
paulson@5313
    79
qed "Init_JN";
paulson@5252
    80
paulson@6295
    81
Goal "Acts (JN i:I. F i) = insert Id (UN i:I. Acts (F i))";
paulson@5596
    82
by (auto_tac (claset(), simpset() addsimps [JOIN_def]));
paulson@5313
    83
qed "Acts_JN";
paulson@5252
    84
paulson@7537
    85
Addsimps [Init_JN, Acts_JN];
paulson@5259
    86
paulson@6295
    87
val prems = Goalw [JOIN_def]
paulson@6633
    88
    "[| I=J;  !!i. i:J ==> F i = G i |] ==> \
paulson@6633
    89
\    (JN i:I. F i) = (JN i:J. G i)";
paulson@6295
    90
by (asm_simp_tac (simpset() addsimps prems) 1);
paulson@6295
    91
qed "JN_cong";
paulson@6012
    92
paulson@6295
    93
Addcongs [JN_cong];
paulson@5584
    94
paulson@5584
    95
paulson@5611
    96
(** Algebraic laws **)
paulson@5259
    97
paulson@5611
    98
Goal "F Join G = G Join F";
paulson@5313
    99
by (simp_tac (simpset() addsimps [Join_def, Un_commute, Int_commute]) 1);
paulson@5259
   100
qed "Join_commute";
paulson@5259
   101
paulson@7360
   102
Goal "A Join (B Join C) = B Join (A Join C)";
paulson@7360
   103
by (simp_tac (simpset() addsimps Un_ac@Int_ac@[Join_def]) 1);
paulson@7360
   104
qed "Join_left_commute";
paulson@7360
   105
paulson@5611
   106
Goal "(F Join G) Join H = F Join (G Join H)";
paulson@6295
   107
by (simp_tac (simpset() addsimps Un_ac@[Join_def, Int_assoc]) 1);
paulson@5259
   108
qed "Join_assoc";
paulson@5596
   109
 
paulson@6295
   110
Goalw [Join_def, SKIP_def] "SKIP Join F = F";
paulson@5611
   111
by (rtac program_equalityI 1);
paulson@6295
   112
by (ALLGOALS (simp_tac (simpset() addsimps [insert_absorb])));
paulson@5611
   113
qed "Join_SKIP_left";
paulson@5584
   114
paulson@6295
   115
Goalw [Join_def, SKIP_def] "F Join SKIP = F";
paulson@6295
   116
by (rtac program_equalityI 1);
paulson@6295
   117
by (ALLGOALS (simp_tac (simpset() addsimps [insert_absorb])));
paulson@5611
   118
qed "Join_SKIP_right";
paulson@5611
   119
paulson@5611
   120
Addsimps [Join_SKIP_left, Join_SKIP_right];
paulson@5611
   121
paulson@5611
   122
Goalw [Join_def] "F Join F = F";
paulson@5611
   123
by (rtac program_equalityI 1);
paulson@6295
   124
by Auto_tac;
paulson@5313
   125
qed "Join_absorb";
paulson@5313
   126
paulson@5611
   127
Addsimps [Join_absorb];
paulson@5313
   128
paulson@7915
   129
Goalw [Join_def] "F Join (F Join G) = F Join G";
paulson@7360
   130
by (rtac program_equalityI 1);
paulson@7360
   131
by Auto_tac;
paulson@7360
   132
qed "Join_left_absorb";
paulson@7360
   133
paulson@7360
   134
(*Join is an AC-operator*)
paulson@7360
   135
val Join_ac = [Join_assoc, Join_left_absorb, Join_commute, Join_left_commute];
paulson@6295
   136
paulson@6295
   137
paulson@6295
   138
(*** JN laws ***)
paulson@6295
   139
paulson@6633
   140
(*Also follows by JN_insert and insert_absorb, but the proof is longer*)
paulson@6633
   141
Goal "k:I ==> F k Join (JN i:I. F i) = (JN i:I. F i)";
paulson@7537
   142
by (auto_tac (claset() addSIs [program_equalityI], simpset()));
paulson@6295
   143
qed "JN_absorb";
paulson@6295
   144
paulson@6633
   145
Goal "(JN i: I Un J. F i) = ((JN i: I. F i) Join (JN i:J. F i))";
paulson@7537
   146
by (auto_tac (claset() addSIs [program_equalityI], simpset()));
paulson@6633
   147
qed "JN_Un";
paulson@5970
   148
paulson@6836
   149
Goal "(JN i:I. c) = (if I={} then SKIP else c)";
paulson@7537
   150
by (auto_tac (claset() addSIs [program_equalityI], simpset()));
paulson@5970
   151
qed "JN_constant";
paulson@5970
   152
paulson@6633
   153
Goal "(JN i:I. F i Join G i) = (JN i:I. F i)  Join  (JN i:I. G i)";
paulson@7537
   154
by (auto_tac (claset() addSIs [program_equalityI], simpset()));
paulson@5970
   155
qed "JN_Join_distrib";
paulson@5584
   156
paulson@6633
   157
Goal "i : I ==> (JN i:I. F i Join G) = ((JN i:I. F i) Join G)";
paulson@6633
   158
by (asm_simp_tac (simpset() addsimps [JN_Join_distrib, JN_constant]) 1);
paulson@6836
   159
by Auto_tac;
paulson@6633
   160
qed "JN_Join_miniscope";
paulson@6633
   161
paulson@5584
   162
paulson@6536
   163
(*** Safety: co, stable, FP ***)
paulson@5313
   164
paulson@6633
   165
(*Fails if I={} because it collapses to SKIP : A co B*)
paulson@6295
   166
Goalw [constrains_def, JOIN_def]
paulson@6633
   167
    "i : I ==> (JN i:I. F i) : A co B = (ALL i:I. F i : A co B)";
paulson@6295
   168
by (Simp_tac 1);
paulson@6295
   169
by (Blast_tac 1);
paulson@7523
   170
qed "JN_constrains";
paulson@6012
   171
paulson@6633
   172
Goal "(F Join G : A co B) = (F : A co B & G : A co B)";
paulson@6295
   173
by (auto_tac
paulson@6295
   174
    (claset(),
paulson@6295
   175
     simpset() addsimps [constrains_def, Join_def]));
paulson@7523
   176
qed "Join_constrains";
paulson@6012
   177
paulson@6633
   178
(*Analogous weak versions FAIL; see Misra [1994] 5.4.1, Substitution Axiom.
paulson@6633
   179
  reachable (F Join G) could be much bigger than reachable F, reachable G
paulson@6633
   180
*)
paulson@5313
   181
paulson@6295
   182
paulson@6536
   183
Goal "[| F : A co A';  G : B co B' |] \
paulson@6536
   184
\     ==> F Join G : (A Int B) co (A' Un B')";
paulson@7523
   185
by (simp_tac (simpset() addsimps [Join_constrains]) 1);
paulson@5313
   186
by (blast_tac (claset() addIs [constrains_weaken]) 1);
paulson@7523
   187
qed "Join_constrains_weaken";
paulson@5313
   188
paulson@6633
   189
Goal "[| ALL i:I. F i : A i co A' i;  i: I |] \
paulson@6633
   190
\     ==> (JN i:I. F i) : (INT i:I. A i) co (UN i:I. A' i)";
paulson@7523
   191
by (asm_simp_tac (simpset() addsimps [JN_constrains]) 1);
paulson@6633
   192
by (blast_tac (claset() addIs [constrains_weaken]) 1);
paulson@7523
   193
qed "JN_constrains_weaken";
paulson@6633
   194
paulson@6295
   195
Goal "i : I ==> \
paulson@6295
   196
\     (JN i:I. F i) : stable A = (ALL i:I. F i : stable A)";
paulson@7523
   197
by (asm_simp_tac (simpset() addsimps [stable_def, JN_constrains]) 1);
paulson@7523
   198
qed "JN_stable";
paulson@5313
   199
paulson@6295
   200
Goal "[| ALL i:I. F i : invariant A;  i : I |]  \
paulson@5970
   201
\      ==> (JN i:I. F i) : invariant A";
paulson@7523
   202
by (asm_full_simp_tac (simpset() addsimps [invariant_def, JN_stable]) 1);
paulson@5970
   203
by (Blast_tac 1);
paulson@5970
   204
bind_thm ("invariant_JN_I", ballI RS result());
paulson@5970
   205
paulson@7594
   206
Goal "(F Join G : stable A) = \
paulson@6295
   207
\     (F : stable A & G : stable A)";
paulson@7523
   208
by (simp_tac (simpset() addsimps [stable_def, Join_constrains]) 1);
paulson@7523
   209
qed "Join_stable";
paulson@5313
   210
paulson@7594
   211
Goal "(F Join G : increasing f) = \
paulson@7594
   212
\     (F : increasing f & G : increasing f)";
paulson@7594
   213
by (simp_tac (simpset() addsimps [increasing_def, Join_stable]) 1);
paulson@7594
   214
by (Blast_tac 1);
paulson@7594
   215
qed "Join_increasing";
paulson@7594
   216
paulson@6295
   217
Goal "[| F : invariant A; G : invariant A |]  \
paulson@5970
   218
\     ==> F Join G : invariant A";
paulson@7523
   219
by (full_simp_tac (simpset() addsimps [invariant_def, Join_stable]) 1);
paulson@5970
   220
by (Blast_tac 1);
paulson@5970
   221
qed "invariant_JoinI";
paulson@5970
   222
paulson@6295
   223
Goal "i : I ==> FP (JN i:I. F i) = (INT i:I. FP (F i))";
paulson@7523
   224
by (asm_simp_tac (simpset() addsimps [FP_def, JN_stable, INTER_def]) 1);
paulson@5313
   225
qed "FP_JN";
paulson@5313
   226
paulson@5313
   227
paulson@5313
   228
(*** Progress: transient, ensures ***)
paulson@5313
   229
paulson@6295
   230
Goal "i : I ==> \
paulson@6295
   231
\   (JN i:I. F i) : transient A = (EX i:I. F i : transient A)";
paulson@6295
   232
by (auto_tac (claset(),
paulson@6295
   233
	      simpset() addsimps [transient_def, JOIN_def]));
paulson@7523
   234
qed "JN_transient";
paulson@5313
   235
paulson@6295
   236
Goal "F Join G : transient A = \
paulson@6295
   237
\     (F : transient A | G : transient A)";
paulson@6295
   238
by (auto_tac (claset(),
paulson@6295
   239
	      simpset() addsimps [bex_Un, transient_def,
paulson@6295
   240
				  Join_def]));
paulson@7523
   241
qed "Join_transient";
paulson@5313
   242
paulson@6295
   243
Goal "i : I ==> \
paulson@6536
   244
\     (JN i:I. F i) : A ensures B = \
paulson@6536
   245
\     ((ALL i:I. F i : (A-B) co (A Un B)) & \
paulson@6536
   246
\      (EX i:I. F i : A ensures B))";
paulson@5313
   247
by (auto_tac (claset(),
paulson@7523
   248
	      simpset() addsimps [ensures_def, JN_constrains, JN_transient]));
paulson@7523
   249
qed "JN_ensures";
paulson@5313
   250
paulson@5313
   251
Goalw [ensures_def]
paulson@6536
   252
     "F Join G : A ensures B =     \
paulson@7630
   253
\     (F : (A-B) co (A Un B) & G : (A-B) co (A Un B) & \
paulson@7630
   254
\      (F : transient (A-B) | G : transient (A-B)))";
paulson@5313
   255
by (auto_tac (claset(),
paulson@7523
   256
	      simpset() addsimps [Join_constrains, Join_transient]));
paulson@7523
   257
qed "Join_ensures";
paulson@5313
   258
paulson@6295
   259
Goalw [stable_def, constrains_def, Join_def]
paulson@6536
   260
    "[| F : stable A;  G : A co A' |] \
paulson@6536
   261
\    ==> F Join G : A co A'";
paulson@6295
   262
by (asm_full_simp_tac (simpset() addsimps [ball_Un]) 1);
paulson@5313
   263
by (Blast_tac 1);
paulson@7523
   264
qed "stable_Join_constrains";
paulson@5313
   265
paulson@6633
   266
(*Premise for G cannot use Always because  F: Stable A  is weaker than
paulson@5648
   267
  G : stable A *)
paulson@6570
   268
Goal "[| F : stable A;  G : invariant A |] ==> F Join G : Always A";
paulson@6570
   269
by (full_simp_tac (simpset() addsimps [Always_def, invariant_def, 
paulson@7523
   270
				       Stable_eq_stable, Join_stable]) 1);
paulson@5313
   271
by (force_tac(claset() addIs [stable_reachable, stable_Int],
paulson@7537
   272
	      simpset()) 1);
paulson@6570
   273
qed "stable_Join_Always";
paulson@5313
   274
paulson@6536
   275
Goal "[| F : stable A;  G : A ensures B |] ==> F Join G : A ensures B";
paulson@7523
   276
by (asm_simp_tac (simpset() addsimps [Join_ensures]) 1);
paulson@5313
   277
by (asm_full_simp_tac (simpset() addsimps [stable_def, ensures_def]) 1);
paulson@5313
   278
by (etac constrains_weaken 1);
paulson@5313
   279
by Auto_tac;
paulson@7523
   280
qed "stable_Join_ensures1";
paulson@5313
   281
paulson@5313
   282
(*As above, but exchanging the roles of F and G*)
paulson@6536
   283
Goal "[| F : A ensures B;  G : stable A |] ==> F Join G : A ensures B";
paulson@5313
   284
by (stac Join_commute 1);
paulson@7523
   285
by (blast_tac (claset() addIs [stable_Join_ensures1]) 1);
paulson@7523
   286
qed "stable_Join_ensures2";
paulson@5313
   287
paulson@5648
   288
paulson@5804
   289
(** Diff and localTo **)
paulson@5648
   290
paulson@7878
   291
Goalw [Diff_def] "F Join (Diff UNIV G (Acts F)) = F Join G";
paulson@5804
   292
by (rtac program_equalityI 1);
paulson@6295
   293
by Auto_tac;
paulson@5804
   294
qed "Join_Diff2";
paulson@5804
   295
paulson@7594
   296
Goalw [Diff_def]
paulson@7878
   297
   "Diff C (F Join G) (Acts H) = (Diff C F (Acts H)) Join (Diff C G (Acts H))";
paulson@7594
   298
by (rtac program_equalityI 1);
paulson@7594
   299
by Auto_tac;
paulson@7594
   300
qed "Diff_Join_distrib";
paulson@7594
   301
paulson@7878
   302
Goalw [Diff_def] "Diff C F (Acts F) = mk_program(Init F, {})";
paulson@7594
   303
by Auto_tac;
paulson@7878
   304
qed "Diff_self_eq";
paulson@7594
   305
paulson@7878
   306
Goalw [Diff_def, Disjoint_def] "Disjoint C F (Diff C G (Acts F))";
paulson@7878
   307
by (force_tac (claset(), 
paulson@7878
   308
	       simpset() addsimps [Restrict_imageI, 
paulson@7878
   309
				   sym RSN (2,Restrict_imageI)]) 1);
paulson@5804
   310
qed "Diff_Disjoint";
paulson@5804
   311
paulson@7878
   312
Goalw [Disjoint_def]
paulson@7878
   313
     "[| A <= B; Disjoint A F G |] ==> Disjoint B F G";
paulson@7878
   314
by (blast_tac (claset() addIs [Restrict_eq_mono RSN (2,Restrict_imageI)]) 1);
paulson@7878
   315
qed "Disjoint_mono";
paulson@5804
   316
paulson@7878
   317
(*** localTo ***)
paulson@7878
   318
paulson@7878
   319
Goalw [LOCALTO_def, Diff_def, stable_def, constrains_def]
paulson@7878
   320
     "A <= B ==> v localTo[B] F <= v localTo[A] F";
paulson@7878
   321
by Auto_tac;
paulson@7878
   322
by (dres_inst_tac [("x", "v xc")] spec 1);
paulson@7878
   323
by (dres_inst_tac [("x", "Restrict B xa")] bspec 1);
paulson@7878
   324
by Auto_tac;
paulson@7878
   325
by (blast_tac (claset() addIs [Restrict_eq_mono RSN (2,Restrict_imageI)]) 1);
paulson@7878
   326
qed "localTo_anti_mono";
paulson@7878
   327
paulson@7947
   328
bind_thm ("localTo_UNIV_imp_localTo", 
paulson@7947
   329
	  impOfSubs (subset_UNIV RS localTo_anti_mono));
paulson@7947
   330
paulson@7878
   331
Goalw [LocalTo_def]
paulson@7878
   332
     "G : v localTo[UNIV] F ==> G : v LocalTo F";
paulson@7878
   333
by (blast_tac (claset() addDs [impOfSubs localTo_anti_mono]) 1);
paulson@7878
   334
qed "localTo_imp_LocalTo";
paulson@7878
   335
paulson@7878
   336
Goalw [LOCALTO_def, stable_def, constrains_def]
paulson@7964
   337
     "G : v localTo[C] F ==> G : (f o v) localTo[C] F";
paulson@7964
   338
by (Force_tac 1);
paulson@5804
   339
qed "localTo_imp_o_localTo";
paulson@5804
   340
paulson@8041
   341
Goal "G : v LocalTo F ==> G : (f o v) LocalTo F";
paulson@8041
   342
by (asm_full_simp_tac
paulson@8041
   343
    (simpset() addsimps [LocalTo_def, localTo_imp_o_localTo]) 1);
paulson@8041
   344
qed "LocalTo_imp_o_LocalTo";
paulson@8041
   345
paulson@7915
   346
(*NOT USED*)
paulson@7878
   347
Goalw [LOCALTO_def, stable_def, constrains_def]
paulson@7878
   348
     "(%s. x) localTo[C] F = UNIV";
paulson@7689
   349
by (Blast_tac 1);
paulson@7689
   350
qed "triv_localTo_eq_UNIV";
paulson@7689
   351
paulson@7915
   352
Goal "(F Join G : v localTo[C] H) = \
paulson@7915
   353
\     (F : v localTo[C] H  &  G : v localTo[C] H)";
paulson@7915
   354
by (simp_tac (simpset() addsimps [LOCALTO_def, Diff_Join_distrib,
paulson@7915
   355
				  stable_def, Join_constrains]) 1);
paulson@7594
   356
by (Blast_tac 1);
paulson@7594
   357
qed "Join_localTo";
paulson@7594
   358
paulson@7878
   359
Goal "F : v localTo[C] F";
paulson@7594
   360
by (simp_tac 
paulson@7878
   361
    (simpset() addsimps [LOCALTO_def, stable_def, constrains_def, 
paulson@7878
   362
			 Diff_self_eq]) 1);
paulson@7594
   363
qed "self_localTo";
paulson@7594
   364
paulson@7947
   365
Goal "(F Join G : v localTo[C] F) = (G : v localTo[C] F)";
paulson@7947
   366
by (simp_tac (simpset() addsimps [Join_localTo, self_localTo]) 1);
paulson@7947
   367
qed "self_Join_localTo";
paulson@7947
   368
paulson@7947
   369
Goal "(F Join G : v LocalTo F) = (G : v LocalTo F)";
paulson@7947
   370
by (simp_tac (simpset() addsimps [self_Join_localTo, LocalTo_def,
paulson@7947
   371
				  Join_left_absorb]) 1);
paulson@7947
   372
qed "self_Join_LocalTo";
paulson@7947
   373
paulson@8041
   374
Goalw [LOCALTO_def]
paulson@8041
   375
     "[| G : v localTo[C] F;  F<=F' |] ==> G : v localTo[C] F'";
paulson@8041
   376
by (Force_tac 1);
paulson@8041
   377
qed "localTo_imp_o_localTo";
paulson@8041
   378
paulson@7594
   379
paulson@5804
   380
paulson@5804
   381
(*** Higher-level rules involving localTo and Join ***)
paulson@5804
   382
paulson@8041
   383
Goal "[| F : {s. P (v s)} co B;  G : v localTo[C] F |]  \
paulson@8041
   384
\     ==> G : C Int {s. P (v s)} co B";
paulson@7878
   385
by (ftac constrains_imp_subset 1);
paulson@7826
   386
by (auto_tac (claset(), 
paulson@7878
   387
	      simpset() addsimps [LOCALTO_def, stable_def, constrains_def,
paulson@7826
   388
				  Diff_def]));
paulson@7878
   389
by (case_tac "Restrict C act: Restrict C `` Acts F" 1);
paulson@7878
   390
by (blast_tac (claset() addSEs [equalityE]) 1);
paulson@7826
   391
by (subgoal_tac "v x = v xa" 1);
paulson@7878
   392
by (Force_tac 1);
paulson@7878
   393
by (thin_tac "ALL act: ?A. ?P act" 1);
paulson@7878
   394
by (dtac spec 1);
paulson@7878
   395
by (dres_inst_tac [("x", "Restrict C act")] bspec 1);
paulson@7826
   396
by Auto_tac;
paulson@7826
   397
qed "constrains_localTo_constrains";
paulson@7826
   398
paulson@7878
   399
Goalw [LOCALTO_def, stable_def, constrains_def, Diff_def]
paulson@7878
   400
     "[| G : v localTo[C] F;  G : w localTo[C] F |]  \
paulson@7878
   401
\     ==> G : (%s. (v s, w s)) localTo[C] F";
paulson@7826
   402
by (Blast_tac 1);
paulson@7826
   403
qed "localTo_pairfun";
paulson@7826
   404
paulson@8041
   405
Goal "[| F : {s. P (v s) (w s)} co B;   \
paulson@7878
   406
\        G : v localTo[C] F;       \
paulson@7878
   407
\        G : w localTo[C] F |]               \
paulson@8041
   408
\     ==> G : C Int {s. P (v s) (w s)} co B";
paulson@8041
   409
by (res_inst_tac [("A", "C Int {s. (%(x,y). P x y) (v s, w s)}")] 
paulson@7826
   410
    constrains_weaken 1);
paulson@7826
   411
by (rtac (localTo_pairfun RSN (2, constrains_localTo_constrains)) 1);
paulson@6295
   412
by Auto_tac;
paulson@5804
   413
qed "constrains_localTo_constrains2";
paulson@5804
   414
paulson@7878
   415
(*Used just once, in Client.ML.  Having F in the conclusion is silly.*)
paulson@5804
   416
Goalw [stable_def]
paulson@5804
   417
     "[| F : stable {s. P (v s) (w s)};   \
paulson@7878
   418
\        G : v localTo[UNIV] F;  G : w localTo[UNIV] F |]               \
paulson@5804
   419
\     ==> F Join G : stable {s. P (v s) (w s)}";
paulson@7878
   420
by (asm_simp_tac (simpset() addsimps [Join_constrains]) 1);
paulson@7878
   421
by (blast_tac (claset() addIs [constrains_localTo_constrains2 RS 
paulson@7878
   422
			       constrains_weaken]) 1);
paulson@5804
   423
qed "stable_localTo_stable2";
paulson@5804
   424
paulson@7878
   425
(*Used just in Client.ML.  Generalize to arbitrary C?*)
paulson@5804
   426
Goal "[| F : stable {s. v s <= w s};   \
paulson@7878
   427
\        G : v localTo[UNIV] F;       \
paulson@7826
   428
\        F Join G : Increasing w |]               \
paulson@5804
   429
\     ==> F Join G : Stable {s. v s <= w s}";
paulson@7826
   430
by (auto_tac (claset(), 
paulson@7826
   431
	      simpset() addsimps [stable_def, Stable_def, Increasing_def, 
paulson@7826
   432
		    Constrains_def, Join_constrains, all_conj_distrib]));
paulson@7826
   433
by (blast_tac (claset() addIs [constrains_weaken]) 1);
paulson@7826
   434
(*The G case remains; proved like constrains_localTo_constrains*)
paulson@7826
   435
by (auto_tac (claset(), 
paulson@7878
   436
              simpset() addsimps [LOCALTO_def, stable_def, constrains_def,
paulson@7878
   437
                                  Diff_def]));
paulson@7826
   438
by (case_tac "act: Acts F" 1);
paulson@7826
   439
by (Blast_tac 1);
paulson@7826
   440
by (thin_tac "ALL act:Acts F. ?P act" 1);
paulson@7826
   441
by (thin_tac "ALL z. ALL act:Acts F. ?P z act" 1);
paulson@7826
   442
by (dres_inst_tac [("x", "v xa")] spec 1 THEN dtac bspec 1 THEN rtac DiffI 1);
paulson@7826
   443
by (assume_tac 1);
paulson@7826
   444
by (Blast_tac 1);
paulson@7826
   445
by (subgoal_tac "v x = v xa" 1);
paulson@5804
   446
by Auto_tac;
paulson@5804
   447
qed "Increasing_localTo_Stable";