0% found this document useful (0 votes)
173 views6 pages

Discrete Mathematics:1st Order Logic

The document contains announcements for the CS311H: Discrete Mathematics course, including: - The homework is due at the beginning of the next lecture and students should bring a hard copy of solutions. - The next topic will be an introduction to first-order logic, which is more expressive than propositional logic and allows for inferences about concepts like "everyone" and "someone". - The building blocks of first-order logic are constants, variables, and predicates, which can be used to represent properties and relationships between objects.

Uploaded by

Bablu Singh
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)
173 views6 pages

Discrete Mathematics:1st Order Logic

The document contains announcements for the CS311H: Discrete Mathematics course, including: - The homework is due at the beginning of the next lecture and students should bring a hard copy of solutions. - The next topic will be an introduction to first-order logic, which is more expressive than propositional logic and allows for inferences about concepts like "everyone" and "someone". - The building blocks of first-order logic are constants, variables, and predicates, which can be used to represent properties and relationships between objects.

Uploaded by

Bablu Singh
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/ 6

Announcements

CS311H: Discrete Mathematics

Introduction to First-Order Logic I Homework due at the beginning of next lecture

I Please bring a hard copy of solutions to class!


Instructor: Isl Dillig

Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 1/33 Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 2/33

Review: Proving Equivalence Formalizing English Arguments in Logic

I We can use logic to prove/disprove arguments.

I For example, consider the argument:


I Prove that (p q) is equivalent to p q using known
I If Joe drives fast, he gets a speeding ticket.
equivalences.
I Joe did not get a ticket.

I Therefore, Joe did not drive fast.

I Let f be the proposition Joe drives fast, and t be the


proposition Joe gets a ticket

I How do you prove using logic that above argument is valid?

Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 3/33 Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 4/33

Another Example Example, cont.

I Suppose your friend George make the following argument:


I If Jill carries an umbrella, it is raining.

I Jill is not carrying an umbrella. If Jill carries an umbrella, it is raining. Jill is not carrying an
umbrella. Therefore it is not raining.:
I Therefore it is not raining.
I How can we prove Georges argument is invalid?
I Is this argument valid? Prove/disprove using logic!

I Let u = Jill is carrying an umbrella, and r = It is raining

I How do we encode this argument in logic?

Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 5/33 Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 6/33

1
Why First-Order Logic? Building Blocks of First-Order Logic
I The building blocks of propositional logic were propositions
I So far, we studied the simplest logic: propositional logic, but,
in many cases, its not expressive enough
I In first-order logic, there are three kinds of basic building
I
blocks: constants, variables, predicates
Consider the statement Anyone who drives fast gets a
speeding ticket
I Constants: refer to specific objects (in a universe of discourse)
I From this, we should be able to conclude If Joe drives fast,
I Examples: 6, Austin, CS311, . . .
he will get a speeding ticket
I Variables: range over objects (in a universe of discourse)
I But PL does not allow inferences like that because we cannot
talk about concepts like everyone, someone etc.
I Examples: x,y,z, . . .
I First-order logic (predicate logic) is more expressive and allows
I If universe of discourse is cities in Texas, x can represent
such inferences
Houston, Austin, Dallas, San Antonio, . . .

Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 7/33 Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 8/33

Building Blocks of First-Order Logic, cont. Predicate Examples


I Predicates describe properties of objects or relationships
between objects

I Examples: ishappy, betterthan, loves, > . . . I Suppose Q(x , y) denotes x = y + 3

I Predicates can be applied to both constants and variables I What is the truth value of Q(3, 0)?

I Examples: ishappy(George), betterthan(x,y), I What is the truth value of Q(1, 2)?


loves(George, Rachel), x > 3, . . .
I What is the truth value of Q(x , 2)?
I A predicate P (x ) is true or false depending on whether
property P holds for x

I Example: ishappy(George) is true if George is happy, but false


otherwise

Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 9/33 Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 10/33

Formulas in First Order Logic Semantics of First-Order Logic


