ϵ">]>
Literature.
[1] Downloadable lecture notes available through the web page of the course.
[2] J. Komara and P. J. Voda. Lecture Notes in Theory of Computability. 2001.
[3] P. J. Voda. Theory of Recursive Functions & Computability. 2000.
[4] I. Korec. Uvod do teorie algoritmov. MFF UK. Bratislava. 1983.
Minimum. The following component contains explicit definition of the minimum function in clausal form:
[CL] Remark. Here is an example of syntactically incorrect definition of the same function:
This is because the first application of the minimum function is syntactically different from the second . They should be identical as it is in the above definition.
Median. Define the ternary function which yields the median, i.e. the middle number, of the numbers , and . The function satisfies:
[CL] Discrimination on the constructors of binary trees. Example(s):
[CL] Formatting the output. Use the format to display numbers as binary trees. Try out the following simple queries
171386336145149 = t:Bt
1,10,(1,11,(0,0),0,0),(1,12,(0,0),0,0) = t:Bt
Size of binary trees. The application yields the number of nodes in the binary tree . The operation is defined by structural recursion on binary trees as follows:
Depth of binary trees. Define the function which yields the depth of the binary tree .
Hint. Define the operation by structural recursion on binary trees.
Membership in binary trees. The predicate holds if the number is an element of the binary tree . The predicate satisfies
and it is defined by structural recursion on binary trees as follows:
Reflection function. Define the function which yields the mirror's image of the binary tree .
Hint. Define the operation by structural recursion on binary trees.
Subtrees. The predicate holds if the binary tree is a subtree of the binary tree . The predicate satisfies
and it is defined by structural recursion on the binary tree as follows:
Binary search trees. The predicate holds if is a binary search tree. The predicate satisfies
and it is defined explicitly as follows: