05Predicate Logic CS 5209: Foundation in Logic and AI Martin Henz - - PowerPoint PPT Presentation

05 predicate logic
SMART_READER_LITE
LIVE PREVIEW

05Predicate Logic CS 5209: Foundation in Logic and AI Martin Henz - - PowerPoint PPT Presentation

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic 05Predicate Logic CS 5209: Foundation in Logic and AI Martin Henz and Aquinas


slide-1
SLIDE 1

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

05—Predicate Logic

CS 5209: Foundation in Logic and AI

Martin Henz and Aquinas Hobor

February 11, 2010

Generated on Tuesday 2nd March, 2010, 12:46 CS 5209: Foundation in Logic and AI 05—Predicate Logic 1

slide-2
SLIDE 2

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

1

Predicate Logic: Motivation, Syntax, Proof Theory

2

Semantics of Predicate Logic

3

Soundness and Completeness of Predicate Logic

4

Undecidability of Predicate Logic

CS 5209: Foundation in Logic and AI 05—Predicate Logic 2

slide-3
SLIDE 3

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

1

Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

2

Semantics of Predicate Logic

3

Soundness and Completeness of Predicate Logic

4

Undecidability of Predicate Logic

CS 5209: Foundation in Logic and AI 05—Predicate Logic 3

slide-4
SLIDE 4

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

More Declarative Sentences

Propositional logic can easily handle simple declarative statements such as: Example Student Peter Lim enrolled in CS3234. Propositional logic can also handle combinations of such statements such as: Example Student Peter Lim enrolled in Tutorial 1, and student Julie Bradshaw is enrolled in Tutorial 2. But: How about statements with “there exists...” or “every...”

  • r “among...”?

CS 5209: Foundation in Logic and AI 05—Predicate Logic 4

slide-5
SLIDE 5

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

What is needed?

Example Every student is younger than some instructor. What is this statement about? Being a student Being an instructor Being younger than somebody else These are properties of elements of a set of objects. We express them in predicate logic using predicates.

CS 5209: Foundation in Logic and AI 05—Predicate Logic 5

slide-6
SLIDE 6

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Predicates

Example Every student is younger than some instructor. S(andy) could denote that Andy is a student. I(paul) could denote that Paul is an instructor. Y(andy, paul) could denote that Andy is younger than Paul.

CS 5209: Foundation in Logic and AI 05—Predicate Logic 6

slide-7
SLIDE 7

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

The Need for Variables

Example Every student is younger than some instructor. We use the predicate S to denote student-hood. How do we express “every student”? We need variables that can stand for constant values, and a quantifier symbol that denotes “every”.

CS 5209: Foundation in Logic and AI 05—Predicate Logic 7

slide-8
SLIDE 8

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

The Need for Variables

Example Every student is younger than some instructor. Using variables and quantifiers, we can write: ∀x(S(x) → (∃y(I(y) ∧ Y(x, y)))). Literally: For every x, if x is a student, then there is some y such that y is an instructor and x is younger than y.

CS 5209: Foundation in Logic and AI 05—Predicate Logic 8

slide-9
SLIDE 9

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Another Example

English Not all birds can fly. Predicates B(x): x is a bird F(x): x can fly The sentence in predicate logic ¬(∀x(B(x) → F(x)))

CS 5209: Foundation in Logic and AI 05—Predicate Logic 9

slide-10
SLIDE 10

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

A Third Example

English Every girl is younger than her mother. Predicates G(x): x is a girl M(x, y): x is y’s mother Y(x, y): x is younger than y The sentence in predicate logic ∀x∀y(G(x) ∧ M(y, x) → Y(x, y))

CS 5209: Foundation in Logic and AI 05—Predicate Logic 10

slide-11
SLIDE 11

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

A “Mother” Function

The sentence in predicate logic ∀x∀y(G(x) ∧ M(y, x) → Y(x, y)) Note that y is only introduced to denote the mother of x. If everyone has exactly one mother, the predicate M(y, x) is a function, when read from right to left. We introduce a function symbol m that can be applied to variables and constants as in ∀x(G(x) → Y(x, m(x)))

