## What is inference?

The inference is finding a conclusion or result based on any data, events, and any information. Usually, there will be a set of conditions and the conclusion is made, which satisfies all the given conditions are true. The conclusion is made according to the inference rules. Any artificial intelligence agent or an intelligent system uses the inference engine to find a better result or output. The work of the inference engine is to analyze the fact and figures based on all circumstances. After the analysis, the machine concludes this fact and gives it to the agent. The agent uses this conclusion for further processing and decision-making. Intelligent systems will generate new logic from existing ones based on the facts.

## Conditional statements in Inference

In proposition logic, new conditional statements can be generated from existing ones. Consider the conditional statement $A\to B$ with logical connective "implication". The expression says that if statement $A$ it is true then statement $B$ must be true. Now the three conditional statements, that can be generated from this are given below:

**Converse:**The converse statement is opposite to the implication. The expression for the converse is $B\to A$. This is read as "$BimpliesA$".**Contrapositive:**The contrapositive follow the negation rule. It is the negation of statements in converse . The negation of $A,B$is $~A,~B$. And the contrapositive expression is $~B\to ~A$ that represent "$if~Bthen~A$".**Inverse:**The inverse statement follow the negation of statements in implication . The expression of inverse is $~A\to ~B$.

## Inference in First-Order Logic

Inference in First-order logic (FOL) generates new sentences or facts from the existing ones. To understand the First-order logic inference rule, let's know some basic definitions.

**Substitution:** Substitution is an essential operation performed on formulas and terms. It comes in all inference systems in first-order logic. The term F[m/z], represents that a constant "m" can be substituted in place of variable "z".

**Equality**: In FOL, equality defines the same object can be represented by different terms. Let's see this with the help of an example. Given is an equality example of first-order logic(FOL).

**Example: Sister(Jenny)=Anna.**

In the above example, the object pointed by **Sister (Jenny)** is the same as the object pointed by **Anna**.

First-order logic consists of the following:-

- Relations-such as, Greater than, round, pink, prime, even, comes between
- Object-such as, Football game, colors, numbers, houses, people.
- Functions-such as, One more than, mother of, plus, sister of.

Basic components of FOL consist of the following:

## First-order logic inference rules for quantifier

**Universal Generalization**- It is a rule that states that if the premise is correct or valid for any element, say c in the universe of discourse, we have a conclusion as ∀ x Q(x). It is written as:-

$\raisebox{1ex}{$Q\left(c\right)$}\!\left/ \!\raisebox{-1ex}{$\forall \times Q\left(x\right)$}\right.$

This rule is used to represent that every element has a similar property.

**Example:-**

Q(c): "The nibble contains 4 bits".

So**, **∀ x Q(x) which means "All nibble contains 4 bits" will be valid.

**Universal Instantiation**

This is also known as Universal Elimination. This can be used multiple times to add new sentences.

In UI( Universal Instantiation), any sentence can be inferred by substituting a ground terminal for the variable.

According to the Rule, any sentence Q(c) can be obtained by replacing a ground word c from the $\forall xQ\left(x\right)$ for any item in the discourse universe, where c is the constant that comes in a domain $x$. It is written as:-

$\forall x\raisebox{1ex}{$Q\left(x\right)$}\!\left/ \!\raisebox{-1ex}{$Q\left(c\right)$}\right.$

**Example:-** "If every person likes chocolates" ∀x Q(x), we can infer that "harry likes chocolates" Q(c)

**Existential Instantiation**

This is also known as Existential elimination. It is a valid inference rule in first-order logic. It can be applied only once to restore the existential sentence.

This rule concludes that one can infer Q(c) from the equation or formula provided in ∃x Q(x) for a new symbol c which is a constant. It is written as:-

$\raisebox{1ex}{$\exists xQ\left(x\right)$}\!\left/ \!\raisebox{-1ex}{$Q\left(c\right)$}\right.$

**Example:-**

Consider, ∃x Crown(x)∧OnHead(x, harry)

So, from this, we can infer that Crown(K)∧OnHead(K, harry), as long as K doesn't exist in the knowledge base.

**Existential introduction**

This is also known as Existential Generalization. According to this rule, element c exists in the universe of discourse. Q is the property of the universe of discourse. So by this, it states that something exists in the universe that has the property Q. It is written as:-

$\raisebox{1ex}{$Q\left(c\right)$}\!\left/ \!\raisebox{-1ex}{$\exists x$}\right.Q\left(x\right)$

**Example:- **

Consider "Ron got good marks in English."

so, we can infer that, "Someone got good marks in English."

## Rules of inference

Inference Rules are the templates for generating authentic arguments. These Rules are enforced to develop proofs in AI. These proofs are usually the sequence of conclusions.

There are 7 types of inferences in Artificial intelligence:

**Modus Ponens**

The modes ponens is based on the implication $A\to B$ that is read by "$A\mathrm{implies}B$" which means that "if $A$ is true then $B$ must be true". The rule states that if A implies B and $A$ is true, then $B$ will be true. It is written as:

$\raisebox{1ex}{$A\to B,A$}\!\left/ \!\raisebox{-1ex}{$B$}\right.$

