src/HOL/UNITY/Project.ML
changeset 9403 aad13b59b8d9
parent 9337 58bd51302b21
child 9610 7dd6a1661bc9
equal deleted inserted replaced
9402:480a1b40fdd6 9403:aad13b59b8d9
    30 (*Generalizes project_constrains to the program F Join project h C G;
    30 (*Generalizes project_constrains to the program F Join project h C G;
    31   useful with guarantees reasoning*)
    31   useful with guarantees reasoning*)
    32 Goal "(F Join project h C G : A co B)  =  \
    32 Goal "(F Join project h C G : A co B)  =  \
    33 \       (extend h F Join G : (C Int extend_set h A) co (extend_set h B) &  \
    33 \       (extend h F Join G : (C Int extend_set h A) co (extend_set h B) &  \
    34 \        F : A co B)";
    34 \        F : A co B)";
    35 by (simp_tac (simpset() addsimps [Join_constrains, project_constrains]) 1);
    35 by (simp_tac (simpset() addsimps [project_constrains]) 1);
    36 by (blast_tac (claset() addIs [extend_constrains RS iffD2 RS constrains_weaken]
    36 by (blast_tac (claset() addIs [extend_constrains RS iffD2 RS constrains_weaken]
    37                         addDs [constrains_imp_subset]) 1);
    37                         addDs [constrains_imp_subset]) 1);
    38 qed "Join_project_constrains";
    38 qed "Join_project_constrains";
    39 
    39 
    40 (*The condition is required to prove the left-to-right direction;
    40 (*The condition is required to prove the left-to-right direction;
    42 Goalw [stable_def]
    42 Goalw [stable_def]
    43      "extend h F Join G : stable C \
    43      "extend h F Join G : stable C \
    44 \     ==> (F Join project h C G : stable A)  =  \
    44 \     ==> (F Join project h C G : stable A)  =  \
    45 \         (extend h F Join G : stable (C Int extend_set h A) &  \
    45 \         (extend h F Join G : stable (C Int extend_set h A) &  \
    46 \          F : stable A)";
    46 \          F : stable A)";
    47 by (simp_tac (simpset() addsimps [Join_project_constrains]) 1);
    47 by (simp_tac (HOL_ss addsimps [Join_project_constrains]) 1);
    48 by (blast_tac (claset() addIs [constrains_weaken] addDs [constrains_Int]) 1);
    48 by (blast_tac (claset() addIs [constrains_weaken] addDs [constrains_Int]) 1);
    49 qed "Join_project_stable";
    49 qed "Join_project_stable";
    50 
    50 
    51 (*For using project_guarantees in particular cases*)
    51 (*For using project_guarantees in particular cases*)
    52 Goal "extend h F Join G : extend_set h A co extend_set h B \
    52 Goal "extend h F Join G : extend_set h A co extend_set h B \
    53 \     ==> F Join project h C G : A co B";
    53 \     ==> F Join project h C G : A co B";
    54 by (asm_full_simp_tac
    54 by (asm_full_simp_tac
    55     (simpset() addsimps [project_constrains, Join_constrains, 
    55     (simpset() addsimps [project_constrains, extend_constrains]) 1);
    56 			 extend_constrains]) 1);
       
    57 by (blast_tac (claset() addIs [constrains_weaken]
    56 by (blast_tac (claset() addIs [constrains_weaken]
    58 			addDs [constrains_imp_subset]) 1);
    57 			addDs [constrains_imp_subset]) 1);
    59 qed "project_constrains_I";
    58 qed "project_constrains_I";
    60 
    59 
    61 Goalw [increasing_def, stable_def]
    60 Goalw [increasing_def, stable_def]
    62      "extend h F Join G : increasing (func o f) \
    61      "extend h F Join G : increasing (func o f) \
    63 \     ==> F Join project h C G : increasing func";
    62 \     ==> F Join project h C G : increasing func";
    64 by (asm_full_simp_tac (simpset() addsimps [project_constrains_I, 
    63 by (asm_full_simp_tac (simpset_of SubstAx.thy
    65 					   extend_set_eq_Collect]) 1);
    64 		 addsimps [project_constrains_I, extend_set_eq_Collect]) 1);
    66 qed "project_increasing_I";
    65 qed "project_increasing_I";
    67 
    66 
    68 Goal "(F Join project h UNIV G : increasing func)  =  \
    67 Goal "(F Join project h UNIV G : increasing func)  =  \
    69 \     (extend h F Join G : increasing (func o f))";
    68 \     (extend h F Join G : increasing (func o f))";
    70 by (rtac iffI 1);
    69 by (rtac iffI 1);
    71 by (etac project_increasing_I 2);
    70 by (etac project_increasing_I 2);
    72 by (asm_full_simp_tac 
    71 by (asm_full_simp_tac (simpset_of SubstAx.thy
    73     (simpset() addsimps [increasing_def, Join_project_stable]) 1);
    72 		         addsimps [increasing_def, Join_project_stable]) 1);
    74 by (auto_tac (claset(),
    73 by (auto_tac (claset(),
    75 	      simpset() addsimps [Join_stable, extend_set_eq_Collect,
    74 	      simpset() addsimps [extend_set_eq_Collect,
    76 				  extend_stable RS iffD1]));
    75 				  extend_stable RS iffD1]));
    77 qed "Join_project_increasing";
    76 qed "Join_project_increasing";
    78 
    77 
    79 (*The UNIV argument is essential*)
    78 (*The UNIV argument is essential*)
    80 Goal "F Join project h UNIV G : A co B \
    79 Goal "F Join project h UNIV G : A co B \
    81 \     ==> extend h F Join G : extend_set h A co extend_set h B";
    80 \     ==> extend h F Join G : extend_set h A co extend_set h B";
    82 by (asm_full_simp_tac
    81 by (asm_full_simp_tac
    83     (simpset() addsimps [project_constrains, Join_constrains, 
    82     (simpset() addsimps [project_constrains, extend_constrains]) 1);
    84 			 extend_constrains]) 1);
       
    85 qed "project_constrains_D";
    83 qed "project_constrains_D";
    86 
    84 
    87 
    85 
    88 (*** "projecting" and union/intersection (no converses) ***)
    86 (*** "projecting" and union/intersection (no converses) ***)
    89 
    87 
   190 by (rtac extending_constrains 1);
   188 by (rtac extending_constrains 1);
   191 qed "extending_stable";
   189 qed "extending_stable";
   192 
   190 
   193 Goalw [extending_def]
   191 Goalw [extending_def]
   194      "extending v (%G. UNIV) h F (increasing (func o f)) (increasing func)";
   192      "extending v (%G. UNIV) h F (increasing (func o f)) (increasing func)";
   195 by (simp_tac (simpset() addsimps [Join_project_increasing]) 1);
   193 by (simp_tac (HOL_ss addsimps [Join_project_increasing]) 1);
   196 qed "extending_increasing";
   194 qed "extending_increasing";
   197 
   195 
   198 
   196 
   199 (** Reachability and project **)
   197 (** Reachability and project **)
   200 
   198 
   214 qed "reachable_imp_reachable_project";
   212 qed "reachable_imp_reachable_project";
   215 
   213 
   216 Goalw [Constrains_def]
   214 Goalw [Constrains_def]
   217      "F Join project h (reachable (extend h F Join G)) G : A Co B  \
   215      "F Join project h (reachable (extend h F Join G)) G : A Co B  \
   218 \     ==> extend h F Join G : (extend_set h A) Co (extend_set h B)";
   216 \     ==> extend h F Join G : (extend_set h A) Co (extend_set h B)";
   219 by (full_simp_tac (simpset() addsimps [Join_project_constrains]) 1);
   217 by (full_simp_tac (simpset_of SubstAx.thy addsimps [Join_project_constrains]) 1);
   220 by (Clarify_tac 1);
   218 by (Clarify_tac 1);
   221 by (etac constrains_weaken 1);
   219 by (etac constrains_weaken 1);
   222 by (auto_tac (claset() addIs [reachable_imp_reachable_project], simpset()));
   220 by (auto_tac (claset() addIs [reachable_imp_reachable_project], simpset()));
   223 qed "project_Constrains_D";
   221 qed "project_Constrains_D";
   224 
   222 
   275 qed "reachable_extend_Join_subset";
   273 qed "reachable_extend_Join_subset";
   276 
   274 
   277 Goalw [Constrains_def]
   275 Goalw [Constrains_def]
   278      "extend h F Join G : (extend_set h A) Co (extend_set h B)  \
   276      "extend h F Join G : (extend_set h A) Co (extend_set h B)  \
   279 \     ==> F Join project h (reachable (extend h F Join G)) G : A Co B";
   277 \     ==> F Join project h (reachable (extend h F Join G)) G : A Co B";
   280 by (full_simp_tac (simpset() addsimps [Join_project_constrains, 
   278 by (full_simp_tac (simpset_of SubstAx.thy addsimps [Join_project_constrains, 
   281 				       extend_set_Int_distrib]) 1);
   279 				       extend_set_Int_distrib]) 1);
   282 by (rtac conjI 1);
   280 by (rtac conjI 1);
   283 by (force_tac
   281 by (force_tac
   284     (claset() addEs [constrains_weaken_L]
   282     (claset() addEs [constrains_weaken_L]
   285               addSDs [extend_constrains_project_set,
   283               addSDs [extend_constrains_project_set,
   286 		      subset_refl RS reachable_project_imp_reachable], 
   284 		      subset_refl RS reachable_project_imp_reachable], 
   287      simpset() addsimps [Join_constrains]) 2);
   285      simpset()) 2);
   288 by (blast_tac (claset() addIs [constrains_weaken_L]) 1);
   286 by (blast_tac (claset() addIs [constrains_weaken_L]) 1);
   289 qed "project_Constrains_I";
   287 qed "project_Constrains_I";
   290 
   288 
   291 Goalw [Stable_def]
   289 Goalw [Stable_def]
   292      "extend h F Join G : Stable (extend_set h A)  \
   290      "extend h F Join G : Stable (extend_set h A)  \
   419 Goal "[| extend h F : stable C;  G : stable C;  \
   417 Goal "[| extend h F : stable C;  G : stable C;  \
   420 \        extend h F Join G : A ensures B;  A-B = C Int extend_set h D |]  \
   418 \        extend h F Join G : A ensures B;  A-B = C Int extend_set h D |]  \
   421 \     ==> F Join project h C G  \
   419 \     ==> F Join project h C G  \
   422 \           : (project_set h C Int project_set h A) ensures (project_set h B)";
   420 \           : (project_set h C Int project_set h A) ensures (project_set h B)";
   423 by (asm_full_simp_tac
   421 by (asm_full_simp_tac
   424     (simpset() addsimps [ensures_def, Join_constrains, project_constrains, 
   422     (simpset() addsimps [ensures_def, project_constrains, 
   425 			 Join_transient, extend_transient]) 1);
   423 			 Join_transient, extend_transient]) 1);
   426 by (Clarify_tac 1);
   424 by (Clarify_tac 1);
   427 by (REPEAT_FIRST (rtac conjI));
   425 by (REPEAT_FIRST (rtac conjI));
   428 (*first subgoal*)
   426 (*first subgoal*)
   429 by (blast_tac (claset() addIs [extend_stable_project_set RS stableD RS 
   427 by (blast_tac (claset() addIs [extend_stable_project_set RS stableD RS 
   461 by (blast_tac (claset() addIs [subset_imp_ensures]) 2);
   459 by (blast_tac (claset() addIs [subset_imp_ensures]) 2);
   462 by (auto_tac (claset() addDs [extend_transient RS iffD2] 
   460 by (auto_tac (claset() addDs [extend_transient RS iffD2] 
   463                        addIs [transient_strengthen, project_set_I,
   461                        addIs [transient_strengthen, project_set_I,
   464 			      project_unless RS unlessD, unlessI, 
   462 			      project_unless RS unlessD, unlessI, 
   465 			      project_extend_constrains_I], 
   463 			      project_extend_constrains_I], 
   466 	      simpset() addsimps [ensures_def, Join_constrains,
   464 	      simpset() addsimps [ensures_def, Join_transient]));
   467 				  Join_stable, Join_transient]));
       
   468 qed_spec_mp "Join_project_ensures";
   465 qed_spec_mp "Join_project_ensures";
   469 
   466 
   470 (** Lemma useful for both STRONG and WEAK progress, but the transient
   467 (** Lemma useful for both STRONG and WEAK progress, but the transient
   471     condition's very strong **)
   468     condition's very strong **)
   472 
   469 
   496 Goal "[| C = (reachable (extend h F Join G)); \
   493 Goal "[| C = (reachable (extend h F Join G)); \
   497 \        ALL D. project h C G : transient D --> D={};  \
   494 \        ALL D. project h C G : transient D --> D={};  \
   498 \        F Join project h C G : A LeadsTo B |] \
   495 \        F Join project h C G : A LeadsTo B |] \
   499 \     ==> extend h F Join G : (extend_set h A) LeadsTo (extend_set h B)";
   496 \     ==> extend h F Join G : (extend_set h A) LeadsTo (extend_set h B)";
   500 by (asm_full_simp_tac 
   497 by (asm_full_simp_tac 
   501     (simpset() addsimps [LeadsTo_def, project_leadsTo_D_lemma, 
   498     (simpset_of SubstAx.thy addsimps [LeadsTo_def, project_leadsTo_D_lemma, 
   502 			 project_set_reachable_extend_eq]) 1);
   499 			 project_set_reachable_extend_eq]) 1);
   503 qed "Join_project_LeadsTo";
   500 qed "Join_project_LeadsTo";
   504 
   501 
   505 
   502 
   506 (*** Towards project_Ensures_D ***)
   503 (*** Towards project_Ensures_D ***)
   507 
       
   508 
   504 
   509 
   505 
   510 Goalw [project_set_def, extend_set_def, project_act_def]
   506 Goalw [project_set_def, extend_set_def, project_act_def]
   511      "act ^^ (C Int extend_set h A) <= B \
   507      "act ^^ (C Int extend_set h A) <= B \
   512 \     ==> project_act h (Restrict C act) ^^ (project_set h C Int A) \
   508 \     ==> project_act h (Restrict C act) ^^ (project_set h C Int A) \
   558 \        extend h F Join G : stable C |] \
   554 \        extend h F Join G : stable C |] \
   559 \     ==> extend h F Join G : (C Int extend_set h A) ensures (extend_set h B)";
   555 \     ==> extend h F Join G : (C Int extend_set h A) ensures (extend_set h B)";
   560 (*unless*)
   556 (*unless*)
   561 by (auto_tac (claset() addSIs [rewrite_rule [unless_def] project_unless2] 
   557 by (auto_tac (claset() addSIs [rewrite_rule [unless_def] project_unless2] 
   562                        addIs [project_extend_constrains_I], 
   558                        addIs [project_extend_constrains_I], 
   563 	      simpset() addsimps [ensures_def, Join_constrains,
   559 	      simpset() addsimps [ensures_def]));
   564 				  Join_stable]));
       
   565 (*transient*)
   560 (*transient*)
   566 by (auto_tac (claset(), simpset() addsimps [Join_transient]));
   561 by (auto_tac (claset(), simpset() addsimps [Join_transient]));
   567 by (blast_tac (claset() addIs [stable_project_transient]) 2);
   562 by (blast_tac (claset() addIs [stable_project_transient]) 2);
   568 by (force_tac (claset() addSEs [extend_transient RS iffD2 RS 
   563 by (force_tac (claset() addSEs [extend_transient RS iffD2 RS 
   569 				transient_strengthen], 
   564 				transient_strengthen],