theory Basic_Assn imports "Refine_Imperative_HOL.Sepref_HOL_Bindings" "Refine_Imperative_HOL.Sepref_Basic" begin
section"Auxilary imperative assumptions"
text"The following auxiliary assertion types and lemmas were provided by Peter Lammich"
subsection‹List-Assn›
lemma list_assn_cong[fundef_cong]: "[ xs=xs'; ys=ys'; ∧x y. [ x∈set xs; y∈set ys ]==> A x y = A' x y ]==> list_assn A xs ys = list_assn A' xs' ys'" by (induction xs ys arbitrary: xs' ys' rule: list_assn.induct) auto
lemma list_assn_app_one: "list_assn P (l1@[x]) (l1'@[y]) = list_assn P l1 l1' * P x y" by simp
(* ------------------ ADDED by NM in course of btree_imp -------- *)
lemma list_assn_len: "h ⊨ list_assn A xs ys ==> length xs = length ys" using list_assn_aux_ineq_len by fastforce
lemma list_assn_append_Cons_left: "list_assn A (xs@x#ys) zs = (∃A zs1 z zs2. list_assn A xs zs1 * A x z * list_assn A ys zs2 * ↑(zs1@z#zs2 = zs))" by (sep_auto simp add: list_assn_aux_cons_conv list_assn_aux_append_conv1 intro!: ent_iffI)
lemma list_assn_aux_append_Cons: shows"length xs = length zsl ==> list_assn A (xs@x#ys) (zsl@z#zsr) = (list_assn A xs zsl * A x z * list_assn A ys zsr) " by (sep_auto simp add: mult.assoc)
lemma list_assn_prod_split: "list_assn (λx y. P x y * Q x y) as bs = list_assn P as bs * list_assn Q as bs" proof(cases "length as = length bs") case True thenshow ?thesis proof (induction rule: list_induct2) case Nil thenshow ?caseby sep_auto next case (Cons x xs y ys) show ?case proof (rule ent_iffI, goal_cases) case1 thenshow ?case using Cons by sep_auto next case2 thenshow ?case using Cons by sep_auto qed qed next case False thenshow ?thesis by (simp add: list_assn_aux_ineq_len) qed
lemma prod_assn_cong[fundef_cong]: "[ p=p'; pi=pi'; A (fst p) (fst pi) = A' (fst p) (fst pi); B (snd p) (snd pi) = B' (snd p) (snd pi) ] ==> (A×aB) p pi = (A'×aB') p' pi'" apply (cases p; cases pi) by auto
subsection‹Assertions and Magic Wand›
lemma entails_preI: "(∧h. h ⊨ P ==> P ==>A Q) ==> P ==>A Q" unfolding entails_def by auto
lemma ent_true_drop_true: "P*true==>AQ*true ==> P*R*true==>AQ*true" using assn_aci(10) ent_true_drop(1) by presburger
(* TODO *) lemma rem_true: "P*true ==>A Q*true ==> P ==>AQ*true" using enttD enttI_true by blast
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.