**Example:-**

**Statement-1:** "If the room is dirty then I will have clean up",

**Statement-2:** "The room is dirty", A**Conclusion:** "I will have to clean up.", B

**Modus Tollens**

Modus Tollens follow the negation rule. That means if $A\to B$ is true and $~B$ is true, then $~A$ will also be true. It is represented as:-

$\raisebox{1ex}{$A\to B,~Q$}\!\left/ \!\raisebox{-1ex}{$~A$}\right.$

**Example:-**

**Statement-1:** "If it rains then the clothes will be wet", $A\to B$ **Statement-2:** "Clothes are not wet, $~B$ **Conclusion:** Which infers that "it has not rained", $~A$

**Hypothetical Syllogism**

The hypothetical syllogism states that if $A\to B$ is true and $B\to C$ is true then $A\to C$ will definitely be true.

**Example:-**

**Statement-1:** If you have my car then you can take its key, **A→B****Statement-2:** If you can take its key then you can go to the palace, **B→C****Conclusion:** If you have my car then you can go to the palace, **A→C**

**Disjunctive Syllogism**

This states that if $A\vee B$ is true for a given condition, and $~A$ is true, then $B$ will be true. It is denotes as:

$\raisebox{1ex}{$A\vee B,\neg A$}\!\left/ \!\raisebox{-1ex}{$B$}\right.$

**Example:-**

**Statement-1**: This month is January or February, A∨B **Statement-2:** This month is not February, ¬A **Conclusion:** This month is January, B

**Addition**

In an addition rule, for the two statements $A,B$, If A is true then, $A\vee B$ will be true.

$\raisebox{1ex}{$A$}\!\left/ \!\raisebox{-1ex}{$A\vee B$}\right.$

**Example:-**

**Statement-1:** I have a banana milk shake, A**Statement-2:** I have mango juice, B**Conclusion:** I have banana milk shake and mango juice, (A∨B)

**Simplification**

If $A\wedge B$ is true, then $B$ or $A$ will also be true. It is denoted as:

$\raisebox{1ex}{$A\wedge B$}\!\left/ \!\raisebox{-1ex}{$A$}\right.or\raisebox{1ex}{$A\wedge B$}\!\left/ \!\raisebox{-1ex}{$B$}\right.$

**Example:-**

**Statement:** I will make a coffee and I will read a book.**Conclusion: **Therefore, I will read a book.

**Resolution**

According to this, if $A\vee B$ and $\neg A\wedge C$ is true, then $B\vee C$ will also be true. Is is denoted as:-

$\raisebox{1ex}{$A\vee B,\neg A\wedge C$}\!\left/ \!\raisebox{-1ex}{$B\vee C$}\right.$

**Example:-**

**Statement-1:** It is raining or I will make tea.**Statement-2:** It is not raining, or I will read a book.**Conclusion:** Therefore, I will make tea, or I will read a book.

## Context and Applications

This is an important topic in the professional test and for a variety of courses, particularly for-

- Master of Science in AI
- Master of Science in data science
- Graduation in Critical Reasoning

## Related Topics

- Statistical inference
- Proposition and supposition in inference
- Inference and syllogism

## Practice Problems

**Q1.** The rule of Universal Instantiation states that any sentence can be inferred by substituting a ground terminal for the variable.

- True
- False
- Partially true
- None

**Correct Answer:** 1

**Explanation:- ** In UI, any sentence can be inferred by substituting a ground terminal for the variable.

**Q2**. Which of the following is a valid inference rule which is used in inference in AI?

- Division
- Multiplication
- Addition
- None

**Correct Answer: **3.

**Explanation:-** Addition is one of the valid rules of inference. Apart from this, other inference rules are modus tollens, modus ponens, Simplification, etc.

**Q3.** Which one is not a component of FOL?

- Constant
- Quantifiers
- Terms
- Unification

**Correct Answer:** 4. Unification

**Explanation-** Unification is the way of detecting a substitute that makes two separate logical atomic expressions identical.

**Q4.** A primary type of Inferences is:

- Modus Ponens (Implication)
- Modus Tollens (Inverse)
- All
- Hypothetical Syllogism

**Correct Answer: **All

**Explanation:**- Modus ponens, Modus tollens, and Hypothetical Syllogism are all primary types of inferences in AI.

**Q5-** Which of the following is not an inference style?

- Resolution
- Forward Chaining
- Backward Chaining
- Modus Ponens

**Correct Answer-** Modus Ponens

**Explanation-** Modus ponens is one of the rules of inference and not an inference style.

### Want more help with your computer science homework?

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.

### Search. Solve. Succeed!

Study smarter access to millions of step-by step textbook solutions, our Q&A library, and AI powered Math Solver. Plus, you get 30 questions to ask an expert each month.

# Inference in AI Homework Questions from Fellow Students

Browse our recently answered Inference in AI homework questions.

### Search. Solve. Succeed!

Study smarter access to millions of step-by step textbook solutions, our Q&A library, and AI powered Math Solver. Plus, you get 30 questions to ask an expert each month.