Mathematical Logic

🤔Mathematical Logic Unit 4 – First–Order Logic (Predicate Logic)

First-order logic expands on propositional logic by introducing quantifiers, variables, and predicates. This powerful system allows for more nuanced expressions of relationships and properties, enabling precise formalization of complex statements in mathematics, computer science, and philosophy. The syntax and semantics of first-order logic provide a framework for constructing and interpreting well-formed formulas. Key concepts include terms, atomic formulas, complex formulas, interpretations, and variable assignments, which together form the foundation for logical reasoning and formal proofs.

Key Concepts and Terminology

  • First-order logic (FOL) extends propositional logic by introducing quantifiers, variables, and predicates
  • Predicates are symbols that represent relations or properties of objects (e.g., P(x)P(x) could represent "xx is prime")
  • Variables are symbols that stand for objects in the domain of discourse (e.g., xx, yy, zz)
  • Constants are symbols that represent specific objects in the domain (e.g., aa, bb, cc)
  • Functions are symbols that map objects to other objects (e.g., f(x)f(x) could represent "the father of xx")
  • Terms are variables, constants, or functions applied to terms (e.g., xx, aa, f(x)f(x), g(a,f(y))g(a, f(y)))
  • Atomic formulas are predicates applied to terms (e.g., P(x)P(x), Q(a,f(y))Q(a, f(y)))
  • Complex formulas are built from atomic formulas using logical connectives (¬\neg, \wedge, \vee, \rightarrow, \leftrightarrow) and quantifiers (\forall, \exists)

Syntax of First-Order Logic

  • The syntax of FOL specifies the rules for constructing well-formed formulas (wffs)
  • Variables, constants, and predicates are chosen from disjoint sets of symbols
  • Terms are defined recursively:
    • Variables and constants are terms
    • If ff is an nn-ary function and t1,,tnt_1, \ldots, t_n are terms, then f(t1,,tn)f(t_1, \ldots, t_n) is a term
  • Atomic formulas are of the form P(t1,,tn)P(t_1, \ldots, t_n), where PP is an nn-ary predicate and t1,,tnt_1, \ldots, t_n are terms
  • Complex formulas are built using the following rules:
    • If ϕ\phi is a formula, then ¬ϕ\neg \phi is a formula
    • If ϕ\phi and ψ\psi are formulas, then (ϕψ)(\phi \wedge \psi), (ϕψ)(\phi \vee \psi), (ϕψ)(\phi \rightarrow \psi), and (ϕψ)(\phi \leftrightarrow \psi) are formulas
    • If ϕ\phi is a formula and xx is a variable, then xϕ\forall x \phi and xϕ\exists x \phi are formulas
  • Parentheses are used to disambiguate the structure of formulas

