0% found this document useful (0 votes)
25 views24 pages

Ai Unit 2

Knowledge representation and reasoning (KRR) is a key aspect of artificial intelligence that enables machines to understand and utilize information about the real world to solve complex problems. It involves various types of knowledge, including declarative, procedural, meta-knowledge, and heuristic knowledge, and requires a well-structured knowledge representation system to ensure accuracy and efficiency. The document also discusses different approaches to knowledge representation, issues associated with it, and the role of logic and quantifiers in formalizing knowledge.

Uploaded by

forgaming9955
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)
25 views24 pages

Ai Unit 2

Knowledge representation and reasoning (KRR) is a key aspect of artificial intelligence that enables machines to understand and utilize information about the real world to solve complex problems. It involves various types of knowledge, including declarative, procedural, meta-knowledge, and heuristic knowledge, and requires a well-structured knowledge representation system to ensure accuracy and efficiency. The document also discusses different approaches to knowledge representation, issues associated with it, and the role of logic and quantifiers in formalizing knowledge.

Uploaded by

forgaming9955
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/ 24

Knowledge representation

What is knowledge representation?


Humans are best at understanding, reasoning, and interpreting knowledge. Human knows things,
which is knowledge and as per their knowledge they perform various actions in the real world. But
how machines do all these things comes under knowledge representation and reasoning. Hence
we can describe Knowledge representation as following:
o Knowledge representation and reasoning (KR, KRR) is the part of Artificial intelligence
which concerned with AI agents thinking and how thinking contributes to intelligent behavior of
agents.
o 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.
o It is also a way which describes how we can represent knowledge in artificial intelligence.
Knowledge representation is not just storing data into some database, but it also enables an intelligent
machine to learn from that knowledge and experiences so that it can behave intelligently like a
human.

What to Represent:
Following are the kind of knowledge which needs to be represented in AI systems:
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).
Knowledge: Knowledge is awareness or familiarity gained by experiences of facts, data, and
situations. Following are the types of knowledge in artificial intelligence:
Types of knowledge
Following are the various types of knowledge:
1. Declarative Knowledge:
o Declarative knowledge is to know about something.
o It includes concepts, facts, and objects.
o It is also called descriptive knowledge and expressed in declarative sentences.
o It is simpler than procedural language.
2. Procedural Knowledge
o It is also known as imperative knowledge.
o Procedural knowledge is a type of knowledge which is responsible for knowing how to do
something.
o It can be directly applied to any task.
o It includes rules, strategies, procedures, agendas, etc.
o Procedural knowledge depends on the task on which it can be applied.
3. Meta-knowledge:
o Knowledge about the other types of knowledge is called Meta-knowledge.
4. Heuristic knowledge:
o Heuristic knowledge is representing knowledge of some experts in a field 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.
5. Structural knowledge:
o Structural knowledge is basic knowledge to problem-solving.
o It describes relationships between various concepts such as kind of, part of, and grouping of
something.
o It describes the relationship that exists between concepts or objects.
The relation between knowledge and intelligence:
Knowledge of real-worlds plays a vital role in intelligence and same for creating artificial
intelligence. Knowledge plays an important role in demonstrating intelligent behavior in AI agents.
An agent is only able to accurately act on some input when he has some knowledge or experience
about that input.
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:
An Artificial intelligence system has the following components for displaying intelligent behavior:
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.

Approaches to knowledge representation:


There are mainly four approaches to knowledge representation, which are givenbelow:
1. Simple relational knowledge:
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.
Example: The following is the simple relational knowledge representation.
Player Weight Age

Player1 65 23
Player2 58 18

Player3 75 24
2. Inheritable knowledge:
o In the inheritable knowledge approach, all data must be stored into a hierarchy of classes.
o All classes should be arranged in a generalized form or a hierarchal manner.
o In this approach, we apply inheritance property.
o Elements inherit values from other members of a class.
o This approach contains inheritable knowledge which shows a relation between instance and
class, and it is called instance relation.
o Every individual frame can represent the collection of attributes and its value.
o In this approach, objects and values are represented in Boxed nodes.
o We use Arrows which point from objects to their values.
o Example:

