Question: Let S - = if x > 0 then x : = x + 1 else y : = - 2 * x fi and

Let S-= if x>0 then x:=x+1 else y:=-2*x fi and let W-= while x>y do S od. Evaluate each of the
following configurations to completion. You may use ?* and/or ?n in your solutions for this question.
a.(:W,1:) where (:W,2:)2|==x>0??y0W-=x3SS-=x:=x+1;y:=y*xM(S,)xyM(W,)(x)=4(y)=1M(W,)|==x=1??y=1W-=x>0SS-=x:=yxx:=x-1;y:=b[y]M(S,)(x)=-2(y)=-1M(W,)={x=2,y=2,b=(0,1,2)}M(W,)={x=8,y=2,b=(4,2,0)}M(W,)={|???(e)}S-=x:=x2b[y]={b=(3,0,-2,4),x=,y=}M(S,)={|???(e)}(x)(y)(x)0(y)=M(S,)={|???(e)}x2x then x:=yx else x:=x-1;y:=b[y]fi. Answer the
following questions.
a. Calculate M(S,) where (x)=-2 and (y)=-1.
b. Calculate M(W,) where ={x=2,y=2,b=(0,1,2)}.
c. Calculate M(W,) where ={x=8,y=2,b=(4,2,0)}.
d.Is there any state such that M(W,)={|???(e)} because of the "division by zero" error?
Let S-=x:=x2b[y] and let ={b=(3,0,-2,4),x=,y=}. Here, and are two named
integer constants. Find all possible states such that M(S,)={|???(e)}.
Hint: You can describe such states by describing andor,or describing (x)andor(y). For example, you
can say: with (x)0 and (y)= any arbitrary integer can satisfy M(S,)={|???(e)}, because we have a
"square root of negative number" error while evaluating x2.1|==y
b.(:W,2:) where 2|==x>0??y0
Let W-= while x3doSod, where S-=x:=x+1;y:=y*x.
a. Calculate M(S,). Here is a state with x and y defined.
b. Calculate M(W,), where (x)=4 and (y)=1.
c. Calculate M(W,), where |==x=1??y=1.
Let W-= while x>0doSod, where S-=ifx then x:=yx else x:=x-1;y:=b[y]fi. Answer the
following questions.
a. Calculate M(S,) where (x)=-2 and (y)=-1.
b. Calculate M(W,) where ={x=2,y=2,b=(0,1,2)}.
c. Calculate M(W,) where ={x=8,y=2,b=(4,2,0)}.
d.Is there any state such that M(W,)={|???(e)} because of the "division by zero" error?
Let S-=x:=x2b[y] and let ={b=(3,0,-2,4),x=,y=}. Here, and are two named
integer constants. Find all possible states such that M(S,)={|???(e)}.
Hint: You can describe such states by describing andor,or describing (x)andor(y). For example, you
can say: with (x)0 and (y)= any arbitrary integer can satisfy M(S,)={|???(e)}, because we have a
"square root of negative number" error while evaluating x2.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!