header {* \isaheader{Upgrading VCG Instantiations} *} theory VCG_Upgrades = VCG_Correctness + VCG_Completeness + VCG_Invariant: section {* Upgrading Correctness Requirements *} subsection {* Refining wellformedness checker *} theorem upgrade_wf: assumes wf_refine: "\ \. wlf' \ \ wlf \" assumes old: "correctVCG initS effS TT FF And Imp valid provable ipc anF succsF wlf initF wpF" shows new: "correctVCG initS effS TT FF And Imp valid provable ipc anF succsF wlf' initF wpF" proof - (*<*) from old have old_SafetyLogic: "SafetyLogic TT FF And Imp valid" by (simp only: correctVCG_def) from old have old_CFG: "CFG_axioms anF succsF wlf" by (simp only: correctVCG_def) from old have old_AbsSem: "AbsSem_axioms valid ipc wlf initF" by (simp only: correctVCG_def) from old have old_correctVCG_ax: "correctVCG_axioms initS effS TT valid provable anF succsF wlf initF wpF" by (simp only: correctVCG_def) from wf_refine old_CFG have new_CFG: "CFG_axioms anF succsF wlf'" by (simp add: CFG_axioms_def) from wf_refine old_AbsSem have new_AbsSem:"AbsSem_axioms valid ipc wlf' initF" by (simp add: AbsSem_axioms_def) from wf_refine old_correctVCG_ax have new_correctVCG_ax:"correctVCG_axioms initS effS TT valid provable anF succsF wlf' initF wpF" by (simp add: correctVCG_axioms_def) from old_SafetyLogic new_CFG new_AbsSem new_correctVCG_ax show "correctVCG initS effS TT FF And Imp valid provable ipc anF succsF wlf' initF wpF" by (simp add: correctVCG_def) qed (*>*) subsection {* Refining successor function *} theorem upgrade_succsF: assumes wf_F: "\ \. wlf \ \ (\ s \ {s. \ s0. s0 \ initS \ \ (s0,s) \ (effS \)\<^sup>*}. (valid \ s (F \ (fst s))))" assumes succsF'_def: "succsF' = (\ \ p. map (\ (p',B). (p',And [B, F \ p])) (succsF \ p))" assumes old: "correctVCG initS effS TT FF And Imp valid provable ipc anF succsF wlf initF wpF" shows new: "correctVCG initS effS TT FF And Imp valid provable ipc anF succsF' wlf initF wpF" (*<*) proof - from succsF'_def have succsF'_succsF: "\ \ p p' B. (p',B) \ set (succsF' \ p) \ (\ B'. (p',B') \ set (succsF \ p) \ B = And [B',F \ p])" apply - apply simp apply (erule imageE) apply (simp add: split_def split_paired_all) apply fastsimp done from succsF'_def have succsF_succsF': "\ \ p p' B. (p',B) \ set (succsF \ p) \ (p',And [B,F \ p]) \ set (succsF' \ p)" by fastsimp from old have old_SafetyLogic: "SafetyLogic TT FF And Imp valid" by (simp add: correctVCG_def) from old_SafetyLogic have old_semConj: "\ \ s L. valid \ s (And L) = (\f\set L. valid \ s f)" apply - apply (unfold SafetyLogic_def) apply (erule conjE)+ apply (erule_tac x="\" in allE) apply (erule_tac x="s" in allE) apply (erule_tac x="L" in allE) apply assumption done from old_SafetyLogic have old_semImpE: "\ \ s f1 f2. valid \ s (Imp f1 f2) \ (valid \ s f1 \ valid \ s f2)" apply - apply (subgoal_tac "\\ s f1 f2. valid \ s (Imp f1 f2) \ valid \ s f1 \ valid \ s f2") prefer 2 apply (unfold SafetyLogic_def) apply (erule conjE)+ apply assumption apply (erule_tac x="\" in allE) apply (erule_tac x="s" in allE) apply (erule_tac x="f1" in allE) apply (erule_tac x="f2" in allE) apply (erule_tac V="?A \ ?B" in thin_rl) apply (simp only: simp_thms) done from old have old_CFG: "CFG_axioms anF succsF wlf" by (simp only: correctVCG_def) from old_CFG have old_wlf_anF: "\ \. wlf \ \ enoughAn succsF \ anF" apply - apply (unfold CFG_axioms_def) apply assumption done from old_wlf_anF have new_wlf_anF: "(\\. wlf \ \ enoughAn succsF' \ anF)" apply - apply (simp add: enoughAn_def isCycle_def) apply (rule allI | rule impI)+ apply (erule_tac x="\" in allE) apply simp apply (erule_tac x="l" in allE) apply (subgoal_tac "\ l. l \ paths (succsF' \) \ l \ paths (succsF \)") prefer 2 apply (rule allI) apply (rule impI) apply (erule paths.induct) apply (simp add: succsF'_def) apply (erule imageE) apply (simp add: split_def split_paired_all) apply (rule paths.intros) apply assumption apply (drule succsF'_succsF) apply (erule exE | erule conjE)+ apply (rule paths.step) apply assumption apply assumption apply simp done from new_wlf_anF have new_CFG: "CFG_axioms anF succsF' wlf" by (simp add: CFG_axioms_def) from old have old_AbsSem: "AbsSem_axioms valid ipc wlf initF" by (simp only: correctVCG_def) from old have old_correctVCG_ax: "correctVCG_axioms initS effS TT valid provable anF succsF wlf initF wpF" by (simp only: correctVCG_def) from old_correctVCG_ax have old_succsFcomplete: "\ \ s s'. wlf \ \ s \ ReachableFromInv (effS \) (initS \) {s. valid \ s (case anF \ (fst s) of None \ TT | Some An \ An)} \ (s,s') \ (effS \) \ (\ B. (fst s',B) \ set (succsF \ (fst s)) \ valid \ s B)" apply - apply (unfold correctVCG_axioms_def) apply (erule conjE)+ apply assumption done have new_succsFcomplete: "\ \ s s'. wlf \ \ s \ (ReachableFromInv (effS \) (initS \) {s. valid \ s (case anF \ (fst s) of None \ TT | Some An \ An)}) \ (s, s') \ effS \ \ (\B. (fst s', B) \ set (succsF' \ (fst s)) \ valid \ s B)" proof (intro allI impI) fix \ s s' assume s_ReachableFromInv: "s \ (ReachableFromInv (effS \) (initS \) {s. valid \ s (case anF \ (fst s) of None \ TT | Some An \ An)})" assume wf_Pi: "wlf \" assume s_s'_effS: "(s,s') \ effS \" show "\B. (fst s', B) \ set (succsF' \ (fst s)) \ valid \ s B" proof - from wf_Pi s_ReachableFromInv s_s'_effS have old_succsF: "\B. (fst s', B) \ set (succsF \ (fst s)) \ valid \ s B" by (rule old_succsFcomplete[rule_format]) from wf_Pi s_ReachableFromInv wf_F have valid_s_F: "valid \ s (F \ (fst s))" apply - apply (erule_tac x="\" in allE) apply (drule ReachableFromInv_ReachableFrom) apply (simp only: ReachableFrom_conv) apply (erule exE)+ apply fastsimp done from old_succsF succsF_succsF' valid_s_F show ?thesis apply atomize apply (erule exE) apply (rule_tac x="And [B, F \ (fst s)]" in exI) apply (erule_tac x="fst s'" in allE) apply (erule_tac x="B" in allE) apply (erule_tac x="\" in allE) apply (erule_tac x="fst s" in allE) apply (simp add: old_semConj) done qed qed from old_correctVCG_ax new_succsFcomplete have new_correctVCG_ax :"correctVCG_axioms initS effS TT valid provable anF succsF' wlf initF wpF" by (simp add: correctVCG_axioms_def) from old_SafetyLogic new_CFG old_AbsSem new_correctVCG_ax show "correctVCG initS effS TT FF And Imp valid provable ipc anF succsF' wlf initF wpF" by (simp add: correctVCG_def) qed (*>*) end