G odel Numbers of Terms and Formulas We assign a unique number to - - PowerPoint PPT Presentation

g odel numbers of terms and formulas we assign a unique
SMART_READER_LITE
LIVE PREVIEW

G odel Numbers of Terms and Formulas We assign a unique number to - - PowerPoint PPT Presentation

G odel Numbers of Terms and Formulas We assign a unique number to each symbol in L NT as follows: 1 15 _ 3 E 17 8 5 < 19 = 7 ( 21 0 9 ) 23 S 11 v i 2 i + 13 Suppose s : s 1 . . . s n is a string of symbols, which constituting a


slide-1
SLIDE 1

  • del Numbers of Terms and Formulas

We assign a unique number to each symbol in LNT as follows: ¬ 1 _ 3 8 5 = 7 9 S 11 + 13 · 15 E 17 < 19 ( 21 ) 23 vi 2i Suppose s :⌘ s1 . . . sn is a string of symbols, which constituting a well-formed term or formula of LNT. Naively, we could encode s by the number h#(s1), . . . , #(sn)i where #(si) is the number corresponding to the symbol si. However, it much better to encode s according to the inductive type of terms and formulas.

slide-2
SLIDE 2

Def 5.7.1. For each term t and formula ', the G¨

  • del numbers ptq and p'q

are defined as follows: p¬↵q = h1, p↵qi p+t1t2q = h13, pt1q, pt2qi p(↵ _ )q = h3, p↵q, pqi p· t1t2q = h15, pt1q, pt2qi p(8vi)(↵)q = h5, pviq, p↵qi pEt1t2q = h17, pt1q, pt2qi p=t1t2q = h7, pt1q, pt2qi p<t1t2q = h19, pt1q, pt2qi p0q = h9i pviq = h2ii. pStq = h11, ptqi

slide-3
SLIDE 3

Def 5.7.1. For each term t and formula ', the G¨

  • del numbers ptq and p'q

are defined as follows: p¬↵q = h1, p↵qi p+t1t2q = h13, pt1q, pt2qi p(↵ _ )q = h3, p↵q, pqi p· t1t2q = h15, pt1q, pt2qi p(8vi)(↵)q = h5, pviq, p↵qi pEt1t2q = h17, pt1q, pt2qi p=t1t2q = h7, pt1q, pt2qi p<t1t2q = h19, pt1q, pt2qi p0q = h9i pviq = h2ii. pStq = h11, ptqi

  • Obs. ptq and p'q are never divisible by 7. (Why?)
slide-4
SLIDE 4

Def 5.7.1. For each term t and formula ', the G¨

  • del numbers ptq and p'q

are defined as follows: p¬↵q = h1, p↵qi p+t1t2q = h13, pt1q, pt2qi p(↵ _ )q = h3, p↵q, pqi p· t1t2q = h15, pt1q, pt2qi p(8vi)(↵)q = h5, pviq, p↵qi pEt1t2q = h17, pt1q, pt2qi p=t1t2q = h7, pt1q, pt2qi p<t1t2q = h19, pt1q, pt2qi p0q = h9i pviq = h2ii. pStq = h11, ptqi

  • Example. p=0S0q = h7, p0q, pS0qi

= h7, h9i, h11, h9iii = h7, 210, h11, 210ii = 28310255(21231025+1). Notice how fast pSSSS0q grows: pSSSS0q = h11, h11, h11, h11, h9iiiii = 2123212321232123210

slide-5
SLIDE 5

Next Steps (Section 5.8) ∆-definability of sets Terms := {ptq : terms t} = {a 2 N : a = ptq for some term t}, Formulas := {p'q : formulas '} = {a 2 N : a = p'q for some formula '}.

slide-6
SLIDE 6

∆-Definition of Terms = {ptq : t is a term}

p¬↵q = h1, p↵qi p=t1t2q = h7, pt1q, pt2qi p+t1t2q = h13, pt1q, pt2qi p<t1t2q = h19, pt1q, pt2qi p(↵ _ )q = h3, p↵q, pqi p0q = h9i p· t1t2q = h15, pt1q, pt2qi pviq = h2ii p(8vi)(↵)q = h5, pviq, p↵qi pStq = h11, ptqi pEt1t2q = h17, pt1q, pt2qi

slide-7
SLIDE 7

∆-Definition of Terms = {ptq : t is a term}

