1 (* Let's define an infinite tree whose nodes are made of natural value and an *)
2 (* infinite forest of infinite trees whose nodes ... *)
4 (* (obbrobrio_tree n) is used to build such a tree whose root value is n and *)
5 (* root forest is made of the corecursively defined tress whose roots values *)
6 (* are (n+1), (n+2), ... *)
8 (* To finish, we provide also some destructors and a funny (?!?) theorem *)
10 CoInductive tree : Set :=
11 node : nat -> forest -> tree
14 | cons : tree -> forest -> forest.
16 CoFixpoint obbrobrio_tree : nat -> tree :=
18 (node n (obbrobrio_forest (S n) nil))
19 with obbrobrio_forest : nat -> forest -> forest :=
21 (cons (obbrobrio_tree n) (obbrobrio_forest (S n) f)).
23 Definition root_value : tree -> nat :=
29 Definition root_forest : tree -> forest :=
35 Definition root_tree : forest -> tree :=
38 nil => (obbrobrio_tree (S (S (S O))))
42 Theorem easy : (root_value (root_tree (root_forest (obbrobrio_tree O))))=(S O).