# 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 Pi,j be true if there is a Pit in the room [i, j].
• Let Bi,j be true if agent perceives breeze in [i, j], (dead or alive).
• Let Wi,j be true if there is wumpus in the square[i, j].
• Let Si,j be true if agent perceives stench in the square [i, j].
• Let Vi,j be true if that square[i, j] is visited.
• Let Gi,j be true if there is gold (and glitter) in the square [i, j].
• Let OKi,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 (¬W11), no smell (¬S11), no Pit (¬P11), no breeze (¬P11), no gold (¬G11), has been visited (V11), and is safe (OK11).

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(¬W21), no stink (¬S21), no Pit (¬P21), Perceives breeze(B21), no glitter(¬G21), visited (V21), and the room is secure (OK21).

##### 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 ¬S11 → ¬W11^ ¬W12 ^ ¬W21, and ¬S11 which will give this output ¬ W11 ^ W12 ^ W12
• Apply And-Elimination Rule: After we apply And-elimination rule to ¬W11 ∧ ¬W12 ∧ ¬W21, we will see three statements:
¬W11, ¬W12, and ¬W21.
• Apply Modus Ponens to ¬S21, and R2: We will now apply Modus Ponens to ¬S21 and R2 which is ¬S21 → ¬W21 ∧¬ W22 ∧ ¬W31, which will give the Output as ¬W21 ∧ ¬W22 ∧ ¬W31
• Apply And -Elimination rule: Again we will now apply And-elimination rule to ¬ W21 ∧ ¬ W22 ∧¬ W31, We will see three statements:
¬W21, ¬W22, and ¬W31.
• Apply MP to S12 and R4: Apply Modus Ponens to S12 and R4 which is S12 → W13 ∨. W12 ∨. W22 ∨. W11, we will get the output as W13 ∨ W12 ∨ W22 ∨ W11.
• Apply Unit resolution on W13 ∨ W12 ∨ W22 ∨ W11 and ¬W11 : After applying Unit resolution formula on W13 ∨ W12 ∨ W22 ∨ W11 and ¬W11 we will see W13 ∨ W12 ∨ W22
• Apply Unit resolution on W13 ∨ W12 ∨ W22 ∨ W11 and ¬W11 : After applying Unit resolution formula on W13 ∨ W12 ∨ W22 ∨ W11 and ¬W11 we will see W13 ∨ W12 ∨ W22.
• Apply Unit resolution on W13 ∨ W12 ∨ W22 and ¬W22 : After applying Unit resolution on W13 ∨ W12 ∨ W22, and ¬W22, we will get W13 ∨ W12 as output.
• Apply Unit Resolution on W13 ∨ W12 and ¬W12 : After Applying Unit resolution on W13 ∨ W12 and ¬W12, we will see W13 as an output, therefore, it is proved that the Wumpus is in the room [1, 3].