Javatpoint Logo
Javatpoint Logo

Knowledge-base for Wumpus world

As in the previous topic we have learned about the wumpus world and how a knowledge-based agent evolves the world. Now in this topic, we will create a knowledge base for the wumpus world, and will derive some proves for the Wumpus-world using propositional logic.

The agent starts visiting from first square [1, 1], and we already know that this room is safe for the agent. To build a knowledge base for wumpus world, we will use some rules and atomic propositions. We need symbol [i, j] for each location in the wumpus world, where i is for the location of rows, and j for column location.

Knowledge-base for Wumpus world

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: For a 4 * 4 square board, there will be 7*4*4= 122 propositional variables.

Some Propositional Rules for the wumpus world:

Knowledge-base for Wumpus world

Note: lack of variables gives us similar rules for each cell.

Representation of Knowledgebase for Wumpus world:

Following is the Simple KB for wumpus world when an agent moves from room [1, 1], to room [2,1]:

Knowledge-base for Wumpus world

Here in the first row, we have mentioned propositional variables for room[1,1], which is showing that room does not have wumpus(¬ W11), no stench (¬S11), no Pit(¬P11), no breeze(¬B11), no gold (¬G11), visited (V11), and the room is Safe(OK11).

In the second row, we have mentioned propositional variables for room [1,2], which is showing that there is no wumpus, stench and breeze are unknown as an agent has not visited room [1,2], no Pit, not visited yet, and the room is safe.

In the third row we have mentioned propositional variable for room[2,1], which is showing that there is no wumpus(¬ W21), no stench (¬S21), no Pit (¬P21), Perceives breeze(B21), no glitter(¬G21), visited (V21), and room is safe (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:

We will firstly apply MP rule with R1 which is ¬S11 → ¬ W11 ^ ¬ W12 ^ ¬ W21, and ¬S11 which will give the output ¬ W11 ^ W12 ^ W12.

Knowledge-base for Wumpus world
  • Apply And-Elimination Rule:

After applying And-elimination rule to ¬ W11 ∧ ¬ W12 ∧ ¬ W21, we will get three statements:
¬ W11, ¬ W12, and ¬W21.

  • Apply Modus Ponens to ¬S21, and R2:

Now we will apply Modus Ponens to ¬S21 and R2 which is ¬S21 → ¬ W21 ∧¬ W22 ∧ ¬ W31, which will give the Output as ¬ W21 ∧ ¬ W22 ∧¬ W31

Knowledge-base for Wumpus world
  • Apply And -Elimination rule:

Now again apply And-elimination rule to ¬ W21 ∧ ¬ W22 ∧¬ W31, We will get 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.

Knowledge-base for Wumpus world
  • Apply Unit resolution on W13 ∨ W12 ∨ W22 ∨W11 and ¬ W11 :

After applying Unit resolution formula on W13 ∨ W12 ∨ W22 ∨W11 and ¬ W11 we will get W13 ∨ W12 ∨ W22.

Knowledge-base for Wumpus world
  • 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.

Knowledge-base for Wumpus world
  • Apply Unit Resolution on W13 ∨ W12 and ¬ W12 :

After Applying Unit resolution on W13 ∨ W12 and ¬ W12, we will get W13 as an output, hence it is proved that the Wumpus is in the room [1, 3].

Knowledge-base for Wumpus world
Next TopicFirst-Order Logic




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA