Question: Please don't put random answers 2) 3) ni SMALL-STEP OPERATIONAL SEMANTICS consider this definition of a small-step operational semantics for the same conditional arithmetic language
Please don't put random answers

2)


3)

ni SMALL-STEP OPERATIONAL SEMANTICS consider this definition of a small-step operational semantics for the same conditional arithmetic language used previously in section 1. Small-step reduction rules: plus(11, 12) (n=n + n2) minus (ni, n2n (n=11 - 112, ni > 12) times(11,12) (n=n x n2) div(ni, n2) (n = n1 + 12, 1270) if(true, A1, A2) A1 if(false, A1, A2) A2 and(true, B) B and(false, B) false or false, B) - B or(true, B) true zero?(0) true zero?(n) false (n =0) Evaluation contexts (E): E:=plus(E,B) | plus(n, E) | minus(E,B) | minus(n. E) times(E, B) times(n. E) div(E, B) divn, E) if(E, A1, A2) | and(E, B) or(E, B) zero?(E) What do you get from plugging the expression plus(2.3) into the evaluation context if (zero?(O), times (2.4), minus(4,1)) (a) if (zero?(5), times(2.4), minus(4,1)) (b) if(zero? (plus(2,3)), times(2.4), minus(4,1)) (c) if(plus(2,3), times(2,4), minus(4.1)) (d) if(times (2.4), minus(4,1), plus(2,3)) This or That). For each of the following pairs of a context and a sub- expression, identify which ones are valid or invalid decompositions of the expression if(zero?(times(plus(3, 4), minus(1,1))), minus(5, 3), div(6,2)) according to the small-step operational semantics. (There may be multiple valid decompositions.) (a) if(O, minus(5,3), div(6,2)) and zero?(times(plus(3, 4),minus(1,1))) (b) if(zero?(times (plus (3.4), minus(1,1))), 0, div(6,2)) and minus(5,3) c) if(zero?(times (plus(3, 4), minus(1,1))), minus(5,3), D) and div6,2) (d) if (zero?(times(O, minus(1,1))), minus(5,3), div(6,2)) and plus(3,4) (e) if (zero?(times(plus(3,4), O)), minus(5,3), div(6.2) and minus(1,1) (Show Your Work). Write down the sequence of reduction step using the rules of the small-step operational semantics for simplifying if(zero?(times(plus(3,4), minus(1,1))), minus(5,3), div(6,2)) to its final result
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
