definition
valterm_update :: "'key :: typerep \ (unit \ Code_Evaluation.term) \ 'value :: typerep \ (unit \ Code_Evaluation.term) \
('key, 'value) alist \<times> (unit \<Rightarrow> Code_Evaluation.term) \<Rightarrow>
('key, 'value) alist \<times> (unit \<Rightarrow> Code_Evaluation.term)" where
[code_unfold]: "valterm_update k v a = Code_Evaluation.valtermify update {\} k {\} v {\}a"
fun random_aux_alist where "random_aux_alist i j =
(if i = 0 then Pair valterm_empty
else Quickcheck_Random.collapse
(Random.select_weight
[(i, Quickcheck_Random.random j \<circ>\<rightarrow> (\<lambda>k. Quickcheck_Random.random j \<circ>\<rightarrow>
(\<lambda>v. random_aux_alist (i - 1) j \<circ>\<rightarrow> (\<lambda>a. Pair (valterm_update k v a))))),
(1, Pair valterm_empty)]))"
end
instantiation alist :: (random, random) random begin
definition random_alist where "random_alist i = random_aux_alist i i"
instance ..
end
instantiation alist :: (exhaustive, exhaustive) exhaustive begin
fun exhaustive_alist :: "(('a, 'b) alist \ (bool \ term list) option) \ natural \ (bool \ term list) option" where "exhaustive_alist f i =
(if i = 0 then None
else case f empty of
Some ts \<Rightarrow> Some ts
| None \<Rightarrow>
exhaustive_alist
(\<lambda>a. Quickcheck_Exhaustive.exhaustive
(\<lambda>k. Quickcheck_Exhaustive.exhaustive (\<lambda>v. f (update k v a)) (i - 1)) (i - 1))
(i - 1))"
instance ..
end
instantiation alist :: (full_exhaustive, full_exhaustive) full_exhaustive begin
fun full_exhaustive_alist :: "(('a, 'b) alist \ (unit \ term) \ (bool \ term list) option) \ natural \
(bool \<times> term list) option" where "full_exhaustive_alist f i =
(if i = 0 then None
else case f valterm_empty of
Some ts \<Rightarrow> Some ts
| None \<Rightarrow>
full_exhaustive_alist
(\<lambda>a.
Quickcheck_Exhaustive.full_exhaustive
(\<lambda>k. Quickcheck_Exhaustive.full_exhaustive (\<lambda>v. f (valterm_update k v a)) (i - 1))
(i - 1))
(i - 1))"
instance ..
end
section \<open>alist is a BNF\<close>
lift_bnf (dead 'k, set: 'v) alist [wits: "[] :: ('k \ 'v) list"] for map: map rel: rel by auto
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.