+ All Categories
Home > Documents > Introduction - Brooklyn Collegedzhu/cs280/Chap2.pdf13 P: It is Wednesday. Q: I will go to Coney...

Introduction - Brooklyn Collegedzhu/cs280/Chap2.pdf13 P: It is Wednesday. Q: I will go to Coney...

Date post: 17-Jul-2020
Category:
Upload: others
View: 1 times
Download: 0 times
Share this document with a friend
13
The Predicate Calculus George F Luger ARTIFICIAL INTELLIGENCE 6th edition Structures and Strategies for Complex Problem Solving 1 Introduction Two main concerns of AI researchers – Representation of the knowledge Search for a logical alternative Search for a logical alternative Predicate calculus is a representation language for AI 2 The Propositional Calculus A language used to represent and reason about properties and relationships in the world To describe the language, we define the following in sequence – Propositional calculus symbols – Propositional calculus sentences – Propositional calculus semantics 3 Propositional calculus symbols • The symbols denote propositions or statements that may be true or false The car is red => R Water is wet => W The symbols usually use uppercase letters P, Q, R, S, … Truth symbols true, false Connectives , , ¬, , 4
Transcript
Page 1: Introduction - Brooklyn Collegedzhu/cs280/Chap2.pdf13 P: It is Wednesday. Q: I will go to Coney Island. The Predicate Calculus • Propositional calculus uses an atomic symbol to denote

The Predicate Calculus

George F Luger

ARTIFICIAL INTELLIGENCE 6th editionStructures and Strategies for Complex Problem Solving

1

Introduction

• Two main concerns of AI researchers– Representation of the knowledge

– Search for a logical alternative– Search for a logical alternative

• Predicate calculus is a representation language for AI

2

The Propositional Calculus

• A language used to represent and reason about properties and relationships in the world world

• To describe the language, we define the following in sequence– Propositional calculus symbols

– Propositional calculus sentences

– Propositional calculus semantics3

Propositional calculus symbols

• The symbols denote propositions or statements that may be true or false– The car is red => R

– Water is wet => W– Water is wet => W

• The symbols usually use uppercase lettersP, Q, R, S, …

• Truth symbolstrue, false

• Connectives∧, ∨, ¬, →, ≡

4

Page 2: Introduction - Brooklyn Collegedzhu/cs280/Chap2.pdf13 P: It is Wednesday. Q: I will go to Coney Island. The Predicate Calculus • Propositional calculus uses an atomic symbol to denote

Propositional calculus sentences

• The sentences in the propositional calculus are formed from the symbols according to the rules listed on the next slidethe rules listed on the next slide

• Legal sentences, formed of legal symbols through the use of the rules, are called well-formed formulas or WFFs

• Some terms:– conjunct, disjunct, antecedent, consequent

5 6

Propositional calculus semantics

• The previous slides define the syntax of the propositional calculus

• The semantics of the propositional calculus • The semantics of the propositional calculus defines the meaning of the sentences using the rules listed on the next slide

• A proposition must be either true or false

• The truth value assigned to a propositional sentence is called an interpretation

7 8

Page 3: Introduction - Brooklyn Collegedzhu/cs280/Chap2.pdf13 P: It is Wednesday. Q: I will go to Coney Island. The Predicate Calculus • Propositional calculus uses an atomic symbol to denote

Truth Table

• The truth values of compound propositions are often described by truth tables

• A truth table lists all possible truth value • A truth table lists all possible truth value assignments to the symbols of the sentence, and the corresponding truth value results of the sentence

9

Truth Table

Figure 2.1: Truth table for the operator ∧.

10

Equivalence Laws

• A proposition is equivalent to another one if they have the same output value under all possible combination of input valuespossible combination of input values

• Equivalence laws can be used to prove a new theorem or change a logical expression into a syntactically different but logically equivalent form

11

Equivalence laws

For propositional expressions P, Q and R:

12

Page 4: Introduction - Brooklyn Collegedzhu/cs280/Chap2.pdf13 P: It is Wednesday. Q: I will go to Coney Island. The Predicate Calculus • Propositional calculus uses an atomic symbol to denote

Truth Table

Figure 2.2: Truth table demonstrating the equivalence of P → Q and ¬P ∨ Q

13

P: It is Wednesday.Q: I will go to Coney Island.

The Predicate Calculus

• Propositional calculus uses an atomic symbol to denote a single proposition. There is no way to access the components of an assertion– It rained on Tuesday � P– It rained on Tuesday � P

– It rained on Wednesday � Q

• Predicate calculus provides this ability by using a predicate that shows relationship– weather(tuesday, rain)

– weather(wednesday, rain)

14

The Predicate Calculus

• Predicate calculus also allows expression to contain variables – weather(X, rain)

• The predicate calculus also use quantifiers• The predicate calculus also use quantifiers– ∀X (weather(X, rain))

– ∃X (weather(X, rain))

15

The Predicate Calculus

• As with propositional calculus, to define the language, we define the following in sequencesequence– Predicate calculus symbols

– Predicate calculus sentences

– Predicate calculus semantics

16

