<<

first-order : ingredients

There is a domain of , and

I variables: x, y, z,... ranging over the domain

I constant symbols (names): 0 1 π e Albert Einstein

I function symbols: + ∗ − / sin(−) exp(−) I predicates: = > 6 male(−) parent(−, −) I propositional connectives: ∧ ∨ q −→ ←→ O ↑ ↓ I quantifiers: ∀ ∃.

Tibor Beke first order syntax False.

sentences

Let the domain of interpretation be the set of real numbers.

∀a ∀b ∀c ∃x(ax2 + bx + c = 0)

This formula is an example of a sentence from first-order logic. It has no free variables: every one of the variables a, b, c, x is in the scope of a quantifier.

A sentence has a well-defined value that can be discovered (at least, in principle). The sentence above (interpreted over the real numbers) is

Tibor Beke first order syntax sentences

Let the domain of interpretation be the set of real numbers.

∀a ∀b ∀c ∃x(ax2 + bx + c = 0)

This formula is an example of a sentence from first-order logic. It has no free variables: every one of the variables a, b, c, x is in the scope of a quantifier.

A sentence has a well-defined truth value that can be discovered (at least, in principle). The sentence above (interpreted over the real numbers) is False.

Tibor Beke first order syntax “Every woman has two children ”

but is, in fact, logically equivalent to every woman having at least one child. That child could play the role of both y and z.

sentences

Let the be a set of people, let F (x) mean “x is female” and let P(x, y) mean “x is a parent of y”.   ∀x F (x) −→ ∃y∃zP(x, y) ∧ P(x, z)

This sentence seems to be saying

Tibor Beke first order syntax sentences

Let the domain of discourse be a set of people, let F (x) mean “x is female” and let P(x, y) mean “x is a parent of y”.   ∀x F (x) −→ ∃y∃zP(x, y) ∧ P(x, z)

This sentence seems to be saying

“Every woman has two children ”

but is, in fact, logically equivalent to every woman having at least one child. That child could play the role of both y and z.

Tibor Beke first order syntax Suppose the domain of discourse is the natural numbers 0, 1, 2, 3,... . What is the meaning of the following formula?  ∀p∀q pq = n −→ (p = 1 O q = 1) “n is a prime number”

open formulas

A first-order formula that contains free variables is said to be open. You cannot associate a truth value to it unless the free variables are specialized to some element of the domain:  ∀x f (x) 6 f (x0) An open formula can be thought of as defining a property (“predicate”) of its free (s).

Tibor Beke first order syntax “n is a prime number”

open formulas

A first-order formula that contains free variables is said to be open. You cannot associate a truth value to it unless the free variables are specialized to some element of the domain:  ∀x f (x) 6 f (x0) An open formula can be thought of as defining a property (“predicate”) of its free variable(s).

Suppose the domain of discourse is the natural numbers 0, 1, 2, 3,... . What is the meaning of the following formula?  ∀p∀q pq = n −→ (p = 1 O q = 1)

Tibor Beke first order syntax open formulas

A first-order formula that contains free variables is said to be open. You cannot associate a truth value to it unless the free variables are specialized to some element of the domain:  ∀x f (x) 6 f (x0) An open formula can be thought of as defining a property (“predicate”) of its free variable(s).

Suppose the domain of discourse is the natural numbers 0, 1, 2, 3,... . What is the meaning of the following formula?  ∀p∀q pq = n −→ (p = 1 O q = 1) “n is a prime number”

Tibor Beke first order syntax “ x is a grandparent of y ”

∃w∃z∃uP(w, z) ∧ P(z, x) ∧ P(w, u) ∧ P(u, y)

“ x and y are cousins (or siblings, or the same people!) ”

open formulas

F (x): x is female M(x): x is male P(x, y): x is a parent of y

∃zP(x, z) ∧ P(z, y)

Tibor Beke first order syntax ∃w∃z∃uP(w, z) ∧ P(z, x) ∧ P(w, u) ∧ P(u, y)

“ x and y are cousins (or siblings, or the same people!) ”

open formulas

F (x): x is female M(x): x is male P(x, y): x is a parent of y

∃zP(x, z) ∧ P(z, y)

“ x is a grandparent of y ”

Tibor Beke first order syntax “ x and y are cousins (or siblings, or the same people!) ”

open formulas

F (x): x is female M(x): x is male P(x, y): x is a parent of y

∃zP(x, z) ∧ P(z, y)

“ x is a grandparent of y ”

∃w∃z∃uP(w, z) ∧ P(z, x) ∧ P(w, u) ∧ P(u, y)

Tibor Beke first order syntax open formulas

F (x): x is female M(x): x is male P(x, y): x is a parent of y

∃zP(x, z) ∧ P(z, y)

“ x is a grandparent of y ”

∃w∃z∃uP(w, z) ∧ P(z, x) ∧ P(w, u) ∧ P(u, y)

“ x and y are cousins (or siblings, or the same people!) ”

Tibor Beke first order syntax first-order logic: syntax

