CS20a: Models (Nov 14, 2002) Alternative models Primitive - - PowerPoint PPT Presentation

cs20a models nov 14 2002
SMART_READER_LITE
LIVE PREVIEW

CS20a: Models (Nov 14, 2002) Alternative models Primitive - - PowerPoint PPT Presentation

CS20a: Models (Nov 14, 2002) Alternative models Primitive recursive functions Partial recursive functions Recursion theorem Rices theorem Lambda Calculus Recursion theorem Rices theorem Arithmetic


slide-1
SLIDE 1

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

1

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

CS20a: Models (Nov 14, 2002)

  • Alternative models

– Primitive recursive functions – Partial recursive functions – Recursion theorem – Rice’s theorem

  • Lambda Calculus

– Recursion theorem – Rice’s theorem

  • Arithmetic

– Recursion theorem – Godel’s incompleteness theorem (aka Rice’s theorem)

slide-2
SLIDE 2

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

2

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

Arithmetic

  • Let’s do the same for arithmetic
  • Arithmetic is:

– Operators: +, -, *, /, … – First-order logic

  • First, let’s define logic
slide-3
SLIDE 3

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

3

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

Defining logics

  • A logic is defined in three parts

– Syntax – Define what is “true” – Define derivation procedures

slide-4
SLIDE 4

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

4

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

Defining the syntax

Start with a countable set of propositional letters P, Q, R, . . . Define the propositions inductively:

  • ⊤ (true) is a proposition
  • ⊥ (false) is a proposition
  • Any propositional letter is a proposition
  • If A is a proposition, so it ¬A (negation)
  • If A and B are propositions, so are

– A ∧ B (conjunction) – A ∨ B (disjunction) – A ⇒ B (implication)

slide-5
SLIDE 5

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

5

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

Standard syntax definition

Propositions: e ::= ⊤ | ⊥ | P, Q, R, . . . | ¬e | e ∧ e | e ∨ e | e ⇒ e

slide-6
SLIDE 6

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

6

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

Semantics

  • The semantics of constants: ⊤ = 1, ⊥ = 0
  • The semantics of a propositional letter is its truth

value.

  • The semantics of a compound proposition is de-

termined by truth tables. A B A ∨ B 1 1 1 1 1 1 1 A B A ∧ B 1 1 1 1 1 A B A ∧ B 1 1 1 1 1 1 1

slide-7
SLIDE 7

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

7

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

Extending the truth assignment

A B C A ∧ B (A ∧ B) ⇒ C 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

slide-8
SLIDE 8

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

8

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

Some definitions

  • A truth assignment A assigns a value to each propo-

sitional letter A a unique truth value A(A) ∈ {0, 1}

  • A truth valuation V assigns a truth value to each

proposition (it can be constructed from a A by following the truth tables).

  • A proposition α is satisfiable if there is a truth

valuation V (α) = 1

  • A proposition α is true (a tautology) if it is true in

all valuations.

slide-9
SLIDE 9

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

9

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

A proof (Pierce’s Law)

A B A ⇒ B (A ⇒ B) ⇒ A ((A ⇒ B) ⇒ A) ⇒ A 1 1 1 1 1 1 1 1 1 1 1 1 1

slide-10
SLIDE 10

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

10

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

Derivations

  • Truth tables are hard to use
  • We want a mechanical method for proving

propositions

  • Use sequents and truth judgments
slide-11
SLIDE 11

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

11

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

Sequents

  • A sequent has the form Γ ⊢ ∆
  • ∆ is a list of propositions α1, . . . , αn
  • Γ is a context containing a list of propositions β1, . . . , βn
  • We can extend valuations to sequents, to get the

folowing semantics: – A sequent β1, . . . , βn ⊢ α1, . . . , αn is true if some αi is true whenever β1, . . . , βn are all true.

slide-12
SLIDE 12

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

12

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

Derivations

  • There are two kinds of inference rules

– Introduction rules operate on the right of the turnstile – Elimination rules operate on the left of the turnstile

  • The base axiom

Γ1, α, Γ2 ⊢ ∆1, α, ∆2 axiom

slide-13
SLIDE 13

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

13

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

Introduction rules, part I