CS 5209: Foundation in Logic and AI 05—Predicate Logic 11

slide-12
SLIDE 12

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

A Drastic Example

English Andy and Paul have the same maternal grandmother. The sentence in predicate logic without functions ∀x∀y∀u∀v(M(x, y) ∧ M(y, andy) ∧ M(u, v) ∧ M(v, paul) → x = u) The same sentence in predicate logic with functions m(m(andy)) = m(m(paul))

CS 5209: Foundation in Logic and AI 05—Predicate Logic 12

slide-13
SLIDE 13

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Outlook

Syntax: We formalize the language of predicate logic, including scoping and substitution. Proof theory: We extend natural deduction from propositional to predicate logic Semantics: We describe models in which predicates, functions, and formulas have meaning. Further topics: Soundness/completeness (beyond scope of module), undecidability, incompleteness results, compactness results, extensions

CS 5209: Foundation in Logic and AI 05—Predicate Logic 13

slide-14
SLIDE 14

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

1

Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

2

Semantics of Predicate Logic

3

Soundness and Completeness of Predicate Logic

4

Undecidability of Predicate Logic

CS 5209: Foundation in Logic and AI 05—Predicate Logic 14

slide-15
SLIDE 15

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Predicate Vocabulary

At any point in time, we want to describe the features of a particular “world”, using predicates, functions, and constants. Thus, we introduce for this world: a set of predicate symbols P a set of function symbols F a set of constant symbols C

CS 5209: Foundation in Logic and AI 05—Predicate Logic 15

slide-16
SLIDE 16

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Arity of Functions and Predicates

Every function symbol in F and predicate symbol in P comes with a fixed arity, denoting the number of arguments the symbol can take. Special case Function symbols with arity 0 are called constants.

CS 5209: Foundation in Logic and AI 05—Predicate Logic 16

slide-17
SLIDE 17

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Terms

t ::= x | c | f(t, . . . , t) where x ranges over a given set of variables var, c ranges over nullary function symbols in F, and f ranges over function symbols in F with arity n > 0.

CS 5209: Foundation in Logic and AI 05—Predicate Logic 17

slide-18
SLIDE 18

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Examples of Terms

If n is nullary, f is unary, and g is binary, then examples of terms are: g(f(n), n) f(g(n, f(n)))

CS 5209: Foundation in Logic and AI 05—Predicate Logic 18

slide-19
SLIDE 19

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

More Examples of Terms

If 0, 1, . . . are nullary, s is unary, and +, − and ∗ are binary, then ∗(−(2, +(s(x), y)), x) is a term. Occasionally, we allow ourselves to use infix notation for function symbols as in (2 − (s(x) + y)) ∗ x

CS 5209: Foundation in Logic and AI 05—Predicate Logic 19

slide-20
SLIDE 20

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Formulas

φ ::= P(t1, t2, . . . , tn) | (¬φ) | (φ ∧ φ) | (φ ∨ φ) | (φ → φ) | (∀xφ) | (∃xφ) where P ∈ P is a predicate symbol of arity n ≥ 1, ti are terms over F and x is a variable.

CS 5209: Foundation in Logic and AI 05—Predicate Logic 20

slide-21
SLIDE 21

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Conventions

Just like for propositional logic, we introduce convenient conventions to reduce the number of parentheses: ¬, ∀x and ∃x bind most tightly; then ∧ and ∨; then →, which is right-associative.

CS 5209: Foundation in Logic and AI 05—Predicate Logic 21

slide-22
SLIDE 22

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Parse Trees

∀x((P(x) → Q(x)) ∧ S(x, y)) has parse tree ∀x ∧ → P x Q x S x y

CS 5209: Foundation in Logic and AI 05—Predicate Logic 22

slide-23
SLIDE 23

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Another Example

