FM-Lect07-Fall2024-Satisfiability Modulo Theory (SMT) and First Order Logic
FM-Lect07-Fall2024-Satisfiability Modulo Theory (SMT) and First Order Logic
Modulo Theory
Nigar Azhar Butt
Give examples
of problems
that we
cannot easily
encode in SAT?
Dreadbury Mansion Mystery
Dreadbury Mansion Mystery
(in FOL)
Dog, Cat, Mouse
Puzzle
Dog, Cat, Mouse
Puzzle
More Math
Challanges
Second
Language
First order Logic
First-order logic
• First-order logic (FOL) models the world in terms of
• Objects, which are things with individual identities
• Properties of objects that distinguish them from other
objects
• Relations that hold among sets of objects
• Functions, which are a subset of relations where there is
only one “value” for any given “input”
• Examples:
• Objects: Students, lectures, companies, cars ...
• Relations: Brother-of, bigger-than, outside, part-of, has-
color, occurs-after, owns, visits, precedes, ...
• Properties: blue, oval, even, large, ...
• Functions: father-of, best-friend, second-half, one-more-
than ...
User provides
• Constant symbols, which represent individuals in the
world
• Mary
• 3
• Green
• Function symbols, which map individuals to
individuals
• father-of(Mary) = John
• color-of(Sky) = Blue
• Predicate symbols, which map individuals to truth
values
• greater(5,3)
• green(Grass)
• color(Grass, Green)
FOL Provides
• Variable symbols
• E.g., x, y, foo
• Connectives
• Same as in PL: not (), and (), or (), implies
(), if and only if (biconditional )
• Quantifiers
• Universal x or (Ax)
• Existential x or (Ex)
Components of FOL
Quantifiers
•Universal Quantifier (∀): "For all"
• Introduce this by asking students to express general statements (e.g., “All
humans are mortal” becomes ∀ x (Human(x) → Mortal(x))).
•Existential Quantifier (∃): "There exists"
• Explain this through specific statements (e.g., "There exists a person who
is a doctor" becomes ∃ x (Person(x) ∧ Doctor(x))).
•Important Tips:
• Emphasize the difference between universal and existential quantifiers,
and how negation affects them (e.g., ¬∀x P(x) is equivalent to ∃x ¬P(x)).
• Teach common misconceptions like confusing "for all" with "there exists."
Examples
Example 1: "All humans are mortal."
•Translate to FOL: ∀ x (Human(x) → Mortal(x))
Constants:
•CardiologyDepartment: Refers to the specific department.
•FiveYears: Represents the value of five years of experience.
•HeartSurgery: Represents the heart surgery operation.
Variables:
•d: Represents a doctor.
•p: Represents a patient.
•exp: Represents years of experience.
Examples
Predicates:
•Doctor(d): Represents that d is a doctor.
•WorksIn(d, CardiologyDepartment): Represents that d works in the
cardiology department.
•Experience(d, exp): Represents that d has exp years of experience.
•Eligible(d): Represents that d is eligible to perform heart surgeries.
•ValidInsurance(p): Represents that p has a valid health insurance
policy.
Examples
Functions:
•Perform(d, HeartSurgery, p): Represents that doctor d performs a
heart surgery on patient p.
Quantifiers:
•Universal Quantifier (∀): For every doctor, if they work in the
cardiology department and have more than five years of
experience, they are eligible.
•Existential Quantifier (∃): There exists a valid insurance policy
for the patient.
Examples
FOL expression:
∀ d ∀ p ((Doctor(d) ∧ WorksIn(d, CardiologyDepartment) ∧
Experience(d, exp) ∧ exp > FiveYears ∧ ValidInsurance(p)) →
Eligible(d) ∧ Perform(d, HeartSurgery, p))
Example: Academic System