Γ ⊢ ∆1, ⊤, ∆2 true intro Γ ⊢ ∆1, α, ∆2 Γ ⊢ ∆1, β, ∆2 Γ ⊢ ∆1, α ∧ β, ∆2 and intro Γ ⊢ ∆1, α, β, ∆2 Γ ⊢ ∆1, α ∨ β, ∆2 or intro

slide-14
SLIDE 14

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

14

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

Introduction rules, part II

Γ, α ⊢ ∆1, β, ∆2 Γ ⊢ ∆1, α ⇒ β, ∆2 implies intro Γ, α ⊢ ∆1, ∆2 Γ ⊢ ∆1, ¬α, ∆2 not intro

slide-15
SLIDE 15

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

15

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

Elimination rules

Γ1, ⊥, Γ2 ⊢ ∆ false elim Γ1, α, β, Γ2 ⊢ ∆ Γ1, α ∧ β, Γ2 ⊢ ∆ and elim Γ1, α, Γ2 ⊢ ∆ Γ1, β, Γ2 ⊢ ∆ Γ1, α ∨ β, Γ2 ⊢ ∆

  • r elim

Γ1, β, Γ2 ⊢ ∆ Γ1, Γ2 ⊢ α, ∆ Γ1, α ⇒ β, Γ2 ⊢ ∆ implies elim

slide-16
SLIDE 16

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

16

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

Rule table

Γ ⊢ ∆1, ⊤, ∆2 Γ1, ⊥, Γ2 ⊢ ∆ Γ ⊢ ∆1, α, ∆2 Γ ⊢ ∆1, β, ∆2 Γ ⊢ ∆1, α ∧ β, ∆2 Γ1, α, β, Γ2 ⊢ ∆ Γ1, α ∧ β, Γ2 ⊢ ∆ Γ ⊢ ∆1, α, β, ∆2 Γ ⊢ ∆1, α ∨ β, ∆2 Γ1, α, Γ2 ⊢ ∆ Γ1, β, Γ2 ⊢ ∆ Γ1, α ∨ β, Γ2 ⊢ ∆ Γ, α ⊢ ∆1, β, ∆2 Γ ⊢ ∆1, α ⇒ β, ∆2 Γ1, β, Γ2 ⊢ ∆ Γ1, Γ2 ⊢ α, ∆ Γ1, α ⇒ β, Γ2 ⊢ ∆

slide-17
SLIDE 17

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

17

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

Proving the law of excluded middle

  • Every proposition is either true or false

A ⊢ A 3 ⊢ A, ¬A 2 ⊢ A ∨ ¬A 1

slide-18
SLIDE 18

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

18

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

Pierce’s law

A ⊢ B, A 4 ⊢ A ⇒ B, A 3 A ⊢ A 5 (A ⇒ B) ⇒ A ⊢ A 2 ⊢ ((A ⇒ B) ⇒ A) ⇒ A 1

slide-19
SLIDE 19

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

19

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

Currying