Every son of my father is my brother. Predicates S(x, y): x is a son of y B(x, y): x is a brother of y Functions m: constant for “me” f(x): father of x The sentence in predicate logic ∀x(S(x, f(m)) → B(x, m)) Does this formula hold?

CS 5209: Foundation in Logic and AI 05—Predicate Logic 23

slide-24
SLIDE 24

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Equality as Predicate

Equality is a common predicate, usually used in infix notation. =∈ P Example Instead of the formula = (f(x), g(x)) we usually write the formula f(x) = g(x)

CS 5209: Foundation in Logic and AI 05—Predicate Logic 24

slide-25
SLIDE 25

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Free and Bound Variables

Consider the formula ∀x((P(x) → Q(x)) ∧ S(x, y)) What is the relationship between variable “binder” x and

  • ccurrences of x?

∀x ∧ → P x Q x S x y

CS 5209: Foundation in Logic and AI 05—Predicate Logic 25

slide-26
SLIDE 26

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Free and Bound Variables

Consider the formula (∀x(P(x) ∧ Q(x))) → (¬P(x) ∨ Q(y)) Which variable occurrences are free; which are bound? → ∀x ∧ P x Q x ∨ ¬ P x Q y

CS 5209: Foundation in Logic and AI 05—Predicate Logic 26

slide-27
SLIDE 27

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Substitution

Variables are placeholders. Replacing them by terms is called substitution. Definition Given a variable x, a term t and a formula φ, we define [x ⇒ t]φ to be the formula obtained by replacing each free occurrence of variable x in φ with t. Example [x ⇒ f(x, y)]((∀x(P(x) ∧ Q(x))) → (¬P(x) ∨ Q(y))) = ∀x(P(x) ∧ Q(x))) → (¬P(f(x, y)) ∨ Q(y))

CS 5209: Foundation in Logic and AI 05—Predicate Logic 27

slide-28
SLIDE 28

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

A Note on Notation

Instead of [x ⇒ t]φ the textbook uses the notation φ[t/x] (we find the order of arguments in the latter notation hard to remember)

CS 5209: Foundation in Logic and AI 05—Predicate Logic 28

slide-29
SLIDE 29

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Example as Parse Tree

[x ⇒ f(x, y)]((∀x(P(x) ∧ Q(x))) → (¬P(x) ∨ Q(y))) = (∀x(P(x) ∧ Q(x))) → (¬P(f(x, y)) ∨ Q(y)) → ∀x ∧ P x Q x ∨ ¬ P x Q y

CS 5209: Foundation in Logic and AI 05—Predicate Logic 29

slide-30
SLIDE 30

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Example as Parse Tree

→ ∀x ∧ P x Q x ∨ ¬ P f x y Q y

CS 5209: Foundation in Logic and AI 05—Predicate Logic 30

slide-31
SLIDE 31

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Capturing in [x ⇒ t]φ

Problem t contains variable y and x occurs under the scope of ∀y in φ Example [x ⇒ f(y, y)](S(x) ∧ ∀y(P(x) → Q(y))) ∧ S x ∀y → P x Q y

CS 5209: Foundation in Logic and AI 05—Predicate Logic 31

slide-32
SLIDE 32

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Avoiding Capturing

Definition Given a term t, a variable x and a formula φ, we say that t is free for x in φ if no free x leaf in φ occurs in the scope of ∀y or ∃y for any variable y occurring in t. Free-ness as precondition In order to compute [x ⇒ t]φ, we demand that t is free for x in φ. What if not? Rename the bound variable!

CS 5209: Foundation in Logic and AI 05—Predicate Logic 32

slide-33
SLIDE 33

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Example of Renaming

[x ⇒ f(y, y)](S(x) ∧ ∀y(P(x) → Q(y))) ⇓ [x ⇒ f(y, y)](S(x) ∧ ∀z(P(x) → Q(z))) ⇓ S(f(y, y)) ∧ ∀z(P(f(y, y)) → Q(z))

CS 5209: Foundation in Logic and AI 05—Predicate Logic 33

