Chapter 6
Knowledge-Based Agent
Agents that know about their world and reason
about possible courses of action.
May be able to accept new tasks in the form of explicitly
described goals. Can learn new
knowledge about environment. Needs to
know:
- current
state of world
- how to
infer unseen properties from percepts
- how
the world evolves over time
- what
it wants to achieve
- what
its actions do in various circumstances
Design of Knowledge-Based Agent
- central
component is knowledge base (KB)
- set
of facts about the world
- each
fact is called a sentence
- expressed
in knowledge representation language
- TELL
adds fact
- ASK
queries
- inference
mechanism makes use of knowledge
- may
start with initial background knowledge
- agent
takes input (TELLS percept) and returns action (ASK)
3 levels of description of KB agent:
- knowledge/epistemological
- say what agent knows
- logical
level - knowledge encoded into sentences. Describe agent based on what
logical sentences it knows.
- implementation
level - runs on agent architecture; physical representations of the
sentences (e.g., as string, as alist, etc.)
Declarative approach: build knowledge from
sentences. Not procedural. May also include a learning approach, for
acquiring new sentences. (easier than
learning new procedural knowledge?)
153-157 Wumpus Example Interesting
Representation, Reasoning and Logic
Goal of knowledge representation: express knowledge in
computer-tractable form so it can be used to help agent perform well. Two aspects:
- syntax
= configurations of sentences
- semantics
= world facts to which sentences refer
If syntax and semantics are defined precisely, call the
language a logic.
Fact is part of world, representation is inside computer.
Proper reasoning ensures that representation-entails->rep
only when facts -follow-> facts (i.e., correspondence between logical
entailment in representation and real world).
Goal of KB is to generate new sentences that are necessarily
true, given that the old sentences are true.
This relation is called entailment. Two ways for inference procedure to operate:
- Given
KB, it can generate new sentences that are entailed by KB
- Given
KB and sentence, can report whether or not sentence is entailed by KB
Inference procedure that generates only entailed sentences
is called sound or truth preserving.
In the inference procedure:
- the
record of operation of a sound inference procedure is called a proof
- an
inference procedure is complete if it can find a proof for any
sentence that is entailed. For
many KB, the consequences are infinite, completeness is an issue.
- proof
theory - specifies the reasoning steps that are sound. Inference steps must respect the
semantics of sentences.
Representation
Programming language
- good
for algorithms and concrete data structures
- not
good when don't have complete info, just possibilities
Natural language
- goal
is communication rather than representation
- meaning
depends on sentence and context
- often
no direct representation
- ambiguous
Goals for representation
- expressive
and concise
- unambiguous
and independent of context
- effective
inference procedure to make new inferences
First-order logic forms basis of most representation schemes
in AI. - Specifics of logical notation
not important, main thing is how a precise formal language represents knowledge
and how mechanical procedures can operate on knowledge to perform
reasoning.
Semantics
- writer
of sentence must provide interpretation.
Sentence does not mean anything by itself (but meaning may have
been fixed long ago).
- Languages
are compositional. meaning of sentence is function of meaning of its parts
- sentence
can be true or false. Depends on interpretation of sentence and state of
world
Inference
- logical
inference/deduction
- valid
sentence/tautology (necesssarily true) iff true under all possible interpretations in all possible
worlds A v ~A
- satisfiable
sentence - iff some interpretation in some world for which it is true
(doesn't have to be true right now)
- unsatisfiable/contradiction
- not satisfiable. e.g.,
self-contradictory A ^ ~A
Computer inference
- doesn't
know interpretation of sentences
- doesn't
know about world except via sentences
- can
only do symbolic manipulation of sentence representations
- we
provide interpretation of conclusions (valid sentences reached via
inference process)
- can
handle very complex sentences
Logic
- formal
system for describing state of affairs, including syntax and semantics
- proof
theory or set of rules for deducing entailments
Propositional logic
- symbols
represent whole propositions (facts)
- use
Boolean connectives to generate more complex sentences
- little
commitment about how things are represented
- not
very useful
First-order logic
- contains
objects and predicates on objects (i.e., properties of
objects or relationships between them)
- includes
connectives and quantifiers
- Can capture
much of what we know about the world
Ontology - nature of reality... True or False in
propositional. Properties of objects
and relationships between them in first-order.
Temporal logic - set of time points, can reason about
time.
Epistemology - states of knowledge. What can we know? For these logics, have three states of belief: believe true,
believe false, or be unable to conclude.
Some systems will have degrees of belief or assign a degree of
truth (fuzzy).
Propositional Logic
Syntax:
- Symbols
include True/False/prepositional symbol such as P, logical connectives,
and parentheses.
A sentence consists of:
- logical
constants True and False
- propositional
symbol such as P or Q
- symbols
inside parentheses are a sentence (P v Q)
- ^
and/conjunction
- v
or/disjunction
- =>implies/implication.
(P ^ Q) => R. premise or
antecedent is (P ^ Q). conclusion
or consequent is R. Also known as rules or if-then statements.
- <=>
equivalence/biconditional
- ~
not/negation. Operates on single
sentence.
- atomic
sentence = single symbol, e.g., P
- complex
sentence includes connectives and parentheses
- literal
is atomic sentence or negated atomic sentence
- grammar
is ambiguous P v Q ^ R is either (PvQ)^R or P v (Q^R)
- need
precedence: ~ ^ v => <=>
Semantics
- propositional
symbol can mean whatever you want.
Can be satisfiable but not valid.
- true:
way the world is. False: way the
world is not.
- complex
sentence has meaning derived from parts.
Standard truth tables.
- implication
doesn't follow intuition about English (false antecedent always means true
statement (making no claim when false), no causal relation between
antecedent and conclusion is required)
Validity and Inference
- Truth
tables used to test for valid sentences
- For
P => C build truth table, if valid (true in every row), then conclude C
Models
Any world in which a sentence is true under a particular
interpretation is called a model of that sentence under that interpretation
May be many models for given sentence
More claims -> fewer models
- entailment:
sentence s is entailed by KB if models of KB are all models of s
- P ^
Q is intersection of models of P and models of Q
Rules of inference for prepositional logic
- certain
recurring patterns of inference can be shown as sound without.
- Can
then use those patterns, in the form of inference rules, without having to
build truth table
- a |-
b says b is derived from a by inference rule
7 common inference rules (Figure 6.13)
- modus
ponens: a=>b, a conclude b
- and-eliminination:
a^b^c can infer any of the conjuncts
- and-introduction:
a,b,c as separate true statements infers a^b^c
- or-introduction:
a can infer avbvc etc.
- double-negation
elimination: ~~a implies a
- unit
resolution: a v B, ~B, infer a
- resolution:
avB and ~Bvg infer avg
Complexity
- Checking
a set of sentences for satisfiability is NP-complete
- monotonic
logic - if add new sentences to KB, all sentences entailed by original
KB are still entailed.
Propositional and first-order logic are monotonic.
- if
not monotonic, couldn't have any local rules, because rest of KB might affect
soundness of inference.
Probability theory is not monotonic.
- There
is a useful class of sentences for which a polynomial-time inference
procedure exists.
- Horn
sentence/Horn clause: P1 ^ P2 ^ ... Pn => Q
- Ps
and Q are non-negated atoms
- Special
case 1: True=> Q is equivalent to atomic sentence Q
- Special
case 2: If Q is false, get ~P1 v ~P2 v … ~Pv
- If
can write KB as collection of Horn sentences, simple inference procedure:
apply Modus Ponens wherever possible until no new inferences remain to be
made.
How to represent problems in prepositional logic
Read Wumpus World example
Limitations of propositional logic
- too
weak. 64 rules just for
"don't go forward if wumpus"
- doesn't
handle change (e.g., agent moving around)