1

I'm studying lambda calculus and only have basic knowledge about it. I read many of website and paper and understand the way that logic (T/F/and/or), predicate and successor work but I don't know how to accomplish other things in programming by using this lambda calculus.

I want to know how could I define positive and negative integers by using pairs of natural numbers and rational numbers as pairs of integers in lambda calculus.

Thank you for your help.

1 Answers1

-1

You should have a look to the Church encoding. For example, it defines integers as loop counters. Given a function f and a variable x, if:

  • x is never mapped to f, it is an identity (equivalent of 0)
  • x mapped once to f, which gives f x, it gives one loop count (1)
  • x mapped two, which gives f (f x), it is two loops (2); and so on.

The Church encoding defines signed numbers in terms of pairs. Therefore, using only functions, and combinations of them, the Church encoding encompasses arithmetics and logic.

Ariel Otilibili
  • 260
  • 1
  • 6