Semantics and Interpretations

  • The semantics of FOL assigns meaning to the symbols and formulas
  • An interpretation I\mathcal{I} consists of a non-empty domain DD and a function that maps:
    • Constants to elements of DD
    • nn-ary functions to functions from DnD^n to DD
    • nn-ary predicates to subsets of DnD^n
  • A variable assignment ss is a function that maps variables to elements of DD
  • The value of a term tt under an interpretation I\mathcal{I} and assignment ss, denoted Is(t)\mathcal{I}_{s}(t), is defined recursively:
    • If tt is a variable xx, then Is(t)=s(x)\mathcal{I}_{s}(t) = s(x)
    • If tt is a constant cc, then Is(t)=I(c)\mathcal{I}_{s}(t) = \mathcal{I}(c)
    • If tt is f(t1,,tn)f(t_1, \ldots, t_n), then Is(t)=I(f)(Is(t1),,Is(tn))\mathcal{I}_{s}(t) = \mathcal{I}(f)(\mathcal{I}_{s}(t_1), \ldots, \mathcal{I}_{s}(t_n))
  • The truth value of a formula ϕ\phi under an interpretation I\mathcal{I} and assignment ss, denoted Isϕ\mathcal{I} \models_{s} \phi, is defined recursively:
    • IsP(t1,,tn)\mathcal{I} \models_{s} P(t_1, \ldots, t_n) iff (Is(t1),,Is(tn))I(P)(\mathcal{I}_{s}(t_1), \ldots, \mathcal{I}_{s}(t_n)) \in \mathcal{I}(P)
    • Is¬ϕ\mathcal{I} \models_{s} \neg \phi iff I̸sϕ\mathcal{I} \not\models_{s} \phi
    • Is(ϕψ)\mathcal{I} \models_{s} (\phi \wedge \psi) iff Isϕ\mathcal{I} \models_{s} \phi and Isψ\mathcal{I} \models_{s} \psi
    • Is(ϕψ)\mathcal{I} \models_{s} (\phi \vee \psi) iff Isϕ\mathcal{I} \models_{s} \phi or Isψ\mathcal{I} \models_{s} \psi
    • Is(ϕψ)\mathcal{I} \models_{s} (\phi \rightarrow \psi) iff I̸sϕ\mathcal{I} \not\models_{s} \phi or Isψ\mathcal{I} \models_{s} \psi
    • Is(ϕψ)\mathcal{I} \models_{s} (\phi \leftrightarrow \psi) iff Isϕ\mathcal{I} \models_{s} \phi iff Isψ\mathcal{I} \models_{s} \psi
    • Isxϕ\mathcal{I} \models_{s} \forall x \phi iff for all dDd \in D, Is[xd]ϕ\mathcal{I} \models_{s[x \mapsto d]} \phi
    • Isxϕ\mathcal{I} \models_{s} \exists x \phi iff there exists dDd \in D such that Is[xd]ϕ\mathcal{I} \models_{s[x \mapsto d]} \phi

Quantifiers and Variables

  • Quantifiers are logical symbols that express the quantity of objects that satisfy a given formula
  • The universal quantifier \forall ("for all") asserts that a formula holds for all objects in the domain
    • Example: x(P(x)Q(x))\forall x (P(x) \rightarrow Q(x)) means "for every xx, if P(x)P(x) holds, then Q(x)Q(x) holds"
  • The existential quantifier \exists ("there exists") asserts that a formula holds for at least one object in the domain
    • Example: x(P(x)Q(x))\exists x (P(x) \wedge Q(x)) means "there exists an xx such that both P(x)P(x) and Q(x)Q(x) hold"
  • Variables are symbols that stand for arbitrary objects in the domain
  • A variable is called free if it is not bound by a quantifier
    • Example: in x(P(x)Q(y))\forall x (P(x) \rightarrow Q(y)), xx is bound, but yy is free
  • A formula with no free variables is called a sentence
  • The scope of a quantifier is the formula it quantifies over
    • Example: in x(P(x)yQ(x,y))\forall x (P(x) \rightarrow \exists y Q(x, y)), the scope of x\forall x is (P(x)yQ(x,y))(P(x) \rightarrow \exists y Q(x, y)), and the scope of y\exists y is Q(x,y)Q(x, y)
  • Quantifiers can be nested, allowing for complex statements about objects and their relationships

Formal Proofs and Inference Rules

  • Formal proofs are sequences of formulas, each of which is either an axiom or derived from previous formulas using inference rules
  • Inference rules are syntactic rules that allow new formulas to be derived from existing ones
  • Some common inference rules in FOL include:
    • Modus ponens: from ϕ\phi and ϕψ\phi \rightarrow \psi, infer ψ\psi
    • Universal instantiation: from xϕ\forall x \phi, infer ϕ[xt]\phi[x \mapsto t] for any term tt
    • Existential generalization: from ϕ[xt]\phi[x \mapsto t], infer xϕ\exists x \phi
    • Conjunction introduction: from ϕ\phi and ψ\psi, infer ϕψ\phi \wedge \psi
    • Conjunction elimination: from ϕψ\phi \wedge \psi, infer ϕ\phi (or ψ\psi)
  • A proof system is sound if every formula derivable in the system is logically valid
  • A proof system is complete if every logically valid formula is derivable in the system
  • Gödel's completeness theorem states that FOL is complete: if a formula is logically valid, then it has a formal proof

