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" (‹(‹indent=2 notation=‹mixfix finite set enumeration›\›{|_|})›)
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
text‹The correspondence relation ‹cr_fset›can only relate ‹list›and ‹fset› types with the same element type. To relate nested types like ‹'a list list›and ‹'a fset fset›, we define a parameterized version of the correspondence relation, ‹pcr_fset›.›
thm pcr_fset_def
subsection‹Transfer examples›
text‹The ‹transfer›method replaces equality on ‹fset› with the ‹list_eq› relation on lists, which is logically equivalent.›
lemma"fmap f (fmap g xs) = fmap (f ∘ g) xs" apply transfer apply simp done
text‹The ‹transfer'›variant can replace equality on ‹fset› with equality on ‹list›, which is logically stronger but sometimes more convenient.›
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 und die Messung sind noch experimentell.