definition single :: "'a => 'a random_pred" where"single x = Pair (Predicate.single x)"
definition bind :: "'a random_pred ==> ('a ==> 'b random_pred) ==> 'b random_pred" where "bind R f = (λs. let (P, s') = R s; (s1, s2) = Random.split_seed s' in (Predicate.bind P (%a. fst (f a s1)), s2))"
definition union :: "'a random_pred ==> 'a random_pred ==> 'a random_pred" where "union R1 R2 = (λs. let (P1, s') = R1 s; (P2, s'') = R2 s' in (sup_class.sup P1 P2, s''))"
definition if_randompred :: "bool ==> unit random_pred" where "if_randompred b = (if b then single () else empty)"
definition iterate_upto :: "(natural ==> 'a) => natural ==> natural ==> 'a random_pred" where "iterate_upto f n m = Pair (Predicate.iterate_upto f n m)"
definition not_randompred :: "unit random_pred ==> unit random_pred" where "not_randompred P = (λs. let (P', s') = P s in if Predicate.eval P' () then (Orderings.bot, s') else (Predicate.single (), s'))"
definition Random :: "(Random.seed ==> ('a × (unit ==> term)) × Random.seed) ==> 'a random_pred" where"Random g = scomp g (Pair ∘ (Predicate.single ∘ fst))"
definition map :: "('a ==> 'b) ==> 'a random_pred ==> 'b random_pred" where"map f P = bind P (single ∘ f)"
hide_const (open) iter' iter empty single bind union if_randompred
iterate_upto not_randompred Random map
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.