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:
• Implication: It is one of the logical connectives which can be represented
as P → Q. It is a Boolean expression.
• 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.
• Contrapositive: The negation of converse is termed as contrapositive, and
it can be represented as ¬ Q → ¬ P.
• Inverse: The negation of implication is called inverse. It can be represented
Truth Table
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:
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
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
Formal logic
Formal logic is logic that deals with the form or logical structure of statements and
propositions and the logical implications and relations that exist or come about because of
those logical forms. In particular, formal logic is concerned with the forms that yield or
guarantee valid inferences from a premise or premises to a conclusion.
Generally two types of logic we used:
1. Propositional Logic
2. Predicate Logic
Propositional logic in Artificial intelligence
Propositional logic (PL) is the simplest form of logic where all the statements are made by
propositions. A proposition is a declarative statement which is either true or false. It is a
technique of knowledge representation in logical and mathematical form.
• Example:
1.a) It is Sunday.
2.b) The Sun rises from West (False proposition)
3.c) 3+3= 7(False proposition)
Following are some basic facts about
propositional logic:
• Propositional logic is also called Boolean logic as it works on 0 and 1.
• In propositional logic, we use symbolic variables to represent the logic,
and we can use any symbol for a representing a proposition, such A, B,
C, P, Q, R, etc.
• Propositions can be either true or false, but it cannot be both.
• The propositions and connectives are the basic elements of the
propositional logic.
• Connectives can be said as a logical operator which connects two
sentences.
• A proposition formula which is always true is called tautology, and it is
also called a valid sentence.
• A proposition formula which is always false is called Contradiction.
• Statements which are questions, commands, or opinions are not
propositions such as "Where is Rohini", "How are you", "What is
your name", are not propositions.
Syntax of propositional logic:
• The syntax of propositional logic defines the allowable sentences for
the knowledge representation. There are two types of Propositions:
1.Atomic Propositions
2.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.
1.a) 2+2 is 4, it is an atomic proposition as it is a true fact.
2.b) "The Sun is cold" is also a proposition as it is a false fact.
• Compound proposition: Compound propositions are constructed by
combining simpler or atomic propositions, using parenthesis and logical
connectives.
• Example:
1.a) "It is raining today, and street is wet."
• Logical Connectives:
• Logical connectives are used to connect two simpler propositions or representing a
sentence logically. We can create compound propositions with the help of logical
connectives. There are mainly five connectives, which are given as follows:
1.Negation: A sentence such as ¬ P is called negation of P. A literal can be either Positive
literal or negative literal.
2.Conjunction: A sentence which has ∧ connective such as, P ∧ Q is called a conjunction.
Example: Rohan is intelligent and hardworking. It can be written as,
P= Rohan is intelligent,
Q= Rohan is hardworking. → P∧ Q.
3.Disjunction: A sentence which has ∨ connective, such as P ∨ Q. is called disjunction,
where P and Q are the propositions.
Example: "Ritika is a doctor or Engineer",
Here P= Ritika is Doctor. Q= Ritika is an Engineer, so we can write it as P ∨ Q.
4.Implication: 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
5.Biconditional: A sentence such as P⇔ Q is a Biconditional sentence, example If I
am breathing, then I am alive
P= I am breathing, Q= I am alive, it can be represented as P ⇔ Q.
• Logical equivalence:
• Logical equivalence is one of the features of propositional logic.
Two propositions are said to be logically equivalent if and only if
the columns in the truth table are identical to each other.
Let's take two propositions A and B, so for logical equivalence, we
can write it as A⇔B. In below truth table we can see that column
for ¬A∨ B and A→B, are identical hence A is Equivalent to B
• 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)
• ¬ (P ∨ Q) = (¬ P) ∧ (¬Q).
• Double-negation elimination:
• Limitations of Propositional logic:
• We cannot represent relations like ALL, some, or none with
propositional logic. Example:
• All the girls are intelligent.
• Some apples are sweet.
• Propositional logic has limited expressive power.
• In propositional logic, we cannot describe statements in terms of
their properties or logical relationships.
• Some humans are intelligent", or
• "Sachin likes cricket."
• To represent the above statements, PL logic is not sufficient, so we required some
more powerful logic, such as first-order logic.
First-Order logic:
• First-order logic is another way of knowledge representation in artificial
intelligence. It is an extension to propositional logic.
• FOL is sufficiently expressive to represent the natural language statements in a
concise way.
• 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.
• 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:
• Objects: A, B, people, numbers, colors, wars, theories, squares, pits, wumpus, ......
• 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
• Function: Father of, best friend, third inning of, end of, ......
• First-order Predicate logic (FOPL) provides:
• Constants: a, b, dog33. Name a specific object.
• Variables: X, Y. Refer to an object without naming it.
• Functions: Mapping from objects to objects.
• Terms: Refer to objects
• Atomic Sentences: in(dad-of(X), food6) Can be true or false,
Correspond to propositional symbols P, Q.
• A well-formed formula (wff) is a sentence containing no “free” variables. That is,
all variables are “bound” by universal or existential quantifiers.
• ("x)P(x, y) has x bound as a universally quantified variable, but y is free.
Quantifiers
• Universal Quantifier, (for all, everyone, everything)
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.
Example : All man drink coffee.
∀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, (for some, at least one).
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.
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.
Knowledge-based systems typically have three
components, which include:
• Knowledge base: A knowledge base is an established
collection of information and resources. The system uses this
as its repository for the knowledge it uses to make decisions.
• Interface engine: An interface engine processes data
throughout the system. It acts similarly to a search engine
within the system by locating relevant information based on
the requests.
• User interface: The user interface is how the knowledge-
based system appears to users on the computer. This allows
users to interact with the system and submit requests.
knowledge-based system?
A knowledge-based system (KBS) is a type of computer system
that analyzes knowledge, data and other information from sources
to generate new knowledge. It uses AI concepts to solve problems,
which may be useful for assisting with human learning and making
decisions. These systems often have built-in problem-solving
capabilities that allow them to understand the context of the data
that they review and process and make informed decisions based
on the knowledge that they store.
Types of knowledge-based systems
Some example types of knowledge-based systems include the following:
• Blackboard systems. These systems enable multiple sources to input new information into a
system to help create solutions to potential problems. Blackboard systems rely heavily on
updates from human experts.
• Case-based systems. These systems use case-based reasoning to create solutions to a
problem. This system works by reviewing past data of similar situations.
• Classification systems. These systems analyze different data to understand its classification
status..
• Expert systems. These are a common type of KBS that simulate human expert decision-making
in a particular field. Expert systems provide solutions for problems as well as the explanations
behind them. For example, they could be used for calculations and predictions.
• Intelligent tutoring systems. These systems are designed to support human learning and
education. Intelligent tutoring systems provide users with instructions and give feedback based
on performance or questions.
• Medical diagnosis systems. These systems help diagnose patients by inputting data or having
a patient answer a series of questions. Based on the responses, the KBS identifies a diagnosis
and makes recommendations medical professionals can use to determine a patient's treatment.
• Rule-based systems. These systems rely on human-specified rules to analyze or change data
Blackboard Architecture
• Blackboard architecture, also known as the blackboard
system, is a problem-solving approach that utilizes a modular and
decentralized framework.
• Blackboard architecture is inspired by human experts
collaborating and solving difficult problems by sharing
information and contributing their expertise.
• The architecture is based on how people work together around a
blackboard – each person would sit around the board and a
problem would be written on it. When a person can solve the
problem, they would go to the board and add the partial solution
they know how to do. This process is repeated until a collective
solution is found.
Blackboard pattern:
• The blackboard pattern describes the overall flow of information and control within
the blackboard architecture. It typically involves the following steps:
1.Initialization: The blackboard is set up with the initial problem statement and any
available input data.
2.Activation: The controller selects and activates one or more knowledge sources
based on the current state of the problem and the available data on the blackboard.
3.Execution: The activated knowledge sources independently analyze the problem,
apply their specialized algorithms or techniques, and produce partial solutions or
hypotheses.
4.Conflict resolution: If multiple knowledge sources generate conflicting or
overlapping solutions, a conflict resolution mechanism is employed to reconcile the
differences and select the most appropriate solution(s).
5.Update: The knowledge sources update the blackboard with their outputs, such as
new constraints, proposed solutions, or intermediate results.
6.Iteration: The controller repeats the activation and execution steps until a
satisfactory solution is reached, convergence criteria are met, or a predefined time
limit is exceeded.
Uncertainty:
• Till now, we have learned knowledge representation using first-order logic
and propositional logic with certainty, which means we were sure about
the predicates. With this knowledge representation, we might write A→B,
which means if A is true then B is true, but consider a situation where we
are not sure about whether A is true or not then we cannot express this
statement, this situation is called uncertainty.
• So to represent uncertain knowledge, where we are not sure about the
predicates, we need uncertain reasoning or probabilistic reasoning.
Causes of uncertainty:
• Following are some leading causes of uncertainty to occur in the real
world.
1.Information occurred from unreliable sources.
2.Experimental Errors
3.Equipment fault
4.Temperature variation
Bayes' theorem:
• Bayes' theorem was named after the British
mathematician Thomas Bayes. The Bayesian inference is an
application of Bayes' theorem, which is fundamental to Bayesian
statistics.
• It is a way to calculate the value of P(B|A) with the knowledge of
P(A|B).
P(A/B) = P(B/A)*P(A)
P(B)
• P(A|B) is known as posterior, which we need to calculate, and it
will be read as Probability of hypothesis A when we have occurred
an evidence B.
• P(B|A) is called the likelihood, in which we consider that
hypothesis is true, then we calculate the probability of evidence.
• P(A) is called the prior probability, probability of hypothesis
Question: what is the probability that a patient
has diseases meningitis with a stiff neck?
A doctor is aware that disease meningitis causes a patient to have a
stiff neck, and it occurs 80% of the time. He is also aware of some more
facts, which are given as follows:
• The Known probability that a patient has meningitis disease is
1/30,000.
• The Known probability that a patient has a stiff neck is 2%.
• Let a be the proposition that patient has stiff neck and b be the
proposition that patient has meningitis. , so we can calculate the
following as:
• P(a|b) = 0.8
• P(b) = 1/30000
• P(a)= .02
P(b/a) = 0.8*1/30000 = 0.00133333
Bayesian Belief Network
• "A Bayesian network is a probabilistic graphical model which represents a set of
variables and their conditional dependencies using a directed acyclic graph."
• It is also called a Bayes network, belief network, decision network, or Bayesian
model.
• Bayesian Network can be used for building models from data and experts
opinions, and it consists of two parts:
• Directed Acyclic Graph
• Table of conditional probabilities.
• The generalized form of Bayesian network that represents and solve decision
problems under uncertain knowledge is known as an Influence diagram.
A Bayesian network graph is made up of nodes and Arcs (directed links), where:
A Node
Each node corresponds to the random variables, and a variable can be continuous or discrete.
D
Arc or directed arrows represent the causal relationship orBconditional probabilities between
random variables.
Arc C variables represented by the nodes of the
• In the above diagram, A, B, C, and D are random
network graph.
• If we are considering node B, which is connected with node A by a directed arrow, then node A
is called the parent of Node B.
• Node C is independent of node A.
Dempster-Shafer Theory OF Evidential Reasoning
• Dempster-Shafer Theory was given by Arthur P. Dempster in 1967 and his
student Glenn Shafer in 1976. This theory was released because of the following
reason:-
• Bayesian theory is only concerned about single evidence.
• Bayesian probability cannot describe ignorance.
• DST is an evidence theory, it combines all possible outcomes of the problem.
Hence it is used to solve problems where there may be a chance that a piece of
different evidence will lead to some different result.
• The uncertainty in this model is given by:-
• Consider all possible outcomes.
• Belief will lead to belief in some possibility by bringing out some evidence.
(What is this supposed to mean?)
• Plausibility will make evidence compatible with possible outcomes.
Example: Let us consider a room where four people are present, A, B, C, and D. Suddenly the lights
go out and when the lights come back, B has been stabbed in the back by a knife, leading to his
death. No one came into the room and no one left the room. We know that B has not committed
suicide. Now we have to find out who the murderer is.
• To solve these there are the following possibilities:
• Either {A} or {C} or {D} has killed him.
• Either {A, C} or {C, D} or {A, D} have killed him.
• Or the three of them have killed him i.e; {A, C, D}
• None of them have killed him {o} (let’s say).
• There will be possible evidence by which we can find the murderer by the measure of plausibility.
Using the above example we can say:
Set of possible conclusion (P): {p1, p2….pn}
where P is a set of possible conclusions and cannot be exhaustive, i.e. at least one (p) I must be
true.
(p)I must be mutually exclusive.
Power Set will contain 2n elements where n is the number of elements in the possible set.
For eg:-
If P = { a, b, c}, then Power set is given as
{o, {a}, {b}, {c}, {a, d}, {d ,c}, {a, c}, {a, c ,d }}= 23 elements.
CLASSIFICATION OF LEARNING
The process of learning may be of various types. One can develop learning taxonomies
based on the type of knowledge representation used (predicate calculus, rules, frames,
scripts etc), the type of knowledge learned (game playing, problem solving) .Generally
learning may be of two types like single agent learning and multi-agent learning
1. Single Agent Learning
Single agent learning involves improving the performance or increasing the knowledge
of a single agent. An improvement in performance or an increase in knowledge allows
the agent to solve past problems with better quality or efficiency. An increase in
knowledge may also allow the agent to solve new problems.
2. Rote Learning
It is the simplest form of learning. It requires the least amount of inference and is
accomplished by simply copying the knowledge in the same form that it will be used
directly into the knowledge base. It includes learning my imitation, simple
memorization and learning by being performed. For example we may use this type of
learning when we memorize multiplication tables. In this method we store the previous
computed values, for which we do not have for recomputed them later.
3. Learning from Instruction
This strategy also known as learning by being told or learning by direct instruction.
It requires the learning system to select and transform knowledge into a usable
form and then integrate it into the existing knowledge of the system. It is a more
complex form of learning. This learning technique requires more inference than
rote learning. It includes learning from teachers and learning by using books,
publications and other types of instructions.
4. Learning by Deduction
This process is accomplished through a sequence of deductive inference steps
using known facts. From the known facts, new facts or relationships are logically
derived. Using this strategy, the learning system derives new facts from existing
information or knowledge by employing deductive inference. It requires more
inferences than other techniques. The inference method used is a deductive type,
which is a valid form of inference. For example we can say x is the cousin of y if we
have the knowledge of x’s and y’s parents and the rules for cousin relationships.
5. Learning by Analogy
It is a process of learning a new concept or solution through the use of similar
known concepts or solutions. We make frequent use of analogical
learning. Example of learning by analogy may include the driving technique of
vehicles. If we know the driving procedure of a bike, then when we will drive a car
then some sort of previous learning procedures we may employ. Similarly for
driving a bus or truck, we may use the procedure for driving a car.
6. Learning from Examples
In this process of learning it includes the learning through various interactive and
innovative examples. This strategy, also called concept acquisition. It requires the
learning system to induce general class or concept descriptions from examples. For
solving a newly designed problem we may use its corresponding old examples.
7. Learning from Observations and Discovery
Using this strategy, the learning system must either induce class descriptions from
observing the environment or manipulate the environment to acquire class
descriptions or concepts. This is an unsupervised learning technique. It requires the
greatest amount of inferencing among all of the different forms of learning. From an
existing knowledge base, some new forms of discovery of knowledge may formed.
The learning discovery process is very important in the respect of constructing new
knowledge base.
8. Inductive Learning
Inductive learning is the system that tries to induce a general rule based on observed
instances. In other words, the system tries to infer an association between specific
inputs and outputs. In general, the input of the program is a set of training instance
where the output is a method of classifying subsequent instance. For example, the
input of the program may be color of types of fruits where the output may be the
types of fruits those are useful for protein. Induction method involves the learning by
examples, experimentation, observation and discovery. The search spaces
encountered in learning tend to be extremely large, even by the standards of search
9. Learning from Advices
In this process we can learn through taking advice from others. In our daily life, this
learning process is quite common. Right from our parents, relatives to our teachers, when
we start our educational life, we take various advices from others. All most all the initial
things and all type of knowledges we acquire through the advices of others. We know the
computer programs are written by programmers. When a programmer writes a computer
program he or she gives many instructions to computer to follow, the same way a teacher
gives his/her advice to his students. The computer follows the instructions given by the
programmer. Hence, a kind of learning takes place when computer runs a particular
program by taking advice from the creator of the program.
10. Learning by Clustering
This process is similar to the inductive learning. Clustering is a process of grouping or
classifying objects on the basis of a close association or shared characteristics. The
clustering process is essentially required in a learning process in which similarity patterns
are found among a group of objects. The program must discover for itself the natural
classes that exist for the objects, in addition to a method for classifying instances.