I In propositonal logic, the truth value of formula depends on a
truth assignment to variables.
I Formulas in first-order logic are formed using predicates and I In FOL, truth value of a formula depends interpretation of
logical connectives. predicate symbols and variables over some domain D
I Example: even(x) is also a formula I Consider a FOL formula P (x )
I Example: even(x) odd(x) is also a formula I A possible interpretation:
I Example: (odd(x) even(x)) even(x) D = {?, }, P (?) = true, P () = false, x = ?

I Under this interpretation, whats truth value of P (x )?

I What about if x = ?

Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 11/33 Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 12/33

2
More Examples Quantifiers

I Consider interpretation I over domain D = {1, 2}


I Real power of first-order logic over propositional logic:
I P (1, 1) = P (1, 2) = true, P (2, 1) = P (2, 2) = false quantifiers
I Q(1) = false, Q(2) = true I Quantifiers allow us to talk about all objects or the existence
I
of some object
x = 1, y = 2
I There are two quantifiers in first-order logic:
I What is truth value of P (x , y) Q(y) under I ?
1. Universal quantifier (): refers to all objects
I What is truth value of P (y, x ) Q(y) under I ?
2. Existential quantifier (): refers to some object
I What is truth value of P (x , y) Q(x ) under I ?

Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 13/33 Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 14/33

Universal Quantifiers More Universal Quantifier Examples

I Universal quantification of P (x ), x .P (x ), is the statement


P(x) holds for all objects x in the universe of discourse. I Consider the domain D of real numbers and predicate P (x )
with interpretation x 2 x
I x .P (x ) is true if predicate P is true for every object in the
universe of discourse, and false otherwise I What is the truth value of x .P (x )?

I Consider domain D = {, ?}, P () = true, P (?) = false I What is a counterexample?

I What is truth value of x .P (x )? I What if the domain is integers?

I Object o for which P (o) is false is counterexample of x .P (x ) I Observe: Truth value of a formula depends on a universe of
discourse!
I What is a counterexample for x .P (x ) in previous example?

Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 15/33 Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 16/33

Existential Quantifiers Existential Quantifier Examples

I Consider the domain of reals and predicate P (x ) with


I Existential quantification of P (x ), written x .P (x ), is There
exists an element x in the domain such that P (x ). interpretation x < 0.

I What is the truth value of x .P (x )?


I x .P (x ) is true if there is at least one element in the domain
such that P (x ) is true
I What if domain is positive integers?
I In first-order logic, domain is required to be non-empty.
I Let Q(y) be the statement y > y 2
I Consider domain D = {, ?}, P () = true, P (?) = false
I Whats truth value of y.Q(y) if domain is reals?
I What is truth value of x .P (x )?
I What about if domain is integers?

Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 17/33 Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 18/33

3
Quantifiers Summary Quantified Formulas

Statement When True? When False? I So far, only discussed how to quantify individual predicates,
x .P (x ) P (x ) is true for every x P (x ) is false for some x but can also quantify entire formulas
x .P (x ) P (x ) is true for some x P (x ) is false for every x
I x .(even(x ) gt(x , 100)) is a valid formula in FOL
I Consider finite universe of discourse with objects o1 , . . . , on
I Whats truth value of this formula if domain is all integers?
I x .P (x ) is true iff P (o1 ) P (o2 ) . . . P (on ) is true
I assuming even(x ) means x is even and gt(x , y) means x > y
I x .P (x ) is true iff P (o1 ) P (o2 ) . . . P (on ) is true
I What about x .(even(x ) gt(x , 100))?

Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 19/33 Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 20/33

More Examples of Quantified Formulas Translating English Into Quantified Formulas

I Consider the domain of integers and the predicates even(x)


and div4(x) which represents if x is divisible by 4 Assuming freshman(x ) means x is a freshman and inCS311(x )
x is taking CS311, express the following in FOL
I What is the truth value of the following quantified formulas?
I Someone in CS311 is a freshman
I x . (div 4(x ) even(x ))
I No one in CS311 is a freshman
I x . (even(x ) div 4(x ))
I Everyone taking CS311 are freshmen
I x . (div 4(x ) even(x ))
I Every freshman is taking CS311
I x . (div 4(x ) even(x ))

