Lambda calculus: fold & Y

In summary: F, which is defined recursively using the Y combinator, to the list n times. This results in a list with each element being multiplied by n.Now, to make n_th_list behave the same as triblelist, we need to find a value of n that will make the two functions equivalent. We can do this by solving for n in the equation n_th_list = triblelist. Since both functions take in a list as their argument, we can set the lists to be the same and then solve for n.In summary, the goal is to find a value of n that will make n_th_list behave the same as triblelist. This can be achieved by setting the lists to be the same and then solving
  • #1
Horse
35
0

Homework Statement



I have two lambda expressions. Triblelist should trible every element in a list eg 1234 to 111222333444. N_th_list should do it n times. The problem is to give some value of n to n_th_list to receive triblelist. How can you do it? Help is really appreciated!

Homework Equations



triblelist = \list. ((fold F) nil ) list,
where F = \a b . cell a (cell a (cell a b))

n_th_list = \n list. ((fold (F n)) nil ) list,
where F = Y (\i .\n a b. n b (\p. cell a (i p a b)))

The Attempt at a Solution



It may be that my equations are wrong. I am not sure of n_th_list. The Y combinator confuses me. I have a bad habit of expanding everything, the calculations really get messy. How should I proceed?
 
Physics news on Phys.org
  • #2


my first step would be to fully understand the problem and the given equations. From the forum post, it seems that the goal is to find a value of n that will make n_th_list behave the same as triblelist.

To start, let's examine the given equations for triblelist and n_th_list.

For triblelist, we have the equation: triblelist = \list. ((fold F) nil ) list, where F = \a b . cell a (cell a (cell a b))

This means that triblelist is a lambda expression that takes in a list as its argument and then applies the function F to that list using the fold operation. The function F is defined as \a b . cell a (cell a (cell a b)), which takes in two arguments and creates a cell with the first argument and then another cell with the first argument again, and then a final cell with the second argument. This results in a list with each element being tripled.

For n_th_list, we have the equation: n_th_list = \n list. ((fold (F n)) nil ) list, where F = Y (\i .\n a b. n b (\p. cell a (i p a b)))

This is a bit more complex, as it involves the Y combinator. However, we can break it down step by step. The first part, \n list., simply defines the lambda expression with two arguments, n and list. The second part, ((fold (F n)) nil ) list, is the same as in triblelist, where we are applying the fold operation to the list using the function F. However, in this case, F is defined as Y (\i .\n a b. n b (\p. cell a (i p a b))). Let's break this down further.

The Y combinator is a fixed-point combinator, which means it allows us to define recursive functions in lambda calculus. In this case, it is being used to define a recursive function i, which takes in three arguments: n, a, and b. The function F is then defined as \n a b. n b (\p. cell a (i p a b)), which takes in the same three arguments and applies the function i to them.

To summarize, n_th_list is a recursive function that takes in a list and an integer n and applies
 

1. What is the Lambda calculus?

The Lambda calculus is a formal system developed by mathematician Alonzo Church in the 1930s to study functions and their computation. It is considered the foundation of functional programming and has influenced the development of programming languages and computer science theory.

2. What is fold in Lambda calculus?

In Lambda calculus, fold is a higher-order function that takes in a binary function, an initial value, and a list of values, and applies the binary function to the initial value and each element in the list, resulting in a single value. It is used for recursive computation and is equivalent to a for loop in imperative programming.

3. What is Y combinator in Lambda calculus?

The Y combinator is a fixed-point combinator in Lambda calculus, which means it is a function that can be used to create recursive functions. It is defined as Y = λf.(λx.f (x x)) (λx.f (x x)), and it allows for the creation of recursive functions without explicitly using recursion.

4. How is fold used to implement the Y combinator in Lambda calculus?

The Y combinator can be implemented in Lambda calculus using the fold function. By passing in a function that takes in a recursive function and returns a new function with the recursive function as an argument, and an initial value of the identity function, the Y combinator can be created using fold.

5. What are some practical applications of Lambda calculus, fold, and Y combinator?

Lambda calculus, fold, and Y combinator have many practical applications in computer science and mathematics. They are used in functional programming languages to perform recursion and higher-order functions, and in the development of type systems and programming language theory. They are also used in algorithms and data structures, such as in the implementation of tree data structures. Additionally, they have been used in cryptography and artificial intelligence research.

Similar threads

  • Calculus and Beyond Homework Help
Replies
1
Views
692
  • Calculus and Beyond Homework Help
Replies
3
Views
507
  • Calculus and Beyond Homework Help
Replies
20
Views
442
  • Calculus and Beyond Homework Help
Replies
2
Views
452
  • Calculus and Beyond Homework Help
Replies
2
Views
1K
  • Calculus and Beyond Homework Help
Replies
18
Views
1K
  • Calculus and Beyond Homework Help
Replies
4
Views
1K
  • Calculus and Beyond Homework Help
Replies
2
Views
531
  • Calculus and Beyond Homework Help
Replies
5
Views
1K
  • Calculus and Beyond Homework Help
Replies
14
Views
1K
Back
Top