maths.freeSet Theory & Logic › Logic › First-order logic

First-order logic

In mathematics, philosophy, linguistics, and computer science, first-order logic (FOL), also called predicate logic, predicate calculus, or quantificational logic, is a type of formal system.

First-order logic

In mathematics, philosophy, linguistics, and computer science, first-order logic (FOL), also called predicate logic, predicate calculus, or quantificational logic, is a type of formal system. First-order logic uses quantified variables over non-logical objects, and allows the use of sentences that contain variables. Rather than propositions such as "all humans are mortal", in first-order logic one can have expressions in the form "for all x, if x is a human, then x is mortal", where "for all x" is a quantifier, x is a variable, and "... is a human" and "... is mortal" are predicates. This distinguishes it from propositional logic, which does not use quantifiers or relations; in this sense, first-order logic is an extension of propositional logic.

A theory about a topic, such as set theory, a theory for groups, or a formal theory of arithmetic, is usually a first-order logic together with a specified domain of discourse (over which the quantified variables range), finitely many functions from that domain to itself, finitely many predicates defined on that domain, and a set of axioms believed to hold about them. "Theory" is sometimes understood in a more formal sense as just a set of sentences in first-order logic.

The term "first-order" distinguishes first-order logic from higher-order logic, in which there are predicates having predicates or functions as arguments, or in which quantification over predicates, functions, or both, are permitted. In first-order theories, predicates are often associated with sets. In interpreted higher-order theories, predicates may be interpreted as sets of sets.

There are many deductive systems for first-order logic which are both sound, i.e. all provable statements are true in all models; and complete, i.e. all statements which are true in all models are provable. Although the logical consequence relation is only semidecidable, much progress has been made in automated theorem proving in first-order logic. First-order logic also satisfies several metalogical theorems that make it amenable to analysis in proof theory, such as the Löwenheim-Skolem theorem and the compactness theorem.

First-order logic is the standard for the formalization of mathematics into axioms, and is studied in the foundations of mathematics. Peano arithmetic and Zermelo-Fraenkel set theory are axiomatizations of number theory and set theory, respectively, into first-order logic. No first-order theory, however, has the strength to uniquely describe a structure with an infinite domain, such as the natural numbers or the real line. Axiom systems that do fully describe these two structures, i.e. categorical axiom systems, can be obtained in stronger logics such as second-order logic.

Historically speaking, the foundations of first-order logic were developed independently by Gottlob Frege and Charles Sanders Peirce in the 1880s. However, the distinction between first-order and higher-order logic was not well understood until metalogical ideas and results arrived, such as Gödel's completeness theorem in 1929. By the 1940s, first-order logic had become the dominant language of mathematical foundations.

Introduction

While propositional logic deals with simple declarative propositions, first-order logic additionally covers predicates and quantification. A predicate evaluates to true or false for an entity or entities in the domain of discourse.

Consider the two sentences "Socrates is a philosopher" and "Plato is a philosopher". In propositional logic, these sentences themselves are viewed as the individuals of study, and might be denoted, for example, by variables such as p and q. They are not viewed as an application of a predicate, such as \(\text{isPhilosopher}\), to any particular objects in the domain of discourse, instead viewing them as purely an utterance which is either true or false. However, in first-order logic, these two sentences may be framed as statements that a certain individual or non-logical object has a property. In this example, both sentences happen to have the common form \(\text{isPhilosopher}(x)\) for some individual \(x\), in the first sentence the value of the variable x is "Socrates", and in the second sentence it is "Plato". Due to the ability to speak about non-logical individuals along with the original logical connectives, first-order logic includes propositional logic.

The truth of a formula such as "x is a philosopher" depends on which object is denoted by x and on the interpretation of the predicate "is a philosopher". Consequently, "x is a philosopher" alone does not have a definite truth value of true or false, and is akin to a sentence fragment. Relationships between predicates can be stated using logical connectives. For example, the first-order formula "if x is a philosopher, then x is a scholar", is a conditional statement with "x is a philosopher" as its hypothesis, and "x is a scholar" as its conclusion, which again needs specification of x in order to have a definite truth value.

