What is First-Order Logic?
First-order logic (FOL), also known as predicate logic or first-order predicate calculus, is a formal system used in mathematics, philosophy, linguistics, and computer science. It extends propositional logic by allowing quantification over individuals and the use of predicates and functions.First-order logic provides a powerful framework for representing complex statements about objects, their properties, and their relationships in a mathematically precise way.
Core Components
Variables and Constants
In the NL2FOL system, variables are typically represented using lowercase letters (a, b, c, x, y, z):- Variables: Represent entities that can take different values (e.g.,
x,y) - Constants: Represent specific entities (e.g.,
afor “tall man”,bfor “cheese”)
Predicates
Predicates express properties or relationships between entities. In NL2FOL, predicates are extracted from natural language:Unary Predicates
Express properties of a single entity
IsTall(x)- “x is tall”LovesCheese(x)- “x loves cheese”
Binary Predicates
Express relationships between two entities
IsTouching(a,b)- “a is touching b”IsGiven(a,b)- “a is given to b”
Logical Connectives
The system uses standard logical operators to connect formulas:| Operator | Symbol | Meaning | Example |
|---|---|---|---|
| Conjunction | & or and | Logical AND | IsTall(x) & LovesCheese(x) |
| Disjunction | | or or | Logical OR | IsTall(x) | IsShort(x) |
| Implication | -> or => | If…then | IsSmacked(x) -> ~HasBadBehavior(x) |
| Negation | ~ or not | NOT | ~HasBadBehavior(x) |
The system applies heuristics to normalize operators, replacing
-> with & in claims and converting all connectives to their word forms (and, or) for processing.Quantifiers
Quantifiers specify how many individuals satisfy a given property:Universal Quantifier (∀ / forall)
Universal Quantifier (∀ / forall)
Universal quantification states that a property holds for all individuals in the domain.This means: “For all x, if x is tall, then x likes basketball.”In the system: Used primarily in implications to represent generalizations.
Existential Quantifier (∃ / exists)
Existential Quantifier (∃ / exists)
Existential quantification states that there exists at least one individual with a property.This means: “There exists an x such that x is tall and x loves cheese.”In the system: Used primarily in claims to represent specific instances.
FOL in NL2FOL
The NL2FOL system converts natural language fallacies into first-order logic formulas following this pattern:- Claim: The observation or premise (often with existential quantifiers)
- Implication: The conclusion drawn (often with universal quantifiers)
Example Transformation
Sorts and Type System
The system uses a sophisticated sort (type) system to ensure logical consistency:Sort Types
- BoundSet: For quantified variables (bound by
existsorforall) - UnboundSet: For free variables without explicit binding
- Bool: For boolean expressions and compound formulas
The sort system ensures that predicates are used consistently throughout the formula - if
IsTall(x) expects a BoundSet variable, it will always expect that sort.Logical Validity
A first-order logic formula is valid if it’s true under all interpretations. The NL2FOL system checks validity by:- Converting the FOL formula to SMT-LIB format
- Checking if the negation of the formula is unsatisfiable
- If the negation is unsatisfiable, the original formula is valid
For logical fallacies, we expect the formula to be invalid (the negation should be satisfiable), indicating the reasoning is flawed.
Next Steps
Logical Fallacies
Learn about the types of fallacies the system can detect
Translation Pipeline
Understand how natural language is converted to FOL
