Write these up and submit them to the class dropbox, before lecture. =========================================================================== Monotonicicy of the transfer function A transfer function is not required to be monotonic, but the lub function must be monotonic. Why must the lub function be monotonic? What might go wrong if lub is not monotonic? Give an example of a lub function that is not monotonic and that causes the problem. Using the same lattice and a lub function that is monotonic, show that the problem does not occur. =========================================================================== Reasoning about programs Stein's algorithm (https://en.wikipedia.org/wiki/Binary_GCD_algorithm) computes the greatest common divisor (GCD) of two integers. On some CPU architectures, Stein's algorithm admits a faster implementation than the far more famous Euclidean algorithm (https://en.wikipedia.org/wiki/Euclidean_algorithm). Here is one possible implementation of Stein's algorithm: def gcd(int a, int b): int d = 0 while a is even and b is even: a = a / 2 b = b / 2 d = d + 1 while a != b: if a is even: a = a / 2 elif b is even: b = b / 2 elif a > b: a = (a - b) / 2 else: b = (b - a) / 2 return a * 2^d A program will crash if it ever divides by zero. Does this program ever crash due to division by zero? Carefully explain how you figured this out. Stein's algorithm is intended to compute a value; it should always terminate. Is it possible for this program to run forever? Carefully explain how you figured this out. =========================================================================== end.