Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In the lecture, we have used the pure lambda-calculus to construct natural numbers and encoded some operations on them. In such encoding, a number n
In the lecture, we have used the pure lambda-calculus to construct natural numbers and encoded some operations on them. In such encoding, a number n is encoded as a function lambda f z. f^n z (denoted as n). In this problem, we will define more useful operations on numbers. If you get stuck in any question, try to proceed by assuming the previous function is properly defined. You can reuse any encoding given in lectures and previous questions. a) Define a function ISZERO in lambda-calculus, so that given a number n, it returns TRUE (the encoding of true) if n = 0: FALSE (the encoding of false) if n notequalto 0. b) Define a function PRED in lambda-calculus, so that given a number n, the function returns its predecessor, assuming the predecessor of 0 is 0. c) Use your encoding of PRED to define a subtraction function MINUS, so that MINUS n_1 n_2 returns n_1 - n_2 when n_1 greaterthanorequalto n_2, and 0 otherwise. d) Recall that in lecture note 2, we have defined MULT (the encoding of times) based on PLUS (the encoding of +): MULT Delta Equal To lambda n_1 n_2. (n_1 (PLUS n2_) 0). Try to define MULT on Church numerals without using PLUS (replacing PLUS with an equivalent term under alpha/beta reduction doesn't count as a solution)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started