I x . (div 4(x ) even(x ))

Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 21/33 Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 22/33

DeMorgans Laws for Quantifiers Using DeMorgans Laws

I Learned about DeMorgans laws for propositional logic:

(p q) p q I Expressed Noone in CS311 is a freshman as


(p q) p q x .(inCS311(x ) freshman(x ))

I DeMorgans laws extend to first-order logic, e.g., I Lets apply DeMorgans law to this formula:
(even(x ) div 4(x )) (even(x ) div 4(x ))
I Using the fact that p q is equivalent to p q, we can
I Two new DeMorgans laws for quantifiers: write this formula as:

x .P (x ) x .P (x ) I Therefore, these two formulas are equivalent!


x .P (x ) x .P (x )

I When you push negation in, flips to and vice versa

Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 23/33 Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 24/33

4
Nested Quantifiers More Nested Quantifier Examples

I Sometimes may be necessary to use multiple quantifiers Using the loves(x,y) predicate, how can we say the following?
I For example, cant express Everybody loves someone using a I Someone loves everyone
single quantifier
I There is somone who doesnt love anyone
I Suppose predicate loves(x , y) means Person x loves person y
I There is someone who is not loved by anyone
I What does x .y.loves(x , y) mean?
I Everyone loves everyone
I What does y.x .loves(x , y) mean?
I There is someone who doesnt love herself/himself.
I Observe: Order of quantifiers is very important!

Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 25/33 Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 26/33

Summary of Nested Quantifiers Understanding Quantifiers

Statement When True?


x .y.P (x , y)
P (x , y) is true for every pair x , y
y.x .P (x , y)
x .y.P (x , y) For every x , there is a y for which P (x , y) is true
x .y.P (x , y) There is an x for which P (x , y) is true for every y
x .y.P (x , y)
There is a pair x , y for which P (x , y) is true
y.x .P (x , y)
Which formulas are true/false? If false, give a counterexample

I x .y. (sameShape(x , y) differentColor(x , y))


Observe: Order of quantifiers is only important if quantifiers of different
kinds!
I x .y. (sameColor(x , y) differentShape(x , y))

I x . (triangle(x ) (y. (circle(y) sameColor(x , y))))

Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 27/33 Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 28/33

Understanding Quantifiers, cont. Translating First-Order Logic into English

Given predicates student(x ), atUT (x ), and friends(x , y), what do


the following formulas say in English?

I x . ((atUT(x ) student(x )) (y.(friends(x , y) atUT (y))))

I x .((student(x ) atUT(x )) y.friends(x , y))


Which formulas are true/false? If false, give a counterexample
I x .y.((student(x ) student(y) friends(x , y))
I x .y. ((triangle(x ) square(y)) sameColor(x , y)) (atUT(x ) atUT(y)))

I x .y.sameShape(x , y)

I x . (circle(x ) (y.(circle(y) sameColor(x , y))))

Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 29/33 Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 30/33

5
Translating English into First-Order Logic Satisfiability, Validity in FOL

I The concepts of satisfiability, validity also important in FOL

I An FOL formula F is satisfiable if there exists some domain


Given predicates student(x ), atUT (x ), and friends(x , y), how do
we express the following in first-order logic? and some interpretation such that F evaluates to true

I Every UT student has a friend I Example: Prove that x .P (x ) Q(x ) is satisfiable.

I At least one UT student has no friends I An FOL formula F is valid if, for all domains and all
interpretations, F evaluates to true
I All UT students are friends with each other
I Prove that x .P (x ) Q(x ) is not valid.

I Formulas that are satisfiable, but not valid are contingent,


e.g., x .P (x ) Q(x )

Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 31/33 Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 32/33

Equivalence

I Two formulas F1 and F2 are equivalent if F1 F2 is valid

I In PL, we could prove equivalence using truth tables, but not


possible in FOL

I However, we can still use known equivalences to rewrite one


formula as the other

I Example: Prove that (x . (P (x ) Q(x ))) and


x . (P (x ) Q(x )) are equivalent.

I Example: Prove that x .y.P (x , y) and x .y.P (x , y) are


equivalent.

Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 33/33

You might also like