0% found this document useful (0 votes)
2 views16 pages

unit 2 lecture 2

Knowledge representation in AI is essential for enabling systems to understand, organize, and reason about information, similar to how humans solve problems. It includes techniques like propositional and predicate logic, semantic networks, frames, and rule-based systems, each serving different purposes in expressing knowledge. These techniques help AI systems efficiently process information, support reasoning, and maintain consistency to make informed decisions.

Uploaded by

mishraabhilu23
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)
2 views16 pages

unit 2 lecture 2

Knowledge representation in AI is essential for enabling systems to understand, organize, and reason about information, similar to how humans solve problems. It includes techniques like propositional and predicate logic, semantic networks, frames, and rule-based systems, each serving different purposes in expressing knowledge. These techniques help AI systems efficiently process information, support reasoning, and maintain consistency to make informed decisions.

Uploaded by

mishraabhilu23
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/ 16

Knowledge Representation Techniques in AI

Knowledge representation is like giving AI a brain—a way for it to


understand, organize, and reason about the world around us. It’s the
foundation that helps AI systems make smart decisions, much like how
humans use knowledge to solve problems.

1. What is Knowledge Representation?


Think of knowledge representation as creating a filing system for
information that AI can understand and use. It’s how facts, relationships,
and rules about the world are stored so that computers can process them
effectively.
Analogy:
Knowledge representation is like organizing a toolbox. A well-organized
toolbox (AI's knowledge base) lets you quickly find the right tool
(information) for the job, use it efficiently, and ensure everything fits
without causing confusion.

Why is it important?
It bridges the gap between how humans think and how machines
compute. It must:
• Express a variety of knowledge: AI systems need to handle different
types of information, such as facts, rules, relationships, and
probabilities, to solve diverse problems.
Example:
Consider a virtual assistant like Siri or Alexa. To answer the question,
"What's the weather like today?", it uses factual knowledge
(temperature and forecast). When asked, "How long will it take to
reach the airport?", it integrates spatial knowledge (distance, traffic
data) with reasoning.

• Be efficient: AI must process and store information quickly and


effectively to deliver timely and accurate results.
Example:
In a recommendation system like Netflix, efficiency matters. The
system analyzes your watch history and compares it with millions of
users to suggest content instantly. If this process were slow or
resource-intensive, it would impact user experience.

• Support reasoning: AI must use the information it has to draw


logical conclusions, solve problems, or predict outcomes.
Example:
In healthcare, an AI system analyzing patient symptoms (input) may
conclude a possible diagnosis (output) using reasoning. For instance,
if a patient has a high fever and rash, the AI might suggest a possible
case of measles.

• Stay consistent: Contradictory data can lead to confusion and wrong


decisions. AI systems must ensure the knowledge they use remains
logical and reliable.
Example:
In a self-driving car, consistency is critical. If one sensor says
"Obstacle detected ahead," and another says "Road is clear," the car
may make a dangerous decision. Systems ensure consistency by
validating sensor data.
2. Techniques for Knowledge Representation
Different situations require different ways to represent knowledge. Here
are the main ones:
1. What is Propositional Logic?
Propositional logic deals with statements (propositions) that can either
be true or false, but not both. Think of it as answering "yes" or "no" to
simple questions.
Example:
• Statement: "It is raining."
This can be either true (if it's actually raining) or false (if it isn't).

2. Syntax
Propositional logic uses symbols (like P, Q) to represent statements and
connectors (like AND, OR) to combine them.
Here are the key connectors with examples:

a) AND ( ∧ )
• Meaning: Both propositions must be true for the combined
statement to be true.
AND (P ∧ Q)

P Q P∧ Q
T T T
T F F
F T F
F F F
Example:
Let P = "It is raining."
Let Q = "It is cloudy."
P ∧ Q = "It is raining AND it is cloudy."
o If both P and Q are true (it's raining and cloudy), then P ∧ Q =
true.
o If either or both are false, P ∧ Q = false.

b) OR ( ∨ )
• Meaning: At least one proposition must be true for the combined
statement to be true.
• OR (P ∨ Q)

P Q P∨ Q
T T T
T F T
F T T
F F F

