Answer to Question 32C-3

Here are the equations for reference.

(isPrefix.1)    isPrefix([ ], B) = true
(isPrefix.2)    isPrefix(A, [ ]) = false   (when A is not [ ])
(isPrefix.3)    isPrefix(A, B) = head(A) == head(B) and isPrefix(tail(A), tail(B))   (when A ≠ [ ] and B ≠ [ ])

Evaluation is as follows.

   isPrefix([2, 3], [2])
   = 2 == 2  andisPrefix([3], [ ])  by (isPrefix.3)
   = true  andisPrefix([3], [ ])
   = isPrefix([3], [ ])
   = isPrefix(3 : [ ], [ ])
   = false  by (isPrefix.2)