src/HOL/UNITY/PPROD.ML
author paulson
Thu, 11 Nov 1999 10:25:17 +0100
changeset 8005 b64d86018785
parent 7947 b999c1ab9327
child 8055 bb15396278fb
permissions -rw-r--r--
new-style infix declaration for "image"
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
7188
2bc63a44721b re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents: 6867
diff changeset
     4
    Copyright   1999  University of Cambridge
2bc63a44721b re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents: 6867
diff changeset
     5
2bc63a44721b re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents: 6867
diff changeset
     6
Abstraction over replicated components (PLam)
2bc63a44721b re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents: 6867
diff changeset
     7
General products of programs (Pi operation)
2bc63a44721b re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents: 6867
diff changeset
     8
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
     9
Probably some dead wood here!
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    10
*)
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    11
6020
4b109bf75976 towards handling sharing of variables
paulson
parents: 6012
diff changeset
    12
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
    13
val image_eqI' = read_instantiate_sg (sign_of thy)
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
    14
                     [("x", "?ff(i := ?u)")] image_eqI;
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7689
diff changeset
    15
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    16
(*** Basic properties ***)
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    17
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
    18
Goalw [PLam_def] "Init (PLam I F) = (INT i:I. lift_set i (Init (F i)))";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
    19
by Auto_tac;
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
    20
qed "Init_PLam";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
    21
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
    22
Goal "Acts (PLam I F) = insert Id (UN i:I. lift_act i `` Acts (F i))";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    23
by (auto_tac (claset(),
7537
875754b599df working snapshot
paulson
parents: 7523
diff changeset
    24
	      simpset() addsimps [PLam_def]));
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
    25
qed "Acts_PLam";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    26
7947
b999c1ab9327 working again; new treatment of LocalTo
paulson
parents: 7826
diff changeset
    27
Addsimps [Init_PLam, Acts_PLam];
b999c1ab9327 working again; new treatment of LocalTo
paulson
parents: 7826
diff changeset
    28
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
    29
Goal "PLam {} F = SKIP";
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
    30
by (simp_tac (simpset() addsimps [PLam_def]) 1);
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
    31
qed "PLam_empty";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    32
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
    33
Goal "(plam i: I. SKIP) = SKIP";
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
    34
by (simp_tac (simpset() addsimps [PLam_def,lift_prog_SKIP,JN_constant]) 1);
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
    35
qed "PLam_SKIP";
6299
1a88db6e7c7e UNITY fully working at last...
paulson
parents: 6295
diff changeset
    36
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
    37
Addsimps [PLam_SKIP, PLam_empty];
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    38
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
    39
Goalw [PLam_def]
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
    40
    "PLam (insert i I) F = (lift_prog i (F i)) Join (PLam I F)";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    41
by Auto_tac;
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
    42
qed "PLam_insert";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    43
7947
b999c1ab9327 working again; new treatment of LocalTo
paulson
parents: 7826
diff changeset
    44
Goal "((PLam I F) <= H) = (ALL i: I. lift_prog i (F i) <= H)";
b999c1ab9327 working again; new treatment of LocalTo
paulson
parents: 7826
diff changeset
    45
by (simp_tac (simpset() addsimps [PLam_def, JN_component_iff]) 1);
b999c1ab9327 working again; new treatment of LocalTo
paulson
parents: 7826
diff changeset
    46
qed "PLam_component_iff";
b999c1ab9327 working again; new treatment of LocalTo
paulson
parents: 7826
diff changeset
    47
7399
cf780c2bcccf changed "component" infix in HOL/UNITY/Comp.thy to be overloaded <
paulson
parents: 7361
diff changeset
    48
Goalw [PLam_def] "i : I ==> lift_prog i (F i) <= (PLam I F)";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
    49
