all rights reservedl. manevitz lecture 41 artificial intelligence logic l. manevitz

35
All rights res erved L. Manevitz Lecture 4 1 Artificial Intelligence Logic L. Manevitz

Post on 20-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 1

Artificial IntelligenceLogic

L. Manevitz

Page 2: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 2

Logic - Advantages

• Pretty universal – (need to choose the correct language).

• Clear semantics– Interpretation.– Intended Interpretation.

• Uniform Method of Manipulating– Theorem proving via Resolution.– Green’s Trick for answer production.

Page 3: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 3

Representing Information

Formulas Formulas

Semanticconnection

Formal connection

RepresentationInterpretation

Page 4: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 4

Basic Concept

Let be a set of formulas.

Let φ be a specific formula.

When does φ logically follow from ?

Meaning : in every possible interpretation where is true then φ is true.

Notationally : φ

( “semantically implies φ).

Page 5: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 5

Syntax

• Language:– Logical symbols.– Relation symbols.– Function symbols.– Constant symbols.

• Terms – recursive.• Formulas – recursive.• Sentences – no free variables.

Page 6: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 6

Semantics - Interpretation

θ= <A|R1,R2,..,Ri,F1,F2,..,Fk,C1,C2,..,Cl>

Ri AxAx..xA

Fk : AxAx..xA A

Cl A

θ θ θ θ θ θ θ θ θ

θ

θ

θ

Page 7: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 7

Semantics

• To handle variables, we extend the notion of satisfaction to include variables

(explain on blackboard)

Page 8: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 8

How to work with

• Basic semantic equivalents :– (e.g. De Morgan’s Laws, Assoc. Laws,

Distr. Laws).

• Fundamental Problem :– Find mechanical procedure to test if

φ or not.

Page 9: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 9

Abstraction of Proof - φ

• Intuitive: φ1

φ2

φn = φ

• Example: “Acceptable Rule”

φ ψ (MP)

Where φi or

φi follows from {φj | j<i}

By “acceptable” rule

φψ

Page 10: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 10

Definitions

• A system S is consistent if whenever φ then φ.

• A system S is complete if whenever φ then φ.

s

s

Page 11: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 11

Theorem

• Completeness Theorem:

There is a system S

s.t. φ φ

Page 12: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 12

Example

• Trivially complete

where A is any formula.

• Sound Rule: (MP)

A

A BAB

Page 13: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 13

Example cont.

[M | s] A B iff [M | s] A or [M | s] B by def.

If [M | s] A then [M | s] A by def.

It follows that [M | s] B.

A BAB

Page 14: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 14

What kind of systems ?

• Mimic People (“Natural Deduction”).

• Mimic Mathematical Proof.

• Convenient for Computers.

Page 15: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 15

Proof Systems

“Natural Deduction”

Formal Computationale.g. Resolution

Completeness Theorem

Page 16: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 16

Control

DATA

Set of formulas

Rules of Deduction

What rule to apply to what ?

Page 17: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 17

Resolution System (Syntax)Sound Rule

• Basic Idea:

(φ1 … φn) ( φ1 ψ1 … ψm)

φ2 … φn ψ1 … ψm

Page 18: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 18

Semantic Equivalents

• We can check this, now that we have a definition of truth in interpretations.

• Example ~(~p) is equivalent to p

Page 19: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 19

Semantic Equivalents

• ( A) A

• A B A B

• A B B A

• A B (A B) (B A)

• Associative :– A (B C) (A B) C– A (B C) (A B) C

Page 20: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 20

Semantic Equivalents cont.

• Commutative:– A B B A– A B B A

• Distributive:– A (B C) (A B) (A C)– A (B C) (A B) (A C)

Page 21: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 21

Semantic Equivalents cont.

• De Morgan:– (A B) ( A) ( B)– (A B) ( A) ( B)

Page 22: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 22

Quantifier Equivalences

• De Morgan:• (( x)A(x)) ( x) A(x)• (( x)A(x)) ( x) A(x)

• x A(x) y A(y)• x A(x) y A(y)

