
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

22C:185 — Fall 2004 Homework IX
1. [15 points] Consider the recursive program over all integers Z P: f(x,y) = if x>10 then x-1 else f(x+2, f(x,y+1)). Determine the least fixed point of the functional P (i.e., the recursive function defined using lazy evaluation) and justify your answer. 2. [20 points] (a) Show that if X is a pointed cpo, C is a chain of X, and f: X ‡ X is a monotone
(b) Suppose we define a function mp: Nat¥Nat ‡ Nat, where Nat, and Nat¥Nat are the pointed cpos from our text, by mp(^Nat,^Nat) = ^Nat, mp(0,^Nat) = 0, mp(^Nat,0) = 0, and mp(m,n) = m*n for m,nŒ{0,1,2, … }. Determine whether or not mp is monotone and continuous (justify your answer).
3. [25 points] Let p be the Wren program fragment if A=B or A=-B then if A>B then C:= A else C:= B-A+1 end if else if AB>0 then C:= AB else C:= 1-A*B end if end if Assuming a store, sto, where sto(A) and sto(B) denote (positive, negative, or zero) integer values, use the denotational semantics of Wren to argue that if execute[p] sto = sto', then sto'(C)=int(c) with c> 0.