Logic Based Agents, Propositional Logic




CS156

Chris Pollett

Oct 17, 2022

Outline

Intro to Knowledge Agents

Knowledge-based agents

KB-Agent Pseudo-code

Below is pseudo-code for a knowledge-based agent. As with all of our agents, it receives percepts about its environment, and returns actions. It maintains a KB, which initially may contain some background knowledge.

function KB-Agent(percept) returns an action
    persistent KB, a knowledge base
    t, a counter, initially 0, indicating time

    // store the percept into the KB
    Tell(KB, Make-Percept-Sentence(percept, t))
    
    // choose an action
    action := Ask(KB, Make-Action-Query(t))
    
    // tell the KB, we did that action at time t
    Tell(KB, Make-Action-Sentence(action, t))

    t++
    return action

Remarks on KB Agent

Quiz

Which of the following is true?

  1. For CSP solvers, the degree heuristic says when choosing the next variable to assign, pick the variable that is involved in the largest number of constraints on other unassigned variables.
  2. It is impossible to come up with an efficient consistency check for any class of global constraints.
  3. Typical CSPs have preference constraints.

Wumpus World

A 4x4 wumpus world

PEAS Description of Wumpus World

Notes about Wumpus World

Wumpus World at Stages of Reasoning

A KB agent in Wumpus World

Logic

Entailment

Propositional Logic

Syntax

Logical Connectives

The logical connectives are:

Semantics