Documente Academic
Documente Profesional
Documente Cultură
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
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
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!
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
I Predicates can be applied to both constants and variables I What is the truth value of Q(3, 0)?
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
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
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
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
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
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
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:
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
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
I x .y.sameShape(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 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.
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
Instructor: Isl Dillig, CS311H: Discrete Mathematics Introduction to First-Order Logic 33/33