You are on page 1of 20

First Order Logic (Introduction)

Objects of FOL
• Constants – names of specific objects
– E.g., Ayan, Gene, King, Crown
• Functions – Mother(Riya), Score(X,Y)
• variables – a, b, c, … for statements about
unidentified objects or general statements

Vandana, CSIS, BITS Pilani, BITS F444/ CS


September 2016 2
F407
Syntax of First-Order Logic
• Constants KingJohn, 2, …
• Predicates Brother, >, …
• Functions Sqrt, LeftArmOf, …
• Variables x, y, a, b, …
• Connectives ¬
• Equality =
• Quantifiers $"

Vandana, CSIS, BITS Pilani, BITS F444/ CS


September 2016 3
F407
FOL - example
• Domain {Ayan, Riya,Shireen, John}
• Functions of objects:
– Mother(Riya) identifies an object
• Relations:
– Siblings (X,Y) true or false
• Properties of objects (unary relations)
– IsMother(X) true or false
• Statements about domain:
– Mother(Riya) = Mother(Ayan) true or false

Vandana, CSIS, BITS Pilani, BITS F444/ CS


September 2016 4
F407
Components of First-Order Logic
• Term
– Constant, e.g. Red
– Function of constant, e.g. Color(Block1)

• Atomic Sentence
– Predicate relating objects (no variable)
• Brother (John, Richard)
• Married (Mother(John), Father(John))

• Complex Sentences
– Atomic sentences + logical connectives
• Brother (John, Richard) Brother (John, Father(John))

Vandana, CSIS, BITS Pilani, BITS F444/ CS


September 2016 5
F407
Components of First-Order Logic
• Quantifiers
– Each quantifier defines a variable for the duration
of the following expression, and indicates the
truth of the expression…

• Universal quantifier “for all” "


– The expression is true for every possible value of
the variable

• Existential quantifier “there exists” $


– The expression is true for at least one value of the
variable

Vandana, CSIS, BITS Pilani, BITS F444/ CS


September 2016 6
F407
Formal Definition
of
FOL - Syntax

Statement about
relation or property
OR Equivalence of
objects

Reference to an
object

Statements
about sets of
objects
Relation or
property
Vandana, CSIS, BITS Pilani, BITS F444/ CS
September 2016 7
F407
Propositional logic vs. FOL

Propositional FOL
Objects, functions
Propositions (t/f) Relations on objects (t/f)
Connectives Connectives
 sentences  sentences
Quantifiers

Vandana, CSIS, BITS Pilani, BITS F444/ CS


September 2016 8
F407
Difference between Predicate and
Functions
• Functions take as input a constant, a variable or a
function itself and output a value (not
necessarily T/F). The output is only one.
• Example: Mother(X), bestFriend(Ayan),
Square(3), Color(tile1) etc
• Predicate takes as input a constant, a variable or
a function and has either true or false value.
• Example:
Sonia = Mother(Priyanka) True
isPresidentUS(Obama) True
brother(ram,shyam)
September 2016
True
Vandana, CSIS, BITS Pilani, BITS F444/ CS
9
F407
Examples
• Mother(Indira, Rajiv) Predicate
• Study(BITS, Amit) Predicate
• Daughter(Nilam) Function
• Pooja = daughter(Nilam) Predicate
• Study(BITS, daughter(Nilam)) Predicate
• Color(block1) Function
• Color(block1) = Blue Predicate
• Square(5) Function
• 10 = square(5) Predicate

Vandana, CSIS, BITS Pilani, BITS F444/ CS


September 2016 10
F407
symbols in FOL
• objects (constants), functions, predicates
• interpretations specify meaning of each
symbol (intended interpretation)
• models determine truth of sentences
– e.g. if symbols Doreen and Mother(Art) refer to same object
then statement
Mother(Art) = Doreen is true

Vandana, CSIS, BITS Pilani, BITS F444/ CS


September 2016 11
F407
The quantifiers
• allow statements about many objects
– apply to sentence containing variable
• universal ": true for all substitutions for the
variable
• existential $: true for at least one substitution
for the variable

Vandana, CSIS, BITS Pilani, BITS F444/ CS


September 2016 12
F407
The quantifiers

• examples:
– $x: Mother(Art) = x
– "x "y: Mother(x)=Mother(y) => Sibling(x,y)
– "y $x: Mother(y) = x

Vandana, CSIS, BITS Pilani, BITS F444/ CS


September 2016 13
F407
Example domain - kinship
• objects – people
• functions
– Mother(x), Father(x)
• predicates
– Female(x), Parent(x,y), Spouse(x,y)
• definitions (compound sentences in KB)
– "x: Male(x) <=> ~ Female(x)
– "x $y : y = Mother(x) <=> Female(y)^Parent(y,x)
– "x $y : y = Father(x) <=> Male(y)^Parent(y,x)
• define these:
– child, grandparent, sibling, brother

Vandana, CSIS, BITS Pilani, BITS F444/ CS


September 2016 14
F407
Truth in First-Order Logic
• Sentences are true with respect to a model and an
interpretation
• Model contains >= 1 object (domain elements) and relations
among them
• Interpretation specifies referents for
– constant symbols -> objects
– predicate symbols -> relations
– function symbols -> functional relations

• An atomic sentence predicate( term1,…,termn) is true iff the


objects referred to by term1,…,termn are in the relation
referred to by predicate

Vandana, CSIS, BITS Pilani, BITS F444/ CS


September 2016 15
F407
Universal Quantification
• " <variables> <sentence>
• "x P is true in a model m iff P with x being each
possible object in the model

• Equivalent to the conjunction of instantiations of P


– At(Mike, JNU)  Smart(Mike) 
– At(Laurie, JNU)  Smart(Laurie) 
– At(Sarah, JNU)  Smart(Sarah) 
–…

Vandana, CSIS, BITS Pilani, BITS F444/ CS


September 2016 16
F407
A Common Mistake to Avoid
• Typically  is the main connective with "

• Common mistake: using  as the main


connective with "

• "x At(x, JNU)  Smart(x)

Vandana, CSIS, BITS Pilani, BITS F444/ CS


September 2016 17
F407
Existential Quantification
• $ <variables> <sentence>
• $ x P is true in a model m iff P with x being at least
one possible object in the model

• Equivalent to the disjunction of instantiations of P


– At(Mike, JNU)  Smart(Mike) 
– At(Laurie, JNU)  Smart(Laurie) 
– At(Sarah, JNU)  Smart(Sarah) 
–…

Vandana, CSIS, BITS Pilani, BITS F444/ CS


September 2016 18
F407
Another Common Mistake to Avoid
• Typically,  is the main connective with $

• Common mistake: using  as the main


connective with $

• $ x At(x, JNU)  Smart(x)

Vandana, CSIS, BITS Pilani, BITS F444/ CS


September 2016 19
F407
Examples
• Everyone likes McDonalds
– "x, likes(x, McDonalds)
• Someone likes McDonalds
– $x, likes(x, McDonalds)
• All children like McDonalds
– "x, child(x)  likes(x, McDonalds)
• Everyone likes McDonalds unless they are allergic to it
– "x, likes(x, McDonalds)  allergic(x, McDonalds)
– "x, allergic (x, McDonalds)  likes(x,
McDonalds)
Vandana, CSIS, BITS Pilani, BITS F444/ CS
September 2016 20
F407

You might also like