Ai Notes Unit II
Ai Notes Unit II
UNIT-II
Knowledge representation issues, mapping, frame problem
Predicate logic, facts in logic
Representing instance and Isa relationship
Resolution, procedural and declarative knowledge
Matching, control knowledge
Symbolic reasoning under uncertainty
Non-monotonic reasoning, statistical reasoning.
o Object: All the facts about objects in our world domain. E.g., Guitars
contains strings, trumpets are brass instruments.
o Events: Events are the actions which occur in our world.
o Performance: It describe behavior which involves knowledge about how to
do things.
o Meta-knowledge: It is knowledge about what we know.
o Facts: Facts are the truths about the real world and what we represent.
o Knowledge-Base: The central component of the knowledge-based agents is
the knowledge base. It is represented as KB. The Knowledgebase is a group
of the Sentences (Here, sentences are used as a technical term and not
identical with the English language).
This type of knowledge refers to facts or statements that describe the world, often in
the form of “knowing what.” It is static and doesn’t involve actions or procedures.
Example: “Paris is the capital of France” is a piece of declarative knowledge.
o
2. Procedural Knowledge
3. Meta-knowledge:
4. Heuristic knowledge:
o Heuristic knowledge is representing knowledge of some experts in a filed or
subject.
o Heuristic knowledge is rules of thumb based on previous experiences,
awareness of approaches, and which are good to work but not guaranteed.
Heuristic knowledge consists of experience-based rules of thumb or best practices that help
in making decisions quickly without complete information.
Example: A heuristic might be “If a website loads slowly, refresh the page” — it’s not
always guaranteed to work, but it’s often useful.
5. Structural knowledge:
Example: Understanding that a dog is a type of animal and a poodle is a type of dog
reflects structural knowledge.
2. Ambiguity and Vagueness: Human language and concepts are often ambiguous or vague,
making it difficult to create precise representations.
3. Scalability: As the amount of knowledge grows, AI systems must scale accordingly, which
can be challenging both in terms of storage and processing power.
4. Knowledge Acquisition: Gathering and encoding knowledge into a machine-readable format
is a significant hurdle, particularly in dynamic or specialized domains.
5. Reasoning and Inference: AI systems must not only store knowledge but also use it to infer
new information, make decisions, and solve problems. This requires sophisticated reasoning
algorithms that can operate efficiently over large knowledge bases.
1. Expert Systems: These systems use knowledge representation to provide advice or make
decisions in specific domains, such as medical diagnosis or financial planning.
3. Robotics: Robots use knowledge representation to navigate, interact with environments, and
perform tasks autonomously.
4. Semantic Web: The Semantic Web relies on ontologies and other knowledge representation
techniques to enable machines to understand and process web content meaningfully.
5. Cognitive Computing: Systems like IBM's Watson use knowledge representation to process
vast amounts of information, reason about it, and provide insights in fields like healthcare
and research.
Let's suppose if you met some person who is speaking in a language which you
don't know, then how you will able to act on that. The same thing applies to the
intelligent behavior of the agents.
As we can see in below diagram, there is one decision maker which act by sensing
the environment and using knowledge. But if the knowledge part will not present
then, it cannot display intelligent behavior.
AI knowledge cycle:
o Perception
o Learning
o Knowledge Representation and Reasoning
o Planning
o Execution
The above diagram is showing how an AI system can interact with the real world
and what components help it to show intelligence. AI system has Perception
component by which it retrieves information from its environment. It can be visual,
audio or another form of sensory input. The learning component is responsible for
learning from data captured by Perception comportment. In the complete cycle, the
main components are knowledge representation and Reasoning. These two
components are involved in showing the intelligence in machine-like humans.
These two components are independent with each other but also coupled together.
The planning and execution depend on analysis of Knowledge representation and
reasoning.
There are mainly four approaches to knowledge representation, which are given
below:
o It is the simplest way of storing facts which uses the relational method, and
each fact about a set of the object is set out systematically in columns.
o This approach of knowledge representation is famous in database systems
where the relationship between different entities is represented.
o This approach has little opportunity for inference.
Player1 65 23
Player2 58 18
Player3 75 24
2. Inheritable knowledge:
Man (Marcus)
∀x = man (x)----------> mortal (x)s
4. Procedural knowledge:
1.RepresentationalAccuracy:
KR system should have the ability to represent all kind of required
knowledge.
2.InferentialAdequacy:
KR system should have ability to manipulate the representational structures to
produce new knowledge corresponding to existing structure.
3.InferentialEfficiency:
The ability to direct the inferential knowledge mechanism into the most
productive directions by storing appropriate guides.
4. Acquisitional efficiency- The ability to acquire the new knowledge easily
using automatic methods.
There are mainly four ways of knowledge representation which are given as follows:
1. Logical Representation
2. Semantic Network Representation
3. Frame Representation
4. Production Rules
1. Logical Representation
Logical representation is a language with some concrete rules which deals with
propositions and has no ambiguity in representation. Logical representation
means drawing a conclusion based on various conditions. This representation
lays down some important communication rules. It consists of precisely
defined syntax and semantics which supports the sound inference. Each
sentence can be translated into logics using syntax and semantics.
Syntax:
o Syntaxes are the rules which decide how we can construct legal sentences in the logic.
o It determines which symbol we can use in knowledge representation.
o How to write those symbols.
Semantics:
o Semantics are the rules by which we can interpret the sentence in the logic.
o Semantic also involves assigning a meaning to each sentence.
Propositional Logic
Predicate logics
Predicate logic
What is Predicate Logic in Artificial Intelligence?
Predicate logic, also known as first-order logic (FOL), is an extension of propositional logic that allows us
to express relationships between objects and their properties. In AI, predicate logic is widely used to
represent knowledge and perform reasoning in more complex scenarios where relationships matter.
Unlike propositional logic, which deals with simple true/false statements, predicate logic
introduces predicates, variables, constants, and quantifiers. These elements help in modelling real-world
problems that involve multiple objects and their interactions.
Role of Predicate Logic in AI
Knowledge Representation: It provides a structure for representing complex facts about objects and their
relationships in a system.
Reasoning: AI systems use predicate logic to infer new information from existing facts, making it suitable
for decision-making tasks.
Example:
“John is the father of Mary” can be represented as: Father(John,Mary)Father(John, Mary)Father(John,Mary)
This expression tells us that there is a relationship (Father) between two objects (John and Mary). Predicate
logic enables us to model and reason about such relationships effectively.
Components of Predicate Logic:
Predicate logic involves several key components that allow it to represent relationships and properties of
objects in a structured way.
1. Predicates:
A predicate is a function that returns either true or false based on the relationship between its arguments.
Example: IsHungry(John)IsHungry(John)IsHungry(John) This predicate represents whether John is hungry,
returning true if he is and false if not.
2. Variables:
Variables are placeholders for objects within a domain. They allow us to represent general statements that apply to
multiple objects.
Example: In IsHungry(x), the variable x can represent any person.
3.Constants:
Constants represent specific objects or entities in the domain.
Example: John is a constant in the predicate IsHungry(John).
4.Structure of Predicates
Predicate consists of two key elements: the predicate symbol and arguments. Predicates are enhanced
with quantifiers to specify the scope of variables involved.
1. Predicate Symbol
The predicate symbol defines the property or relationship being described.
Example:
IsHungry(x) represents whether a person (x) is hungry.
Married(x, y) denotes that person x is married to person y.
Predicates are named based on the relationship or property they represent. The symbol is followed
by arguments enclosed in parentheses.
2. Arguments and Arity
Arguments refer to the specific objects that the predicate is applied to.
The arity of a predicate refers to the number of arguments it takes.
Examples:
IsHungry(x): A predicate with 1 argument (arity = 1).
Married(x, y): A predicate with 2 arguments (arity = 2).
X(a, b, c): A predicate with 3 arguments (arity = 3), representing something like “a + b + c = 0.”
3. Quantifiers in Predicate Logic
Quantifiers allow us to specify the scope of variables. There are two main types:
1. Existential Quantifier ( ∃ )
Meaning: There exists at least one object that satisfies the given condition.
Example: ∃x IsHungry(x)
This statement means that at least one person is hungry.
Negation: The negation of the existential quantifier means that no such object exists.
¬∃x IsHungry(x)
This means that no one is hungry.
2. Universal Quantifier ( ∀ )
Meaning: The given condition holds for all objects in the domain.
Example: ∀x (IsHuman(x)→IsMortal(x))
This means that all humans are mortal.
Negation: The negation of the universal quantifier means there is at least one exception.
¬∀x IsHuman(x)→IsMortal(x)
This implies that at least one human is not mortal.
∃x TaskRequires(x,Charging)
Solution:
Let's convert the given statements into predicate logic:
Propositional Logics
(P∧¬Q)→R
This logic reads as:
“If it is hot outside AND the windows are not open, then turn on the air conditioner.”
Explanation of the Logic:
AND ( ∧ ) ensures that both conditions must be true (hot outside and windows closed) for the air
conditioner to turn on.
NOT ( ¬ ) negates the condition, meaning the windows must be closed.
IF-THEN ( → ) states that if the first part is true, the second part (turning on the AC) will follow.
Logical Connectives in Propositional Logic
Connective Symbo Meaning Example
l
AND ∧ True if both propositions (P ∧ Q): “It is raining
are true. AND cold.”
OR ∨ True if at least one (P ∨ Q): “It is raining
proposition is true. OR cold.”
NOT ¬ Negates the truth value of ¬P: “It is not raining.”
a proposition.
IF-THEN → True unless the first is (P → Q): “If it rains,
true and second is then it will flood.”
false.
IF AND ↔ True if both propositions (P ↔ Q): “It rains if
ONLY are either true or and only if it is
IF false. cloudy.”
Logical connectives are essential operators that combine atomic propositions to form compound
propositions. These connectives allow AI systems to build more complex rules and perform logical
reasoning. Below are the most common connectives used in propositional logic:
Common Logical Connectives
These connectives allow us to create logical rules that AI systems can use to make decisions. Let’s take a
quick look at how each works:
1. AND ( ∧ ):
The result is True only if both propositions are true.
Example: If P is “It is hot” and Q is “The fan is on”, then (P ∧ Q) means both conditions are
satisfied.
2. OR ( ∨ ):
The result is True if at least one of the propositions is true.
Example: (P ∨ Q) will be true if either it is hot or the fan is on.
3. NOT ( ¬ ):
This inverts the truth value of the proposition.
Example: If P is true, ¬P will be false.
4. IF-THEN ( → ):
This implies that if the first proposition is true, the second must also be true for the compound
statement to be true.
Example: “If it rains, then the ground will be wet” (P → Q).
5. IF AND ONLY IF (↔ ):
This is true only when both propositions have the same truth value (either both true or both false).
Example: “It is cloudy if and only if it will rain” (P ↔ Q).
Truth Table
A truth table is a useful tool for determining the truth value of a compound proposition based on the truth
values of its atomic propositions. It systematically lists all possible combinations of truth values and the
corresponding output for a given logical expression.
How Truth Tables Work
Let’s consider two propositions:
P: “It is raining.”
Q: “The ground is wet.”
We can build a truth table to evaluate the compound proposition P ∧ Q (It is raining AND the ground is
wet).
P Q P∧Q
TRUE TRUE TRUE
TRUE FALSE FALSE
FALSE TRUE FALSE
FALSE FALSE FALSE
1. Logical representations have some restrictions and are challenging to work with.
2. Logical representation technique may not be very natural, and inference may
not be so efficient.
a. IS-A relation
(Inheritance) b.Kind-of-
relation
Statements:
a. Jerry is a cat.
b. Jerry is a mammal
3. Frame Representation
A frame is a record like structure which consists of a collection of attributes
and its values to describe an entity in the world. Frames are the AI data
structure which divides knowledge into substructures by representing
stereotypes situations. It consists of a collection of slots and slot values.
These slots may be of any type and sizes. Slots have names and values
which are called facets.
Example: 1
Let's take an example of a frame for a book
Slots Filters
Year 1996
Page 1152
Example 2:
Let's suppose we are taking an entity, Peter. Peter is a doctor as a
profession, and his age is 25, he lives in city London, and the country is
England. So following is the frame representation for this:
Slots Filter
Name Peter
Profession Doctor
Age 25
Weight 78
Advantages of frame representation:
In production rules agent checks for the condition and if the condition exists then production rule fires and
corresponding action is carried out. The condition part of the rule determines which rule may be applied
to a problem. And the action part carries out the associated problem-solving steps. This complete
process is called a recognize-act cycle.
The working memory contains the description of the current state of problems-
solving and rule can write knowledge to the working memory. This
knowledge match and may fire other rules.
If there is a new situation (state) generates, then multiple production rules will
be fired together, this is called conflict set. In this situation, the agent needs
to select a rule from these sets, and it is called a conflict resolution.
Example:
o IF (at bus stop AND bus arrives) THEN action (get into the bus)
o IF (on the bus AND paid AND empty seat) THEN action (sit down).
o IF (on bus AND unpaid) THEN action (pay charges).
o IF (bus arrives at destination) THEN action (get down from the bus).
Non-monotonic Reasoning is the process that changes its direction or values as the
knowledge base increases.
It is also known as NMR in Artificial Intelligence.
Non-monotonic Reasoning will increase or decrease based on the condition.
Since that Non-monotonic Reasoning depends on assumptions, It will change itself with
improving knowledge or facts.
Example:
o Consider a bowl of water, If we put it on the stove and turn the flame on it will
obviously boil hot and as we will turn off the flame it will cool down gradually.