0% found this document useful (0 votes)
6 views12 pages

AI Lab Tasks: Prolog & Logic Implementation

The document outlines laboratory tasks for the Intelligent Systems I course at SVKM’s NMIMS, focusing on various aspects of artificial intelligence, including propositional and predicate logic, algorithms, and programming in Prolog and Python. Students are required to complete tasks such as summarizing Turing's paper, developing algorithms, and implementing logic in the context of the Wumpus world and the Colonel West problem. The document emphasizes the importance of understanding logical reasoning and its application in AI decision-making.

Uploaded by

jvelankar405
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views12 pages

AI Lab Tasks: Prolog & Logic Implementation

The document outlines laboratory tasks for the Intelligent Systems I course at SVKM’s NMIMS, focusing on various aspects of artificial intelligence, including propositional and predicate logic, algorithms, and programming in Prolog and Python. Students are required to complete tasks such as summarizing Turing's paper, developing algorithms, and implementing logic in the context of the Wumpus world and the Colonel West problem. The document emphasizes the importance of understanding logical reasoning and its application in AI decision-making.

Uploaded by

jvelankar405
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

SVKM’s NMIMS

Mukesh Patel School of Technology Management & Engineering


Artificial Intelligence Department
Program: [Link]/MBA Tech. Semester: III

Course: Intelligent Systems I


List of Laboratory tasks

Faculty :Prof. Sapna shah w.e.f. 15th July 2025

Exp Title Prerequisite* CO#


No.
1 To understand and write a two-page summary of CO1
paper “Computing Machinery and Intelligence” by
Alan Turing.
2. Write an algorithm for two different given CO2
problems based on logic and represent the same.
3. a. To develop a simple vacuum cleaner world Basics idea about CO2
with only two locations intelligent agents
i. Identify precepts and actions and environments
ii. Comment on rationality of the
agent
b. To tabulate PEAS description for the
following agents- Part picking robot,
Satellite image analysis system
4 Familiarizing with Prolog Basic CO4
a. To get hands-on with Prolog by understanding of
implementing the following tasks logical statements
i. To define and query relationships in
Prolog
ii. To define relations by rules in
Prolog
iii. To write simple predicates in
Prolog
b. To write predicate in Prolog to convert
degree centigrade to Fahrenheit and
viceversa
c. To write a program in Prolog to find
maximum and minimum of two numbers
5 To find shortest path from the starting node to a Basic CO3
goal node using Best First search algorithm with understanding of
Python search algorithms
6 To implement A* algorithm for the given graph Basic CO3
problem understanding of
b. Compare the results with best first search search algorithms
algorithm output
7 To design a simple game using min max Understanding of CO3
algorithm in Python adversarial search
8 a. To choose and implement a Constraint Basic CO3
Satisfaction Problem. understanding of
b. For 8-Queen problem and Sudoku - constraint
i. Identify the variables in the above satisfaction
problem problem
ii. Identify set of constraint variables
iii. Obtain possible values of each variable

9 To implement Propositional Logic and First Order Understanding of CO4


Predicate Logic in Prolog/Python Wumpus world,
a. To develop a knowledge base (KB) for propositional
Wumpus world using propositional logic logic, predicate
and to ascertain if the given question is logic
entailed by KB
b. To develop predicate logic for the
following problem statement
i. The law says that it is a
crime for an American to sell
weapons to hostile nations.
The country Nono, an
enemy of America, has
some missiles, and all of its
missiles were sold to it by
ColonelWest, who is
American
ii. To prove that West is a
criminal

* Students are expected to be ready with the prerequisite before attending the lab
Experiment No.9

PART A

(PART A: TO BE REFFERED BY STUDENTS)

Experiment 10

A.1 Aim:
To implement Propositional Logic and First Order Predicate Logic in Prolog/Python

c. To develop a knowledge base (KB) for Wumpus world using propositional logic and to
ascertain if the given question is entailed by KB
d. To develop predicate logic for the following problem statement
iii. The law says that it is a crime for an American to sell weapons to hostile
nations. The country Nono, an enemy of America, has some missiles, and all
of its missiles were sold to it by ColonelWest, who is American
iv. To prove that West is a criminal

A.2Prerequisite: Basic understanding of Wumpus world problem, propositional logic, first


order predicate logic.

A.3 Learning Outcome:

After completing this experiment, you will be able to-


1. Implement propositional logic and predicate logic for the given problem
2. Understand the concept of entailment
A.4 Theory:

A.4.1 Wumpus world

 Based on “Hunt the Wumpus” text-based adventure game developed by Gregory Yob in
1973
 Wumpus world is a cave with number of rooms presented as 4x4 square grid (total 16
rooms)

 All rooms are connected

 Beast called Wumpus is in one of the rooms

 Wumpus eats anyone who enters the room

 There are some rooms with bottomless Pits

 If anyone falls in the Pit, he is stuck there forever

 One of the rooms will have gold in it

 Agent gets rewarded if he comes out of the cave with gold

 He will be penalized if eaten by Wumpus or falls in Pit

 The main mission of the agent

 Collect gold

 Exit the cave without being eaten or without falling in the Pit

 4x4 grid of squares

 Entire grid is surrounded by walls

 Entrance (Start) is in the lower left-hand corner in a square labeled (1,1)

 Each square has a coordinate designation indicating its position in the grid

 Location of gold and Wumpus are selected randomly with uniform distribution

 Each square other than start can be pit with probability 0.2

 Properties of the environment are:

 Partially Observable: Agent can only perceive adjacent (neighbouring)


