19
CPSC 7373: Artificial Intelligence Lecture 8: Representation with Logic Jiang Bian, Fall 2012 University of Arkansas at Little Rock

CPSC 7373: Artificial Intelligence Lecture 8: Representation with Logic Jiang Bian, Fall 2012 University of Arkansas at Little Rock

Embed Size (px)

Citation preview

Page 1: CPSC 7373: Artificial Intelligence Lecture 8: Representation with Logic Jiang Bian, Fall 2012 University of Arkansas at Little Rock

CPSC 7373: Artificial IntelligenceLecture 8: Representation with Logic

Jiang Bian, Fall 2012University of Arkansas at Little Rock

Page 2: CPSC 7373: Artificial Intelligence Lecture 8: Representation with Logic Jiang Bian, Fall 2012 University of Arkansas at Little Rock

Propositional Logic

A

J M

B E

The alarm (A) might go off because of either a Burglary (B) and/or an Earthquake (E). And when the alarm (A) goes off, either John (J) and/or Mary (M) will call to report.

In probabilistic model, our degree of belief is the probability (NUMBER).In propositional logic, our belief is either: TRUE, FALSE, or UNKNOWN.

Logic Sentences: e.g.,1) (E V B) => A; E or B implies A2) A => (J ^ M); A implies J and

M3) J M; J called is Equivalent

to M calls4) J ¬M;

Logical Operators:1) V: OR2) =>: Implies3) ^: AND4) : Equivalent (Bi-

condition)5) ¬: Negation

Page 3: CPSC 7373: Artificial Intelligence Lecture 8: Representation with Logic Jiang Bian, Fall 2012 University of Arkansas at Little Rock

Propositional Logic – cond.

• A propositional logic sentence is either true or false with respect to a model of the world.

• A model is a set of true/false values for all the propositional symbols.– e.g., {B: True, E: False, …}

• We can define the truth of the sentence in terms of the truth of the symbols with respect to the models using truth tables.

Page 4: CPSC 7373: Artificial Intelligence Lecture 8: Representation with Logic Jiang Bian, Fall 2012 University of Arkansas at Little Rock

True Tables

• A truth table does is list all the possibilities for the propositional symbols, e.g.,:

P Q ¬P P ^ Q P v Q P => Q P QF F T F F T T

F T T F T T F

T F F F T F F

T T F T T T T

Page 5: CPSC 7373: Artificial Intelligence Lecture 8: Representation with Logic Jiang Bian, Fall 2012 University of Arkansas at Little Rock

Logical disjunction

• OR: in propositional logic is a logical disjunction, also known as inclusive disjunction, that results in true whenever one or more of its operands are true.– e.g., "A or B" is true if A is true, or if B is true, or if both A

and B are true.• In ordinary English, “or” can be either inclusive or

exclusive disjunction.– e.g., "Please ring me or send an email" means "do one or

the other, but not both".– e.g., "Her grades are so good that she's either very bright

or studies hard"

Page 6: CPSC 7373: Artificial Intelligence Lecture 8: Representation with Logic Jiang Bian, Fall 2012 University of Arkansas at Little Rock

Quiz - 1

• Whether the sentence that 5 is an odd number implies Pairs is the capital of France is true or false???– O: 5 is an order number– P: Pairs is the capital of France– O => P True/False ???

• Whether the sentence that 5 is an even number implies Moscow is the capital of France is true or false– E: 5 is an even number– M: Moscow is the capital of France– E => M True/False ???

Page 7: CPSC 7373: Artificial Intelligence Lecture 8: Representation with Logic Jiang Bian, Fall 2012 University of Arkansas at Little Rock

Quiz - 2

P Q P ^ (P => Q)

¬(¬P v ¬Q) (P ^ (P => Q)) (¬(¬P v ¬Q))

F F

F T

T F

T T

Under what conditions the following logic sentences are true ???

Page 8: CPSC 7373: Artificial Intelligence Lecture 8: Representation with Logic Jiang Bian, Fall 2012 University of Arkansas at Little Rock

Quiz - 3

• We know the following three sentences are true:– (E V B) => A– A => (J ^ M)– B

A

J M

B E

T F ?

E

B

A

J

M

Page 9: CPSC 7373: Artificial Intelligence Lecture 8: Representation with Logic Jiang Bian, Fall 2012 University of Arkansas at Little Rock

Terminology

• A valid sentence is one that is true in every possible model, for every combination of values of the propositional symbols.

• A satisfiable sentence is one that is true in some models, but not necessarily in all the models.

V S U

P v ¬P

P ^ ¬P

P v Q v (P Q)(P => Q) v (Q => P)

((Food=>Party) v (Drinks => Party)) => (( Food ^ Drinks) => Party)

Page 10: CPSC 7373: Artificial Intelligence Lecture 8: Representation with Logic Jiang Bian, Fall 2012 University of Arkansas at Little Rock

Terminology

V S U

T P v ¬P

T P ^ ¬P

T P v Q v (P Q)T (P => Q) v (Q => P)

T ((Food=>Party) v (Drinks => Party)) => (( Food ^ Drinks) => Party)

Page 11: CPSC 7373: Artificial Intelligence Lecture 8: Representation with Logic Jiang Bian, Fall 2012 University of Arkansas at Little Rock

