0% found this document useful (0 votes)
13 views119 pages

Unit 3

The document discusses Knowledge Representation and Reasoning, focusing on Predicate Logic and its components such as syntax, semantics, and quantifiers. It explains the concepts of Forward and Backward Chaining, as well as the Resolution Principle and its algorithm for deriving conclusions from a set of clauses. Additionally, it introduces Prolog as a programming language for logic-based computation and outlines its features, facts, rules, and the process of unification.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views119 pages

Unit 3

The document discusses Knowledge Representation and Reasoning, focusing on Predicate Logic and its components such as syntax, semantics, and quantifiers. It explains the concepts of Forward and Backward Chaining, as well as the Resolution Principle and its algorithm for deriving conclusions from a set of clauses. Additionally, it introduces Prolog as a programming language for logic-based computation and outlines its features, facts, rules, and the process of unification.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 119

Knowledge Representation &

Reasoning

Predicate Logic
Predicate Logic/ First order
Predicate logic(FOPL)
⚫ Propositional logic : Assumes that the
world contains facts
⚫ First-order logic: Assumes that the world
contains
Objects
⚫ people, houses, numbers, theories, Donald
Duck, colors, centuries, …
Relations
⚫ red, round, prime, multistoried, ... brother
of, bigger than, part of, has color, occurred
after, owns, …
Functions
⚫ +, middle of, father of, one more than,
beginning of, ...
Syntax of FOPL
⚫ Syntax of FOPL like PL is determined by the
allowed symbols and rules of combinations.

❖ Constants: are fixed value terms that belongs to a


given domain of discourse. Ex: KingJohn, 2,
Koblenz, C,...
❖ Predicates: Predicate Symbols refer to a particular
relation among objects. Ex: Brother, >, =, ...
❖ Functions : Functions allow us to refer to objects
indirectly (via some relationship). Ex: Sqrt,
LeftLegOf , ...
❖ Variables: are terms that can assume different
values over a given domain. Ex: x, y, a, b, ...
❖ Connectives : ∧ ,∨, ¬ ,⇒ ,⇔
❖ Quantifiers : ∀(Universal quantifiers), ∃
(Existential Quantifiers)
Syntax of FOPL
Syntax of First-order Logic: Atomic
Sentences
⚫ Example : Brother ( KingJohn ,
RichardTheLionheart )
( Length(LeftLegOf(Richard)),
Length(LeftLegOf(KingJohn)) )

Syntax of First-order Logic: Complex


Sentences :
⚫ Built from atomic sentences using connectives
¬S, S1 ∧S2 ,S1 ∨S2, S1 ⇒ S2, S1 ⇔ S2 (as in
propositional logic)
Semantics of
FOPL(Quantifiers)
⚫ Universal quantifiers:Universal Quantification
allows us to make a statement about a
collection of objects:
∀(x) : Cat(x) ⇒ Mammal(x) : All cats are
mammals
∀(x) : Father(Bill,x) ⇒ Mother(Hillary,x) : All of
Bill’s kids are also Hillary’s kids.

⚫ Existential Quantifiers :Existential


Quantification allows us to state that an object
does exist (without naming it):
∃(x) : Cat(x) ∧ Mean(x) : There is a mean cat.
∃(x) : Father(Bill,x) ∧ Mother(Hillary,x) :
There is a kid whose father is Bill and whose
mother is Hillary.
Connection between ∀ and ∃
⚫ Both quantifiers are intimately connected
to each other, through negation.
⚫ Ex: Everyone dislikes garlic : ∀x ¬Likes(x,
Garlic)
⚫ There does not exist someone who likes
garlic :
¬ ∃y Likes(x, Garlic)
⚫ Both the sentences are similar in meaning,
therefore
∀x ¬Likes(x, Garlic) ≡ ¬ ∃y Likes(x, Garlic)
Conversion to FOPL
⚫ Bill is a student
⚫ Student(Bill)
⚫ All students are smart.
⚫ ∀ x ( Student(x) ⇒ Smart(x) )
⚫ There exists a smart student.
⚫ ∃ x ( Student(x) ∧ Smart(x) )
⚫ Every student loves some student.
⚫ ∀ x ( Student(x) ⇒ ∃ y ( Student(y) ∧
Loves(x,y) ))
⚫ Bill takes Analysis or Geometry (or
both)
⚫ Takes(Bill, Analysis) ∨ Takes(Bill, Geometry)
⚫ Bill takes Analysis and Geometry
⚫ Takes(Bill, Analysis) ∧ Takes(Bill, Geometry)
⚫ No student loves Bill.
⚫ ¬ ∃ x ( Student(x) ∧ Loves(x, Bill) )
⚫ Bill has at least one sister.
⚫ ∃ x SisterOf(x,Bill)
⚫ Every student takes at least one course.
⚫ ∀ x ( Student(x) ⇒ ∃ y ( Course(y) ∧
Takes(x,y) ))
⚫ Every student who takes Analysis also
takes Geometry.
⚫ ∀ x ( Student(x) ∧ Takes(x, Analysis) ⇒
Takes(x, Geometry) )
⚫PROLOG
Features of Prolog
⚫ Prolog is short of PROgramming in LOGic.
⚫ Prolog is a language that is useful for doing
symbolic and logic-based computation.
⚫ Its declarative and very different from
impretive style programming like JAVA,
C++, Pyhton etc.
⚫ A program is partly like a database but
much more powerful since we can also
have general rules to infer new facts.
⚫ A Prolog interpreter can follow these
facts/rules and answer queries by
sophisticated search.
Prolog Program
⚫ The Program
is a text file (*.pl) that contain the facts and
rules
The Query
mode is represented by the sign ? - at the
begining of the line
Loading a program
launch your Prolog compiler, for this report
we used the SWI-Prolog
⚫ The Facts
⚫ Simple facts
⚫ sunny.
⚫ Rainy
⚫ Facts with arguments
⚫ relation(<argument1>,<argument2>,....,<argument
N> ).
⚫ likes( john,mary).
⚫ Father(ram,luv).
⚫ How to query
⚫ eats(fred,oranges). /* 'Fred eats
oranges' */
⚫ eats(tony,apple). /* 'Tony eats apple'
*/
⚫ eats( john,apple). /* 'John eats
apple' */
⚫ ?- eats(fred,oranges).
⚫ /* does this match anything in the database?
*/
Variables and Unification
⚫ Variables are distinguished from atoms by
starting with a capital letter.
⚫ ?- eats(fred,What)
⚫ What=oranges
⚫ ?- eats(Who,oranges).
⚫ Who=fred
⚫ book(1,title1,author1).
⚫ book(2,title2,author1).
⚫ book(3,title3,author2).
⚫ book(4,title4,author3).

