Add lambda

master
Miloslav Ciz 2 years ago
parent afa9f77620
commit 5419eb0b62

@ -4,7 +4,7 @@ WIP
{ There are probably errors, you can send me an email if you find some. ~drummyfish }
This is a brief summary of history of technology and computers.
This is a brief summary of history of [technology](technology.md) and [computers](computer.md).
The earliest known appearance of technology related to humans is the use of **stone tools** of hominids in Africa some two and a half million years ago. Learning to start and control **fire** was one of the most important advances of earliest humans; this probably happened hundreds of thousands to millions years ago, even before modern humans. Around 8000 BC the **Agricultural Revolution** happened: humans domesticated animals and plants and subsequently started to create cities. Primitive **writing** can be traced to about 7000 BC to China. **Wheel** was another extremely useful technology humans invented, it is not known exactly when or where it appeared, but it might have been some time after 5000 BC (in Ancient Egypt the Great Pyramid was built still without the knowledge of wheel). Around 4000 BC **history starts with first written records**. Humans learned to smelt and use metals approximately 3300 BC (**Bronze Age**) and 1200 BC (**Iron Age**). **[Abacus](abacus.md)**, one of the simplest devices aiding with computation, was invented roughly around 2500 BC. However people used primitive computation helping tools, such as bone ribs, probably almost from the time they started trading. Babylonians in around 2000 BC were already able to solve some forms of **[quadratic equations](quadratic_equation.md)**.
@ -14,25 +14,20 @@ Around 50 AD Heron of Alexandria, an Egyptian mathematician, created a number of
In the 3rd century Chinese mathematician Liu Hui describes operations with **negative numbers**, even though negative numbers have already appeared before. In 600s AD an Indian astronomer Brahmagupta first used the number **[zero](zero.md)** in a systematic way, even though hints on the number zero without deeper understanding of it appeared much earlier.
Around 1450 a major technological leap known as the **Printing Revolution** occurred. Johannes Gutenberg, a German goldsmith, perfected the process of producing books in large quantities with the movable type press. This made books cheap to publish and buy and contributed to fast spread of information and better education.
During 1700s a major shift in civilization occurred, called the **[Industrial Revolution](industrial_revolution.md)**. It was a process of rapid change in the whole society due to new technological inventions that also led to great changes in how people worked and lived their everyday lives. It started in Great Britain but quickly spread over the whole world. The revolution spanned roughly 100 years. One of the main changes was the **transition from manual manufacturing to factory manufacturing** using machines and sources of energy such as coal. **[Steam engine](steam_engine.md) played a key role**. Work became more organized, society became industrionalized. This revolution became [criticized](ted_kaczynski.md) as it unfortunately opened the door for [capitalism](capitalism.md), made people less independent as everyone had to become a specialized cog in the society machine, at this time people started to measure time in minutes and lead very planned lives. People became enslaved by the system.
During 1700s a major shift in civilization occurred, called the **[Industrial Revolution](industrial_revolution.md)**. It spanned roughly from 1750 to 1850. It was a process of rapid change in the whole society due to new technological inventions that also led to great changes in how people worked and lived their everyday lives. It started in Great Britain but quickly spread over the whole world. One of the main changes was the **transition from manual manufacturing to factory manufacturing** using machines and sources of energy such as coal. **[Steam engine](steam_engine.md) played a key role**. Work became more organized, society became industrionalized. This revolution became [criticized](ted_kaczynski.md) as it unfortunately opened the door for [capitalism](capitalism.md), made people less independent as everyone had to become a specialized cog in the society machine, at this time people started to measure time in minutes and lead very planned lives. People became enslaved by the system.
In 1712 Thomas Newcomen invented the first widely used **[steam engine](steam_engine.md)** used mostly for pumping water, even though steam powered machines have already been invented long time ago. The engine was significantly improved by [James Watt](james_watt.md) in 1776. Around 1770 Nicolas-Joseph Cugnot created a first somewhat working **steam-powered [car](car.md)**. In 1784 William Murdoch built a small prototype of a **[steam locomotive](steam_locomotive.md)** which would be perfected over the following decades, leading to a transportation revolution; people would be able to travel far away for work, the world would become smaller which would be the start of **[globalization](globalization.md)**. The railway system would make common people measure time with minute precision.
In 1792 Clause Chappe invented **[optical telegraph](optical_telegraph.md)**, also called *semaphore*. The system consisted of towers spaced up to by 32 km which forwarded textual messages by arranging big arms on top of the towers to signal specific letters. With this messages between Paris and Strasbourg, i.e. almost 500 km, could be transferred in under half an hour. The system was reserved for the government, however in 1834 it was **[hacked](hack.md)** by two bankers who bribed the tower operators to transmit information about stock market along with the main message (by setting specific positions of arms that otherwise didn't carry any meaning), so that they could get an advantage on the market.
By 1800 Alessandro Volta invented an **electric battery**. In 1827 André-Marie Ampère publishes a further work shedding light on [electromagnetism](electromagneticm.md). After this **[electric telegraph](telegraph.md)** would be worked on and improved by several people and eventually made to work in practice. In 1821 Michael Faraday invented the **[electromotor](electromotor.md)**. Georg Ohm and especially [James Maxwell](maxwell.md) would subsequently push the knowledge of electricity even further.
In 1822 [Charles Babbage](charles_babbage.md), a great English mathematician, completed the first version of a manually powered **[digital](digital.md) mechanical computer** called the Difference engine to help with the computation of [polynomial](polynomial.md) [derivatives](derivative.md) to create mathematical tables used e.g. in navigation. It was met with success and further development was funded by the government, however difficulties of the construction never led to finishing the whole project. In 1837 Babbage designed a new machine, this time a **[Turing complete](turing_complete.md) general purpose computer**, i.e. allowing for programming with branches and loops, a true marvel of technology. It also ended up not being built completely, but it showed a lot about what computers would be, e.g. it had an [assembly](assembly.md) programming language, memory etc. For this computer [Ada Lovelace](ada_lovelace.md) would famously write the Bernoulli number algorithm.
1895 can roughly be seen as the year of **invention of radio**, specifically wireless [telegraph](telegraph.md), by Italian engineer and inventor Guglielmo Marconi. He built on top of work of others such as [Hertz](hertz.md) and [Tesla](tesla.md) and created a device with which he was able to wirelessly ring a bell at a distance over 2 km.
Around 1915 [Albert Einstein](einstein.md), a German physicist, completed his **[General Theory of Relativity](relativity.md)**, a groundbreaking physics theory that describes the fundamental nature of space and time and gives so far the best description of the Universe since [Newton](newton.md). This would shake the world of science as well as popular culture and would enable advanced technology including nuclear energy, space satellites, high speed computers and many others.
In 1931 [Kurt Gödel](kurt_godel.md), a genius mathematician and logician from Austria-Hunagry (nowadays Czech Republic), published revolutionary papers with his [incompleteness theorems](incompleteness.md) which proved that, simply put, mathematics has fundamental limits and "can't prove everything". This led to [Alan Turing](turing.md)'s publications in 1936 that nowadays stand as the **foundations of [computer science](compsci.md)** -- he introduced a theoretical computer called the **[Turing machine](turing_machine.md)** and with it he proved that computers, no matter how powerful, will never be able to "compute everything". Turing also predicted the importance of computers in the future and has created several [algorithms](algorithm.md) for future computers (such as a [chess](chess.md) playing program).
@ -53,8 +48,6 @@ On 25 August 1991 **[Linus Torvalds](linus_torvalds.md) announced [Linux](linux.
After this very recent history follows, it's hard to judge which recent events will be of historical significance much later. 1990s have seen a huge growth of computer power, video [games](game.md) such as [Doom](doom.md) led to development of [GPU](gpu.md)s and high quality computer graphics along with a wide adoption of computers by common people, which in turn helped the further growth of Internet. During the 90s we've also seen the rise of the [open source movement](open_source.md). Shortly after 2000 [Lawrence Lessig](lessig.md) founded [Creative Commons](creative_commons.md), an organization that came hand in hand with the [free culture](free_culture.md) movement inspired by the [free software movement](free_software.md). Cell phones became a commonly owned item and after about 2005 so called "[smart](smart.md) phones" and other "smart" devices replaced them as a universal communication device capable of connecting to the Internet. Before 2020 we've seen a huge advancement in [neural network](neural_network.md) [Artificial Intelligence](ai.md) which will likely be the topic of the future. [Quantum computers](quantum.md) are being highly researched with already existing primitive prototypes; this will also likely be very important in the following years. Besides AI there has appeared a great interest and development of [virtual reality](vr.md), [drones](drone.md), electromobiles, robotic Mars exploration and others. However the society and technology has generally seen a decadence after 2010, [capitalism](capitalism.md) has pushed technology to become hostile and highly [abusive to users](capitalist_software.md), extreme [bloat](bloat.md) of technology causes highly inefficient, extremely expensive and unreliable technology. In addition society is dealing with a lot of serious issues such as the [global warming](global_warming.md) and many people are foreseeing a [collapse of society](collapse.md).
TODO
## Recent History
TODO

@ -0,0 +1,49 @@
# Lambda Calculus
Lambda calculus is a formal [mathematical](math.md) system for describing calculations with [functions](function.md). It is a theoretical basis for [functional languages](functional.md). It can be seen as a model of computation similar to e.g. a [Turing machine](turing_machine.md) -- in fact lambda calculus has exactly the same computational power as a Turing machine and so it is an alternative to it. It can also be seen as a simple [programming language](programming_language.md), however its so extremely simple it isn't used for practical programming, it is more of a mathematical tool for constructing proofs etc.
While Turing machines use memory in which computations are performed, lambda calculus performs computations only with pure mathematical functions, i.e. there are no [global variables](variable.md) or [side effects](side_effect.md). It has to be stressed that the functions in questions are mathematical functions, also called **pure functions**, NOT functions we know from programming. A pure function cannot have any side effects such as changing global state and its result also cannot depend on any global state or randomness, the only thing a pure function can do is return a value, and this value has to always be the same if the arguments to the function are same.
## How It Works
(For simplicity we'll use pure ASCII text. Let the letters L, A and B signify the Greek letters lambda, alpha and beta.)
Lambda calculus is extremely simple, though it may not be so simple to learn to understand it.
In lambda calculus function have no names, they are what we'd call anonymous functions or lambdas in programming (now you know why they're called lambdas).
Computations in lambda calculus don't work with numbers but with sequences of symbols, i.e. the computation can be imagined as manipulating text strings with operations like "search/replace".
In lambda calculus an expression, also a **lambda term** or "program" if you will, consists only of three types of [syntactical](syntax.md) constructs:
1. *x*: **variables**, represent unknown values.
2. *(Lx.T)*: **abstraction**, where *T* is a lambda term, signifies a function definition (*x* is a variable that's the function's parameter, *T* is its body).
3. *(S T)*: **application** of *T* to *S*, where *S* and *T* are lambda terms, signifies a function call/invocation (*S* is the function, *T* is the argument).
Brackets can be left out if there's no ambiguity. Furthermore we need to distinguish between two types of variables:
- **bound**: A variable whose name is the same as some parameter of a function this variable is in. E.g. in *(Lx.(Ly.xyz))* variables *x* and *y* are bound.
- **free**: Variable that's not bound.
Every lambda term can be broken down into the above defined three constructs. The actual computation is performed by simplifying the term with special rules until we get the result (similarly to how we simplify expression with special rules in [algebra](algebra.md)). This simplification is called a **reduction**, and there are only two rules for performing it:
1. **A-conversion**: Renames (substitutes) a bound variable inside a function, e.g. we can apply A-conversion to *Lx.xa* and convert it to *Ly.ya*. This is done in specific cases when we need to prevent a substitution from making a free variable into a bound one.
2. **B-reduction**: Replaces a parameter inside a function with provided argument, i.e. this is used to reduce *applications*. For example *(Lx.xy) a* is an application, when we apply B-reduction, we take the function body (*xy*) and replace the bound variable (*x*) with the argument (*a*), so we get *ay* as the result.
A function in lambda calculus can only take one argument. The result of the function, its "return value", is a "string" it leaves behind after it's been processed with the reduction rules. This means a function can also return a function (and a function can be an argument to another function), which allows us to implement functions of multiple variables with so called *[currying](currying.md)*.
For example if we want to make a function of two arguments, we instead create a function of one argument that will return another function of one argument. E.g. a function we'd traditionally write as *f(x,y,z) = xyz* can in lambda calculus be written as *(Lx.(Ly.(Lz.xyz)))*, or, without brackets, *Lx.Ly.Lz.xyz* which will sometimes be written as *Lxyz.xyz* (this is just a [syntactic sugar](syntactic_sugar.md)).
**This is all we need to implement any possible program**. For example we can encode numbers with so called Church numerals: 0 is *Lf.Lx.x*, 1 is *Lf.Lx.fx*, 2 is *Lf.Lx.f(fx)*, 3 is *Lf.Lx.f(f(fx))* etc. Then we can implement functions such as an increment: *Ln.Lf.Lx.f((nf)x)*, etc.
Let's take a complete **example**. We'll use the above shown increment function to increment the number 0 so that we get a result 1:
```
(Ln.Lf.Lx.f((nf)x) (Lf.Lx.x) application
(Ln.Lf.Lx.f((nf)x) (Lf0.Lx0.x0) A-conversion (rename variables)
(Lf.Lx.f(((Lf0.Lx0.x0)f)x) B-reduction (substitution)
(Lf.Lx.f((Lx0.x0)x) B-reduction
(Lf.Lx.fx) B-reduction
```
We see we've gotten the representation of number 1.

@ -56,6 +56,7 @@ Apart from this software a lot of other software developed by other people and g
It is also possible to talk about LRS data formats, standards, designs and concepts as such etc. These might include:
- [ASCII](ascii.md)
- [RGB332](rgb332.md), [RGB565](rgb565.md)
- [bytebeat](bytebeat.md)
- [farbfeld](farbfeld.md)
- [json](json.md)

@ -20,7 +20,7 @@ If you're new here, you may want to read answers to [frequently asked questions]
Well, we're trying to figure this out on this wiki, but it is greatly related to [suckless](suckless.md), [Unix](unix.md), [KISS](kiss.md), [free](free_software.md), selfless and sustainable software created to maximally help all living beings. LRS stands opposed to all [shittiness](shit.md) of so called ["modern"](modern.md) software. For more details see the article about [LRS](lrs.md).
## Are You a Noob?
## Are You A Noob?
Are you a noob but see our ideas as appealing and would like to join us? Say no more and head over to a [how to](how_to.md)!

@ -7,8 +7,8 @@ mkdir html
DATE=`date +"%D"`
FILELIST="filelist.html"
HEADER="<html><head><title>LRS Wiki</title></head><body><h1>less_retarded_wiki</h1><a href=\"main.html\">main page</a>, <a href=\"$FILELIST\">file list</a>, <a href=\"https://codeberg.org/drummyfish/less_retarded_wiki\">source</a> last updated on $DATE<hr />"
FOOTER="<hr/><p>All content available under <a href=\"https://creativecommons.org/publicdomain/zero/1.0/\">CC0 1.0</a> (public domain).</p></body></html>"
HEADER="<html><head><link rel=\"stylesheet\" href=\"style.css\"><title>LRS Wiki</title></head><body><h1>less_retarded_wiki</h1><a href=\"main.html\">main page</a>, <a href=\"$FILELIST\">file list</a>, <a href=\"https://codeberg.org/drummyfish/less_retarded_wiki\">source</a>, last updated on $DATE<hr />"
FOOTER="<hr/><p>All content available under <a href=\"https://creativecommons.org/publicdomain/zero/1.0/\">CC0 1.0</a> (public domain). Send comments and corrections to drummyfish at disroot dot org. </p></body></html>"
echo "$HEADER <ul>" > html/$FILELIST
@ -28,5 +28,6 @@ echo "$HEADER<a href="main.html">Go to main page.</a>$FOOTER" >> html/index.html
echo "</ul> $FOOTER" >> html/$FILELIST
cp style.css html/
echo "done"

@ -12,7 +12,7 @@ Public domain is NOT the same thing as [free (as in freedom) software](free_soft
- **Public domain software is not always [free software](free_software.md)** -- PD software is free (as in freedom) only if its source code is available and also in the public domain (without source code freedoms 1 and 2 in the definition of free software are violated).
- **Freeware/gratis just means available for no price**, very often under specific restrictive conditions such as "for personal use" only and without the access to the source code. Public domain is not only gratis but also without any legal limitations on use.
## Which works are in the Public Domain?
## Which Works Are In The Public Domain?
This is not a trivial question, firstly because the term *public domain* is not clearly defined: the definition varies by each country's laws, and secondly because it is non-trivial and sometimes very difficult to assess the legal status of a work.
@ -32,7 +32,7 @@ We therefore devise the term **safe/strong public domain**. Under this we includ
There are a number of places on the internet to look for public domain works, for a list see below.
## How to Create Public Domain Works
## How To Create Public Domain Works
If you want to create a PD work (which you should), then generally in that work **you must not use any non-public domain work**. So, for example, you can NOT create a public domain fan fiction story about Harry Potter because Harry Potter and his universe is copyrighted. Similarly you can't just use randomly googled images in a game you created because the images are most likely copyrighted. Small and obscure exceptions (fonts, freedom of panorama, ...) to this may exist in laws but it's never good to rely on them, it's best to keep it safe and simply avoid utilizing anything non-PD within your works.

Loading…
Cancel
Save