p¬↵q = h1, p↵qi p=t1t2q = h7, pt1q, pt2qi p+t1t2q = h13, pt1q, pt2qi p<t1t2q = h19, pt1q, pt2qi p(↵ _ )q = h3, p↵q, pqi p0q = h9i p· t1t2q = h15, pt1q, pt2qi pviq = h2ii p(8vi)(↵)q = h5, pviq, p↵qi pStq = h11, ptqi pEt1t2q = h17, pt1q, pt2qi

Recall the inductive definition of an LNT-term t: it is either

  • a variable symbol vi,
  • St1 where t1 is term,
  • the constant symbol 0,
  • +t1t2 or · t1t2 or Et1t2 where t1, t2 are terms.
slide-8
SLIDE 8

∆-Definition of Terms = {ptq : t is a term}

p¬↵q = h1, p↵qi p=t1t2q = h7, pt1q, pt2qi p+t1t2q = h13, pt1q, pt2qi p<t1t2q = h19, pt1q, pt2qi p(↵ _ )q = h3, p↵q, pqi p0q = h9i p· t1t2q = h15, pt1q, pt2qi pviq = h2ii p(8vi)(↵)q = h5, pviq, p↵qi pStq = h11, ptqi pEt1t2q = h17, pt1q, pt2qi

Recall the inductive definition of an LNT-term t: it is either

  • a variable symbol vi,
  • St1 where t1 is term,
  • the constant symbol 0,
  • +t1t2 or · t1t2 or Et1t2 where t1, t2 are terms.

Let’s start with ∆-definition of Variables := {pviq : i = 1, 2, . . . } (= {22i+1 : i = 1, 2, . . . }). by the formula Variable(x) :⌘ (9y < x)[Even(y) ^ (0 < y) ^ (x = 2Sy)].

slide-9
SLIDE 9

∆-Definition of Terms = {ptq : t is a term}

p¬↵q = h1, p↵qi p=t1t2q = h7, pt1q, pt2qi p+t1t2q = h13, pt1q, pt2qi p<t1t2q = h19, pt1q, pt2qi p(↵ _ )q = h3, p↵q, pqi p0q = h9i p· t1t2q = h15, pt1q, pt2qi pviq = h2ii p(8vi)(↵)q = h5, pviq, p↵qi pStq = h11, ptqi pEt1t2q = h17, pt1q, pt2qi

Recall the inductive definition of an LNT-term t: it is either

  • a variable symbol vi,
  • St1 where t1 is term,
  • the constant symbol 0,
  • +t1t2 or · t1t2 or Et1t2 where t1, t2 are terms.

We would like to write: Term(x) :⌘ Variable(x) _

“x is p0q”

z }| { x = 210 _

“x is pSt1q for some term t1”

z }| { (9y < x)[Term(y) ^ x = 212·3

Sy

| {z }

h11,yi

] _ · · · |{z}

“x is +t1t2 or · t1t2 or Et1t2”

However, there is a problem with this “∆-formula”: It is a not legitimate for- mula of first-order logic! Note the circular use of the subformula Term(y).

slide-10
SLIDE 10

∆-Definition of Terms = {ptq : t is a term}

  • Definition. A term construction sequence for a term t is a finite sequence
  • f terms (t1, . . . , t`) such that t` :⌘ t and, for each k 2 {1, . . . , `}, the term tk

is either

  • a variable symbol,
  • the constant symbol 0,
  • Stj for some j < k, or
  • +titj or · titj or Etitj for some i, j < k.
slide-11
SLIDE 11

∆-Definition of Terms = {ptq : t is a term}

  • Definition. A term construction sequence for a term t is a finite sequence
  • f terms (t1, . . . , t`) such that t` :⌘ t and, for each k 2 {1, . . . , `}, the term tk

is either

  • a variable symbol,
  • the constant symbol 0,
  • Stj for some j < k, or
  • +titj or · titj or Etitj for some i, j < k.
  • Example. (0, v1, Sv1, +0Sv1) is term construction sequence for the +0Sv1.
slide-12
SLIDE 12

∆-Definition of Terms = {ptq : t is a term}

  • Definition. A term construction sequence for a term t is a finite sequence
  • f terms (t1, . . . , t`) such that t` :⌘ t and, for each k 2 {1, . . . , `}, the term tk

is either

  • a variable symbol,
  • the constant symbol 0,
  • Stj for some j < k, or
  • +titj or · titj or Etitj for some i, j < k.
  • Example. (0, v1, Sv1, +0Sv1) is term construction sequence for the +0Sv1.
  • Lemma. Every term t has a term construction sequence of length at most the

number of symbols in t. (Easy proof by induction.)

slide-13
SLIDE 13

∆-Definition of Terms = {ptq : t is a term}

  • Definition. A term construction sequence for a term t is a finite sequence
  • f terms (t1, . . . , t`) such that t` :⌘ t and, for each k 2 {1, . . . , `}, the term tk

is either

  • a variable symbol,
  • the constant symbol 0,
  • Stj for some j < k, or
  • +titj or · titj or Etitj for some i, j < k.

Key to defining Terms: We will write a ∆-formula defining the set TermConSeq = {(c, a) : c = hpt1q, . . . , pt`qi and a = pt`q where (t1, . . . , t`) is a term construction sequence}.

slide-14
SLIDE 14

∆-Definition of Terms = {ptq : t is a term} TermConSeq(c, a) :⌘ Codenumber(c) ^ (9` < c) " Length(c, `) ^ IthElement(a, `, c) ^ (8k  `)(9ek < c) " IthElement(ek, k, c) ^ B B B B @ Variable(ek) _ ek = 210 } } } “ek is p0q” _ (9j < k)(9ej < c)[IthElement(ej, j, c) ^

“ek is pSejq”

z }| { ek = 212 · 3

Sej]

