0% found this document useful (0 votes)
44 views

CS305 First Order Logic Tutorial

This document provides an introduction to first-order logic (FOL) by explaining its basic components and how to construct sentences and proofs in FOL. It defines constant, predicate, and function symbols; terms; atomic and complex sentences; and quantifiers. Examples are given of representing English sentences in FOL notation. The document also demonstrates how to represent collections using quantifiers and provides a simple example of a FOL proof to show that Fido is a dog given the facts that anything that barks is a dog and that Fido barks.

Uploaded by

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

CS305 First Order Logic Tutorial

This document provides an introduction to first-order logic (FOL) by explaining its basic components and how to construct sentences and proofs in FOL. It defines constant, predicate, and function symbols; terms; atomic and complex sentences; and quantifiers. Examples are given of representing English sentences in FOL notation. The document also demonstrates how to represent collections using quantifiers and provides a simple example of a FOL proof to show that Fido is a dog given the facts that anything that barks is a dog and that Fido barks.

Uploaded by

dd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

CS 305 – Introduction to

Artificial Intelligence (AI)

A First-Order Logic Tutorial

1
Purpose
 This tutorial was created to help explain
first-order logic

2
The Basics
 Constant symbols: B, X, Jane, Ralph
 A specific object in the world
 Predicate symbols: Parent(John, Jane),
Brother(Jack, Jill)
 Refers to a relation in a model
 Ex: John is Jane’s Parent
 Ex: Jack is Jill’s brother

3
The Basics (continued)
 Function Symbols: FatherOf(John),
PetOf(Jill)
 An object is directly related to exactly one
other object
 Ex: The object John is directly related to the
object John by the relationship FatherOf. That
object may be called Ralph.
 Ex: The object Jill is directly related to another
object called Sparky by the relation PetOf.

4
The Basics (continued)
 Terms: A, Jane, Ralph, FatherOf(John),
PetOf(Jill)
 Logical representation that refers to an particular
object
 Atomic Sentences: Parent(John, Jane),
Brother(Jack, Jill)
 Predicate symbol followed parenthesized list of
terms
 Complex Sentences:
 Constructed by using logical connectives
 Connectives include: ,,,,

5
Examples of Sentences
 Understanding how to construct basic
sentences is key to using FOL
 Ex: YoungerThan(Joe, Jim)
 This sentence says “Joe is younger than Jim”
 Parent(Adam, Zoe)  Parent(Jane, Adam)
 This sentence says “Adam is Zoe’s parent and
Jane is Adam’s Parent”
 Ex: Cat(Morris)  Likes(Morris, catnip)
 This sentence says “If Morris is a cat then he likes
catnip”

6
Create your own sentences
 Given the following English sentences,
create FOL sentences
 Fido is Jack’s pet.
 Jill owns a car.
 Tweety is a yellow bird and is Bob’s pet.
 Tom is a cat and Jerry is a bird.

7
Create your own sentences
 English: Fido is Jack’s pet.
 FOL: Pet(Fido, Jack)
 English: Jill owns a car.
 FOL: Owns(Jill,car)
 English: Tweety loves bird seed and he is
Bob’s pet.
 FOL: Loves(Tweety,bird seed)  Pet(Tweety,Bob)
 English: Tom is a cat and Jerry is a bird.
 FOL: Cat(Tom)  Bird(Jerry)

8
Representing Collections
 How can you represent of an entire
collection of objects using FOL?
 Refer to “All people…” or “There is a
person…”
 Ex: How can one state “All dogs like bones”
using FOL?
 Ex: How can one state “Someone likes liver”
using FOL?

9
Quantifiers
 Universal Quantifier: 
 “For all….”
 Ex: “All dogs like bones”
 FOL: xDog(x)  Likes(x,bones)
 This reads “For any object x, if x is a dog then x likes
bones”
 Ex: “Anything with a beak and feathers is a bird”
 FOL: xHasBeak(x)  HasFeathers(x)  Bird(x)
 This reads “For any object x, if x has a beak and x has
feathers then x is a bird”

10
Quantifiers
 Existential Quantifier: 
 “There exists….”
 Ex: “There is someone who likes liver”
 FOL: xLikes(x, liver)
 This reads “There is an object x that likes liver”
 Ex: “Mary owns a coat”
 xOwns(Mary,x)  Coat(x)

11
Using Inference FOL (Proofs)
 Recognize which rules you can use.
 The primary rules you can use are the Inference
Rules on pages 211-212 (these rules apply to FOL
as well as propositional logic)
 In order to apply these rules, you must also have
rules to handle (get rid of) quantifiers.
 The rules to accomplish this are discussed on pages 272-
273

12
Simple Proof
 Suppose we have the following
situation:
 Anything that barks is a dog. Fido barks.
 We wish to prove that Fido is a dog.
 This fact is obvious to us but how can a
computer prove this?
 See the next slide

13
Simple Proof (continued)
 Step 1: State the facts you know in FOL
 We know anything that barks is a dog.
State this fact in FOL:
 a. xBarks(x)  Dog(x)
 This says “If x barks then x is a dog”. We are given
this fact.
 We know that Fido barks. State this fact in
FOL:
 B. Barks(Fido)

14
Simple Proof (continued)
 Step 2: Remove all quantifiers
 Apply the Universal Instantiation inference
rule to remove the universal quantifier ()
in sentence a
 The result is:
 c. Barks(Fido)  Dog(Fido)

15
Simple Proof (continued)
 So far we have the following sentences:
 A. xBarks(x)  Dog(x)
 B. Barks(Fido)
 C. Barks(Fido)  Dog(Fido)
 Step 3: See what inference rules can be
applied.
 Think about what we want to do: Eliminate the
implication in C, leaving the sentence “Dog(Fido)”
 How can we so this? Use Modens Ponens
 D. Dog(Fido)

16
Simple Proof (continued)
 Our entire proof looks like:

A. xBarks(x)  Dog(x) State a given fact

B. Barks(Fido) State a given fact

C. Barks(Fido)  Dog(Fido) Apply Universal Instantiation on C

D. Dog(Fido) Apply Modus Ponens to B and C

17

You might also like