Lambda Calculus - Fundamentals of Lambda Calculus & Functional Programming in JavaScript

Lambda Calculus - Fundamentals of Lambda Calculus & Functional Programming in JavaScript

Fullstack Academy

6 лет назад

200,458 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

VineBoomSoundEffect
VineBoomSoundEffect - 11.09.2023 00:09

The best video on λcalc‼️‼️

Ответить
Ivandro Jao
Ivandro Jao - 02.09.2023 13:58

Best explanation on the internet

Ответить
Matthias Blume
Matthias Blume - 01.09.2023 07:43

A bit of trivia about S and K...

TL;DR: The type schemas for K and S are T -> U -> T and (T -> U -> V) -> (T -> U) -> T -> V, respectively. These two types, when read as logical formulas and taken as axioms form a basis of the propositional calculus (with -> as the only connector).

In more detail:

First let us consider B, which is \fgx.f(gx). This is also known as "function composition" - f is called with the result of calling g on x. S is a "stronger" version of B where the outer function (here f) also receives x as an additional argument while also - like B - receiving gx, i.e., the result of applying the second function to that argument. S = \fgx.fx(gx)

Now suppose we want to give types (really: type schemas) to K and S.
K is easy. If the type of the first argument of K is T and the type of the second argument is U, then the type of the result is again T. Therefore we have:

K: T -> U -> T

(Side note: the type arrows group to the right, which meshes well with function application grouping to the left. T -> U -> T is really T -> (U -> T).)

Before looking at S, let's again look at its simpler cousin B. Here the second argument is a function from some type T to some other type U, which means that the first argument must be a function able to receive an argument of type U while then producing a result of a third type V. The end result is a function from T to V.

B: (U -> V) -> (T -> U) -> T -> V

The case of S this is very similar, except the first function not only receives U but also a copy of the T argument:

S: (T -> U -> V) -> (T -> U) -> T -> V

Now look at only the type schemas and forget about the combinators. We have:

T -> U -> T
(T -> U -> V) -> (T -> U) -> T -> V

Further forget that these are types and instead read them as formulas in propositional calculus, reading the function type arrow -> as implication:

T -> U -> T means:
If we already know T, then anything (call it U) implies that T. (It does not matter what the U is and whether or not it is true.)

(T -> U -> V) -> (T -> U) -> T -> V means:
Suppose T implies U (that's the second argument or the middle of the formula). Further suppose that when T is true then U implies V. (That's the first argument. Notice that U does not need to unconditionally imply V, it only needs to imply V when T is true.) Then T implies V.

It turns out that these two formulas, when taken as logical axioms, form a basis of the propositional calculus (where the only connector is implication). In other words, every tautology in propositional calculus can be proved from just these two axioms.

Isn't that neat?

Brought to you courtesy of Mr. Curry and Mr. Howard. :)

PS: Of course, the same thing works for the types of the combinators of any other basis, including the one consisting of 5 combinators mentioned in the talk. It just means there are also 5 corresponding axioms then.

Ответить
Ai Ohto
Ai Ohto - 23.03.2023 01:06

Best explanation yet from a high school student perspective thank you :)

Ответить
Herr Bönk
Herr Bönk - 05.02.2023 04:36

I choked already on the first example. Why 'const'? What is constant there? And why is it relevant?

Ответить
P
P - 31.01.2023 22:00

