Docsity

First-Order Logic: Expressive Representation of Complex Environments - Prof. Worthy Martin, Study notes of Computer Science

Toggle sidebar
bg1
Page 1
CS 416
Artificial Intelligence
Lecture 13
First-Order Logic
Chapter 8
Question about Final Exam
• I will have a date for you by Tuesday of next
week.
First-order logic
•We saw how propositional logic can create
intelligent behavior
•But propositional logic is a poor representation for
complex environments
–Why?
•First-order logic is a more expressive and
powerful representation
What do we like about propositional
logic?
•It is:
–Declarative
• Relationships between variables are described
• A method for propagating relationships
– Expressive
• Can represent partial information using disjunction
– Compositional
•If A means foo and B means bar, A ^ B means foo and bar
What don’t we like about
propositional logic?
• Lacks expressive power to describe the
environment concisely
– Separate rules for every square/square relationship
in Wumpus world
Natural Language
•English appears to be expressive
– Squares adjacent to pits are breezy
•But natural language is a medium of communication, not
a knowledge representation
– Much of the information and logic conveyed by language is
dependent on context
– Information exchange is not well defined
– Not compositional (combining sentences may mean something
different)
– It is ambiguous
pf3
pf4
pf5

Partial preview of the text

Download First-Order Logic: Expressive Representation of Complex Environments - Prof. Worthy Martin and more Study notes Computer Science in PDF only on Docsity!

CS 416

Artificial Intelligence

Lecture 13 First-Order Logic Chapter 8

Question about Final Exam

  • I will have a date for you by Tuesday of next

week.

First-order logic

•We saw how propositional logic can create

intelligent behavior

•But propositional logic is a poor representation for

complex environments

  • Why?

•First-order logic is a more expressive and

powerful representation

What do we like about propositional

logic?

•It is:

  • Declarative
    • Relationships between variables are described
    • A method for propagating relationships
  • Expressive
    • Can represent partial information using disjunction
  • Compositional
    • If A means foo and B means bar, A ^ B means foo and bar

What don’t we like about

propositional logic?

  • Lacks expressive power to describe the

environment concisely

  • Separate rules for every square/square relationship in Wumpus world

Natural Language

•English appears to be expressive

  • Squares adjacent to pits are breezy

•But natural language is a medium of communication, not a knowledge representation

  • Much of the information and logic conveyed by language is dependent on context
  • Information exchange is not well defined
  • Not compositional (combining sentences may mean something different)
  • It is ambiguous

But we borrow representational

ideas from natural language

•Natural language syntax

  • Nouns and noun phrases refer to objects
    • People, houses, cars
  • Verbs and verb phrases refer to relationships btw objects
    • Red, round, nearby, eaten
  • Some relationships are clearly defined functions where there is only one output for a given input - Best friend, first thing, plus •We build first order logic around objects and relations

Ontology

  • a ā€œ specification of a conceptualization ā€
  • A description of the objects and relationships that can exist - Propositional logic had only true/false relationships - First-order logic has many more relationships
  • The ontological commitment of languages is different - How much can you infer from what you know? - Temporal logic defines additional ontological commitments because of timing constraints

Higher-order logic

•First-order logic is ā€œfirstā€ because you relate objects (the first-order entities that actually exist in the world)

  • There are 10 chickens… chickens.number=
  • There are 10 ducks… ducks.number= •You cannot build relationships between relations or functions
  • There are as many chickens as ducks… chickens.number = ducks.number
  • the number of objects belonging to a group must be a property of the group, and not the objects themselves
  • Cannot represent Leibniz’s law: If x and y share all properties, x is y

Another characterization of a logic

  • Epistemological commitments
    • The possible states of knowledge permitted with respect to each fact - In first-order logic, each sentence is a statement that is - True, false, or unknown

Formal structure of first-order logic

•Models of first-order logic contain:

  • A set of objects (its domain)
    • Alice, Alice’s left arm, Bob, Bob’s hat
  • Relationships between objects
    • Represented as tuples
      • Sibling (Alice, Bob), Sibling (Bob, Alice)
      • On head (Bob, hat)
      • Person (Bob), Person (Alice)
    • Some relationships are functions if a given object is related to exactly one object in a certain way - Alice -> Alice’s left arm

First-order logic syntax

•Constant Symbols

  • A, B, Bob, Alice, Hat •Predicate Symbols
  • Is, onHead, hasColor, person •Function Symbols
  • Mother, leftLeg

•Each predicate and function symbol has an arity

  • A constant the fixes the number of arguments

Universal Quantification

•Note that all of these are true

  • Implication is true if premise is false
  • Using AND instead of implication is overly strong

•By asserting a universally quantified sentence,

you assert a whole list of individual implications

Existential Quantification

  • There exists,
    • There exists an x such that Crown(x) ^ OnHead(x, John)
    • It is true for at least one object
    • AND, ^, is the appropriate connective

∃

Existential Quantification

•What if we used implication as the connective?

  • Implication is true if both premise and conclusion are true or if premise is false - Richard the Lionheart is not a crown, first assertion is true, and existential is satisfied

Nested Quantifiers

•Building more complex sentences

  • Everybody loves somebody
  • There is someone who is loved by everyone

•Use unique variable names and parentheses when appropriate

Combining

  • Everyone who dislikes parsnips == there does not exist someone who likes parsnips
  • Everyone likes ice cream == there is no one who does not like ice cream

Combining

  • De Morgan’s rules apply

Equality

  • Two terms refer to the same object
    • Father (John) = Henry
    • Richard has at least two brothers
    • Notice this sentence is not the same

An Example

•A Tell/Ask interface for a first-order knowledge base

  • Sentences are added with ā€œTellā€
    • These are called assertions
    • Tell (KB, King(John))
    • Tell (KB, Forall x: King(x) => Person(x))
  • Queries are made with ā€œAskā€
    • Ask (KB, King(John))
    • Ask (KB, Person(John))

An Example

  • Quantified queries
    • Ask (KB, exist x: Person(x))
  • KB should return a list of variable/term pairs that satisfy the query

The Wumpus World

•More precise axioms than with propositional logic

  • Percept has five values
  • Time is important
  • A typical sentence
    • Percept ([Stench, Breeze, Glitter, None, None], 5)
  • The actions are terms
    • Turn(right), Turn(left), Forward, Shoot, Grab, Release
  • Computing best action with a query
    • Exist a: BestAction(a, 5)

The Wumpus World

  • After executing query, KB responds with variable/term list: {a/Grab}
  • Then tell the KB the action taken
  • Raw percept data is easily encoded
  • Reflexes are easily encoded

Wumpus World

  • Defining the environment with[x,y] reference instead of alternative atomic name
  • Adjacency between two squares
  • Location of Wumpus is constant: Home (Wumpus)
  • Location of agent changes: At (Agent, [ ], t)