3. Inferential knowledge:
o Inferential knowledge approach represents knowledge in the form of formal logics.
o This approach can be used to derive more facts.
o It guaranteed correctness.
o Example: Let's suppose there are two statements:
a. Marcus is a man
b. All men are mortal
Then it can represent as;

man(Marcus)
∀x = man (x) ----------> mortal (x)s
4. Procedural knowledge:
o Procedural knowledge approach uses small programs and codes which describes how to do
specific things, and how to proceed.
o In this approach, one important rule is used which is If-Then rule.
o In this knowledge, we can use various coding languages such as LISP language and Prolog
language.
o We can easily represent heuristic or domain-specific knowledge using this approach.
o But it is not necessary that we can represent all cases in this approach.

Requirements for knowledge Representation system:


A good knowledge representation system must possess the following properties.
1. 1. Representational Accuracy:
KR system should have the ability to represent all kind of required knowledge.
2. 2. Inferential Adequacy:
KR system should have ability to manipulate the representational structures to produce new
knowledge corresponding to existing structure.
3. 3. Inferential Efficiency:
The ability to direct the inferential knowledge mechanism into the most productive directions by
storing appropriate guides.
4. 4. Acquisitional efficiency- The ability to acquire the new knowledge easily using automatic
methods.

Issues in knowledge representation


The main objective of knowledge representation is to draw the conclusions from the
knowledge, but there are many issues associated with the use of knowledge
representation techniques.

Some of them are listed below:

Refer to the above diagram to refer to the following issues.

1. Important attributes
There are two attributes shown in the diagram, instance and isa. Since these
attributes support property of inheritance, they are of prime importance.

2. Relationships among attributes


Basically, the attributes used to describe objects are nothing but the entities.
However, the attributes of an object do not depend on the encoded specific
knowledge.

3. Choosing the granularity of representation


While deciding the granularity of representation, it is necessary to know the
following:

i. What are the primitives and at what level should the knowledge be represented?
ii. What should be the number (small or large) of low-level primitives or high-level
facts?

High-level facts may be insufficient to draw the conclusion while Low-level


primitives may require a lot of storage.
For example: Suppose that we are interested in following facts:
John spotted Alex.

Now, this could be represented as "Spotted (agent(John), object (Alex))"

Such a representation can make it easy to answer questions such as: Who spotted
Alex?

Suppose we want to know : "Did John see Sue?"


Given only one fact, user cannot discover that answer.

Hence, the user can add other facts, such as "Spotted (x, y) → saw (x, y)"

4. Representing sets of objects.


There are some properties of objects which satisfy the condition of a set together
but not as individual;

Example: Consider the assertion made in the sentences:


"There are more sheep than people in Australia", and "English speakers can be
found all over the world."
These facts can be described by including an assertion to the sets representing
people, sheep, and English.

5. Finding the right structure as needed


To describe a particular situation, it is always important to find the access of right
structure. This can be done by selecting an initial structure and then revising the
choice.

While selecting and reversing the right structure, it is necessary to solve following
problem statements. They include the process on how to:
 Select an initial appropriate structure.
 Fill the necessary details from the current situations.
 Determine a better structure if the initially selected structure is not
appropriate to fulfill other conditions.
 Find the solution if none of the available structures is appropriate.
 Create and remember a new structure for the given condition.
 There is no specific way to solve these problems, but some of the effective
knowledge representation techniques have the potential to solve them.

Logic Representation
Facts are the general statements that may be either True or False. Thus, logic can
be used to represent such simple facts.

To build a Logic-based representation:


 User has to define a set of primitive symbols along with the required
semantics.
 The symbols are assigned together to define legal sentences in the language
for representing TRUE facts.
 New logical statements are formed from the existing ones. The statements
which can be either TRUE or false but not both , are called propositions. A
declarative sentence expresses a statement with a proposition as content;
Example: The declarative "Cotton is white" expresses that Cotton is white. So, the
sentence "Cotton is white" is a true statement.

What is Propositional Logic (PL)?


 Propositional logic is a study of propositions.
 Each proposition has either a true or a false value but not both at a time.
 Propositions is represented by variables.
For example: Symbols 'p' and 'q' can be used to represent propositions.
There are two types of propositions:
1. Simple Preposition
2. compound Prepositions.

