src/HOL/UNITY/PPROD.ML
author paulson
Mon, 07 Dec 1998 18:26:46 +0100
changeset 6020 4b109bf75976
parent 6012 1894bfc4aee9
child 6295 351b3c2b0d83
permissions -rw-r--r--
towards handling sharing of variables
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
     1
(*  Title:      HOL/UNITY/PPROD.ML
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
     2
    ID:         $Id$
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
     4
    Copyright   1998  University of Cambridge
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
     5
*)
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
     6
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
     7
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
     8
val rinst = read_instantiate_sg (sign_of thy);
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
     9
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    10
    (*** General lemmas ***)
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    11
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    12
Goalw [sharing_def] "((x,y): sharing Rsh A) = (x: A & y : range (Rsh x))";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    13
by Auto_tac;
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    14
qed "sharing_iff";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    15
AddIffs [sharing_iff]; 
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    16
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    17
Goalw [sharing_def] "(sharing Rsh A <= sharing Rsh B) = (A <= B)";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    18
by Auto_tac;
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    19
qed "sharing_subset_iff";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    20
AddIffs [sharing_subset_iff]; 
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    21
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    22
Goalw [sharing_def] "sharing Rsh (A Un B) = sharing Rsh A Un sharing Rsh B";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    23
by Auto_tac;
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    24
qed "sharing_Un_distrib";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    25
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    26
Goalw [sharing_def] "sharing Rsh (A Int B) = sharing Rsh A Int sharing Rsh B";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    27
by Auto_tac;
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    28
qed "sharing_Int_distrib";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    29
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    30
Goalw [sharing_def] "sharing Rsh (A - B) = sharing Rsh A - sharing Rsh B";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    31
by Auto_tac;
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    32
qed "sharing_Diff_distrib";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    33
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    34
Goalw [sharing_def] "sharing Rsh (Union A) = (UN X:A. sharing Rsh X)";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    35
by (Blast_tac 1);
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    36
qed "sharing_Union";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    37
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    38
Goal "(sharing Rsh A <= - sharing Rsh B) = (A <= - B)";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    39
by (force_tac (claset(),simpset() addsimps [sharing_def, Image_iff]) 1);
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    40
qed "Lcopy_subset_Compl_eq";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    41
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    42
Goal "(((a,b), (a',b')) : Lcopy_act Rsh act) = \
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    43
\     ((a,a'):act & Rsh a b = b & Rsh a' b = b')";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    44
by (simp_tac (simpset() addsimps [Lcopy_act_def]) 1);
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    45
qed "mem_Lcopy_act_iff";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    46
AddIffs [mem_Lcopy_act_iff]; 
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    47
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    48
(*NEEDED????????????????*)
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    49
Goal "[| (a,a'):act; Rsh a b = b |] ==> (((a,b), (a', Rsh a' b)) : Lcopy_act Rsh act)";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    50
by Auto_tac;
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    51
qed "mem_Lcopy_actI";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    52
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    53
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    54
Goal "act : Acts F \
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    55
\     ==> Lcopy_act Rsh act <= \
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    56
\         sharing Rsh (States F) Times sharing Rsh (States F)";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    57
by (auto_tac (claset() addIs [range_eqI, sym]
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    58
                       addDs [impOfSubs Acts_subset_Pow_States], 
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    59
              simpset()));
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    60
qed "Lcopy_act_subset_Times";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    61
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    62
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    63
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    64
Open_locale "Share";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    65
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    66
val overwrite = thm "overwrite";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    67
Addsimps [overwrite];
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    68
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    69
Goal "Lcopy_act Rsh act ^^ sharing Rsh A = sharing Rsh (act ^^ A)";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    70
by (force_tac (claset(),simpset() addsimps [sharing_def, Image_iff]) 1);
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    71
qed "Lcopy_act_Image";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    72
Addsimps [Lcopy_act_Image];
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    73
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    74
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    75
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    76
Goal "(Lcopy_act Rsh act ^^ sharing Rsh A <= sharing Rsh B) = (act ^^ A <= B)";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    77
by (force_tac (claset(),simpset() addsimps [sharing_def, Image_iff]) 1);
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    78
qed "Lcopy_act_Image_subset_eq";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    79
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    80
Goal "Domain (Lcopy_act Rsh act) = sharing Rsh (Domain act)";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    81
by (auto_tac (claset() addIs [sym], simpset() addsimps [Domain_iff]));
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    82
qed "Domain_Lcopy_act"; 
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    83
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    84
(*?? needed??
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    85
Goal "(Lcopy_act Rsh act) ^^ (SIGMA x:A. B Int range(Rsh x)) = (SIGMA x: act^^A. Rsh x `` B)";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    86
by (auto_tac (claset(), simpset() addsimps [Image_iff]));
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    87
qed "Image_Lcopy_act"; 
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    88
**)
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    89
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    90
Goal "Lcopy_act Rsh (diag A) = diag (sharing Rsh A)";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    91
by (auto_tac (claset() addIs [sym], simpset()));
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    92
qed "Lcopy_diag";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    93
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    94
Addsimps [Lcopy_diag];
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    95
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    96
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    97
(**** Lcopy ****)
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    98
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    99
(*** Basic properties ***)
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   100
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   101
Goalw [Lcopy_def] "States (Lcopy Rsh F) = sharing Rsh (States F)";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   102
by Auto_tac;
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   103
qed "States_Lcopy";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   104
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   105
Goalw [Lcopy_def] "Init (Lcopy Rsh F) = sharing Rsh (Init F)";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   106
by (auto_tac (claset() addIs [impOfSubs Init_subset_States], simpset()));
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   107
qed "Init_Lcopy";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   108
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   109
Goal "diag (sharing Rsh (States F)) : Lcopy_act Rsh `` Acts F";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   110
by (rtac image_eqI 1);
6012
1894bfc4aee9 Addition of the States component; parts of Comp not working
paulson
parents: 5972
diff changeset
   111
by (rtac diag_in_Acts 2);
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   112
by Auto_tac;
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   113
val lemma = result();
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   114
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   115
Goal "Acts (Lcopy Rsh F) = (Lcopy_act Rsh `` Acts F)";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   116
by (auto_tac (claset() addSIs [lemma] 
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   117
                       addDs [impOfSubs Acts_subset_Pow_States], 
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   118
	      simpset() addsimps [Lcopy_def, Lcopy_act_subset_Times, 
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   119
				  image_subset_iff]));
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   120
qed "Acts_Lcopy";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   121
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   122
Addsimps [States_Lcopy, Init_Lcopy, Acts_Lcopy];
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   123
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   124
Goalw [SKIP_def] "Lcopy Rsh (SKIP A) = SKIP(sharing Rsh A)";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   125
by (rtac program_equalityI 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   126
by Auto_tac;
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   127
qed "Lcopy_SKIP";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   128
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   129
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   130
(*** Safety: constrains, stable ***)
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   131
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   132
Goal "(Lcopy Rsh F : constrains (sharing Rsh A) (sharing Rsh B)) = \
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   133
\     (F : constrains A B)";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   134
by (simp_tac (simpset() addsimps [constrains_def, 
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   135
				  Lcopy_act_Image_subset_eq]) 1);
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   136
qed "Lcopy_constrains";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   137
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   138
Goal "[| Lcopy Rsh F : constrains A B;  A <= States (Lcopy Rsh F) |]  \
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   139
\     ==> F : constrains (Domain A) (Domain B)";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   140
by (force_tac (claset() addIs [rev_bexI], 
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   141
	       simpset() addsimps [constrains_def, sharing_def, Image_iff]) 1);
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   142
qed "Lcopy_constrains_Domain";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   143
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   144
Goal "(Lcopy Rsh F : stable (sharing Rsh A)) = (F : stable A)";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   145
by (asm_simp_tac (simpset() addsimps [stable_def, Lcopy_constrains]) 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   146
qed "Lcopy_stable";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   147
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   148
Goal "(Lcopy Rsh F : invariant (sharing Rsh A)) = (F : invariant A)";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   149
by (asm_simp_tac (simpset() addsimps [invariant_def, Lcopy_stable]) 1);
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   150
qed "Lcopy_invariant";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   151
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   152
(** Substitution Axiom versions: Constrains, Stable **)
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   153
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   154
Goal "p : reachable (Lcopy Rsh F) \
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   155
\     ==> (%(a,b). a : reachable F & b : range (Rsh a)) p";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   156
by (etac reachable.induct 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   157
by (auto_tac
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   158
    (claset() addIs reachable.intrs,
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   159
     simpset() addsimps [Acts_Lcopy]));
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   160
qed "reachable_Lcopy_fst";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   161
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   162
Goal "(a,b) : reachable (Lcopy Rsh F) \
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   163
\     ==> a : reachable F & b : range (Rsh a)";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   164
by (force_tac (claset() addSDs [reachable_Lcopy_fst], simpset()) 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   165
qed "reachable_LcopyD";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   166
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   167
Goal "reachable (Lcopy Rsh F) = sharing Rsh (reachable F)";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   168
by (rtac equalityI 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   169
by (force_tac (claset() addSDs [reachable_LcopyD], simpset()) 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   170
by (Clarify_tac 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   171
by (etac reachable.induct 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   172
by (ALLGOALS (force_tac (claset() addIs reachable.intrs, 
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   173
			 simpset())));
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   174
qed "reachable_Lcopy_eq";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   175
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   176
Goal "(Lcopy Rsh F : Constrains (sharing Rsh A) (sharing Rsh B)) =  \
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   177
\     (F : Constrains A B)";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   178
by (simp_tac
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   179
    (simpset() addsimps [Constrains_def, reachable_Lcopy_eq, 
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   180
			 Lcopy_constrains, sharing_Int_distrib RS sym]) 1);
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   181
qed "Lcopy_Constrains";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   182
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   183
Goal "(Lcopy Rsh F : Stable (sharing Rsh A)) = (F : Stable A)";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   184
by (simp_tac (simpset() addsimps [Stable_def, Lcopy_Constrains]) 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   185
qed "Lcopy_Stable";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   186
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   187
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   188
(*** Progress: transient, ensures ***)
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   189
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   190
Goal "(Lcopy Rsh F : transient (sharing Rsh A)) = (F : transient A)";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   191
by (auto_tac (claset(),
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   192
	      simpset() addsimps [transient_def, Lcopy_subset_Compl_eq,
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   193
				  Domain_Lcopy_act]));
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   194
qed "Lcopy_transient";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   195
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   196
Goal "(Lcopy Rsh F : ensures (sharing Rsh A) (sharing Rsh B)) = \
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   197
\     (F : ensures A B)";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   198
by (simp_tac
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   199
    (simpset() addsimps [ensures_def, Lcopy_constrains, Lcopy_transient, 
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   200
			 sharing_Un_distrib RS sym, 
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   201
			 sharing_Diff_distrib RS sym]) 1);
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   202
qed "Lcopy_ensures";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   203
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   204
Goal "F : leadsTo A B \
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   205
\     ==> Lcopy Rsh F : leadsTo (sharing Rsh A) (sharing Rsh B)";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   206
by (etac leadsTo_induct 1);
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   207
by (asm_simp_tac (simpset() addsimps [leadsTo_UN, sharing_Union]) 3);
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   208
by (blast_tac (claset() addIs [leadsTo_Trans]) 2);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   209
by (asm_simp_tac (simpset() addsimps [leadsTo_Basis, Lcopy_ensures]) 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   210
qed "leadsTo_imp_Lcopy_leadsTo";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   211
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   212
(**
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   213
    Goal "Lcopy Rsh F : ensures A B ==> F : ensures (Domain A) (Domain B)";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   214
    by (full_simp_tac
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   215
	(simpset() addsimps [ensures_def, Lcopy_constrains, Lcopy_transient, 
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   216
			     Domain_Un_eq RS sym,
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   217
			     sharing_Un_distrib RS sym, 
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   218
			     sharing_Diff_distrib RS sym]) 1);
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   219
    by (safe_tac (claset() addSDs [Lcopy_constrains_Domain]));
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   220
    by (etac constrains_weaken_L 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   221
    by (Blast_tac 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   222
    (*NOT able to prove this:
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   223
    Lcopy Rsh F : ensures A B ==> F : ensures (Domain A) (Domain B)
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   224
     1. [| Lcopy Rsh F : transient (A - B);
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   225
	   F : constrains (Domain (A - B)) (Domain (A Un B)) |]
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   226
	==> F : transient (Domain A - Domain B)
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   227
    **)
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   228
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   229
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   230
    Goal "Lcopy Rsh F : leadsTo AU BU ==> F : leadsTo (Domain AU) (Domain BU)";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   231
    by (etac leadsTo_induct 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   232
    by (full_simp_tac (simpset() addsimps [Domain_Union]) 3);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   233
    by (blast_tac (claset() addIs [leadsTo_UN]) 3);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   234
    by (blast_tac (claset() addIs [leadsTo_Trans]) 2);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   235
    by (rtac leadsTo_Basis 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   236
    (*...and so CANNOT PROVE THIS*)
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   237
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   238
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   239
    (*This also seems impossible to prove??*)
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   240
    Goal "(Lcopy Rsh F : leadsTo (sharing Rsh A) (sharing Rsh B)) = \
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   241
    \     (F : leadsTo A B)";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   242
**)
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   243
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   244
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   245
(**** PPROD ****)
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   246
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   247
(*** Basic properties ***)
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   248
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   249
Goalw [lift_set_def] "(f : lift_set i A) = (f i : A)";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   250
by Auto_tac;
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   251
qed "lift_set_iff";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   252
AddIffs [lift_set_iff];
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   253
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   254
Goalw [lift_act_def] "lift_act i (diag A) = (diag (lift_set i A))";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   255
by Auto_tac;
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   256
qed "lift_act_diag";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   257
Addsimps [lift_act_diag];
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   258
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   259
Goalw [lift_prog_def] "States (lift_prog i F) = (lift_set i (States F))";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   260
by Auto_tac;
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   261
qed "States_lift_prog";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   262
Addsimps [States_lift_prog];
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   263
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   264
Goalw [lift_prog_def] "Init (lift_prog i F) = (lift_set i (Init F))";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   265
by (auto_tac (claset() addIs [impOfSubs Init_subset_States], simpset()));
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   266
qed "Init_lift_prog";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   267
Addsimps [Init_lift_prog];
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   268
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   269
Goalw [lift_act_def]
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   270
     "act : Acts F \
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   271
\     ==> lift_act i act <= lift_set i (States F) Times lift_set i (States F)";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   272
by (force_tac (claset()  addIs [range_eqI, sym]
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   273
                    addDs [impOfSubs Acts_subset_Pow_States], 
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   274
              simpset()) 1);
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   275
qed "lift_act_subset_Times";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   276
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   277
Goalw [lift_prog_def] "Acts (lift_prog i F) = lift_act i `` Acts F";
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   278
by (auto_tac (claset() addIs [diag_in_Acts RSN (2,image_eqI)], 
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   279
	      simpset() addsimps [lift_act_subset_Times, 
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   280
				  image_subset_iff]));
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   281
qed "Acts_lift_prog";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   282
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   283
Goalw [PPROD_def] "States (PPROD I F) = (INT i:I. lift_set i (States (F i)))";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   284
by Auto_tac;
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   285
qed "States_PPROD";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   286
Addsimps [States_PPROD];
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   287
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   288
Goalw [PPROD_def] "Init (PPROD I F) = (INT i:I. lift_set i (Init (F i)))";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   289
by Auto_tac;
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   290
qed "Init_PPROD";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   291
Addsimps [Init_PPROD];
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   292
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   293
Goalw [lift_act_def]
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   294
    "((f,f') : lift_act i act) = (EX s'. f' = f(i := s') & (f i, s') : act)";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   295
by (Blast_tac 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   296
qed "lift_act_eq";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   297
AddIffs [lift_act_eq];
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   298
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   299
Goalw [eqStates_def] "eqStates I (%i. lift_prog i F)";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   300
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   301
Goalw [eqStates_def] "eqStates I (%i. lift_prog i (F i))";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   302
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   303
Goal "[| eqStates I (%i. lift_prog i (F i));  i: I |] \
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   304
\     ==> Acts (PPROD I F) = (UN i:I. lift_act i `` Acts (F i))";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   305
by (auto_tac (claset(),
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   306
	      simpset() addsimps [PPROD_def, Acts_lift_prog, Acts_JN]));
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   307
qed "Acts_PPROD";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   308
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   309
Goal "PPROD {} F = SKIP UNIV";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   310
by (simp_tac (simpset() addsimps [PPROD_def]) 1);
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   311
qed "Acts_PPROD";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   312
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   313
Goal "i : I ==> (PPI i: I. SKIP A) = SKIP (INT i:I. lift_set i A)";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   314
by (auto_tac (claset() addSIs [program_equalityI],
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   315
	      simpset() addsimps [eqStates_def, Acts_lift_prog, 
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   316
				  SKIP_def, Acts_PPROD]));
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   317
qed "PPROD_SKIP";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   318
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   319
Goal "PPROD {} F = SKIP";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   320
by (simp_tac (simpset() addsimps [PPROD_def]) 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   321
qed "PPROD_empty";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   322
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   323
Addsimps [PPROD_SKIP, PPROD_empty];
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   324
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   325
Goalw [PPROD_def]
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   326
    "PPROD (insert i I) F = (lift_prog i (F i)) Join (PPROD I F)";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   327
by Auto_tac;
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   328
qed "PPROD_insert";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   329
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   330
Goalw [PPROD_def] "i : I ==> component (lift_prog i (F i)) (PPROD I F)";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   331
(*blast_tac doesn't use HO unification*)
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   332
by (fast_tac (claset() addIs [component_JN]) 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   333
qed "component_PPROD";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   334
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   335
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   336
(*** Safety: constrains, stable, invariant ***)
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   337
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   338
(** 1st formulation of lifting **)
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   339
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   340
Goal "(lift_prog i F : constrains (lift_set i A) (lift_set i B))  =  \
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   341
\     (F : constrains A B)";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   342
by (auto_tac (claset(), 
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   343
	      simpset() addsimps [constrains_def, Acts_lift_prog]));
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   344
by (Blast_tac 2);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   345
by (Force_tac 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   346
qed "lift_prog_constrains_eq";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   347
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   348
Goal "(lift_prog i F : stable (lift_set i A)) = (F : stable A)";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   349
by (simp_tac (simpset() addsimps [stable_def, lift_prog_constrains_eq]) 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   350
qed "lift_prog_stable_eq";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   351
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   352
(*This one looks strange!  Proof probably is by case analysis on i=j.*)
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   353
Goal "F i : constrains A B  \
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   354
\     ==> lift_prog j (F j) : constrains (lift_set i A) (lift_set i B)";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   355
by (auto_tac (claset(), 
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   356
	      simpset() addsimps [constrains_def, Acts_lift_prog]));
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   357
by (REPEAT (Blast_tac 1));
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   358
qed "constrains_imp_lift_prog_constrains";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   359
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   360
Goal "i : I ==>  \
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   361
\     (PPROD I F : constrains (lift_set i A) (lift_set i B))  =  \
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   362
\     (F i : constrains A B)";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   363
by (asm_simp_tac (simpset() addsimps [PPROD_def, constrains_JN]) 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   364
by (blast_tac (claset() addIs [lift_prog_constrains_eq RS iffD1, 
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   365
			       constrains_imp_lift_prog_constrains]) 1);
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   366
qed "PPROD_constrains";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   367
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   368
Goal "i : I ==> (PPROD I F : stable (lift_set i A)) = (F i : stable A)";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   369
by (asm_simp_tac (simpset() addsimps [stable_def, PPROD_constrains]) 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   370
qed "PPROD_stable";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   371
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   372
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   373
(** 2nd formulation of lifting **)
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   374
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   375
Goal "[| lift_prog i F : constrains AA BB |] \
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   376
\     ==> F : constrains (Applyall AA i) (Applyall BB i)";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   377
by (auto_tac (claset(), 
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   378
	      simpset() addsimps [Applyall_def, constrains_def, 
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   379
				  Acts_lift_prog]));
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   380
by (force_tac (claset() addSIs [rinst [("x", "?ff(i := ?u)")] image_eqI],
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   381
	       simpset()) 1);
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   382
qed "lift_prog_constrains_projection";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   383
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   384
Goal "[| PPROD I F : constrains AA BB;  i: I |] \
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   385
\     ==> F i : constrains (Applyall AA i) (Applyall BB i)";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   386
by (rtac lift_prog_constrains_projection 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   387
(*rotate this assumption to be last*)
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   388
by (dres_inst_tac [("psi", "PPROD I F : ?C")] asm_rl 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   389
by (asm_full_simp_tac (simpset() addsimps [PPROD_def, constrains_JN]) 1);
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   390
qed "PPROD_constrains_projection";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   391
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   392
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   393
(** invariant **)
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   394
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   395
Goal "F : invariant A ==> lift_prog i F : invariant (lift_set i A)";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   396
by (auto_tac (claset(),
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   397
	      simpset() addsimps [invariant_def, lift_prog_stable_eq]));
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   398
qed "invariant_imp_lift_prog_invariant";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   399
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   400
Goal "[| lift_prog i F : invariant (lift_set i A) |] ==> F : invariant A";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   401
by (auto_tac (claset(),
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   402
	      simpset() addsimps [invariant_def, lift_prog_stable_eq]));
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   403
qed "lift_prog_invariant_imp_invariant";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   404
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   405
(*NOT clear that the previous lemmas help in proving this one.*)
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   406
Goal "[| F i : invariant A;  i : I |] ==> PPROD I F : invariant (lift_set i A)";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   407
by (auto_tac (claset(),
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   408
	      simpset() addsimps [invariant_def, PPROD_stable]));
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   409
qed "invariant_imp_PPROD_invariant";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   410
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   411
(*The f0 premise ensures that the product is well-defined.*)
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   412
Goal "[| PPROD I F : invariant (lift_set i A);  i : I;  \
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   413
\        f0: Init (PPROD I F) |] ==> F i : invariant A";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   414
by (auto_tac (claset(),
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   415
	      simpset() addsimps [invariant_def, PPROD_stable]));
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   416
by (dres_inst_tac [("c", "f0(i:=x)")] subsetD 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   417
by Auto_tac;
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   418
qed "PPROD_invariant_imp_invariant";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   419
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   420
Goal "[| i : I;  f0: Init (PPROD I F) |] \
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   421
\     ==> (PPROD I F : invariant (lift_set i A)) = (F i : invariant A)";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   422
by (blast_tac (claset() addIs [invariant_imp_PPROD_invariant, 
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   423
			       PPROD_invariant_imp_invariant]) 1);
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   424
qed "PPROD_invariant";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   425
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   426
(*The f0 premise isn't needed if F is a constant program because then
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   427
  we get an initial state by replicating that of F*)
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   428
Goal "i : I \
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   429
\     ==> ((PPI x:I. F) : invariant (lift_set i A)) = (F : invariant A)";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   430
by (auto_tac (claset(),
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   431
	      simpset() addsimps [invariant_def, PPROD_stable]));
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   432
qed "PFUN_invariant";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   433
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   434
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   435
(*** Substitution Axiom versions: Constrains, Stable ***)
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   436
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   437
(** Reachability **)
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   438
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   439
Goal "[| f : reachable (PPROD I F);  i : I |] ==> f i : reachable (F i)";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   440
by (etac reachable.induct 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   441
by (auto_tac
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   442
    (claset() addIs reachable.intrs,
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   443
     simpset() addsimps [Acts_PPROD]));
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   444
qed "reachable_PPROD";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   445
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   446
Goal "reachable (PPROD I F) <= {f. ALL i:I. f i : reachable (F i)}";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   447
by (force_tac (claset() addSDs [reachable_PPROD], simpset()) 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   448
qed "reachable_PPROD_subset1";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   449
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   450
Goal "[| i ~: I;  A : reachable (F i) |]     \
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   451
\  ==> ALL f. f : reachable (PPROD I F)      \
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   452
\             --> f(i:=A) : reachable (lift_prog i (F i) Join PPROD I F)";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   453
by (etac reachable.induct 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   454
by (ALLGOALS Clarify_tac);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   455
by (etac reachable.induct 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   456
(*Init, Init case*)
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   457
by (force_tac (claset() addIs reachable.intrs,
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   458
	       simpset() addsimps [Acts_lift_prog]) 1);
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   459
(*Init of F, action of PPROD F case*)
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   460
by (rtac reachable.Acts 1);
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   461
by (force_tac (claset(), simpset() addsimps [Acts_Join]) 1);
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   462
by (assume_tac 1);
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   463
by (force_tac (claset() addIs [ext], simpset() addsimps [Acts_PPROD]) 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   464
(*induction over the 2nd "reachable" assumption*)
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   465
by (eres_inst_tac [("xa","f")] reachable.induct 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   466
(*Init of PPROD F, action of F case*)
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   467
by (res_inst_tac [("act","lift_act i act")] reachable.Acts 1);
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   468
by (force_tac (claset(), simpset() addsimps [Acts_lift_prog, Acts_Join]) 1);
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   469
by (force_tac (claset() addIs [reachable.Init], simpset()) 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   470
by (force_tac (claset() addIs [ext], simpset() addsimps [lift_act_def]) 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   471
(*last case: an action of PPROD I F*)
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   472
by (rtac reachable.Acts 1);
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   473
by (force_tac (claset(), simpset() addsimps [Acts_Join]) 1);
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   474
by (assume_tac 1);
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   475
by (force_tac (claset() addIs [ext], simpset() addsimps [Acts_PPROD]) 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   476
qed_spec_mp "reachable_lift_Join_PPROD";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   477
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   478
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   479
(*The index set must be finite: otherwise infinitely many copies of F can
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   480
  perform actions, and PPROD can never catch up in finite time.*)
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   481
Goal "finite I \
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   482
\     ==> {f. ALL i:I. f i : reachable (F i)} <= reachable (PPROD I F)";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   483
by (etac finite_induct 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   484
by (Simp_tac 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   485
by (force_tac (claset() addDs [reachable_lift_Join_PPROD], 
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   486
	       simpset() addsimps [PPROD_insert]) 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   487
qed "reachable_PPROD_subset2";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   488
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   489
Goal "finite I ==> \
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   490
\     reachable (PPROD I F) = {f. ALL i:I. f i : reachable (F i)}";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   491
by (REPEAT_FIRST (ares_tac [equalityI,
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   492
			    reachable_PPROD_subset1, 
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   493
			    reachable_PPROD_subset2]));
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   494
qed "reachable_PPROD_eq";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   495
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   496
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   497
(** Constrains **)
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   498
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   499
Goal "[| F i : Constrains A B;  i: I;  finite I |]  \
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   500
\     ==> PPROD I F : Constrains (lift_set i A) (lift_set i B)";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   501
by (auto_tac
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   502
    (claset(),
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   503
     simpset() addsimps [Constrains_def, Collect_conj_eq RS sym,
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   504
			 reachable_PPROD_eq]));
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   505
by (auto_tac (claset(), 
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   506
              simpset() addsimps [constrains_def, Acts_lift_prog, PPROD_def,
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   507
                                  Acts_JN]));
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   508
by (REPEAT (blast_tac (claset() addIs reachable.intrs) 1));
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   509
qed "Constrains_imp_PPROD_Constrains";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   510
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   511
Goal "[| ALL i:I. f0 i : R i;  i: I |] \
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   512
\     ==> Applyall {f. (ALL i:I. f i : R i) & f i : A} i = R i Int A";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   513
by (force_tac (claset() addSIs [rinst [("x", "?ff(i := ?u)")] exI],
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   514
	       simpset() addsimps [Applyall_def]) 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   515
qed "Applyall_Int_depend";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   516
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   517
(*Again, we need the f0 premise because otherwise Constrains holds trivially
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   518
  for PPROD I F.*)
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   519
Goal "[| PPROD I F : Constrains (lift_set i A) (lift_set i B);  \
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   520
\        i: I;  finite I;  f0: Init (PPROD I F) |]  \
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   521
\     ==> F i : Constrains A B";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   522
by (full_simp_tac (simpset() addsimps [Constrains_def]) 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   523
by (subgoal_tac "ALL i:I. f0 i : reachable (F i)" 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   524
by (blast_tac (claset() addIs [reachable.Init]) 2);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   525
by (dtac PPROD_constrains_projection 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   526
by (assume_tac 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   527
by (asm_full_simp_tac
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   528
    (simpset() addsimps [Applyall_Int_depend, Collect_conj_eq RS sym,
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   529
			 reachable_PPROD_eq]) 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   530
qed "PPROD_Constrains_imp_Constrains";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   531
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   532
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   533
Goal "[| i: I;  finite I;  f0: Init (PPROD I F) |]  \
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   534
\     ==> (PPROD I F : Constrains (lift_set i A) (lift_set i B)) =  \
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   535
\         (F i : Constrains A B)";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   536
by (blast_tac (claset() addIs [Constrains_imp_PPROD_Constrains, 
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   537
			       PPROD_Constrains_imp_Constrains]) 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   538
qed "PPROD_Constrains";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   539
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   540
Goal "[| i: I;  finite I;  f0: Init (PPROD I F) |]  \
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   541
\     ==> (PPROD I F : Stable (lift_set i A)) = (F i : Stable A)";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   542
by (asm_simp_tac (simpset() delsimps [Init_PPROD]
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   543
			    addsimps [Stable_def, PPROD_Constrains]) 1);
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   544
qed "PPROD_Stable";
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   545
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   546
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   547
(** PFUN (no dependence on i) doesn't require the f0 premise **)
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   548
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   549
Goal "i: I ==> Applyall {f. (ALL i:I. f i : R) & f i : A} i = R Int A";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   550
by (force_tac (claset(), simpset() addsimps [Applyall_def]) 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   551
qed "Applyall_Int";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   552
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   553
Goal "[| (PPI x:I. F) : Constrains (lift_set i A) (lift_set i B);  \
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   554
\        i: I;  finite I |]  \
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   555
\     ==> F : Constrains A B";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   556
by (full_simp_tac (simpset() addsimps [Constrains_def]) 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   557
by (dtac PPROD_constrains_projection 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   558
by (assume_tac 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   559
by (asm_full_simp_tac
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   560
    (simpset() addsimps [Applyall_Int, Collect_conj_eq RS sym,
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   561
			 reachable_PPROD_eq]) 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   562
qed "PFUN_Constrains_imp_Constrains";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   563
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   564
Goal "[| i: I;  finite I |]  \
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   565
\     ==> ((PPI x:I. F) : Constrains (lift_set i A) (lift_set i B)) =  \
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   566
\         (F : Constrains A B)";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   567
by (blast_tac (claset() addIs [Constrains_imp_PPROD_Constrains, 
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   568
			       PFUN_Constrains_imp_Constrains]) 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   569
qed "PFUN_Constrains";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   570
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   571
Goal "[| i: I;  finite I |]  \
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   572
\     ==> ((PPI x:I. F) : Stable (lift_set i A)) = (F : Stable A)";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   573
by (asm_simp_tac (simpset() addsimps [Stable_def, PFUN_Constrains]) 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   574
qed "PFUN_Stable";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   575
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   576
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   577
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   578
(*** guarantees properties ***)
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   579
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   580
(*We only need act2=Id but the condition used is very weak*)
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   581
Goal "(x,y): act2 ==> fst_act (act1 Lcopy_act act2) = act1";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   582
by (auto_tac (claset(), simpset() addsimps [fst_act_def, Lcopy_act_def]));
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   583
qed "fst_act_Lcopy_act";
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   584
Addsimps [fst_act_Lcopy_act];
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   585
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   586
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   587
Goal "(Lcopy Rsh F) Join G = Lcopy H ==> EX J. H = F Join J";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   588
by (etac program_equalityE 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   589
by (auto_tac (claset(), simpset() addsimps [Acts_Join]));
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   590
by (res_inst_tac 
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   591
     [("x", "mk_program(Domain (Init G), fst_act `` Acts G)")] exI 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   592
by (rtac program_equalityI 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   593
(*Init*)
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   594
by (simp_tac (simpset() addsimps [Acts_Join]) 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   595
by (blast_tac (claset() addEs [equalityE]) 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   596
(*Now for the Actions*)
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   597
by (dres_inst_tac [("f", "op `` fst_act")] arg_cong 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   598
by (asm_full_simp_tac 
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   599
    (simpset() addsimps [insert_absorb, Acts_Lcopy, Acts_Join,
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   600
			 image_Un, image_compose RS sym, o_def]) 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   601
qed "Lcopy_Join_eq_Lcopy_D";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   602
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   603
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   604
Goal "F : X guarantees Y \
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
   605
\     ==> Lcopy Rsh F : (Lcopy `` X) guarantees (Lcopy `` Y)";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   606
by (rtac guaranteesI 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   607
by Auto_tac;
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   608
by (blast_tac (claset() addDs [Lcopy_Join_eq_Lcopy_D, guaranteesD]) 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   609
qed "Lcopy_guarantees";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   610
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   611
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   612
Goal "drop_act i (lift_act i act) = act";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   613
by (force_tac (claset() addSIs [rinst [("x", "?ff(i := ?u)")] exI],
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   614
	       simpset() addsimps [drop_act_def, lift_act_def]) 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   615
qed "lift_act_inverse";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   616
Addsimps [lift_act_inverse];
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   617
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   618
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   619
Goal "(lift_prog i F) Join G = lift_prog i H \
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   620
\     ==> EX J. H = F Join J";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   621
by (etac program_equalityE 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   622
by (auto_tac (claset(), simpset() addsimps [Acts_lift_prog, Acts_Join]));
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   623
by (res_inst_tac [("x", 
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   624
		   "mk_program(Applyall(Init G) i, drop_act i `` Acts G)")] 
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   625
    exI 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   626
by (rtac program_equalityI 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   627
(*Init*)
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   628
by (simp_tac (simpset() addsimps [Applyall_def]) 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   629
(*Blast_tac can't do HO unification, needed to invent function states*)
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   630
by (fast_tac (claset() addEs [equalityE]) 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   631
(*Now for the Actions*)
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   632
by (dres_inst_tac [("f", "op `` (drop_act i)")] arg_cong 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   633
by (asm_full_simp_tac 
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   634
    (simpset() addsimps [insert_absorb, Acts_Join,
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   635
			 image_Un, image_compose RS sym, o_def]) 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   636
qed "lift_prog_Join_eq_lift_prog_D";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   637
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   638
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   639
Goal "F : X guarantees Y \
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   640
\     ==> lift_prog i F : (lift_prog i `` X) guarantees (lift_prog i `` Y)";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   641
by (rtac guaranteesI 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   642
by Auto_tac;
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   643
by (blast_tac (claset() addDs [lift_prog_Join_eq_lift_prog_D, guaranteesD]) 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   644
qed "lift_prog_guarantees";
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   645
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   646