Page 5: Introduction - Brooklyn Collegedzhu/cs280/Chap2.pdf13 P: It is Wednesday. Q: I will go to Coney Island. The Predicate Calculus • Propositional calculus uses an atomic symbol to denote

17

Predicate Calculus Symbols

• Constant symbols name specific objects or properties in the world– E.g. george, tree, tall, blue, …

• Variable symbols designate general classes of • Variable symbols designate general classes of objects or properties– E.g. Fruit, PEOPLE, X, Y, …

• Function symbols denote a mapping of one or more elements in the domain of the function into a unique element of the range of function – father, price, plus, …

18

Predicate Calculus Symbols

• A function expression is a function symbol followed by its arguments– f(X, Y) => Z– f(X, Y) => Z

– father(david) => george

– price(banana) => 5.24

– plus(2, 3) => 5

19 20

Page 6: Introduction - Brooklyn Collegedzhu/cs280/Chap2.pdf13 P: It is Wednesday. Q: I will go to Coney Island. The Predicate Calculus • Propositional calculus uses an atomic symbol to denote

Predicates and Atomic Sentences

• Predicate symbols start with lowercase letters

• Predicates name relationship between objects whose numbers are called the arity– likes, equals, on, near, part_of, …

• Atomic sentences, most primitive unit, are predicates of arity n followed by n terms enclosed in parentheses and separated by commas

21

Predicates and Atomic Sentences

• Examples of atomic sentences:– likes(george, kate)

– likes(george, sarah, tuesday)

– likes(X, george)

different relationships

– likes(X, george)

– likes(X, Y)

– friends(bill, george)

– friends(father_of(david), father_of(andrew))

– helps(richard, bill)

22

23

Predicate Calculus Sentences

• Atomic sentences can be combined using logical operators to form sentences

• Predicate calculus uses the same five logical operators as propositional calculusoperators as propositional calculus

• Two quantifiers, ∀ and ∃, are used– ∀: universal quantifier, means “for all”

– ∃: existential quantifier, means “there exists at least one”

– ∃Y friends(Y, peter)

– ∀X likes(X, ice_cream)24

Page 7: Introduction - Brooklyn Collegedzhu/cs280/Chap2.pdf13 P: It is Wednesday. Q: I will go to Coney Island. The Predicate Calculus • Propositional calculus uses an atomic symbol to denote

25

Examples of Predicate Sentences

• Let times and plus be function symbols; let equal and foo be predicate symbols

Is it a sentence?

26

plus(two, three)

equal(plus(two, three), five)

equal(plus(2, 3), seven)

∃∃∃∃ X foo(X, two, plus(two, three))∧∧∧∧ equal(plus(two, three), five)

(foo(two, two, plus(two, three))) →→→→(equal(plus(three, two), five) ≡≡≡≡ true)

No

Yes

Yes

Yes

Yes

verify_sentence algorithm

27

Predicate Calculus Semantics

• It provides a formal basis for determining the truth value of well-formed expressions

• If the relationship described by the • If the relationship described by the predicate exists, the predicate calculus expression will have the truth value of T. – friends(george, susie)

– friends(george, kate)

28

Page 8: Introduction - Brooklyn Collegedzhu/cs280/Chap2.pdf13 P: It is Wednesday. Q: I will go to Coney Island. The Predicate Calculus • Propositional calculus uses an atomic symbol to denote

29 30

An Example

• The following predicates describe the relationships of a family in the biblical genealogy. New relationships are defined using asserted relationships.– mother(eve, abel)

– mother(eve, cain)– mother(eve, cain)

– father(adam, abel)

– father(adam, cain)

– father(X, Y) ∨ mother(X, Y) → parent(X, Y)

– ∃X (parent(X, Y) ∧ parent(X, Z)) → sibling(Y, Z)

• Is abel a sibling of cain? ( sibling(abel, cain) = true? )

• grandparent(X, Y)? ancestor(X, Y) ?31

First-Order Predicate Calculus

• It allows quantified variables to refer to objects in domain of discourse and not to predicates or functionspredicates or functions

• The following is not a well-formed expression in the first-order predicate calculus– ∀(Likes) Likes(george, kate)

32

Page 9: Introduction - Brooklyn Collegedzhu/cs280/Chap2.pdf13 P: It is Wednesday. Q: I will go to Coney Island. The Predicate Calculus • Propositional calculus uses an atomic symbol to denote

Examples of English Sentences Represented in Predicate Calculus

If it doesn’t rain on Monday, Tom will go to the mountains.

Emma is a Doberman pinscher and a good dog

¬weather(rain, monday) → go(tom, mountain)

isa(emma, doberman) ∧ gooddog(emma)

All basketball players are tall.

Some people like anchovies.

Nobody likes taxes.

33