(*blast_tac doesn't use HO unification*)
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
    50
by (fast_tac (claset() addIs [component_JN]) 1);
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
    51
qed "component_PLam";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    52
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
    53
7523
3a716ebc2fc0 more rational theorem names (?)
paulson
parents: 7399
diff changeset
    54
(** Safety & Progress **)
6835
588f791ee737 addition of drop_... operators with new results and simplification of old ones
paulson
parents: 6826
diff changeset
    55
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    56
Goal "i : I ==>  \
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
    57
\     (PLam I F : (lift_set i A) co (lift_set i B))  =  \
6536
281d44905cab made many specification operators infix
paulson
parents: 6451
diff changeset
    58
\     (F i : A co B)";
7523
3a716ebc2fc0 more rational theorem names (?)
paulson
parents: 7399
diff changeset
    59
by (asm_simp_tac (simpset() addsimps [PLam_def, JN_constrains]) 1);
7344
d54e871d77e0 new guarantees laws; also better natural deduction style for old ones
paulson
parents: 7188
diff changeset
    60
by (blast_tac (claset() addIs [lift_prog_constrains RS iffD1, 
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
    61
			       constrains_imp_lift_prog_constrains]) 1);
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
    62
qed "PLam_constrains";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    63
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
    64
Goal "i : I ==> (PLam I F : stable (lift_set i A)) = (F i : stable A)";
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
    65
by (asm_simp_tac (simpset() addsimps [stable_def, PLam_constrains]) 1);
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
    66
qed "PLam_stable";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
    67
7523
3a716ebc2fc0 more rational theorem names (?)
paulson
parents: 7399
diff changeset
    68
Goal "i : I ==> \
3a716ebc2fc0 more rational theorem names (?)
paulson
parents: 7399
diff changeset
    69
\   PLam I F : transient A = (EX i:I. lift_prog i (F i) : transient A)";
3a716ebc2fc0 more rational theorem names (?)
paulson
parents: 7399
diff changeset
    70
by (asm_simp_tac (simpset() addsimps [JN_transient, PLam_def]) 1);
3a716ebc2fc0 more rational theorem names (?)
paulson
parents: 7399
diff changeset
    71
qed "PLam_transient";
3a716ebc2fc0 more rational theorem names (?)
paulson
parents: 7399
diff changeset
    72
3a716ebc2fc0 more rational theorem names (?)
paulson
parents: 7399
diff changeset
    73
Addsimps [PLam_constrains, PLam_stable, PLam_transient];
3a716ebc2fc0 more rational theorem names (?)
paulson
parents: 7399
diff changeset
    74
7538
357873391561 new rule PLam_ensures
paulson
parents: 7537
diff changeset
    75
Goal "[| i : I;  F i : A ensures B |] ==>  \
357873391561 new rule PLam_ensures
paulson
parents: 7537
diff changeset
    76
\     PLam I F : (lift_set i A) ensures lift_set i B";
357873391561 new rule PLam_ensures
paulson
parents: 7537
diff changeset
    77
by (auto_tac (claset(), 
357873391561 new rule PLam_ensures
paulson
parents: 7537
diff changeset
    78
	      simpset() addsimps [ensures_def, lift_prog_transient_eq_disj]));
357873391561 new rule PLam_ensures
paulson
parents: 7537
diff changeset
    79
qed "PLam_ensures";
357873391561 new rule PLam_ensures
paulson
parents: 7537
diff changeset
    80
7523
3a716ebc2fc0 more rational theorem names (?)
paulson
parents: 7399
diff changeset
    81
Goal "[| i : I;  F i : (A-B) co (A Un B);  F i : transient (A-B) |] ==>  \
3a716ebc2fc0 more rational theorem names (?)
paulson
parents: 7399
diff changeset
    82
\     PLam I F : (lift_set i A) leadsTo lift_set i B";
7538
357873391561 new rule PLam_ensures
paulson
parents: 7537
diff changeset
    83
by (rtac (PLam_ensures RS leadsTo_Basis) 1);
357873391561 new rule PLam_ensures
paulson
parents: 7537
diff changeset
    84
by (rtac ensuresI 2);
357873391561 new rule PLam_ensures
paulson
parents: 7537
diff changeset
    85
by (ALLGOALS assume_tac);
7523
3a716ebc2fc0 more rational theorem names (?)
paulson
parents: 7399
diff changeset
    86
qed "PLam_leadsTo_Basis";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
    87
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
    88
Goal "[| PLam I F : AA co BB;  i: I |] \
6835
588f791ee737 addition of drop_... operators with new results and simplification of old ones
paulson
parents: 6826
diff changeset
    89
\     ==> F i : (drop_set i AA) co (drop_set i BB)";
7188
2bc63a44721b re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents: 6867
diff changeset
    90
by (rtac lift_prog_constrains_drop_set 1);
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
    91
(*rotate this assumption to be last*)
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
    92
by (dres_inst_tac [("psi", "PLam I F : ?C")] asm_rl 1);
7523
3a716ebc2fc0 more rational theorem names (?)
paulson
parents: 7399
diff changeset
    93
by (asm_full_simp_tac (simpset() addsimps [PLam_def, JN_constrains]) 1);
7188
2bc63a44721b re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents: 6867
diff changeset
    94
qed "PLam_constrains_drop_set";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    95
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
    96
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
    97
(** invariant **)
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
    98
6299
1a88db6e7c7e UNITY fully working at last...
paulson
parents: 6295
diff changeset
    99
Goal "[| F i : invariant A;  i : I |] \
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   100
\     ==> PLam I F : invariant (lift_set i A)";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   101
by (auto_tac (claset(),
7523
3a716ebc2fc0 more rational theorem names (?)
paulson
parents: 7399
diff changeset
   102
	      simpset() addsimps [invariant_def]));
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   103
qed "invariant_imp_PLam_invariant";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   104
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   105
(*The f0 premise ensures that the product is well-defined.*)
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   106
Goal "[| PLam I F : invariant (lift_set i A);  i : I;  \
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   107
\        f0: Init (PLam I F) |] ==> F i : invariant A";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   108
by (auto_tac (claset(),
7523
3a716ebc2fc0 more rational theorem names (?)
paulson
parents: 7399
diff changeset
   109
	      simpset() addsimps [invariant_def]));
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   110
by (dres_inst_tac [("c", "f0(i:=x)")] subsetD 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   111
by Auto_tac;
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   112
qed "PLam_invariant_imp_invariant";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   113
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   114
Goal "[| i : I;  f0: Init (PLam I F) |] \
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   115
\     ==> (PLam I F : invariant (lift_set i A)) = (F i : invariant A)";
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   116
by (blast_tac (claset() addIs [invariant_imp_PLam_invariant, 
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   117
			       PLam_invariant_imp_invariant]) 1);
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   118
qed "PLam_invariant";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   119
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   120
(*The f0 premise isn't needed if F is a constant program because then
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   121
  we get an initial state by replicating that of F*)
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   122
Goal "i : I \
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   123
\     ==> ((plam x:I. F) : invariant (lift_set i A)) = (F : invariant A)";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   124
by (auto_tac (claset(),
7523
3a716ebc2fc0 more rational theorem names (?)
paulson
parents: 7399
diff changeset
   125
	      simpset() addsimps [invariant_def]));
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   126
qed "const_PLam_invariant";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   127
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   128
7947
b999c1ab9327 working again; new treatment of LocalTo
paulson
parents: 7826
diff changeset
   129
(** localTo **)
b999c1ab9327 working again; new treatment of LocalTo
paulson
parents: 7826
diff changeset
   130
b999c1ab9327 working again; new treatment of LocalTo
paulson
parents: 7826
diff changeset
   131
Goal "(PLam I F) : (sub i) localTo[C] lift_prog i (F i)";
b999c1ab9327 working again; new treatment of LocalTo
paulson
parents: 7826
diff changeset
   132
by (simp_tac (simpset() addsimps [LOCALTO_def, Diff_def, extend_def, 
b999c1ab9327 working again; new treatment of LocalTo
paulson
parents: 7826
diff changeset
   133
				  stable_def, constrains_def]) 1);
b999c1ab9327 working again; new treatment of LocalTo
paulson
parents: 7826
diff changeset
   134
by (Force_tac 1);
b999c1ab9327 working again; new treatment of LocalTo
paulson
parents: 7826
diff changeset
   135
qed "PLam_sub_localTo";
b999c1ab9327 working again; new treatment of LocalTo
paulson
parents: 7826
diff changeset
   136
b999c1ab9327 working again; new treatment of LocalTo
paulson
parents: 7826
diff changeset
   137
7188
2bc63a44721b re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents: 6867
diff changeset
   138
(** Reachability **)
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   139
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   140
Goal "[| f : reachable (PLam I F);  i : I |] ==> f i : reachable (F i)";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   141
by (etac reachable.induct 1);
7947
b999c1ab9327 working again; new treatment of LocalTo
paulson
parents: 7826
diff changeset
   142
by (auto_tac (claset() addIs reachable.intrs, simpset()));
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   143
qed "reachable_PLam";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   144
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   145
(*Result to justify a re-organization of this file*)
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   146
Goal "{f. ALL i:I. f i : R i} = (INT i:I. lift_set i (R i))";
6867
7cb9d3250db7 expandshort
paulson
parents: 6842
diff changeset
   147
by Auto_tac;
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   148
result();
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   149
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   150
Goal "reachable (PLam I F) <= (INT i:I. lift_set i (reachable (F i)))";
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   151
by (force_tac (claset() addSDs [reachable_PLam], simpset()) 1);
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   152
qed "reachable_PLam_subset1";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   153
6826
02c4dd469ec0 many new results for reachable and lift_prog
paulson
parents: 6646
diff changeset
   154
(*simplify using reachable_lift_prog??*)
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   155
Goal "[| i ~: I;  A : reachable (F i) |]     \
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   156
\  ==> ALL f. f : reachable (PLam I F)      \
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   157
\             --> f(i:=A) : reachable (lift_prog i (F i) Join PLam I F)";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   158
by (etac reachable.induct 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   159
by (ALLGOALS Clarify_tac);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   160
by (etac reachable.induct 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   161
(*Init, Init case*)
6826
02c4dd469ec0 many new results for reachable and lift_prog
paulson
parents: 6646
diff changeset
   162
by (force_tac (claset() addIs reachable.intrs, simpset()) 1);
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   163
(*Init of F, action of PLam F case*)
7947
b999c1ab9327 working again; new treatment of LocalTo
paulson
parents: 7826
diff changeset
   164
by (res_inst_tac [("act","act")] reachable.Acts 1);
7537
875754b599df working snapshot
paulson
parents: 7523
diff changeset
   165
by (Force_tac 1);
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   166
by (assume_tac 1);
7947
b999c1ab9327 working again; new treatment of LocalTo
paulson
parents: 7826
diff changeset
   167
by (force_tac (claset() addIs [ext], simpset()) 1);
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   168
(*induction over the 2nd "reachable" assumption*)
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   169
by (eres_inst_tac [("xa","f")] reachable.induct 1);
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   170
(*Init of PLam F, action of F case*)
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   171
by (res_inst_tac [("act","lift_act i act")] reachable.Acts 1);
7537
875754b599df working snapshot
paulson
parents: 7523
diff changeset
   172
by (Force_tac 1);
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   173
by (force_tac (claset() addIs [reachable.Init], simpset()) 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   174
by (force_tac (claset() addIs [ext], simpset() addsimps [lift_act_def]) 1);
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   175
(*last case: an action of PLam I F*)
7947
b999c1ab9327 working again; new treatment of LocalTo
paulson
parents: 7826
diff changeset
   176
by (res_inst_tac [("act","acta")] reachable.Acts 1);
7537
875754b599df working snapshot
paulson
parents: 7523
diff changeset
   177
by (Force_tac 1);
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   178
by (assume_tac 1);
7947
b999c1ab9327 working again; new treatment of LocalTo
paulson
parents: 7826
diff changeset
   179
by (force_tac (claset() addIs [ext], simpset()) 1);
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   180
qed_spec_mp "reachable_lift_Join_PLam";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   181
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   182
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   183
(*The index set must be finite: otherwise infinitely many copies of F can
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   184
  perform actions, and PLam can never catch up in finite time.*)
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   185
Goal "finite I \
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   186
\     ==> (INT i:I. lift_set i (reachable (F i))) <= reachable (PLam I F)";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   187
by (etac finite_induct 1);
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   188
by (Simp_tac 1);
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   189
by (force_tac (claset() addDs [reachable_lift_Join_PLam], 
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   190
	       simpset() addsimps [PLam_insert]) 1);
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   191
qed "reachable_PLam_subset2";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   192
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   193
Goal "finite I ==> \
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   194
\     reachable (PLam I F) = (INT i:I. lift_set i (reachable (F i)))";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   195
by (REPEAT_FIRST (ares_tac [equalityI,
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   196
			    reachable_PLam_subset1, 
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   197
			    reachable_PLam_subset2]));
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   198
qed "reachable_PLam_eq";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   199
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   200
6536
281d44905cab made many specification operators infix
paulson
parents: 6451
diff changeset
   201
(** Co **)
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   202
6536
281d44905cab made many specification operators infix
paulson
parents: 6451
diff changeset
   203
Goal "[| F i : A Co B;  i: I;  finite I |]  \
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   204
\     ==> PLam I F : (lift_set i A) Co (lift_set i B)";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   205
by (auto_tac
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   206
    (claset(),
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   207
     simpset() addsimps [Constrains_def, Collect_conj_eq RS sym,
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   208
			 reachable_PLam_eq]));
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   209
by (auto_tac (claset(), 
7537
875754b599df working snapshot
paulson
parents: 7523
diff changeset
   210
              simpset() addsimps [constrains_def, PLam_def]));
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   211
by (REPEAT (blast_tac (claset() addIs reachable.intrs) 1));
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   212
qed "Constrains_imp_PLam_Constrains";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   213
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   214
Goal "[| ALL j:I. f0 j : A j;   i: I |] \
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   215
\     ==> drop_set i (INT j:I. lift_set j (A j)) = A i";
7523
3a716ebc2fc0 more rational theorem names (?)
paulson
parents: 7399
diff changeset
   216
by (force_tac (claset() addSIs [image_eqI'],
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   217
	       simpset() addsimps [drop_set_def]) 1);
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   218
qed "drop_set_INT_lift_set";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   219
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   220
(*Again, we need the f0 premise so that PLam I F has an initial state;
6575
70d758762c50 new definitions of Co and LeadsTo
paulson
parents: 6536
diff changeset
   221
  otherwise its Co-property is vacuous.*)
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   222
Goal "[| PLam I F : (lift_set i A) Co (lift_set i B);  \
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   223
\        i: I;  finite I;  f0: Init (PLam I F) |]  \
6536
281d44905cab made many specification operators infix
paulson
parents: 6451
diff changeset
   224
\     ==> F i : A Co B";
6575
70d758762c50 new definitions of Co and LeadsTo
paulson
parents: 6536
diff changeset
   225
by (full_simp_tac (simpset() addsimps [Constrains_eq_constrains]) 1);
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   226
by (subgoal_tac "ALL i:I. f0 i : reachable (F i)" 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   227
by (blast_tac (claset() addIs [reachable.Init]) 2);
7188
2bc63a44721b re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents: 6867
diff changeset
   228
by (dtac PLam_constrains_drop_set 1);
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   229
by (assume_tac 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   230
by (asm_full_simp_tac
7523
3a716ebc2fc0 more rational theorem names (?)
paulson
parents: 7399
diff changeset
   231
    (simpset() addsimps [drop_set_Int_lift_set2,
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   232
			 drop_set_INT_lift_set, reachable_PLam_eq]) 1);
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   233
qed "PLam_Constrains_imp_Constrains";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   234
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   235
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   236
Goal "[| i: I;  finite I;  f0: Init (PLam I F) |]  \
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   237
\     ==> (PLam I F : (lift_set i A) Co (lift_set i B)) =  \
6536
281d44905cab made many specification operators infix
paulson
parents: 6451
diff changeset
   238
\         (F i : A Co B)";
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   239
by (blast_tac (claset() addIs [Constrains_imp_PLam_Constrains, 
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   240
			       PLam_Constrains_imp_Constrains]) 1);
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   241
qed "PLam_Constrains";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   242
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   243
Goal "[| i: I;  finite I;  f0: Init (PLam I F) |]  \
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   244
\     ==> (PLam I F : Stable (lift_set i A)) = (F i : Stable A)";
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   245
by (asm_simp_tac (simpset() delsimps [Init_PLam]
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   246
			    addsimps [Stable_def, PLam_Constrains]) 1);
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   247
qed "PLam_Stable";
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   248
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   249
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   250
(** const_PLam (no dependence on i) doesn't require the f0 premise **)
5899
13d4753079fe new theory PPROD
paulson
parents:
diff changeset
   251
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   252
Goal "[| (plam x:I. F) : (lift_set i A) Co (lift_set i B);  \
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   253
\        i: I;  finite I |]  \
6536
281d44905cab made many specification operators infix
paulson
parents: 6451
diff changeset
   254
\     ==> F : A Co B";
6575
70d758762c50 new definitions of Co and LeadsTo
paulson
parents: 6536
diff changeset
   255
by (full_simp_tac (simpset() addsimps [Constrains_eq_constrains]) 1);
7188
2bc63a44721b re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents: 6867
diff changeset
   256
by (dtac PLam_constrains_drop_set 1);
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   257
by (assume_tac 1);
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   258
by (asm_full_simp_tac
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   259
    (simpset() addsimps [drop_set_INT,
7523
3a716ebc2fc0 more rational theorem names (?)
paulson
parents: 7399
diff changeset
   260
			 drop_set_Int_lift_set2, Collect_conj_eq RS sym,
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   261
			 reachable_PLam_eq]) 1);
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   262
qed "const_PLam_Constrains_imp_Constrains";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   263
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   264
Goal "[| i: I;  finite I |]  \
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   265
\     ==> ((plam x:I. F) : (lift_set i A) Co (lift_set i B)) =  \
6536
281d44905cab made many specification operators infix
paulson
parents: 6451
diff changeset
   266
\         (F : A Co B)";
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   267
by (blast_tac (claset() addIs [Constrains_imp_PLam_Constrains, 
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   268
			       const_PLam_Constrains_imp_Constrains]) 1);
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   269
qed "const_PLam_Constrains";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   270
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   271
Goal "[| i: I;  finite I |]  \
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   272
\     ==> ((plam x:I. F) : Stable (lift_set i A)) = (F : Stable A)";
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   273
by (asm_simp_tac (simpset() addsimps [Stable_def, const_PLam_Constrains]) 1);
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   274
qed "const_PLam_Stable";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   275
7188
2bc63a44721b re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents: 6867
diff changeset
   276
Goalw [Increasing_def]
2bc63a44721b re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents: 6867
diff changeset
   277
     "[| i: I;  finite I |]  \
2bc63a44721b re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents: 6867
diff changeset
   278
\     ==> ((plam x:I. F) : Increasing (f o sub i)) = (F : Increasing f)";
2bc63a44721b re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents: 6867
diff changeset
   279
by (subgoal_tac "ALL z. {s. z <= (f o sub i) s} = lift_set i {s. z <= f s}" 1);
2bc63a44721b re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents: 6867
diff changeset
   280
by (asm_simp_tac (simpset() addsimps [lift_set_sub]) 2);
2bc63a44721b re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents: 6867
diff changeset
   281
by (asm_full_simp_tac
2bc63a44721b re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents: 6867
diff changeset
   282
    (simpset() addsimps [finite_lessThan, const_PLam_Stable]) 1);
2bc63a44721b re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents: 6867
diff changeset
   283
qed "const_PLam_Increasing";
5972
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   284
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   285
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   286
(*** guarantees properties ***)
2430ccbde87d guarantees laws
paulson
parents: 5899
diff changeset
   287
6842
56e08e264961 renamed PPI to plam
paulson
parents: 6835
diff changeset
   288
Goalw [PLam_def]
7689
affe0c2fdfbf working snapshot (even Alloc)
paulson
parents: 7538
diff changeset
   289
    "[| lift_prog i (F i): X guarantees Y;  i : I |]  \
7361
477e1bdf230f changed "guar" back to "guarantees" (sorry)
paulson
parents: 7344
diff changeset
   290
\    ==> (PLam I F) : X guarantees Y";
7344
d54e871d77e0 new guarantees laws; also better natural deduction style for old ones
paulson
parents: 7188
diff changeset
   291
by (asm_simp_tac (simpset() addsimps [guarantees_JN_I]) 1);
d54e871d77e0 new guarantees laws; also better natural deduction style for old ones
paulson
parents: 7188
diff changeset
   292
qed "guarantees_PLam_I";