theory Simple_Nesting imports"HOL-Library.BNF_Corec" begin
subsection‹Corecursion via Map Functions›
consts
g :: 'a
g' :: 'a
g'' :: 'a
h :: 'a
h' :: 'a
q :: 'a
q' :: 'a
codatatype tree =
Node nat "tree list"
(* a direct, intuitive way to define a function *)
corec k0 where "k0 x = Node (g x) (map (λy. if q y then g' y else k0 (h' y :: 'a)) (h (x :: 'a) :: nat list))"
(* another way -- this one is perhaps less intuitive but more systematic *)
corec k0' where "k0' x = Node (g x) (map (λz. case z of Inl t ==> t | Inr (x' :: 'a) ==> k0' x') (map (λy. if q y then Inl (g' y) else Inr (h' y)) (h (x :: 'a) :: nat list)))"
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.