1) Describe The Syntax and Semantics of Propositional Logic With An Example
1) Describe The Syntax and Semantics of Propositional Logic With An Example
ropositional logic, also known as propositional calculus, is a branch of logic that deals with sentences
or propositions that can either be true or false. It uses symbols to represent these propositions and
combines them using logical connectives such as "and" (∧∧∧), "or" (∨∨∨), "not" (¬¬¬), "implies"
(⇒⇒⇒), and "if and only if" (⇔⇔⇔).
2) Define inference system and explain operations performed by knowledge-based
agents.
Inference System:
An inference system is a component of a knowledge-based agent that derives new
information or sentences from the existing knowledge base using logical reasoning. It applies
predefined logical rules to the knowledge base (KB) to deduce new facts or relationships
about the world. These new facts help the agent update its internal representation of the
environment, enabling intelligent decision-making and action.
The inference system works by generating conclusions from known information, making the
agent capable of reasoning about the world and predicting outcomes effectively.
Algorithm Steps:
1. Initialization:
o Add the starting node to the priority queue (fringe) with its heuristic value
h(n)h(n)h(n).
o Maintain an empty set of explored nodes.
2. Expand Node:
o Remove the node with the smallest h(n)h(n)h(n) from the priority queue.
o If the node is the goal, terminate the search.
3. Generate Successors:
o Expand the current node, generate its successors, and compute their heuristic
values h(n)h(n)h(n).
4. Add to Priority Queue:
o Add successors to the priority queue if they are not already explored or in the
queue.
5. Repeat:
o Repeat steps 2–4 until the goal is reached or the queue is empty (indicating
failure).
Example:
Let's consider finding a path from A to G in the following graph:
Graph Representation:
Nodes: A, B, C, D, E, F, G
Edges and heuristic values (h):
Node h(n) (Heuristic to G)
A 6
B 4
C 5
D 2
E 3
F 1
G 0
7)Using propositional logic, write down the rules required for an agent to avoid the Wumpus
and pits.
8. Illustrate Wumpus World problem with PEAS description in detail.
Performance Measure
• +1000+1000+1000: If the agent successfully retrieves the gold and exits the cave.
• −1000-1000−1000: If the agent is eaten by the Wumpus or falls into a pit.
• −1-1−1: For each action performed by the agent.
• −10-10−10: For using the arrow (shoot action).
• Game End:
o Agent dies (falls into pit or eaten by Wumpus).
o Agent retrieves gold and climbs out of the cave.
Environment
• Grid: A 4x4 grid where the agent starts at (1,1)(1, 1)(1,1), facing right.
• Wumpus: A single Wumpus placed randomly in the grid (not in (1,1)(1, 1)(1,1)).
• Pits: Randomly placed pits in the grid with a probability of 0.2 (not in (1,1)(1, 1)(1,1)).
• Gold: A single piece of gold randomly placed in the grid (not in (1,1)(1, 1)(1,1)).
Actions (Actuators)
• Forward: Move to the square in the current direction.
• TurnLeft: Turn 90° counterclockwise.
• TurnRight: Turn 90° clockwise.
• Grab: Pick up gold if in the same square.
• Shoot: Fire an arrow in a straight line in the current direction.
• Climb: Exit the cave from (1,1)(1, 1)(1,1).
Sensors
• Stench: Perceived in the same square as the Wumpus or adjacent (not diagonal).
• Breeze: Perceived in the same square as a pit or adjacent (not diagonal).
• Glitter: Perceived in the same square as gold.
• Bump: Perceived if the agent walks into a wall.
• Scream: Perceived anywhere in the cave when the Wumpus is killed.
Agent's Goal
• Safely navigate the grid.
• Use logical reasoning to infer the location of Wumpus and pits.
• Grab the gold and exit the cave without dying.
The agent applies logical inference to decide safe moves, detect hazards, and optimize actions
based on its performance measure.