• x [P(x) Q(x)] ( x P(x)) ( x Q(x))• x [P(x) Q(x)] ( x P(x)) ( x Q(x))

Page 23: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 23

Resolution (Predicate) S

• Convert to set of clauses.• Convert S to set of clauses.• Let Clauses := all the above clauses.• Repeat until NIL found :

– Select two clauses.

– Resolve (using Unification).

– Check result :• If result is NIL finish.

• Otherwise add result to Clauses

Page 24: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 24

Over all Procedure

1. Eliminate , .

2. Push to atomic.

3. Eliminate .

4. Rename variables in a formula.

5. Move quantifier to the left.

Page 25: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 25

Over all Procedure

6. Push down.

7. Eliminate conj. - By making separate formulas.

8. Rename variables in all formulas.

9. Eliminate - Convention.

Page 26: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 26

Example

• [ x (A(x) B(x)] [ y C(y)]

• [ x (A(x) B(x)] [ y C(y)]

• [ x (A(x) B(x)] [ y C(y)]

• [ x ( A(x) B(x)] [ y C(y)]

• A(a) B(a) y C(y)

• y [ A(a) B(a) C(y)]

• Get Clause [ A(a) B(a) C(y)]

To replace add a constant to language.

Page 27: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 27

- Elimination example

• x y Boss (y,x)– Problem:

• Constant not sufficient.

• y depends on x.

– Solution:• Add a new function symbol f().

• x Boss (f(x),x)

Page 28: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 28

Example

1. x [Brick(x) [ y[On(x,y) Pyramid(y)] y[On(x,y) On(y,x)]

y[ Brick(y) Equal(x,y)]]]

2. x [ Brick(x) [ y[On(x,y) Pyramid(y)] y[On(x,y) On(y,x)]

y[ ( Brick(y)) Equal(x,y)]]]

Eliminate

Push

Page 29: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 29

Example cont.

3. x [ Brick(x) [ y[On(x,y) Pyramid(y)] y[ On(x,y) On(y,x)] y[Brick(y) Equal(x,y)]]]

4. x [ Brick(x) [[On(x,support(x)) Pyramid(support(x))]

y[ On(x,y) On(y,x)] y[Brick(y)

Equal(x,y)]]]

Eliminate

Rename variables apart

Page 30: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 30

Example cont.

5. x [ Brick(x) [[On(x,support(x)) Pyramid(support(x))]

y[ On(x,y) On(y,x)] z[Brick(z) Equal(x,z)]]]

6. x y z [ Brick(x) [[On(x,support(x)) Pyramid(support(x))]

[ On(x,y) On(y,x)] [Brick(z)

Equal(x,z)]]]

Move to left

Push down

Page 31: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 31

Example cont.

7. x y z [ Brick(x) [On(x,support(x)) Pyramid(support(x))]]

[ Brick(x) On(x,y) On(y,x)] [ Brick(x) Brick(z) Equal(x,z)]]

Page 32: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 32

Example cont.

8. x y z [[ Brick(x) On(x,support(x))] [ Brick(x)

Pyramid(support(x))] [ Brick(x) On(x,y) On(y,x)]

[ Brick(x) Brick(z) Equal(x,z)]]Eliminate

conj.

Page 33: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 33

Example cont.

9. x [ Brick(x) On(x,support(x))] x [ Brick(x) Pyramid(support(x))] x y [ Brick(x) On(x,y) On(y,x)] x z [ Brick(x) Brick(z) Equal(x,z)]

Rename variables

Page 34: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 34

Example cont.

10. x [ Brick(x) On(x,support(x))] w [ Brick(w) Pyramid(support(w))] u y [ Brick(u) On(u,y) On(y,u)] v z [ Brick(v) Brick(z) Equal(v,z)]

Eliminate

Page 35: All rights reservedL. Manevitz Lecture 41 Artificial Intelligence Logic L. Manevitz

All rights reserved L. Manevitz Lecture 4 35

Example cont.

• Clause form:

Brick(x) On(x,support(x)) Brick(w)

Pyramid(support(w)) Brick(u) On(u,y) On(y,u) Brick(v) Brick(z) Equal(v,z)