• Example:
Let P = "I will study."
Let Q = "I will play."
P ∨ Q = "I will study OR I will play."
o If either P or Q (or both) are true, then P ∨ Q = true.
o If both P and Q are false, then P ∨ Q = false.

c) NOT ( ¬ )
• Meaning: This reverses the truth value of a proposition.
• Negation (¬P)
P ¬P
T F
F T

• Example:
Let P = "I am hungry."
¬P = "I am NOT hungry."
o If P = true (you are hungry), then ¬P = false.
o If P = false (you are not hungry), then ¬P = true.

d) IMPLIES ( → )
• Meaning: If one statement is true, it leads to another being true.
• Implication (P → Q)

P Q P→ Q
TT T
TF F
FT T
FF T

• Example:
Let P = "I study."
Let Q = "I will pass the exam."
P → Q = "If I study, then I will pass the exam."
o If P is true (you study) and Q is true (you pass), then P → Q =
true.
o If P is true (you study) but Q is false (you fail), P → Q = false.
o If P is false (you don’t study), P → Q = true regardless of Q.
Examples :
Propositions:
• P = "I wake up early."
• Q = "I go for a jog."
Expressions:
• AND: "I wake up early AND I go for a jog" → P∧Q
o True if you do both.
• OR: "I wake up early OR I go for a jog" → P∨Q
o True if you do at least one of these activities.
• NOT: "I do NOT wake up early" → ¬P.
o True if you sleep in.
• IMPLIES: "If I wake up early, I go for a jog" → P→Q
o True unless you wake up early and don’t jog.

Online Shopping
Propositions:
• P = "The product is in stock."
• Q = "I will buy it."
Expressions:
• AND: "The product is in stock AND I will buy it" → P∧Q
o True if both conditions are true.
• OR: "The product is in stock OR I will buy it" → P∨Q
o True if either or both conditions are true.
• NOT: "The product is NOT in stock" → ¬P
o True if the product is unavailable.
• IMPLIES: "If the product is in stock, I will buy it" → P→Q
o True unless the product is in stock and you don’t buy it.

b. Predicate Logic (First-Order Logic)


Predicate logic extends propositional logic by describing relationships
between objects and their properties. It allows us to make statements
about specific objects and generalize them using quantifiers.
Example (Basic):
• Statement in propositional logic: "John likes pizza."
• Statement in predicate logic: Likes(John, Pizza).
Here, "John" and "Pizza" are objects, and "Likes" is a predicate
showing the relationship between them.

2. Syntax Components
a) Objects
Objects are the entities we are talking about.
Examples:
• People: John, Alice, David.
• Things: Ball, Pizza, Book.
b) Predicates
Predicates describe properties of objects or relationships between
objects.
Examples:
• Likes(John, Pizza): John likes pizza (relationship).
• Taller(John, Alice): John is taller than Alice (relationship).
• Red(Ball): The ball is red (property).
c) Quantifiers
Quantifiers allow us to generalize or specify statements.
1. Universal Quantifier ( ∀ )
Indicates that a statement applies to all objects.
Syntax: ∀x [Predicate(x)].
Example:
• ∀x Likes(x, Pizza): "Everyone likes pizza."
o Meaning: For every object x likes pizza.
• ∀x Animal(x) → HasHeart(x): "All animals have hearts."

2. Existential Quantifier ( ∃ )
Indicates that a statement applies to at least one object.
Syntax: ∃x [Predicate(x)].
Example:
• ∃x Likes(x, Pizza): "At least one person likes pizza."
o Meaning: There exists an object x such that x likes pizza.
• ∃x Red(x) ∧ Ball(x): "There is a red ball."

3. Examples in Real Life


a) Classroom Example
• ∀x Student(x) → Studies(x): "Every student studies."
• ∃x Student(x) ∧ Plays(x): "At least one student plays."
• Taller(John, Alice): "John is taller than Alice."

b) Traffic Example
• ∀x Car(x) → NeedsFuel(x): "Every car needs fuel."
• ∃x Car(x) ∧ Electric(x): "There exists a car that is electric."

c) Family Relationships
• Parent(John, Alice): "John is a parent of Alice."
• ∀x Parent(x, Alice) → Loves(x, Alice): "Everyone who is a parent of
Alice loves her."
• ∃x Parent(x, Alice) ∧ Doctor(x): "There exists a parent of Alice who is
a doctor."

