logical agents knowledge-based agents logic propositional logic summary

32
Logical Agents Knowledge-Based Agents • Logic • Propositional Logic • Summary

Upload: jeffery-wiggins

Post on 13-Jan-2016

243 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Logical Agents

• Knowledge-Based Agents• Logic• Propositional Logic• Summary

Page 2: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Knowledge-Based Agents

• Central component is a knowledge-base• Knowledge is made of sentences• Sentences are expressed in a language• We wish to derive new sentences through inference.

Page 3: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Knowledge-Based Algorthim

Function KB (percept) returns action

TELL (KB; PERCEPT-SENTENCE(percept,t))action = ASK(KB,MAKE-ACTION-QUERY(t))TELL (KB;ACTION-SENTENCE(action,t))T = t + 1Return action

Page 4: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Declarative vs Procedural

Two approaches to store knowledge:

1. Declarative. Sentences representing knowledge

2. Procedural. Encode behavior directly as code.

Page 5: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

An Example

Moving on a square to reach a goal state while avoiding risks.

Page 6: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary
Page 7: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary
Page 8: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary
Page 9: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Logical Agents

• Knowledge-Based Agents• Logic• Propositional Logic• Summary

Page 10: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Logic Important terms:

Syntax .- rules to represent well-formed sentences Semantics.- define the truth of each sentence. Model.- Possible world (m is a model of a) Entailment:

a |= b a entails b means: In every model where a is true, b is also true.

Page 11: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Logic

Sentence a is derived from KB by algorithm i:

KB |=i a

• Algorithm i is called sound (truth preserving) if it derives only entailed sentences.

• Algorithm i is called complete if it derives all entailed sentences.

Page 12: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Physical configuration

Representation

Sentence Sentence

Real World Real World

entails

follows

sem

ant i

cs

sem

ant i

cs

Page 13: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Allen Newell

Born in 1927 – died in 1992

1982 “The Knowledge Level”Rational agents can be describedby the knowledge they contain

With Herbert Simon he developed the Logic Theorist (first real AI program).

Winner of the Turing Award

Page 14: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Logical Agents

• Knowledge-Based Agents• Logic• Propositional Logic• Summary

Page 15: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Syntax

• Atomic sentences: propositional symbols

• Complex sentences use logical connectives

• Negation,conjunction,disjunction

• Implication and biconditional.

Page 16: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Syntax

Sentence Atom | Complex StructureAtom True | False | SymbolSymbol P | Q | RComplex S - sentence | ( sentence ^ sentence ) | ( sentence V sentence ) | ( sentence sentence) | ( sentence sentence)

Page 17: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Semantics

How to define the truth value of statements?

• Connectives associate to truth tables.• The knowledge base of an agent grows by telling it of new statements:

TELL(KB,S1), … TELL(KB,Sn)

KB = S1 ^ … ^ Sn

Page 18: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Inference

We want to know if KB entails a: KB |= aApproach 1: Try all models

KB: {b , b a}

b a Models consistent with KBt t YESt f NOf t NOf f NO

Page 19: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Check All Models

Method is characterized as:

• sound (directly implements entailment)• complete (it works for any KB and a and it always terminates.

Problem: With n symbols there are 2n models.Time complexity is O(2n)Space complexity is O(n)

Page 20: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Some concepts

• Equivalence: a = b a |= b and b |= a

•Validity A sentence is valid if it is true in all models Example p V -p

•Satisfiability A sentence is satisfiable if it is true in some model

Page 21: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Reasoning Patterns Modus Ponens a b, a b And-Elimination a ^ b a Commutativity of ^ and V de Morgan’s Laws, etc.

Page 22: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Proofs

• Applying a sequence of rules is called a proof.• Equivalent to searching for a solution • Monotonicity: if KB |= a then KB ^ b |= a

{b, b a}

a

Modus ponens

Page 23: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Resolution

Complete and sound inference algorithm

a v b ~a v c

b v c

Cannot derive all conclusions but can tellif they are true or false (refutation completeness).

Page 24: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Applying Resolution

Resolution only works on disjunction of literals.How can we apply resolution to all clauses?

Solution: convert to conjunctive normal form (CNF)

CNF : (L11 V .. V L1k) ^ … ^ (Ln1 V … V Lnk)

Page 25: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Resolution

How does it work?

To show that KB |= a We show that (KB ^ ~a) is unsatisfiable.

Every pair that contains complementary literals is resolved.Continue until there are no new clauses (KB |= a) Or we derive the empty clause (a V ~a) (KB |= a)

Page 26: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Example

a v b v ~c d v c

a v b v d ~b

a v d ~d

a ~a

KB |= b

KB

Page 27: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Horn Clauses

In practice we restrict our clauses to Horn Clauses.(base of logic programming)Horn Clause: disjunction of literals with at mostone of them being positive.

Example: (~a v ~b v c) (definite clause)

Equivalent to ( a ^ b c )

Page 28: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Forward Chaining

Begins from known facts in the knowledge base.If premises of implication are known deriveconclusion.

Continue until query is added or no moreinferences can be made.

a ^ b ^ c d a,b,c conclude d

Page 29: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Example

P QL ^ M PB ^ L MA ^ P LA ^ B LAB A B

L

M

P

Q

AND-OR Graph

Page 30: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Backward Chaining

Works backwards from the query qFind implications that conclude q If all premises can be proved true then q is true

a ^ b ^ c q

How do I prove a? and b? and c?

Page 31: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Logical Agents

• Knowledge-Based Agents• Logic• Propositional Logic• Summary

Page 32: Logical Agents Knowledge-Based Agents Logic Propositional Logic Summary

Summary

• Rational agents need to work with knowledge bases.• A language is defined by syntax and semantics• KB |= a if a is true in all models where KB is true• Inference techniques can be characterized based on soundness and completeness.• Simplest logic is propositional logic• A strong inference rule is called “resolution”• When using Horn clauses, reasoning methods are forward and backward chaining.