We will define the notion of well-formed formula. The definition will be “step-by-step” (inductive).

• A is a composite of function symbols, variables and constants. Terms denote elements of the domain — specific or unspecified elements. Examples of terms x π Pope Francis 23 · 24 sin2(kx) + 23 a · x2 + b · x + c

Tibor Beke first order syntax first-order logic: atomic formulas

• Suppose t1, t2,..., tn are terms, and R(−, −,..., −) is an n-ary relation symbol. The

R(t1, t2,..., tn)

is called an .

Atomic formulas contain neither propositional connectives nor quantifiers. They are the simplest types of expressions that can be evaluated to True or False — if their free variables are specialized to some element of the domain, that is. They are the same, essentially, as the “atomic ” of propositional logic.

Tibor Beke first order syntax examples of atomic formulas

π > e x = y friends(Big Bird, Cookie Monster) spouse(Pope Francis, x) collinear(p, q, r) x2 + 1 > sin(z) + 23

Tibor Beke first order syntax first-order logic: well-formed formulas

We will define well-formed formulas the following way:

I Any atomic formula is well-formed.

I If α and β are well-formed and ? is any binary propositional connective, then (α ? β)

is well-formed. (‘?’ could be any of ∧ ∨ −→ O ←→ ↑ ↓ .) I If α is well-formed, so is qα. I If α is well-formed and x is any variable then the expressions

∀xα

∃xα are both well-formed.

Tibor Beke first order syntax not well-formed (if we’re sticklers!)

wff

not wff

not wff

wff

wff

wff (strange but true!)

which of the following is a well-formed formula?

P(x) ∧ Q(y) ∧ R(z)

  ∃x P(x, y) ∧ Q(x) ∨ R(y)

 ∃x ∧ ∃y P(x)OQ(y)  q q∀x∃yR(x)  q ∀xQ(x, y) −→q∃yqqQ(z, z)  q ∀yq ∃x P(z) ←→ ∃xQ(x)

q ∀zq ∀z∃zQ(x, y)

Tibor Beke first order syntax wff

not wff

not wff

wff

wff

wff (strange but true!)

which of the following is a well-formed formula?

P(x) ∧ Q(y) ∧ R(z) not well-formed (if we’re sticklers!)

  ∃x P(x, y) ∧ Q(x) ∨ R(y)

 ∃x ∧ ∃y P(x)OQ(y)  q q∀x∃yR(x)  q ∀xQ(x, y) −→q∃yqqQ(z, z)  q ∀yq ∃x P(z) ←→ ∃xQ(x)

q ∀zq ∀z∃zQ(x, y)

Tibor Beke first order syntax not wff

not wff

wff

wff

wff (strange but true!)

which of the following is a well-formed formula?

P(x) ∧ Q(y) ∧ R(z) not well-formed (if we’re sticklers!)

  ∃x P(x, y) ∧ Q(x) ∨ R(y) wff

 ∃x ∧ ∃y P(x)OQ(y)  q q∀x∃yR(x)  q ∀xQ(x, y) −→q∃yqqQ(z, z)  q ∀yq ∃x P(z) ←→ ∃xQ(x)

q ∀zq ∀z∃zQ(x, y)

Tibor Beke first order syntax not wff

wff

wff

wff (strange but true!)

which of the following is a well-formed formula?

P(x) ∧ Q(y) ∧ R(z) not well-formed (if we’re sticklers!)

  ∃x P(x, y) ∧ Q(x) ∨ R(y) wff

 ∃x ∧ ∃y P(x)OQ(y) not wff  q q∀x∃yR(x)  q ∀xQ(x, y) −→q∃yqqQ(z, z)  q ∀yq ∃x P(z) ←→ ∃xQ(x)

q ∀zq ∀z∃zQ(x, y)

Tibor Beke first order syntax wff

wff

wff (strange but true!)

which of the following is a well-formed formula?

P(x) ∧ Q(y) ∧ R(z) not well-formed (if we’re sticklers!)

  ∃x P(x, y) ∧ Q(x) ∨ R(y) wff

 ∃x ∧ ∃y P(x)OQ(y) not wff  q q∀x∃yR(x) not wff  q ∀xQ(x, y) −→q∃yqqQ(z, z)  q ∀yq ∃x P(z) ←→ ∃xQ(x)

q ∀zq ∀z∃zQ(x, y)

Tibor Beke first order syntax wff

wff (strange but true!)

which of the following is a well-formed formula?

P(x) ∧ Q(y) ∧ R(z) not well-formed (if we’re sticklers!)

  ∃x P(x, y) ∧ Q(x) ∨ R(y) wff

 ∃x ∧ ∃y P(x)OQ(y) not wff  q q∀x∃yR(x) not wff  q ∀xQ(x, y) −→q∃yqqQ(z, z) wff  q ∀yq ∃x P(z) ←→ ∃xQ(x)

q ∀zq ∀z∃zQ(x, y)

Tibor Beke first order syntax wff (strange but true!)