Exercise:
1. Every student studies.
2. At least one student plays football.
3. All teachers give homework.
4. Some students like mathematics.
5. Every book has an author.
6. There is at least one red car.
7. All cats have tails.
8. Some birds can’t fly.
9. Every parent loves their child.
10. At least one person in the class wears glasses.
Solution:
Every student studies.
∀x (Student(x) → Studies(x))
At least one student plays football.
∃x (Student(x) ∧ PlaysFootball(x))
All teachers give homework.
∀x (Teacher(x) → GivesHomework(x))
Some students like mathematics.
∃x (Student(x) ∧ LikesMath(x))
Every book has an author.
∀x (Book(x) → ∃y (Author(y) ∧ Wrote(y, x)))
There is at least one red car.
∃x (Car(x) ∧ Red(x))
All cats have tails.
∀x (Cat(x) → HasTail(x))
Some birds can’t fly.
∃x (Bird(x) ∧ ¬CanFly(x))
Every parent loves their child.
∀x ∀y (Parent(x, y) → Loves(x, y))
At least one person in the class wears glasses.
∃x (Person(x) ∧ InClass(x) ∧ WearsGlasses(x))

4. Combining Quantifiers
We can also combine universal and existential quantifiers to create more
complex statements.
Example:
• ∀x Student(x) → ∃y Teacher(y) ∧ Teaches(y, x):
"For every student, there exists a teacher who teaches them."

c. Semantic Networks
A semantic network is a way to represent knowledge in a graphical form,
similar to a mind map. It consists of nodes (representing objects or
concepts) and edges (representing relationships).

Let’s break this down with examples:

1. Nodes
Nodes represent concepts, objects, or ideas.
Example:
• "Dog" (a concept)
• "Mammal" (a category)
• "Barks" (a property of dogs)

2. Edges
Edges define relationships between nodes, such as categories,
properties, or actions.

Example Relationships:
• IsA: Specifies that an object belongs to a category.
o "Dog → IsA → Mammal"
• HasProperty: Indicates an attribute of the object.
o "Dog → HasProperty → Barks"
• Can: Denotes an action the object can perform.
o "Dog → Can → Run"
• PartOf: Indicates that an object is a part of something larger.
o "Wheel → PartOf → Car"

3. Example: Dog Semantic Network


Imagine a simple semantic network for a "Dog":
• Nodes: Dog, Mammal, Barks, Tail, Run.
• Edges:
o Dog → IsA → Mammal
o Dog → HasProperty → Barks
o Dog → HasProperty → Tail
o Dog → Can → Run

d. Frames
Frames are a data structure used to represent knowledge about objects
in a more structured and detailed manner. They can be thought of as a
template or form where specific details about an object or concept are
stored. Frames capture attributes and relationships in an organized way,
often used in AI for representing objects and reasoning.

1. Structure of Frames
A frame is like a container or structure for storing information about an
object. It consists of:
• Slots: These are like fields or attributes that define properties of the
object.
• Filler: This is the actual value or information stored in a slot.

Frame Name: Car


Make:
Model:
Color:
Engine:
Seats:
Doors:
Transmission:
Fuel
Efficiency:
2. Example of a Frame for a Car
Let’s consider a Car as an object. A frame for the car could look like this:

Frame Name: Car


o Make: Toyota
o Model: Corolla
o Color: Blue
o Engine: Petrol
o Seats: 5
o Doors: 4
o Transmission: Automatic
o Fuel Efficiency: 15 km/l

This frame contains various slots (like Make, Model, Engine) and the
corresponding fillers (like Toyota, Corolla, Petrol). Each slot describes a
specific attribute of the car.

e. Rule-Based Systems
Knowledge is stored as “if-then” rules, which are great for decision-
making.
• Example:
o Rule: If temperature < 0, then state = Solid.
o Input: Temperature = -5.
o Output: State = Solid.
• Analogy: It’s like following a recipe: If the step is to mix ingredients,
you do so.

3. Comparison: Propositional vs. Predicate Logic


Propositional Predicate
Aspect
Logic Logic

Objects &
Complexity Simple facts
relationships

Highly
Expressiveness Limited
expressive

Quantifiers Not supported Supported

Expert
Example Use
Logic circuits systems,
Case
language

You might also like