Tải bản đầy đủ (.pdf) (73 trang)

Chapter 2 Predicate Logic Discrete Mathematics II BKTPHCM

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (551.6 KB, 73 trang )

Predicate Logic
Nguyen An Khuong,
Huynh Tuong Nguyen

Chapter 2
Predicate Logic
Discrete Mathematics II

Contents
Predicate Logic:
Motivation, Syntax,
Proof Theory
Need for Richer Language
Predicate Logic as Formal
Language

(Materials drawn from Chapter 2 in:

Proof Theory of Predicate
Logic
Quantifier Equivalences

“Michael Huth and Mark Ryan. Logic in Computer Science: Modelling and
Reasoning about Systems, 2nd Ed., Cambridge University Press, 2006.”)

Semantics of Predicate
Logic
Soundness and
Completeness of
Predicate Logic
Undecidability of


Predicate Logic

Nguyen An Khuong, Huynh Tuong Nguyen
Faculty of Computer Science and Engineering
University of Technology, VNU-HCM

Compactness of
Predicate Calculus
Homeworks and Next
Week Plan?

2.1


Contents

Predicate Logic
Nguyen An Khuong,
Huynh Tuong Nguyen

1 Predicate Logic: Motivation, Syntax, Proof Theory

Need for Richer Language
Predicate Logic as Formal Language
Proof Theory of Predicate Logic
Quantifier Equivalences

Contents
Predicate Logic:
Motivation, Syntax,

Proof Theory
Need for Richer Language

2 Semantics of Predicate Logic

Predicate Logic as Formal
Language
Proof Theory of Predicate
Logic

3 Soundness and Completeness of Predicate Logic
4 Undecidability of Predicate Logic

Quantifier Equivalences

Semantics of Predicate
Logic
Soundness and
Completeness of
Predicate Logic
Undecidability of
Predicate Logic

5 Compactness of Predicate Calculus

Compactness of
Predicate Calculus
Homeworks and Next
Week Plan?


2.2


Predicate Logic
Nguyen An Khuong,
Huynh Tuong Nguyen

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

Contents
Predicate Logic:
Motivation, Syntax,
Proof Theory
Need for Richer Language
Predicate Logic as Formal
Language

3 Soundness and Completeness of Predicate Logic

Proof Theory of Predicate
Logic
Quantifier Equivalences

4 Undecidability of Predicate Logic

5 Compactness of Predicate Calculus

Semantics of Predicate
Logic
Soundness and
Completeness of
Predicate Logic
Undecidability of
Predicate Logic
Compactness of
Predicate Calculus
Homeworks and Next
Week Plan?

2.3


More Declarative Sentences

Predicate Logic
Nguyen An Khuong,
Huynh Tuong Nguyen

• Propositional logic can easily handle simple declarative

statements such as:
Example

Student Hung enrolled in DMII.
• Propositional logic can also handle combinations of such


statements such as:
Example

Student Hung enrolled in Tutorial 1, and student Cuong is enrolled
in Tutorial 2.
• But: How about statements with “there exists...” or “every...”

or “among...”?

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

Semantics of Predicate
Logic
Soundness and
Completeness of
Predicate Logic
Undecidability of
Predicate Logic
Compactness of
Predicate Calculus

Homeworks and Next
Week Plan?

2.4


What is needed?

Predicate Logic
Nguyen An Khuong,
Huynh Tuong Nguyen

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.

Contents
Predicate Logic:
Motivation, Syntax,
Proof Theory
Need for Richer Language
Predicate Logic as Formal
Language

Proof Theory of Predicate
Logic
Quantifier Equivalences

Semantics of Predicate
Logic
Soundness and
Completeness of
Predicate Logic
Undecidability of
Predicate Logic
Compactness of
Predicate Calculus
Homeworks and Next
Week Plan?

2.5


Predicates

Predicate Logic
Nguyen An Khuong,
Huynh Tuong Nguyen

Example

Contents

Every student is younger than some instructor.