slide-34
SLIDE 34

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

1

Predicate Logic: Motivation, Syntax, Proof Theory Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

2

Semantics of Predicate Logic

3

Soundness and Completeness of Predicate Logic

4

Undecidability of Predicate Logic

CS 5209: Foundation in Logic and AI 05—Predicate Logic 34

slide-35
SLIDE 35

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Natural Deduction for Predicate Logic

Relationship between propositional and predicate logic If we consider propositions as nullary predicates, propositional logic is a sub-language of predicate logic. Inheriting natural deduction We can translate the rules for natural deduction in propositional logic directly to predicate logic. Example φ ψ φ ∧ ψ [∧i]

CS 5209: Foundation in Logic and AI 05—Predicate Logic 35

slide-36
SLIDE 36

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Built-in Rules for Equality

t = t [= i] ti = t2 [x ⇒ t1]φ [x ⇒ t2]φ [= e]

CS 5209: Foundation in Logic and AI 05—Predicate Logic 36

slide-37
SLIDE 37

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Properties of Equality

We show: f(x) = g(x) ⊢ h(g(x)) = h(f(x)) using t = t [= i] t1 = t2 [x ⇒ t1]φ [x ⇒ t2]φ [= e] 1 f(x) = g(x) premise 2 h(f(x)) = h(f(x)) = i 3 h(g(x)) = h(f(x)) = e 1,2

CS 5209: Foundation in Logic and AI 05—Predicate Logic 37

slide-38
SLIDE 38

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Rules for Universal Quantification

∀xφ [x ⇒ t]φ [∀x e]

CS 5209: Foundation in Logic and AI 05—Predicate Logic 38

slide-39
SLIDE 39

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Example

∀xφ [x ⇒ t]φ [∀x e] We prove: F(g(john)), ∀x(F(x) → ¬M(x)) ⊢ ¬M(g(john)) 1 F(g(john)) premise 2 ∀x(F(x) → ¬M(x)) premise 3 F(g(john)) → ¬M(g(john)) ∀x e 2 4 ¬M(g(john)) → e 3,1

CS 5209: Foundation in Logic and AI 05—Predicate Logic 39

slide-40
SLIDE 40

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Rules for Universal Quantification

If we manage to establish a formula φ about a fresh variable x0, we can assume ∀xφ.

✞ ✝ ☎ ✆

x0 . . . [x ⇒ x0]φ ∀xφ [∀x i]

CS 5209: Foundation in Logic and AI 05—Predicate Logic 40

slide-41
SLIDE 41

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Example

∀x(P(x) → Q(x)), ∀xP(x) ⊢ ∀xQ(x) via

✞ ✝ ☎ ✆

x0 . . . [x ⇒ x0]φ ∀xφ 1 ∀x(P(x) → Q(x)) premise 2 ∀xP(x) premise 3 x0 P(x0) → Q(x0) ∀x e 1 4 P(x0) ∀x e 2 5 Q(x0) → e 3,4 6 ∀xQ(x) ∀x i 3–5

CS 5209: Foundation in Logic and AI 05—Predicate Logic 41

slide-42
SLIDE 42

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Rules for Existential Quantification

[x ⇒ t]φ ∃xφ [∃x i] ∃xφ

✞ ✝ ☎ ✆

x0 [x ⇒ x0]φ . . . χ χ [∃e]

CS 5209: Foundation in Logic and AI 05—Predicate Logic 42

slide-43
SLIDE 43

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Example

∀x(P(x) → Q(x)), ∃xP(x) ⊢ ∃xQ(x) 1 ∀x(P(x) → Q(x)) premise 2 ∃xP(x) premise 3 x0 P(x0) assumption 4 P(x0) → Q(x0) ∀x e 1 5 Q(x0) → e 4,3 6 ∃xQ(x) ∃x i 5 7 ∃xQ(x) ∃x e 2,3–6

CS 5209: Foundation in Logic and AI 05—Predicate Logic 43

