Chap 4 Knowledge & Reasoning
Chap 4 Knowledge & Reasoning
[email protected]
Knowledge
Representation(NR)
Contents will be
covered
Knowledge
What????
Why?????
KBA
KE
KR
KR
KR using
Logic
Why????
14
Knowledge: What and Why?
• Knowledge includes facts about the real world
entities and the
relationship between them
• Knowledge-based Systems (KBSs) are useless
without the ability to
Why Knowledge
represent is knowledge.
important ?
•• Hence,
We are there
livingisina complex
need to represent knowledge to ease the
environment.
development
of an intelligent system.
• It–Automate
enables to: reasoning , Discover new facts, Deduce new
facts that
follow from
–Make thedecisions
quality KB, and Answer users queries
- select courses of
15
actions, etc.
Knowledge-based Agent
(KBA)
about their possible courses of
action.
• Agents can be seen as knowing about their
• KBA begins with
world, some
and knowledge of the world
reasoning
and
– Itofuses
its actions.
logical reasoning to maintain a description of the
world as new
percepts
– arrive
Learn new facts/knowledge that are inferred and unseen by
current
percept
– sDeduce a course of actions that will
achieve its goals
• One can also design an autonomous
agent thatfrom experience and construct knowledge with less
– learns
human
interventio
ns 16
Knowledge-based Agent
(KBA)…
We can describe a knowledge-
based agent
at three levels:
- The most abstract
I. Knowledge Level level:
describe agent
by saying what it knows about the
world
II. Logical
Level. and what isitsencoded
- The level at which the knowledge goals are.
into sentences
of some
logical language.
III. Implementation Level.
- This is the level where sentences are implemented. This
level runs on 17
the agent architecture.
Knowledge
engineering
from the human
extracting knowledge
(KE)
•KE is the process of building a knowledge base through
expert.
•Knowledge engineering is the process of
–Extracting knowledge from the human expert.
–Choose knowledge representation formalism
–Choose reasoning and problem solving strategy.
•A knowledge engineer is someone who investigates a particular
domain,
determines what concepts are important in that domain, and
creates
–A KEa has to decide what objects and relations are worth
formal
whichrepresentation
relations
representing, of the objects and relations inGoal
andhold among the
domain.
which objects
Knowledge Knowled
ge Knowled
acquisition Representation
ge
(Extract (choose KR
Method & Base 18
knowledge
The two main tasks
of KE
22
Revision
1. What are the Criteria's for evaluating
Searching algorithm performance
2. What is k/ge? Why k/ge is needed for
developing KBS?
3. What is the main purpose of KE? – The two main
tasks of KE?
23
Propositional
logic
•A simple language useful for showing key ideas and
definitions
•Syntax: PL allows facts about the world to be represented as
sentences
formed from: symbols (P, Q, R, …) are used to represent
Proposition
Logical constants: True, False
facts about
the world: e.g.: P = "It is hot“, Q = "It is humid“, R = "It is
raining“
Logical connectives: not (), and (), or (), implies (), is
Precedence order from highest to lowest is: , ,,,
equivalent, if and only if ().
e.g. The sentence P v Q R S is equivalent to [(P) v (Q
R)] S
Parenthesis ( ): Used for grouping sentences and to specify
precedenc
order of
e 24
Propositional logic (PL)
sentences
•A sentence is made by linking prepositional
symbols together
using logical
– There connectives.
are atomic and complex
sentences.
– Atomic sentences consist of propositional symbol (e.g.
P,FALS
Q, TRUE,
– E)
Complex sentences are combined by using connectives
orparenthesi
– s:
while S and T are atomic sentences, S T, (S T), (S T),
T),(S T) are complex
(Sand
sentences.
Examples: Given the following sentences about the
convert them
“weather into PL
problem”
sentences:
• “It is humid.”: Q QP
25
••“If
“Ifititisishot
humid, then it is
and humid, then it is (P Q) R
Syntax of Propositional
logic (PL)
Symbo |Q|R|
l …
Exercis
e
Examples: Convert the following English sentences
toPropositional
logic
Let A = Lectures are active and R = Text is readable,
Pwill pass the exam, then represent the
= Aleazar
following:
• the lectures are not active:
•A
the lectures are active and the text is readable:A
• either the lectures are active or the text is readable:
R
AV
• if the lectures are active, then the text is not readable: AR
• the lectures are active if and only if the text isRreadable: A
R
A active,
if the lectures are (R P
then
) if the text is not readable,
Aleazar will not
pass the exam: 27
Terminol
ogy is valid sentence or
•Valid sentence: A sentence
tautology if and only
if Example:
it is True under all possible
“It’s raining or it’s interpretations
not in all
possible
raining.”worlds.
(R R).
•Unsatisfiable: A sentence is unsatisfiable (inconsistent
sentence or
self- contradiction) if and only if it is not satisfiable, i.e. a
sentence that
isExample:
False under allraining
“It’s interpretations.
and it's notThe world is never like
what it
raining.” R R
•Satisfiable:
describes. A sentence is satisfiable if and only if there is
some
interpretations
Example: “Itin is some
rainingworld
or it for
is which the sentence is
True.
humid”. R v Q, R
28
Proof: Inference
Rules
•Inference is used to create new sentences that logically
follow from a
–It captures
given patterns of
set of sentences ininferences
the KB. that occur over & over
again.
–Once a rule is established, it can be used to make inferences
without going
through the tedious process of building truth tables
•Given set of inference rules (I) and set of sentences (KB);
Inference is
the process of applying successive inference rules from the
KB, each rule
–There are
inferring different
new inference
facts and rules
adding its (including
conclusion logical
to KB
equivalence) that can
be used for proofing and reasoning purpose.
29
Logical equivalence
•Two sentences are logically
equivalent iff they are true in same
pνq≡qν Commutativity of
models
p
pΛq≡qΛ disjunction
p
(p Λ q) Λ r ≡ p Λ (q Λ r) Commutativity of
conjunction
(p ν q) ν r ≡ p ν (q ν r)
Associativity of
( ( p) ≡ p
conjunction
pq≡qp
Associativity of
pq≡pνq implication
disjunction
(p ν q) ≡ ( p Λ q) elimination
Double Negation
(p Λ q) ≡ ( p ν q) De-Morgan
elimination
De-
(p q) ≡ (p q) Λ (q p) Morgan
contraposition
Biconditional
p Λ (q ν r) ≡ (p Λ q) ν (p Λ elimination
r) Distributive of Λ 30
Inference
RUL Rules
PREMI CONCLU
Modus E A, SE
AB B SION
Ponens
And AB A
Elimination B
And A, AB
Introduction B A1 A2 … An
Or A A
Double Negation Elimination A
Introduction
Hypothetical Syllogism PQ, QR PR
31
Examp
• E.g. Given the following
le facts and relationship
between facts;
What can we say about the weather condition?
– It–isIfhumid:
it is humid, then it is hot :
– If it is hot and humid, then it is
raining:
1.
Q
2. Q P
3. (P Q) R
4. (using Modes Ponens on P
1&
5. 2) AND introduction P Q
(using
on 1 & 4)
32
Propositional logic is a weak
language
•PL cannot handle even a domain with small worlds. The
problem is that there
are just too many propositions to handle since it only has one
•In PL world consists
representational of the
device: justproposition
facts. It is
–Identify
hard to : individuals: E.g.,
–Describe
Mary, 3 properties of (or relations between) individuals.
E.g. Belete is
–Generalize
taller for a given universe. E.g., all triangles
than Gelaw
have 3 sides
•Example: Prove that “my dog Fido is Nice, given that “all
dogs are Nice.”
–This requires to get at the structure and meanings of
statements (where
FOL is useful).
33
First Order
Logic
•First-Order Logic (FOL) is expressive enough to
concisely represent any
kind of situation that are expressed in natural language.
–FOL represents objects and relations between objects,
variables, and
–Also k.as
quantifiers in predicate
addition to propositions
logic.
34
•Constants Components of FOL
symbol
–names (like Yonas, Kebede, …), numbers (like 1, 2, … n),
...
•Predicates:
–Predicates used to relate one object with another. E.g.
brother, >, ,...
Eg greater(5,3)
•Functions: Returns value (Sqrt, mother-of, color-of,...)
eg father-of(Mary)
= John
•Variables: X, Y, A, B,...
–Important to increase generalization capability of KB
•Connectives:
–Quantifiers specify whether all or some objects satisfy
or relations
–retains
properties betweenused in PL (, , , , )
connectives
objects
•Quantifiers:
–Two standard quantifiers: Universal (" for all, for every)
35
(“there
and exists,
Existential
Components of FOL…
• Term
– Constant, e.g. Red
– Function of constant, e.g.
Color(Block1)
• Atomic Term= Constant | Variable |
Sentence
– Predicate relatingFunction(Term,….)
objects (no
variable)Atomic Sentence= Predicate(term,……)|
Term=Term
• Brother (John, Richard)
• Complex• Married (Mother(John), Father(John))
Sentences
– Atomic sentences + logical
connectives
• Brother (John, Richard) Brother (John,
Father(John))
36
Components of FOL…
•
Quantifiers
– Each quantifier defines a variable for the duration of the
expression, and indicates the truth of the
following
expression…
Universal quantifier “for
all”– The expression is true for every possible value of
the variable
– is the main connective with
x (elephant(x)
Every elephant is gray:
gray(x))
Existential quantifier “there
exists”
– The expression is true for at least one value of
the variable
– is the main connective with 37
x (alligator(X) ^
Universal quantification
• Universal Quantifiers: makes statements about every
object
<variables> <sentence>
–Everyone at ASU is
–All cats are mammals:
smart:
xcat(x) mammal(x) xAt(x,ASU) Smart(x)
41
Sentence structure
In FOL the basic unit is a predicate
(argument/terms) structure called
•Terms refer to sentence to represent facts.
objects
Example: likes(muhe, chocolate);
tall(Silesh)
–Terms or arguments can be any of: Constant symbol, such as
‘muhe’,
variable symbol, such as X , functions, such as
•Amotherof(Silesh), father-of(
predicate is the one that says something about the subject.
father-of(
red
E.g., There isjohn))
a
book
•Subject: color of the book, represented as: x
book(x)red(x)
–Predicate also refers to a particular relation
between objects
friends(motherof(yonas) ,
•Example:
–A predicatelikes(X, richard)
motherof(sami))
statement takes the value 42
Sentences
Atomic sentences: formed from a predicate symbol followed by
alist of
parenthesized
terms
Atomic sentence = predicate1 n
(term ,...,term
Example:) Brother(John, Richard)
x man(x) mortal(x)
man(Aristotle)
so we can conclude that: mortal(Aristotle)
–This involves matching man(x) against man(Aristotle)
and binding the variable x to Aristotle.
46
Unification
• Unification is an algorithm for determining the
substitutions needed to make two expressions match
– Unification is a "pattern matching" procedure that
takes two atomic sentences as input, and returns the
most general unifier, i.e., a shortest length substitution
list that makes the two literals match.
– E.g.: To make, say p(X, X) and p( Y, Z) match, subst(X/ Y) or
subst(X/ Z)
• Note: It is possible to substitute two variables with the
same value, but not the same variables with different values.
•Example
Sentence 1 Sentence 2 Unifier
group(x, cat(x), dog(Bill)) group(Bill, cat(Bill), y) {x/Bill, y/dog(Bill)}
group(x, cat(x), dog(Bill)) group(Bill, cat(y), z) {x/Bill, y/Bill, z/dog(Bill)}
group(x, cat(x), dog(Jane)) group(Bill, cat(y), dog(y)) Failure 47
Unification…
•A variable can never be replaced by a term containing that
variable. For example, x/f(x) is illegal.
•Unification and inference rules allows us to make inferences on a
set of logical assertions. To do this, the logical database must be
expressed in an appropriate form
• A substitution α unfies atomic sentences p and q if pα = qα
p q α
Knows(John,x) Knows(John,Jane) {x/Jane}
Knows(John,x) Knows(y, Abe) {y/John, x/Abe}
Knows(John,x) Knows(y,Mother(y)) {y/John, x/Mother(John)}
Knows(John,x) Knows(x,Abe) Fail
54
Knowledge based systems
(KBS)
1
Contents will be covered
Differentiate data, information and knowledge
Architecture of KBS
KBS in AI
2
Data, Information, and Knowledge
• What is Data and Information? Are they different from Knowledge
data!=information!=knowledge
• :DUnorganized and unprocessed facts;
static; a set of discrete facts about events
• Characteristics of Knowledge:
- It is voluminous in nature and requires proper structuring.
Have the ability to learn ideas so that they can obtain information from outs
use it appropriately.
- The value of the system lies in its ability to make the workings of the human mind
6
understandable and executable on a computer.
KBS Architecture
Learning
7
Artificial Intelligence and KBS
Knowledge based system is part of Artificial Intelligen
• KNWOLEDGE REPRSENATION(KR
• KNOWLEDGE ORGANIZATION
• KNOWLEDGE MANIPULATION
9
Intelligenc
e
10
Contents will be covered
Describe the concept of intelligence
11
Intelligence
• The ability of a system to o solve problems,
o calculate, o understand complex ideas,
o reason, o use natural language fluently,
o perceive relationships and analogies, o classify,
o learn from experience, o generalize, and
o store and retrieve information from o adapt new situations.
memory,
13
What is Intelligence Composed of?
16
Agent
• An agent is something that acts in an environment.
• An agent acts intelligently if:
o its actions are appropriate for its goals and circumstance
o it is flexible to changing environments and goals
o it learns from experience
o it makes appropriate choices given perceptual and
computational limitations
17
Agents acting in an environment
18
Examples of Agent
Organisations : Microsoft, Al Qaeda, Government of Canada, UBC, CS De
19
Inputs of an agent
• Abilities: the set of things it can do.
Prior Knowledge : what it comes into being knowing, what it doesn't get f
experience,...
21
Class work
• Agent
- Teacher
- Student
- Researcher
- Medical Doctor
22
Assignment II (due: 5 days)
cuss one of the following concepts. Refer at least five so
ks, articles). present in class and send via email.
Knowledge based system:
What is KBS? KBS vs. ES vs. AI; Knowledge acquisition, knowle
modeling and knowledge representation .
• Reasoning:
What is reasoning, Case based reasoning; probabilistic reasoning; f
easoning; rule-based reasoning
• Learning:
- What is Machine learning? Support Vector Machine(SVM), Hid
Markov Model(HMM), Bayesian Belief Network
23