church’s coincidences · stephen c. kleene:recursive functions general recursive functions of...

60
Church’s Coincidences Philip Wadler University of Edinburgh Summer School on Trends in Computing Tarragona, 25–26 July 2013 1

Upload: others

Post on 19-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Church’s Coincidences

Philip WadlerUniversity of Edinburgh

Summer School on Trends in ComputingTarragona, 25–26 July 2013

1

Page 2: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

2

Page 3: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

3

Page 4: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

4

Page 5: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Part I

About Coincidences

5

Page 6: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Two Kinds of Coincidence

6

Page 7: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Part II

The First Coincidence:Effective Computability

7

Page 8: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Effective Computability

• Alonzo Church: Lambda calculusAn unsolvable problem of elementary number theory(Abstract) Bulletin the American Mathematical Society, May 1935

• Stephen C. Kleene: Recursive functionsGeneral recursive functions of natural numbers(Abstract) Bulletin the American Mathematical Society, July 1935

• Alan M. Turing: Turing machinesOn computable numbers, with an application to the EntscheidungsproblemProceedings of the London Mathematical Society, received 25 May 1936

8

Page 9: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

David Hilbert (1862–1943)

9

Page 10: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

David Hilbert (1928) — Entscheidungsproblem

10

Page 11: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

David Hilbert (1930) — An Address

Konigsberg, 8 September 1930Society of German Scientists and Physicians

“We must know! We will know!”

11

Page 12: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Kurt Godel (1906–1978)

12

Page 13: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Kurt Godel (1930) — Incompleteness

Konigsberg, 7 September 1930Society of German Scientists and Physicians

13

Page 14: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Alonzo Church (1903–1995)

14

Page 15: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Alonzo Church (1932) — λ-calculus

f (x) = x2 + x + 42

f = λx. x2 + x + 42

∀x.A = ∀ (λx.A)

15

Page 16: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Alonzo Church (1932) — λ-calculus

Then Now

x x

λx[N ] (λx.N)

{L}(M) (LM)

16

Page 17: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Alonzo Church (1932) — Lambda Calculus

· · ·

· · ·

17

Page 18: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Alonzo Church (1936) — Undecidability

· · ·

· · ·

18

Page 19: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Stephen Kleene (1909–1994)

19

Page 20: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Stephen Kleene (1932) — Predecessor

· · ·

· · ·

20

Page 21: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Stephen Kleene (1936) — Recursive Functions

21

Page 22: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Alan Turing (1912–1954)

22

Page 23: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Alan Turing (1936) — Turing Machine

· · ·

23

Page 24: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

24

Page 25: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Robin Gandy (1988) — Turing’s Theorem

Theorem: Any function which can be calculated by a human being can becomputed by a Turing Machine.

25

Page 26: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Alan Turing (1937) — Equivalence

· · ·

26

Page 27: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Alan Turing (1946) — Automatic Computing Engine

“Instruction tables will have to be made up by mathematicians with com-puting experience and perhaps a certain puzzle-solving ability. There needbe no real danger of it ever becoming a drudge, for any processes that arequite mechanical may be turned over to the machine itself.”

27

Page 28: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Part III

The Second Coincidence:Propositions as Types

28

Page 29: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Gerhard Gentzen (1909–1945)

29

Page 30: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Gerhard Gentzen (1935) — Natural Deduction

30

Page 31: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Gerhard Gentzen (1935) — Natural Deduction

[A]x···B

⊃-IxA⊃B

A⊃B A⊃-E

B

A B&-I

A&B

A&B&-E0

A

A&B&-E1

B

31

Page 32: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Gerhard Gentzen (1935) — Natural Deduction

[A]x···B

⊃-IxA⊃B

···A⊃-E ⇒

···A···B

B

···A

···B

&-IA&B

&-E0 ⇒

···A

A

32

Page 33: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

A proof

[B &A]z&-E1

A

[B &A]z&-E0

B&-I

A&B⊃-Iz

(B &A)⊃ (A&B)

33

Page 34: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Simplifying a proof

[B &A]z&-E1

A

[B &A]z&-E0

B&-I

A&B⊃-Iz

(B &A)⊃ (A&B)

[B]y [A]x&-I

B &A⊃-E

A&B

34

Page 35: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Simplifying a proof

[B &A]z&-E1

A

[B &A]z&-E0

B&-I

A&B⊃-Iz

(B &A)⊃ (A&B)

[B]y [A]x&-I

B &A⊃-E

A&B⇓

[B]y [A]x&-I

B &A&-E1

A

[B]y [A]x&-I

B &A&-E0

B&-I

A&B

35

Page 36: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Simplifying a proof

[B &A]z&-E1

A

[B &A]z&-E0

B&-I

A&B⊃-Iz

(B &A)⊃ (A&B)

[B]y [A]x&-I

B &A⊃-E

A&B⇓

[B]y [A]x&-I

B &A&-E1

A

[B]y [A]x&-I

B &A&-E0

B&-I

A&B⇓

[A]x [B]y&-I

A&B

36

Page 37: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Alonzo Church (1903–1995)

37

Page 38: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Alonzo Church (1940) — Typed λ-calculus

[x : A]x···

N : B⊃-Ix

λx.N : A⊃B

L : A⊃B M : A⊃-E

LM : B

