src/HOL/UNITY/Guar.ML
author wenzelm
Sat, 01 Sep 2001 00:14:16 +0200
changeset 11543 d61b913431c5
parent 11383 297625089e80
permissions -rw-r--r--
renamed `keep_derivs' to `proofs', and made an integer;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
     1
(*  Title:      HOL/UNITY/Guar.ML
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
     2
    ID:         $Id$
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
     4
    Copyright   1999  University of Cambridge
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
     5
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
     6
Guarantees, etc.
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
     7
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
     8
From Chandy and Sanders, "Reasoning About Program Composition"
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
     9
Revised by Sidi Ehmety on January 2001
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    10
*)
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    11
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    12
Goal "(OK (insert i I) F) = (if i:I then OK I F else OK I F & (F i ok JOIN I F))";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    13
by (auto_tac (claset() addIs [ok_sym], 
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    14
              simpset() addsimps [OK_iff_ok]));
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    15
qed "OK_insert_iff";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    16
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    17
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    18
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    19
(*** existential properties ***)
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    20
Goalw [ex_prop_def]
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    21
 "[| ex_prop X; finite GG |] ==> \
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    22
\    GG Int X ~= {}--> OK GG (%G. G) -->(JN G:GG. G) : X";
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    23
by (etac finite_induct 1);
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    24
by (auto_tac (claset(), simpset() addsimps [OK_insert_iff,Int_insert_left]));
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    25
qed_spec_mp "ex1";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    26
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    27
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    28
Goalw [ex_prop_def]
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    29
     "ALL GG. finite GG & GG Int X ~= {} --> OK GG (%G. G) -->(JN G:GG. G):X ==> ex_prop X";
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    30
by (Clarify_tac 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    31
by (dres_inst_tac [("x", "{F,G}")] spec 1);
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    32
by (auto_tac (claset() addDs [ok_sym], 
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    33
              simpset() addsimps [OK_iff_ok]));
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    34
qed "ex2";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    35
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    36
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    37
(*Chandy & Sanders take this as a definition*)
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    38
Goal "ex_prop X = (ALL GG. finite GG & GG Int X ~= {} & OK GG (%G. G)--> (JN G:GG. G) : X)";
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    39
by (blast_tac (claset() addIs [ex1,ex2]) 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    40
qed "ex_prop_finite";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    41
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    42
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    43
(*Their "equivalent definition" given at the end of section 3*)
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    44
Goal
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    45
 "ex_prop X = (ALL G. G:X = (ALL H. (G component_of H) --> H: X))";
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    46
by Auto_tac;
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    47
by (rewrite_goals_tac 
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    48
          [ex_prop_def, component_of_def]);
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    49
by Safe_tac;
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    50
by (stac Join_commute 3);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    51
by (dtac  ok_sym 3);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    52
by (REPEAT(Blast_tac 1));
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    53
qed "ex_prop_equiv";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    54
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    55
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    56
(*** universal properties ***)
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    57
Goalw [uv_prop_def]
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    58
     "[| uv_prop X; finite GG |] ==>  \
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    59
\  GG <= X & OK GG (%G. G) --> (JN G:GG. G) : X";
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    60
by (etac finite_induct 1);
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    61
by (auto_tac (claset(), simpset() addsimps 
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    62
           [Int_insert_left, OK_insert_iff]));
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    63
qed_spec_mp "uv1";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    64
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    65
Goalw [uv_prop_def]
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    66
     "ALL GG. finite GG & GG <= X & OK GG (%G. G)-->(JN G:GG. G):X  ==> uv_prop X";
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    67
by (rtac conjI 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    68
by (Clarify_tac 2);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    69
by (dres_inst_tac [("x", "{F,G}")] spec 2);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    70
by (dres_inst_tac [("x", "{}")] spec 1);
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    71
by (auto_tac (claset() addDs [ok_sym], simpset() addsimps [OK_iff_ok]));
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    72
qed "uv2";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    73
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    74
(*Chandy & Sanders take this as a definition*)
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
    75
Goal "uv_prop X = (ALL GG. finite GG & GG <= X & OK GG (%G. G)--> (JN G:GG. G): X)";
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    76
by (blast_tac (claset() addIs [uv1,uv2]) 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    77
qed "uv_prop_finite";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    78
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    79
(*** guarantees ***)
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    80
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    81
val prems = Goal
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
    82
     "(!!G. [| F ok G; F Join G : X |] ==> F Join G : Y) \
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
    83
\     ==> F : X guarantees Y";
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7947
diff changeset
    84
by (simp_tac (simpset() addsimps [guar_def, component_def]) 1);
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    85
by (blast_tac (claset() addIs prems) 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    86
qed "guaranteesI";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    87
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    88
Goalw [guar_def, component_def]
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
    89
     "[| F : X guarantees Y;  F ok G;  F Join G : X |] \
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7947
diff changeset
    90
\     ==> F Join G : Y";
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    91
by (Blast_tac 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    92
qed "guaranteesD";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    93
8065
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
    94
(*This version of guaranteesD matches more easily in the conclusion
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
    95
  The major premise can no longer be  F<=H since we need to reason about G*)
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    96
Goalw [guar_def]
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
    97
     "[| F : X guarantees Y;  F Join G = H;  H : X;  F ok G |] \
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7947
diff changeset
    98
\     ==> H : Y";
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
    99
by (Blast_tac 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   100
qed "component_guaranteesD";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   101
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   102
Goalw [guar_def]
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   103
     "[| F: X guarantees X'; Y <= X; X' <= Y' |] ==> F: Y guarantees Y'";
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   104
by (Blast_tac 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   105
qed "guarantees_weaken";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   106
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   107
Goalw [guar_def] "X <= Y ==> X guarantees Y = UNIV";
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   108
by (Blast_tac 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   109
qed "subset_imp_guarantees_UNIV";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   110
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   111
(*Equivalent to subset_imp_guarantees_UNIV but more intuitive*)
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   112
Goalw [guar_def] "X <= Y ==> F : X guarantees Y";
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   113
by (Blast_tac 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   114
qed "subset_imp_guarantees";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   115
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   116
(*Remark at end of section 4.1 *)
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   117
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   118
Goalw [guar_def] "ex_prop Y ==> (Y = UNIV guarantees Y)";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   119
by (full_simp_tac (simpset() addsimps [ex_prop_equiv]) 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   120
by Safe_tac;
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   121
by (dres_inst_tac [("x", "x")] spec 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   122
by (dres_inst_tac [("x", "x")] spec 2);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   123
by (dtac sym 2);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   124
by (ALLGOALS(etac iffE));
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   125
by (ALLGOALS(full_simp_tac (simpset() addsimps [component_of_def])));
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   126
by (REPEAT(Blast_tac 1));
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   127
qed "ex_prop_imp";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   128
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   129
Goalw [guar_def] "(Y = UNIV guarantees Y) ==> ex_prop(Y)";
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   130
by (simp_tac (simpset() addsimps [ex_prop_equiv]) 1);
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   131
by Safe_tac;
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   132
by (ALLGOALS(full_simp_tac (simpset() addsimps [component_of_def])));
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   133
by (dtac sym 2);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   134
by (ALLGOALS(etac equalityE));
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   135
by (REPEAT(Blast_tac 1));
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   136
qed "guarantees_imp";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   137
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   138
Goal "(ex_prop Y) = (Y = UNIV guarantees Y)";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   139
by (rtac iffI 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   140
by (rtac ex_prop_imp 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   141
by (rtac guarantees_imp 2);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   142
by (ALLGOALS(Asm_simp_tac));
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   143
qed "ex_prop_equiv2";
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   144
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   145
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   146
(** Distributive laws.  Re-orient to perform miniscoping **)
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   147
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   148
Goalw [guar_def]
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   149
     "(UN i:I. X i) guarantees Y = (INT i:I. X i guarantees Y)";
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   150
by (Blast_tac 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   151
qed "guarantees_UN_left";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   152
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   153
Goalw [guar_def]
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   154
     "(X Un Y) guarantees Z = (X guarantees Z) Int (Y guarantees Z)";
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   155
by (Blast_tac 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   156
qed "guarantees_Un_left";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   157
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   158
Goalw [guar_def]
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   159
     "X guarantees (INT i:I. Y i) = (INT i:I. X guarantees Y i)";
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   160
by (Blast_tac 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   161
qed "guarantees_INT_right";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   162
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   163
Goalw [guar_def]
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   164
     "Z guarantees (X Int Y) = (Z guarantees X) Int (Z guarantees Y)";
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   165
by (Blast_tac 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   166
qed "guarantees_Int_right";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   167
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   168
Goal "[| F : Z guarantees X;  F : Z guarantees Y |] \
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   169
\    ==> F : Z guarantees (X Int Y)";
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8122
diff changeset
   170
by (asm_simp_tac (simpset() addsimps [guarantees_Int_right]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8122
diff changeset
   171
qed "guarantees_Int_right_I";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8122
diff changeset
   172
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   173
Goal "(F : X guarantees (INTER I Y)) = \
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   174
\     (ALL i:I. F : X guarantees (Y i))";
8065
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
   175
by (simp_tac (simpset() addsimps [guarantees_INT_right]) 1);
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
   176
qed "guarantees_INT_right_iff";
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
   177
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   178
Goalw [guar_def] "(X guarantees Y) = (UNIV guarantees (-X Un Y))";
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   179
by (Blast_tac 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   180
qed "shunting";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   181
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   182
Goalw [guar_def] "(X guarantees Y) = -Y guarantees -X";
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   183
by (Blast_tac 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   184
qed "contrapositive";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   185
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   186
(** The following two can be expressed using intersection and subset, which
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   187
    is more faithful to the text but looks cryptic.
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   188
**)
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   189
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   190
Goalw [guar_def]
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   191
    "[| F : V guarantees X;  F : (X Int Y) guarantees Z |]\
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   192
\    ==> F : (V Int Y) guarantees Z";
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   193
by (Blast_tac 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   194
qed "combining1";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   195
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   196
Goalw [guar_def]
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   197
    "[| F : V guarantees (X Un Y);  F : Y guarantees Z |]\
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   198
\    ==> F : V guarantees (X Un Z)";
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   199
by (Blast_tac 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   200
qed "combining2";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   201
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   202
(** The following two follow Chandy-Sanders, but the use of object-quantifiers
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   203
    does not suit Isabelle... **)
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   204
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   205
(*Premise should be (!!i. i: I ==> F: X guarantees Y i) *)
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   206
Goalw [guar_def]
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   207
     "ALL i:I. F : X guarantees (Y i) ==> F : X guarantees (INT i:I. Y i)";
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   208
by (Blast_tac 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   209
qed "all_guarantees";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   210
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   211
(*Premises should be [| F: X guarantees Y i; i: I |] *)
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   212
Goalw [guar_def]
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   213
     "EX i:I. F : X guarantees (Y i) ==> F : X guarantees (UN i:I. Y i)";
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   214
by (Blast_tac 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   215
qed "ex_guarantees";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   216
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   217
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   218
(*** Additional guarantees laws, by lcp ***)
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   219
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   220
Goalw [guar_def]
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   221
    "[| F: U guarantees V;  G: X guarantees Y; F ok G |] \
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   222
\    ==> F Join G: (U Int X) guarantees (V Int Y)"; 
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7947
diff changeset
   223
by (Simp_tac 1);
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7947
diff changeset
   224
by Safe_tac;
8065
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
   225
by (asm_full_simp_tac (simpset() addsimps [Join_assoc]) 1);
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7947
diff changeset
   226
by (subgoal_tac "F Join G Join Ga = G Join (F Join Ga)" 1);
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   227
by (asm_full_simp_tac (simpset() addsimps [ok_commute]) 1); 
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7947
diff changeset
   228
by (asm_simp_tac (simpset() addsimps Join_ac) 1);
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   229
qed "guarantees_Join_Int";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   230
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   231
Goalw [guar_def]
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   232
    "[| F: U guarantees V;  G: X guarantees Y; F ok G |]  \
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   233
\    ==> F Join G: (U Un X) guarantees (V Un Y)";
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7947
diff changeset
   234
by (Simp_tac 1);
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7947
diff changeset
   235
by Safe_tac;
8065
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
   236
by (asm_full_simp_tac (simpset() addsimps [Join_assoc]) 1);
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7947
diff changeset
   237
by (subgoal_tac "F Join G Join Ga = G Join (F Join Ga)" 1);
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   238
by (asm_full_simp_tac (simpset() addsimps [ok_commute]) 1);
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7947
diff changeset
   239
by (asm_simp_tac (simpset() addsimps Join_ac) 1);
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   240
qed "guarantees_Join_Un";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   241
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   242
Goalw [guar_def]
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   243
     "[| ALL i:I. F i : X i guarantees Y i;  OK I F |] \
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   244
\     ==> (JOIN I F) : (INTER I X) guarantees (INTER I Y)";
9337
58bd51302b21 used bounded quantification in definition of guarantees and other minor
paulson
parents: 8251
diff changeset
   245
by Auto_tac;
58bd51302b21 used bounded quantification in definition of guarantees and other minor
paulson
parents: 8251
diff changeset
   246
by (ball_tac 1);
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   247
by (rename_tac "i" 1);
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   248
by (dres_inst_tac [("x", "JOIN (I-{i}) F Join G")] spec 1);
9337
58bd51302b21 used bounded quantification in definition of guarantees and other minor
paulson
parents: 8251
diff changeset
   249
by (auto_tac
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   250
    (claset() addIs [OK_imp_ok],
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   251
     simpset() addsimps [Join_assoc RS sym, JN_Join_diff, JN_absorb]));
9337
58bd51302b21 used bounded quantification in definition of guarantees and other minor
paulson
parents: 8251
diff changeset
   252
qed "guarantees_JN_INT";
58bd51302b21 used bounded quantification in definition of guarantees and other minor
paulson
parents: 8251
diff changeset
   253
58bd51302b21 used bounded quantification in definition of guarantees and other minor
paulson
parents: 8251
diff changeset
   254
Goalw [guar_def]
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   255
    "[| ALL i:I. F i : X i guarantees Y i;  OK I F |] \
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   256
\    ==> (JOIN I F) : (UNION I X) guarantees (UNION I Y)";
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7947
diff changeset
   257
by Auto_tac;
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7947
diff changeset
   258
by (ball_tac 1);
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   259
by (rename_tac "i" 1);
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   260
by (dres_inst_tac [("x", "JOIN (I-{i}) F Join G")] spec 1);
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7947
diff changeset
   261
by (auto_tac
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   262
    (claset() addIs [OK_imp_ok],
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   263
     simpset() addsimps [Join_assoc RS sym, JN_Join_diff, JN_absorb]));
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7947
diff changeset
   264
qed "guarantees_JN_UN";
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   265
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   266
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   267
(*** guarantees laws for breaking down the program, by lcp ***)
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   268
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   269
Goalw [guar_def]
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   270
     "[| F: X guarantees Y;  F ok G |] ==> F Join G: X guarantees Y";
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7947
diff changeset
   271
by (Simp_tac 1);
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7947
diff changeset
   272
by Safe_tac;
8065
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
   273
by (asm_full_simp_tac (simpset() addsimps [Join_assoc]) 1);
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7947
diff changeset
   274
qed "guarantees_Join_I1";
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   275
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   276
Goal "[| G: X guarantees Y;  F ok G |] ==> F Join G: X guarantees Y";
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   277
by (asm_full_simp_tac (simpset() addsimps [inst "G" "G" Join_commute, 
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   278
                                           inst "G" "G" ok_commute]) 1);
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7947
diff changeset
   279
by (blast_tac (claset() addIs [guarantees_Join_I1]) 1);
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7947
diff changeset
   280
qed "guarantees_Join_I2";
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7537
diff changeset
   281
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   282
Goalw [guar_def]
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   283
     "[| i : I;  F i: X guarantees Y;  OK I F |] \
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   284
\     ==> (JN i:I. (F i)) : X guarantees Y";
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 7947
diff changeset
   285
by (Clarify_tac 1);
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   286
by (dres_inst_tac [("x", "JOIN (I-{i}) F Join G")] spec 1);
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   287
by (auto_tac (claset() addIs [OK_imp_ok],
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 9337
diff changeset
   288
	      simpset() addsimps [JN_Join_diff, JN_Join_diff, Join_assoc RS sym]));
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   289
qed "guarantees_JN_I";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   290
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   291
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   292
(*** well-definedness ***)
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   293
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   294
Goalw [welldef_def] "F Join G: welldef ==> F: welldef";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   295
by Auto_tac;
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   296
qed "Join_welldef_D1";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   297
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   298
Goalw [welldef_def] "F Join G: welldef ==> G: welldef";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   299
by Auto_tac;
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   300
qed "Join_welldef_D2";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   301
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   302
(*** refinement ***)
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   303
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   304
Goalw [refines_def] "F refines F wrt X";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   305
by (Blast_tac 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   306
qed "refines_refl";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   307
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   308
(* Goalw [refines_def]
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   309
     "[| H refines G wrt X;  G refines F wrt X |] ==> H refines F wrt X"; 
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   310
by Auto_tac;
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   311
qed "refines_trans"; *)
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   312
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   313
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   314
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   315
Goalw [strict_ex_prop_def]
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   316
     "strict_ex_prop X \
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   317
\     ==> (ALL H. F ok H & G ok H & F Join H : X --> G Join H : X) \
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   318
\             = (F:X --> G:X)";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   319
by Auto_tac;
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   320
qed "strict_ex_refine_lemma";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   321
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   322
Goalw [strict_ex_prop_def]
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   323
     "strict_ex_prop X \
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   324
\     ==> (ALL H. F ok H & G ok H & F Join H : welldef & F Join H : X --> G Join H : X) = \
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   325
\         (F: welldef Int X --> G:X)";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   326
by Safe_tac;
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   327
by (eres_inst_tac [("x","SKIP"), ("P", "%H. ?PP H --> ?RR H")] allE 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   328
by (auto_tac (claset() addDs [Join_welldef_D1, Join_welldef_D2], simpset()));
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   329
qed "strict_ex_refine_lemma_v";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   330
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   331
Goal "[| strict_ex_prop X;  \
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   332
\        ALL H. F ok H & G ok H & F Join H : welldef Int X --> G Join H : welldef |] \
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   333
\     ==> (G refines F wrt X) = (G iso_refines F wrt X)";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   334
by (res_inst_tac [("x","SKIP")] allE 1
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   335
    THEN assume_tac 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   336
by (asm_full_simp_tac
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   337
    (simpset() addsimps [refines_def, iso_refines_def,
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   338
			 strict_ex_refine_lemma_v]) 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   339
qed "ex_refinement_thm";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   340
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   341
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   342
Goalw [strict_uv_prop_def]
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   343
     "strict_uv_prop X \
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   344
\     ==> (ALL H. F ok H & G ok H & F Join H : X --> G Join H : X) = (F:X --> G:X)";
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   345
by (Blast_tac 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   346
qed "strict_uv_refine_lemma";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   347
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   348
Goalw [strict_uv_prop_def]
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   349
     "strict_uv_prop X \
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   350
\     ==> (ALL H. F ok H & G ok H & F Join H : welldef & F Join H : X --> G Join H : X) = \
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   351
\         (F: welldef Int X --> G:X)";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   352
by Safe_tac;
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   353
by (eres_inst_tac [("x","SKIP"), ("P", "%H. ?PP H --> ?RR H")] allE 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   354
by (auto_tac (claset() addDs [Join_welldef_D1, Join_welldef_D2],
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   355
	      simpset()));
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   356
qed "strict_uv_refine_lemma_v";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   357
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   358
Goal "[| strict_uv_prop X;  \
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   359
\        ALL H. F ok H & G ok H & F Join H : welldef Int X --> G Join H : welldef |] \
7400
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   360
\     ==> (G refines F wrt X) = (G iso_refines F wrt X)";
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   361
by (res_inst_tac [("x","SKIP")] allE 1
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   362
    THEN assume_tac 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   363
by (asm_full_simp_tac (simpset() addsimps [refines_def, iso_refines_def,
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   364
					   strict_uv_refine_lemma_v]) 1);
fbd5582761e6 new files HOL/UNITY/Guar.{thy,ML}: theory file gets the instance declaration
paulson
parents:
diff changeset
   365
qed "uv_refinement_thm";
11190
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   366
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   367
(* Added by Sidi Ehmety from Chandy & Sander, section 6 *)
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   368
Goalw [guar_def, component_of_def]
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   369
"(F:X guarantees Y) = (ALL H. H:X \\<longrightarrow> (F component_of H \\<longrightarrow> H:Y))";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   370
by Auto_tac;
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   371
qed "guarantees_equiv";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   372
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   373
Goalw [wg_def] "!!X. F:(X guarantees Y) ==> X <= (wg F Y)";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   374
by Auto_tac;
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   375
qed "wg_weakest";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   376
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   377
Goalw [wg_def, guar_def] "F:((wg F Y) guarantees Y)";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   378
by (Blast_tac 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   379
qed "wg_guarantees";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   380
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   381
Goalw [wg_def]
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   382
  "(H: wg F X) = (F component_of H --> H:X)";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   383
by (simp_tac (simpset() addsimps [guarantees_equiv]) 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   384
by (rtac iffI 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   385
by (res_inst_tac [("x", "{H}")] exI 2);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   386
by (REPEAT(Blast_tac 1));
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   387
qed "wg_equiv";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   388
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   389
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   390
Goal
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   391
"F component_of H ==> (H:wg F X) = (H:X)";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   392
by (asm_simp_tac (simpset() addsimps [wg_equiv]) 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   393
qed "component_of_wg";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   394
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   395
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   396
Goal
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   397
"ALL FF. finite FF & FF Int X ~= {} --> OK FF (%F. F) \
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   398
\  --> (ALL F:FF. ((JN F:FF. F): wg F X) = ((JN F:FF. F):X))";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   399
by (Clarify_tac 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   400
by (subgoal_tac "F component_of (JN F:FF. F)" 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   401
by (dres_inst_tac [("X", "X")] component_of_wg 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   402
by (Asm_full_simp_tac 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   403
by (asm_full_simp_tac (simpset() addsimps [component_of_def]) 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   404
by (res_inst_tac [("x", "JN F:(FF-{F}). F")] exI 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   405
by (auto_tac (claset() addIs [JN_Join_diff] addDs [ok_sym], 
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   406
              simpset() addsimps [OK_iff_ok]));
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   407
qed "wg_finite";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   408
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   409
Goal "ex_prop X ==> (F:X) = (ALL H. H : wg F X)";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   410
by (full_simp_tac (simpset() addsimps [ex_prop_equiv, wg_equiv]) 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   411
by (Blast_tac 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   412
qed "wg_ex_prop";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   413
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   414
(** From Charpentier and Chandy "Theorems About Composition" **)
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   415
(* Proposition 2 *)
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   416
Goalw [wx_def] "(wx X)<=X";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   417
by Auto_tac;
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   418
qed "wx_subset";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   419
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   420
Goalw [wx_def]
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   421
"ex_prop (wx X)";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   422
by (simp_tac (simpset() addsimps [ex_prop_equiv]) 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   423
by Safe_tac;
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   424
by (Blast_tac 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   425
by Auto_tac;
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   426
qed "wx_ex_prop";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   427
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   428
Goalw [wx_def]
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   429
"ALL Z. Z<= X --> ex_prop Z --> Z <= wx X";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   430
by Auto_tac;
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   431
qed "wx_weakest";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   432
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   433
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   434
(* Proposition 6 *)
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   435
Goalw [ex_prop_def]
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   436
 "ex_prop({F. ALL G. F ok G --> F Join G:X})";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   437
by Safe_tac;
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   438
by (dres_inst_tac [("x", "G Join Ga")] spec 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   439
by (force_tac (claset(), simpset() addsimps [ok_Join_iff1, Join_assoc]) 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   440
by (dres_inst_tac [("x", "F Join Ga")] spec 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   441
by (full_simp_tac (simpset() addsimps [ok_Join_iff1]) 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   442
by Safe_tac;
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   443
by (asm_simp_tac (simpset() addsimps [ok_commute]) 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   444
by (subgoal_tac "F Join G = G Join F" 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   445
by (asm_simp_tac (simpset() addsimps [Join_assoc]) 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   446
by (simp_tac (simpset() addsimps [Join_commute]) 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   447
qed "wx'_ex_prop";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   448
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   449
(* Equivalence with the other definition of wx *)
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   450
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   451
Goalw [wx_def]
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   452
 "wx X = {F. ALL G. F ok G --> (F Join G):X}";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   453
by Safe_tac;
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   454
by (full_simp_tac (simpset() addsimps [ex_prop_def]) 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   455
by (dres_inst_tac [("x", "x")] spec 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   456
by (dres_inst_tac [("x", "G")] spec 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   457
by (forw_inst_tac [("c", "x Join G")] subsetD 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   458
by Safe_tac;
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   459
by (Simp_tac 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   460
by (res_inst_tac [("x", "{F. ALL G. F ok G --> F Join G:X}")] exI 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   461
by Safe_tac;
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   462
by (rtac wx'_ex_prop 2);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   463
by (rotate_tac 1 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   464
by (dres_inst_tac [("x", "SKIP")] spec 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   465
by Auto_tac;
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   466
qed "wx_equiv";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   467
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   468
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   469
(* Propositions 7 to 11 are about this second definition of wx. And
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   470
   they are the same as the ones proved for the first definition of wx by equivalence *)
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   471
   
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   472
(* Proposition 12 *)
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   473
(* Main result of the paper *)
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   474
Goalw [guar_def] 
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   475
   "(X guarantees Y) = wx(-X Un Y)";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   476
by (simp_tac (simpset() addsimps [wx_equiv]) 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   477
qed "guarantees_wx_eq";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   478
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   479
(* {* Corollary, but this result has already been proved elsewhere *}
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   480
 "ex_prop(X guarantees Y)";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   481
  by (simp_tac (simpset() addsimps [guar_wx_iff, wx_ex_prop]) 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   482
  qed "guarantees_ex_prop";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   483
*)
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   484
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   485
(* Rules given in section 7 of Chandy and Sander's
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   486
    Reasoning About Program composition paper *)
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   487
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   488
Goal "Init F <= A ==> F:(stable A) guarantees (Always A)";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   489
by (rtac guaranteesI 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   490
by (simp_tac (simpset() addsimps [Join_commute]) 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   491
by (rtac stable_Join_Always1 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   492
by (ALLGOALS(asm_full_simp_tac (simpset() 
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   493
     addsimps [invariant_def, Join_stable])));
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   494
qed "stable_guarantees_Always";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   495
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   496
(* To be moved to WFair.ML *)
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   497
Goal "[| F:A co A Un B; F:transient A |] ==> F:A leadsTo B";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   498
by (dres_inst_tac [("B", "A-B")] constrains_weaken_L 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   499
by (dres_inst_tac [("B", "A-B")] transient_strengthen 2);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   500
by (rtac (ensuresI RS leadsTo_Basis) 3);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   501
by (ALLGOALS(Blast_tac));
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   502
qed "leadsTo_Basis'";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   503
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   504
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   505
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   506
Goal "F:transient A ==> F: (A co A Un B) guarantees (A leadsTo (B-A))";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   507
by (rtac guaranteesI 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   508
by (rtac leadsTo_Basis' 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   509
by (dtac constrains_weaken_R 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   510
by (assume_tac 2);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   511
by (Blast_tac 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   512
by (blast_tac (claset() addIs [Join_transient_I1]) 1);
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   513
qed "constrains_guarantees_leadsTo";
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   514
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   515
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   516
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   517
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   518
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   519
44e157622cb2 *** empty log message ***
ehmety
parents: 10064
diff changeset
   520