Lambda Calculus (Logic)
Lambda calculus is regarded as the most simplest programming language in the world. It serves as a basis for logic that powers applications in Computer Science.
Lambda calculus is made from three templates.
First
Second
Third
We can substitute any templates into any of the blanks in any template
In lambda calculus, everything is a function and can be applied on one another
In lambda calculus.
def func(a):
return a
to pass in an argument lets say b. we apply function
func(b) # b
to pass more than one argument, lets say. Lets assume we have defined
def func(a, b, c):
return a+b+c
we have to define lambda for
Going from outer to inner brackets. Replace all
we can express it as a short hand
Boolean Logic
True and False are selectors. True selects the first element while False selects the second.
True:
False
For example
And
NOT
NOT T = F
NOT F = T
Such that
And
AND
T AND T = T
T AND F = F
F AND T = F
F AND F = F
OR
T OR T = T
T OR F = T
F OR T = T
F OR F = F
NAND
T NAND T = F
T NAND F = T
F NAND T = T
F NAND F = T
NOR
T NOR T = F
T NOR F = F
F NOR T = F
F NOR F = T
From these gates, you can theoretically compute and create any function that a computer can do.
Numbers
A number is defined as
It takes in a function
Thus
Let a successor be defined as
Thus
Thus addition is defined as
And multiplication is defined as