# Rules of Inference in Artificial intelligence

In this page we will learn about Rules of Inference in Artificial intelligence, Rules of Inference in Artificial intelligence, Types of Inference rules, Modus Ponens, Modus Tollens, Hypothetical Syllogism, Disjunctive Syllogism, Addition, Simplification, Resolution.

## Inference:

We need intelligent computers in artificial intelligence to construct new logic from old logic or evidence, therefore inference is the process of drawing conclusions from data and facts.

## Inference rules:

The templates for creating valid arguments are known as inference rules. In artificial intelligence, inference rules are used to generate proofs, and a proof is a series of conclusions that leads to the intended outcome. The implication among all the connectives is vital in inference rules. Some terms relating to inference rules are as follows:

1. Implication: It's one of the logical connectives, denoted by the letters P → Q. It's a Boolean expression, to be precise.
2. Converse: The converse of implication is when the right-hand side statement is applied to the left-hand side, and vice versa. It is denoted by the letters Q → P.
3. Contrapositive: Contrapositive is the negation of converse, and it can be expressed as ¬ Q → ¬ P.
4. Inverse: Inverse is the antithesis of implication. ¬ P → ¬ Q can be used to symbolize it.

Some of the compound statements in the above term are equivalent to each other, which we can verify using the truth table:

P Q P → Q Q → P ¬ Q → ¬ P ¬ P → ¬ Q
T T T T T T
T F F T F T
F T T F T F
F F T T T T

As a result 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:

One of the most essential laws of inference is the Modus Ponens rule, which asserts that if P and P → Q are both true, we can infer that Q will be true as well. It's written like this: 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:

According to the Modus Tollens rule if P→ Q is true and ¬ Q is true, then ¬ P will also true. It can be represented as: Example:
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:

According to the Hypothetical Syllogism rule 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: Statement-1: If you have my home key then you can unlock my home. P→Q
Statement-2: Statement-2: If you can unlock my home then you can take my money. Q→R
Statement-3: Conclusion: If you have my home key then you can take my money. P→R

#### Proof by Truth table: ### 4. Disjunctive Syllogism:

According to the Disjunctive syllogism rule 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: According to the Addition rule which is one of the common inference rule, If P is true, then P∨Q will be true. Example:
Statement-1: 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:

According to the simplification rule if P∧ Q is true, then Q or P will also be true. It can be represented as: #### Proof by Truth table: ### 7. Resolution:

According to the Resolution rule if P∨Q and ¬ P∧R is true, then Q∨R will also be true. It can be represented as #### Proof by Truth table: 