What I’d give to be in that classroom :(

Ответить
iWon'tFakeIt
iWon'tFakeIt - 10.12.2022 18:30

🙌

Ответить
Lord Ernie
Lord Ernie - 01.11.2022 00:33

Not going to lie, that man not only smart but is also looking fine as day 😏

Ответить
Era
Era - 21.10.2022 19:01

lambda calculus ist the most nonsensical, useless shit i have ever seen.

Ответить
vertigo
vertigo - 15.10.2022 20:26

shouts out i finally get it

Ответить
Data.Monoid (<>)
Data.Monoid (<>) - 06.10.2022 02:58

This makes me wonder why Lambda Calculus never became the standard... It certainly makes a lot more sense than the turing approach in my opinion!

Ответить
yuan yeo
yuan yeo - 15.09.2022 05:12

Remarkable, this is the video recommended by my professor

Ответить
Mitchell Dietz
Mitchell Dietz - 06.09.2022 04:49

I need more of this. Gabriel now works for Google. If they were wise, they would have him give lectures.

Ответить
Gustavo Bremm
Gustavo Bremm - 22.08.2022 03:39

Awesome, thanks a lot. This is a programming 💎

Ответить
Maksadbek
Maksadbek - 12.08.2022 23:11

Why did not we use "lambda e.f" function at the end of beta reduction ?

Ответить
Jerome Kelly
Jerome Kelly - 10.08.2022 03:06

The inset obscures important items in the discussion.

Ответить
Niklas
Niklas - 24.07.2022 14:21

Thanks for the great presentation!

Ответить
Lima Limon
Lima Limon - 10.07.2022 23:41

Great video!

Ответить
A K
A K - 05.07.2022 20:19

Clearly clearest explanation on YT

Ответить
chrissx Media
chrissx Media - 05.07.2022 06:55

This talk is essential. Seriously. I've spent the last 9 months implementing λ-calculus, inspired by this, and every now and then I come back to it, just because it is so awesome.

Ответить
Ryan
Ryan - 24.06.2022 05:33

something i thought of: for that "equality", instead of lambda p, q: p q (Not q) you could instead have lambda p, q: p Id Not q, and Xor is just p Not Id q. Xor especially generalizes to any number of terms by repeating: lambda a, b... z: a Not Id b Not Id ... z

Ответить
qwerty123
qwerty123 - 14.06.2022 10:27

Re-upload with the camera on the right it gets in they way now unfortunately

Ответить
Cole Pendergraft
Cole Pendergraft - 19.05.2022 08:59

This probably just saved my midterm grade, 10000x more clear than anything my professor has ever said. Also, this dude looks like the Jeff Winger of logical mathematics

Ответить
My Humble Beginning
My Humble Beginning - 18.05.2022 11:19

Mr. Lebec, thank you very much for this material of yours. I will do my best to digest this to the best of my intellectual ability.

Ответить
Azure Wang
Azure Wang - 13.05.2022 19:59

so clear explained and slide are just artwork

Ответить
AMAN UTKARSH
AMAN UTKARSH - 04.05.2022 07:39

Thankyou so much for the lecture.

Ответить
T J
T J - 15.04.2022 11:18

Moses Isajewitsch Schönfinkel Ukrainian Logician born in Dnipro.
Schönfink: German for "green munia". A bird species from India... now all these bird references make a bit more sense.

Ответить
Code Cleric
Code Cleric - 13.04.2022 04:42

I watched several videos about this topic and felt I kind of grasped it but this talk just made it crystal clear. Seriously can't say anything that hasn't already been said, but this talk is amazing and mind expanding!

Ответить
Austin Clements
Austin Clements - 26.03.2022 02:09

🎵Go Haskell go go! Haskell B. Curry

Ответить
Stephen James
Stephen James - 25.03.2022 02:09

A great talk fun and truly informative.

Ответить
The Default Mode Network
The Default Mode Network - 09.03.2022 10:03

The prettiest slides I have ever seen.

edit: also some of the most engaging math/programming teaching I have ever been privy to!

Ответить
Raahil Badiani
Raahil Badiani - 16.02.2022 12:47

superb!

Ответить
Louis Thibault
Louis Thibault - 16.02.2022 08:16

This was great. What should I watch (or read) next if I want to dig a little deeper?

Ответить
bashful228
bashful228 - 13.02.2022 14:11

great talk. pity about the placement of the video camera image… needs to move around to show the final line of code that we sometimes never see as he changes slide without entering new lines.

Ответить
KT Teng
KT Teng - 07.02.2022 06:42

1000x better than university professor's explanation

Ответить
Qais Ahm
Qais Ahm - 05.02.2022 20:20

This was honestly a very amazing talk, fun and educational at the same time, I've just had fun learning while preparing for my exams, again great work and many thanks mister Gabriel!

Ответить
riebeck
riebeck - 08.01.2022 16:01

Thank you for making this !!

Ответить