Predicate Logic:
Motivation, Syntax,
Proof Theory
Need for Richer Language

• S(An) could denote that An is a student.
• I(Binh) could denote that Binh is an instructor.
• Y (An, Binh) could denote that An is younger than Binh.

Predicate Logic as Formal
Language
Proof Theory of Predicate
Logic
Quantifier Equivalences

Semantics of Predicate
Logic
Soundness and
Completeness of
Predicate Logic
Undecidability of
Predicate Logic
Compactness of
Predicate Calculus
Homeworks and Next
Week Plan?

2.6



The Need for Variables

Predicate Logic
Nguyen An Khuong,
Huynh Tuong Nguyen

Example

Every student is younger than some instructor.
We use the predicate S to denote student-hood.
How do we express “every student”?

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

We need variables that can stand for constant values, and a
quantifier symbol that denotes “every”.

Semantics of Predicate
Logic
Soundness and

Completeness of
Predicate Logic
Undecidability of
Predicate Logic
Compactness of
Predicate Calculus
Homeworks and Next
Week Plan?

2.7


The Need for Variables

Predicate Logic
Nguyen An Khuong,
Huynh Tuong Nguyen

Example

Contents

Every student is younger than some instructor.
Using variables and quantifiers, we can write:

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

Language

∀x(S(x) → (∃y(I(y) ∧ Y (x, y)))).

Proof Theory of Predicate
Logic
Quantifier Equivalences

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.

Semantics of Predicate
Logic
Soundness and
Completeness of
Predicate Logic
Undecidability of
Predicate Logic
Compactness of
Predicate Calculus
Homeworks and Next
Week Plan?

2.8


Predicate Logic

Another Example


Nguyen An Khuong,
Huynh Tuong Nguyen

English

Not all birds can fly.
Contents
Predicate Logic:
Motivation, Syntax,
Proof Theory

Predicates

B(x): x is a bird
F (x): x can fly

Need for Richer Language
Predicate Logic as Formal
Language
Proof Theory of Predicate
Logic
Quantifier Equivalences

The sentence in predicate logic

¬(∀x(B(x) → F (x)))

Semantics of Predicate
Logic
Soundness and

Completeness of
Predicate Logic
Undecidability of
Predicate Logic
Compactness of
Predicate Calculus
Homeworks and Next
Week Plan?

2.9


A Third Example

Predicate Logic
Nguyen An Khuong,
Huynh Tuong Nguyen

English

Every girl is younger than her mother.
Contents

Predicates

G(x): x is a girl
M (x, y): y is x’s mother
Y (x, y): x is younger than y

Predicate Logic:

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

Semantics of Predicate
Logic

The sentence in predicate logic

∀x∀y(G(x) ∧ M (x, y) → Y (x, y))

Soundness and
Completeness of
Predicate Logic
Undecidability of
Predicate Logic
Compactness of
Predicate Calculus
Homeworks and Next
Week Plan?

2.10


A “Mother” Function


Predicate Logic
Nguyen An Khuong,
Huynh Tuong Nguyen

The sentence in predicate logic

∀x∀y(G(x) ∧ M (x, y) → Y (x, y))
Note that y is only introduced to denote the mother of x.

Contents
Predicate Logic:
Motivation, Syntax,
Proof Theory
Need for Richer Language

If everyone has exactly one mother, the predicate M (x, y) 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)))

Predicate Logic as Formal
Language
Proof Theory of Predicate
Logic
Quantifier Equivalences

Semantics of Predicate
Logic

Soundness and
Completeness of
Predicate Logic
Undecidability of
Predicate Logic
Compactness of
Predicate Calculus
Homeworks and Next
Week Plan?

2.11


A Drastic Example

Predicate Logic
Nguyen An Khuong,
Huynh Tuong Nguyen

English

An and Binh have the same maternal grandmother.
The sentence in predicate logic without functions

Contents
Predicate Logic:
Motivation, Syntax,
Proof Theory