1. A simple preposition: It does not contain any other preposition.


For example: Rocky is a dog.

2. A compound preposition: It contains more than one prepositions.


For example: Surendra is a boy and he likes chocolate.

Connectives and the truth tables of compound prepositions are given


below:
Consider 'p' and 'q' are two prepositions then,

1. Negation (¬p) indicates the opposite of p.


Truth table for negation:
P ¬p
0 1
1 0

2. Conjunction (p ∧ q) indicates that p and q both and are enclosed in parenthesis.


So, p and q are called conjuncts .
Truth table for conjunction:
p q p∧q
0 0 0
0 1 0
1 0 0
1 1 1

3. Disjunction (p ∨ q) indicates that either p or q or both are enclosed in


parenthesis. Thus, p and q are called disjuncts.
Truth table for disjunction:
P q p∨q
0 0 0
0 1 1
1 0 1
1 1 1

4. Implication (p ⇒ q) consists of a pair of sentences separated by the ⇒ operator


and enclosed in parentheses. The sentence to the left of the operator is called as an
antecedent, and the sentence to the right is called as the consequent.
Truth table for implication:
P q p⇒q
0 0 1
0 1 1
1 0 0
1 1 1

5. Equivalence (p ⇔ q) is a combination of an implication and a reduction.


Truth table for Equivalence:
P q p⇔q
0 0 1
0 1 0
1 0 0
1 1 1

Predicate logic /First-Order logic:


o First-order logic is another way of knowledge representation in artificial intelligence. It is an
extension to propositional logic.
o FOL is sufficiently expressive to represent the natural language statements in a concise way.
o 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.
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:
a. Syntax
b. Semantics
Syntax of First-Order logic:
The syntax of FOL determines which collection of symbols is a logical expression in first-
order logic. The basic syntactic elements of first-order logic are symbols. We write
statements in short-hand notation in FOL.
Basic Elements of First-order logic:
Following are the basic elements of FOL syntax:
Constant 1, 2, A, John, Mumbai, cat,....

Variables x, y, z, a, b,....

Predicates Brother, Father, >,....

Function sqrt, LeftLegOf, ....

Connectives ∧, ∨, ¬, ⇒, ⇔

Equality ==

Quantifier ∀, ∃

Atomic sentences:
o Atomic sentences are the most basic sentences of first-order logic. These sentences are
formed from a predicate symbol followed by a parenthesis with a sequence of terms.
o We can represent atomic sentences as Predicate (term1, term2, ......, term n).
Example: Ravi and Ajay are brothers: => Brothers(Ravi, Ajay).
Chinky is a cat: => cat (Chinky).
Complex Sentences:
o Complex sentences are made by combining atomic sentences using connectives.
First-order logic statements can be divided into two parts:
o Subject: Subject is the main part of the statement.
o Predicate: A predicate can be defined as a relation, which binds two atoms together in a
statement.
Consider the statement: "x is an integer.", it consists of two parts, the first part x is the
subject of the statement and second part "is an integer," is known as a predicate.

Quantifiers in First-order logic:


o A quantifier is a language element which generates quantification, and quantification
specifies the quantity of specimen in the universe of discourse.
o These are the symbols that permit to determine or identify the range and scope of the
variable in the logical expression. There are two types of quantifier:
a. Universal Quantifier, (for all, everyone, everything)
b. Existential quantifier, (for some, at least one).
Universal Quantifier:
Universal quantifier is a symbol of logical representation, which specifies that the statement
within its range is true for everything or every instance of a particular thing.
The Universal quantifier is represented by a symbol ∀, which resembles an inverted A.
Note: In universal quantifier we use implication "→".
If x is a variable, then ∀x is read as:
o For all x
o For each x
o For every x.
Example:
All man drink coffee.
Let a variable x which refers to a cat so all x can be represented in UOD as below:

∀x man(x) → drink (x, coffee).