which of the following is a well-formed formula?

P(x) ∧ Q(y) ∧ R(z) not well-formed (if we’re sticklers!)

  ∃x P(x, y) ∧ Q(x) ∨ R(y) wff

 ∃x ∧ ∃y P(x)OQ(y) not wff  q q∀x∃yR(x) not wff  q ∀xQ(x, y) −→q∃yqqQ(z, z) wff  q ∀yq ∃x P(z) ←→ ∃xQ(x) wff

q ∀zq ∀z∃zQ(x, y)

Tibor Beke first order syntax which of the following is a well-formed formula?

P(x) ∧ Q(y) ∧ R(z) not well-formed (if we’re sticklers!)

  ∃x P(x, y) ∧ Q(x) ∨ R(y) wff

 ∃x ∧ ∃y P(x)OQ(y) not wff  q q∀x∃yR(x) not wff  q ∀xQ(x, y) −→q∃yqqQ(z, z) wff  q ∀yq ∃x P(z) ←→ ∃xQ(x) wff

q ∀zq ∀z∃zQ(x, y) wff (strange but true!)

Tibor Beke first order syntax unique parsing

If α is a wff but not atomic then it must arise from smaller wff (“subformulas”) using one of the three rules of formation: (1) If α and β are well-formed and ? is any propositional connective, then (α ? β) is well-formed. (2) If α is well-formed, so is qα. (3) If α is well-formed and x is any variable then the expressions ∀xα and ∃xα are both well-formed. The following is true (and requires proof, which will not be given here):

If a well-formed formula is not atomic then it can be generated from well-formed subformulas using one of rules (1), (2) or (3). There is no ambiguity which rule applied, and the subformulas involved are uniquely determined too.

Tibor Beke first order syntax unique parsing: example

n   o ∀xP(x, y) ∧ ∃yQ(z) O qq∀zR(z, x) ∨ ∀xP(y) is well-formed. It comes from ∀xP(x, y) ∧ ∃yQ(z) and   qq∀zR(z, x) ∨ ∀xP(y) , both of which are well-formed, using an instance of rule (1). It cannot be broken up into well-formed subformulas any other way.

Its subformulas can be broken up into yet smaller subformulas, generating what is called the “parse tree” of the formula. This process in unambiguous. A well-formed formula cannot be “read” two different ways.

Tibor Beke first order syntax why this is important

I using very few rules of “grammar”, we were able to specify all the formulas we consider meaningful; no need for elaborate rules of parenthesization; no chance for ambiguity like

p ∧ q ∨ r

I this method of specifying the syntax of well-formed expressions has become influential both for programming languages (ALGOL 60, C) and for natural language processing

I wff are great for logic and computer algorithms; for human consumption, we will drop the outermost parentheses and continue to write formulas like

x > 0 ∨ x = 0 ∨ x < 0

rather than ((x > 0 ∨ x = 0) ∨ x < 0) etc.

Tibor Beke first order syntax scope and binding

In a well-formed formula, a variable may appear free, or it may be in the scope of a quantifier. One also says that the quantifier binds an occurrence of a variable. A variable can appear several times in a formula, free at some locations and bound at others. can appear confusing!

∀x(q ∃y∀z(P(x, y, z) ↓ ∀xQ(x)) ∧ R(x, z)) ∨ ∃yS(x, y) That initial for every x, just which of the other x’s is it referring to? And the y? z?

Tibor Beke first order syntax scope and binding

I In an atomic formula R(t1, t2,..., tn), any variables that appear are free.

I Let x be some variable. In the formula ∀xα, the free occurrences of x in α become bound by the initial ∀x. Those occurrences of x in α that are not free (that are already bound by some quantifier) will not fall under the scope of the initial ∀x. Similarly for ∃xα.

I Iterating this rule (as one builds up a formula from subformulas) one can determine unambiguously(!) which quantifier binds which variable.

Tibor Beke first order syntax Homework Problem 19

Let our variables range over the natural numbers 0, 1, 2, 3,... with +, ·, =, > having their usual meaning. Write down a first-order formula that expresses the following: There are infinitely many prime numbers. Hint: you cannot directly say “infinitely many” in first order logic — you only have “for every ... ” and “there is some ... ”. But you could express the following: For any number n, there is a number bigger than n that is prime. Or, if you want, you could express the following: It is not true that there is a biggest prime number. Due Tue, Oct 30, in class.

Tibor Beke first order syntax Homework Problem 20

Suppose your variables range over all people. Let the binary predicate R(x, y) mean “person x respects person y”.

Formalize the following statements in first order logic, using the predicates R(−, −) and ‘ = ’ only:

(a) Everyone is respected by someone. (b) Everyone respects at least two people. (c) No one is respected by everyone. (d) If you respect everyone you’ll find that everyone respects you. (e) If you respect no one you’ll find that no one respects you. (f) People that you respect, will respect you too.

Due Tue, Oct 30, in class.

Tibor Beke first order syntax