![Page 1: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/1.jpg)
A Brief History of the Freedom of Expressions
Matt Might
http://matt.might.net/
![Page 2: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/2.jpg)
Sapir-Whorf Hypothesis
Language limits
thought.
Edward Sapir Benjamin Whorf
![Page 3: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/3.jpg)
Programming languages
• Where did they come from?
• What kinds of languages do we have now?
• What will they do for us tomorrow?
![Page 4: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/4.jpg)
What is a programming language?
A programming language is a language that can describe a transformation from inputs to outputs...
![Page 5: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/5.jpg)
What is a programming language?
...without ambiguity.
A programming language is a language that can describe a transformation from inputs to outputs...
![Page 6: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/6.jpg)
Origins of programming languages
![Page 7: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/7.jpg)
Origins ofmathematical notation
![Page 8: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/8.jpg)
Euclid’s algorithm (300 BC)
• Greatest common divisor
• GCD(24,18) = 6
• GCD(4,6) = 2
(Probably) Euclid
![Page 9: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/9.jpg)
300 BC
![Page 10: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/10.jpg)
2008 AD
gcd(a, b) = (b == 0) ? a : gcd(b, a mod b)
![Page 11: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/11.jpg)
Limits on the Greeks
• No notation for zero.
• No variables for unknowns.
• No symbols for operations.
• Long division required Ph.D.
• Irrational numbers punished by death.
![Page 12: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/12.jpg)
Example
• The number such that four of its roots is equal to its three of its square.
• 4x = 3x2.
![Page 13: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/13.jpg)
Indian numerals (596)
• Notation for zero.
• Decimal numerals.
• Calculation easier.
Brahmagupta
![Page 14: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/14.jpg)
Solving quadratics (820)
Muhammad ibn Mūsā al-Khwārizmī
![Page 15: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/15.jpg)
Solving quadratics (820)
Muhammad ibn Mūsā al-Khwārizmī
![Page 16: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/16.jpg)
Variables (1570s)
François Viète
![Page 17: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/17.jpg)
Example
• 3 + x is equal to 10 times x2.
• 3 + x = 10x2
![Page 18: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/18.jpg)
Operations (Early 1600s)
William Oughtred
• Letters for variables.
• Symbols for operations.
• Led to slide rule.
![Page 19: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/19.jpg)
Calculus (Late 1600s)
Isaac NewtonPrincipia (1687)
![Page 20: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/20.jpg)
Calculus (Late 1600s)
Gottfried Leibniz
![Page 21: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/21.jpg)
Euler (1700s)
![Page 22: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/22.jpg)
The end of the reign of numbers
![Page 23: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/23.jpg)
Functions
f(x) = x2 + 3
A function transforms an input into an output.
input: x output: f(x)0 3
1 4
2 7
![Page 24: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/24.jpg)
A programming language is a language that can describe a transformation from inputs to outputs.
Functions
![Page 25: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/25.jpg)
A programming language is a language that can describe functions.
Functions
![Page 26: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/26.jpg)
Names for functions
f (x)
![Page 27: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/27.jpg)
Names for functions
f
![Page 28: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/28.jpg)
Names for functions
f (3)
![Page 29: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/29.jpg)
Sets and Logic (1800s)
Giuseppe Peano
• Sets became objects.
• Logic became math.
• Math began unifying.
![Page 30: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/30.jpg)
Sets
A set is a collection of objects.
• {1,2,3} is a set of three numbers.
• {} is the empty set.
• {{1,2,3}} is a set containing a set.
• N is the set of natural numbers.
![Page 31: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/31.jpg)
Frege’s unification
• Logic as foundation.
• Sets as atoms.
• Numbers from sets.
• Functions from sets.
Gottlob Frege
![Page 32: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/32.jpg)
Example
• Every even integer greater than two can be written as the sum of two primes.
• ∀n > 2 : ∃a,b : p(a) ∧ p(b) ∧ a+b = n.
![Page 33: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/33.jpg)
Grundgesetze der Arithmetik
• Published in 1903.
• Foundation for math.
![Page 34: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/34.jpg)
Russell’s postcard
Dear Frege,
Prof. Dr. Gottlob FregeUniversity of GöttingenGöttingen, Germany
{X | X ∉ X} ∈ {X | X ∉ X}
XOXO,Bertrand R.
![Page 35: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/35.jpg)
Russell’s postcard
Dear Frege,
Prof. Dr. Gottlob FregeUniversity of GöttingenGöttingen, Germany
XOXO,Bertrand R.
U FAIL.
![Page 36: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/36.jpg)
Russell’s paradox{X | X ∉ X} ∈ {X | X ∉ X}
![Page 37: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/37.jpg)
Russell’s paradox
Does the set of all sets that do not contain themselves contain itself?
{X | X ∉ X} ∈ {X | X ∉ X}
![Page 38: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/38.jpg)
Russell’s paradox
Does the set of all sets that do not contain themselves contain itself?
{X | X ∉ X} ∈ {X | X ∉ X}
The barber shaves all those that do not shave themselves.
![Page 39: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/39.jpg)
Russell’s paradox
Does the set of all sets that do not contain themselves contain itself?
{X | X ∉ X} ∈ {X | X ∉ X}
The barber shaves all those that do not shave themselves.
But, then who shaves the barber?
![Page 40: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/40.jpg)
Russell’s solution: Orders
• Problem is self-reference.
• Example: This sentence is false.
• Solution: Order sentences.
• Must reference lower orders.
• Seems to avoid paradox.
Bertrand Russell
![Page 41: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/41.jpg)
Functions as foundation?
Alonzo Church
• Notation for functions.
• f(x) = x2
• f(2) = 4
• f = λx.x2
• (λx.x2)(2) = 4
![Page 42: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/42.jpg)
Lambda Calculus (1920s)
Throw away everything in math, except:
x variables
f(e) function application
λx.e function definition
![Page 43: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/43.jpg)
Lambda Calculus
(λx.e) v = {v/x}e.
![Page 44: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/44.jpg)
The Lambda Calculus
• Numbers.
• True and false.
• Propositions.
• Sets.
• Recursive functions.
• Logic.
• ...
Can encode:
![Page 45: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/45.jpg)
Another paradox
k = (λx.¬(x x)) (λx.¬(x x)) = ¬k
![Page 46: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/46.jpg)
Turing machine (1936)
• Student of Church.
• Defined computability.
• Showed λ = computer.
Alan Turing
![Page 47: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/47.jpg)
Modern programming languages
![Page 48: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/48.jpg)
Lisp (1958)
• λ as programming language.
• S-Expression notation.
• Code as data.
• Data as code.
• Self-evaluating.
John McCarthy
![Page 49: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/49.jpg)
Example
(define (factorial x) (if (= x 0) 1 (* n (factorial (- n 1)))))
![Page 50: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/50.jpg)
Kinds of languages
• Declarative: Describes relationship.
• Imperative: Describes process.
![Page 51: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/51.jpg)
Example: Declarative
• A PBJ is the result of placing peanut butter and jelly between two slices of bread.
![Page 52: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/52.jpg)
Example: Imperative
• Place slice of bread on table.
• Add peanut butter.
• Add jelly.
• Place slice of bread on top.
![Page 53: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/53.jpg)
Declarative languages
• Roots in the lambda calculus.
• Examples: Haskell, SML, Lisp/Scheme
• Easy to reason about correctness.
• Generally safe and bug free.
• Can be inefficient.
• Need to think mathematically to use them.
![Page 54: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/54.jpg)
Imperative languages
• Trace roots to Babbage’s engine (1800s).
• Examples: C, C++, Java, Python.
• Hard to know if correct.
• Generally very efficient.
• Extremely dangerous.
![Page 55: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/55.jpg)
45
<exploding-rocket-video />
![Page 56: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/56.jpg)
46
![Page 57: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/57.jpg)
47
![Page 58: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/58.jpg)
48
![Page 59: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/59.jpg)
49
![Page 60: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/60.jpg)
PowerPoint
A fatal exception 0E has occurred at 0137:BFFA21C9. The currentapplication will be terminated.
* Press any key to terminate the current application.* Press CTRL+ALT+DEL again to restart your computer. You will
lose any unsaved information in all applicatons.
Press any key to continue _
![Page 61: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/61.jpg)
<exploding-rocket-video />
51
![Page 62: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/62.jpg)
51
![Page 63: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/63.jpg)
The future of programming languages
![Page 64: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/64.jpg)
Front lines of research
• Get the best of both worlds.
• Write program in both; prove equivalent.
• Use a mixed language: Scala, Ynot.
![Page 65: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/65.jpg)
The future
• Programs won’t crash.
• Programs won’t hang.
• Programs will always do the right thing.
![Page 67: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/67.jpg)
Example: Numbers
• 0 = λs.λz.z
• n+1 = λs.λz.s(n s z)
![Page 68: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/68.jpg)
Example: True, false, if
• true = λt.λf.t
• false = λt.λf.f
• if = λb.λt.λf.(b t f )
![Page 69: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/69.jpg)
Omega
ω = (λx.x x) (λx.x x) = ω
![Page 70: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/70.jpg)
Fixed-point Combinator
Fix(F) = F(Fix(F))
![Page 71: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/71.jpg)
Fixed points andself reference
• x2 = 1 + x
• x = x2 - 1
• x = F(x), where F = λx.x2 - 1
• x = Fix(F) = ±1
![Page 72: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/72.jpg)
Recursion
• f(n) = if n=0 then 1 else n × f(n-1)
• F(f) = λn.n=0 then 1 else n × f(n-1)
• ! = Fix(F)
![Page 73: A Brief History of the Freedom of Expressions](https://reader031.vdocuments.mx/reader031/viewer/2022030107/621c9d79c26eda5557739327/html5/thumbnails/73.jpg)
Fixed-point Combinator
Fix = λf.(λx.f (x x)) (λx.f (x x))