I am going through my practice exam for Programming language Foundations using agda and it has the following question:
You are given the following Agda declaration:
data Even : N → Set where
ezero : Even 0
esuc : { n : N } → Even n → Even (2+ n)
Assume that the standard library of natural numbers has been imported. Answer the following questions:
a)What is the type of ezero
?
b)Are there any terms of type Even 1
?
c)How many terms are of type Even 2
? List them
d)Describe one potential problem that might occur if we change the return type of esuc to be Even (n+2)
instead of Even (2+n)
.
We're not provided a solution manual. The question seems pretty basic but I am not sure about any of these.I think the answer to the first three are:
a) Set
b) No terms of type Even 1
c) One term of type Even 2
d) don't know
Answers to these questions along with a brief explanation would be highly appreciated. Thanks