In functional languages, there is a primitive function if-then-else that
we can use to define a function by cases that depend on a Boolean condition
(see the case construction in Definition 4.7). Thus,
if x == 0 then 0 else x * y
will return 0 if the value of x is equal to 0 and will return the product of x
and y otherwise.
Assume the function mult on natural numbers is defined by
mult x y def = if x == 0 then 0 else x * y
where == is the equality test. Assume that e1 == e2 is evaluated by reducing
e1 and e2 to normal form and then comparing the normal forms.
a) Is mult commutative over numbers; i.e., will mult m n and mult n m
compute the same result for all numbers m and n?
b) Let infinity be the function defined by
infinity def = infinity + 1
What is the value of mult infinity 0?
What is the value of mult 0 infinity?