src/HOL/UNITY/PPROD.ML
changeset 6536 281d44905cab
parent 6451 bc943acc5fda
child 6575 70d758762c50
equal deleted inserted replaced
6535:880f31a62784 6536:281d44905cab
    66 (*blast_tac doesn't use HO unification*)
    66 (*blast_tac doesn't use HO unification*)
    67 by (fast_tac (claset() addIs [component_JN]) 1);
    67 by (fast_tac (claset() addIs [component_JN]) 1);
    68 qed "component_PPROD";
    68 qed "component_PPROD";
    69 
    69 
    70 
    70 
    71 (*** Safety: constrains, stable, invariant ***)
    71 (*** Safety: co, stable, invariant ***)
    72 
    72 
    73 (** 1st formulation of lifting **)
    73 (** 1st formulation of lifting **)
    74 
    74 
    75 Goal "(lift_prog i F : constrains (lift_set i A) (lift_set i B))  =  \
    75 Goal "(lift_prog i F : (lift_set i A) co (lift_set i B))  =  \
    76 \     (F : constrains A B)";
    76 \     (F : A co B)";
    77 by (auto_tac (claset(), 
    77 by (auto_tac (claset(), 
    78 	      simpset() addsimps [constrains_def, Acts_lift_prog]));
    78 	      simpset() addsimps [constrains_def, Acts_lift_prog]));
    79 by (Blast_tac 2);
    79 by (Blast_tac 2);
    80 by (Force_tac 1);
    80 by (Force_tac 1);
    81 qed "lift_prog_constrains_eq";
    81 qed "lift_prog_constrains_eq";
    83 Goal "(lift_prog i F : stable (lift_set i A)) = (F : stable A)";
    83 Goal "(lift_prog i F : stable (lift_set i A)) = (F : stable A)";
    84 by (simp_tac (simpset() addsimps [stable_def, lift_prog_constrains_eq]) 1);
    84 by (simp_tac (simpset() addsimps [stable_def, lift_prog_constrains_eq]) 1);
    85 qed "lift_prog_stable_eq";
    85 qed "lift_prog_stable_eq";
    86 
    86 
    87 (*This one looks strange!  Proof probably is by case analysis on i=j.*)
    87 (*This one looks strange!  Proof probably is by case analysis on i=j.*)
    88 Goal "F i : constrains A B  \
    88 Goal "F i : A co B  \
    89 \     ==> lift_prog j (F j) : constrains (lift_set i A) (lift_set i B)";
    89 \     ==> lift_prog j (F j) : (lift_set i A) co (lift_set i B)";
    90 by (auto_tac (claset(), 
    90 by (auto_tac (claset(), 
    91 	      simpset() addsimps [constrains_def, Acts_lift_prog]));
    91 	      simpset() addsimps [constrains_def, Acts_lift_prog]));
    92 by (REPEAT (Blast_tac 1));
    92 by (REPEAT (Blast_tac 1));
    93 qed "constrains_imp_lift_prog_constrains";
    93 qed "constrains_imp_lift_prog_constrains";
    94 
    94 
    95 Goal "i : I ==>  \
    95 Goal "i : I ==>  \
    96 \     (PPROD I F : constrains (lift_set i A) (lift_set i B))  =  \
    96 \     (PPROD I F : (lift_set i A) co (lift_set i B))  =  \
    97 \     (F i : constrains A B)";
    97 \     (F i : A co B)";
    98 by (asm_simp_tac (simpset() addsimps [PPROD_def, constrains_JN]) 1);
    98 by (asm_simp_tac (simpset() addsimps [PPROD_def, constrains_JN]) 1);
    99 by (blast_tac (claset() addIs [lift_prog_constrains_eq RS iffD1, 
    99 by (blast_tac (claset() addIs [lift_prog_constrains_eq RS iffD1, 
   100 			       constrains_imp_lift_prog_constrains]) 1);
   100 			       constrains_imp_lift_prog_constrains]) 1);
   101 qed "PPROD_constrains";
   101 qed "PPROD_constrains";
   102 
   102 
   105 qed "PPROD_stable";
   105 qed "PPROD_stable";
   106 
   106 
   107 
   107 
   108 (** 2nd formulation of lifting **)
   108 (** 2nd formulation of lifting **)
   109 
   109 
   110 Goal "[| lift_prog i F : constrains AA BB |] \
   110 Goal "[| lift_prog i F : AA co BB |] \
   111 \     ==> F : constrains (Applyall AA i) (Applyall BB i)";
   111 \     ==> F : (Applyall AA i) co (Applyall BB i)";
   112 by (auto_tac (claset(), 
   112 by (auto_tac (claset(), 
   113 	      simpset() addsimps [Applyall_def, constrains_def, 
   113 	      simpset() addsimps [Applyall_def, constrains_def, 
   114 				  Acts_lift_prog]));
   114 				  Acts_lift_prog]));
   115 by (force_tac (claset() addSIs [rinst [("x", "?ff(i := ?u)")] image_eqI],
   115 by (force_tac (claset() addSIs [rinst [("x", "?ff(i := ?u)")] image_eqI],
   116 	       simpset()) 1);
   116 	       simpset()) 1);
   117 qed "lift_prog_constrains_projection";
   117 qed "lift_prog_constrains_projection";
   118 
   118 
   119 Goal "[| PPROD I F : constrains AA BB;  i: I |] \
   119 Goal "[| PPROD I F : AA co BB;  i: I |] \
   120 \     ==> F i : constrains (Applyall AA i) (Applyall BB i)";
   120 \     ==> F i : (Applyall AA i) co (Applyall BB i)";
   121 by (rtac lift_prog_constrains_projection 1);
   121 by (rtac lift_prog_constrains_projection 1);
   122 (*rotate this assumption to be last*)
   122 (*rotate this assumption to be last*)
   123 by (dres_inst_tac [("psi", "PPROD I F : ?C")] asm_rl 1);
   123 by (dres_inst_tac [("psi", "PPROD I F : ?C")] asm_rl 1);
   124 by (asm_full_simp_tac (simpset() addsimps [PPROD_def, constrains_JN]) 1);
   124 by (asm_full_simp_tac (simpset() addsimps [PPROD_def, constrains_JN]) 1);
   125 qed "PPROD_constrains_projection";
   125 qed "PPROD_constrains_projection";
   161 by (auto_tac (claset(),
   161 by (auto_tac (claset(),
   162 	      simpset() addsimps [invariant_def, PPROD_stable]));
   162 	      simpset() addsimps [invariant_def, PPROD_stable]));
   163 qed "PFUN_invariant";
   163 qed "PFUN_invariant";
   164 
   164 
   165 
   165 
   166 (*** Substitution Axiom versions: Constrains, Stable ***)
   166 (*** Substitution Axiom versions: Co, Stable ***)
   167 
   167 
   168 (** Reachability **)
   168 (** Reachability **)
   169 
   169 
   170 Goal "[| f : reachable (PPROD I F);  i : I |] ==> f i : reachable (F i)";
   170 Goal "[| f : reachable (PPROD I F);  i : I |] ==> f i : reachable (F i)";
   171 by (etac reachable.induct 1);
   171 by (etac reachable.induct 1);
   223 			    reachable_PPROD_subset1, 
   223 			    reachable_PPROD_subset1, 
   224 			    reachable_PPROD_subset2]));
   224 			    reachable_PPROD_subset2]));
   225 qed "reachable_PPROD_eq";
   225 qed "reachable_PPROD_eq";
   226 
   226 
   227 
   227 
   228 (** Constrains **)
   228 (** Co **)
   229 
   229 
   230 Goal "[| F i : Constrains A B;  i: I;  finite I |]  \
   230 Goal "[| F i : A Co B;  i: I;  finite I |]  \
   231 \     ==> PPROD I F : Constrains (lift_set i A) (lift_set i B)";
   231 \     ==> PPROD I F : (lift_set i A) Co (lift_set i B)";
   232 by (auto_tac
   232 by (auto_tac
   233     (claset(),
   233     (claset(),
   234      simpset() addsimps [Constrains_def, Collect_conj_eq RS sym,
   234      simpset() addsimps [Constrains_def, Collect_conj_eq RS sym,
   235 			 reachable_PPROD_eq]));
   235 			 reachable_PPROD_eq]));
   236 by (auto_tac (claset(), 
   236 by (auto_tac (claset(), 
   243 \     ==> Applyall ({f. (ALL i:I. f i : R i)} Int lift_set i A) i = R i Int A";
   243 \     ==> Applyall ({f. (ALL i:I. f i : R i)} Int lift_set i A) i = R i Int A";
   244 by (force_tac (claset() addSIs [rinst [("x", "?ff(i := ?u)")] image_eqI],
   244 by (force_tac (claset() addSIs [rinst [("x", "?ff(i := ?u)")] image_eqI],
   245 	       simpset() addsimps [Applyall_def, lift_set_def]) 1);
   245 	       simpset() addsimps [Applyall_def, lift_set_def]) 1);
   246 qed "Applyall_Int_depend";
   246 qed "Applyall_Int_depend";
   247 
   247 
   248 (*Again, we need the f0 premise because otherwise Constrains holds trivially
   248 (*Again, we need the f0 premise because otherwise holds Co trivially
   249   for PPROD I F.*)
   249   for PPROD I F.*)
   250 Goal "[| PPROD I F : Constrains (lift_set i A) (lift_set i B);  \
   250 Goal "[| PPROD I F : (lift_set i A) Co (lift_set i B);  \
   251 \        i: I;  finite I;  f0: Init (PPROD I F) |]  \
   251 \        i: I;  finite I;  f0: Init (PPROD I F) |]  \
   252 \     ==> F i : Constrains A B";
   252 \     ==> F i : A Co B";
   253 by (full_simp_tac (simpset() addsimps [Constrains_def]) 1);
   253 by (full_simp_tac (simpset() addsimps [Constrains_def]) 1);
   254 by (subgoal_tac "ALL i:I. f0 i : reachable (F i)" 1);
   254 by (subgoal_tac "ALL i:I. f0 i : reachable (F i)" 1);
   255 by (blast_tac (claset() addIs [reachable.Init]) 2);
   255 by (blast_tac (claset() addIs [reachable.Init]) 2);
   256 by (dtac PPROD_constrains_projection 1);
   256 by (dtac PPROD_constrains_projection 1);
   257 by (assume_tac 1);
   257 by (assume_tac 1);
   259     (simpset() addsimps [Applyall_Int_depend, reachable_PPROD_eq]) 1);
   259     (simpset() addsimps [Applyall_Int_depend, reachable_PPROD_eq]) 1);
   260 qed "PPROD_Constrains_imp_Constrains";
   260 qed "PPROD_Constrains_imp_Constrains";
   261 
   261 
   262 
   262 
   263 Goal "[| i: I;  finite I;  f0: Init (PPROD I F) |]  \
   263 Goal "[| i: I;  finite I;  f0: Init (PPROD I F) |]  \
   264 \     ==> (PPROD I F : Constrains (lift_set i A) (lift_set i B)) =  \
   264 \     ==> (PPROD I F : (lift_set i A) Co (lift_set i B)) =  \
   265 \         (F i : Constrains A B)";
   265 \         (F i : A Co B)";
   266 by (blast_tac (claset() addIs [Constrains_imp_PPROD_Constrains, 
   266 by (blast_tac (claset() addIs [Constrains_imp_PPROD_Constrains, 
   267 			       PPROD_Constrains_imp_Constrains]) 1);
   267 			       PPROD_Constrains_imp_Constrains]) 1);
   268 qed "PPROD_Constrains";
   268 qed "PPROD_Constrains";
   269 
   269 
   270 Goal "[| i: I;  finite I;  f0: Init (PPROD I F) |]  \
   270 Goal "[| i: I;  finite I;  f0: Init (PPROD I F) |]  \
   279 Goal "i: I \
   279 Goal "i: I \
   280 \     ==> Applyall ({f. (ALL i:I. f i : R)} Int lift_set i A) i = R Int A";
   280 \     ==> Applyall ({f. (ALL i:I. f i : R)} Int lift_set i A) i = R Int A";
   281 by (force_tac (claset(), simpset() addsimps [Applyall_def]) 1);
   281 by (force_tac (claset(), simpset() addsimps [Applyall_def]) 1);
   282 qed "Applyall_Int";
   282 qed "Applyall_Int";
   283 
   283 
   284 Goal "[| (PPI x:I. F) : Constrains (lift_set i A) (lift_set i B);  \
   284 Goal "[| (PPI x:I. F) : (lift_set i A) Co (lift_set i B);  \
   285 \        i: I;  finite I |]  \
   285 \        i: I;  finite I |]  \
   286 \     ==> F : Constrains A B";
   286 \     ==> F : A Co B";
   287 by (full_simp_tac (simpset() addsimps [Constrains_def]) 1);
   287 by (full_simp_tac (simpset() addsimps [Constrains_def]) 1);
   288 by (dtac PPROD_constrains_projection 1);
   288 by (dtac PPROD_constrains_projection 1);
   289 by (assume_tac 1);
   289 by (assume_tac 1);
   290 by (asm_full_simp_tac
   290 by (asm_full_simp_tac
   291     (simpset() addsimps [Applyall_Int, Collect_conj_eq RS sym,
   291     (simpset() addsimps [Applyall_Int, Collect_conj_eq RS sym,
   292 			 reachable_PPROD_eq]) 1);
   292 			 reachable_PPROD_eq]) 1);
   293 qed "PFUN_Constrains_imp_Constrains";
   293 qed "PFUN_Constrains_imp_Constrains";
   294 
   294 
   295 Goal "[| i: I;  finite I |]  \
   295 Goal "[| i: I;  finite I |]  \
   296 \     ==> ((PPI x:I. F) : Constrains (lift_set i A) (lift_set i B)) =  \
   296 \     ==> ((PPI x:I. F) : (lift_set i A) Co (lift_set i B)) =  \
   297 \         (F : Constrains A B)";
   297 \         (F : A Co B)";
   298 by (blast_tac (claset() addIs [Constrains_imp_PPROD_Constrains, 
   298 by (blast_tac (claset() addIs [Constrains_imp_PPROD_Constrains, 
   299 			       PFUN_Constrains_imp_Constrains]) 1);
   299 			       PFUN_Constrains_imp_Constrains]) 1);
   300 qed "PFUN_Constrains";
   300 qed "PFUN_Constrains";
   301 
   301 
   302 Goal "[| i: I;  finite I |]  \
   302 Goal "[| i: I;  finite I |]  \