lemma member_transfer: assumes [transfer_rule]: "bi_unique A" shows"(A ===> list_all2 A ===> (=)) (\x xs. x \ set xs) (\x xs. x \ set xs)" by transfer_prover
end
syntax "_fset" :: "args => 'a fset" (\<open>(\<open>indent=2 notation=\<open>mixfix finite set enumeration\<close>\<close>{|_|})\<close>)
syntax_consts "_fset" == fcons translations "{|x, xs|}" == "CONST fcons x {|xs|}" "{|x|}" == "CONST fcons x {||}"
lift_definition fmember :: "'a \ 'a fset \ bool" (infix \|\|\ 50) is "\x xs. x \ set xs"
parametric member_transfer by simp
abbreviation notin_fset :: "'a \ 'a fset \ bool" (infix \|\|\ 50) where "x |\| S \ \ (x |\| S)"
lemma fmember_fmap[simp]: "a |\| fmap f X = (\b. b |\| X \ a = f b)" by transfer auto
subsection \<open>Using transfer with type \<open>fset\<close>\<close>
text\<open>The correspondence relation \<open>cr_fset\<close> can only relate \<open>list\<close> and \<open>fset\<close> types with the same element type. To relate nested types like \<open>'a list list\<close> and \<open>'a fset fset\<close>, we define a parameterized version of the
correspondence relation, \<open>pcr_fset\<close>.\<close>
thm pcr_fset_def
subsection \<open>Transfer examples\<close>
text\<open>The \<open>transfer\<close> method replaces equality on \<open>fset\<close> with the \<open>list_eq\<close> relation on lists, which is
logically equivalent.\<close>
lemma"fmap f (fmap g xs) = fmap (f \ g) xs" apply transfer apply simp done
text\<open>The \<open>transfer'\<close> variant can replace equality on \<open>fset\<close> with equality on \<open>list\<close>, which is logically stronger
but sometimes more convenient.\<close>
lemma"fmap f (fmap g xs) = fmap (f \ g) xs" using map_map [Transfer.transferred] .
lemma"ffilter p (fmap f xs) = fmap f (ffilter (p \ f) xs)" using filter_map [Transfer.transferred] .
lemma"ffilter p (ffilter q xs) = ffilter (\x. q x \ p x) xs" using filter_filter [Transfer.transferred] .
lemma"fset (fcons x xs) = insert x (fset xs)" using list.set(2) [Transfer.transferred] .
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.