**Artificial Intelligence**

**History and Application**

**Types of AI**

**Agents in AI**

**Types of AI Agents**

**Agent Environment**

**Turing Test in AI**

**Search Algorithms**

**Uninformed Search Algorithms**

**Informed Search Algorithms**

**Hill Climbing Algorithm**

**Means Ends Analysis**

**Adversarial Search**

**Mini-Max Algorithm**

**Alpha-Beta Pruning**

**Knowledge-based Agent**

**Knowledge Representation**

**Knowledge Representation Techniques**

**Propositional Logic**

**Rules of Inference**

**The Wumpus World**

**Knowledge Base for Wumpus World**

**First Order Logic**

**Knowledge Engineering in FOL**

**Inference in FOL**

**Unification in FOL**

**Resolution in FOL**

**Forward and Backward Chaining**

**Reasoning in AI**

**Bayesian Belief Network**

# Knowledge-base for Wumpus world in Artificial intelligence

**In this page, we will learn about Knowledge base for Wumpus world,
Knowledge base for Wumpus world in Artificial intelligence, Atomic proposition variable for Wumpus world, Some Propositional Rules for the wumpus world, Representation of Knowledgebase for Wumpus world, and Prove that Wumpus is in the room (1, 3).**

## Knowledge base for Wumpus world in Artificial intelligence

We studied about the wumpus world and how a knowledge based agent evolves the world in the previous topic. Now, in this topic, we'll establish a knowledge base for the Wumpus world and use propositional logic to deduce some Wumpus-world facts.

The agent begins his visit in the first square [1, 1], and we already know that the agent is secure in this room. We'll utilize certain rules and atomic propositions to create a knowledge base for the wumpus world. For each place in the wumpus world, we need the symbol [I j], where I stands for row location and j for column location.

## Atomic proposition variable for Wumpus world:

- Let P
_{i,j}be true if there is a Pit in the room [i, j]. - Let B
_{i,j}be true if agent perceives breeze in [i, j], (dead or alive). - Let W
_{i,j}be true if there is wumpus in the square[i, j]. - Let S
_{i,j}be true if agent perceives stench in the square [i, j]. - Let V
_{i,j}be true if that square[i, j] is visited. - Let G
_{i,j}be true if there is gold (and glitter) in the square [i, j]. - Let OK
_{i,j}be true if the room is safe.

**[Note: There will be 7*4*4= 122 propositional variables for a 4 * 4 square board.
]**

#### Some Propositional Rules for the wumpus world:

**[Note: Lack of variable gives similar rules for each cell.
]**

#### Representation of Knowledgebase for Wumpus world:

The Simple KB for wumpus world when an agent moves from room [1, 1], to room [2,1] is as follows:

We mentioned propositional variables for room[1,1] in the first row, indicating that the room has no wumpus (¬W_{11}), no smell (¬S_{11}), no Pit (¬P_{11}), no breeze (¬P_{11}), no gold (¬G_{11}), has been visited (V_{11}), and is safe (OK_{11}).

We mentioned propositional variables for room [1,2] in the second row, indicating that there are no wumpus, stink, or breeze because an agent has not visited room [1,2], no Pit, and the room is safe.

We mentioned a propositional variable for room[2,1] in the third row, which shows that there are no wumpus(¬W_{21}), no stink (¬S_{21}), no Pit (¬P_{21}), Perceives breeze(B_{21}), no glitter(¬G_{21}), visited (V_{21}), and the room is secure (OK_{21}).

**Prove that Wumpus is in the room (1, 3)**

We can prove that wumpus is in the room (1, 3) using propositional rules which we have derived for the wumpus world and using inference rule.

**Apply Modus Ponens with ¬S11 and R1:**At first we will apply MP rule with R1 which is ¬S_{11}→ ¬W_{11}^ ¬W_{12}^ ¬W_{21}, and ¬S_{11}which will give this output ¬ W_{11}^ W_{12}^ W_{12}**Apply And-Elimination Rule:**After we apply And-elimination rule to ¬W_{11}∧ ¬W_{12}∧ ¬W_{21}, we will see three statements:

¬W_{11}, ¬W_{12}, and ¬W_{21}.**Apply Modus Ponens to ¬S**We will now apply Modus Ponens to ¬S_{21}, and R2:_{21}and R2 which is ¬S_{21}→ ¬W_{21}∧¬ W_{22}∧ ¬W_{31}, which will give the Output as ¬W_{21}∧ ¬W_{22}∧ ¬W_{31}**Apply And -Elimination rule:**Again we will now apply And-elimination rule to ¬ W21 ∧ ¬ W22 ∧¬ W31, We will see three statements:

¬W_{21}, ¬W_{22}, and ¬W_{31}.**Apply MP to S**Apply Modus Ponens to S_{12}and R4:_{12}and R4 which is S_{12}→ W_{13}∨. W_{12}∨. W_{22}∨. W_{11}, we will get the output as W_{13}∨ W_{12}∨ W_{22}∨ W_{11}.**Apply Unit resolution on W**After applying Unit resolution formula on W_{13}∨ W_{12}∨ W_{22}∨ W_{11}and ¬W_{11}:_{13}∨ W_{12}∨ W_{22}∨ W_{11}and ¬W_{11}we will see W_{13}∨ W_{12}∨ W_{22}**Apply Unit resolution on W**After applying Unit resolution formula on W_{13}∨ W_{12}∨ W_{22}∨ W_{11}and ¬W_{11}:_{13}∨ W_{12}∨ W_{22}∨ W_{11}and ¬W_{11}we will see W13 ∨ W12 ∨ W22.**Apply Unit resolution on W**After applying Unit resolution on W_{13}∨ W_{12}∨ W_{22}and ¬W_{22}:_{13}∨ W_{12}∨ W_{22}, and ¬W_{22}, we will get W_{13}∨ W_{12}as output.**Apply Unit Resolution on W**After Applying Unit resolution on W_{13}∨ W_{12}and ¬W_{12}:_{13}∨ W_{12}and ¬W_{12}, we will see W_{13}as an output, therefore, it is proved that the Wumpus is in the room [1, 3].