- 439 Views
- Uploaded on

Download Presentation
## PowerPoint Slideshow about 'Predicate Logic' - Sharon_Dale

**An Image/Link below is provided (as is) to download presentation**

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

First Order Predicate Calculus

Why do we need another reasoning system?

What’s wrong with propositional calculus?

Well…it only allows reasoning about

propositions, or whole sentences.

How could we express the following sentences

in propositional logic:

All super heroes can fly.

Socrates can’t fly.

Therefore Socrates is not a super hero.

Which of these statements is not a proposition?

Why not?

Western Washington University

Predicates

Identify the predicates in the previous examples…

predicates from a grammar point of view.

From a logic point of view, a predicate is a

relation, which can also be thought of as a

property.

Let p(x) mean “x can fly.” p(x) is called a

predicate. When we substitute a specific value for

x, we get a proposition.

p(Mighty Mouse) is a proposition.

Another example:

Let p(x) mean that x is an odd integer, then

the proposition p(11) is true, and the proposition

p(98) is false.

Western Washington University

Existential Quantification

p(4) p(10) p(12) p(13) is true, and it can

also be described by saying:

There exists an element x in the set {4, 10, 12, 13}

such that p(x) is true.

If we let D = {4, 10, 12, 13}, then we can

symbolically express the expression as:

x D: p(x)

The symbol is the existential quantifier.

The statement above is a proposition, because

the predicate is specific to a particular set.

It would be a predicate if the statement was

expressed without regard to any particular set:

x p(x)

Western Washington University

Universal Quantification

Consider a conjunction containing the previous

p.

p(1) p(33) p(91) p(15)

Let D = {1, 33, 91, 15}. We can express this

proposition as “Every x in D is an odd integer.”,

or symbolically:

x D: p(x).

Without set quantification, the expression

x p(x) can be read “For every x p(x).”

The symbol is call the universal quantifier.

Western Washington University

Consider the following statement:

- [p(0,0) p(0,1)] [p(1,0) p(1,1)]
- We can represent this as:
- Let D = {0,1}
- x D : y D : p(x,y)
- Natural Numbers:
- Every natural number has a successor.
- There is no natural number whose successor
- is 0.
- How would we express these statements using
- predicate calculus?
- This notation belongs to a logic called first-order
- predicate calculus. In first-order predicate
- calculus we can only quantify variables that
- occur in predicates. High-order predicate calc
- is in Chapter 8…something to look forward to

Western Washington University

Well-Formed Formulas

In order for predicate calculus to be an actual

calculus, we need to have rules about what is

a valid expression.

The alphabet:

Individual variables: x, y, z

Individual constants: a, b, c

Function constants: f, g, h

Predicate constants: p, q, r

Connective symbols: , , ,

Quantifier symbols: ,

Punctuation symbols: ( )

Western Washington University

An inductive definition:

