# BEST代写-线上编程学术专家

Best代写-最专业靠谱代写IT | CS | 留学生作业 | 编程代写Java | Python |C/C++ | PHP | Matlab | Assignment Project Homework代写

## Q4: Semantics and Type Systems [20 pts]

### 4.1 Evaluation 1 [5 points]

Which of these evaluation relations are valid according to the operational
semantics of Nano?

(A) [] ; 1 + x ==> 1 [ ]
(B) [] ; (\x -> 1) ==> 1 [ ]
(C) [] ; (\x -> 1) (2 + 3) ==> 1 [X]
(D) [] ; (\x -> x x) (\x -> x x) ==> <[], x, x x> [ ]
(E) [f := <[x:=5],y,x + y>] ; f 1 ==> 6 [X]

### 4.2 Evaluation 2 [5 points]

Which of the following rules are used in the derivation of the reduction

[] ; (\x y -> x + y) 5 ==> <[x:=5], y, x+y>
(A) E-Num [X]
(B) E-Var [ ]
(D) E-Lam [X]
(E) E-App [X]

### 4.3 Typing 1 [5 points]

Which of the following typing judgments are valid according to the type
system of Nano?

(A) [x:Int,y:Int] |- x :: Int [X]
(B) [x:Int] |- x + y :: Int [ ]
(C) [] |- \x y -> x :: Int -> Int -> Int [X]
(D) [] |- \x y -> x :: Int -> (Int->Int) -> Int [X]
(E) [] |- \x y -> x :: Int -> Int -> Int -> Int [ ]

### 4.4 Typing 2 [5 points]

Which of the following rules are used in the derivation of the typing judgment

[] |- (\x y -> x + y) 5 :: Int -> Int
(A) T-Num [X]
(B) T-Var [X] 