diff --git a/thys/Case_Labeling/Examples/Hoare/Labeled_Hoare.thy b/thys/Case_Labeling/Examples/Hoare/Labeled_Hoare.thy --- a/thys/Case_Labeling/Examples/Hoare/Labeled_Hoare.thy +++ b/thys/Case_Labeling/Examples/Hoare/Labeled_Hoare.thy @@ -1,83 +1,83 @@ theory Labeled_Hoare imports "../../Case_Labeling" "HOL-Hoare.Hoare_Logic" begin subsection \A labeling VCG for HOL/Hoare\ context begin interpretation Labeling_Syntax . lemma LSeqRule: assumes "C\IC,CT,OC1: Valid P c1 Q\" and "C\Suc OC1,CT,OC: Valid Q c2 R\" shows "C\IC,CT,OC: Valid P (c1; c2) R\" using assms unfolding LABEL_simps by (rule SeqRule) lemma LSkipRule: assumes "V\(''weaken'', IC, []),CT: p \ q\" shows "C\IC,CT,IC: Valid p SKIP q\" using assms unfolding LABEL_simps by (rule SkipRule) lemmas LAbortRule = LSkipRule \ \dummy version\ lemma LBasicRule: assumes "V\(''basic'', IC, []),CT: p \ {s. f s \ q}\" shows "C\IC,CT,IC: Valid p (Basic f) q\" using assms unfolding LABEL_simps by (rule BasicRule) lemma LCondRule: fixes IC CT defines "CT' \ (''cond'', IC, []) # CT " assumes "V\(''vc'', IC, []),(''cond'', IC, []) # CT: p \ {s. (s \ b \ s \ w) \ (s \ b \ s \ w')}\" and "C\Suc IC,(''then'', IC, []) # (''cond'', IC, []) # CT,OC1: Valid w c1 q\" and "C\Suc OC1,(''else'', Suc OC1, []) # (''cond'', IC, []) # CT,OC: Valid w' c2 q\" shows "C\IC,CT,OC: Valid p (IF b THEN c1 ELSE c2 FI) q\" using assms(2-) unfolding LABEL_simps by (rule CondRule) lemma LWhileRule: fixes IC CT defines "CT' \ (''while'', IC, []) # CT" assumes "V\(''precondition'', IC, []),(''while'', IC, []) # CT: p \ i\" and "C\Suc IC,(''invariant'', Suc IC, []) # (''while'', IC, []) # CT,OC: Valid (i \ b) c i\" and "V\(''postcondition'', IC, []),(''while'', IC, []) # CT: i \ - b \ q\" - shows "C\IC,CT,OC: Valid p (While b i c) q\" + shows "C\IC,CT,OC: Valid p (While b i v c) q\" using assms(2-) unfolding LABEL_simps by (rule WhileRule) lemma LABELs_to_prems: "(C\IC, CT, OC: True\ \ P) \ C\IC, CT, OC: P\" "(V\x, ct: True\ \ P) \ V\x, ct: P\" unfolding LABEL_simps by simp_all lemma LABELs_to_concl: "C\IC, CT, OC: True\ \ C\IC, CT, OC: P\ \ P" "V\x, ct: True\ \ V\x, ct: P\ \ P" unfolding LABEL_simps . end ML_file \labeled_hoare_tac.ML\ method_setup labeled_vcg = \ Scan.succeed (fn ctxt => SIMPLE_METHOD' (Labeled_Hoare.hoare_tac ctxt (K all_tac)))\ "verification condition generator" method_setup labeled_vcg_simp = \ Scan.succeed (fn ctxt => SIMPLE_METHOD' (Labeled_Hoare.hoare_tac ctxt (asm_full_simp_tac ctxt)))\ "verification condition generator" method_setup casified_vcg = \ Scan.lift (Casify.casify_options casify_defs) >> (fn opt => fn ctxt => Util.SIMPLE_METHOD_CASES ( HEADGOAL (Labeled_Hoare.hoare_tac ctxt (K all_tac)) THEN_CONTEXT Casify.casify_tac opt)) \ method_setup casified_vcg_simp = \ Scan.lift (Casify.casify_options casify_defs) >> (fn opt => fn ctxt => Util.SIMPLE_METHOD_CASES ( HEADGOAL (Labeled_Hoare.hoare_tac ctxt (asm_full_simp_tac ctxt)) THEN_CONTEXT Casify.casify_tac opt)) \ end