⚫ Now if we want to know if we have a
book from the author2 we can ask :
⚫ ?- book(_,_,author2).
⚫ yes
⚫ If we want to know which book from the
author1 we have :
⚫ ?- book(_,X,author1).
⚫ X=title1 ;
⚫ X=title2 ;
⚫ ?- book(X,_,_)
⚫ X=1;
⚫ X=2;
⚫ X=3;
⚫ X=4;
Rules
⚫ Consider the following sentence : 'All men are
mortal'
⚫ mortal(X) :- human(X).
⚫ human(socrate).
(Right hand side is a condition part and Left hand
side is a conlcusion part)
⚫ Now if we ask to prolog :
?- mortal(socrate).
⚫ Prolog will respond :
⚫ yes
Want to know “who is mortal” :
⚫ ?- mortal(X).
⚫ Then Prolog should respond :
⚫ X=socrate
Step to run Prolog
Program
⚫ Download and install SWI
prolog
⚫ Create a new file with
extension name .pl
⚫ create a database and end
the line with dot
⚫ compile the database
⚫ create a query and end the
UNIFICATION
Overview
Inference can be understood through the use
of lifted version of modus ponens, called
Generalized Modus Ponens. It raises
Modus Ponens from PL to FOPL and is stated
below.
If ‘a’ has property P and all objects which have property P
also have the property Q, then we may conclude that ‘a’ has
the property Q, expressed as:
P(a) Assertion
∀x P(x) → Q(x) Implication
Q(a) Conclusion
A substitution of a for x was necessary in the
concluding Q(a).
This was possible since the implication P(x)→
Q(x) true for all value of x, including x=a. Such
substitutions are an essential part of first
order inference.
Inference rules require finding substitutions
that make different logical expressions look
identical. This process is called Unification.
Example
The UNIFY algorithm takes the two sentences
and return a unifier for them, if one exists
UNIFY (P, Q) = θ
where SUBST (θ, P) = SUBST (θ, Q)

Suppose we have a query: Whom does Ravna