Validity and Satisfiability

  • A formula ϕ\phi is satisfiable if there exists an interpretation I\mathcal{I} and an assignment ss such that Isϕ\mathcal{I} \models_{s} \phi
    • Example: xP(x)\exists x P(x) is satisfiable, as there is an interpretation with a non-empty domain and an object that satisfies PP
  • A formula ϕ\phi is unsatisfiable if there is no interpretation I\mathcal{I} and assignment ss such that Isϕ\mathcal{I} \models_{s} \phi
    • Example: xP(x)x¬P(x)\forall x P(x) \wedge \exists x \neg P(x) is unsatisfiable, as no object can both satisfy and not satisfy PP
  • A formula ϕ\phi is logically valid (or a tautology) if for every interpretation I\mathcal{I} and assignment ss, Isϕ\mathcal{I} \models_{s} \phi
    • Example: x(P(x)¬P(x))\forall x (P(x) \vee \neg P(x)) is logically valid, as every object either satisfies PP or does not satisfy PP
  • A formula ϕ\phi is logically invalid if there exists an interpretation I\mathcal{I} and an assignment ss such that I̸sϕ\mathcal{I} \not\models_{s} \phi
  • Logical validity and satisfiability are related: a formula is logically valid iff its negation is unsatisfiable
  • Determining the satisfiability or validity of FOL formulas is an undecidable problem in general

Applications and Examples

  • FOL is used to formalize and reason about statements in various domains, such as mathematics, computer science, and philosophy
  • In mathematics, FOL can be used to define and prove theorems about structures like groups, rings, and fields
    • Example: the associativity of a binary operation * can be expressed as xyz((xy)z=x(yz))\forall x \forall y \forall z ((x * y) * z = x * (y * z))
  • In computer science, FOL is used in formal specification and verification of software and hardware systems
    • Example: the Hoare triple {P}C{Q}\{P\} C \{Q\} can be expressed in FOL as Pwp(C,Q)P \rightarrow wp(C, Q), where wpwp is the weakest precondition predicate transformer
  • In database theory, FOL is used to define and query relational databases
    • Example: the query "find all employees who work in the sales department" can be expressed as x(Employee(x)Department(x,"sales"))\exists x (Employee(x) \wedge Department(x, "sales"))
  • FOL can be used to analyze and validate arguments in natural language
    • Example: the argument "all humans are mortal, Socrates is human, therefore Socrates is mortal" can be formalized as (x(Human(x)Mortal(x))Human(Socrates))Mortal(Socrates)(\forall x (Human(x) \rightarrow Mortal(x)) \wedge Human(Socrates)) \rightarrow Mortal(Socrates)
  • Many other logics, such as second-order logic, modal logic, and temporal logic, are extensions of FOL with additional expressive power

Common Pitfalls and Tips

  • Remember to use parentheses to disambiguate the structure of formulas, especially when using multiple connectives or quantifiers
    • Example: xP(x)Q(x)\forall x P(x) \rightarrow Q(x) is different from x(P(x)Q(x))\forall x (P(x) \rightarrow Q(x))
  • Be careful with the order of quantifiers, as it can significantly change the meaning of a formula
    • Example: xyP(x,y)\forall x \exists y P(x, y) is not equivalent to yxP(x,y)\exists y \forall x P(x, y)
  • When using multiple quantifiers, ensure that each variable is bound by a quantifier before it is used
    • Example: xyP(x,y,z)\forall x \exists y P(x, y, z) is not a well-formed formula if zz is not bound by a quantifier
  • Keep in mind that the domain of discourse can affect the truth value of a formula
    • Example: xy(x<y)\forall x \exists y (x < y) is true in the domain of natural numbers but false in the domain of integers
  • Use the negation of quantifiers to express complex statements more concisely
    • Example: ¬xP(x)\neg \forall x P(x) is equivalent to x¬P(x)\exists x \neg P(x), and ¬xP(x)\neg \exists x P(x) is equivalent to x¬P(x)\forall x \neg P(x)
  • Break down complex formulas into smaller, more manageable parts when analyzing or proving them
    • Example: to prove x(P(x)(Q(x)R(x)))\forall x (P(x) \rightarrow (Q(x) \wedge R(x))), prove x(P(x)Q(x))\forall x (P(x) \rightarrow Q(x)) and x(P(x)R(x))\forall x (P(x) \rightarrow R(x)) separately
  • Practice translating natural language statements into FOL and vice versa to develop a better understanding of the logic and its applications


© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.

© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.