Quantifiers can be applied to variables in a formula. The variable x in the previous formula can be universally quantified, for instance, with the first-order sentence "For every x, if x is a philosopher, then x is a scholar". The universal quantifier "for every" in this sentence expresses the idea that the claim "if x is a philosopher, then x is a scholar" holds for all choices of x.

The negation of the sentence "For every x, if x is a philosopher, then x is a scholar" is logically equivalent to the sentence "There exists x such that x is a philosopher and x is not a scholar". The existential quantifier "there exists" expresses the idea that the claim "x is a philosopher and x is not a scholar" holds for some choice of x.

The predicates "is a philosopher" and "is a scholar" each take a single variable. In general, predicates can take several variables. In the first-order sentence "Socrates is the teacher of Plato", the predicate "is the teacher of" takes two variables.

Condensed: the full section is in Wikipedia.

Syntax

Unlike natural languages, such as English, the language of first-order logic is completely formal, so that it can be mechanically determined whether a given expression is well formed. There are two key types of well-formed expressions: terms, which intuitively represent objects, and formulas, which intuitively express statements that can be true or false. The terms and formulas of first-order logic are strings of symbols, where all the symbols together form the alphabet of the language.

Alphabet

As with all formal languages, the nature of the symbols themselves is outside the scope of formal logic; they are often regarded simply as letters and punctuation symbols.

It is common to divide the symbols of the alphabet into logical symbols, which always have the same meaning, and non-logical symbols, whose meaning varies by interpretation. For example, the logical symbol \(\land\) always represents "and"; it is never interpreted as "or", which is represented by the logical symbol \(\lor\). However, a non-logical predicate symbol such as Phil(x) could be interpreted to mean "x is a philosopher", "x is a man named Philip", or any other unary predicate depending on the interpretation at hand.

Formation rules

The formation rules define the terms and formulas of first-order logic. When terms and formulas are represented as strings of symbols, these rules can be used to write a formal grammar for terms and formulas. These rules are generally context-free (each production has a single symbol on the left side), except that the set of symbols may be allowed to be infinite and there may be many start symbols, for example the variables in the case of terms.

Free and bound variables

In a formula, a variable may occur free or bound (or both). One formalization of this notion is due to Quine, first the concept of a variable occurrence is defined, then whether a variable occurrence is free or bound, then whether a variable symbol overall is free or bound. In order to distinguish different occurrences of the identical symbol x, each occurrence of a variable symbol x in a formula φ is identified with the initial substring of φ up to the point at which said instance of the symbol x appears. Then, an occurrence of x is said to be bound if that occurrence of x lies within the scope of at least one of either \(\exists x\) or \(\forall x\). Finally, x is bound in φ if all occurrences of x in φ are bound.

Intuitively, a variable symbol is free in a formula if at no point is it quantified: in ∀y P(x, y), the sole occurrence of variable x is free while that of y is bound. The free and bound variable occurrences in a formula are defined inductively as follows.

Atomic formulas

If φ is an atomic formula, then x occurs free in φ if and only if x occurs in φ. Moreover, there are no bound variables in any atomic formula.

Negation

x occurs free in ¬φ if and only if x occurs free in φ. x occurs bound in ¬φ if and only if x occurs bound in φ

Binary connectives

x occurs free in (φψ) if and only if x occurs free in either φ or ψ. x occurs bound in (φψ) if and only if x occurs bound in either φ or ψ. The same rule applies to any other binary connective in place of →.

Quantifiers

x occurs free in ∀y φ, if and only if x occurs free in φ and x is a different symbol from y. Also, x occurs bound in ∀y φ, if and only if x is y or x occurs bound in φ. The same rule holds with ∃ in place of ∀.

For example, in ∀xy (P(x) → Q(x,f(x),z)), x and y occur only bound, z occurs only free, and w is neither because it does not occur in the formula.

Free and bound variables of a formula need not be disjoint sets: in the formula P(x) → ∀x Q(x), the first occurrence of x, as argument of P, is free while the second one, as argument of Q, is bound.

A formula in first-order logic with no free variable occurrences is called a first-order sentence. These are the formulas that will have well-defined truth values under an interpretation. For example, whether a formula such as Phil(x) is true must depend on what x represents. But the sentence ∃x Phil(x) will be either true or false in a given interpretation.

