For next Tuesday Read chapter 8 No written homework Initial posts - - PowerPoint PPT Presentation

for next tuesday
SMART_READER_LITE
LIVE PREVIEW

For next Tuesday Read chapter 8 No written homework Initial posts - - PowerPoint PPT Presentation

For next Tuesday Read chapter 8 No written homework Initial posts due Thursday 1pm and responses due by class time Tuesday Program 1 Any questions? Imperfect Knowledge What issues arise when we dont know everything (as in


slide-1
SLIDE 1

For next Tuesday

  • Read chapter 8
  • No written homework
  • Initial posts due Thursday 1pm and

responses due by class time Tuesday

slide-2
SLIDE 2

Program 1

  • Any questions?
slide-3
SLIDE 3

Imperfect Knowledge

  • What issues arise when we don’t know

everything (as in standard card games)?

slide-4
SLIDE 4

State of the Art

  • Chess – Deep Blue, Hydra, Rybka
  • Checkers – Chinook (alpha-beta search)
  • Othello – Logistello
  • Backgammon – TD-Gammon (learning)
  • Go
  • Bridge
  • Scrabble
slide-5
SLIDE 5

Games/Mainstream AI

slide-6
SLIDE 6

What about the games we play?

slide-7
SLIDE 7

Knowledge

  • Knowledge Base

– Inference mechanism (domain-independent) – Information (domain-dependent)

  • Knowledge Representation Language

– Sentences (which are not quite like English sentences) – The KRL determine what the agent can “know” – It also affects what kind of reasoning is possible

  • Tell and Ask
slide-8
SLIDE 8

Getting Knowledge

  • We can TELL the agent everything it needs

to know

  • We can create an agent that can “learn” new

information to store in its knowledge base

slide-9
SLIDE 9

The Wumpus World

  • Simple computer game
  • Good testbed for an agent
  • A world in which an agent with knowledge

should be able to perform well

  • World has a single wumpus which cannot

move, pits, and gold

slide-10
SLIDE 10

Wumpus Percepts

  • The wumpus’s square and squares adjacent

to it smell bad.

  • Squares adjacent to a pit are breezy.
  • When standing in a square with gold, the

agent will perceive a glitter.

  • The agent can hear a scream when the

wumpus dies from anywhere

  • The agent will perceive a bump if it walks

into a wall.

  • The agent doesn’t know where it is.
slide-11
SLIDE 11

Wumpus Actions

  • Go forward
  • Turn left
  • Turn right
  • Grab (picks up gold in that square)
  • Shoot (fires an arrow forward--only once)

– If the wumpus is in front of the agent, it dies.

  • Climb (leave the cavern--only good at the

start square)

slide-12
SLIDE 12

Consequences

  • Entering a square containing a live wumpus

is deadly

  • Entering a square containing a pit is deadly
  • Getting out of the cave with the gold is

worth 1,000 points.

  • Getting killed costs 10,000 points
  • Each action costs 1 point
slide-13
SLIDE 13

Possible Wumpus Environment

Stench Stench Stench Stench

Breeze Breeze Breeze Breeze Breeze Breeze Gold Pit Pit Pit

Wumpus Agent

slide-14
SLIDE 14

Knowledge Representation

  • Two sets of rules:

– Syntax: determines what atomic symbols exist in the language and how to combine them into sentences – Semantics: Relationship between the sentences and “the world”--needed to determine truth or falsehood of the sentences

slide-15
SLIDE 15

Reasoning

  • Entailment
  • Inference

– May produce new sentences entailed by KB – May be used to determine which a particular sentence is entailed by the KB

  • We want inference procedures that are

sound, or truth-preserving.

slide-16
SLIDE 16

What Is a Logic?

  • A set of language rules

– Syntax – Semantics

  • A proof theory

– A set of rules for deducing the entailments of a set of sentences

slide-17
SLIDE 17

Distinguishing Logics

Language Ontological Commitment (what exists in the world) Epistemological Commitment (What an agent believes about facts) Propositional Logic facts true/false/unknown First-order logic facts, objects, relations true/false/unknown Temporal logic facts, objects, relations, times true/false/unknown Probability theory facts degree of belief 0…1 Fuzzy logic degree of truth degree of belief 0…1

slide-18
SLIDE 18

Propositional Logic

  • Simple logic
  • Deals only in facts
  • Provides a stepping stone into first order

logic

slide-19
SLIDE 19

Syntax

  • Logical Constants: true and false
  • Propositional symbols P, Q ... are sentences
  • If S is a sentence then (S) is a sentence.
  • If S is a sentence then ¬S is a sentence.
  • If S1 and S2 are sentences, then so are:

– S1  S2 – S1  S2 – S1  S2 – S1  S2

slide-20
SLIDE 20

Semantics

  • true and false mean truth or falsehood in the

world

  • P is true if its proposition is true of the

world

  • ¬S is the negation of S
  • The remainder follow standard truth tables

– S1  S2 : AND – S1  S2 : inclusive OR – S1  S2 : True unless S1 is true and S2 is false – S1  S2 : bi-conditional, or if and only if

slide-21
SLIDE 21

Vocabulary

  • An interpretation is an assignment of true or

false to each atomic proposition

  • A sentence true under any interpretation is

valid (a tautology or analytic sentence)

  • Validity can be checked by exhaustive

checking of truth tables

  • A sentence that can be true is satisfiable
slide-22
SLIDE 22

Rules of Inference

  • Alternative to truth-table checking
  • A sequence of inference rule applications

leading to a desired conclusion is a logical proof

  • We can check inference rules using truth

tables, and then use to create sound proofs

  • We can treat finding a proof as a search

problem

slide-23
SLIDE 23

Propositional Inference Rules

  • Modus Ponens or Implication Elimination
  • And Elimination
  • And Introduction
  • Unit Resolution
  • Resolution
slide-24
SLIDE 24

Building an Agent with Propositional Logic

  • Propositional logic has some nice properties

– Easily understood – Easily computed

  • Can we build a viable wumpus world agent

with propositional logic???

slide-25
SLIDE 25

The Problem

  • Propositional Logic only deals with facts.
  • We cannot easily represent general rules

that apply to any square.

  • We cannot express information about

squares and relate (we can’t easily keep track of which squares we have visited)

slide-26
SLIDE 26

More Precisely

  • In propositional logic, each possible atomic

fact requires a separate unique propositional symbol.

  • If there are n people and m locations,

representing the fact that some person moved from one location to another requires nm2 separate symbols.

slide-27
SLIDE 27

First Order Logic

  • Predicate logic includes a richer ontology:

– objects (terms) – properties (unary predicates on terms) – relations (n-ary predicates on terms) – functions (mappings from terms to other terms)

  • Allows more flexible and compact

representation of knowledge

  • Move(x, y, z) for person x moved from

location y to z.

slide-28
SLIDE 28

Syntax for First-Order Logic

Sentence  AtomicSentence | Sentence Connective Sentence | Quantifier Variable Sentence | ¬Sentence | (Sentence) AtomicSentence  Predicate(Term, Term, ...) | Term=Term Term  Function(Term,Term,...) | Constant | Variable Connective   Quanitfier  $" Constant  A | John | Car1 Variable  x | y | z |... Predicate  Brother | Owns | ... Function  father-of | plus | ...

slide-29
SLIDE 29

Terms

  • Objects are represented by terms:

– Constants: Block1, John – Function symbols: father-of, successor, plus

  • An n-ary function maps a tuple of n terms to

another term: father-of(John), succesor(0), plus(plus(1,1),2)

  • Terms are simply names for objects.
  • Logical functions are not procedural as in

programming languages. They do not need to be defined, and do not really return a value.

  • Functions allow for the representation of an

infinite number of terms.

slide-30
SLIDE 30

Predicates

  • Propositions are represented by a predicate

applied to a tuple of terms. A predicate represents a property of or relation between terms that can be true or false:

– Brother(John, Fred), Left-of(Square1, Square2) – GreaterThan(plus(1,1), plus(0,1))

  • In a given interpretation, an n-ary predicate

can defined as a function from tuples of n terms to {True, False} or equivalently, a set tuples that satisfy the predicate:

– {<John, Fred>, <John, Tom>, <Bill, Roger>, ...}

slide-31
SLIDE 31

Sentences in First-Order Logic

  • An atomic sentence is simply a predicate applied

to a set of terms.

– Owns(John,Car1) – Sold(John,Car1,Fred)

  • Semantics is True or False depending on the

interpretation, i.e. is the predicate true of these arguments.

  • The standard propositional connectives ( 

) can be used to construct complex sentences:

– Owns(John,Car1)  Owns(Fred, Car1) – Sold(John,Car1,Fred)  ¬Owns(John, Car1)

  • Semantics same as in propositional logic.
slide-32
SLIDE 32

Quantifiers

  • Allow statements about entire collections of objects
  • Universal quantifier: "x

– Asserts that a sentence is true for all values of variable x

  • "x Loves(x, FOPC)
  • "x Whale(x)  Mammal(x)
  • "x ("y Dog(y)  Loves(x,y))  ("z Cat(z)  Hates(x,z))
  • Existential quantifier: $

– Asserts that a sentence is true for at least one value of a variable x

  • $x Loves(x, FOPC)
  • $x(Cat(x)  Color(x,Black)  Owns(Mary,x))
  • $x("y Dog(y)  Loves(x,y))  ("z Cat(z)  Hates(x,z))
slide-33
SLIDE 33

Use of Quantifiers

  • Universal quantification naturally uses implication:

– "x Whale(x)  Mammal(x)

  • Says that everything in the universe is both a whale and a mammal.
  • Existential quantification naturally uses conjunction:

– $x Owns(Mary,x)  Cat(x)

  • Says either there is something in the universe that Mary does not
  • wn or there exists a cat in the universe.

– "x Owns(Mary,x)  Cat(x)

  • Says all Mary owns is cats (i.e. everthing Mary owns is a cat). Also

true if Mary owns nothing.

– "x Cat(x)  Owns(Mary,x)

  • Says that Mary owns all the cats in the universe. Also true if there

are no cats in the universe.

slide-34
SLIDE 34

Nesting Quantifiers

  • The order of quantifiers of the same type doesn't matter:

– "x"y(Parent(x,y)  Male(y)  Son(y,x)) – $x$y(Loves(x,y)  Loves(y,x))

  • The order of mixed quantifiers does matter:

– "x$y(Loves(x,y))

  • Says everybody loves somebody, i.e. everyone has someone whom

they love.

– $y"x(Loves(x,y))

  • Says there is someone who is loved by everyone in the universe.

– "y$x(Loves(x,y))

  • Says everyone has someone who loves them.

– $x"y(Loves(x,y))

  • Says there is someone who loves everyone in the universe.
slide-35
SLIDE 35

Variable Scope

  • The scope of a variable is the sentence to which

the quantifier syntactically applies.

  • As in a block structured programming language, a

variable in a logical expression refers to the closest quantifier within whose scope it appears.

– $x (Cat(x)  "x(Black (x)))

  • The x in Black(x) is universally quantified
  • Says cats exist and everything is black
  • In a well-formed formula (wff) all variables

should be properly introduced:

– $xP(y) not well-formed

  • A ground expression contains no variables.
slide-36
SLIDE 36

Relations Between Quantifiers

  • Universal and existential quantification are logically

related to each other:

– "x ¬Love(x,Saddam)  ¬$x Loves(x,Saddam) – "x Love(x,Princess-Di)  ¬$x ¬Loves(x,Princess-Di)

  • General Identities

– "x ¬P  ¬$x P – ¬"x P  $x ¬P – "x P  ¬$x ¬P – $x P  ¬"x ¬P – "x P(x)  Q(x)  "x P(x)  "x Q(x) – $x P(x)  Q(x)  $x P(x)  $x Q(x)