M : A N : B&-I

〈M,N〉 : A&B

L : A&B&-E0

L0 : A

L : A&B&-E1

L1 : B

38

Page 39: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Alonzo Church (1940) — Typed λ-calculus

[x : A]x···

N : B⊃-Ix

λx.N : A⊃B

···M : A

⊃-E ⇒

···M : A···

N{M/x} : B(λx.N)M : B

···M : A

···N : B

&-I〈M,N〉 : A&B

&-E0 ⇒

···M : A

〈M,N〉0 : A

39

Page 40: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Alan Turing (1942)

40

Page 41: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

A program

[z : B &A]z&-E1

z1 : A

[z : B &A]z&-E0

z0 : B&-I

〈z1, z0〉 : A&B⊃-Iz

λz. 〈z1, z0〉 : (B &A)⊃ (A&B)

41

Page 42: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Evaluating a program

[z : B &A]z&-E1

z1 : A

[z : B &A]z&-E0

z0 : B&-I

〈z1, z0〉 : A&B⊃-Iz

λz. 〈z1, z0〉 : (B &A)⊃ (A&B)

[y : B]y [x : A]x&-I

〈y, x〉 : B &A⊃-E

(λz. 〈z1, z0〉) 〈y, x〉 : A&B

42

Page 43: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Evaluating a program

[z : B &A]z&-E1

z1 : A

[z : B &A]z&-E0

z0 : B&-I

〈z1, z0〉 : A&B⊃-Iz

λz. 〈z1, z0〉 : (B &A)⊃ (A&B)

[y : B]y [x : A]x&-I

〈y, x〉 : B &A⊃-E

(λz. 〈z1, z0〉) 〈y, x〉 : A&B

⇓[y : B]y [x : A]x

&-I〈y, x〉 : B &A

&-E1〈y, x〉1 : A

[y : B]y [x : A]x&-I

〈y, x〉 : B &A&-E0

〈y, x〉0 : B&-I

〈〈y, x〉1, 〈y, x〉0〉 : A&B

43

Page 44: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Evaluating a program

[z : B &A]z&-E1

z1 : A

[z : B &A]z&-E0

z0 : B&-I

〈z1, z0〉 : A&B⊃-Iz

λz. 〈z1, z0〉 : (B &A)⊃ (A&B)

[y : B]y [x : A]x&-I

〈y, x〉 : B &A⊃-E

(λz. 〈z1, z0〉) 〈y, x〉 : A&B

⇓[y : B]y [x : A]x

&-I〈y, x〉 : B &A

&-E1〈y, x〉1 : A

[y : B]y [x : A]x&-I

〈y, x〉 : B &A&-E0

〈y, x〉0 : B&-I

〈〈y, x〉1, 〈y, x〉0〉 : A&B

⇓[x : A]x [y : B]y

&-I〈x, y〉 : A&B

44

Page 45: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

The Curry-Howard homeomorphismLC'90

45

Page 46: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Haskell Curry (1900–1982) / William Howard (1926–)

46

Page 47: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Howard 1980

47

Page 48: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Curry-Howard correspondence

propositions as types

proofs as programs

normalisation of proofs as evaluation of programs

48

Page 49: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Curry-Howard correspondenceNatural Deduction ↔ Typed Lambda Calculus

Gentzen (1935) Church (1940)

Type Schemes ↔ ML Type System

Hindley (1969) Milner (1975)

System F ↔ Polymorphic Lambda Calculus

Girard (1972) Reynolds (1974)

Modal Logic ↔ Monads (state, exceptions)

Lewis (1910) Kleisli (1965), Moggi (1987)

Classical-Intuitionistic Embedding ↔ Continuation Passing Style

Godel (1933) Reynolds (1972)

49

Page 50: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Functional Languages

• Lisp (McCarthy, 1960)

• Iswim (Landin, 1966)

• Scheme (Steele and Sussman, 1975)

• ML (Milner, Gordon, Wadsworth, 1979)

• Haskell (Hudak, Peyton Jones, and Wadler, 1987)

• O’Caml (Leroy, 1996)

• Erlang (Armstrong, Virding, Williams, 1996)

• Scala (Odersky, 2004)

• F# (Syme, 2006)

50

Page 51: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Language Popularity Index

51

Page 52: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Language Popularity Index—Discussion

52

Page 53: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Proof systems

• Automath (de Bruijn, 1970)

• Type Theory (Martin Lof, 1975)

• Mizar (Trybulec, 1975)

• ML/LCF (Milner, Gordon, and Wadsworth, 1979)

• NuPrl (Constable, 1985)

• HOL (Gordon and Melham, 1988)

• Coq (Huet and Coquand, 1988)

• Isabelle (Paulson, 1993)

• Epigram (McBride and McKinna, 2004)

• Agda (Norell, 2005)

53

Page 54: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Part IV

Conclusion:Philosophy

54

Page 55: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Two Kinds of Coincidence

55

Page 56: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

How to talk to aliens

56

Page 57: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Independence Day

57

Page 58: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

A universal programming language?

58

Page 59: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Multiverses

59

Page 60: Church’s Coincidences · Stephen C. Kleene:Recursive functions General recursive functions of natural numbers (Abstract) Bulletin the American Mathematical Society, July 1935 Alan

Lambda is Omniversal

60