src/HOL/UNITY/Project.ML
changeset 7947 b999c1ab9327
parent 7915 c7fd7eb3b0ef
child 8002 fb83cbd469bb
equal deleted inserted replaced
7946:95e1de322e82 7947:b999c1ab9327
   400 	       simpset() addsimps [project_act_def]) 2);
   400 	       simpset() addsimps [project_act_def]) 2);
   401 by (force_tac (claset() addIs [reachable.Init],
   401 by (force_tac (claset() addIs [reachable.Init],
   402 	       simpset() addsimps [project_set_def]) 1);
   402 	       simpset() addsimps [project_set_def]) 1);
   403 qed "reachable_project_imp_reachable";
   403 qed "reachable_project_imp_reachable";
   404 
   404 
   405 
       
   406 Goal "project_set h (reachable (extend h F Join G)) = \
   405 Goal "project_set h (reachable (extend h F Join G)) = \
   407 \     reachable (F Join project h (reachable (extend h F Join G)) G)";
   406 \     reachable (F Join project h (reachable (extend h F Join G)) G)";
   408 by (auto_tac (claset() addDs [subset_refl RS reachable_imp_reachable_project,
   407 by (auto_tac (claset() addDs [subset_refl RS reachable_imp_reachable_project,
   409 			      subset_refl RS reachable_project_imp_reachable], 
   408 			      subset_refl RS reachable_project_imp_reachable], 
   410 	      simpset() addsimps [project_set_def]));
   409 	      simpset() addsimps [project_set_def]));
   411 qed "project_set_reachable_extend_eq";
   410 qed "project_set_reachable_extend_eq";
       
   411 
       
   412 Goal "reachable (extend h F Join G) <= C  \
       
   413 \     ==> reachable (extend h F Join G) <= \
       
   414 \         extend_set h (reachable (F Join project h C G))";
       
   415 by (auto_tac (claset() addDs [reachable_imp_reachable_project], 
       
   416 	      simpset()));
       
   417 qed "reachable_extend_Join_subset";
   412 
   418 
   413 (*Perhaps should replace C by reachable...*)
   419 (*Perhaps should replace C by reachable...*)
   414 Goalw [Constrains_def]
   420 Goalw [Constrains_def]
   415      "[| C <= reachable (extend h F Join G);  \
   421      "[| C <= reachable (extend h F Join G);  \
   416 \        extend h F Join G : (extend_set h A) Co (extend_set h B) |] \
   422 \        extend h F Join G : (extend_set h A) Co (extend_set h B) |] \
   470 \   (extend h F Join G : Increasing (func o f))";
   476 \   (extend h F Join G : Increasing (func o f))";
   471 by (asm_simp_tac (simpset() addsimps [Increasing_def, project_Stable,
   477 by (asm_simp_tac (simpset() addsimps [Increasing_def, project_Stable,
   472 				      Collect_eq_extend_set RS sym]) 1);
   478 				      Collect_eq_extend_set RS sym]) 1);
   473 qed "project_Increasing";
   479 qed "project_Increasing";
   474 
   480 
   475 (**
   481 Goal "[| H <= F;  extend h F Join G : (v o f) LocalTo extend h H |] \
   476 Goal "extend h F Join G : (v o f) LocalTo extend h H \
       
   477 \     ==> F Join project h (reachable (extend h F Join G)) G : v LocalTo H";
   482 \     ==> F Join project h (reachable (extend h F Join G)) G : v LocalTo H";
   478 by (asm_full_simp_tac 
   483 by (asm_full_simp_tac 
   479     (simpset() addsimps [LocalTo_def, project_set_reachable_extend_eq RS sym,
   484     (simpset() delsimps [extend_Join]
   480 			 gen_project_localTo_I,
   485 	       addsimps [LocalTo_def, project_set_reachable_extend_eq RS sym,
   481 			 Join_assoc RS sym]) 1);
   486 			 gen_project_localTo_I, extend_Join RS sym, 
   482 
   487 			 Join_assoc RS sym, Join_absorb1]) 1);
   483 qed "project_LocalTo_I";
   488 qed "project_LocalTo_I";
   484 **)
       
   485 
   489 
   486 (** A lot of redundant theorems: all are proved to facilitate reasoning
   490 (** A lot of redundant theorems: all are proved to facilitate reasoning
   487     about guarantees. **)
   491     about guarantees. **)
   488 
   492 
   489 Goalw [projecting_def]
   493 Goalw [projecting_def]
   508      "projecting (%G. reachable (extend h F Join G)) h F \
   512      "projecting (%G. reachable (extend h F Join G)) h F \
   509 \                (Increasing (func o f)) (Increasing func)";
   513 \                (Increasing (func o f)) (Increasing func)";
   510 by (blast_tac (claset() addIs [project_Increasing_I]) 1);
   514 by (blast_tac (claset() addIs [project_Increasing_I]) 1);
   511 qed "projecting_Increasing";
   515 qed "projecting_Increasing";
   512 
   516 
   513 (**
   517 Goalw [projecting_def]
   514 Goalw [projecting_def]
   518      "H <= F ==> projecting (%G. reachable (extend h F Join G)) h F \
   515      "projecting (%G. reachable (extend h F Join G)) h F \
   519 \                           ((v o f) LocalTo extend h H) (v LocalTo H)";
   516 \                ((v o f) LocalTo extend h H) (v LocalTo H)";
       
   517 by (blast_tac (claset() addIs [project_LocalTo_I]) 1);
   520 by (blast_tac (claset() addIs [project_LocalTo_I]) 1);
   518 qed "projecting_LocalTo";
   521 qed "projecting_LocalTo";
   519 **)
       
   520 
   522 
   521 Goalw [extending_def]
   523 Goalw [extending_def]
   522      "extending (%G. reachable (extend h F Join G)) h F X' \
   524      "extending (%G. reachable (extend h F Join G)) h F X' \
   523 \               (extend_set h A Co extend_set h B) (A Co B)";
   525 \               (extend_set h A Co extend_set h B) (A Co B)";
   524 by (blast_tac (claset() addIs [project_Constrains_D]) 1);
   526 by (blast_tac (claset() addIs [project_Constrains_D]) 1);
   623 by (REPEAT (force_tac (claset() addIs [project_unless RS unlessD, unlessI, 
   625 by (REPEAT (force_tac (claset() addIs [project_unless RS unlessD, unlessI, 
   624 				       project_extend_constrains_I], 
   626 				       project_extend_constrains_I], 
   625 		       simpset()) 1));
   627 		       simpset()) 1));
   626 qed_spec_mp "Join_project_ensures";
   628 qed_spec_mp "Join_project_ensures";
   627 
   629 
   628 Goal "[| ALL D. project h C G : transient D --> F : transient D;  \
   630 (** Lemma useful for both STRONG and WEAK progress*)
   629 \        extend h F Join G : stable C;  \
   631 
   630 \        F Join project h C G : A leadsTo B |] \
   632 (*The strange induction formula allows induction over the leadsTo
   631 \     ==> extend h F Join G : (C Int extend_set h A) leadsTo (extend_set h B)";
   633   assumption's non-atomic precondition*)
   632 by (etac leadsTo_induct 1);
       
   633 by (asm_simp_tac (simpset() delsimps UN_simps
       
   634 		  addsimps [Int_UN_distrib, leadsTo_UN, extend_set_Union]) 3);
       
   635 by (blast_tac (claset() addIs [psp_stable RS leadsTo_weaken, 
       
   636 			       leadsTo_Trans]) 2);
       
   637 by (blast_tac (claset() addIs [leadsTo_Basis, Join_project_ensures]) 1);
       
   638 qed "project_leadsTo_lemma";
       
   639 
       
   640 (*Instance of the previous theorem for STRONG progress*)
       
   641 Goal "[| ALL D. project h UNIV G : transient D --> F : transient D;  \
       
   642 \        F Join project h UNIV G : A leadsTo B |] \
       
   643 \     ==> extend h F Join G : (extend_set h A) leadsTo (extend_set h B)";
       
   644 by (dtac project_leadsTo_lemma 1);
       
   645 by Auto_tac;
       
   646 qed "project_UNIV_leadsTo_lemma";
       
   647 
       
   648 (** Towards the analogous theorem for WEAK progress*)
       
   649 
       
   650 Goal "[| ALL D. project h C G : transient D --> F : transient D;  \
   634 Goal "[| ALL D. project h C G : transient D --> F : transient D;  \
   651 \        extend h F Join G : stable C;  \
   635 \        extend h F Join G : stable C;  \
   652 \        F Join project h C G : (project_set h C Int A) leadsTo B |] \
   636 \        F Join project h C G : (project_set h C Int A) leadsTo B |] \
   653 \     ==> extend h F Join G : C Int extend_set h (project_set h C Int A) leadsTo (extend_set h B)";
   637 \     ==> extend h F Join G : \
       
   638 \         C Int extend_set h (project_set h C Int A) leadsTo (extend_set h B)";
   654 by (etac leadsTo_induct 1);
   639 by (etac leadsTo_induct 1);
   655 by (asm_simp_tac (simpset() delsimps UN_simps
   640 by (asm_simp_tac (simpset() delsimps UN_simps
   656 		  addsimps [Int_UN_distrib, leadsTo_UN, extend_set_Union]) 3);
   641 		  addsimps [Int_UN_distrib, leadsTo_UN, extend_set_Union]) 3);
   657 by (blast_tac (claset() addIs [psp_stable RS leadsTo_weaken, 
   642 by (blast_tac (claset() addIs [psp_stable RS leadsTo_weaken, 
   658 			       leadsTo_Trans]) 2);
   643 			       leadsTo_Trans]) 2);
   663 \        extend h F Join G : stable C;  \
   648 \        extend h F Join G : stable C;  \
   664 \        F Join project h C G : (project_set h C Int A) leadsTo B |] \
   649 \        F Join project h C G : (project_set h C Int A) leadsTo B |] \
   665 \     ==> extend h F Join G : (C Int extend_set h A) leadsTo (extend_set h B)";
   650 \     ==> extend h F Join G : (C Int extend_set h A) leadsTo (extend_set h B)";
   666 by (rtac (lemma RS leadsTo_weaken) 1);
   651 by (rtac (lemma RS leadsTo_weaken) 1);
   667 by (auto_tac (claset() addIs [project_set_I], simpset()));
   652 by (auto_tac (claset() addIs [project_set_I], simpset()));
   668 val lemma2 = result();
   653 qed "project_leadsTo_lemma";
   669 
   654 
   670 Goal "[| C = (reachable (extend h F Join G)); \
   655 Goal "[| C = (reachable (extend h F Join G)); \
   671 \        ALL D. project h C G : transient D --> F : transient D;  \
   656 \        ALL D. project h C G : transient D --> F : transient D;  \
   672 \        F Join project h C G : A LeadsTo B |] \
   657 \        F Join project h C G : A LeadsTo B |] \
   673 \     ==> extend h F Join G : (extend_set h A) LeadsTo (extend_set h B)";
   658 \     ==> extend h F Join G : (extend_set h A) LeadsTo (extend_set h B)";
   674 by (asm_full_simp_tac 
   659 by (asm_full_simp_tac 
   675     (simpset() addsimps [LeadsTo_def, lemma2, stable_reachable, 
   660     (simpset() addsimps [LeadsTo_def, project_leadsTo_lemma, stable_reachable, 
   676 			 project_set_reachable_extend_eq]) 1);
   661 			 project_set_reachable_extend_eq]) 1);
   677 qed "Join_project_LeadsTo";
   662 qed "Join_project_LeadsTo";
   678 
   663 
   679 
   664 
   680 (*** GUARANTEES and EXTEND ***)
   665 (*** GUARANTEES and EXTEND ***)
   711 
   696 
   712 (*The raw version*)
   697 (*The raw version*)
   713 val [xguary,project,extend] =
   698 val [xguary,project,extend] =
   714 Goal "[| F : X guarantees Y;  \
   699 Goal "[| F : X guarantees Y;  \
   715 \        !!G. extend h F Join G : X' ==> F Join proj G h G : X;  \
   700 \        !!G. extend h F Join G : X' ==> F Join proj G h G : X;  \
   716 \        !!G. [| F Join proj G h G : Y; extend h F Join G : X'; \
   701 \        !!G. [| F Join proj G h G : Y; extend h F Join G : X' |] \
   717 \                Disjoint UNIV (extend h F) G |] \
       
   718 \             ==> extend h F Join G : Y' |] \
   702 \             ==> extend h F Join G : Y' |] \
   719 \     ==> extend h F : X' guarantees Y'";
   703 \     ==> extend h F : X' guarantees Y'";
   720 by (rtac (xguary RS guaranteesD RS extend RS guaranteesI) 1);
   704 by (rtac (xguary RS guaranteesD RS extend RS guaranteesI) 1);
   721 by (etac project 1);
   705 by (etac project 1);
   722 by (assume_tac 1);
       
   723 by (assume_tac 1);
   706 by (assume_tac 1);
   724 qed "project_guarantees_lemma";
   707 qed "project_guarantees_lemma";
   725 
   708 
   726 Goal "[| F : X guarantees Y;  \
   709 Goal "[| F : X guarantees Y;  \
   727 \        projecting C h F X' X;  extending C h F X' Y' Y |] \
   710 \        projecting C h F X' X;  extending C h F X' Y' Y |] \
   759 by (etac project_guarantees 1);
   742 by (etac project_guarantees 1);
   760 by (rtac extending_increasing 2);
   743 by (rtac extending_increasing 2);
   761 by (rtac projecting_localTo 1);
   744 by (rtac projecting_localTo 1);
   762 qed "extend_localTo_guar_increasing";
   745 qed "extend_localTo_guar_increasing";
   763 
   746 
   764 (**
   747 Goal "[| F : (v LocalTo H) guarantees Increasing func;  H <= F |]  \
   765 Goal "F : (v LocalTo G) guarantees Increasing func  \
   748 \     ==> extend h F : (v o f) LocalTo (extend h H)  \
   766 \     ==> extend h F : (v o f) LocalTo (extend h G)  \
       
   767 \                      guarantees Increasing (func o f)";
   749 \                      guarantees Increasing (func o f)";
   768 by (etac project_guarantees 1);
   750 by (etac project_guarantees 1);
   769 by (rtac extending_Increasing 2);
   751 by (rtac extending_Increasing 2);
   770 by (rtac projecting_LocalTo 1);
   752 by (rtac projecting_LocalTo 1);
   771 by Auto_tac;
   753 by Auto_tac;
   772 qed "extend_LocalTo_guar_Increasing";
   754 qed "extend_LocalTo_guar_Increasing";
   773 **)
       
   774 
   755 
   775 Goal "F : Always A guarantees Always B \
   756 Goal "F : Always A guarantees Always B \
   776 \ ==> extend h F : Always(extend_set h A) guarantees Always(extend_set h B)";
   757 \ ==> extend h F : Always(extend_set h A) guarantees Always(extend_set h B)";
   777 by (etac project_guarantees 1);
   758 by (etac project_guarantees 1);
   778 by (rtac extending_Always 2);
   759 by (rtac extending_Always 2);
   806 qed "localTo_project_transient_transient";
   787 qed "localTo_project_transient_transient";
   807 
   788 
   808 Goal "[| F Join project h UNIV G : A leadsTo B;    \
   789 Goal "[| F Join project h UNIV G : A leadsTo B;    \
   809 \        G : f localTo[UNIV] extend h F |]  \
   790 \        G : f localTo[UNIV] extend h F |]  \
   810 \     ==> extend h F Join G : (extend_set h A) leadsTo (extend_set h B)";
   791 \     ==> extend h F Join G : (extend_set h A) leadsTo (extend_set h B)";
   811 by (rtac project_UNIV_leadsTo_lemma 1);
   792 by (res_inst_tac [("C1", "UNIV")] (project_leadsTo_lemma RS leadsTo_weaken) 1);
   812 by (auto_tac (claset(), 
   793 by (auto_tac (claset(), 
   813          simpset() addsimps [impOfSubs (subset_UNIV RS localTo_anti_mono) RS
   794          simpset() addsimps [localTo_UNIV_imp_localTo RS
   814 			     localTo_project_transient_transient]));
   795 			     localTo_project_transient_transient]));
   815 qed "project_leadsTo_D";
   796 qed "project_leadsTo_D";
   816 
   797 
   817 Goal "[| F Join project h (reachable (extend h F Join G)) G : A LeadsTo B; \
   798 Goal "[| F Join project h (reachable (extend h F Join G)) G : A LeadsTo B; \
   818 \         G : f LocalTo extend h F |]  \
   799 \         G : f LocalTo extend h F |]  \