slide-44
SLIDE 44

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic Need for Richer Language Predicate Logic as Formal Language Proof Theory of Predicate Logic Quantifier Equivalences

Examples of Quantifier Equivalences

¬∀xφ ⊣⊢ ∃x¬φ ¬∃xφ ⊣⊢ ∀x¬φ ∃x∃yφ ⊣⊢ ∃y∃xφ Assume x is not free in ψ: ∀xφ ∧ ψ ⊣⊢ ∀x(φ ∧ ψ) ∃x(ψ → φ) ⊣⊢ ψ → ∃xφ

CS 5209: Foundation in Logic and AI 05—Predicate Logic 44

slide-45
SLIDE 45

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

1

Predicate Logic: Motivation, Syntax, Proof Theory

2

Semantics of Predicate Logic

3

Soundness and Completeness of Predicate Logic

4

Undecidability of Predicate Logic

CS 5209: Foundation in Logic and AI 05—Predicate Logic 45

slide-46
SLIDE 46

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

Models

Definition Let F contain function symbols and P contain predicate

  • symbols. A model M for (F, P) consists of:

1

A non-empty set A, the universe;

2

for each nullary function symbol f ∈ F a concrete element f M ∈ A;

3

for each f ∈ F with arity n > 0, a concrete function f M : An → A;

4

for each P ∈ P with arity n > 0, a set PM ⊆ An.

CS 5209: Foundation in Logic and AI 05—Predicate Logic 46

slide-47
SLIDE 47

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

Example

Let F = {e, ·} and P = {≤}. Let model M for (F, P) be defined as follows:

1

Let A be the set of binary strings over the alphabet {0, 1};

2

let eM = ǫ, the empty string;

3

let ·M be defined such that s1 ·M s2 is the concatenation of the strings s1 and s2; and

4

let ≤M be defined such that s1 ≤M s2 iff s1 is a prefix of s2.

CS 5209: Foundation in Logic and AI 05—Predicate Logic 47

slide-48
SLIDE 48

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

Example (continued)

1

Let A be the set of binary strings over the alphabet {0, 1};

2

let eM = ǫ, the empty string;

3

let ·M be defined such that s1 ·M s2 is the concatenation of the strings s1 and s2; and

4

let ≤M be defined such that s1 ≤M s2 iff s1 is a prefix of s2. Some Elements of A 10001 ǫ 1010 ·M 1100 = 10101100 ǫ 000 ·M ǫ = 000

CS 5209: Foundation in Logic and AI 05—Predicate Logic 48

slide-49
SLIDE 49

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

Equality Revisited

Interpretation of equality Usually, we require that the equality predicate = is interpreted as same-ness. Extensionality restriction This means that allowable models are restricted to those in which a =M b holds if and only if a and b are the same elements of the model’s universe.

CS 5209: Foundation in Logic and AI 05—Predicate Logic 49

slide-50
SLIDE 50

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

Example (continued)

1

Let A be the set of binary strings over the alphabet {0, 1};

2

let eM = ǫ, the empty string;

3

let ·M be defined such that s1 ·M s2 is the concatenation of the strings s1 and s2; and

4

let ≤M be defined such that s1 ≤M s2 iff s1 is a prefix of s2. Equality in M 000 =M 000 001 =M 100

CS 5209: Foundation in Logic and AI 05—Predicate Logic 50

slide-51
SLIDE 51

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

Another Example

Let F = {z, s} and P = {≤}. Let model M for (F, P) be defined as follows:

1

Let A be the set of natural numbers;

2

let zM = 0;

3

let sM be defined such that s(n) = n + 1; and

4

let ≤M be defined such that n1 ≤M n2 iff the natural number n1 is less than or equal to n2.

CS 5209: Foundation in Logic and AI 05—Predicate Logic 51

slide-52
SLIDE 52

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

How To Handle Free Variables?

Idea We can give meaning to formulas with free variables by providing an environment (lookup table) that assigns variables to elements of our universe: l : var → A. Environment extension We define environment extension such that l[x → a] is the environment that maps x to a and any other variable y to l(y).