(

x < wff> |

x

Review of precedence hierarchy:

, x,x

Note that the quantifiers have the same

precedence as negation

Western Washington University

Identifying a wff

How can we determine if an expression is a

wff?

Bottom-up Approach

Identify the atoms…this is the basis case.

Then use induction on the atoms.

Top-Down Approach

Notice the general form of the expression.

Then show that all of the terms are

atoms.

x p(x,y) q(x)

Western Washington University

Quantifier Scope

When a quantifier, or , occurs in a wff,

it influences some occurrences of a quantified

variable. This influence is called the scope of

the quantifier.

In the wff x W, W is the scope of the quantifier

x

In the wff x W, W is the scope of the quantifier

x

What is the scope of x in the wff:

x p(x,y) q(x)

Recall the hierarchy of precedence.

Bound vs. Free

If a variable x lies within the scope of either x

or x, or it is the quantifier variable itself, it is

considered bound…otherwise it’s free.

Western Washington University

Practice

p(x,y) (y q(y) x r(x, y))

Which are bound?

Which are free?

What’s the scope of the bound ones?

x y (p(y) q(f(x), y))

Is this a expression a wff? Why or why not?

Western Washington University

Semantics

Now that we have identified an alphabet and

rules for what is a well-formed formula in

the predicate calculus, we need to explain the

meaning of a wff.

In the propositional calculus, the meaning of

a wff was its truth table.

In the predicate calculus, the meaning of a wff

is its true or false value, once we have provided

an interpretation to its symbols.

We can give an interpretation to the wff:

x y s(x, y)

where we let s(x, y) mean that y is the successor

of x, and x and y take values from the set of

natural numbers.

Is this wff true or false?

Western Washington University

Interpretations

An interpretation for a wff consists of:

a nonempty set D, called the domain of the

interpretation, combined with an assignment that associates the symbols of the wff to values in D according to the following:

1. Each predicate letter must be assigned some

relation over D. A predicate with no arguments

is a proposition and must be assigned a truth value

2. Each function letter must be assigned a

function over D.

3. Each free variable must be assigned a value in

D. All free occurrences of a variable x are

assigned the same value in D.

4. Each constant must be assigned a value in D.

All occurrences of the same constant are assigned

the same value in D.

Western Washington University

Too Many Rules!

Interpretations seem so arbitrary! Well they

are…kind of.

There can be many interpretations for a wff.

To describe the meaning of an interpreted wff,

we can write:

W(x/t)

where x is a free variable in W and t is a term.

This is a binding.

Let W = p(x) x q(x, y)

W(x/a) = p(a) x q(x, y)

Why?

What does W(x/a)(y/b) look like?

Western Washington University

At Last…The Meaning

The meaning of a wff:

Suppose we have an interpretation with domain D

for a wff.

If the wff has no quantifiers, then its meaning is

the truth value of the statement obtained from the

wff by applying the interpretation.

If the wff has quantifiers, then each quantified

wff is evaluated as follows:

x W is true if there is some d D such that

W(x/d) is true…o.w. x W is false.

x W is true if W(x/d) is true for every d D…

o.w. x W is false.

Western Washington University

What is the Meaning?

Let W = x y (p(y) q(x, y)).

Let q(x, y) denote the equality relation “x=y”.

Round 1

Let D = {a}.

Let p(a) = true.

Round 2

Let D = {a, b}.

Let p(a) = p(b) = false.

Round 3

Let D = {a, b}.

Let p(a) = true and p(b) = false.

Western Washington University

Models

An interpretation is called a model for W if W

is true with respect to the interpretation.

Otherwise the interpretation is called a

countermodel.

In the previous exercise, identify the models

and countermodels.

Western Washington University

Validity

How many interpretations exist for each wff?

Infinity…remember that they’re arbitrary!

Do you think any wff can be true for every possible

interpretation? This would be kind of like a

tautology.

Well, it’s actually possible. A wff is considered

valid if it’s true for every possible interpretation.

All its interpretations are models. Otherwise,

it’s invalid.

A wff is unsatisfiable if it’s false for all possible

interpretations. All its interpretations are

countermodels. Otherwise, it’s satisfiable.

Western Washington University

What are the possible combinations of these

properties?

valid and invalid

valid and satisfiable

valid and unsatisfiable

invalid and satisfiable

invalid and unsatisfiable

satisfiable and unsatisfiable

How do these relate to the properties of:

tautology, contingency, and contradiction

from the propositional calculus?

Let’s show that the following wff is

satisfiable and invalid:

x y (p(y) q(x, y))

Western Washington University

Proving Validity

It’s not quite as easy as creating a truth table!

How about checking the infinite number of

interpretations to show that each one is a

model…NOT!

The Indirect Approach

Assume the wff is invalid, and try to obtain a

contradiction. Assume the existence of a

countermodel for the wff, and argue toward a

contradiction.

The Direct Approach

If the wff has the form A B, then assume there

is an arbitrary interpretation for A B that is

a model for A. Show that the interpretation is

a model for B. This proves that any interpretation

for A B is a model for A B. Thus A B

is valid.

Western Washington University

Let’s start with an easy one, and let W denote:

y x p(x, y) x y p(x, y)

Direct Approach:

Let A be the wff y x p(x, y) , and

let B be the wff x y p(x, y).

Next, let M be an interpretation with domain D

for W, such that M is a model for A.

Indirect Approach:

Let A be the wff y x p(x, y) , and

let B be the wff x y p(x, y).

Assume W is invalid. This means there is a

countermodel with domain D that makes

A true and B false.

Not nearly as simple as creating a truth table!

Western Washington University

Transformations

What should we do with free variables? They’d

be much more manageable if they were

quantified.

We can apply either Universal or Existential

quantification to each free variable…BUT…

this does affect the meaning.

p(x) p(y) is satisfiable, but x y (p(x)

p(y)) is unsatisfiable

p(x) p(y) is invalid, x y (p(x) p(y)) is

valid.

But, validity is preserved if we universally

quantify the free variables.

Unsatisfiability is preserved if we existentially

quantify the free variables.

Western Washington University

Closure

Universal Closure

Suppose W is a wff with free variables

x1, x2, …, xn. The universal closure of W is

the wff:

x1 x2 …xn W

Existential Closure

Suppose W is a wff with free variables

x1, x2, …, xn. The existentialclosure of W is

the wff:

x1 x2 …xn W

The Closure Properties

1. A wff is valid iff its universal closure is valid.

2. A wff is unsatisfiable iff its existential closure

is unsatisfiable.

Western Washington University

The Validity Problem

Given a wff, is it valid?

In propositional calculus, we use Quine’s method or a truth table…so the problem is decidable.

In predicate calculus, we don’t have any process

that always works…so the problem is

partially decidable.

A decision problem is a problem that can be stated

as a question with a yes or no answer.

A decision problem is decidable if there is an

algorithm that halts with an answer to the problem,

otherwise is is undecidable.

A decision problem is partially decidable if there is an algorithm that halts with the answer yes if there is a yes answer, otherwise it may not halt.

Western Washington University

Which algorithms do we use to solve the

validity problem for the predicate calculus?

Natural deduction (Later in this chapter)

Resolution (Chapter 9)

Western Washington University

Equivalence

Two wffs, A and B, are equivalent if they have

the same truth value, meaning, with respect to

every interpretation of both A and B.

In this definition, all free variables, constants,

functions, and predicates that occur in either

A or B are interpreted wrt a single domain.

A B iff (A B) (B A) is a valid wff.

How can we use propositional equivalences to

show predicate equivalences?

Consider x p(x) x p(x) q(x)

Which propositional wff does this look like?

Western Washington University

A wff, W, is an instance of a propositional wff, V,

if W is obtained from V by replacing each

propositional letter of V with a wff, where all

occurrences of of each propositional letter in V

are replaces by the same wff.

Once we identify a propositional wff we can

assign truth values to the propositional variables.

Two predicate wffs are equivalent if they are

instances of two equivalent propositional wffs,

where both instances are obtained by using the

same replacement of propositional letters

How can we show that the following is an

equivalence:

x p(x) q(x) x p(x) q(x)

Western Washington University

Proving Equivalences

Wouldn’t it be great if all predicate wffs

were instances of propositional wffs with

known equivalences? Well, that’s not the case.

Equivalences for Quantifiers:

x y W y x W

x y W y x W

x W (x W)

x (p(x) q(x)) x p(x) x q(x)

How would we prove these if we were going

to prove these?

Try proving

x(p(x) q(x)) x p(x) x q(x)

using other equivalences.

Western Washington University

Restricted Equivalences

Certain equivalences are true only when certain

restrictions are applied.

Renaming Rule

If y does not occur in W(x), then the following

equivalences hold:

a. x W(x) y W(y)

b. x W(x) y W(y)

Use the renaming rule to make all the quantified

variables distinct in the following wff:

x y (p(x, y) x q(x, y) y r(x,y))

Western Washington University

The following restricted equivalences are true

when x does not occur in the wff C

Disjunction

x(C A(x)) C x A(x)

x(C A(x)) C x A(x)

Conjunction

x(C A(x)) C x A(x)

x(C A(x)) C x A(x)

Implication

x(C A(x)) C x A(x)

x(C A(x)) C x A(x)

x(A(x) C) x A(x) C

x(A(x) C) x A(x) C

Now we can do some proofs using these

equivalences…oh joy!

Western Washington University

Normal Forms

Similar to propositional calculus, we have normal

forms to describe wffs in predicate calculus.

A wff W is prenex normal form if all its quantifiers

are on the left of the expression. It looks like this:

Q1x1 … Qnxn M

where each Qi is either or , each xi is distinct,

and M is a wff without quantifiers.

Any wff is equivalent to some wff in prenex

normal form. Here’s the algorithm:

1. Rename the variables of W so that no

quantifiers use the same variable name and such

that the quantified variable names are distinct from

the free variable names.

2. Move quantifiers to the left by using

equivalences.

Western Washington University

Try putting the following wffs into prenex normal

form:

p(x) x q(x)

A(x) x (B(x) y C(x,y) y A(y))

Prenex Conjunctive Normal Form

Q1x1 … Qnxn (C1 … Ck)

where each Ci is a disjunction or 1 or more literals

Prenex Disjunctive Normal Form

Q1x1 … Qnxn (D1 … Dk)

where each Di is a conjunction or 1 or more literals

Algorithm:

1. Rename the variables.

2. Remove implications.

3. Move negations to the right to form literals.

4. Move quantifiers to the left.

5. Distribute over or vice versa

Western Washington University

Put the following wff in both prenex CNF and

prenex DNF:

x (p(x) q(x)) x p(x) x q(x)

Western Washington University

Formalizing English Sentences

How do we apply all that we’ve learned about

predicate calculus to reasoning in the English

language?

It’s easiest to see if we start with an example:

“Some computer science majors are geeks.”

“No computer science major is a geek.”

“All computer science majors are cool.”

“Some computer science majors are smart.”

“Not all computer science majors are smart.”

“There is a stupid computer science major.”

Observe:

The universal quantifier quantifies a conditional

The existential quantifier quantifies a conjunction

Western Washington University

Formal Proofs

You expected this didn’t you?

How do we reason formally about wffs in the

predicate calculus?

Inference rules!

We can use all the inference rules from the

propositional calculus…but we need more.

It can be tough to reason in the predicate

calculus when the wffs contain quantifiers.

Our approach can be to remove the quantifiers,

reason, then restore the quantifiers. RRR.

But…this can change the meaning of the wff.

Western Washington University

Inference Rules for Quantifiers

Universal Instantiation (UI)

Existential Instantiation (EI)

Universal Generalization (UG)

Existential Generalization (EG)

Universal Instantiation

Can we infer W(y) from x W(x)?

Can we infer y p(y,y) from x y p(x,y)?

Try letting p(x,y) be the relation x < y.

y is not free to replace x. If y does not occur in

W(x), then y is free to replace x in W(x).

A term t is free to replace x in W(x) if both

W(t) and W(x) have the same bound variables.

Western Washington University

The UI Rule (formally stated)

- x W(x) W(t) if t is free to replace x in W(x)
- Special Cases of UI Rule
- x W(x) W(x)
- x W(x) W(c) where c is any constant
- Existential Instantiation (EI)
- Can we infer W(c) from the statement x W(x)?
- Sometimes…there are restrictions.
- The EI Rule (formally stated)
- x W(x) W(c) if c is a new constant in the

proof

- Let’s try a proof using these new inference rules:
- x W(x) x W(x)

Western Washington University

Universal Generalization (UG)

We might want to generalize a wff by attaching

a universal quantifier. For instance, we might

want to infer x W(x) from W(x).

Sometimes we can…sometimes we can’t.

What if x is a free variable in a premise, ie.

p(x)? Nope…we can’t generalize x p(x).

Try it!

A variable x in a wff is a flaggedvariable in W

if x is free in W and either W is a premise or W

is inferred by a wff containing x as a flagged

variable.

Can we prove the following?

x (p(x) q(x)) x (q(x) r(x))

x (p(x) r(x))

Are there any flagged variables?

Western Washington University

Do you see anything wrong with the following:

1. x y x < y P

2. y x < y 1, UI

3. x < c 2, EI

4. x x < c 3, UG

A variable x is a subscripted variable of W if x

is free in W and there is a constant c in W that

was created by the EI rule, where c and x occur

in the same predicate of W.

Formal Statement of UG

W(x) x W(x) if x is not flagged and x is not

subscripted

Prove:

x y W y x W

Western Washington University

Existential Generalization

Can we infer x W(x) from W(c) for a constant

c? It seems logical, eh?

There are actually some restrictions.

1. x y x < y P

2. y x < y 1, UI

3. x < c 2, EI

4. x x < x EG, huh?

The Backwards Check

To infer x W(x) from W(t) for a term t, the

following relationship must hold:

W(t) = W(x)(x/t)

W(t) must equal the wff obtained from W(x) by

replacing all occurrences of x by t.

W(c) = x < c … this is line 3 above

W(x)(x/c) = c < c …this is line 4 above

Western Washington University

Another Restriction…Free to Replace

To infer x W(x) from W(t), the term t must be

free to replace x in W(x).

1. y y < f(y) P

2. x y y < x 1, EG?????

What happened to the other bound occurrence of

y? oops.

EG Formalized

W(t) x W(x) if

a. W(t) = W(x)(x/t)

b. t is free to replace x in W(x)

There is a special case:

W(x) x W(x)

Western Washington University

Applying the New Rules

Now that we have some more rules, we can

prove many more arguments:

“All computer science majors are people. Some

computer science majors are logical thinkers.

Therefore some people are logical thinkers.”

Western Washington University

Download Presentation

Connecting to Server..