Title: Autonomy Knowledge Representation
1Autonomy Knowledge Representation
- Shyh-Kang Jeng
- Department of Electrical Engineering/
- Graduate Institute of Communication Engineering
- National Taiwan University
2References
- J. P. Bigus and J. Bigus, Constructing
Intelligent Agents with Java, Wiley Computer
Publishing, 1998 - S. Russell and P. Norvig, Artificial
Intelligence A Modern Approach, Englewood
Cliffs, NJ Prentice Hall, 1995
3Goal-Based Agents
Sensors
Environment
State
Environment Model
Options
Decision Maker
Goals
Agent
Effectors
4Knowledge-Based Agents
Sensors
Environment
Knowledge Base Management System
Knowledge Base
Agent
Effectors
5Knowledge Base
- A set of representation of facts about the world
- Each individual representation is a sentence
- Sentences are expressed in a knowledge
representation language - Knowledge representation languages are composed
of symbols - Representation and reasoning support the
operation of a knowledge-based agent - Accessed through a knowledge base management
system (KBMS)
6General Knowledge-Based Agent (1)
- class KBAgent
- KnowledgeBase kb
- KBMS kbms
- counter t // indicating time
- public KBAgent()
- kb new KnowledgeBase()
- kbms new KBMS( kb )
- t 0
-
7General Knowledge-Based Agent (2)
- public Action run(Percept percept)
- kbms.tell(new
- PerceptSentence(percept, t))
- Action action kbms.ask( new
- ActionQuery(t) )
- kbms.tell( new
- ActionSentence(action,t) )
- t return action
-
8Description Levels
- Knowledge level (epistemological level)
- Most abstract
- Example Taipei is in the north of I-Lan
- Logical level
- Knowledge is encoded into sentences
- Example North( Taipei, Taiwan )
- Implementation level
- Physical representation of the sentences at the
logical level - Important to the efficient performance of the
agent
9Knowledge Representation
- Natural language
- Most easily understood for people
- Not the best for computers because of ambiguity
- Formal logic was the first representation
language
10Some Kinds of Knowledge
- Simple facts or complex relationships
- Mathematical formulas or rules for natural
language syntax - Associations between related concepts
- Inheritance hierarchies between classes of objects
11Choosing Knowledge Representations
- Each type of knowledge places special
requirements on both human comprehension and
computer manipulation - A good knowledge representation
- Easy to use
- Easily modified and extended
12Procedural Representation
- Encodes facts and defines sequence as well as the
control structure of operations for using and
manipulating those facts - Example FORTRAN programs
- hardcoded logic
- Not considered to be part of AI per se
- Few AI programs exist which do not contain some
amount of procedural control code
13Declarative Representation
- Simply states facts, rules, and relationships
- Separate the knowledge and the manipulation of
the knowledge - Still needs to be processed by some procedural
code - More easily modified
- Allows for optimization and reuse inferencing
procedures
14Relational Representation
- Knowledge is stored in a table and manipulated
through relational calculus - Information of an item is represented by tuples
or records - Each tuple contains a set of fields or columns
defining specific attributes and values of the
item - Flexible but not good at representing complex
relationships between concepts or objects in the
real world
15Hierarchical Representation
- Represents relationships and shared attributes
between kinds or classes of objects - Use categories or types to give structure to the
world by grouping similar objects together - Allows for compact representation
- Allows reasoning algorithms to process at
different levels of abstraction or granularity
16Frames
- As a collection of attributes which defines the
state of an object and its relationship to other
frames - Also called slot-and-filler data representations
- Slots are the data values
- Fillers are attached procedures which are called
before, during, or after the slots value is
changed - Often linked to a hierarchy
17A Frame Example
isa
isa
isa
isa
isa
18Semantic Nets
- Defines the meaning of a concept by its
relationships to other concepts - Uses a graph data structure, where nodes hold
concepts and links show the relationships - Both frames and semantic nets can be transformed
to predicate logic
19A Semantic Net Example
has-part
Vehicle
Wheels
has-part
isa
has-part
Motor
Doors
Automobile
num-wheels
isa
size
4
Sports Car
Small
num-doors
2
instance
Corvette
20Knowledge Representation Language
- Syntax
- describes the possible configurations that
constitute sentences - Semantics
- determines the facts in the world to which the
sentences refer - Logic
- A language with the syntax and semantics defined
precisely
21Entailment
- A set of sentences entails a sentence if the fact
represented by the sentence follows the facts
represented by the set of sentences
22Inference Procedure
- Given a knowledge base KB, an inference procedure
can generate new sentences that purport to be
entailed by KB - Given a knowledge base KB and another sentence a,
an inference procedure can report whether or not
a is entailed by KB - An inference procedure that generates only
entailed sentences is called sound or
truth-preserving
23Proof, Complete Procedure, and Proof Theory
- The record of operations 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 - Proof theory specifies a set of rules for
deducing the entailments of a set of sentences
24Logics
- A logic consists of
- A formal system for describing states of affairs,
consisting of the syntax and the semantics of the
language - A proof theory
- The ontological commitments of a logic have to do
with the nature of reality in the related world - The epistemological commitments of a logic have
to do with states of knowledge an agent can have
25Some Formal Languages
26Propositional Logic Syntax
27Propositional Logic Semantics
- Defined by specifying the interpretation of the
symbols and constants, and specifying the
meanings of the logical connectives - A complex sentence has a meaning derived from the
meaning of its parts - Each connective can be thought of as a function
and defined by truth tables
28Truth Tables for Connectives
29Test for Valid Sentences
- A valid sentence is true for every possible
combination of truth values for the propositional
symbols in the sentence - Truth table can be used to test for valid
sentences - This can be used to determine if the conclusion
(consequent) is true given some premises
(antecedent). Just test if the following sentence
is valid -
30Models (1)
- Any world in which a sentence is true under a
particular interpretation is called a model of
the sentence under that interpretation - The meaning of a sentence can be defined by means
of set operations on sets of models - Another view is to regard a model as a mapping
from proposition symbols to truth and falsehood,
and the models of a sentence are those mappings
that make the sentence true
31Models (2)
32Inference Rules (1)
- The soundness of an inference can also be
established through truth tables - Inference rules are some inference patterns that
occur frequently - Inference rules can be used to make inferences
without going through the tedious process of
building truth tables - The inference rule that b can be derived from a
is denoted as
33Inference Rules (2)
- Conjunctions and conjuncts
- Disjunctions and disjuncts
34Inference Rules (3)
- Modus Ponens or Implication-Elimination
- And Elimination
35Inference Rules (4)
- And-Introduction
- Or-Introduction
36Inference Rules (5)
- Double-Negation Elimination
- Unit Resolution
37Inference Rules (6)
- Resolution
- b cannot be both true and false, one of the
other disjuncts must be true in one of the
premises - Or, equivalently, implication is transitive
38Completeness and Complexity of Propositional
Inference
- The truth-table method of inference is complete
- For any proof involving n proposition symbols, 2n
rows of the table is enumerated - Complexity is O(2n)
- A more efficient inference procedure relies on
the monotonicity
39Monotonicity
- A logic is monotonic if when we add some new
sentences to the knowledge base, all the
sentences entailed by the original knowledge base
are still entailed by the new larger knowledge
base - This is true regardless of the contents of the
new knowledge base it can be irrelevant or even
contradictory to the original knowledge base - Propositinal logic and first-logic are monotonic
in this sense
40A Knowledge Base Example
41An Inference Example
42The Wumpus World
43Agent in the Wumpus World
- The agent starts in the lower left corner labeled
1,1, facing to the right - Goal Find the gold, return to 1,1 and climb
out of the cave as soon as possible - Actions Forward, Turn(Right), Turn(Left), Grab,
Release, Shoot, Climb - Percepts Stench, Breeze, Glitter, Bump, Scream
44Acting and Reasoning in the Wumpus World (1)
45Acting and Reasoning in the Wumpus World (2)
46Acting and Reasoning in the Wumpus World (3)
47Acting and Reasoning in the Wumpus World (4)
48Knowledge After the Third Move
49Propositional Knowledge Base After the Third Move
50Finding the Wumpus
51Propositional Agent Action
- Action rule example
- Action Query
- while(actionIterator.hasNext())
- if( kb.ask( new
- ActionQuery(t, action) )
- t
- return action
-
-
52Problems with Propositional Agent
- Too many propositions to handle
- Example 64 propositions for the rule dont
forward if the wumpus is in front of you - Dealing with change over time
- Example
53First-Order Logic Syntax
54Quantifiers
- Universal quantifier
- Existential quantifier
55Some Properties of Quantified Sentences
56First-Order Logic vs.Higher-Order Logic
- In first-order logic one can quantify over
objects but not over relations or functions on
those objects - Higher-order logic allows us to quantify over
relations and functions as well as over objects - Example
57Axioms, Definitions, and Theorems
- Axioms Basic facts about a domain
- Definition Basic description of concepts in a
domain - Example Definition of P
- Theorem Sentences proved through axioms and
definitions - Independent axioms and redundant axioms
58Sets and Lists
- Sets
- Constant EmptySet
- Predicates Set, Member, Subset
- Functions Intersection, Union, Adjoint
- Lists
- Constant Nil
- Functions Cons, Append, First, Rest
- Predicates Find, Member, List?
59Special Notations for Sets and Lists
60Accessing First-Order Logic KB
- Assertions
- Example
- Queries or goals
- Example
- Substitution or binding list
- Example
61General Knowledge-Based Agent (1)
- class KBAgent
- KnowledgeBase kb
- KBMS kbms
- counter t // indicating time
- public KBAgent()
- kb new KnowledgeBase()
- kbms new KBMS( kb )
- t 0
-
62General Knowledge-Based Agent (2)
- public Action run(Percept percept)
- kbms.tell(new
- PerceptSentence(percept, t))
- Action action kbms.ask( new
- ActionQuery(t) )
- kbms.tell( new
- ActionSentence(action,t) )
- t return action
-
63Reflex Agent
- Action run(Percept percept)
- state
- interprete(percept)
- rule
- kbms.ruleMatch(state)
- action rule.Action()
-
64Reflex Agent for the Wumpus World (1)
- Direct rules
- Example
- Mediated rules
- Example
65Reflex Agent for the Wumpus World (2)
- Limitations
- Unable to know the states
- Example Not knowing when to climb
- Unable to avoid infinity loop
66Model-Based Agent
- Maintain an internal model of the world
- Any system that makes decisions on the basis of
past percepts can be rewritten to use instead a
set of sentences about the current world state - Example My keys are in my pocket
- Diachronic rules
- Rules describing the way in which the world
changes or does not change
67Situational Calculus
68Representing Changes
- Relations or functions
- Examples
- Function Result
- Examples
- Effect axioms
- Examples
69Defining Time-Varying Predicates
- Frame axioms
- Examples
- Successor-state axioms
- Example
70Describing the Map
71Synchronic Rules
- Causal Rules
- Examples
- Diagnostic Rules
- Examples
72Diagnostic Rules vs. Model-Based Reasoning
- Reasoning that a square is OK
- Diagnostic rules
- Model-based reasoning
73Action-Value System
- Example
- Great, Good, Medium, Risky, Deadly
- Recommending an action
74Agent Exploration Policy
- Great to pick up the gold when found and climbing
out of the cave with the gold - Good to move to an OK square that has not been
visited - Medium to move to an OK square that has been
visited - Risky to move to a square that is not deadly, but
is not known to be OK either - Deadly to move to a square that is known to
contain a pit or a live wumpus
75Knowledge Engineering
- Knowledge engineering
- Process of building knowledge base
- Knowledge engineer
- Knowledge acquisition
- Prior to, or interleaved with, the process of
creating formal representations
76Knowledge Engineering vs. Programming
77Knowledge Engineering Methodology
- Ontological engineering
- Decide what to talk about
- Decide on a vocabulary of predicates, functions,
and constants (ontology of the domain) - Encode general knowledge about the domain
- Encode a description of the specific problem
instance - Pose queries to the inference procedure and get
answers
78General Ontology
- Ontology
- Particular theory of the nature of being or
existence - General ontology
- Applicable in more or less any special-purpose
domain, with the addition of domain-specific
axioms - Examples Categories, measures, composite
objects, time, space, change, events, processes,
physical objects, substances, mental objects,
beliefs
79A General Ontology Hierarchy