AI Ch3
AI Ch3
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.
Types of knowledge
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.
o First-order logic (like natural language) does not only assume that the world
contains facts like propositional logic but also assumes the following things in the
world:
o Objects: A, B, people, numbers, colors, wars, theories, squares, pits, wumpus,
......
o 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
o Function: Father of, best friend, third inning of, end of, ......
o As a natural language, first-order logic also has two main parts:
o Syntax
o Semantics
Variables x, y, z, a, b,....
Connectives ∧, ∨, ¬, ⇒, ⇔
Equality ==
Quantifier ∀, ∃
Quantifier:
Existential Quantifier:
Then it is denoted as ∃x p(x) and read as "There exists at least one value in the
universe of variable x such that p(x) is true.
The quantifier ∃ is called the existential quantifier.
There are several ways to write a proposition, with an existential quantifier, i.e.,
(∃x∈A)p(x) or ∃x∈A such that p (x) or (∃x)p(x) or p(x) is true for some x ∈A.
Universal Quantifier:
If p(x) is a proposition over the universe U. Then it is denoted as ∀x,p(x) and read as
"For every x∈U,p(x) is true." The quantifier ∀ is called the Universal Quantifier.
2. (∃x∈U) (x+6=25)
3. ~( ∃ x p(x)∨∀ y q(y)
The first step in the backward reasoning is that the goal state and rules are selected.
Then, sub-goals are made from the selected rule, which need to be satisfied for the
goal state to be true.
Backward reasoning is also known as a decision-driven or goal-driven inference
technique because the system selects a goal state and reasons in the backward
direction.
The objective is to find a conclusion that The objective is to find the facts that
3.
would follow. support the conclusions.
Forward reasoning begins with the initial Backward reasoning begins with some
6.
facts. goal (hypothesis).
7. Forward reasoning tests all the rules. Backward reasons tests some rules.
In the forward reasoning, all the data is In the backward reasoning, the data is
10.
available. acquired on demand.
Definition -
DHAVAL R.PATEL Page 9
AI Unit– 3 Knowledge Representation
“Unification is a process in which two terms, which may include variables, constants,
and functions, are made identical by finding a substitution for the variables. A
substitution is a mapping of variables to terms. For instance, if we have a variable
(X) and we substitute it with a constant (a), the variable (X) is unified with (a).”
Basic Terminology -
Unification Algorithm -
Example 1:
The resulting substitution is: {X/b, Y/h, Z/a}. Applying this substitution to both expressions
gives us:
Example 2:
Let's consider a more complex example involving predicates and quantifiers in first-order
logic:
The resulting substitution is: {x/Z, Y/a}. Applying this substitution to both expressions
gives us:
Given two clauses that contain complementary literals (a literal and its negation),
resolution allows us to derive a new clause that is a result of resolving the two
clauses by eliminating the complementary literals.
Example 1:
Let's consider a simple example with propositional logic. Suppose we want to prove
that the following statements are contradictory:
P OR Q
NOT P OR R
NOT Q OR R
Example 2:
Let's consider a more complex example using first-order logic. Suppose we want to
prove the statement: "All humans are mortal."
We'll assume that our knowledge base includes the following premises:
A. Human(Socrates)
B. NOT Mortal(Socrates)
Logic Programming uses facts and rules for solving the problem. That is why they
are called the building blocks of Logic Programming. A goal needs to be specified for
every program in logic programming. To understand how a problem can be solved
in logic programming, we need to know about the building blocks − Facts and Rules
−
Following is the syntax of rule –
A∶− B1,B2,...,Bn.
This can be read as, for every X and Y, if X is the father of Y and Y is an ancestor of Z,
X is the ancestor of Z. For every X and Y, X is the ancestor of Z, if X is the father of Y
and Y is an ancestor of Z.
add = 'add'
mul = 'mul'
Both addition and multiplication are communicative processes. Hence, we need to specify it
and this can be done as follows −
fact(commutative, mul)
fact(commutative, add)
fact(associative, mul)
fact(associative, add)
a, b = var('a'), var('b')
We need to match the expression with the original pattern. We have the following original
pattern, which is basically (5+a)*b −
We have the following two expressions to match with the original pattern −
((3,2))
()