It will be read as: There are all x where x is a man who drink coffee.
Existential Quantifier:
Existential quantifiers are the type of quantifiers, which express that the statement within its
scope is true for at least one instance of something.
It is denoted by the logical operator ∃, which resembles as inverted E. When it is used with a
predicate variable then it is called as an existential quantifier.
Note: In Existential quantifier we always use AND or Conjunction symbol ( ∧).
If x is a variable, then existential quantifier will be ∃x or ∃(x). And it will be read as:
o There exists a 'x.'
o For some 'x.'
o For at least one 'x.'
Example:
Some boys are intelligent.

∃x: boys(x) ∧ intelligent(x)


It will be read as: There are some x where x is a boy who is intelligent.
Points to remember:
o The main connective for universal quantifier ∀ is implication →.
o The main connective for existential quantifier ∃ is and ∧.

Properties of Quantifiers:
o In universal quantifier, ∀x∀y is similar to ∀y∀x.
o In Existential quantifier, ∃x∃y is similar to ∃y∃x.
o ∃x∀y is not similar to ∀y∃x.
Some Examples of FOL using quantifier:
1. All birds fly.
In this question the predicate is "fly(bird)."
And since there are all birds who fly so it will be represented as follows.
∀x bird(x) →fly(x).
2. Every man respects his parent.
In this question, the predicate is "respect(x, y)," where x=man, and y= parent.
Since there is every man so will use ∀, and it will be represented as follows:
∀x man(x) → respects (x, parent).
3. Some boys play cricket.
In this question, the predicate is "play(x, y)," where x= boys, and y= game. Since there are
some boys so we will use ∃, and it will be represented as:
∃x boys(x) → play(x, cricket).
4. Not all students like both Mathematics and Science.
In this question, the predicate is "like(x, y)," where x= student, and y= subject.
Since there are not all students, so we will use ∀ with negation, so following representation
for this:
¬∀ (x) [ student(x) → like(x, Mathematics) ∧ like(x, Science)].
5. Only one student failed in Mathematics.
In this question, the predicate is "failed(x, y)," where x= student, and y= subject.
Since there is only one student who failed in Mathematics, so we will use following
representation for this:
∃(x) [ student(x) → failed (x, Mathematics) ∧∀ (y) [¬(x==y) ∧ student(y) →
¬failed (x, Mathematics)].
Free and Bound Variables:
The quantifiers interact with variables which appear in a suitable way. There are two types of
variables in First-order logic which are given below:
Free Variable: A variable is said to be a free variable in a formula if it occurs outside the
scope of the quantifier.
Example: ∀x ∃(y)[P (x, y, z)], where z is a free variable.
Bound Variable: A variable is said to be a bound variable in a formula if it occurs within the
scope of the quantifier.
Example: ∀x [A (x) B( y)], here x and y are the bound variables.
Difference between Propositional Logic and Predicate Logic
Logical reasoning forms the basis for a huge domain of computer science and mathematics.
They help in establishing mathematical arguments, valid or invalid.
1. Propositional Logic :
A proposition is basically a declarative sentence that has a truth value. Truth value can either
be true or false, but it needs to be assigned any of the two values and not be ambiguous. The
purpose of using propositional logic is to analyze a statement, individually or compositely.
For example :
The following statements :

1. If x is real, then x2 > 0


2. What is your name?
3. (a+b)2 = 100
4. This statement is false.
5. This statement is true.
Are not propositions because they do not have a truth value. They are ambiguous.
But the following statements :

1. (a+b)2 = a2 + 2ab + b2
2. If x is real, then x2 >= 0
3. If x is real, then x2 < 0
4. The sun rises in the east.
5. The sun rises in the west.
Are all propositions because they have a specific truth value, true or false.
The branch of logic that deals with proposition is propositional logic.
2. Predicate Logic :
Predicates are properties, additional information to better express the subject of the sentence.
A quantified predicate is a proposition , that is, when you assign values to a predicate with
variables it can be made a proposition.
For example :
In P(x) : x>5, x is the subject or the variable and ‘>5’ is the predicate.
P(7) : 7>5 is a proposition where we are assigning values to the variable x, and it has a truth
value, i.e. True.
The set of values that the variables of the predicate can assume is called the Universe or
Domain of Discourse or Domain of Predicate.
Difference between Propositional Logic and Predicate Logic :

Propositional Logic Predicate Logic

Predicate logic is an expression consisting of


Propositional logic is the logic that deals variables with a specified domain. It consists
with a collection of declarative statements of objects, relations and functions between the
1
which have a truth value, true or false. objects.

It is the basic and most widely used logic. It is an extension of propositional logic
2
Also known as Boolean logic. covering predicates and quantification.

A proposition has a specific truth value, A predicate’s truth value depends on the
3
either true or false. variables’ value.

Predicate logic helps analyze the scope of the


subject over the predicate. There are three
quantifiers : Universal Quantifier (∀) depicts
for all, Existential Quantifier (∃) depicting
Scope analysis is not done in propositional there exists some and Uniqueness Quantifier
4
logic. (∃!) depicting exactly one.

Propositions are combined with Logical


Operators or Logical Connectives like
Negation(¬), Disjunction(∨),
Conjunction(∧), Exclusive OR(⊕),
Implication(⇒), Bi-Conditional or Double Predicate Logic adds by introducing
5
Implication(⇔). quantifiers to the existing proposition.

6
It is a more generalized representation. It is a more specialized representation.

It can deal with set of entities with the help of


7
It cannot deal with sets of entities. quantifiers.
Resolution in FOL
Resolution
Resolution is a theorem proving technique that proceeds by building refutation proofs, i.e.,
proofs by contradictions. It was invented by a Mathematician John Alan Robinson in the year
1965.
Resolution is used, if there are various statements are given, and we need to prove a
conclusion of those statements. Unification is a key concept in proofs by resolutions.
Resolution is a single inference rule which can efficiently operate on the conjunctive normal
form or clausal form.
Clause: Disjunction of literals (an atomic sentence) is called a clause. It is also known as a
unit clause.
Conjunctive Normal Form: A sentence represented as a conjunction of clauses is said to
be conjunctive normal form or CNF.
The resolution inference rule:
The resolution rule for first-order logic is simply a lifted version of the propositional rule.
Resolution can resolve two clauses if they contain complementary literals, which are
assumed to be standardized apart so that they share no variables.

Where li and mj are complementary literals.


This rule is also called the binary resolution rule because it only resolves exactly two
literals.
Example:
We can resolve two clauses which are given below:
[Animal (g(x) V Loves (f(x), x)] and [¬ Loves(a, b) V ¬Kills(a, b)]
Where two complimentary literals are: Loves (f(x), x) and ¬ Loves (a, b)
These literals can be unified with unifier θ= [a/f(x), and b/x] , and it will generate a
resolvent clause:
[Animal (g(x) V ¬ Kills(f(x), x)].
Steps for Resolution:
1. Conversion of facts into first-order logic.
2. Convert FOL statements into CNF
3. Negate the statement which needs to prove (proof by contradiction)
4. Draw resolution graph (unification).
To better understand all the above steps, we will take an example in which we will apply
resolution.
Example:
a. John likes all kind of food.
b. Apple and vegetable are food
c. Anything anyone eats and not killed is food.
d. Anil eats peanuts and still alive
e. Harry eats everything that Anil eats.
Prove by resolution that:
f. John likes peanuts.
Step-1: Conversion of Facts into FOL
In the first step we will convert all the given statements into its first order logic.

Step-2: Conversion of FOL into CNF


In First order logic resolution, it is required to convert the FOL into CNF as CNF form makes
easier for resolution proofs.
o Eliminate all implication (→) and rewrite
a. ∀x ¬ food(x) V likes(John, x)
b. food(Apple) Λ food(vegetables)
c. ∀x ∀y ¬ [eats(x, y) Λ ¬ killed(x)] V food(y)
d. eats (Anil, Peanuts) Λ alive(Anil)
e. ∀x ¬ eats(Anil, x) V eats(Harry, x)
f. ∀x¬ [¬ killed(x) ] V alive(x)
g. ∀x ¬ alive(x) V ¬ killed(x)
h. likes(John, Peanuts).
o Move negation (¬)inwards and rewrite
. ∀x ¬ food(x) V likes(John, x)
a. food(Apple) Λ food(vegetables)
b. ∀x ∀y ¬ eats(x, y) V killed(x) V food(y)
c. eats (Anil, Peanuts) Λ alive(Anil)
d. ∀x ¬ eats(Anil, x) V eats(Harry, x)
e. ∀x ¬killed(x) ] V alive(x)
f. ∀x ¬ alive(x) V ¬ killed(x)
g. likes(John, Peanuts).
o Rename variables or standardize variables
. ∀x ¬ food(x) V likes(John, x)
a. food(Apple) Λ food(vegetables)
b. ∀y ∀z ¬ eats(y, z) V killed(y) V food(z)
c. eats (Anil, Peanuts) Λ alive(Anil)
d. ∀w¬ eats(Anil, w) V eats(Harry, w)
e. ∀g ¬killed(g) ] V alive(g)
f. ∀k ¬ alive(k) V ¬ killed(k)
g. likes(John, Peanuts).
o Eliminate existential instantiation quantifier by elimination.
In this step, we will eliminate existential quantifier ∃, and this process is known as Skolemization. But
in this example problem since there is no existential quantifier so all the statements will remain same
in this step.
o Drop Universal quantifiers.
In this step we will drop all universal quantifier since all the statements are not implicitly quantified
so we don't need it.
. ¬ food(x) V likes(John, x)
a. food(Apple)
b. food(vegetables)
c. ¬ eats(y, z) V killed(y) V food(z)
d. eats (Anil, Peanuts)
e. alive(Anil)
f. ¬ eats(Anil, w) V eats(Harry, w)
g. killed(g) V alive(g)
h. ¬ alive(k) V ¬ killed(k)
i. likes(John, Peanuts).
Distribute conjunction ∧ over disjunction ¬.
This step will not make any change in this problem.
Step-3: Negate the statement to be proved
In this statement, we will apply negation to the conclusion statements, which will be written
as ¬likes(John, Peanuts)
Step-4: Draw Resolution graph:
Now in this step, we will solve the problem by resolution tree using substitution. For the
above problem, it will be given as follows:

Hence the negation of the conclusion has been proved as a complete contradiction with the
given set of statements.
Explanation of Resolution graph:
o In the first step of resolution graph, ¬likes(John, Peanuts) , and likes(John, x) get
resolved(canceled) by substitution of {Peanuts/x}, and we are left with ¬ food(Peanuts)
o In the second step of the resolution graph, ¬ food(Peanuts) , and food(z) get resolved
(canceled) by substitution of { Peanuts/z}, and we are left with ¬ eats(y, Peanuts) V killed(y) .
o In the third step of the resolution graph, ¬ eats(y, Peanuts) and eats (Anil, Peanuts) get
resolved by substitution {Anil/y}, and we are left with Killed(Anil) .
o In the fourth step of the resolution graph, Killed(Anil) and ¬ killed(k) get resolve by
substitution {Anil/k}, and we are left with ¬ alive(Anil) .
o In the last step of the resolution graph ¬ alive(Anil) and alive(Anil) get resolved.

Deductive reasoning:
o Deductive reasoning is deducing new information from logically related known
information. It is the form of valid reasoning, which means the argument's conclusion must
be true when the premises are true.
o Deductive reasoning is a type of propositional logic in AI, and it requires various rules
and facts. It is sometimes referred to as top-down reasoning, and contradictory to inductive
reasoning.
o In deductive reasoning, the truth of the premises guarantees the truth of the
conclusion.
o Deductive reasoning mostly starts from the general premises to the specific
conclusion, which can be explained as below example.
o Example:
o Premise-1: All the human eats veggies
o Premise-2: Suresh is human.
o Conclusion: Suresh eats veggies.
o The general process of deductive reasoning is given below:

Difference between Inductive and Deductive reasoning

Reasoning in artificial intelligence has two important forms, Inductive reasoning, and
Deductive reasoning. Both reasoning forms have premises and conclusions, but both
reasoning are contradictory to each other. Following is a list for comparison between
inductive and deductive reasoning:

o Deductive reasoning uses available facts, information, or knowledge to deduce a valid


conclusion, whereas inductive reasoning involves making a generalization from specific facts,
and observations.
o Deductive reasoning uses a top-down approach, whereas inductive reasoning uses a
bottom-up approach.
o Deductive reasoning moves from generalized statement to a valid conclusion,
whereas Inductive reasoning moves from specific observation to a generalization.
o In deductive reasoning, the conclusions are certain, whereas, in Inductive reasoning,
the conclusions are probabilistic.
o Deductive arguments can be valid or invalid, which means if premises are true, the
conclusion must be true, whereas inductive argument can be strong or weak, which means
conclusion may be false even if premises are true.

The differences between inductive and deductive can be explained using the below diagram
on the basis of arguments:

Comparison Chart:

Basis for Deductive Reasoning Inductive Reasoning


comparison

Definition Deductive reasoning is the form of Inductive reasoning arrives at a


valid reasoning, to deduce new conclusion by the process of
information or conclusion from generalization using specific facts or
known related facts and data.
information.

Approach Deductive reasoning follows a top- Inductive reasoning follows a bottom-up


down approach. approach.

Starts from Deductive reasoning starts from Inductive reasoning starts from the
Premises. Conclusion.

Validity In deductive reasoning conclusion In inductive reasoning, the truth of


must be true if the premises are premises does not guarantee the truth of
true. conclusions.
Usage Use of deductive reasoning is Use of inductive reasoning is fast and
difficult, as we need facts which easy, as we need evidence instead of true
must be true. facts. We often use it in our daily life.

Process Theory→ hypothesis→ Observations-


patterns→confirmation. →patterns→hypothesis→Theory.

Argument In deductive reasoning, arguments In inductive reasoning, arguments may


may be valid or invalid. be weak or strong.

Structure Deductive reasoning reaches from Inductive reasoning reaches from specific
general facts to specific facts. facts to general facts.

Automated theorem proving


Automated theorem proving (also known as ATP or automated deduction) is a subfield
of automated reasoning and mathematical logic dealing with proving mathematical
theorems by computer programs. Automated reasoning over mathematical proof was a
major impetus for the development of computer science.

Inference:
In artificial intelligence, we need intelligent computers which can create new logic from old
logic or by evidence, so generating the conclusions from evidence and facts is termed as
Inference.
Inference rules:
Inference rules are the templates for generating valid arguments. 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.
In inference rules, the implication among all the connectives plays an important role.
Following are some terminologies related to inference rules:
o Implication: It is one of the logical connectives which can be represented as P → Q. It
is a Boolean expression.
o 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.
o Contrapositive: The negation of converse is termed as contrapositive, and it can be
represented as ¬ Q → ¬ P.
o Inverse: The negation of implication is called inverse. It can be represented as ¬ P →
¬ Q.
From the above term some of the compound statements are equivalent to each other, which
we can prove using truth table:
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.
Types of Inference rules:
1. Modus Ponens:
The Modus Ponens rule is one of the most important rules of inference, and it states that if P
and P → Q is true, then we can infer that Q will be true. It can be represented as:

Example:
Statement-1: "If I am sleepy then I go to bed" ==> P→ Q
Statement-2: "I am sleepy" ==> P
Conclusion: "I go to bed." ==> Q.
Hence, we can say that, if P→ Q is true and P is true then Q will be true.
Proof by Truth table:

2. Modus Tollens:
The Modus Tollens rule state that if P→ Q is true and ¬ Q is true, then ¬ P will also true. It
can be represented as:

Statement-1: "If I am sleepy then I go to bed" ==> P→ Q


Statement-2: "I do not go to the bed."==> ~Q
Statement-3: Which infers that "I am not sleepy" => ~P
Proof by Truth table:

3. Hypothetical Syllogism:
The Hypothetical Syllogism rule state that if P→R is true whenever P→Q is true, and Q→R is
true. It can be represented as the following notation:
Example:
Statement-1: If you have my home key then you can unlock my home. P→Q
Statement-2: If you can unlock my home then you can take my money. Q→R
Conclusion: If you have my home key then you can take my money. P→R
Proof by truth table:

4. Disjunctive Syllogism:
The Disjunctive syllogism rule state that if P∨Q is true, and ¬P is true, then Q will be true. It
can be represented as:

Example:
Statement-1: Today is Sunday or Monday. ==>P∨Q
Statement-2: Today is not Sunday. ==> ¬P
Conclusion: Today is Monday. ==> Q
Proof by truth-table:

5. Addition:
The Addition rule is one the common inference rule, and it states that If P is true, then P∨Q
will be true.

Example:
Statement: I have a vanilla ice-cream. ==> P
Statement-2: I have Chocolate ice-cream.
Conclusion: I have vanilla or chocolate ice-cream. ==> (P∨Q)
Proof by Truth-Table:
6. Simplification:
The simplification rule state that if P∧ Q is true, then Q or P will also be true. It can be
represented as:

Proof by Truth-Table:

7. Resolution:
The Resolution rule state that if P∨Q and ¬ P∧R is true, then Q∨R will also be true. It can be
represented as

Proof by Truth-Table:

What is AI Inference?
AI Inference is achieved through an “inference engine” that applies logical
rules to the knowledge base to evaluate and analyze new information. In the
process of machine learning, there are two phases. First, is the training
phase where intelligence is developed by recording, storing, and labeling
information. If, for example, you're training a machine to identify cars, the
machine-learning algorithm is fed with many images of different cars the
machine can later refer to. Second, is the inference phase where the
machine uses the intelligence gathered and stored in phase one to
understand new data. In this phase, the machine can use inference to
identify and categorize new images as “cars" despite having never seen
them before. In more complex scenarios, this inference learning can be used
to augment human decision making.

Why is AI Inference Important?


AI inference is the essential component of artificial intelligence. Without
inference, a machine would not have the ability to learn. While machine
learning can run on any type of processor, the specific computing
capabilities required has become increasingly important. Whether the focus
is on highly-complex computing, high performance, or high efficiency,
computing architectures such as Arm CPUs, GPUs and NPUs—all tailored to
meet specific workload requirements—are available. For maximum reliability,
energy efficiency, privacy and to minimize latency, AI inference is
increasingly being applied at the point and time the data is being sensed,
captured or created—at the “edge of input.”
5. Monotonic Reasoning:
In monotonic reasoning, once the conclusion is taken, then it will remain the same even if we
add some other information to existing information in our knowledge base. In monotonic
reasoning, adding knowledge does not decrease the set of prepositions that can be derived.
To solve monotonic problems, we can derive the valid conclusion from the available facts
only, and it will not be affected by new facts.
Monotonic reasoning is not useful for the real-time systems, as in real time, facts get
changed, so we cannot use monotonic reasoning.
Monotonic reasoning is used in conventional reasoning systems, and a logic-based system is
monotonic.
Any theorem proving is an example of monotonic reasoning.
Example:
o Earth revolves around the Sun.
It is a true fact, and it cannot be changed even if we add another sentence in knowledge
base like, "The moon revolves around the earth" Or "Earth is not round," etc.
Advantages of Monotonic Reasoning:
o In monotonic reasoning, each old proof will always remain valid.
o If we deduce some facts from available facts, then it will remain valid for always.
Disadvantages of Monotonic Reasoning:
o We cannot represent the real world scenarios using Monotonic reasoning.
o Hypothesis knowledge cannot be expressed with monotonic reasoning, which means
facts should be true.
o Since we can only derive conclusions from the old proofs, so new knowledge from the
real world cannot be added.
6. Non-monotonic Reasoning
In Non-monotonic reasoning, some conclusions may be invalidated if we add some more
information to our knowledge base.
Logic will be said as non-monotonic if some conclusions can be invalidated by adding more
knowledge into our knowledge base.
Non-monotonic reasoning deals with incomplete and uncertain models.
"Human perceptions for various things in daily life, "is a general example of non-monotonic
reasoning.
Example: Let suppose the knowledge base contains the following knowledge:
o Birds can fly
o Penguins cannot fly
o Pitty is a bird
So from the above sentences, we can conclude that Pitty can fly.
However, if we add one another sentence into knowledge base "Pitty is a penguin", which
concludes "Pitty cannot fly", so it invalidates the above conclusion.
Advantages of Non-monotonic reasoning:
o For real-world systems such as Robot navigation, we can use non-monotonic
reasoning.
o In Non-monotonic reasoning, we can choose probabilistic facts or can make
assumptions.
Disadvantages of Non-monotonic Reasoning:
o In non-monotonic reasoning, the old facts may be invalidated by adding new
sentences.
o It cannot be used for theorem proving.

You might also like