Part B: Type Inference and Unification Infer the types of each of the following expressions and all their subexpressions
Posted: Sun May 15, 2022 11:44 am
solve any of the above , but with great steps please
Part B: Type Inference and Unification Infer the types of each of the following expressions and all their subexpressions. For every step of your derivation, you are required to write the acronym for the rule you are applying next to the corresponding horizontal bar. For every step of unification, you are required to write the operation you apply in each step. If the expression contains a type error, show where unification fails. 1. fn x => fn y => X у 2. fn x => if x then x + 1 else x (1) 3. let fun fact X = if X O then 1 else fact (x - 1) in fact end 4. fn x => fn y => fn f => if y then x + 1 else f y 5. fn f => fn h => 1 + f(h(f(true)))
Part B: Type Inference and Unification Infer the types of each of the following expressions and all their subexpressions. For every step of your derivation, you are required to write the acronym for the rule you are applying next to the corresponding horizontal bar. For every step of unification, you are required to write the operation you apply in each step. If the expression contains a type error, show where unification fails. 1. fn x => fn y => X у 2. fn x => if x then x + 1 else x (1) 3. let fun fact X = if X O then 1 else fact (x - 1) in fact end 4. fn x => fn y => fn f => if y then x + 1 else f y 5. fn f => fn h => 1 + f(h(f(true)))