subsection \<open>Induction principle and case distinction\<close>
lemma dlist_induct [case_names empty insert, induct type: dlist]: assumes empty: "P Dlist.empty" assumes insrt: "\x dxs. \ Dlist.member dxs x \ P dxs \ P (Dlist.insert x dxs)" shows"P dxs" proof (cases dxs) case (Abs_dlist xs) thenhave"distinct xs"and dxs: "dxs = Dlist xs" by (simp_all add: Dlist_def distinct_remdups_id) from\<open>distinct xs\<close> have "P (Dlist xs)" proof (induct xs) case Nil from empty show ?caseby (simp add: Dlist.empty_def) next case (Cons x xs) thenhave"\ Dlist.member (Dlist xs) x" and "P (Dlist xs)" by (simp_all add: Dlist.member_def) with insrt have"P (Dlist.insert x (Dlist xs))" . with Cons show ?caseby (simp add: Dlist.insert_def distinct_remdups_id) qed with dxs show"P dxs"by simp qed
lemma dlist_case [cases type: dlist]: obtains (empty) "dxs = Dlist.empty"
| (insert) x dys where"\ Dlist.member dys x" and "dxs = Dlist.insert x dys" proof (cases dxs) case (Abs_dlist xs) thenhave dxs: "dxs = Dlist xs"and distinct: "distinct xs" by (simp_all add: Dlist_def distinct_remdups_id) show thesis proof (cases xs) case Nil with dxs have"dxs = Dlist.empty"by (simp add: Dlist.empty_def) with empty show ?thesis . next case (Cons x xs) with dxs distinct have"\ Dlist.member (Dlist xs) x" and"dxs = Dlist.insert x (Dlist xs)" by (simp_all add: Dlist.member_def Dlist.insert_def distinct_remdups_id) with insert show ?thesis . qed qed
subsection \<open>Functorial structure\<close>
functor map: map by (simp_all add: remdups_map_remdups fun_eq_iff dlist_eq_iff)
qualified inductive double :: "'a list \ 'a list \ bool" where "double (xs @ ys) (xs @ x # ys)"if"x \ set ys"
qualified lemma strong_confluentp_double: "strong_confluentp double" proof fix xs ys zs :: "'a list" assume ys: "double xs ys"and zs: "double xs zs"
consider (left) as y bs z cs where"xs = as @ bs @ cs""ys = as @ y # bs @ cs""zs = as @ bs @ z # cs""y \ set (bs @ cs)" "z \ set cs"
| (right) as y bs z cs where"xs = as @ bs @ cs""ys = as @ bs @ y # cs""zs = as @ z # bs @ cs""y \ set cs" "z \ set (bs @ cs)" proof - show thesis using ys zs by(clarsimp simp add: double.simps append_eq_append_conv2)(auto intro: that) qed thenshow"\us. double\<^sup>*\<^sup>* ys us \ double\<^sup>=\<^sup>= zs us" proof cases case left let ?us = "as @ y # bs @ z # cs" have"double ys ?us""double zs ?us"using left by(auto 4 4 simp add: double.simps)(metis append_Cons append_assoc)+ thenshow ?thesis by blast next case right let ?us = "as @ z # bs @ y # cs" have"double ys ?us""double zs ?us"using right by(auto 4 4 simp add: double.simps)(metis append_Cons append_assoc)+ thenshow ?thesis by blast qed qed
qualified lemma double_Cons1 [simp]: "double xs (x # xs)"if"x \ set xs" using double.intros[of x xs "[]"] that by simp
lemma list_of_dlist_map_dlist[simp]: "list_of_dlist (map_dlist f xs) = remdups (map f (list_of_dlist xs))" by transfer (auto simp: remdups_map_remdups)
end
end
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet)
¤
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 ist noch experimentell.