Propositional Logic Limitations

• It can only handle True or False– No capability to handle uncertainty

• Only events that are True of False– Cannot handle objects that have properties, such

as size, weight, color, etc.– Cannot handle relations between objects

• No shortcuts– e.g., Vacuum world with 1000 propositions

Page 12: CPSC 7373: Artificial Intelligence Lecture 8: Representation with Logic Jiang Bian, Fall 2012 University of Arkansas at Little Rock

First-Order LogicWORLD (ONTOLOGICAL)

BELEFS(EPISTEMOLOGICAL)

FIRST-ORDER LOGIC RELS, OBJECTS, FUNCS T/F/?

PROPOSITIONAL LOGIC FACTS T/F/?

PROBABILITY THEORY FACTS [0,1]

So logics vary both in what you can say about the world and what you can believe about what's been said about the world.

VIEW OF LOGIC REPRESNETAIONS:1) ATOMIC: A representation of the state is just an individual state with no

pieces inside of it. E.g., search and problem solving2) FACTORED: The representation of an individual state of the world is

factored into several variables.3) STRUCTURED: include relationships between objects (FIRST-ORDER

LOGIC)

Page 13: CPSC 7373: Artificial Intelligence Lecture 8: Representation with Logic Jiang Bian, Fall 2012 University of Arkansas at Little Rock

FIRST-ORDER LOGIC: MODEL

• CONSTANTS: {A, B, C, D, 1, 2, 3}• FUNCTIONS:

– NUMBER-OF: {A -> 1, B -> 3, C -> 3, D -> 2}• RELATIONS:

– ABOVE: {[A, B], [C, D]}– VOWEL: {[A]}– RAINY: {}

A,1 C,3

B,3 D,2

Page 14: CPSC 7373: Artificial Intelligence Lecture 8: Representation with Logic Jiang Bian, Fall 2012 University of Arkansas at Little Rock

FIRST-ORDER LOGIC: SYNTAX

• SENTENCES: describe facts that are true or false– VOWEL(A)– ABOVE(A,B)– 2 = 2

• OPERATORS: ^, v, ¬, =>, , ()• TERMS: describe objects

– A, B, 2– x, y– NUMBER-OF(A)

• QUANTIFIERS: , ∀ ∃– ∀x VOWEL(X) => NUMBER-OF(X) = 1– ∃x NUMBER-OF(X) = 2

Page 15: CPSC 7373: Artificial Intelligence Lecture 8: Representation with Logic Jiang Bian, Fall 2012 University of Arkansas at Little Rock

VACCUM WORLD• LOCATION:

– A, B, V, D1, D2• RELATIONS:

– LOC– VACUUM– DIRT– AT(O, L)

• e.g., – the vacuum is at location A

• AT(V,A)– there's no dirt in any location

• ∀d l DIRT(d) ^ ¬LOC(l) => AT(d, l)∀

– the vacuum is in a location with dirt • ∃l d DIRT(d) ^ LOC(l) => AT(d, l) ^ ∃

AT(V,l)

FIRST-ORDER: RELATIONS ARE ON OBJECTS, BUT NOT ON RELATIONS

Page 16: CPSC 7373: Artificial Intelligence Lecture 8: Representation with Logic Jiang Bian, Fall 2012 University of Arkansas at Little Rock

Quiz – 1

V S U

∃x,y x=y

( x x=x) => (y z y = z)∃ ∀ ∃

∀x P(x) v ¬P(x)

∃x P(x)

Page 17: CPSC 7373: Artificial Intelligence Lecture 8: Representation with Logic Jiang Bian, Fall 2012 University of Arkansas at Little Rock

Quiz – 1

V S U

T ∃x,y x=y

T ( x x=x) => (y z y = z)∃ ∀ ∃

T ∀x P(x) v ¬P(x)

T ∃x P(x)

Page 18: CPSC 7373: Artificial Intelligence Lecture 8: Representation with Logic Jiang Bian, Fall 2012 University of Arkansas at Little Rock

Quiz – 2Y N

Sam has two jobs∃x,y JOB(Sam, x) ^ JOB(Sam, y) ^ ¬ (x=y)Can I define set membership with these 2 axioms?∀x, s MEMBER(x, ADD(x, s))∀x, s MEMBER(x,s) => ( y MEMBER(x, ADD(y,s)))∀define the notion of adjacent squares on a checkboard?∀x, y ADJ(SQ(x,y), SQ(+(x,1), y)) ^ ADJ(SQ(x,y), SQ(x, +(y,1))) ^

Page 19: CPSC 7373: Artificial Intelligence Lecture 8: Representation with Logic Jiang Bian, Fall 2012 University of Arkansas at Little Rock

Quiz – 2Y N

T Sam has two jobs∃x,y JOB(Sam, x) ^ JOB(Sam, y) ^ ¬ (x=y)

T Can I define set membership with these 2 axioms?∀x, s MEMBER(x, ADD(x, s))∀x, s MEMBER(x,s) => ( y MEMBER(x, ADD(y,s)))∀

T define the notion of adjacent squares on a checkboard?∀x, y ADJ(SQ(x,y), SQ(+(x,1), y)) ^ ADJ(SQ(x,y), SQ(x, +(y,1))) ^