∃X (person(X) ∧ likes(X, anchovies)

¬ ∃ X likes(X, taxes)

isa(emma, doberman) ∧ gooddog(emma)

∀X (basketball_player(X) → tall(X))

Figure 2.3: A blocks world with its predicate calculate description.

34

The following rule describes when a block is clear:¬ ∃ Y on(Y, X) → clear(X)

Using Inference Rules to Produce Predicate Calculus Expression

• Predicate calculus allows new expressions be inferred from true assertions

• The new expressions are consistent with the • The new expressions are consistent with the original set of expressions

• Inference rules are used to generate new expressions– Ex: modus ponens, modus tollens, resolution …

35 36

Page 10: Introduction - Brooklyn Collegedzhu/cs280/Chap2.pdf13 P: It is Wednesday. Q: I will go to Coney Island. The Predicate Calculus • Propositional calculus uses an atomic symbol to denote

37 38

39

Use Modus Ponens to Produce New Expressions

P: it is raining

Q: the ground is wet

From the following two expressions:

If it is raining then the ground is wet. P→Q

It is raining. P

Using modus ponens, we produce a new expression:

The ground is wet. Q40

Page 11: Introduction - Brooklyn Collegedzhu/cs280/Chap2.pdf13 P: It is Wednesday. Q: I will go to Coney Island. The Predicate Calculus • Propositional calculus uses an atomic symbol to denote

Use Modus Ponens to Produce New Expressions

All men are mortal. => ∀ X (man(X) → mortal(X))

Socrates is a man. => man(socrates)

Substitute socrates for X, we have:

man(socrates)→ mortal(socrates)

Applying modus ponens, we have a new expression:

mortal(socrates)

41

Give a formal proof using predicate logic for the syllogism:

No software is guaranteedIE is a software .∴ IE is not guaranteed

Let: software(X) = X is software, and guaranteed(X) = X is guaranteedThen:

(∀X)[software(X) → ¬guaranteed (X) ]software (IE) . ∴

42

software (IE) . ∴ ¬guaranteed (IE)

The universal quantifier can be ignored in this case.

software (IE) → ¬ guaranteed(IE)software (IE) .∴ ¬ guaranteed(IE)

According to modus ponens, the above is a valid argument.

Unification Algorithm

• To apply inference rules such as modus ponens, an inference system must be able to determine if two expressions match

• In predicate calculus this process is complicated by the existence of variables in the expressionsexistence of variables in the expressions

• Unification is an algorithm for determining if two expressions match

• Automated problem solvers use unification to determine if two expressions match

• Resolution is a more powerful rule of inference used by many automated reasoning systems

43

Application: A Logic-Based Financial Advisor

• It helps a user to decide whether to invest in a savings account or the stock market– Individuals with an inadequate savings account should

invest in the savings accountinvest in the savings account

– Individuals with an adequate savings account and an adequate income should invest in stock market

– Individuals with an adequate savings account and a lower income should split their income between savings and stocks

44

Page 12: Introduction - Brooklyn Collegedzhu/cs280/Chap2.pdf13 P: It is Wednesday. Q: I will go to Coney Island. The Predicate Calculus • Propositional calculus uses an atomic symbol to denote

A Logic-Based Financial Advisor

• The rule of adequacy for savings is to have at least $5,000 in savings for each dependent

• The rule of adequacy for income is a steady income of $15,000/year plus $4,000 for each income of $15,000/year plus $4,000 for each dependent

• Define the following two functions:– minsavings(X) ≡ 5000 × X

– minincome(X) ≡ 15000 + (4000× X)

where X is # dependents

45 46

Inference Process

• Using 7, 10, 11 under the substitution {25000/X, 3/Y}⇒earnings(25000, steady) ∧ dependents(3) ∧ ¬greater(25000,

minincome(3)) → income(inadequate)⇒earnings(25000, steady) ∧ dependents(3) ∧ ¬greater(25000,

27000) → income(inadequate)27000) → income(inadequate)⇒12. income(inadequate)

• Using 4, 9, 11 under the substitution {22000/X, 3/Y}⇒amount_saved(22000) ∧ dependents(3) ∧ greater(22000,

minsavings(3)) → savings_account(adequate)⇒amount_saved(22000) ∧ dependents(3) ∧ greater(22000,

15000) → savings_account(adequate)⇒13. savings_account(adequate)

47

Inference Process

• Conclusions of the inference are represented by the predicate investment with three possible values stocks, savings, or combination (investment is split)

• Using 3, 12, 13, the conclusion is: • Using 3, 12, 13, the conclusion is:

investment(combination)

48

Page 13: Introduction - Brooklyn Collegedzhu/cs280/Chap2.pdf13 P: It is Wednesday. Q: I will go to Coney Island. The Predicate Calculus • Propositional calculus uses an atomic symbol to denote

Homework Assignment

1. The logical operator “↔” is read “if and only if.” P ↔ Q is defined as being equivalent to (P→Q) ∧ (Q→P). Based on this definition, show that P ↔ Q is logically equivalent to (P∨Q) → (P∧Q) a) by using truth tableb) by a series of substitution using equivalence laws

49

b) by a series of substitution using equivalence laws

2. Jane Doe has four dependents, a steady income of $30,000, and $15,000 in her savings account. Add the appropriate predicates describing her situation to the general investment advisor discussed in the class and perform the unifications and inferences needed to determine her suggested investment.


Recommended