CS 5209: Foundation in Logic and AI 05—Predicate Logic 52

slide-53
SLIDE 53

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

Satisfaction Relation

The model M satisfies φ with respect to environment l, written M | =l φ: in case φ is of the form P(t1, t2, . . . , tn), if the result (a1, a2, . . . , an) of evaluating t1, t2, . . . , tn with respect to l is in PM; in case φ has the form ∀xψ, if the M | =l[x→a] ψ holds for all a ∈ A; in case φ has the form ∃xψ, if the M | =l[x→a] ψ holds for some a ∈ A;

CS 5209: Foundation in Logic and AI 05—Predicate Logic 53

slide-54
SLIDE 54

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

Satisfaction Relation (continued)

in case φ has the form ¬ψ, if M | =l ψ does not hold; in case φ has the form ψ1 ∨ ψ2, if M | =l ψ1 holds or M | =l ψ2 holds; in case φ has the form ψ1 ∧ ψ2, if M | =l ψ1 holds and M | =l ψ2 holds; and in case φ has the form ψ1 → ψ2, if M | =l ψ1 holds whenever M | =l ψ2 holds.

CS 5209: Foundation in Logic and AI 05—Predicate Logic 54

slide-55
SLIDE 55

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

Satisfaction of Closed Formulas

If a formula φ has no free variables, we call φ a sentence. M | =l φ holds or does not hold regardless of the choice of l. Thus we write M | = φ or M | = φ.

CS 5209: Foundation in Logic and AI 05—Predicate Logic 55

slide-56
SLIDE 56

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

Semantic Entailment and Satisfiability

Let Γ be a possibly infinite set of formulas in predicate logic and ψ a formula. Entailment Γ | = ψ iff for all models M and environments l, whenever M | =l φ holds for all φ ∈ Γ, then M | =l ψ. Satisfiability of Formulas ψ is satisfiable iff there is some model M and some environment l such that M | =l ψ holds. Satisfiability of Formula Sets Γ is satisfiable iff there is some model M and some environment l such that M | =l φ, for all φ ∈ Γ.

CS 5209: Foundation in Logic and AI 05—Predicate Logic 56

slide-57
SLIDE 57

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

Semantic Entailment and Satisfiability

Let Γ be a possibly infinite set of formulas in predicate logic and ψ a formula. Validity ψ is valid iff for all models M and environments l, we have M | =l ψ.

CS 5209: Foundation in Logic and AI 05—Predicate Logic 57

slide-58
SLIDE 58

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

The Problem with Predicate Logic

Entailment ranges over models Semantic entailment between sentences: φ1, φ2, . . . , φn | = ψ requires that in all models that satisfy φ1, φ2, . . . , φn, the sentence ψ is satisfied. How to effectively argue about all possible models? Usually the number of models is infinite; it is very hard to argue

  • n the semantic level in predicate logic.

Idea from propositional logic Can we use natural deduction for showing entailment?

CS 5209: Foundation in Logic and AI 05—Predicate Logic 58

slide-59
SLIDE 59

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

Central Result of Natural Deduction

φ1, . . . , φn | = ψ iff φ1, . . . , φn ⊢ ψ proven by Kurt G¨

  • del, in 1929 in his doctoral dissertation

CS 5209: Foundation in Logic and AI 05—Predicate Logic 59

slide-60
SLIDE 60

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

Recall: Decidability

Decision problems A decision problem is a question in some formal system with a yes-or-no answer. Decidability Decision problems for which there is an algorithm that returns “yes” whenever the answer to the problem is “yes”, and that returns “no” whenever the answer to the problem is “no”, are called decidable. Decidability of satisfiability The question, whether a given propositional formula is satisifiable, is decidable.

CS 5209: Foundation in Logic and AI 05—Predicate Logic 60

slide-61
SLIDE 61

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

Undecidability of Predicate Logic