Example: ordered abelian groups

In mathematics, the language of ordered abelian groups has one constant symbol 0, one unary function symbol −, one binary function symbol +, and one binary relation symbol ≤. Then:

  • The expressions +(x, y) and +(x, +(y, −(z))) are terms. These are usually written as x + y and x + yz.
  • The expressions +(x, y) = 0 and ≤(+(x, +(y, −(z))), +(x, y)) are atomic formulas. These are usually written as x + y = 0 and x + yz  ≤  x + y.
  • The expression \((\forall x \forall y \, [\mathop{\leq}(\mathop{+}(x, y), z) \to \forall x\, \forall y\, \mathop{+}(x, y) = 0)]\) is a formula, which is usually written as \(\forall x \forall y ( x + y \leq z) \to \forall x \forall y (x+y = 0).\) This formula has one free variable, z.

The axioms for ordered abelian groups can be expressed as a set of sentences in the language. For example, the axiom stating that the group is commutative is usually written \((\forall x)(\forall y)[x+ y = y + x].\)

Semantics

An interpretation of a first-order language assigns a denotation to each non-logical symbol (predicate symbol, function symbol, or constant symbol) in that language. It also determines a domain of discourse that specifies the range of the quantifiers. The result is that each term is assigned an object that it represents, each predicate is assigned a property of objects, and each sentence is assigned a truth value. In this way, an interpretation provides semantic meaning to the terms, predicates, and formulas of the language. The study of the interpretations of formal languages is called formal semantics. What follows is a description of the standard or Tarskian semantics for first-order logic. (It is also possible to define game semantics for first-order logic, but aside from requiring the axiom of choice, game semantics agree with Tarskian semantics for first-order logic, so game semantics will not be elaborated here.)

First-order structures

The most common way of specifying an interpretation (especially in mathematics) is to specify a structure (also called a model; see below). The structure consists of a domain of discourse D and an interpretation function I mapping non-logical symbols to predicates, functions, and constants.

The domain of discourse D is a nonempty set of "objects" of some kind. Intuitively, given an interpretation, a first-order formula becomes a statement about these objects; for example, \(\exists x P(x)\) states the existence of some object in D for which the predicate P is true (or, more precisely, for which the predicate assigned to the predicate symbol P by the interpretation is true). For example, one can take D to be the set of integers.

Non-logical symbols are interpreted as follows:

  • The interpretation of an n-ary function symbol is a function from D to D. For example, if the domain of discourse is the set of integers, a function symbol f of arity 2 can be interpreted as the function that gives the sum of its arguments. In other words, the symbol f is associated with the function ⁠\(I(f)\)⁠ which, in this interpretation, is addition.
  • The interpretation of a constant symbol (a function symbol of arity 0) is a function from D (a set whose only member is the empty tuple) to D, which can be simply identified with an object in D. For example, an interpretation may assign the value \(I(c)=10\) to the constant symbol \(c\).
  • The interpretation of an n-ary predicate symbol is a set of n-tuples of elements of D, giving the arguments for which the predicate is true. For example, an interpretation \(I(P)\) of a binary predicate symbol P may be the set of pairs of integers such that the first one is less than the second. According to this interpretation, the predicate P would be true if its first argument is less than its second argument. Equivalently, predicate symbols may be assigned Boolean-valued functions from D to \(\{\mathrm{true, false}\}\).

Evaluation of truth values

A formula evaluates to true or false given an interpretation and a variable assignment μ that associates an element of the domain of discourse with each variable. The reason that a variable assignment is required is to give meanings to formulas with free variables, such as \(y = x\). The truth value of this formula changes depending on the values that x and y denote.

First, the variable assignment μ can be extended to all terms of the language, with the result that each term maps to a single element of the domain of discourse. The following rules are used to make this assignment:

  • Variables. Each variable x evaluates to μ(x)
  • Functions. Given terms \(t_1, \ldots, t_n\) that have been evaluated to elements \(d_1, \ldots, d_n\) of the domain of discourse, and a n-ary function symbol f, the term \(f(t_1, \ldots, t_n)\) evaluates to \((I(f))(d_1,\ldots,d_n)\).

