Unit-4 Knowledge representation
Unit-4 Knowledge representation
Introduction
Knowledge is a theoretical or practical understanding of a subject or a domain.
Knowledge refers to the fact of knowing something that has been gained through an experience and
learning which makes the agent (AI application like a chatbot) familiar.
In Artificial Intelligence, a machine will perform a specific action based on a specific condition only if it
has gained an experience from the past.
An intelligent agent needs knowledge about the real world for taking decisions and reasoning to act
efficiently.
Types of knowledge
Classification-based Knowledge: Ability to classify information
Importance of Knowledge
Understanding and Reasoning: Just like humans, AI systems need knowledge to understand the world
around them. This knowledge can be factual (like the capital of France) or conceptual (like the relationship
between speed and distance). With this knowledge, AI systems can reason about situations, draw
inferences, and make logical decisions.
Learning and Adapting: While some AI systems learn primarily from data, knowledge can play a crucial
role in guiding that learning. A base of knowledge helps AI systems distinguish between relevant and
irrelevant information, generalize from specific examples, and adapt to new situations.
Problem-Solving and Task Completion: Many AI applications involve solving problems or completing
tasks. Knowledge equips AI systems with the information they need to approach these challenges
effectively. For instance, a medical diagnosis system needs medical knowledge to analyze symptoms and
suggest diagnoses.
Communication and Interaction: For AI systems to interact meaningfully with humans, they need
knowledge about language, the world, and common sense. This knowledge allows them to understand what
is being said, respond appropriately, and generate human-like text or speech.
Supporting natural language processing: Knowledge is fundamental for AI to understand and generate
human language. Natural Language Processing (NLP) models, such as those used in chatbots or virtual
assistants, rely on extensive knowledge bases to comprehend context, disambiguate meaning, and provide
relevant responses
By providing a foundation of knowledge, AI systems can act more intelligently and achieve better results in
various applications.
It deals with how to encode and structure the vast amount of knowledge the world has to offer in a way that
machines can understand and reason with. Here are some of the key issues that arise in knowledge
representation for AI:
2. Handling Uncertainty and Incompleteness: The real world is messy. Our knowledge is often incomplete,
and things aren't always black and white. KR systems need to deal with:
o Uncertainty: How to represent and reason with knowledge that might be imprecise or probabilistic (e.g.,
"It will probably rain tomorrow").
o Inconsistency: Conflicting information can exist. The system needs to identify and handle inconsistencies
or provide methods to resolve them.
Techniques like fuzzy logic and probabilistic reasoning can help represent and reason with uncertainty.
AI systems might need to access and combine knowledge from various sources, each with its own structure
and format. Knowledge integration involves:
o Semantic Alignment: Ensuring concepts and relationships from different sources have consistent meanings.
4. Reasoning with Inconsistent Knowledge: Developing methods to reason and draw conclusions even if
the knowledge sources disagree.
5. Expressiveness: More expressive systems often lead to computational complexity, making reasoning slower
and more resource-intensive.
Researchers are constantly developing new techniques and approaches to address these issues. The goal is to
create knowledge representation systems that are expressive, efficient, and adaptable to handle the
complexities of the real world.
It is responsible for representing information about the real world so that a computer can understand and
can utilize this knowledge to solve the complex real world problems such as diagnosis a medical condition
or communicating with humans in natural language.
Knowledge representation in AI involves encoding information about the world into formats that AI
systems can utilize to solve complex tasks.
Knowledge representation is not just storing data into some database, but it also enables an intelligent
machine to learn from that knowledge and past experiences so that it can behave intelligently like a human.
Objects, events, performance, meta-knowledge, facts, and knowledge-base are the different kinds of
knowledge.
Representational Accuracy: The KRS should be able to represent all the different kinds of knowledge
required for the task at hand.
Inferential Adequacy: The KRS should allow the system to derive new knowledge based on the existing
knowledge.
Comprehensiveness: The KRS should be able to represent a broad range of knowledge, not limited to a
specific domain.
Computability: The knowledge representation needs to be structured in a way that the system can process
and manipulate it using its computational abilities.
Accessibility: The knowledge base should be easy for humans to understand and interact with, allowing for
easier maintenance and knowledge editing.
Relevance: The KRS should focus on storing knowledge that is relevant to the specific task or domain the
system is designed for.
Conciseness: The knowledge representation should be efficient in its use of storage space, avoiding
redundancy and unnecessary complexity.
By considering these properties, developers can choose or design a knowledge representation system that best
suits the needs of their specific AI application.
1) Logical Representation:
This allows for clear and unambiguous representation, enabling powerful reasoning capabilities.
However, logical representations can be complex and difficult to understand for humans, and knowledge
acquisition can be challenging.
There are two types of logical representation: Propositional Logic and First-order Logic.
o Propositional Logic:- Propositional logic is the simplest formal logic for the representation of the
knowledge in terms of propositions. Propositional logic is also called Boolean logic as it works on 0 and 1
or true and false.
o First-order logic (FOL):- It also known as first-order predicate calculus (FOPC) or first-order logic with
identity, is an extension of propositional logic that allows for the representation of more complex
relationships between objects. It uses quantifiers for showing the relationship between propositions.
2) Semantic Networks
Semantic networks are a type of graphical model that shows the relationships between concepts, ideas, and
objects in a way that is easy for humans to understand.
Semantic networks are used to represent both simple and complex knowledge structures.
Nodes represent concepts or entities, and links represent relationships between them.
Semantic networks are good for representing relationships and hierarchies between concepts, but they can
become unwieldy for large knowledge bases.
The syntax of a semantic network consists of nodes and links, and the semantics involve defining the
meaning of each node and link.
One of the main advantages of semantic networks is that they can be easily visualized, making them more
easy to understand than logical representations.
However, there are some drawbacks associated with this representation method. For instance, semantic
networks can be computationally expensive at runtime, as traversing the entire network tree may be
necessary to answer certain questions.
Example: The following are a few statements that must be represented with nodes and arcs:
3) Frame Representation:
Knowledge is organized around frames, which are data structures containing slots for attributes and their
values.
In artificial intelligence, frames serve as a data structure that divides knowledge into substructures by
representing typical situations.
This approach is good for representing objects with similar properties and allows for inheritance of
attributes between related frames. However, frames can be less efficient for representing complex
relationships.
4) Production Rules:
The antecedent (if) part of the rule specifies a condition, and the consequent (then) part specifies an action.
o The recognize-act-cycle
Production rules are good for representing procedural knowledge and reasoning steps, but they can be less
efficient for representing complex factual knowledge.
One advantage of this system is that production rules can be expressed in natural language, which makes
them easier to understand and modify.
However, there are also some drawbacks to the production rules system. They do not possess any learning
capabilities and cannot store the result of a problem for future use.
Example:
o IF (at bus stop AND bus arrives) THEN action (get into the bus)
o IF (on bus AND unpaid) THEN action (pay charges).
o IF (bus arrives at destination) THEN action (get down from the bus).
Propositional Logic
Propositional logic is the simplest formal logic for the representation of the knowledge in terms of
propositions.
It provides a formal framework for representing and manipulating statements (propositions) to perform
automated reasoning tasks.
Propositional logic is also called Boolean logic as it works on 0 and 1 or true and false.
Propositions logic can be true or false, but not both at the same time.
The propositions and connectives are the basic elements of the propositional logic. Connectives can be said
as a logical operator which connects two sentences(propositions).
It provides a formal system for representing these propositions and the relationships between them using
logical operators like AND, OR, and NOT.
Knowledge Representation: Propositional logic allows us to express facts and rules in a clear way. We
can represent simple statements about the world as propositions (e.g., "It is raining" or "The car is red"). By
combining these propositions with logical operators, we can build more complex knowledge structures.
Reasoning: Once knowledge is represented, propositional logic allows AI systems to reason and draw
conclusions based on that knowledge. We can use inference rules to derive new propositions from existing
ones. This enables AI systems to make decisions and solve problems without needing everything explicitly
programmed.
Expert Systems: These systems use knowledge bases built with propositional logic to diagnose problems,
recommend solutions, and answer questions in specific domains.
Natural Language Processing (NLP): Propositional logic can help understand the logical structure of
sentences and perform tasks like question answering or sentiment analysis.
Game Playing: AI players in games like chess or checkers can use propositional logic to evaluate the
game state and make optimal moves based on the rules.
The syntax of propositional logic defines the allowable sentences for the knowledge representation.
There are two types of Propositions:
Atomic Propositions
Compound propositions
Atomic Proposition: Atomic propositions are the simple propositions. It consists of a single proposition
symbol. These are the sentences which must be either true or false.
Example :-
Example :-
a) today is Friday and people visit Temple today.
Logical connectives are used to connect two simpler propositions or representing a sentence logically.
There are mainly five connectives, which are given as follows:
1. Negation :- A sentence such as ¬ P is called negation of P. The symbol uses in negation is “¬” in word
“Not”.
P ¬P
1 (true) 0 (false)
0 (false) 1 (true)
2. Conjunction (Conjunctive Normal Form): A sentence which has ∧ connective such as, P ∧ Q is called a
conjunction. The symbol uses in Conjunction is “∧” in word “AND”.
Example: Rohan is intelligent and hardworking.
P Q P^Q
A sentence which has ∨ connective, such as P ∨ Q. is called disjunction, where P and Q are the
propositions.
Example:
P Q PvQ
1 (true) 1 (true) 1 (true)
4. Implication (if-then): 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
P Q P→Q
P Q P⇔Q
Q ) X = It is cold , Y= It is Sunny and Z = It is Breezy solve all the below questions using logical
connectives.
1) It is not cold
Ans :- ¬ X
Ans :- X ^ Z
3) It is cold or It is Breezy.
Ans :- X V Z
Ans :- ( Z ^ X ) ¬ Y
Ans :- Z X
Ans :- X ⇔ Z
Q ] You can access the internet from SPA College if and only if you are BIM Student or you are not
freshman .
Ans:-
Ans:-
Ans:-
Ans:-
As we can see every value of (A ∨ B) ∧ (¬A) has both ―True and ―False, it is a contingency.
Inference rules are applied to derive proofs in artificial intelligence, and the proof is a sequence of the
conclusion that leads to the desired goal.
Converse: The converse of implication, which means the right-hand side proposition goes to the left-hand
side and vice-versa. It can be written as Q → P.
From the terminologies related to inference rules are equivalent to each other, which we can prove using truth
table:
Or
Hence from the above truth table, we can prove that P → Q is equivalent to ¬ Q → ¬ P, and Q→ P is
equivalent to ¬ P → ¬ Q.
Production system provide a structure for describing and performing the search process in AI program.
A production system is a set of rule, each rule consists L.H.S (Situation) and R.H.S (Action). These rules,
termed productions, are a basic representation found useful in automated planning, expert systems and
action selection.
A production system provides pattern-directed control of a problem solving process and consists of:–
Production Rules: Production rules form the core logic of the system. They are a set of guidelines that the
system follows while making decisions. These regulations outline the system’s reaction to various inputs and
circumstances.
Control System: The control system manages the execution of production rules. It determines the sequence in
which rules are applied, ensuring efficient processing and optimizing the system’s performance.
Production Set:
1. ba → ab
2. ca → ac
3. cb → bc
Inference engine:
The inference engine is the component of the intelligent system in artificial intelligence, which applies
logical rules to the knowledge base.
It acquires and manipulates knowledge from the knowledge base(database) to arrive at particular solution.
It is like a search engine.
It is rule-based expert system.
There are two principal ways in which rules are executed.
Forward chaining is also known as a forward deduction or forward reasoning method when using an
inference engine.
Forward chaining starts from the start state(Known facts or data) and proceeds towards the goal state
(conclusion).
It is a process of making a conclusion based on known facts or data, by starting from the initial state and
reaches the goal state.
Forward chaining can be used in planning, monitoring, controlling, and interpreting applications.
A, A->B, B
A is the starting point. A->B represents a fact. This fact is used to achieve a decision B.
Backward-chaining is also known as a backward deduction or backward reasoning method when using an
inference engine.
A backward chaining algorithm is a form of reasoning, which starts with the goal and works backward,
chaining through rules to find known facts that support the goal.
In backward chaining, the goal is broken into sub-goal or sub-goals to prove the facts true.
The modus ponens inference rule is used as the basis for the backward chaining process.
A backward chaining algorithm is employed in inference engines, game theories, and complex database
systems.
B, A->B, A
B is the goal or endpoint, that is used as the starting point for backward tracking. A is the initial state.
A->B is a fact that must be asserted to arrive at the endpoint B.
First-order logic is a powerful language that develops information about the objects in an easier way and
can also express the relationship between those objects.
First-order predicate logic also assumes the following things in the world:
First-order logic in Artificial Intelligence comprises two main components, which are as follows.
1) Syntax
2) Semantics
The basic syntactic elements of FOL are symbols. We use symbols to write statements in shorthand
notation.
Variables x, y, z, a, b,....
Equality ==
Quantifier ∀, ∃
Connectives ∧, ∨, ¬, ⇒, ⇔
2) Semantics
Semantics refers to the techniques that we use to evaluate an expression of First Order Logic in AI.
In AI, semantics of First-Order Logic (FOL) play a vital role in enabling machines to reason and
understand the meaning of statements within a specific context.
It provides a way to assign meanings to the symbols and structures used in first-order logic.
Semantics refers to the techniques that we use to evaluate an expression of First Order Logic in AI.
Universal quantifier is a symbol of logical representation, which specifies that the statement within its
range is true for everything of a particular thing.
Example:
It will be read as: There are all x where x is a man who drink coffee.
Existential quantifiers are the type of quantifiers, which express that the statement within its scope is true
for at least one instance of something.
Example:
It will be read as: There are some x where x is a boy who is intelligent.
Note:-
Q] Every person who buys a share is smart. => ∀x∀y:person(x) ∧ share(y) ∧ buys(x , y) smart(x) .