Theorem The decision problem of validity in predicate logic is undecidable: no program exists which, given any language in predicate logic and any formula φ in that language, decides whether | = φ. Proof Establish that the Post Correspondence Problem (PCP) is undecidable (here only as sketch). Translate an arbitrary PCP , say C, to a formula φ. Establish that | = φ holds if and only if C has a solution. Conclude that validity of pred. logic formulas is undecidable.

CS 5209: Foundation in Logic and AI 05—Predicate Logic 61

slide-62
SLIDE 62

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

Post Correspondence Problem

Informally Can we line up copies of the cards such that the top row spells

  • ut the same sequence as the bottom row?

Formally Given a finite sequence of pairs (s1, t1), (s2, t2), . . . , (sk, tk) such that all si and ti are binary strings of positive length, is there a sequence of indices i1, i2, . . . , in with n ≥ 1 such that the concatenations si1si2 . . . sin and ti1ti2 . . . tin are equal?

CS 5209: Foundation in Logic and AI 05—Predicate Logic 62

slide-63
SLIDE 63

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

Undecidability of Post Correspondence Problem

Turing machines Basic abstract symbol-manipulating devices that can simulate in prinicple any computer algorithm. The input is a string of symbols on a tape, and the machine “accepts” the input string, if it reaches one of a number of accepting states. Termination of Programs is Undecidable It is undecidable, whether program with input terminates. Proof idea For a Turing machine with a given input, construct a PCP such that a solution of the PCP exists if and only if the Turing machine accepts the solution.

CS 5209: Foundation in Logic and AI 05—Predicate Logic 63

slide-64
SLIDE 64

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

Translate Post Correspondence Problem to Formula

Bits as Functions Represent bits 0 and 1 by functions f0 and f1. Strings as Terms Represent the empty string by a constant e. The string b1b2 . . . bl corresponds to the term fbl(fbl−1 . . . (fb2(fb1(e))) . . .)

CS 5209: Foundation in Logic and AI 05—Predicate Logic 64

slide-65
SLIDE 65

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

Towards a Formula for a PCP

Let C be the problem s1 s2 . . . sk t1 t2 . . . tk Idea P(s, t) holds iff there is a sequence of indices (i1, i2, . . . , im) such that s is si1si2 . . . sim and t is ti1ti2 . . . tim.

CS 5209: Foundation in Logic and AI 05—Predicate Logic 65

slide-66
SLIDE 66

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

The Formula φ

φ = φ1 ∧ φ2 → φ3, where φ1 =

k

  • i=1

P(fsi(e), fti(e)) φ2 = ∀v∀w(P(v, w) →

k

  • i=1

P(fsi(v), fti(w))) φ3 = ∃zP(z, z)

CS 5209: Foundation in Logic and AI 05—Predicate Logic 66

slide-67
SLIDE 67

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

Undecidability of Predicate Logic

So Far Post correspondence problem is undecidable. Constructed φC for Post correspondence problem C. To Show | = φC holds if and only if C has a solution. Proof Proof via construction of φC. Formally construct an interpretation of strings and show that whenever there is a solution, the formula φC holds and vice versa.

CS 5209: Foundation in Logic and AI 05—Predicate Logic 67

slide-68
SLIDE 68

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

Summary of Undecidability Proof

Theorem The decision problem of validity in predicate logic is undecidable: no program exists which, given any language in predicate logic and any formula φ in that language, decides whether | = φ. Proof Establish that the Post Correspondence Problem (PCP) is undecidable Translate an arbitrary PCP , say C, to a formula φ. Establish that | = φ holds if and only if C has a solution. Conclude that validity of pred. logic formulas is undecidable.

CS 5209: Foundation in Logic and AI 05—Predicate Logic 68

slide-69
SLIDE 69

Predicate Logic: Motivation, Syntax, Proof Theory Semantics of Predicate Logic Soundness and Completeness of Predicate Logic Undecidability of Predicate Logic

Next Week

CNY

CS 5209: Foundation in Logic and AI 05—Predicate Logic 69