Next, each formula is assigned a truth value. The inductive definition used to make this assignment is called the T-schema.

  • Atomic formulas (1). A formula \(P(t_1,\ldots,t_n)\) is associated the value true or false depending on whether \(\langle v_1,\ldots,v_n \rangle \in I(P)\), where \(v_1,\ldots,v_n\) are the evaluation of the terms \(t_1,\ldots,t_n\) and \(I(P)\) is the interpretation of \(P\), which by assumption is a subset of \(D^n\).
  • Atomic formulas (2). A formula \(t_1 = t_2\) is assigned true if \(t_1\) and \(t_2\) evaluate to the same object of the domain of discourse (see the section on equality below).
  • Logical connectives. A formula in the form \(\neg \varphi\), \(\varphi \rightarrow \psi\), etc. is evaluated according to the truth table for the connective in question, as in propositional logic.
  • Existential quantifiers. A formula \(\exists x \varphi(x)\) is true according to M and \(\mu\) if there exists an evaluation \(\mu'\) of the variables that differs from \(\mu\) at most regarding the evaluation of x and such that φ is true according to the interpretation M and the variable assignment \(\mu'\). This formal definition captures the idea that \(\exists x \varphi(x)\) is true if and only if there is a way to choose a value for x such that φ(x) is satisfied.
  • Universal quantifiers. A formula \(\forall x \varphi(x)\) is true according to M and \(\mu\) if φ(x) is true for every pair composed by the interpretation M and some variable assignment \(\mu'\) that differs from \(\mu\) at most on the value of x. This captures the idea that \(\forall x \varphi(x)\) is true if every possible choice of a value for x causes φ(x) to be true.

If a formula does not contain free variables, and thus is a sentence, then the initial variable assignment does not affect its truth value. In other words, a sentence is true according to M and \(\mu\) if and only if it is true according to M and every other variable assignment \(\mu'\).

  • Existential quantifiers (alternate). A formula \(\exists x \varphi(x)\) is true according to M if there is some d in the domain of discourse such that \(\varphi(c_d)\) holds. Here \(\varphi(c_d)\) is the result of substituting cd for every free occurrence of x in φ.
  • Universal quantifiers (alternate). A formula \(\forall x \varphi(x)\) is true according to M if, for every d in the domain of discourse, \(\varphi(c_d)\) is true according to M.

Condensed: the full section is in Wikipedia.

Validity, satisfiability, and logical consequence

If a sentence φ evaluates to true under a given interpretation M, one says that M satisfies φ; this is denoted \(M \vDash \varphi\). A sentence is satisfiable if there is some interpretation under which it is true. This is a bit different from the symbol \(\vDash\) from model theory, where \(M\vDash\phi\) denotes satisfiability in a model, i.e. "there is a suitable assignment of values in \(M\)'s domain to variable symbols of \(\phi\)".

Satisfiability of formulas with free variables is more complicated, because an interpretation on its own does not determine the truth value of such a formula. The most common convention is that a formula φ with free variables \(x_1\), ..., \(x_n\) is said to be satisfied by an interpretation if the formula φ remains true regardless which individuals from the domain of discourse are assigned to its free variables \(x_1\), ..., \(x_n\). This has the same effect as saying that a formula φ is satisfied if and only if its universal closure \(\forall x_1 \dots \forall x_n \phi (x_1, \dots, x_n)\) is satisfied.

A formula is logically valid (or simply valid) if it is true in every interpretation. These formulas play a role similar to tautologies in propositional logic.

A formula φ is a logical consequence of a formula ψ if every interpretation that makes ψ true also makes φ true. In this case one says that φ is logically implied by ψ.

Algebraizations

An alternate approach to the semantics of first-order logic proceeds via abstract algebra. This approach generalizes the Lindenbaum-Tarski algebras of propositional logic. There are three ways of eliminating quantified variables from first-order logic that do not involve replacing quantifiers with other variable binding term operators:

  • Cylindric algebra, by Alfred Tarski, et al.;
  • Polyadic algebra, by Paul Halmos;
  • Predicate functor logic, primarily by Willard Quine.

These algebras are all lattices that properly extend the two-element Boolean algebra.

Tarski and Givant (1987) showed that the fragment of first-order logic that has no atomic sentence lying in the scope of more than three quantifiers has the same expressive power as relation algebra. This fragment is of great interest because it suffices for Peano arithmetic and most axiomatic set theory, including the canonical Zermelo-Fraenkel set theory (ZFC). They also prove that first-order logic with a primitive ordered pair is equivalent to a relation algebra with two ordered pair projection functions.

First-order theories, models, and elementary classes

A first-order theory of a particular signature is a set of axioms, which are sentences consisting of symbols from that signature. The set of axioms is often finite or recursively enumerable, in which case the theory is called effective. Some authors require theories to also include all logical consequences of the axioms. The axioms are considered to hold within the theory and from them other sentences that hold within the theory can be derived.

A first-order structure that satisfies all sentences in a given theory is said to be a model of the theory. An elementary class is the set of all structures satisfying a particular theory. These classes are a main subject of study in model theory.

Many theories have an intended interpretation, a certain model that is kept in mind when studying the theory. For example, the intended interpretation of Peano arithmetic consists of the usual natural numbers with their usual operations. However, the Löwenheim-Skolem theorem shows that most first-order theories will also have other, nonstandard models.

A theory is consistent (within a deductive system) if it is not possible to prove a contradiction from the axioms of the theory. A theory is complete if, for every formula in its signature, either that formula or its negation is a logical consequence of the axioms of the theory. Gödel's incompleteness theorem shows that effective first-order theories that include a sufficient portion of the arithmetic of the natural numbers can never be both consistent and complete.

Empty domains

The definition above requires that the domain of discourse of any interpretation must be nonempty. There are settings, such as inclusive logic, where empty domains are permitted. Moreover, if a class of algebraic structures includes an empty structure (for example, there is an empty poset), that class can only be an elementary class in first-order logic if empty domains are permitted or the empty structure is removed from the class.

There are several difficulties with empty domains, however:

  • Many common rules of inference are valid only when the domain of discourse is required to be nonempty. One example is the rule stating that \(\varphi \lor \exists x \psi\) implies \(\exists x (\varphi \lor \psi)\) when x is not a free variable in \(\varphi\). This rule, which is used to put formulas into prenex normal form, is sound in nonempty domains, but unsound if the empty domain is permitted.
  • The definition of truth in an interpretation that uses a variable assignment function cannot work with empty domains, because there are no variable assignment functions whose range is empty. (Similarly, one cannot assign interpretations to constant symbols.) This truth definition requires that one must select a variable assignment function (μ above) before truth values for even atomic formulas can be defined. Then the truth value of a sentence is defined to be its truth value under any variable assignment, and it is proved that this truth value does not depend on which assignment is chosen. This technique does not work if there are no assignment functions at all; it must be changed to accommodate empty domains.

Thus, when the empty domain is permitted, it must often be treated as a special case. Most authors, however, simply exclude the empty domain by definition.

İndi siz Heç bir hesablama proqramı bu ədədi həll edə bilməz, lakin onun hissələri hesablana bilər. Aşağıdakılardan birini sınayın ya da özünüz yazın.

Özün işlə

Pulsuz hesab hər dərsdə qeydlər əlavə edir, bitirdiyiniz işlərin qeydini saxlayır, həll etdiyiniz problemləri bir yerdə saxlayır və bu səhifə haqqında soruşa biləcəyiniz müəllimi də əlavə edir. Riyaziyyat özü daxil olub-olmadığınıza baxmayaraq hər kəsə açıqdır.

Qeyd Et Giriş

Burada istifadə edilən simvollar

Tam təsviri, şəkli və hər hərfin nə demək olduğunu görmək üçün hər hansı simvolu vurun.

İnsanlar soruşurlar

Are some infinities bigger than others?

Yes. The integers and the rationals can be listed; the real numbers cannot (Cantor's diagonal argument), so there are strictly more reals than integers.

What is the difference between a relation and a function?

A relation pairs inputs with outputs freely; a function is a relation in which every input gets exactly one output.

Bu səhifənin bəzi hissələri Wikipedia (CC BY-SA 4.0). Bu, bizim üçün çox böyük bir uğurdur, biz bunu çox istəyirik.

Daha çox Set Theory & Logic