## Inference in AI

The process of using real-time data with an AI model that has been trained to generate predictions or complete tasks is known as inference. The moment of truth for an AI model is inference, which measures how well the model can use knowledge from training to complete a task or make a prediction.

An AI model compares the user's query with data processed during training and stored in its weights, or parameters while making inferences using real-time data. Whether the aim is to understand spam, translate speech to text, or reduce a lengthy paper into the most important points, the model's answer varies. AI inference seeks to compute and produce a useful outcome.

### Inference Rules in AI

The models used to produce legal arguments are called inference rules. In artificial intelligence, proofs are derived using inference rules; a proof is a series of conclusions that lead to the intended outcome.

A collection of logical precepts and deductive guidelines known as rules of inference are used to generate inferences from data or claims that already exist.

### Various types of Inference Rules

The types of inference rules are as follows:

- Modus ponens

- Modus tollens

- Hypothetical syllogism

- Disjunctive syllogism

- Addition

- Simplification

- Resolution

#### 1. Modus ponens

Q must be true if P implies Q and P is true.

** P:** It's pouring with rain.

** Q: **The streets are wet.

** R: **The roads are slick.

**Notation **

( 𝑃 →𝑄 ) ∧𝑃 ) →𝑄 ((P→Q)∧P)→Q

*As an Example*

The streets are wet (P -> Q) if it is raining, and since it is raining (P), the streets are wet (Q).

#### 2. Modus tollens

P is false if Q is false and P implies Q.

** P: **It's pouring with rain.

** Q: **The streets are wet.

** R: **The roads are slick.

*Notation*

( 𝑃 →𝑄 ) ∧∼ 𝑄 ) → ∼𝑃 ((P→Q)∧∼Q)⇒ ∼P

**As an Example**

When it rains, the streets get wet (P -> Q), and when it doesn't rain (~Q), it isn't raining (~P).

#### 3. A Hypothetical Syllogism

P means R if Q implies R and P implies Q.

** P: **It's pouring with rain.

** Q: **The streets are wet.

** R: **The roads are slick.

*Notation*

( (𝑃 →𝑄 ) ∧ (𝑄 →𝑅 ) ) → (𝑃 → 𝑅 ) ((P→Q)∧(Q→R))→ (P→R)

*As an Example*

Rain causes the streets to get wet (P -> Q), and wet streets cause roads to become slick (Q -> R). Consequently, rain causes the roads to become slick (P -> R).

*4. Disjunctive Syllogism*

Q is true if P is false and either P or Q is true.

** P: **It's pouring with rain.

** Q: **The streets are wet.

** R: **The roads are slick.

*Notation*

( 𝑃 ∨ 𝑄 ) ∧ ∼ 𝑃 ) ⇒ 𝑄 ((P∨Q)∧∼P)⇒ Q

*An Example*

The streets are wet (Q) because it is raining or it is wet (P∧Q) and it is not raining (~P).

#### 5. Addition

In addition, Either P or Q is true if P is true.

** P: **It's pouring with rain.

** Q: **The streets are wet.

** R: **The roads are slick.

*Notation*

𝑃 ⇒ (𝑃∨𝑄) P⇒ (P∨Q)

*An Example*

Since it is raining (P), the streets are either wet or it is raining (P∨Q).

#### 6. Simplification

P is true if both P and Q are true.

** P: **It's pouring with rain.

** Q: **The streets are wet.

* R: *The roads are slick.

*Notation*

( P∧Q )⇒ P (P∧Q)⇒ P

*As an Example*

It is pouring (P) because the streets are wet and it is raining (P∧Q).

**7. Resolution**

Q or R is true if both P or Q and not P or R are true.

** P: **It's pouring with rain.

** Q: **The streets are wet.

** R: **The roads are slick.

*Notation*

((𝑃 ∨𝑄 ) ∧ (∼ 𝑃 ∨𝑅 ) ) ⇒ (𝑄∨𝑅) ((P∨Q)∧(∖P∨R))→ (Q∧R)

*As an Illustration*

Streets are wet or roads are slippery (Q∨R) because it is raining or the streets are wet (P∨Q) and it is not raining or the roads are slippery (~P∨R).