ϵ">]>
[CL] Discrimination on the constructors of general trees. Example(s):
[CL] Formatting the output. Use the format to display numbers as general trees. Try out the following simple queries
223759839492 = t:Gt
1,1,(1,2,0),(1,3,0),(1,4,0),0 = t:Gt
Use the format to display numbers as lists of such trees.
Membership in general trees. Define the predicate which holds if the number is a member of the tree .
Isomorphic general trees. Given general trees and , the predicate holds if the trees and are of the same shape (isomorphic).
Fast program for the reflection function. Save the concatenation in the definition of the reflection function.
Fast programs for tree traversals. Save the concatenation in the definition of each tree traversal function.
Problem. Given a tree, create a new tree of the same shape, but with the values at the nodes replaced by the numbers 0,1,2... in a fixed order.
Exercise. Define the function such that
Remark. Implement the function with the help of the size function .
Hint. Define first an auxiliary function such that