src/ZF/UNITY/Union.ML
author wenzelm
Tue, 11 Dec 2001 16:00:26 +0100
changeset 12466 5f4182667032
parent 12220 9dc4e8fec63d
child 12484 7ad150f5fc10
permissions -rw-r--r--
added HOL-Library;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     1
(*  Title:      ZF/UNITY/Union.ML
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     2
    ID:         $Id$
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     3
    Author:     Sidi O Ehmety, Computer Laboratory
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     4
    Copyright   2001  University of Cambridge
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     5
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     6
Unions of programs
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     7
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     8
From Misra's Chapter 5: Asynchronous Compositions of Programs
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     9
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    10
Proofs ported from HOL.
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    11
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    12
*)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    13
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    14
(** SKIP **)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    15
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    16
Goal "reachable(SKIP) = state";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    17
by (force_tac (claset() addEs [reachable.induct]
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    18
                        addIs reachable.intrs, simpset()) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    19
qed "reachable_SKIP";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    20
AddIffs [reachable_SKIP];
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    21
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    22
(* Elimination programify from ok and Join *)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    23
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    24
Goal "programify(F) ok G <-> F ok G";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    25
by (simp_tac (simpset() addsimps [ok_def]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    26
qed "ok_programify_left";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    27
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    28
Goal "F ok programify(G) <-> F ok G";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    29
by (simp_tac (simpset() addsimps [ok_def]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    30
qed "ok_programify_right";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    31
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    32
Goal "programify(F) Join G = F Join G";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    33
by (simp_tac (simpset() addsimps [Join_def]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    34
qed "Join_programify_left";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    35
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    36
Goal "F Join programify(G) = F Join G";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    37
by (simp_tac (simpset() addsimps [Join_def]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    38
qed "Join_programify_right";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    39
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    40
AddIffs [ok_programify_left, ok_programify_right, 
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    41
          Join_programify_left, Join_programify_right];
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    42
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    43
(** SKIP and safety properties **)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    44
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    45
Goalw [constrains_def, st_set_def] 
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    46
"(SKIP: A co B) <-> (A<=B & st_set(A))";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    47
by Auto_tac;
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    48
qed "SKIP_in_constrains_iff";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    49
AddIffs [SKIP_in_constrains_iff];
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    50
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    51
Goalw [Constrains_def]"(SKIP : A Co B)<-> (state Int A<=B)";
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    52
by Auto_tac;
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    53
qed "SKIP_in_Constrains_iff";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    54
AddIffs [SKIP_in_Constrains_iff];
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    55
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    56
Goal "SKIP:stable(A) <-> st_set(A)";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    57
by (auto_tac (claset(), 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    58
    simpset() addsimps [stable_def]));
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    59
qed "SKIP_in_stable";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    60
AddIffs [SKIP_in_stable];
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    61
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    62
Goalw [Stable_def] "SKIP:Stable(A)";
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    63
by Auto_tac;
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    64
qed "SKIP_in_Stable";
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    65
AddIffs [SKIP_in_Stable];
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    66
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    67
(** Join and JOIN types **)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    68
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    69
Goalw [Join_def]  "F Join G : program";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    70
by Auto_tac;
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    71
qed "Join_in_program";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    72
AddIffs [Join_in_program];
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    73
AddTCs [Join_in_program];
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    74
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    75
Goalw [JOIN_def] "JOIN(I,F):program";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    76
by Auto_tac;
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    77
qed "JOIN_in_program";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    78
AddIffs [JOIN_in_program];
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    79
AddTCs [JOIN_in_program];
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    80
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    81
(* Init, Acts, and AllowedActs of Join and JOIN *)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    82
Goal "Init(F Join G) = Init(F) Int Init(G)";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    83
by (simp_tac (simpset() 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    84
         addsimps [Int_assoc, Join_def]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    85
qed "Init_Join";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    86
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    87
Goal "Acts(F Join G) = Acts(F) Un Acts(G)";
12220
9dc4e8fec63d last-minute tidying
paulson
parents: 12215
diff changeset
    88
by (simp_tac (simpset() addsimps [Int_Un_distrib2, cons_absorb, Join_def]) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    89
qed "Acts_Join";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    90
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    91
Goal "AllowedActs(F Join G) = \
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    92
\ AllowedActs(F) Int AllowedActs(G)";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    93
by (simp_tac (simpset() 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    94
     addsimps [Int_assoc,cons_absorb,Join_def]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    95
qed "AllowedActs_Join";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    96
Addsimps [Init_Join, Acts_Join, AllowedActs_Join];
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    97
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    98
(** Join's algebraic laws **)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    99
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   100
Goal "F Join G = G Join F";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   101
by (simp_tac (simpset() addsimps 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   102
     [Join_def, Un_commute, Int_commute]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   103
qed "Join_commute";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   104
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   105
Goal "A Join (B Join C) = B Join (A Join C)";
12220
9dc4e8fec63d last-minute tidying
paulson
parents: 12215
diff changeset
   106
by (asm_simp_tac (simpset() addsimps 
9dc4e8fec63d last-minute tidying
paulson
parents: 12215
diff changeset
   107
     Un_ac@Int_ac@[Join_def,Int_Un_distrib2, cons_absorb]) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   108
qed "Join_left_commute";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   109
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   110
Goal "(F Join G) Join H = F Join (G Join H)";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   111
by (asm_simp_tac (simpset() addsimps 
12215
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   112
          Un_ac@[Join_def, cons_absorb, Int_assoc, Int_Un_distrib2]) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   113
qed "Join_assoc";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   114
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   115
(* Needed below *)
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   116
Goal "cons(id(state), Pow(state * state)) = Pow(state*state)";
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   117
by Auto_tac;
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   118
qed "cons_id";
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   119
AddIffs [cons_id];
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   120
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   121
Goalw [Join_def, SKIP_def] 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   122
    "SKIP Join F = programify(F)";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   123
by (auto_tac (claset(), simpset() addsimps [Int_absorb,cons_eq]));
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   124
qed "Join_SKIP_left";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   125
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   126
Goal  "F Join SKIP =  programify(F)";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   127
by (stac Join_commute 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   128
by (asm_simp_tac (simpset() addsimps [Join_SKIP_left]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   129
qed "Join_SKIP_right";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   130
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   131
AddIffs [Join_SKIP_left, Join_SKIP_right];
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   132
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   133
Goal "F Join F = programify(F)";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   134
by (rtac program_equalityI 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   135
by Auto_tac;
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   136
qed "Join_absorb";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   137
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   138
Addsimps [Join_absorb];
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   139
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   140
Goal "F Join (F Join G) = F Join G";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   141
by (asm_simp_tac (simpset() addsimps [Join_assoc RS sym]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   142
qed "Join_left_absorb";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   143
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   144
(*Join is an AC-operator*)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   145
val Join_ac = [Join_assoc, Join_left_absorb, Join_commute, Join_left_commute];
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   146
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   147
(** Eliminating programify form JN and OK expressions **)
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   148
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   149
Goal "OK(I, %x. programify(F(x))) <-> OK(I, F)";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   150
by (simp_tac (simpset() addsimps [OK_def]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   151
qed "OK_programify";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   152
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   153
Goal "JOIN(I, %x. programify(F(x))) = JOIN(I, F)";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   154
by (simp_tac (simpset() addsimps [JOIN_def]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   155
qed "JN_programify";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   156
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   157
AddIffs [OK_programify, JN_programify];
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   158
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   159
(* JN *)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   160
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   161
Goalw [JOIN_def] "JOIN(0, F) = SKIP";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   162
by Auto_tac;
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   163
qed "JN_empty";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   164
AddIffs [JN_empty];
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   165
AddSEs [not_emptyE];
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   166
Addsimps [Inter_0];
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   167
12220
9dc4e8fec63d last-minute tidying
paulson
parents: 12215
diff changeset
   168
Goal "Init(JN i:I. F(i)) = (if I=0 then state else (INT i:I. Init(F(i))))";
9dc4e8fec63d last-minute tidying
paulson
parents: 12215
diff changeset
   169
by (simp_tac (simpset() addsimps [JOIN_def]) 1);
12215
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   170
by (auto_tac (claset(), simpset() addsimps [INT_Int_distrib]));
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   171
qed "Init_JN";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   172
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   173
Goalw [JOIN_def]
12220
9dc4e8fec63d last-minute tidying
paulson
parents: 12215
diff changeset
   174
     "Acts(JOIN(I,F)) = cons(id(state), UN i:I.  Acts(F(i)))";
12215
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   175
by (auto_tac (claset(), simpset() delsimps (INT_simps@UN_simps)));
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   176
by (rtac equalityI 1);
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   177
by (auto_tac (claset() addDs [Acts_type RS subsetD], simpset()));
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   178
qed "Acts_JN";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   179
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   180
Goalw [JOIN_def]
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   181
"AllowedActs(JN i:I. F(i)) = (if I=0 then Pow(state*state) else (INT i:I. AllowedActs(F(i))))";
12215
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   182
by Auto_tac;
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   183
by (rtac equalityI 1);
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   184
by (auto_tac (claset() addDs [AllowedActs_type RS subsetD], simpset()));
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   185
qed "AllowedActs_JN";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   186
AddIffs [Init_JN, Acts_JN, AllowedActs_JN];
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   187
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   188
Goal "(JN i:cons(a,I). F(i)) = F(a) Join (JN i:I. F(i))";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   189
by (rtac program_equalityI 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   190
by Auto_tac;
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   191
qed "JN_cons";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   192
AddIffs[JN_cons];
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   193
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   194
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   195
val prems = Goalw [JOIN_def]
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   196
    "[| I=J;  !!i. i:J ==> F(i) = G(i) |] ==> \
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   197
\    (JN i:I. F(i)) = (JN i:J. G(i))";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   198
by (asm_simp_tac (simpset() addsimps prems) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   199
qed "JN_cong";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   200
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   201
Addcongs [JN_cong];
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   202
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   203
(*** JN laws ***)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   204
Goal "k:I ==>F(k) Join (JN i:I. F(i)) = (JN i:I. F(i))";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   205
by (stac (JN_cons RS sym) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   206
by (auto_tac (claset(), 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   207
           simpset() addsimps [cons_absorb]));
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   208
qed "JN_absorb";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   209
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   210
Goal "(JN i: I Un J. F(i)) = ((JN i: I. F(i)) Join (JN i:J. F(i)))";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   211
by (rtac program_equalityI 1);
12220
9dc4e8fec63d last-minute tidying
paulson
parents: 12215
diff changeset
   212
by (ALLGOALS(asm_full_simp_tac (simpset() addsimps [UN_Un,INT_Un])));
9dc4e8fec63d last-minute tidying
paulson
parents: 12215
diff changeset
   213
by (ALLGOALS(asm_full_simp_tac (simpset() delsimps INT_simps
9dc4e8fec63d last-minute tidying
paulson
parents: 12215
diff changeset
   214
		                          addsimps INT_extend_simps)));
9dc4e8fec63d last-minute tidying
paulson
parents: 12215
diff changeset
   215
by (Blast_tac 1); 
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   216
qed "JN_Un";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   217
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   218
Goal "(JN i:I. c) = (if I=0 then SKIP else programify(c))";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   219
by (rtac program_equalityI 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   220
by Auto_tac;
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   221
qed "JN_constant";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   222
12220
9dc4e8fec63d last-minute tidying
paulson
parents: 12215
diff changeset
   223
Goal "(JN i:I. F(i) Join G(i)) = (JN i:I. F(i))  Join  (JN i:I. G(i))";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   224
by (rtac program_equalityI 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   225
by (ALLGOALS(simp_tac (simpset() addsimps [Int_absorb])));
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   226
by Safe_tac;
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   227
by (ALLGOALS(asm_full_simp_tac (simpset() addsimps 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   228
              [INT_Int_distrib, Int_absorb])));
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   229
by (Force_tac 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   230
qed "JN_Join_distrib";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   231
12220
9dc4e8fec63d last-minute tidying
paulson
parents: 12215
diff changeset
   232
Goal "(JN i:I. F(i) Join G) = ((JN i:I. F(i) Join G))";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   233
by (asm_simp_tac (simpset() 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   234
    addsimps [JN_Join_distrib, JN_constant]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   235
qed "JN_Join_miniscope";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   236
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   237
(*Used to prove guarantees_JN_I*)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   238
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   239
Goal "i:I==>F(i) Join JOIN(I - {i}, F) = JOIN(I, F)";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   240
by (rtac program_equalityI 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   241
by Auto_tac;
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   242
qed "JN_Join_diff";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   243
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   244
(*** Safety: co, stable, FP ***)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   245
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   246
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   247
(*Fails if I=0 because it collapses to SKIP : A co B, i.e. to A<=B.  So an
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   248
  alternative precondition is A<=B, but most proofs using this rule require
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   249
  I to be nonempty for other reasons anyway.*)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   250
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   251
Goalw [constrains_def, JOIN_def,st_set_def]
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   252
 "i:I==>(JN i:I. F(i)):A co B <-> (ALL i:I. programify(F(i)):A co B)";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   253
by Auto_tac;
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   254
by (cut_inst_tac [("F","F(xa)")] Acts_type 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   255
by (Blast_tac 2);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   256
by (dres_inst_tac [("x", "xb")] bspec 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   257
by Auto_tac;
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   258
qed "JN_constrains";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   259
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   260
Goal "(F Join G : A co B) <-> (programify(F):A co B & programify(G):A co B)";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   261
by (auto_tac
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   262
    (claset(), simpset() addsimps [constrains_def]));
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   263
qed "Join_constrains";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   264
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   265
Goal "(F Join G : A unless B) <-> \
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   266
\   (programify(F) : A unless B & programify(G):A unless B)";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   267
by (asm_simp_tac (simpset() addsimps [Join_constrains, unless_def]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   268
qed "Join_unless";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   269
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   270
AddIffs [Join_constrains, Join_unless];
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   271
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   272
(*Analogous weak versions FAIL; see Misra [1994] 5.4.1, Substitution Axiom.
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   273
  reachable (F Join G) could be much bigger than reachable F, reachable G
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   274
*)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   275
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   276
Goal "[| F : A co A';  G:B co B' |] \
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   277
\     ==> F Join G : (A Int B) co (A' Un B')";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   278
by (subgoal_tac "st_set(A) & st_set(B) & F:program & G:program" 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   279
by (blast_tac (claset()  addDs [constrainsD2]) 2);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   280
by (Asm_simp_tac 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   281
by (blast_tac (claset() addIs [constrains_weaken]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   282
qed "Join_constrains_weaken";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   283
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   284
(*If I=0, it degenerates to SKIP : state co 0, which is false.*)
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   285
val [major, minor] = Goal 
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   286
"[| (!!i. i:I ==> F(i) : A(i) co A'(i));  i: I |] \
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   287
\     ==> (JN i:I. F(i)) : (INT i:I. A(i)) co (UN i:I. A'(i))";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   288
by (cut_facts_tac [minor] 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   289
by (asm_simp_tac (simpset() addsimps [JN_constrains]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   290
by (Clarify_tac 1);
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   291
by (forw_inst_tac [("i", "x")] major 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   292
by (forward_tac [constrainsD2] 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   293
by (Asm_full_simp_tac 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   294
by (blast_tac (claset() addIs [constrains_weaken]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   295
qed "JN_constrains_weaken";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   296
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   297
Goal "(JN i:I. F(i)): stable(A) <-> ((ALL i:I. programify(F(i)):stable(A)) & st_set(A))";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   298
by (asm_simp_tac 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   299
    (simpset() addsimps [stable_def, constrains_def, JOIN_def]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   300
by Auto_tac;
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   301
by (cut_inst_tac [("F", "F(xa)")] Acts_type 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   302
by (dres_inst_tac [("x","xb")] bspec 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   303
by Auto_tac;
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   304
qed "JN_stable";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   305
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   306
val [major, minor] = Goalw [initially_def]
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   307
 "[| (!!i. i:I ==>F(i):initially(A)); i:I |] ==> (JN i:I. F(i)):initially(A)";
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   308
by (cut_facts_tac [minor] 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   309
by (Asm_full_simp_tac 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   310
by Safe_tac;
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   311
by (asm_full_simp_tac (simpset() addsimps [Inter_iff]) 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   312
by (forw_inst_tac [("i", "x")] major 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   313
by Auto_tac;
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   314
qed "initially_JN_I";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   315
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   316
val [major, minor] = Goal 
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   317
"[|(!!i. i:I ==> F(i) : invariant(A)); i:I|]==> (JN i:I. F(i)):invariant(A)";
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   318
by (cut_facts_tac [minor] 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   319
by (auto_tac (claset() addSIs [initially_JN_I] addDs [major], 
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   320
              simpset() addsimps [invariant_def, JN_stable]));
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   321
by (thin_tac "i:I" 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   322
by (forward_tac [major] 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   323
by (dtac major 2);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   324
by (auto_tac (claset(), simpset() addsimps [invariant_def]));
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   325
by (ALLGOALS(forward_tac [stableD2]));
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   326
by Auto_tac;
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   327
qed "invariant_JN_I";
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   328
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   329
Goal " (F Join G : stable(A)) <->  \
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   330
\     (programify(F) : stable(A) & programify(G): stable(A))";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   331
by (asm_simp_tac (simpset() addsimps [stable_def]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   332
qed "Join_stable";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   333
AddIffs [Join_stable];
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   334
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   335
Goalw [initially_def] "[| F:initially(A); G:initially(A) |] ==> F Join G: initially(A)";
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   336
by Auto_tac;
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   337
qed "initially_JoinI";
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   338
AddSIs [initially_JoinI];
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   339
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   340
Goal "[| F : invariant(A); G : invariant(A) |]  \
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   341
\     ==> F Join G : invariant(A)";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   342
by (subgoal_tac "F:program&G:program" 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   343
by (blast_tac (claset() addDs [invariantD2]) 2);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   344
by (full_simp_tac (simpset() addsimps [invariant_def]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   345
by (auto_tac (claset() addIs [Join_in_program], simpset()));
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   346
qed "invariant_JoinI";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   347
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   348
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   349
(* Fails if I=0 because INT i:0. A(i) = 0 *)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   350
Goal "i:I ==> FP(JN i:I. F(i)) = (INT i:I. FP (programify(F(i))))";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   351
by (asm_simp_tac (simpset() addsimps [FP_def, Inter_def]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   352
by (rtac equalityI 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   353
by Safe_tac;
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   354
by (ALLGOALS(subgoal_tac "st_set({x})"));
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   355
by (rotate_tac ~1 3);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   356
by (rotate_tac ~1 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   357
by (ALLGOALS(asm_full_simp_tac (simpset() addsimps [JN_stable])));
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   358
by (rewrite_goals_tac [st_set_def]);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   359
by (REPEAT(Blast_tac 1));
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   360
qed "FP_JN";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   361
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   362
(*** Progress: transient, ensures ***)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   363
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   364
Goal "i:I==>(JN i:I. F(i)) : transient(A) <-> \
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   365
\  (EX i:I. programify(F(i)) : transient(A))";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   366
by (auto_tac (claset(),
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   367
              simpset() addsimps [transient_def, JOIN_def]));
12215
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   368
by (rewrite_goals_tac [st_set_def]);
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   369
by (dres_inst_tac [("x", "xb")] bspec 2);
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   370
by (auto_tac (claset() addDs [Acts_type RS subsetD], simpset()));
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   371
qed "JN_transient";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   372
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   373
Goal "F Join G : transient(A) <-> \
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   374
\     (programify(F) : transient(A) | programify(G):transient(A))";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   375
by (auto_tac (claset(),
12220
9dc4e8fec63d last-minute tidying
paulson
parents: 12215
diff changeset
   376
              simpset() addsimps [transient_def, Join_def, Int_Un_distrib2]));
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   377
qed "Join_transient";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   378
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   379
AddIffs [Join_transient];
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   380
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   381
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   382
Goal "F : transient(A) ==> F Join G : transient(A)";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   383
by (asm_full_simp_tac (simpset() 
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   384
           addsimps [Join_transient, transientD2]) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   385
qed "Join_transient_I1";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   386
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   387
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   388
Goal "G : transient(A) ==> F Join G : transient(A)";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   389
by (asm_full_simp_tac (simpset() 
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   390
           addsimps [Join_transient, transientD2]) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   391
qed "Join_transient_I2";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   392
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   393
(*If I=0 it degenerates to (SKIP : A ensures B) = False, i.e. to ~(A<=B) *)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   394
Goal "i : I ==> \
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   395
\     (JN i:I. F(i)) : A ensures B <-> \
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   396
\     ((ALL i:I. programify(F(i)) : (A-B) co (A Un B)) &  \
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   397
\     (EX i:I. programify(F(i)) : A ensures B))";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   398
by (auto_tac (claset(),
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   399
              simpset() addsimps [ensures_def, JN_constrains, JN_transient]));
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   400
qed "JN_ensures";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   401
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   402
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   403
Goalw [ensures_def]
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   404
     "F Join G : A ensures B  <->     \
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   405
\     (programify(F) : (A-B) co (A Un B) & programify(G) : (A-B) co (A Un B) & \
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   406
\      (programify(F): transient (A-B) | programify(G) : transient (A-B)))";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   407
by (auto_tac (claset(), simpset() addsimps [Join_transient]));
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   408
qed "Join_ensures";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   409
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   410
Goalw [stable_def, constrains_def, Join_def, st_set_def]
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   411
    "[| F : stable(A);  G : A co A' |] \
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   412
\    ==> F Join G : A co A'";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   413
by (cut_inst_tac [("F", "F")] Acts_type 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   414
by (cut_inst_tac [("F", "G")] Acts_type 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   415
by Auto_tac;
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   416
by (REPEAT(Blast_tac 1));
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   417
qed "stable_Join_constrains";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   418
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   419
(*Premise for G cannot use Always because  F: Stable A  is
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   420
   weaker than G : stable A *)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   421
Goal "[| F : stable(A);  G : invariant(A) |] ==> F Join G : Always(A)";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   422
by (subgoal_tac "F:program & G:program & st_set(A)" 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   423
by (blast_tac (claset() addDs [invariantD2, stableD2]) 2);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   424
by (asm_full_simp_tac (simpset() addsimps [Always_def, invariant_def,initially_def ,
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   425
                                       Stable_eq_stable]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   426
by (force_tac(claset() addIs [stable_Int], simpset()) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   427
qed "stable_Join_Always1";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   428
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   429
(*As above, but exchanging the roles of F and G*)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   430
Goal "[| F : invariant(A);  G : stable(A) |] ==> F Join G : Always(A)";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   431
by (stac Join_commute 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   432
by (blast_tac (claset() addIs [stable_Join_Always1]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   433
qed "stable_Join_Always2";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   434
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   435
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   436
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   437
Goal "[| F : stable(A);  G : A ensures B |] ==> F Join G : A ensures B";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   438
by (subgoal_tac "F:program & G:program & st_set(A)" 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   439
by (blast_tac (claset() addDs [stableD2, ensures_type RS subsetD]) 2);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   440
by (asm_simp_tac (simpset() addsimps [Join_ensures]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   441
by (asm_full_simp_tac (simpset() addsimps [stable_def, ensures_def]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   442
by (etac constrains_weaken 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   443
by Auto_tac;
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   444
qed "stable_Join_ensures1";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   445
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   446
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   447
(*As above, but exchanging the roles of F and G*)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   448
Goal "[| F : A ensures B;  G : stable(A) |] ==> F Join G : A ensures B";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   449
by (stac Join_commute 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   450
by (blast_tac (claset() addIs [stable_Join_ensures1]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   451
qed "stable_Join_ensures2";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   452
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   453
(*** The ok and OK relations ***)
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   454
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   455
Goal "SKIP ok F";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   456
by (auto_tac (claset() addDs [Acts_type RS subsetD], simpset() addsimps [ok_def]));
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   457
qed "ok_SKIP1";  
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   458
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   459
Goal "F ok SKIP";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   460
by (auto_tac (claset() addDs [Acts_type RS subsetD],
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   461
      simpset() addsimps [ok_def]));
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   462
qed "ok_SKIP2";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   463
AddIffs [ok_SKIP1, ok_SKIP2];  
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   464
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   465
Goal "(F ok G & (F Join G) ok H) <-> (G ok H & F ok (G Join H))";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   466
by (auto_tac (claset(), simpset() addsimps [ok_def]));
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   467
qed "ok_Join_commute";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   468
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   469
Goal "(F ok G) <->(G ok F)";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   470
by (auto_tac (claset(), simpset() addsimps [ok_def]));
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   471
qed "ok_commute";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   472
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   473
bind_thm ("ok_sym", ok_commute RS iffD1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   474
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   475
Goal "OK({<0,F>,<1,G>,<2,H>}, snd) <-> (F ok G & (F Join G) ok H)";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   476
by (asm_full_simp_tac
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   477
    (simpset() addsimps [ok_def, Join_def,  OK_def,
12215
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   478
                        Int_assoc, cons_absorb, Int_Un_distrib2, Ball_def]) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   479
by (rtac iffI 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   480
by Safe_tac; 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   481
by (REPEAT(Force_tac 1));
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   482
qed "ok_iff_OK";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   483
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   484
Goal "F ok (G Join H) <-> (F ok G & F ok H)";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   485
by (auto_tac (claset(), simpset() addsimps [ok_def]));
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   486
qed "ok_Join_iff1";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   487
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   488
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   489
Goal "(G Join H) ok F <-> (G ok F & H ok F)";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   490
by (auto_tac (claset(), simpset() addsimps [ok_def]));
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   491
qed "ok_Join_iff2";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   492
AddIffs [ok_Join_iff1, ok_Join_iff2];
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   493
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   494
(*useful?  Not with the previous two around*)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   495
Goal "[| F ok G; (F Join G) ok H |] ==> F ok (G Join H)";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   496
by (auto_tac (claset(), simpset() addsimps [ok_def]));
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   497
qed "ok_Join_commute_I";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   498
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   499
Goal "F ok JOIN(I,G) <-> (ALL i:I. F ok G(i))";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   500
by (auto_tac (claset(), simpset() addsimps [ok_def]));
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   501
by (blast_tac (claset() addDs [Acts_type RS subsetD]) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   502
qed "ok_JN_iff1";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   503
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   504
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   505
Goal "JOIN(I,G) ok F   <->  (ALL i:I. G(i) ok F)";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   506
by (auto_tac (claset(), simpset() addsimps [ok_def]));
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   507
by (blast_tac (claset() addDs [Acts_type RS subsetD]) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   508
qed "ok_JN_iff2";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   509
AddIffs [ok_JN_iff1, ok_JN_iff2];
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   510
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   511
Goal "OK(I,F) <-> (ALL i: I. ALL j: I-{i}. F(i) ok (F(j)))"; 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   512
by (auto_tac (claset(), simpset() addsimps [ok_def, OK_def]));  
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   513
qed "OK_iff_ok";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   514
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   515
Goal "[| OK(I,F); i: I; j: I; i~=j|] ==> F(i) ok F(j)"; 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   516
by (auto_tac (claset(), simpset() addsimps [OK_iff_ok]));  
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   517
qed "OK_imp_ok";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   518
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   519
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   520
(*** Allowed ***)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   521
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   522
Goal "Allowed(SKIP) = program";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   523
by (auto_tac (claset() addDs [Acts_type RS subsetD], 
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   524
               simpset() addsimps [Allowed_def]));  
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   525
qed "Allowed_SKIP";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   526
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   527
Goal "Allowed(F Join G) = \
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   528
\  Allowed(programify(F)) Int Allowed(programify(G))";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   529
by (auto_tac (claset(), simpset() addsimps [Allowed_def]));
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   530
qed "Allowed_Join";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   531
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   532
Goal "i:I ==> \
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   533
\  Allowed(JOIN(I,F)) = (INT i:I. Allowed(programify(F(i))))";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   534
by (auto_tac (claset(), simpset() addsimps [Allowed_def]));
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   535
qed "Allowed_JN";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   536
Addsimps [Allowed_SKIP, Allowed_Join, Allowed_JN];
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   537
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   538
Goal 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   539
"F ok G <-> (programify(F):Allowed(programify(G)) & \
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   540
\  programify(G):Allowed(programify(F)))";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   541
by (asm_simp_tac (simpset() addsimps [ok_def, Allowed_def]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   542
qed "ok_iff_Allowed";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   543
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   544
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   545
Goal "OK(I,F) <-> \
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   546
\ (ALL i: I. ALL j: I-{i}. programify(F(i)) : Allowed(programify(F(j))))"; 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   547
by (auto_tac (claset(), simpset() addsimps [OK_iff_ok, ok_iff_Allowed]));  
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   548
qed "OK_iff_Allowed";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   549
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   550
(*** safety_prop, for reasoning about given instances of "ok" ***)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   551
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   552
Goal "safety_prop(X) ==> (Acts(G) <= cons(id(state), (UN F:X. Acts(F)))) <-> (programify(G):X)";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   553
by (full_simp_tac( simpset() addsimps [safety_prop_def]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   554
by (Clarify_tac 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   555
by (case_tac "G:program" 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   556
by (ALLGOALS(Asm_full_simp_tac));
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   557
by (Blast_tac 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   558
by Safe_tac;
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   559
by (Force_tac 2);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   560
by (force_tac (claset(), simpset() 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   561
          addsimps [programify_def]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   562
qed "safety_prop_Acts_iff";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   563
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   564
Goal "safety_prop(X) ==> \
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   565
\ (UN G:X. Acts(G)) <= AllowedActs(F) <-> (X <= Allowed(programify(F)))";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   566
by (auto_tac (claset(), 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   567
      simpset() addsimps [Allowed_def, 
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   568
              safety_prop_Acts_iff RS iff_sym]));  
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   569
by (rewrite_goals_tac [safety_prop_def]);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   570
by Auto_tac;
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   571
qed "safety_prop_AllowedActs_iff_Allowed";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   572
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   573
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   574
Goal "safety_prop(X) ==> Allowed(mk_program(init, acts, UN F:X. Acts(F))) = X";
12215
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   575
by (subgoal_tac "cons(id(state), Union(RepFun(X, Acts)) Int Pow(state * state)) = \
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   576
\                   Union(RepFun(X, Acts))" 1);
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   577
by (rtac equalityI 2);
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   578
by (REPEAT(force_tac (claset() addDs [Acts_type RS subsetD],
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   579
               simpset() addsimps [safety_prop_def]) 2));
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   580
by (asm_full_simp_tac (simpset() delsimps UN_simps
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   581
                   addsimps [Allowed_def, safety_prop_Acts_iff]) 1);
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   582
by (rewrite_goals_tac [safety_prop_def]);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   583
by Auto_tac;
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   584
qed "Allowed_eq";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   585
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   586
Goal "[| F == mk_program (init, acts, UN F:X. Acts(F)); X:property; safety_prop(X) |] \
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   587
\     ==> Allowed(F) = X";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   588
by (asm_simp_tac (simpset() addsimps [Allowed_eq]) 1); 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   589
qed "def_prg_Allowed";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   590
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   591
(*For safety_prop to hold, the property must be satisfiable!*)
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   592
Goal "safety_prop(A co B) <-> (A <= B & st_set(A))";
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   593
by (simp_tac (simpset() addsimps [safety_prop_def, constrains_def, st_set_def]) 1);
12215
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   594
by (auto_tac (claset() addDs [Acts_type RS subsetD], simpset()));
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   595
by (REPEAT(Blast_tac 1));
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   596
qed "safety_prop_constrains";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   597
AddIffs [safety_prop_constrains];
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   598
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   599
(* To be used with resolution *)
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   600
Goal "[| A<=B; st_set(A) |] ==>safety_prop(A co B)";
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   601
by Auto_tac;
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   602
qed "safety_prop_constrainsI";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   603
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   604
Goal "safety_prop(stable(A)) <-> st_set(A)";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   605
by (asm_simp_tac (simpset() addsimps [stable_def]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   606
qed "safety_prop_stable";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   607
AddIffs [safety_prop_stable];
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   608
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   609
Goal "st_set(A) ==> safety_prop(stable(A))";
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   610
by Auto_tac;
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   611
qed "safety_prop_stableI";
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   612
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   613
Goal "[| safety_prop(X) ; safety_prop(Y) |] ==> safety_prop(X Int Y)";
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   614
by (asm_full_simp_tac (simpset() addsimps [safety_prop_def]) 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   615
by Auto_tac; 
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   616
by (dres_inst_tac [("B", "Union(RepFun(X Int Y, Acts))"),
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   617
                   ("C", "Union(RepFun(Y, Acts))")] subset_trans 2);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   618
by (dres_inst_tac [("B", "Union(RepFun(X Int Y, Acts))"),
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   619
                   ("C", "Union(RepFun(X, Acts))")] subset_trans 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   620
by (REPEAT(Blast_tac 1));
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   621
qed "safety_prop_Int";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   622
Addsimps [safety_prop_Int];
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   623
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   624
(* If I=0 the conclusion becomes safety_prop(0) which is false *)
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   625
val [major, minor] = Goalw [safety_prop_def] 
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   626
"[| (!!i. i:I ==>safety_prop(X(i))); i:I |] ==> safety_prop(INT i:I. X(i))";
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   627
by (cut_facts_tac [minor] 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   628
by Safe_tac;
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   629
by (full_simp_tac (simpset() addsimps [Inter_iff]) 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   630
by (Clarify_tac 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   631
by (forward_tac [major] 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   632
by (dres_inst_tac [("i", "xa")] major 2);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   633
by (forw_inst_tac [("i", "xa")] major 4);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   634
by (ALLGOALS(Asm_full_simp_tac));
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   635
by Auto_tac;
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   636
by (dres_inst_tac [("B", "Union(RepFun(Inter(RepFun(I, X)), Acts))"),
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   637
                   ("C", "Union(RepFun(X(xa), Acts))")] subset_trans 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   638
by (REPEAT(Blast_tac 1));
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   639
qed "safety_prop_Inter";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   640
12215
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   641
Goalw [ok_def]
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   642
"[| F == mk_program(init,acts, UN G:X. Acts(G)); safety_prop(X) |] \
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   643
\     ==> F ok G <-> (programify(G):X & acts Int Pow(state*state) <= AllowedActs(G))";
12215
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   644
by (dres_inst_tac [("G", "G")] safety_prop_Acts_iff 1);
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   645
by Safe_tac;
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   646
by (ALLGOALS(cut_inst_tac [("F", "G")] AllowedActs_type));
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   647
by (ALLGOALS(cut_inst_tac [("F", "G")] Acts_type));
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   648
by Auto_tac;
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   649
qed "def_UNION_ok_iff";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   650
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   651