ϵ">]>
Literature.
[1] J. Komara. Specification and Verification of Programs. Downloadable lecture notes available through the web page of the course.
[2] J. Komara and P. J. Voda. Metamathematics of Computer Programming. 2001.
[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
[CL] Structural case analysis on binary trees. Syntax:
Example(s):
where , and are new variables (eigen-variables).
Structural induction on binary trees. (1 point) Show that the principle of structural induction over binary trees is admissible in Peano arithmetic.
Remark. Prove the claim for the special case in the following theory.
[CL] Hint. Reduce structural induction on to course of values induction with measure . Recall that the pair size function , written as |x|, is defined in the module Standard.
[CL] Structural induction on binary trees. Syntax:
where the induction formula is formed from the current sequent.
Example(s):
where , and are new variables (eigen-variables).
where , and are new variables (eigen-variables).
[CL] Structural induction on binary trees (2nd form). Syntax:
where the induction formula is formed from the current sequent.
Example(s):
where , and are new variables (eigen-variables).
where , and are new variables (eigen-variables).
Exercise. Prove
[CL] Hint. In the proof you will need the following simple properties of the maximum function:
Max_le |
Spec_max_ge |
Exp2_max |
Exercise. Save the concatenation in the definition of the function with help of an accumulator function and verify your implementation.
Exercise. Save the concatenation in the definition of the function with help of an accumulator function and verify your implementation.
Exercise. (3 points) Define the function such that
Hint. Define first an auxiliary function such that
[CL] Hint. In the proof you will need the following property of exponentiation
Exp2_is_not_zero |
from the module Maux*.
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.
Isomorphic binary trees. Given binary trees and , the predicate holds if the trees and are isomorphic (of the same shape).
Exercise. (2 points) Define the function such that
Verify your implementation!
Remark. Implement the function with the help of the size function .
Hint. Define first an auxiliary function such that
Exercise. Define the function such that
Verify your implementation!
Remark. Implement the function with the help of the size function .