Fundamentals of AI Unit-3 Notes
Fundamentals of AI Unit-3 Notes
UNIT-3
INFERENCE TECHNIQUES
Propositional Logic: The simplest kind of logic is propositional logic (PL), in which all statements
are made up of propositions. The term "Proposition" refers to a declarative statement that can be true
or false. It's a method of expressing knowledge in logical and mathematical terms.
Example:
It is Sunday.
3 + 3 = 7 (False proposition)
5 is a prime number.
Because it operates with 0 and 1, propositional logic is also known as Boolean logic.
In propositional logic, symbolic variables are used to express the logic, and any symbol can
be used to represent a proposition, such as A, B, C, P, Q, R, and so on.
Propositions can be true or untrue, but not both at the same time.
An object, relations or functions, and logical connectives make up propositional logic.
Logical operators are another name for these connectives.
The essential parts of propositional logic are propositions and connectives.
Connectives are logical operators that link two sentences together.
Tautology, commonly known as a legitimate sentence, is a proposition formula that is always
true.
Contradiction is a proposition formula that is always false.
Statements that are inquiries, demands, or opinions are not propositions, such as "Where is
Raj","How are you", and "What is your name" are not propositions.
The allowed sentences for knowledge representation are defined by the syntax of propositional logic.
Propositions are divided into two categories:
1) Atomic Propositions.
2) Compound propositions.
FUNDAMENTALS OF AI
Example:
Compound proposition: Simpler or atomic statements are combined with parenthesis and
logical connectives to form compound propositions.
Example:
Logical Connectives: Logical connectives are used to link two simpler ideas or to logically
represent a statement. With the use of logical connectives, we can form compound assertions.
There are five primary connectives, which are listed below:
1) Negation: A statement like ¬P is referred to as a negation of P. There are two types of
literals: positive and negative literals.
P = Rohan is intelligent,
Q = Rohan is hardworking. →P ∧ Q.
Because P denotes rain and Q denotes a wet street, the situation is written as P and Q
Truth Table:
We need to know the truth values of propositions in all feasible contexts in propositional logic.
With logical connectives, we can combine all possible combinations, and the representation of
these combinations in a tabular manner is known as a truth table. The truth table for all logical
connectives is as follows:
For Negation:
For Conjunction:
FUNDAMENTALS OF AI
For Disjunction:
For Implication:
For Biconditional:
You can build a proposition composing three propositions P, Q, and R. The truth table is made up
of 8Xn Tuples as we have taken three proposition symbols.
FUNDAMENTALS OF AI
Precedence of connectives:
Propositional connectors or logical operators, like arithmetic operators, have a precedence order.
When evaluating a propositional problem, this order should be followed. The following is a list of
the operator precedence order:
Logical equivalence:
One of the characteristics of propositional logic is logical equivalence. If and only if the truth
table's columns are equal, two assertions are said to be logically comparable. Let's take two
FUNDAMENTALS OF AI
propositions P and Q, so for logical equivalence, we can write it as P⇔Q. In below truth table we
can see that column for ¬P ∨ Q and P→Q, are identical hence P is Equivalent to P.
Properties of Operators:
Commutativity:
P ∧ Q= Q ∧ P, or
P ∨ Q = Q ∨ P.
Associativity:
(P ∧ Q) ∧ R = P ∧ (Q ∧ R),
(P ∨ Q) ∨ R= P ∨ (Q ∨ R).
Identity element:
P ∧ True = P,
P ∨ True= True.
Distributive:
P ∧ (Q ∨ R) = (P ∧ Q) ∨ (P ∧ R).
P ∨ (Q ∧ R) = (P ∨ Q) ∧ (P ∨ R).
DE Morgan's Law:
¬(P ∨ Q) = (¬ P) ∧ (¬Q).
Double-negation elimination:
¬(¬P) = P.
FUNDAMENTALS OF AI
This is not possible to represent relations like ALL, some, or none with propositional logic.
Example:
o All the girls are intelligent.
o Some apples are sweet.
The expressive power of propositional logic is restricted.
We can't explain propositions in propositional logic in terms of their qualities or logical
relationships.
Atomic sentences:
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.
We can represent atomic sentences as Predicate (term1, term2, ......, term n).
Example: Ravi and Ajay are brothers: => Brothers(Ravi, Ajay).
Complex Sentences:
Complex sentences are made by combining atomic sentences using connectives.
A quantifier is a language element which generates quantification, and quantification specifies the
quantity of specimen in the universe of discourse.
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:
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.
For all x
For each x
For every x.
Example:
Let a variable x which refers to a cat so all x can be represented in UOD as below:
It will be read as: There are all x where x is a man who drink coffee.
FUNDAMENTALS OF AI
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.
If x is a variable, then existential quantifier will be ∃x or ∃(x). And it will be read as:
Example:
It will be read as: There are some x where x is a boy who is intelligent.
Properties of Quantifiers:
And since there are all birds who fly so it will be represented as follows.
∀x bird(x) →fly(x).
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:
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:
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:
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)].
One way to represent knowledge is by using rules that express what must happen or what does
happen when certain conditions are met. Rules are usually expressed in the form of IF . . . THEN . . .
statements, such as: IF A THEN B This can be considered to have a similar logical meaning as the
following: A→B
A is called the antecedent and B is the consequent in this statement. In expressing rules, the
consequent usually takes the form of an action or a conclusion. In other words, the purpose of a rule
FUNDAMENTALS OF AI
is usually to tell a system (such as an expert system) what to do in certain circumstances, or what
conclusions to draw from a set of inputs about the current situation.
In general, a rule can have more than one antecedent, usually combined either by AND or by OR
(logically the same as the operators ∧ and ∨).
Similarly, a rule may have more than one consequent, which usually suggests that there are multiple
actions to be taken. In general, the antecedent of a rule compares an object with a possible value,
using an operator.
IF x > 3
IF name is “Bob”
IF weather is cold
Here, the objects being considered are x, name, and weather; the operators are “>” and “is”, and the
values are 3, “Bob,” and cold.
Note that an object is not necessarily an object in the real-world sense—the weather is not a real
world object, but rather a state or condition of the world.
An object in this sense is simply a variable that represents some physical object or state in the real
world.
IF name is “Bob”
This is an example of a recommendation rule, which takes a set of inputs and gives advice as a result.
The conclusion of the rule is actually an action, and the action takes the form of a recommendation to
Bob that he should wear a coat.
In some cases, the rules provide more definite actions such as “move left” or “close door,” in which
case the rules are being used to represent directives.
IF temperature is below 0
We can express the knowledge in various forms to the inference engine in the computer system to
solve the problems. There are two important representations of knowledge namely, procedural
knowledge and declarative knowledge. The basic difference between procedural and declarative
knowledge is that procedural knowledge gives the control information along with the knowledge,
whereas declarative knowledge just provides the knowledge but not the control information to
implement the knowledge.
Read through this article to find out more about procedural knowledge and declarative knowledge
and how they are different from each other.
What is Procedural Knowledge?
Procedural or imperative knowledge clarifies how to perform a certain task. It lays down the steps to
perform. Thus, the procedural knowledge provides the essential control information required to
implement the knowledge.
What is Declarative Knowledge?
Declarative or functional knowledge clarifies what to do to perform a certain task. It lays down the
function to perform. Thus, in the declarative knowledge, only the knowledge is provided but not the
control information to implement the knowledge. Thus, in order to use the declarative knowledge,
we have to add the declarative knowledge with a program which provides the control information.
Key Procedural Knowledge Declarative Knowledge
Meaning Procedural knowledge provides the Declarative knowledge provides the
knowledge of how a particular task can be basic knowledge about something.
accomplished.
Alternate name Procedural knowledge is also termed as Declarative knowledge is also
imperative knowledge. termed as functional knowledge.
Basis Procedural knowledge revolves around Declarative knowledge revolves
the "How" of the concept. around the "What" of the concept.
Communication Procedural knowledge is difficult to Declarative knowledge is easily
communicate. communicable.
Orientation Procedural knowledge is process- Declarative knowledge is data-
oriented. oriented.
Validation Validation is not very easy in procedural Validation is quite easy in
knowledge. declarative knowledge.
Debugging Debugging is not very easy in procedural Debugging is quite easy in
knowledge. declarative knowledge.
FUNDAMENTALS OF AI
Forward reasoning is a process in artificial intelligence that finds all the possible solutions of a problem
based on the initial data and facts. Thus, the forward reasoning is a data-driven task as it begins with
new data. The main objective of the forward reasoning in AI is to find a conclusion that would follow.
It uses an opportunistic type of approach.
Forward reasoning flows from incipient to the consequence. The inference engine searches the
knowledge base with the given information depending on the constraints. The precedence of these
constraints have to match the current state.
In forward reasoning, the first step is that the system is given one or more constraints. The rules are
then searched for in the knowledge base for every constraint. The rule that fulfils the condition is
selected. Also, every rule can generate a new condition from the conclusion which is obtained from
the invoked one. This new conditions can be added and are processed again.
The step ends if no new conditions exist. Hence, we can conclude that forward reasoning follows the
top-down approach.
Backward reasoning is the reverse process of the forward reasoning in which a goal or hypothesis is
selected and it is analyzed to find the initial data, facts, and rules. Therefore, the backward reasoning
is a goal driven task as it begins with conclusions or goals that are uncertain. The main objective of
the backward reasoning is to find the facts that support the conclusions.
Backward reasoning uses a conservative type of approach and flows from consequence to the incipient.
The system helps to choose a goal state and reasons in a backward direction. 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.
FUNDAMENTALS OF AI
The initial conditions are set such that they satisfy all the sub-goals. Also, the established states are
matched to the initial state provided. If the condition is fulfilled, the goal is the solution, otherwise the
goal is rejected. Therefore, backward reasoning follows bottom-up technique.
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.