Step by Step
The down side to constantly blogging about the functional numbers subtraction problem is that I'm going to feel like that much more of an idiot when I know the answer. (It also makes it harder to just give in and look it up - but that isn't such a problem yet as I'm still enjoying chewing on it a bit).
I just wanted to add, for now, that it just occurred to me that it was silly of me to say that the method I'm currently pursuing of implementing subtraction for Church numbers wouldn't be able to deal with negative numbers. OF COURSE IT WOULD! In fact, the method I'm pursuing - in which subtraction involves passing some kind of function to the 's' argument of the subtrahend such that, when the subtrahend is passed to the minued it has the effect of removing that many 's' applications from the minued - IS such a definition. Keeping in mind that numbers are merely functions in Church Number notation, then clearly a negative number is just a number which has the effect of reducing the value of another number when it is passed to that number. Really, there is no subtraction, right? Only addition - and what we call "subtraction" just involves addition with negative numbers.
Probably this "realization" about Church numbers wasn't worth a blog post (and in fact, I should stop thinking about this problem soon, because Friedman in fact gave us another problem to chew on that seems more directly related to the class that I should probably start "working" (i.e. blogging) on). But posting about each step has the double bonus of allowing me to organize and examing my thoughts - and it also gives a kind of "public" (even if it's only Noah), which has the effect of keeping it honest (i.e. I have greater inhibitions against lazythinking and cheating with Wikipedia).
But this is actually a "step," because now I "know" (by which I mean very strongly suspect) that the answer does indeed involve coming up with some kind of definition for a
sub1
function. A negative number is the same as a positive number plus a negative sign, right? So the Church Number equivalent of such a sign is just passing an argument to 's' that does the opposite of what it should - i.e. rather than incrementing it does nothing.So I'm definitely on the right track. The answer is indeed passing the identity function
(lambda (x) x)
in place of add1
to a fixed number of the 's' arguments of the minuend. It's getting the right number to go in that's tricky. So close and yet so far away.
1 Comments:
Very good internet site you've gotten here.
Post a Comment
<< Home