∀x∀y∀u∀v(M (y, x) ∧ M (An, y) ∧

M (v, u) ∧ M (Binh, v) → x = u)

Need for Richer Language
Predicate Logic as Formal
Language
Proof Theory of Predicate
Logic
Quantifier Equivalences

Semantics of Predicate
Logic

The same sentence in predicate logic with functions

Soundness and
Completeness of
Predicate Logic
Undecidability of
Predicate Logic

m(m(An)) = m(m(Binh))

Compactness of
Predicate Calculus
Homeworks and Next
Week Plan?

2.12



Outlook

Predicate Logic
Nguyen An Khuong,
Huynh Tuong Nguyen

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

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

Semantics of Predicate
Logic
Soundness and

Completeness of
Predicate Logic
Undecidability of
Predicate Logic
Compactness of
Predicate Calculus
Homeworks and Next
Week Plan?

2.13


Predicate Logic
Nguyen An Khuong,
Huynh Tuong Nguyen

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

Contents
Predicate Logic:
Motivation, Syntax,
Proof Theory
Need for Richer Language
Predicate Logic as Formal

Language

3 Soundness and Completeness of Predicate Logic

Proof Theory of Predicate
Logic
Quantifier Equivalences

4 Undecidability of Predicate Logic
5 Compactness of Predicate Calculus

Semantics of Predicate
Logic
Soundness and
Completeness of
Predicate Logic
Undecidability of
Predicate Logic
Compactness of
Predicate Calculus
Homeworks and Next
Week Plan?

2.14


Predicate Vocabulary

Predicate Logic
Nguyen An Khuong,

Huynh Tuong Nguyen

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:

Contents
Predicate Logic:
Motivation, Syntax,
Proof Theory
Need for Richer Language

• a set of predicate symbols P

Predicate Logic as Formal
Language

• a set of function symbols F

Proof Theory of Predicate
Logic

• a set of constant symbols C

Quantifier Equivalences

Semantics of Predicate
Logic
Soundness and
Completeness of

Predicate Logic
Undecidability of
Predicate Logic
Compactness of
Predicate Calculus
Homeworks and Next
Week Plan?

2.15


Arity of Functions and Predicates

Predicate Logic
Nguyen An Khuong,
Huynh Tuong Nguyen

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.

Contents
Predicate Logic:
Motivation, Syntax,
Proof Theory
Need for Richer Language
Predicate Logic as Formal

Language
Proof Theory of Predicate
Logic
Quantifier Equivalences

Semantics of Predicate
Logic
Soundness and
Completeness of
Predicate Logic
Undecidability of
Predicate Logic
Compactness of
Predicate Calculus
Homeworks and Next
Week Plan?

2.16


Predicate Logic

Terms

Nguyen An Khuong,
Huynh Tuong Nguyen

Contents

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.

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

Semantics of Predicate
Logic
Soundness and
Completeness of
Predicate Logic
Undecidability of
Predicate Logic
Compactness of
Predicate Calculus
Homeworks and Next
Week Plan?

2.17



Examples of Terms

Predicate Logic
Nguyen An Khuong,
Huynh Tuong Nguyen

Contents

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)))

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

Semantics of Predicate
Logic
Soundness and
Completeness of
Predicate Logic
Undecidability of
Predicate Logic

Compactness of
Predicate Calculus
Homeworks and Next
Week Plan?

2.18


More Examples of Terms

Predicate Logic
Nguyen An Khuong,
Huynh Tuong Nguyen

If 0, 1, . . . are nullary, s is unary, and +, − and ∗ are binary, then
∗(−(2, +(s(x), y)), x)

Contents
Predicate Logic:
Motivation, Syntax,
Proof Theory
Need for Richer Language

is a term.
Occasionally, we allow ourselves to use infix notation for function
symbols as in
(2 − (s(x) + y)) ∗ x

Predicate Logic as Formal
Language

Proof Theory of Predicate
Logic
Quantifier Equivalences