environment

 Deterministic: Result and outcome of the world are known

 Sequential: Current choices will affect the future, agent has to plan ahead,
action order is important

 Static: Wumpus and Pits’ locations are not moving


 Discrete: Clearly defined percepts and actions

 Actuators

 Left turn,

 Right turn

 Move forward

 Grab

 Release

 Shoot.

 Sensors

 In the square containing the wumpus and in the directly (not diagonally) adjacent
squares, the agent will perceive a Stench.

 In the squares directly adjacent to a pit, the agent will perceive a Breeze.

 In the square where the gold is, the agent will perceive a Glitter

 When an agent walks into a wall, it will perceive a Bump

 When the wumpus is killed, it emits a woeful Scream that can be perceived
anywhere in the cave.

A.4.2 Knowledge base at (1,1)

Pit (P), Wumpus (W), Stench (S), Breeze (B),


KB at (1,1)
1. ┐W11
2. ┐P11
3. B11↔ P12 U P21
4. ┐B11
5. ┐S11
6. S11 ↔ W12 U W21
Question
α1: ┐ P12
α2 : ┐ W12

A.4.3 Problem statement for Predicate Logic

The law says that it is a crime for an American to sell weapons to hostile
nations. The country Nono, an enemy of America, has some missiles, and all
of its missiles were sold to it by ColonelWest, who is American.
To prove that West is a criminal.

Resolution by refutation
A.4.4 Implementation of above problem in Prolog

A.5 Task to be completed:

a. Implement Wumpus world problem using propostional logic


b. Implement the given problem statement to prove if West is criminal using Predicate
Logic.

References:
Stuart Russel and Peter Norvig, Artificial Intelligence: A Modern Approach, 4th edition, Pearson
Education, 2021.

***************************************************************************
PART B

(PART B: TO BE COMPLETED BY STUDENTS)

(Students must submit the soft copy as per following segments within the submission
timeline. The soft copy must be uploaded on the MS Teams assignment link at the end of
the practical)

Roll No. R070 Name: Jay Velankar


Program : Mba Tech AI Division: B2
Batch:B2 Date of Experiment:
Date of Submission: Grade :

B.1 Tasks given in PART A to be completed here

(Students must write the answers of the task(s) given in the PART A /Students must copy the
code, output screenshots here based on the task(s) given in section A.5)

(a) Wumpus World using Propositional Logic

Knowledge Base (KB):

Symbol Meaning

P Pit

W Wumpus

B Breeze

S Stench

At location (1, 1):

¬W11

¬P11

B11 ↔ (P12 ∨ P21)

¬B11

¬S11

S11 ↔ (W12 ∨ W21)


Query α₁ : ¬P12
Query α₂ : ¬W12

Because B11 and S11 are false, we infer there are no pits or Wumpus adjacent to (1, 1).
Hence the agent can safely move to (1, 2) or (2, 1).

b) Predicate Logic – Colonel West Problem

Statement:

“The law says that it is a crime for an American to sell weapons to hostile nations.
Nono, an enemy of America, has some missiles, all of which were sold to it by Colonel West,
who is American.
Prove that West is a criminal.”

Knowledge Base in Predicate Logic

1. American(x) ∧ Weapon(y) ∧ Sells(x, y, z) ∧ Hostile(z) → Criminal(x)

2. Owns(Nono, m1)

3. Missile(m1)

4. Missile(x) → Weapon(x)

5. Enemy(Nono, America)

6. Enemy(x, America) → Hostile(x)

7. Sells(West, m1, Nono)

8. American(West)

Goal: Prove Criminal(West)

Resolution Outline

 From (3) and (4): Weapon(m1)

 From (5) and (6): Hostile(Nono)

 Combine (1), (7), (8), and the above to infer Criminal(West)

B.2 Observations and Learning:


(Students must write the observations and learning based on their understanding built about
the subject matter and inferences drawn)

The Wumpus World demonstrated how propositional logic encodes environmental


knowledge through logical [Link] Colonel West problem illustrated how predicate
logic represents real-world facts and rules in symbolic [Link] Prolog showed that
logical inference engines can derive new knowledge automatically via resolution and
unification. Understanding entailment and logical reasoning is crucial for AI agents that
must make decisions under formal rules.

B.3 Conclusion:

(Students must write the conclusive statements as per the actual attainment of individual
outcomes listed above and learning/observation noted in section B.2)

This experiment demonstrated the implementation of propositional and predicate logic in


Prolog.
Through the Wumpus World example, we saw how an agent uses logical rules to make safe
moves.
The Colonel West case proved that knowledge bases can deduce complex facts (such as
“West is a criminal”) from given axioms.
Hence, logic forms a powerful foundation for reasoning and problem-solving in AI.

B.4 Question of curiosity:

Wumpus Problem:
Predicate Logic:
***************

You might also like