know i.e. Knows(Ravna, x) and there are four
sentences in the knowledge base:
Knows (Ravna, Sita)
Knows (y, Ram)
Knows(y, Mother(y))
Knows (x, Radha)
The following are the results by unifying the given sentences with the
Knows (Ravna, x)
UNIFY(Knows (Ravna, x), Knows (Ravna, Sita) =(x/Sita)
UNIFY(Knows (Ravna, x), Knows (y, Ram) =(x/Ram, y/Ravna)
UNIFY(Knows (Ravna, x), Knows (y, Mother(y)) =(y/Ravna, x/Mother(Ravna))
UNIFY(Knows (Ravna, x), Knows (x, Radha) = fail
Algorithm : Unify (P,Q)
1. If P and Q are both the variables or constants,
then;
1.1If P and Q are identical, then return NIL.
1.2 Else if P is a variable, then if P occurs in Q
then return (FAIL), else return (Q/P).
1.3 Else if Q is a variable then if Q occurs in P
then return (FAIL), else return (P/Q).
1.4 Else return (FAIL).
Algorithm : Unify (P,Q)
2. If the intial predicate symbols in P and Q are not
identical then return (FAIL).
3. If P and Q have a different number of arguments
then return (FAIL).
4. Set SUBST to NIL (at the end of this procedure,
the SUBST will contain all the substitutions used
to unify P and Q).
Algorithm : Unify (P,Q)
5. For i←1 to number of arguments in P:
5.1 Call Unify with ith argument of P and ith
argument of Q, putting results in S.
5.2 If S contains FAIL the return (FAIL).
5.3 If S is not equal to NIL then
5.3.1 Apply S to remainder of both P and Q.
5.3.2 SUBST: = APPEND(S, SUBST)
6. Return SUBST
Skolemization
Skolemization eliminates existential quantifiers by replacing each
existentially quantified variable with a Skolem constant or Skolem
function.

It is done as follows:
If the left most quantifier in an expression is an existential
quantifier, replaces all occurance of the variable it quantifies with
an arbitrary constant not appearing elsewhere in the expression
& delete the quantifier. The same procedure should be followed
for all other existential quantifier not preceeded by a universal
quantifier.

Ex:∃x Rich(x) becomes Rich(G1) where G1 is a new Skolem


constant
For each existential quantifier that is preceeded by
one or more universal quantifier, replace all
occurance of the existential quantifier variable by a
function symbol not appearing elsewhere in the
expression. The argument assigned to the function
should match all the variable appearing in each
universal quantifier, which proceeds the existential
quantifier.

Ex:
∃u ∀v ∀x ∃y : P(f(u), v, x, y) ⇒ Q(v, u, y)
∀v ∀x P(f(a), v, x, g(v, x)) ⇒ Q(v, u, g(v, x))
u ⇒ a , because it is preceded by ∃
y ⇒ g(v, x), because it is preceded by before ∀v ∀x
Knowledge Representation &
Reasoning

Forward and Backward


Chaining
Forward & Backward Chaining
⚫ Forward chaining/reasoning:
--works from the facts to a conclusion.
-- Sometimes called the data driven
approach.
--To chain forward, match data in working
memory against 'conditions' of rules in the
rule-base.
--When one of them fires, this is liable to
produce more data.
--So the cycle continues.
--A forward-chaining system tends to
produce a sequence which seems random
Forward chaining is the best
choice if

--All the facts are provided with the


problem statement;
or
--There are many possible goals, and a
smaller number of patterns of data; or:
-- There isn't any sensible way to guess
what the goal is at the beginning of the
consultation.
Forward chaining Illustration
--Goal state: Z Termination condition: stop if
Z is derived or no further rule can be
applied
Backward Chaining/Reasoning
--working from the conclusion to the facts.
--Sometimes called the goal-driven
approach.
--To chain backward, match a goal in
working memory against 'conclusions' of
rules in the rule-base.
--When one of them fires, this is liable to
produce more goals.
-- So the cycle continues.
--A backwards-chaining system tends to
produce a sequence of questions which
seems focused and logical to the user.
--Backward chaining is used in game
Backward chaining is the best
choice if

--The goal is given in the problem


statement, or can sensibly be guessed at the
beginning of the consultation;
or
--The system has been built so that it
sometimes asks for pieces of data (e.g.
"please now do the gram test on the
patient's blood, and tell me the result"),
rather than expecting all the facts to be
presented to it.
Backward chaining Illustration
Forward and Backward
Chaining

⚫ Backward Chaining (Top down


approach) : If you already know
what you are looking for .

⚫ Forward Chaining (Bottom up


Approach) : If you don't
necessarily know the final state of
your solution.
Forward
Vs
Backwar
d
Chaining
Resolution
Resolution Principle
Robinson in 1965 introduced the resolution
principle, which can be directly applied to any set
of clauses.

The principal is "Given any two clauses A and B,


if there is a literal P1 in A which has a
complementary literal P2 in B, delete P1 & P2
from A and B and construct a disjunction of the
remaining clauses. The clause so constructed is
called resolvent of A and B."
Resolution Algorithm
1. Convert all the statements of F to clause form
2. Negate P and convert the result to clause form. Add it to the set of clauses obtained in
step 1.
3. Repeat until either a contradiction is found or no progress can be made or a
predetermined amount of effort has been expended:
(a) Select two clauses. Call these the parent clauses.
(b) Resolve them together. The resulting clause, called the resolvent, will be the
disjunction of all of the literals of both the parent clauses with appropriate
substitutions performed and with the following exception:
◦ If there is one pair of literals T1 and T2 such that one of the parent clauses contains
T1 and the other contains T2 and if T1 and T2 are unifiable, then neither T1 nor T2
should appear in the resolvent. We call T1 and T2 complementary literals. Use the
substitution produced by the unification to create the resolvent. If there is one pair of
complementary literals, only one such pair should be omitted from the resolvent.
(c). If the resolvent is the empty clause, then a contradiction has been found. If it is not
then add it to the set of clauses available to the procedure.
1. Marcus was a man
2. Marcus was a Pompeian
3. All Pompeians were Romans
4. Caesar was a ruler.
5. All Romans were either loyal to Caesar or hated him.
6. Everyone is loyal to someone.
7. Men only try to assassinate rulers they are not loyal
to.
8. Marcus tried to assassinate Caesar
9. Find out :- Does Marcus hate Caesar ?
1. Man(Marcus)
2. Pompeian(Marcus)
3. ∀ x Pompeian(x) ⇒ Roman(x)
4. Ruler(Caesar)
5. ∀x Romans(x) ⇒ Loyalto(x,Caesar) ∨
Hate(x,Caesar)
6. ∀ x ∃ y Loyalto(x,y)
7. ∀ x ∀ y Men(x) ∧ Ruler(y) ∧ Tryassassinate(x,y)
⇒ ¬ Loyalto(x,y)
8. Tryassassinate(Marcus,Caesar)
9. hate(Marcus,Caesar)
Axioms in clause form are:
1. man(marcus)
2. Pompian(marcus)
3. ¬ Pompeian(x1) ∨ Roman(x1)
Removing implication and universal quantifier by replacing it with a variable x1
4. ruler(caesar)
5. (¬roman(x2)∨ loyal(x2,caesar)∨ hate(x2,caesar))
Removing implication and universal quantifier by replacing it with a variable x2
6. (loyal(x3,f(x3))
Removing universal quantifier by replacing it with a variable x3 and existential
quantifier by F(x3) since existential quantifier was inside universal, that’s why a
function.
7. (¬man(x4) ∨ ¬ruler(y1) ∨ ¬tryassasin(x4,y1) ∨ ¬loyalto(x4, y1))
Removing universal quantifier for x and y by replacing it with x4 and y1
respectively.
8. try assasinate(marcus,caesar)
9. Question: hate(Marcus, Casear)
By applying Resolution Theorem :
lets take the negation as : ¬hate(Marcus,
Caesar)
Knowledge Representation

Knowledge Based
Systems
Definition and Importance of
Knowledge
⚫ Knowledge can be defined as the body of facts
and principles accumulated by Human kind.

⚫ The meaning of knowledge is closely related to


the meaning of intelligence. Intelligence
requires possession of an access to knowledge.

⚫ E.g.: In biological organisms, knowledge is


stored as complex structures or interconnected
neurons.

⚫ E.g.: In computers, knowledge is also stored as


symbolic structures, but in form of collection
of magnetic spots and voltage states.
Knowledge Vs Data
⚫ Knowledge should not be confused with
data. Let’s take an example to differentiate
both:-
⚫ A physician treating a patient uses both
knowledge and data.
⚫ The data is patient’s record, including patient
history, measurements of vital signs, drugs
given, response to drugs and so on.
⚫ The knowledge is what the physician learned
in medical school and in years of internship,
specialization and practice.

⚫ Thus we can say that knowledge requires


Types of Knowledge
⚫ Procedural Knowledge: Procedural
knowledge is compiled knowledge related
to the performance of some tasks. Ex-steps
used to solve some algebraic equation.
⚫ Declarative Knowledge: It is passive
knowledge expressed as statements of facts
about the world. Ex. Personal data in a
database is example of declarative
knowledge.
⚫ Heuristic knowledge: It is an special type
of knowledge used by humans to solve a
complex problem. Heuristics are the
knowledge used to make good judgments.
Knowledge Based Agents
⚫ Knowledge-Based agents combine general
knowledge with current percepts to infer
hidden aspects of current state prior to
selecting actions.
⚫ The agent operates as follows:
⚫ 1. It TELLs the knowledge base what it
perceives.
⚫ 2. It ASKs the knowledge base what action it
should perform.
⚫ 3. It performs the chosen action.
Components of Knowledge Based
System
⚫ The knowledge is stored in a knowledge base
separate from control and inferencing
components.
⚫ This makes it possible to add new knowledge
or refine exiting knowledge without
recompiling the control and inferencing
programs.
Properties of Knowledge Representation
Strategies

⚫ Representational Adequacy -- the ability to


represent the required knowledge.
⚫ Inferential Adequacy - the ability to
manipulate the knowledge represented to
produce new knowledge corresponding to that
inferred from the original.
⚫ Inferential Efficiency -- the ability to direct
the inferential mechanisms into the most
productive directions by storing appropriate
guides.
⚫ Acquisitional Efficiency- the ability to acquire
new knowledge using automatic methods
wherever possible rather than reliance on
human intervention.
Approaches to Knowledge
Representation

There are FOUR approaches to


KR:
⚫ Simple relational knowledge
⚫ Inheritable knowledge
⚫ Inferential Knowledge
⚫ Procedural Knowledge
Simple relational knowledge
⚫ The simplest way of storing facts is to use
a relational method where each fact about
a set of objects is set out systematically in
columns.
⚫ This representation gives little
opportunity for inference, but it can be
used as the knowledge basis for inference
engines.
Inheritable knowledge
⚫ Relational knowledge is
made up of objects
consisting of attributes
corresponding
associated values.
Knowledge base is
extended more by
allowing inference
mechanisms:-
⚫ Property inheritance
⚫ Here elements inherit
values from being
members of a class and
data must be organized
into a hierarchy of classes.
Slot and filler
structure
Inferential Knowledge
⚫ Represent knowledge as formal logic and
can be used to derive more facts. Ex:
All dogs have tails
V(X) : dog(x) 🡪 hasatail(x)

⚫ Advantages:
⚫ A set of strict rules.
⚫ Can be used to derive more facts.
⚫ Truths of new statements can be verified.
⚫ Guaranteed correctness.
⚫ Popular in AI systems. e.g Automated
theorem proving
Procedural Knowledge
⚫ Here the Knowledge is encoded in some
procedures. It consists of small programs
that know how to do specific things, how to
proceed.
Representation of Knowledge
⚫ Propositional Logic
⚫ FOPL(First Order Predicate
knowledge)
⚫ Frames & Associative Networks
⚫ Scripts
⚫ Case grammar theory
⚫ Production Rules
⚫ Inference System
⚫ Forward & backward declaration
ONTOLOGY ENGINEERING
Deciding and constructing Pizza
Terminology to avoid Inconsistency
Customer
Which
Restaurant Menu
Vegetarian Pizza
is Least Spicy?

A shared
ONTOLOGY
of
Pizza Mexican Vegetarian Pizza

American Vegetarian Pizza Recipe


What is “Ontology Engineering”?
Ontology Engineering:
• Ontology engineering is a set of tasks related to the
development of ontologies for a particular domain.

• Defining terms in the domain and relations among them


• Defining concepts in the domain (classes)
• Arranging the concepts in a hierarchy (subclass-superclass
hierarchy)
• Defining which attributes and properties (slots) classes can have
and constraints on their values
• Defining individuals and filling in property values

• Ontology Engineering analogous to OO Database Design?


Ontology Engineering versus
Object-Oriented Modeling
An ontology An OO class structure
• reflects the structure of the world • reflects the structure of the data
• is often about structure of and code
concepts • is usually about behavior
• Formal ontological classes are (methods)
sets which can be defined in • Object-oriented classes are
terms of other classes, attributes templates for constructing objects.
and associations
• Property is a general term for
attributes and associations. • Attributes and associations have
• Open World Assumption different meanings.
means that lack of knowledge of a • Closed World Assumption.
fact does not immediately imply
knowledge of the negation of a
fact.
Logic: Open versus Closed
• Open (monotonic) logic gives different answers to
queries than a closed logic.

has Base
Pizza Pizza Base

● Fact:Suppose that Americana is the only Pizza


● Closed world: violates constraint
● Open world: Americana Pizza exists but its base is
not known.
Logic: Open versus Closed
• Open (monotonic) logic gives different answers to
queries than a closed logic.

has Base
Pizza Pizza Base

Fact: ItalianPizza has bases CrispBase and HardBase


Closed world: violates constraint
Open world: CrispBase and HardBase are same!.
Axioms for OWL Ontology
• An OWL ontology is a set of axioms
• Class Axioms: C ⊑ D, C ≡ D
• Role Axioms: R ⊑ S, Func(R), Trans(S)
• Individual Axioms: a:C, <a,b>:R

Animal CanSwi
m
■ Ontology example
⊓ ¬hasVerte
❑ Fish⊑ Animal ⊓ CanSwim bra
❑ Jellyfish⊑ Fish⊓ ¬hasVertebra Fish

❑ Pomfret⊑ Fish
Pomfret ⊓
❑ Moonjelly:Jellyfish
Jellyfish

Moonje
lly
Ontology Engineering Process
An iterative process:
determine consider enumerate consider define enumerate define
scope reuse terms reuse classes terms classes

define define define define create define create


properties classes properties constraints instances classes instances

consider define define create


reuse properties constraints instances
Research Issues in Ontology
Engineering
■ Content Acquisition
■ Analysis and evaluation
■ Maintenance
■ Ontology Merging
Conclusion
• There is no single correct ontology for any domain.
• Ontology design is a creative process and no two
ontologies designed by different people would be the
same.
• The potential applications of the ontology and the
designer’s understanding and view of the domain will
undoubtedly affect ontology design choices.
• We can assess the quality of our ontology only by using it
in applications for which we designed it.
Categories and
Objects
Overview
> Ontology refers to organizing every thing in the
world into hierarchy of categories.

> The organization of objects into categories is a


vital part of knowledge representation.

> Although interaction with the world takes place at


the level of individual objects, much reasoning
takes place at the level of categories.
Subclass relations organize categories into a
taxonomy, or taxonomic hierarchy. Taxonomies
have been used explicitly for centuries in technical
fields. For example, systematic biology aims to
provide a taxonomy of all living and extinct species.
Taxonomies are also an important aspect of general
commonsense knowledge. First-order logic makes
it easy to state facts about categories, either by
relating objects to categories or by quantifying over
their members.
Example
A shopper would normally have the goal of
buying a basketball, rather than a particular
basketball such as BB9. There are two choices
for representing categories in first-order
logic: predicates and objects. That is, we can
use the predicate Basketball (b), or we can
reify1 the category as an object, Basketballs.
Example contd..
BB9 ∈ Basketballs
A category is a subclass of another category. Basketballs ⊂ Balls
All members of a category have some properties.

(x∈ Basketballs) ⇒ Spherical (x)


Members of a category can be recognized by some properties. Orange(x) 𝖠
Round (x) 𝖠 Diameter(x)=9.5 𝖠 x∈ Balls ⇒ x∈ Basketballs
A category as a whole has some properties.

Dogs ∈ Domesticated Species


Notice that because Dogs is a category and is a member of Domesticated
Species
Example contd..
Categories are used to classify objects
according to common properties or
definitions
∀ x ∈ Tomates ⇒ Red(x) ∧ Round(x)
Categories can be represented by
Predicates: Tomato(x)
Sets: The constant Tomatoes represents set
of tomatoes (reification)
Roles of category representation.
> Instance relations (is-a): x1 ∈ Tomatoes

> Taxonomical hierarchies (Subset)


Tomatoes ⊂ Fruit

> Inheritance of properties.

> (Exhaustive) decompositions.


Physical Composition
We use the general PartOf relation to say that one
thing is part of another. Objects can be grouped
into part of hierarchies, reminiscent of the Subset
hierarchy:
PartOf (Bucharest, Romania)
PartOf (Romania, EasternEurope)
PartOf(EasternEurope, Europe)
PartOf (Europe, Earth)
The PartOf relation is transitive and reflexive;
that is, PartOf (x, y) 𝖠PartOf (y, z) ⇒PartOf (x,
z)
Measurements
In both scientific and commonsense theories of the world, objects
have height, mass, cost, and so on. The values that we assign for
these properties are called measures.
Length(L1)=Inches(1.5)=Centimeters(3.81)
Conversion between units is done by equating multiples of one unit
to another:
Centimeters(2.54 ×d)=Inches(d)
Similar axioms can be written for pounds and kilograms, seconds
and days, and dollars and cents. Measures can be used to describe
objects as follows:
Diameter (Basketball12)=Inches(9.5)
ListPrice(Basketball12)=$(19)
d∈ Days ⇒ Duration(d)=Hours(24)
Mental events and mental
objects
Overview
EVENTS
Event calculus reifies fluents and events. The fluent
At(Shankar, Berkeley) is an object that refers to the fact of
Shankar being in Berkeley, but does not by itself say anything
about whether it is true. To assert that a fluent is actually true
at some point in time we use the predicate T, as in
T(At(Shankar, Berkeley), t).

Events are described as instances of event categories. The


event E1 of Shankar flying from San Francisco to Washington,
D.C. is described as E1 ∈Flyings𝖠 Flyer (E1, Shankar ) 𝖠
Origin(E1, SF) 𝖠 Destination (E1,DC)
Overview contd..
Mental Events
Mental events refer to the various processes, activities, and
occurrences that take place within an individual's mind. These
events encompass a wide range of cognitive activities,
thoughts, feelings, and perceptions that occur in one's
conscious or unconscious awareness.
Examples of mental events include thinking, remembering,
perceiving, imagining, experiencing emotions, making
decisions, and problem-solving.
Mental events are typically considered subjective experiences
that occur within the realm of one's consciousness.
Overview contd..
Mental Objects
Mental objects, on the other hand, refer to the content or objects of
thought within the mind. These are the things, concepts, ideas, or
representations that the mind is directed toward during mental
events.
Mental objects can be concrete or abstract and may include sensory
perceptions of the external world, such as the mental image of an
apple, as well as abstract concepts like justice, love, or mathematical
equations.
In philosophical discussions, mental objects are often examined in
the context of how the mind represents or perceives the external
world and the relationship between mental representations and
reality.
Overview contd..
Need to represent beliefs in self and other agents,
e.g. for controlling reasoning, or for planning
actions that involve others

How are beliefs represented?


 Beliefs are reified as mental objects
 Mental objects are represented as strings in a language
 Inference rules for this language can be defined
Rules for reasoning about logical agents use their
beliefs
∀a, p, q LogicalAgent (a) ∧ Believes (a,p) ∧
Believes(a, "p ⇒ q") ⇒ Believes (a,q)

∀a, p LogicalAgent (a) ∧ Believes (a,p) ⇒


Believes(a, "Believes (Name(a),q)")
Example
learn p. The robot learns the fact p. An obvious
consequence is
holds(know p, result(learn p,s))
provided the effects are definite enough to justify
the result formalism. More likely we'll want something
like
occurs(learn p,s) ⊃ Holds(F, know p, s)
where occurs(event, s) is a point fluent asserting
that event occurs (instantaneously) in situations. F p is
the proposition that the proposition p will be true at
some time in the future.
Example contd..
Suppose we try to assert that Lois knows that
Superman can fly: Knows (Lois,
CanFly(Superman)) One minor issue with this is
that we normally think of CanFly(Superman) as a
sentence, but here it appears as a term. That issue
can be patched up just be reifying
CanFly(Superman); making it a fluent. A more
serious problem isthat, if it is true that Superman is
Clark Kent, then we must conclude that Lois knows
that Clark can fly: (Superman = Clark)
𝖠Knows(Lois, CanFly(Superman)) |=
Knows(Lois, CanFly (Clark))
Reasoning systems for
Categories
Overview of Reasoning Systems
⚫ Reasoning plays a great role in the process of
artificial Intelligence. Thus Reasoning can be
defined as the logical process of drawing
conclusions, making predictions or
constructing approaches towards a particular
thought with the help of existing knowledge.

⚫ "Reasoning is a way to infer facts from


existing data." It is a general process of
thinking rationally, to find valid conclusions.

⚫ In artificial intelligence, the reasoning is


essential so that the machine can also think
rationally as a human brain, and can
Types of Reasoning
In artificial intelligence, reasoning
can be divided into the following
categories:
• Deductive reasoning
• Inductive reasoning
• Abductive reasoning
• Common Sense Reasoning
• Monotonic Reasoning
• Non-monotonic Reasoning
Deductive reasoning
⚫ Deductive reasoning is deducing
new information from logically
related known information. It is
the form of valid reasoning, which
means the argument's conclusion
must be true when the premises
are true.
⚫ Deductive reasoning is a type of
propositional logic in AI, and it
requires various rules and facts. It
is sometimes referred to as
top-down reasoning, and
Deductive reasoning
Example:
Premise-1: All the human
eats veggies
Premise-2: Suresh is
human.
Conclusion: Suresh eats
veggies.
Inductive Reasoning
⚫ Inductive reasoning is a form of
reasoning to arrive at a conclusion
using limited sets of facts by the
process of generalization. It starts
with the series of specific facts or
data and reaches to a general
statement or conclusion.
⚫ Inductive reasoning is a type of
propositional logic, which is also
known as causeeffect reasoning or
bottom-up reasoning
Inductive Reasoning
Example:
Premise: All of the pigeons we
have seen in the
zoo are white.
Conclusion:Therefore, we can
expect all the
pigeons to be white.
Abductive reasoning
⚫ Abductive reasoning is a form of logical
reasoning which starts with single or multiple
observations then seeks to find the most likely
explanation or conclusion for the observation.
⚫ Abductive reasoning is an extension of
deductive reasoning, but in abductive
reasoning, the premises do not guarantee the
conclusion.
⚫ Example:
Implication: Cricket ground is wet if it is
raining
Axiom: Cricket ground is wet.
Common Sense Reasoning
⚫ Common sense reasoning is an informal form
of reasoning, which can be gained through
experiences.
⚫ Common Sense reasoning simulates the
human ability to make presumptions about
events which occurs on every day.
⚫ It relies on good judgment rather than exact
logic and operates on heuristic knowledge and
heuristic rules.
⚫ Example:
• One person can be at one place at a time.
• If I put my hand in a fire, then it will burn.
The above two statements are the examples of
Monotonic Reasoning
⚫ In monotonic reasoning, once the
conclusion is taken, then it will remain the
same even if we add some other
information to existing information in our
knowledge base. In monotonic reasoning,
adding knowledge does not decrease the
set of prepositions that can be derived.
⚫ To solve monotonic problems, we can
derive the valid conclusion from the
available facts only, and it will not be
affected by new facts.
⚫ Monotonic reasoning is not useful for the
real-time systems, as in real time, facts get
Monotonic Reasoning
⚫ Monotonic reasoning is used in
conventional reasoning systems, and a
logic-based system is monotonic.
⚫ Any theorem proving is an example of
monotonic reasoning.
⚫ Example
• Earth revolves around the Sun.
• It is a true fact, and it cannot be changed
even if we add another sentence in
knowledge base like, "The moon revolves
around the earth" Or "Earth is not round,"
etc.
Monotonic Reasoning
Advantages of Monotonic Reasoning:
• In monotonic reasoning, each old proof
will always remain valid.
• If we deduce some facts from available
facts, then it will remain valid for always.
Disadvantages of Monotonic Reasoning:
• We cannot represent the real world
scenarios using Monotonic reasoning.
• Hypothesis knowledge cannot be
expressed with monotonic reasoning, which
means facts should be true.
• Since we can only derive conclusions from
Non-monotonic Reasoning
⚫ In Non-monotonic reasoning, some
conclusions may be invalidated if we
add some more information to our
knowledge base.
⚫ Logic will be said as non-monotonic
if some conclusions can be
invalidated by adding more
knowledge into our knowledge base.
⚫ Non-monotonic reasoning deals
with incomplete and uncertain
models.
Non-monotonic Reasoning
Example: Let suppose the knowledge
base contains the following
knowledge:
• Birds can fly
• Penguins cannot fly
• Pitty is a bird
• So from the above sentences, we
can conclude that Pitty can fly.
• However, if we add one another
sentence into knowledge base "Pitty
is a penguin", which concludes "Pitty
Non-monotonic Reasoning
Advantages of Non-monotonic
reasoning:
• For real-world systems such as
Robot navigation, we can use
non-monotonic reasoning.
• In Non-monotonic reasoning, we
can choose probabilistic facts or can
make assumptions.
Disadvantages of Non-monotonic
Reasoning:
• In non-monotonic reasoning, the
categories
How to organise and reason with
categories?
1. Semantic networks are systems
specially designed for organizing and
reasoning with categories.
They provide:
⚫ graphical aid for visualizing a knowledge base
⚫ efficient algorithms for inferring properties
of an object on the basis of its category
membership.
They are an evolution of existential
graphs (Charles Peirce, 1909)
Reasoning systems for categories
contd..

2. Another closely related family


of systems are description
logics, which provide:
⚫a formal language for
constructing and combining
category definitions
⚫ efficient algorithms for
deciding subset and superset
relationships between
Semantic
networks
⚫ Logic, as representation language,
has practical difficulties.
⚫ More intuitive and easy to use
representation schemes are
necessary.
⚫ According to cognitive psychology,
knowledge representation and
retrieval is based on its relations and
this is formalized, for example,
through semantic networks.
⚫ They allow to represent the elements
of a domain in a declarative way.
⚫ A semantic network is a graph in
which:
Semantic Networks
Example
Description
logics
⚫ Are designed to describe defintions and
properties about categories
A formalization of semantic networks
⚫ Principal inference task is
Subsumption: checking if one category is the
subset of another by comparing their
definitions
Classification: checking whether an object
belongs to a category.
Consistency: whether the category
membership criteria are logically
satisfiable.
Description logics
(DL)
Frames
⚫ Frames are a version of semantic
networks proposed by Marvin
Minsky in 1975.
⚫ A frame is a representation of an
object or concept, with
descriptors (slots) and relations
to other objects or concepts.
⚫ Relations and slots have a
structure, too, which helps to
describe their semantics.
Frames:
example
⚫ frame Person
super-classes: Class
names:
ages:
dates-of-birth:
genders:
readings:
sexual-preferences:
TV-preferences:
Slots
⚫ Slots describe the characteristics
of frames.
⚫ Their facets (e.g., domain, range,
cardinality, default value) allow
to define their semantics.
⚫ They are where the demons are
defined.
⚫ Demons can be of the following
types:
– if-needed (They activate when the
slot is read.)
– if-added (They activate when a
value is added to the slot.)
example
⚫ Slot age
spanish-name: edad
value: 28
domain: class Person
range: integer [0..140]
max-cardinality: 1
min-cardinality: 0
default-value:
function-to-calculate-value:
Reasoning with Default
Information

In AI, the default logic is a reasoning method


that allows for the drawing of conclusions from
a set of given premises that are incomplete or
uncertain. It is based on the principle of
assuming the truth of something unless there is
evidence to the contrary.
Default
Reasoning

When giving information, we don’t want to


enumerate all of the exceptions, even if we could
think of them all.
In default reasoning, we specify general knowledge
and modularly add exceptions. The general
knowledge is used
Classical logic for
If gcases
is monotonic we don’t
logically know
follows fromare
exceptional.
A, it also follows: from any superset of
A.
Default reasoning isnonmonotonic
When we add that
something is exceptional,
: we can’t conclude
what we could before.
Defaults as
Assumptions

Default reasoning can be modeled using


H is normality assumptions
F states what follows from the
assumptions
An explanation of g gives an for g .
argumen
t
Default
Example
A reader of newsgroups may have a default:
“Articles about AI are generally interesting”.

H = {int ai },

where int ai means X is interesting if it is about AI. With


facts:
interesting ← about ai ∧ int ai.
about ai.

{int ai } is an explanation for interesting .


Default Example,
Continued
We can have exceptions to defaults:

false ← interesting ∧ uninteresting.

Suppose an article is about AI but is uninteresting:


interesting ← about ai ∧ int
ai. about ai.
uninteresting.

We cannot explain interesting even though


everything we know about the previous we also
know about this case.
Exceptions to
defaults
implication
interesting
default
int_ai class
uninteresting membership
about_ai

article_23 article_53
Exceptions to
Defaults
“Articles about formal logic are about AI.”
“Articles about formal logic are
uninteresting.” “Articles about machine
learning are about AI.”
about ai ← about fl .
uninteresting ← about fl .
about ai ← about ml.
interesting ← about ai ∧ int
ai.
false ← interesting ∧
uninteresting. false ← intro
question ∧ interesting.
Exceptions to
Defaults
implication
interesting
default
int_ai class
membership
about_ai
intro_question

about_fl
about_ml
article_23

article_77 article_99
article_34
Formal logic is uninteresting by
default
implication
interesting
default
unint_fl
int_ai class
membership
about_ai
intro_question

about_fl
about_ml
article_23

article_77 article_99
article_34
Contradictory
Explanations
Suppose formal logic articles aren’t interesting by
default:

H. = {unint fl , int ai }

The corresponding facts are:


interesting ← about ai ∧ int
ai. about ai ← about fl .
uninteresting ← about fl ∧
unint fl . false ← interesting ∧
uninteresting. about fl .

Does uninteresting have an


explanation? Does interesting have
an explanation?
Overriding
Assumptions

For an article about formal logic, the argument “it is


interesting because it is about AI” shouldn’t be
applicable.
This is an instance of preference more
for defaults. specific
Arguments that articles about formal logic are
interesting because they are about AI can be
defeated by adding:
This false ← about
is known fl ∧ int ai.
as cancellation
a rule.
We can no longer explain
interesting .
Diagram of the Default
Example
implication
interesting
default
unint_fl int_ai class
membership
about_ai
intro_question

about_fl
about_ml
article_23

article_77 article_99
article_34

You might also like