Semantics of Predicate
Logic
Soundness and
Completeness of
Predicate Logic
Undecidability of
Predicate Logic
Compactness of
Predicate Calculus
Homeworks and Next
Week Plan?

2.19


Predicate Logic

Formulas

Nguyen An Khuong,
Huynh Tuong Nguyen

Contents

φ ::=


P (t1 , t2 , . . . , tn ) | (¬φ) | (φ ∧ φ) | (φ ∨ φ) |
(φ → φ) | (∀xφ) | (∃xφ)

Predicate Logic:
Motivation, Syntax,
Proof Theory
Need for Richer Language

where
• P ∈ P is a predicate symbol of arity n ≥ 1,

Predicate Logic as Formal
Language
Proof Theory of Predicate
Logic
Quantifier Equivalences

• ti are terms over F and

Semantics of Predicate
Logic

• x is a variable.

Soundness and
Completeness of
Predicate Logic
Undecidability of
Predicate Logic
Compactness of

Predicate Calculus
Homeworks and Next
Week Plan?

2.20


Conventions

Predicate Logic
Nguyen An Khuong,
Huynh Tuong Nguyen

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.

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


Semantics of Predicate
Logic
Soundness and
Completeness of
Predicate Logic
Undecidability of
Predicate Logic
Compactness of
Predicate Calculus
Homeworks and Next
Week Plan?

2.21


Predicate Logic

Parse Trees

Nguyen An Khuong,
Huynh Tuong Nguyen

∀x((P (x) → Q(x)) ∧ S(x, y))
Contents

has parse tree

Predicate Logic:
Motivation, Syntax,
Proof Theory


∀x

Need for Richer Language



Predicate Logic as Formal
Language
Proof Theory of Predicate
Logic


P
x

S
Q
x

x

Quantifier Equivalences

y

Semantics of Predicate
Logic
Soundness and
Completeness of

Predicate Logic
Undecidability of
Predicate Logic
Compactness of
Predicate Calculus
Homeworks and Next
Week Plan?

2.22


Predicate Logic

Another Example

Nguyen An Khuong,
Huynh Tuong Nguyen

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

Contents
Predicate Logic:
Motivation, Syntax,
Proof Theory

Functions


Need for Richer Language
Predicate Logic as Formal
Language

m: constant for “me”
f (x): father of x

Proof Theory of Predicate
Logic
Quantifier Equivalences

Semantics of Predicate
Logic

The sentence in predicate logic

∀x(S(x, f (m)) → B(x, m))
Does this formula hold?

Soundness and
Completeness of
Predicate Logic
Undecidability of
Predicate Logic
Compactness of
Predicate Calculus
Homeworks and Next
Week Plan?


2.23


Predicate Logic

Equality as Predicate

Nguyen An Khuong,
Huynh Tuong Nguyen

Equality is a common predicate, usually used in infix notation.
=∈ P
Contents
Predicate Logic:
Motivation, Syntax,
Proof Theory

Example

Need for Richer Language

Instead of the formula

Predicate Logic as Formal
Language
Proof Theory of Predicate
Logic

= (f (x), g(x))
we usually write the formula

f (x) = g(x)

Quantifier Equivalences

Semantics of Predicate
Logic
Soundness and
Completeness of
Predicate Logic
Undecidability of
Predicate Logic
Compactness of
Predicate Calculus
Homeworks and Next
Week Plan?

2.24


Predicate Logic

Free and Bound Variables

Nguyen An Khuong,
Huynh Tuong Nguyen

Consider the formula
∀x((P (x) → Q(x)) ∧ S(x, y))
Contents


What is the relationship between variable “binder” x and
occurrences of x?
∀x

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



Quantifier Equivalences



Semantics of Predicate
Logic

S

P

Q

x


x

x

y

Soundness and
Completeness of
Predicate Logic
Undecidability of
Predicate Logic
Compactness of
Predicate Calculus
Homeworks and Next
Week Plan?

2.25


×