CSA2020 Module2
CSA2020 Module2
Dr.Mohana S D,
Assistant Professor,
(Course Instructor Incharge - CSA2020)
School of Information Science,
Presidency University Bengaluru.
Main Topic
Content
1 Introduction to Knowledge representation
2 Knowledge-based Agents
3 Knowledge-Based Systems
4 Frame Structures
5 Propositional Logic
6 First order Logic
7 Inference in First Order Logic (FOL)
8 Introduction to Reasoning, types of reasoning
Introduction
Introduction
Represent knowledge
Reason about knowledge
What to Represent
Object: All the facts about objects in our world domain. E.g., Guitars
contains strings, trumpets are brass instruments.
Events: Events are the actions which occur in our world.
Performance: It describe behavior which involves knowledge about
how to do things.
Meta-knowledge: It is knowledge about what we know.
Facts: Facts are the truths about the real world and what we
represent.
Knowledge-Base: The central component of the knowledge-based
agents is the knowledge base. It is represented as KB. The
Knowledge-base is a group of the Sentences (Here, sentences are used
as a technical term and not identical with the English language).
Types of knowledge
Declarative Knowledge(descriptive knowledge): Is to know about
something. It includes concepts, facts, and objects.
Procedural Knowledge(imperative knowledge): Is responsible for
knowing how to do something. It includes rules, strategies,
procedures, agendas, etc.
Meta-knowledge: Knowledge about the other types of knowledge
Heuristic knowledge: Is to know about some experts in a filed or
subject. It rules of thumb based on previous experiences, awareness of
approaches, and which are good to work but not guaranteed.
Structural knowledge. Is basic knowledge to problem-solving. It
describes relationships between various concepts such as kind of, part
of, and grouping of something
AI knowledge cycle:
An Artificial intelligence system has the following components for
displaying intelligent behavior:
Perception
Learning
Knowledge Representation and Reasoning
Planning
Execution
Represent knowledge
It deals with creating formal languages and symbols to capture
information about the world in a way that computers can understand.
This includes concepts, objects, relationships, rules, and constraints.
Some popular logic-based formalisms include Description Logic
(DL)(AND, NOT), Propositional Logic, First-Order Logic, and Modal
Logic(if something is true, it is necessarily true).
Key approaches
Propositional Logic
Propositional logic deals with propositions, which are statements that
can be true or false.
It uses logical connectives such as AND (∧), OR (∨), NOT (¬),
IMPLIES (→), and IF AND ONLY IF (↔) to manipulate propositions.
Propositional logic is limited to dealing with simple statements
without considering the internal structure of propositions.
Challenges
Handling uncertainty and inconsistency in knowledge representation.
Scaling up reasoning to handle large knowledge bases efficiently.
Integrating knowledge from heterogeneous sources and domains.
Addressing ontological mismatches and ensuring interoperability
between different ontologies.
Knowledge-based Agents
Knowledge-based Agents
Knowledge-based agents are intelligent agents that operate based on
an explicit representation of knowledge.
These agents use their knowledge to make decisions, solve problems,
and interact with their environment.
Knowledge-based agents typically consist of a knowledge base, an
inference engine, and mechanisms for acquiring, representing, and
using knowledge.
They can be designed for various tasks and domains, ranging from
medical diagnosis and natural language processing to robotics and
game playing.
Knowledge-based agents may incorporate learning mechanisms to
improve their performance over time, but their primary mode of
operation is reasoning based on the knowledge they possess.
CSA2020 Artificial Intelligence 20 / 59
Introduction to Knowledge representation
Knowledge-Based Systems
Knowledge-Based Systems
Knowledge-based systems are software systems that utilize
knowledge-based techniques to solve problems or make decisions in
specific domains.
These systems typically consist of a knowledge base, an inference
engine, and a user interface for interaction with users or other
systems.
Knowledge-based systems are often designed to emulate the
decision-making capabilities of human experts in a particular field or
domain.
Expert systems, a subset of knowledge-based systems, are specifically
designed to capture and utilize expert knowledge for problem-solving
and decision-making tasks.
Many applications, including medical diagnosis, financial analysis,
fault diagnosis, scheduling, and planning.
CSA2020 Artificial Intelligence 21 / 59
Introduction to Knowledge representation
What is KB
A KB agent needs at least
A knowledge base (KB)
An inference system
Propositional Logics
Propositional Logics
Frame Structures
Problem: Design a frame structure to represent information about
different types of vehicles.
Propositional Logic
Problem: Given the following propositions, determine their truth values:
p: It is raining.
q: The sun is shining.
Example
It is Sunday.
The Sun rises from West (False proposition)
3+3= 7(False proposition)
5 is a prime number.
Two Types
Atomic Propositions: Atomic propositions are the simple propositions.
It consists of a single proposition symbol. These are the sentences
which must be either true or false.
Compound propositions: Compound propositions are constructed by
combining simpler or atomic propositions, using parenthesis and
logical connectives.
Atomic Propositions
a) 2+2 is 4, it is an atomic proposition as it is a true fact.
b) ”The Sun is cold” is also a proposition as it is a false fact.
Compound proposition:
a) ”It is raining today, and street is wet.”
b) ”Ankit is a doctor, and his clinic is in Mumbai.”
Logical connectives
Logical connectives are used to connect two simpler propositions or
representing a sentence logically. We can create compound propositions
with the help of logical connectives.
Logical Connectives: There are mainly five connectives
Negation:A sentence such as not (logical not) ¬ P is called negation
of P. A literal can be either Positive literal or negative literal.
Conjunction: A sentence which has ∧ connective such as, P ∧ Q is
called a conjunction. Disjunction: A sentence which has ∨
connective, such as P ∨ Q. is called disjunction, where P and Q are
the propositions.
Implication: A sentence such as P → Q, is called an implication.
Implications are also known as if-then rules. It can be represented as
If it is raining, then the street is wet.
Let P= It is raining, and Q= Street is wet, so it is represented as P
→Q
CSA2020 Artificial Intelligence 36 / 59
Introduction to Knowledge representation
Logical connectives
First-Order Logic
First-order logic is also known as Predicate logic or First-order predicate
logic. First-order logic is a powerful language that develops information
about the objects in a more easy way and can also express the relationship
between those objects.
Example
Objects: A, B, people, numbers, colors, wars, theories, squares, pits,
wumpus, ......
Relations: It can be unary relation such as: red, round, is adjacent, or
n-any relation such as: the sister of, brother of, has color, comes
between
Function: Father of, best friend, third inning of, end of, .....
First-order logic
First-order logic is another way of knowledge representation in artificial
intelligence. It is an extension to propositional logic. FOL is sufficiently
expressive to represent the natural language statements in a concise way.
Syntax
Constants: Represent specific objects or individuals in the domain. Example:
”a”, ”b”, ”c”.
Variables: Represent placeholders for objects in the domain. Example: ”x”,
”y”, ”z”.
Predicates: Represent relationships or properties that can be true or false of
objects. Example: ”Human(x)”, ”Mammal(x)”.
Functions: Represent operations that take objects as inputs and produce
objects as outputs. Example: ”FatherOf(x)”.
Connectives: Logical operators used to combine atomic formulas. Example:
∧ (AND), ∨ (OR), ¬ (NOT).
Quantifiers: Express statements about all or some objects in the domain.
Example: ∀ (universal quantifier), ∃ (existential quantifier).
CSA2020 Artificial Intelligence 42 / 59
Introduction to Knowledge representation
Semantic
Interpretations: Assign meanings to the symbols in the logic.
Domains: Set of objects that the variables and constants can refer to.
Predicate Interpretations: Define whether a predicate is true or false for a
given set of objects.
Function Interpretations: Define how functions operate on objects in the
domain.
CSA2020 Artificial Intelligence 43 / 59
Introduction to Knowledge representation
Semantic
Function Interpretations: Define how functions operate on objects in the
domain.
Truth Values: Assign true or false values to formulas based on the
interpretation.
Example
∀x(Human(x) →Mortal(x))
True because all elements in the domain that satisfy ”Human(x)” also satisfy
”Mortal(x)”.
∃ y(FatherOf(y,Socrates))
True because there exists an element in the domain (Plato) such that
”FatherOf(y, Socrates)” holds.
Universal Generalization
Universal generalization is a valid inference rule which states that if
premise P(c) is true for any arbitrary element c in the universe of
discourse, then we can have a conclusion as ∀ x P(x).
P(c)
It can be represented as: ∀xP(x)
This rule can be used if we want to show that every element has a similar
property.
Example: ”A byte contains 8 bits”, so for ∀xP(x) ”All bytes contain 8
bits.”
Universal Instantiation
Universal instantiation is also called as universal elimination or UI is a valid
inference rule. It can be applied multiple times to add new sentences.
The new KB is logically equivalent to the previous KB.
The UI rule state that we can infer any sentence P(c) by substituting a
ground term c (a constant within domain x) from ∀ x P(x) for any object
in the universe of discourse.
It can be represented as: ∀xP(x)
P(c)
Example: IF ”Every person like ice-cream” =⇒ ∀xP(x) so we can infer
that ”John likes ice-cream” =⇒ P(c)
Existential Instantiation
Existential instantiation is also called as Existential Elimination, which is a
valid inference rule in first-order logic.
It can be applied only once to replace the existential sentence.
The new KB is not logically equivalent to old KB, but it will be satisfiable
if old KB was satisfiable.
This rule states that one can infer P(c) from the formula given in the form
of ∃ x P(x) for a new constant symbol c.
The restriction with this rule is that c used in the rule must be a new term
for which P(c ) is true.
It can be represented as: ∃xP(x)
P(c)
Example:From the given sentence: ∃Crown(x)∧ OnHead(x, John),
So we can infer: Crown(K) ∧ OnHead( K, John), as long as K does not
appear in the knowledge base.
The above used K is a constant symbol, which is called Skolem constant.
The Existential instantiation is a special case of Skolemization process. It
elimination of existential quantifiers.
CSA2020 Artificial Intelligence 50 / 59
Introduction to Knowledge representation
Existential introduction
An existential introduction is also known as an existential generalization,
which is a valid inference rule in first-order logic.
This rule states that if there is some element c in the universe of discourse
which has a property P, then we can infer that there exists something in
the universe which has the property P.
P(c)
It can be represented as: ∃xP(x)
Example:Example: Let’s say that,
”Priyanka got good marks in AI course.”
”Therefore, someone got good marks in AI course.”
Modus Ponens states that for atomic phrases pi, pi ‘ , q. Where there is a
substitution θ such that SUBST (θ, pi) = SUBST (θ, pi),
It represented as : p1‘,p2‘..(p1∧p2∧pn
SUBST (θ,q)
=⇒ q)
Example: Example: We will use this rule for Kings are evil, so we will find
some x such that x is king, and x is greedy so we can infer that x is evil.
Types of Reasoning
Deductive reasoning
Inductive reasoning
Abductive reasoning
Common Sense Reasoning
Monotonic Reasoning
Non-monotonic Reasoning
Deductive reasoning
Deductive reasoning involves drawing specific conclusions from
general principles or premises. It follows a top-down approach where
conclusions logically follow from given premises. Here’s an example:
Premise 1: All mammals have hair.
Premise 2: A dog is a mammal.
Conclusion: Therefore, a dog has hair.
Inductive reasoning
Inductive reasoning involves drawing general conclusions from specific
observations or examples. It follows a bottom-up approach where
generalizations are made based on patterns observed in specific
instances. Here’s an example:
Observation: Every time I eat peanuts, I get a rash.
Conclusion: Peanuts must be causing my rash.
Abductive reasoning
Abductive reasoning involves forming the most plausible explanation
based on available evidence, even if it’s not necessarily the only
possible explanation. It’s often used in scientific inference and
problem-solving. Here’s an example:
Observation: The ground is wet.
Explanation: It must have rained.
Monotonic reasoning
Monotonic reasoning involves drawing conclusions that remain valid
even when new information is added. Once a conclusion is reached, it
does not change with additional information. An example:
Statement: All birds can fly.
Conclusion: Therefore, a sparrow can fly.
Even if we learn that some birds, like penguins, cannot fly, it doesn’t
change the fact that sparrows can.
Non-monotonic reasoning
Non-monotonic reasoning involves drawing conclusions that may be
revised or invalidated in light of new information. Conclusions are not
always absolute and may be subject to change. An example:
Initial Conclusion: Birds can fly.
New Information: Penguins are birds but cannot fly.
Revised Conclusion: Not all birds can fly.