-
I tried to define the integers using smart constructors described in this blog post but in a different way, more akin to the usual definition of the natural numbers.
We have three constructors: zero, successor and predecessor, and we want to use smart constructors so that successor and predecessor are inverses. However, I can't get it to work. I get the following type error:
The hard cases are the successor of a successor (i.e. we're dealing with a positive number) and the predecessor of a predecessor (i.e. we're dealing with a negative number). According to my limited understanding of how computation in Kind works, the actual and expected types should be judgmentally equal, because for positive Any ideas as to whether such recursive smart constructors are even possible, or is it just me doing something wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You're on the right path, this was discussed in the telegram group recently while @MaiaVictor was trying to implement rationals. Whether this is possible or not is an open problem. |
Beta Was this translation helpful? Give feedback.
You're on the right path, this was discussed in the telegram group recently while @MaiaVictor was trying to implement rationals. Whether this is possible or not is an open problem.