Module 4.1: Knowledge and Reasoning
Module 4.1: Knowledge and Reasoning
Module: 4.1
Knowledge and Reasoning
Motivation:
Motivation of this module is to provide the students with the knowledge:
● What is knowledge base?
● How logical agents represent knowledge base?
● What is knowledge representation language?
● What is logic & knowledge about propositional logic?
Syllabus:
Learning Objective:
Learner should know about the representation of knowledge and the reasoning processes
that bring knowledge to life and are central to the entire field of artificial intelligence. This
provides an overview of all the fundamental concepts of logical representation and
reasoning. After studying this chapter, students should know about:
1. What are knowledge base agents & what is wumpus world?
2. How Logic & Propositional Logic help in knowledge reasoning?
Theoretical Background:
Predicate logic is the generic term for symbolic formal systems like first-order logic,
second-order logic, many-sorted logic or infinitary logic. This formal system is
distinguished from other systems in that its formulae contain variables which can be
quantified. Two common quantifiers are the existential ∃ ("there exists") and universal ∀
("for all") quantifiers. The variables could be elements in the universe under discussion, or
perhaps relations or functions over that universe. For instance, an existential quantifier over
a function symbol would be interpreted as modifier "there is a function".
Frames were proposed by Marvin Minsky in his 1974 article "A Framework for
Representing Knowledge." A frame is an artificial intelligence data structure used to divide
knowledge into substructures by representing "stereotyped situations." Frames are
connected together to form a complete idea.
The term data refers to qualitative or quantitative attributes of a variable or set of variables.
Data (plural of "datum") are typically the results of measurements and can be the basis of
graphs, images, or observations of a set of variables
from the declarative knowledge one possesses about problem solving. In some legal
systems, such procedural knowledge has been considered the intellectual property of a
company, and can be transferred when that company is purchased.
Declarative knowledge is factual knowledge. For example knowing that "A cathode ray
tube is used to project a picture in most televisions" is declarative knowledge. Propositional
knowledge or declarative knowledge is knowledge or the possession of information that is
either true or false. Declarative knowledge is assertion-oriented. It describes objects and
events by specifying the properties which characterize them; it does not pay attention to the
actions needed to obtain a result, but only on its properties.
Key Definitions:
Knowledge based agent: Agent that reasons logically.
Semantics: determines the facts in the world to which the sentences refer.
Course Content:
Lecture : 1
Knowledge Based Agent
The central component of a knowledge based agent is its knowledge base. Informally, a
knowledge base is a set of representations of facts about the world. Each individual
representation is called a sentence. The sentences are expressed in a language called a
knowledge representation language. There must be a way to add new sentences to the
knowledge base, and a way to query what is known. Determining what follows from what
the KB has been the job of the inference mechanism, the other main component of a
knowledge-based agent.
The details of the representation language are hidden inside two functions that implement
the interface between the agent program "shell" and the core representation and reasoning
system. MAKE-PERCEPT-SENTENCE takes a percept and a time and returns a sentence
representing the fact that the agent perceived the percept at the given time, and
MAKE-ACTION-QUERY takes a time as input and returns a sentence that is suitable for
asking what action should be performed at that time. The details of the inference
mechanism are hidden inside TELL and ASK.
Knowledge Representation (KR) has long been considered one of the principal elements of
Artificial Intelligence, and a critical part of all problem solving. The subfields of KR range
from the purely philosophical aspects of epistemology to the more practical problems of
handling huge amounts of data. This diversity is unified by the central problem of
encoding human knowledge - in all its various forms - in such a way that the knowledge
can be used. This goal is perhaps best summarized in the Knowledge Representation
Hypothesis:
Any mechanically embodied intelligent process will be comprised of structural ingredients
that a) we as external observers naturally take to represent a propositional account of the
knowledge that the overall process exhibits, and b) independent of such external
semantically attribution, play a formal but causal and essential role in engendering the
behavior that manifests that knowledge. A successful representation of some knowledge
must, then, be in a form that is understandable by humans, and must cause the system
Module 4.1: Knowledge and Reasoning
5
using the knowledge to behave as if it knows it. The "structural ingredients" that
accomplish these goals are typically found in the languages for KR, both implemented and
theoretical, that have been developed over the years.
Exercise
1. The work in AI is that intelligent behavior can be achieved through the manipulation of symbol structures
representing bits of _____________
a. Fact
b. Knowledge
c. Logic
d. Rules
Learning from this lecture: Learners will be able to understand knowledge base agents along
with knowledge base representation techniques.
Lecture : 2
First order logic
Propositional logic assumes the world contains facts, Whereas First-order logic (like natural
language) assumes the world contains:
Objects: people, houses, numbers, colors, baseball games, wars, …
Relations: brother of, bigger than, inside, part of, has color, occurred after, owns…
Properties: red, round, bogus, prime, multistoried...
Functions: father of, best friend, one more than, plus, …
Example:
• "One plus two equals three"
Objects: one, two, three, one plus two
Relation: equals
Function: plus. (One plus two is a name for the object that is obtained by applying the
function plus to the objects one and two. Three is another name for this object.)
• "Squares neighboring the wumpus are smelly."
Objects: wumpus, square
Property: smelly
Relation: neighboring.
• "Evil King John ruled England in 1200."
Objects: John, England, 1200
Relation: ruled
Properties: evil, king.
Predicate logic is the generic term for symbolic formal systems like first-order logic,
second-order logic, many-sorted logic or infinitely logic. This formal system is
distinguished from other systems in that its formulae contain variables which can be
quantified. Two common quantifiers are the existential ∃ ("there exists") and universal ∀
("for all") quantifiers. The variables could be elements in the universe under discussion, or
perhaps relations or functions over that universe. For instance, an existential quantifier over
a function symbol would be interpreted as modifier "there is a function".
UNIVERSAL QUANTIFICATION
∀<variables> <sentence>
Everyone at NUS is smart:
∀x At(x,NUS) ⇒ Smart(x)
∀x P is true in a model m iff P is true with x being each possible object in the model
Roughly speaking, equivalent to the conjunction of instantiations of P
Example:
At(KingJohn,NUS)⇒ Smart(KingJohn) ∧ At(Richard,NUS)⇒ Smart(Richard) ∧
At(NUS,NUS)⇒ Smart(NUS) ∧…
Example: “All elephants are gray”
(∀x )(elephant(x) ⇒color(x, GRAY))
EXISTENTIAL QUANTIFICATION
∃<variables> <sentence>
Someone at NUS is smart:
∃x At(x,NUS) ∧ Smart(x)
∃x P is true in a model m iff P is true with x being some possible object in the model
Roughly speaking, equivalent to the disjunction of instantiations of P
Example:
At(KingJohn,NUS) ∧ Smart(KingJohn) ∨ At(Richard,NUS) ∧ Smart(Richard) ∨
At(NUS,NUS) ∧ Smart(NUS) ∨ ...
Example: “Someone wrote Computer Chess”
(∃x write(x, COMPUTER-CHESS))
A Few Assumptions : All doors are closed at the initial state. Doors must be opened prior to entering a
room (obviously) and they must be closed as Shakey just after it enters the room or leaves the room.
Your programs will show lots of "open door" and "close door" actions.
Shakey has poor eyesight. Specifically, he has to turn on the light just after entering a room. As Shakey
plans to leave a room, after opening the door, Shakey must turn off the light.
Shakey only has one robotic arm that can only do one thing at a time. He can open a door, turn on a light,
pickup or drop a box.
You do not have to keep track of what direction Shakey is facing. The important part of this project is the
"action plan".
2. A ____________ almost by definition has a well defined syntax and semantics and is concerned with truth
preserving inference.
a. Fact
b. Knowledge
c. logic
d. Rules
3. Truths about the real world and what we represent
a. Facts
b. Knowledge
c. Logic
d. Rules
4. It is the ability to acquire new knowledge using automatic methods wherever possible rather than on
human intervention.
a. Representational adequacy
b. Inferential adequacy
c. Inferential efficiency
d. Acquisitional efficiency
5. The basis of these perspective is the knowledge representation hypothesis by:
a. Biran c. Smith
b. John McCarthy
c. Herbert
d. None
6. __________________ Logic is simple language that is useful for showing key ideas and definitions.
a. Knowledge
b. Rules
c. Propositional
d. All of the above.
7. The legitimate expressions of the predicate calculus are called as__________________
a. Well formed formulas
b. Predicate logic
c. Logic
d. None.
8. It is used to represent a relation in a domain.
a. Predicate symbols
b. Constant symbols
c. Variable symbols
d. Function symbols
9. Denoted by Ǝ is known as ____________________________
a. Universal Quantifiers
b. Existential Quantifiers
c. Both
d. None.
10. A left hand built by connecting two formulas with _________is called as implication.
a. Ʃ
b. Ʊ
c. →
d. All of the above.
Module 4.1: Knowledge and Reasoning
9
Learning from this lecture: Learners will be able to understand prepositional Logic and First order
logic.
Conclusion
This chapter was introduction to knowledge base agents, Prepositional and Predicate logic required
for reasoning.
i. (C√ ⌐D)→(D→C)
ii. (P↔Q)√R
i. ⌐ (P→Q) →R
ii. (P↔Q)ˆR
Q3. Briefly describe the following knowledge representation schemes along with their merits and demerits.
Q5. What is the difference between knowledge, belief, hypotheses and data?
Q. 11. Use truth tables to show the following sentences are valid, and thus that the equivalences hold:
P ^ (Q ^ R) <=> (P ^ Q) ^ R Associativity of conjunction
P \/ (Q \/ R) <=> (P \/ Q) \/ R Associativity of disjunction
P ^ Q <=> Q ^ P Commutativity of conjunction
P \/ Q <=> Q \/ P Commutativity of disjunction
P ^ (Q \/ R) <=> (P ^ Q) \/ ( P ^ R) Distributivity of ^ over \/
P \/ (Q ^ R) <=> (P \/ Q) ^ ( P \/ R) Distributivity of \/ over ^
~(P ^ Q) <=> ~Q \/ ~P de Morgan’s Law
~(P \/ Q) <=> ~Q ^ ~P de Morgan’s Law
P => Q <=> ~Q => ~P Contraposition
~ ~P <=> P Double negation
P => Q <=> ~P \/ Q
P <=> Q <=> (P => Q) ^ (Q => P)
P <=> Q <=> (P ^ Q) \/ (~Q ^ ~P)
P ^ ~P <=> False
P \/ ~P <=> True
Q.12. State whether the following sentences are valid, unsatisfiable, or neither.
Verify your decisions using truth tables or equivalence rules.
a. Smoke => Smoke
b. Smoke => Fire
c (Smoke => Fire) => (~Smoke => ~Fire)
d. Smoke \/ Fire \/ ~Fire
e. ((Smoke ^ Heat) => Fire) <=> ((Smoke => Fire) \/ (Heat => Fire))
f. (Smoke => Fire) => ((Smoke ^ Heat) => Fire)
g. Big \/ Dumb \/ (Big => Dumb)
h. (Big ^ Dumb) \/ ~Dumb
Q. 13. Describe the wumpus world according the properties of task environment.
Q.15. From “Horse are animals”, it follows that “The head of the Horse is the head of an animal”.
Demonstrate that this inference is valid by carrying out the following steps:
(i) Translate the premise and the conclusion into the language of the first order logic. Use three predicates
HeadOf(h,x), Horse(x) and Animal(x)
(ii) Negate the conclusion and convert the premise and negated conclusion into conjunctive normal form.
(iii) Use resolution to show that the conclusion follows from the premise.
Module 4.1: Knowledge and Reasoning
11
References:
Books:
Title Authors Publisher Edition Year Chapter
No
1 Artificial Stuart J. Russell and Peter McGraw 3rd
Intelligence a Norvig Hill Edition
Modern 2009
Approach
2 A First Course Deepak Khemani McGraw 1st
in Artificial Hill Edition
Intelligence Education 2013
(India)
Online Resources:
● https://nptel.ac.in/courses/106/102/106102220/
● https://www.javatpoint.com/history-of-artificial-intelligence
● http://people.eecs.berkeley.edu/~russell/slides/