Tuesday, March 2, 2010

First-order-logic FOL

General rule:
Use ⇒ for ∀
Use ∧ for ∃

Every student loves some student.
∀ x ( Student(x)⇒∃ y ( Student(y)∧ Loves(x,y) ))

There is a student who is loved by every other student.
∃ x ( Student(x)∧∀ y ( Student(y)∧¬(x = y)⇒ Loves(y,x) ))

There is a student who is loved by every other student.
∃ x ( Student(x)∧∀ y ( Student(y)∧¬(x = y)⇒ Loves(y,x) ))

Bill takes either Analysis or Geometry (but not both)
Takes(Bill, Analysis)⇔¬ Takes(Bill, Geometry)

No student loves Bill.
¬∃ x ( Student(x)∧ Loves(x, Bill) )

Bill has at most one sister.
∀ x, y ( SisterOf(x, Bill)∧ SisterOf(y, Bill)⇒ x = y )

Bill has exactly one sister.
∃ x ( SisterOf(x, Bill)∧∀y ( SisterOf(y, Bill)⇒ x = y ))

Bill has at least two sisters.
∃ x, y ( SisterOf(x, Bill)∧ SisterOf(y, Bill)∧¬ (x = y) )

Only one student failed History.
∃ x ( Student(x)∧ Failed(x, History)∧∀y ( Student(y)∧ Failed(y, History)⇒ x = y ))

No student can fool all the other students.
¬∃ x ( Student(x)∧∀ y ( Student(y)∧¬ (x = y)⇒ Fools(x,y) ))

No comments: