Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2) BIG-STEP OPERATIONAL SEMANTICS consider this definition of conditional arithmetic in terms of a big-step operational semantics. Syntax of arithmetic (A) and boolean (B) expressions,

image text in transcribed

image text in transcribed

image text in transcribed

2)

image text in transcribed

BIG-STEP OPERATIONAL SEMANTICS consider this definition of conditional arithmetic in terms of a big-step operational semantics. Syntax of arithmetic (A) and boolean (B) expressions, and natural number (n) and boolean (b) values: nu=0|1|2|3... A :=nplus(A1, A2) | minus(A1, A2) | times(A1, A2) | div(A1, A2) | if(B, A1, A2) b::= true false B::=band(B1, B2) or(B1, B2) | zero?(A) Big-step operational semantics of arithmetic expressions (An): nin An A2 n2ni + 112 = n An A, n2 11 - 12 = n ni >n2 plus(A1, A2) in minus(A1, A2) in A ni Agn2 ni X n2 = n An A2 n2 ni = n2 = n 1270 times(A1, A2) in div(A1, A2) in B true Alin B false A2 n2 if(B, A1, A2) in if(B, A1, A2) 2 Big-step operational semantics of boolean expressions (Bb): true true false false B1 true B2b Bi false and(B1, B2) and(B1, B2) false Bi false B2 16 Bi true or(B1, B2) 1b or(B1, B2) true AO Ann70 zero?(A) true zero?(A) V false For the natural number division ni + n2 returns only the whole number dividend and drops the remainder, so that 7 = 2 is 3 for example. . Multiple Choice). Which of the following evaluations of times(if(zero?(minus(1,1)),3,1), 2) can be derived by the operational semantics? (a) times(if(zero?(minus (2.plus(1,1))), 3.1), 2) 3 (b) times(if(zero?(minus (2.plus(1,1))), 3.1), 2) 1 (c) times(if(zero?(minus (2.plus(1,1))), 3.1), 2) 2 (d) times(if(zero?(minus(2.plus(1,1))), 3.1), 2) 6 (e) times(if(zero?(minus(2.plus(1,1))), 3. 1),2) true (f) times(if(zero?(minus (2.plus(1,1))), 3.1), 2) false (This or That). An arithmetic expression A returns if there is some number n such that An, and diverges if there is no such n. For example, div(1.0) and minus(0.1) both diverge, and div(0.1) and minus(1,0) both return (since div(0.1) 40 and minus(1,0) 11). Similarly, a boolean expression B returns if there is some boolean value b = true or b = false such that Bb, and diverges otherwise. For each of the following arithmetic and boolean expressions, say if that expres- sion returns or diverges. (a) minus(plus(3,1), 2) (b) plus(3, minus(1,2)) (c) if(zero?(minus(2, 2)),0, div(3, minus(2, 2))) (d) and (zero?(div(0,0)), false) (e) and(false, zero?(div(0,0)))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions