lambda-calculus

Beta reduction of Lambda Calculus

无人久伴 提交于 2021-02-11 06:01:14
问题 I have the following lambda calculus: 1) λx . katze(x)(Garfield) 2) λP . λx . P(x)(tea) 3) λy . λx . likes(x, y)(Mia) How do I reduce them with the Beta Reduction? My solutions: 1) katze (Garfield) 2) tea 3) likes(Mia) 回答1: When performing beta reduction, you substitute the bound variable to the lambda function with the value supplied. The notation for that is [param := value] and you pick up the first variable that is given. In the case λx . katze(x)(Garfield) -> katze (Garfield) the

Pure Prolog δλ-Calculus Equality

旧街凉风 提交于 2021-01-07 01:35:18
问题 It is not so difficult to conceive an appartness relation for Peano numbers. Its even possible to make a reified eq/3 predicate like here. Question is now, whether we can push the boundary and also implement Scheme equal? predicate in a pure and reified manner? Problem would be for example to realize this reductions, also known as δ-rule (see Chapter 6 Extensions here): δxx ~~> T δxy ~~> F if x and y are not identical In case terms are represented with deBruijn indexes. This would incorporate

Pure Prolog δλ-Calculus Equality

元气小坏坏 提交于 2021-01-07 01:29:35
问题 It is not so difficult to conceive an appartness relation for Peano numbers. Its even possible to make a reified eq/3 predicate like here. Question is now, whether we can push the boundary and also implement Scheme equal? predicate in a pure and reified manner? Problem would be for example to realize this reductions, also known as δ-rule (see Chapter 6 Extensions here): δxx ~~> T δxy ~~> F if x and y are not identical In case terms are represented with deBruijn indexes. This would incorporate

What is a kind projector

好久不见. 提交于 2020-06-22 12:16:08
问题 I've been digging into FP and everything that surrounds it, and I found the concept of kind projector written somewhere, without details nor explanations. The only thing I found was this github project, and I'm starting to think if it was referring to this particular project, or to some generic concept in FP? So, what is a kind projector? Why is it useful? (if possible, can you provide examples, resources, etc?) 回答1: This is indeed just a slightly awkward name for the specific plugin for the

Problem with recursion using lambda calculus (using church numerals) in Javascript

两盒软妹~` 提交于 2020-01-16 09:07:11
问题 I have been playing around with with lambda calculus in javascript (node). I created some Church numerals, and I've been trying to create a recursive function that calculates the fibonacci sequence, but it's definitely not working! I have tried wrapping the function in a Y combinator, and a Z combinator, but neither (or my application for them) worked. What I think might be happening is that javascript is just applying the recursive function and then each time it does that, the recursive

Can XOR be expressed using SKI combinators?

那年仲夏 提交于 2020-01-15 03:39:24
问题 I have question about SKI-Combinators. Can XOR (exclusive or) be expressed using S and K combinators only? I have True = Cancel False = (Swap Cancel) where Cancel x y = K x y = x Swap: ff x y = S ff x y = ff y x 回答1: Booleans Your question is a bit unclear on the details, but it seems that what you mean is that you have the following representation of booleans: T := K F := S K This works because it means the following reductions hold: T t e => t F t e => e in other words, b t e can be

Operations on Church Lists in Haskell

房东的猫 提交于 2020-01-14 12:41:36
问题 I am referring to this question type Churchlist t u = (t->u->u)->u->u In lambda calculus, lists are encoded as following: [] := λc. λn. n [1,2,3] := λc. λn. c 1 (c 2 (c 3 n)) mapChurch :: (t->s) -> (Churchlist t u) -> (Churchlist s u) mapChurch f l = \c n -> l (c.f) n I am thinking about what other list functions I could implement on Churchlists and successfully wrote a conc2 function that concatenates 2 church lists conc2Church l1 l2 c n = l1 c (l2 c n) I also tried a zipWithChurch that

Query on Booleans in Lambda Calculus

丶灬走出姿态 提交于 2020-01-10 14:14:29
问题 This is the lambda calculus representation for the AND operator: lambda(m).lambda(n).lambda (a).lambda (b). m(n a b) b Can anyone help me in understanding this representation? 回答1: To understand how to represent Booleans in lambda calculus, it helps to think about an IF expression, "if a then b else c". This is an expression which chooses the first branch, b, if it is true, and the second, c, if it is false. Lambda expressions can do that very easily: lambda(x).lambda(y).x will give you the

lambda calculus precedence of application and abstraction

前提是你 提交于 2020-01-06 04:41:07
问题 Application has higher precedence than abstraction. In this sense, what is lambda calculus abstraction? I'm confused at what there is to have precedence over? 回答1: Lambda abstraction is λx.M , for some variable x and arbitrary term M . Application is (MN) , for some arbitrary terms M and N . Precdence is the question which of several operation is to be performed first if more than one reading is possible because the term is ambiguous due to ommission of brackets. For example in arithmetic,

lambda calculus precedence of application and abstraction

守給你的承諾、 提交于 2020-01-06 04:41:07
问题 Application has higher precedence than abstraction. In this sense, what is lambda calculus abstraction? I'm confused at what there is to have precedence over? 回答1: Lambda abstraction is λx.M , for some variable x and arbitrary term M . Application is (MN) , for some arbitrary terms M and N . Precdence is the question which of several operation is to be performed first if more than one reading is possible because the term is ambiguous due to ommission of brackets. For example in arithmetic,