_ · · · 1 C C C C A ## Key to defining Terms: We will write a ∆-formula defining the set TermConSeq = {(c, a) : c = hpt1q, . . . , pt`qi and a = pt`q where (t1, . . . , t`) is a term construction sequence}.

slide-15
SLIDE 15

∆-Definition of Terms = {ptq : t is a term} Now there is an obvious way to define Term(a): Term(a) :⌘ (9c)TermConSeq(c, a). To make this a ∆-formula, we need an upper bound on c as a function of a.

slide-16
SLIDE 16

∆-Definition of Terms = {ptq : t is a term} Now there is an obvious way to define Term(a): Term(a) :⌘ (9c)TermConSeq(c, a). To make this a ∆-formula, we need an upper bound on c as a function of a. Suppose a = ptq. Another easy lemma by induction: The number of symbols in t is at most a. Therefore, there exists a term construction sequence (t1, . . . , t`) for t with length  a. We may assume that each tk is a subterm of t, so that ptkq  ptq = a for all k 2 {1, . . . , `}. Let c := hpt1q, . . . , pt`qi. We have c = 2pt1q+13pt2q+1 · · · (p`)pt`q+1  (p`)pt1q+···+pt`q+`  (p`)`a+`  (pa)a2+a  (a + 1)a3 using the (easy) fact that the ath prime number pa is at most (a + 1)a.

slide-17
SLIDE 17

∆-Definition of Terms = {ptq : t is a term} Now there is an obvious way to define Term(a): Term(a) :⌘ (9c)TermConSeq(c, a). To make this a ∆-formula, we need an upper bound on c as a function of a. We may therefore take Term(a) :⌘ (9c  (a + 1)a3)TermConSeq(c, a).

slide-18
SLIDE 18

Construction Sequences for Other Recursive Definitions In a similar way, using the notion of a formula construction sequence, we get a ∆-definition of the set Formulas = {p'q : ' is a formula}.

  • Definition. A formula construction sequence for a formula ' is a finite

sequence of terms ('1, . . . , '`) such that '` :⌘ ' and, for each k 2 {1, . . . , `}, the term 'k is either

  • =t1t2 for some terms t1 and t2
  • <t1t2 for some terms t1 and t2
  • ¬'j for some j < k
  • ('i _ 'j) for some i, j < k
  • (8x)('i) for some i < k and x 2 Vars
slide-19
SLIDE 19

Construction Sequences for General Recursive Definitions This idea is very general: using an appropriate notion of construction sequence, we get a ∆-definition of any recursively defined set or function. Suppose want a ∆-formula Factorial(x, y) defining the function Factorial : N ! N (i.e., the {(a, b) 2 N2 : b = a!}). Key idea: Write a ∆-formula defining the set FactorialConstSeq := {(a, b, c) 2 N3 : b = a! and c = h0!, 1!, 2!, . . . , a!i} using Codenumber, Length, IthElement as subformulas. (Details in tutorial.) Homework Problem (PSET 4). Write down a ∆-formula defining the function Fibonacci : N ! N.

slide-20
SLIDE 20

Next Steps (Sections 5.11–5.12) The following are ∆-definable: LogicalAxiom :=

  • p'q : ' is a logical axiom

RuleOfInference :=

  • (hp1q, . . . , pnqi, p'q) : ({1, . . . , n}, ') is a

rule of inference AxiomN :=

  • pN1q, . . . , pN11q

DeductionN :=

  • (hp1q, . . . , p1qi, p'q) : (1, . . . , n) is a

deduction from N of ' . Important ∆-definable functions: Num(a) := p a q, TermSub(puq, pxq, ptq) := pux

t q,

Sub(p'q, pxq, ptq) := p'x

t q.

slide-21
SLIDE 21

∆-definable sets and functions Using an appropriate notion of “construction sequence”, we get a ∆-formula Num(x, y) which defines the function Num(a) := p a q.

slide-22
SLIDE 22

∆-definable sets and functions Using an appropriate notion of “construction sequence”, we get a ∆-formula Num(x, y) which defines the function Num(a) := p a q. This means:

  • N |

= Num(a, b) for all (a, b) 2 N2 such that b = p a q

  • N |

= ¬Num(a, b) for all (a, b) 2 N2 such that b 6= p a q

slide-23
SLIDE 23

∆-definable sets and functions Similarly (by a more complicated “construction sequence”), there is a ∆-formula Sub(x1, x2, x3, y) which define the function Sub(p'q, pxq, ptq) := p'x

t q.

slide-24
SLIDE 24

∆-definable sets and functions Similarly (by a more complicated “construction sequence”), there is a ∆-formula Sub(x1, x2, x3, y) which define the function Sub(p'q, pxq, ptq) := p'x

t q.

This means: for all (a, b, c, d) 2 N4,

  • N |

= Sub(a, b, c, d) if a = p'q and b = pxq and c = ptq and d = p'x

t q for

some formula ' and variable symbol x and term t

  • N |

= ¬Sub(a, b, c, d) otherwise.

slide-25
SLIDE 25

∆-definable sets and functions Using ∆-formulas Num(x, y) and Sub(x1, x2, x3, y) (among other useful ∆- formulas such as Free and Substitutable)), we get ∆-formulas defining sets: LogicalAxiom :=

  • p'q : ' is a logical axiom

AxiomN :=

  • pN1q, . . . , pN11q

, RuleOfInf :=

  • (c, a) : c = hp1q, . . . , pnqi and a = p'q

where ({1, . . . , n}, ') is a rule of inference . Finally, we get a ∆-formula DeductionN(y, z) which defines the set DeductionN :=

  • (c, a) : c = hp1q, . . . , p1qi and a = p'q

where (1, . . . , n) is a deduction from N of ' .

slide-26
SLIDE 26

The Σ-formula ThmN(x) The set ThmN := {p'q : N ` '} is defined by Σ-formula ThmN(x) :⌘ (9y)DeductionN(y, x).

slide-27
SLIDE 27

The Σ-formula ThmN(x) The set ThmN := {p'q : N ` '} is defined by Σ-formula ThmN(x) :⌘ (9y)DeductionN(y, x). This means: for every a 2 N,

  • N |

= Thm(a) if a = p'q for some formula ' such that N ` ', (In this case, N ` Thm(a) since N proves every Σ-sentence which is true in N by Proposition 5.3.13.)

  • N |

= ¬Thm(a) otherwise. (We cannot conclude that N ` ¬Thm(a) since ¬Thm(a) is (equivalent to) a Π-sentence.)

slide-28
SLIDE 28

The Σ-formula ThmN(x) The set ThmN := {p'q : N ` '} is defined by Σ-formula ThmN(x) :⌘ (9y)DeductionN(y, x). There is no obvious way to rewrite ThmN(x) as a ∆-sentence (in fact, this is impossible). For instance, we cannot replace (9y) with (9y < xxx), since this would imply that every formula of length ` provable by ' has a deduction of length < ``` (which is false).

slide-29
SLIDE 29

Representable ) Σ-Definable Previously, we showed that every ∆-definable set is representable. (This is a straightforward corollary of Proposition 5.3.13: N proves every Σ- sentence which is true in N.) Next, we show that every representable set is Σ-definable.