Aiphabet

Propositional Logic

Propositional logic is a fundamental tool used by logical agents in AI to represent and reason about knowledge. It deals with propositions (statements that are either true or false) and logical connectives. You can refer to our logic refresher for more information on propositional logic: Logic Refresher.

Logical Agents and Propositional Logic

Key Components of Propositional Logic

  1. Propositions: Simple statements (e.g., "There is a pit in room 1,1")
  2. Logical Connectives: AND (∧), OR (∨), NOT (¬), IMPLIES (→), EQUIVALENT (↔)

Propositional Logic Definitions

Representing Knowledge in Propositional Logic

In the context of the Wumpus World:

  • Let P(x,y) represent "There is a pit in room (x,y)"
  • Let W(x,y) represent "The Wumpus is in room (x,y)"
  • Let B(x,y) represent "There is a breeze in room (x,y)"
  • Let S(x,y) represent "There is a stench in room (x,y)"

Example propositions:

  1. ¬P(1,1): "There is no pit in room (1,1)"
  2. B(1,1) ↔ (P(1,2) ∨ P(2,1)): "There is a breeze in (1,1) if and only if there is a pit in (1,2) or (2,1)"

Inference and Rules of Inference

Inference is the process of deriving new knowledge from existing knowledge using logical rules.

  1. Modus Ponens:

    • If A → B is true, and A is true, then B must be true

    Example:

    • We know: S(1,1) → W(1,2) ∨ W(2,1)
    • We observe: S(1,1) is true
    • We can infer: W(1,2) ∨ W(2,1) is true

Modus Ponens

  1. Modus Tollens:

    • If A → B is true, and B is false, then A must be false

    Example:

    • We know: B(1,1) → P(1,2) ∨ P(2,1)
    • We observe: ¬P(1,2) ∧ ¬P(2,1)
    • We can infer: ¬B(1,1)

Modus Tollens

Other inference rules can be found in the table below:

Rules of Inference

Building a Knowledge Base

A logical agent's knowledge base (KB) is constructed using propositional logic statements. For the Wumpus World:

  1. ¬P(1,1): The starting room has no pit
  2. ¬W(1,1): The starting room has no Wumpus
  3. B(x,y) ↔ (P(x-1,y) ∨ P(x+1,y) ∨ P(x,y-1) ∨ P(x,y+1)): A room is breezy if and only if there's an adjacent pit
  4. S(x,y) ↔ (W(x-1,y) ∨ W(x+1,y) ∨ W(x,y-1) ∨ W(x,y+1)): A room has a stench if and only if there's an adjacent Wumpus

Reasoning with the Knowledge Base

As the agent explores the Wumpus World, it:

  1. Adds new observations to its KB
  2. Uses inference rules to derive new knowledge
  3. Makes decisions based on what it knows and what it can infer

Example:

  • Agent observes: ¬B(1,1) and ¬S(1,1)
  • Agent can infer: ¬P(1,2) ∧ ¬P(2,1) ∧ ¬W(1,2) ∧ ¬W(2,1)
  • Decision: It's safe to move to (1,2) or (2,1)

Limitations of Propositional Logic

  1. Limited expressiveness: Cannot easily represent general statements about multiple objects
  2. Inability to handle uncertainty: Propositions are either true or false, with no in-between
  3. Complexity: As the number of propositions grows, reasoning can become computationally expensive