A, B ⊢ A 5 A, B ⊢ B 6 A, B ⊢ A ∧ B 4 C, A, B ⊢ C 6 (A ∧ B) ⇒ C, A, B ⊢ C 3 (A ∧ B) ⇒ C ⊢ A ⇒ B ⇒ C 2 ⊢ ((A ∧ B) ⇒ C) ⇒ (A ⇒ (B ⇒ C) 1

slide-20
SLIDE 20

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

20

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

First-order logic

  • Add atomic formulas f(a1, . . . , an) of various ar-

itites.

  • Add atomic predicates P(a1, . . . , am) is various ar-

ities. a ::= f(a1, . . . , an) e ::= ⊤ | ⊥ | P(a1, . . . , am) | ¬e | e ∧ e | e ∨ e | e ⇒ e | ∀v.e | ∃v.e

slide-21
SLIDE 21

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

21

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

Some examples

  • ∀x.big(x) ⇒ heavy(x)
  • ∀i.(i + 1) > i
  • ∀i.∃j.j > i
  • ∃i.∀j.j ≤ i
slide-22
SLIDE 22

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

22

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

Adding rules for FOL

Γ ⊢ ∆1, P(t), ∆2 Γ ⊢ ∆1, ∃v.P(v), ∆2 exists intro Γ ⊢ ∆1, P(c), ∆2 (new c) Γ ⊢ ∆1, ∀v.P(v), ∆2 all intro

Γ1, P(c), Γ2 ⊢ ∆ (new c) Γ1, ∃v.P(v), Γ2 ⊢ ∆ exists elim Γ1, ∀v.P(v), Γ2, P(t) ⊢ ∆ Γ1, ∀v.P(v), Γ2 ⊢ ∆ all elim

slide-23
SLIDE 23

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

23

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

A quantifier DeMorgan law

ϕ(c) ⊢ ϕ(c) 6 ∀x.ϕ(x) ⊢ ϕ(c) 5 ¬ϕ(c), ∀x.ϕ(x) ⊢ 4 ¬ϕ(c) ⊢ ¬(∀x.ϕ(x)) 3 ∃x.¬ϕ(x) ⊢ ¬(∀x.ϕ(x)) 2 ⊢ (∃x.¬ϕ(x)) ⇒ ¬(∀x.ϕ(x)) 1

slide-24
SLIDE 24

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

24

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

Another proof

ϕ(c) ⊢ ϕ(c) ϕ(c) ⊢ ∃x.ϕ(x) 5 ψ ⊢ ψ (∃x.ϕ(x)) ⇒ ψ, ϕ(c) ⊢ ψ 4 (∃x.ϕ(x)) ⇒ ψ, ϕ(c) ⇒ ψ 3 (∃x.ϕ(x)) ⇒ ψ ⊢ ∀x.ϕ(x) ⇒ ψ 2 ⊢ ((∃x.ϕ(x)) ⇒ ψ) ⇒ (∀x.ϕ(x) ⇒ ψ) 1

slide-25
SLIDE 25

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

25

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

Formalizing arithmetic

The language of arithmetic: e ::= i | v | e + e | · · · | e/e P ::= e = e | e < e | · · · | ¬P | P ∧ P | P ∨ P | P ⇒ P | ∃v.P[v] | ∀v.P[v] Example: ∀x1.∃x2.∀x3.∃x4.(x3 + x2 ≤ (1 + x1) ∗ x4)

slide-26
SLIDE 26

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

26

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

Indexing the arithmetic formulas

Define ϕ is the Gödel index of formula ϕ Define the normal way:

  • xi = [0 :: i]
  • e1 + e2 = 1 :: e1@e2
  • e1 < e2 = 10 :: e1@e2
  • P1 ∧ P2 = 20 :: P1@P2
  • · · ·
slide-27
SLIDE 27

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

27

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

Defining substitution

  • Define a function subst(x, y, z) = w, where

subst(n, x, ϕ) = ϕ[n/x]

  • That is, subst(n, x, ϕ) produces the number
  • f a new function ϕ[n/x] where the constant

n is substituted for x.

  • Define subst′(y) ≡ subst(y, x0, y)
  • (Note that subst can be defined in arithmetic)
slide-28
SLIDE 28

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

28

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

Fixpoint theorem for arithmetic

Theorem (Fixpoint theorem) For any formula ψ(y) with free variable y, there is a sentence ϕ with no free variables s.t. ϕ ⇔ ψ(ϕ).

slide-29
SLIDE 29

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

29

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

Fixpoint proof

  • Let ρ(y) = ψ(subst′(y))
  • so ρ(x0) = ψ(subst′(x0))
  • Let ϕ = ρ(ρ(x0))

ϕ ⇔ ρ(ρ(x0)) ⇔ ψ(subst′(ρ(x0))) ⇔ ψ(subst(ρ(x0), x0, ρ(x0))) ⇔ ψ(ρ(ρ(x0))) ⇔ ψ(ϕ)

slide-30
SLIDE 30

Computation, Computers, and Programs Godel's incompleteness theorem http://www.cs.caltech.edu/courses/cs20/a/ November 13, 2002

30

C A L I F O R N I A I N S T I T U T E O F T E C H N O I L O G Y

If this page displays slowly, try turning off the “smooth line art” option in Acrobat, under Edit->Preferences

Godel’s Incompleteness Theorem

Theorem (Gödel's Incompletness theorem) There is a formula that is not provable. Proof

  • Define a formula unprovable(ϕ) iff ϕ is not

provable.

  • This is a formula in arithmetic

ψ(y) ≡ unprovable(y) ≡ unprovable(ϕy)

  • Consider, for some ϕ, the formula

ϕ ⇔ unprovable(ϕ)