First-order logicFrom Wikipedia, the free encyclopediaFirst-order logic (FOL) is a formal deductive system used in mathematics, philosophy, linguistics, and computer science. It goes by many names, including: first-order predicate calculus (FOPC), the lower predicate calculus, the language of first-order logic or predicate logic. Unlike natural languages such as English, FOL uses a wholly unambiguous formal language interpreted by mathematical structures. FOL is a system of deduction that extends propositional logic by allowing quantification over individuals of a given domain of discourse. For example, it can be stated in FOL "Every individual has the property P". While propositional logic deals with simple declarative propositions, first-order logic additionally covers predicates and quantification. Take for example the following sentences: "Socrates is a man", "Plato is a man". In propositional logic these will be two unrelated propositions, denoted for example by p and q. In first-order logic however, both sentences would be connected by the same property: Man(x), where Man(x) means that x is a man. When x=Socrates we get the first proposition, p, and when x=Plato we get the second proposition, q. Such a construction allows for a much more powerful logic when quantifiers are introduced, such as "for every x...", for example, "for every x, if Man(x), then...". Without quantifiers, every valid argument in FOL is valid in propositional logic, and vice versa. A first-order theory consists of a set of axioms (usually finite or recursively enumerable) and the statements deducible from them given the underlying deducibility relation. Usually what is meant by 'first-order theory' is some set of axioms together with those of a complete (and sound) axiomatization of first-order logic, closed under the rules of FOL. (Any such system FOL will give rise to the same abstract deducibility relation, so we needn't have a fixed axiomatic system in mind.) A first-order language has sufficient expressive power to formalize two important mathematical theories: ZFC set theory and (first-order) Peano arithmetic. A first-order language cannot, however, categorically express the notion of countability even though it is expressible in the first-order theory ZFC under the intended interpretation of the symbolism of ZFC. Such ideas can be expressed categorically with second-order logic. Why is first-order logic needed?Propositional logic is not adequate for formalizing valid arguments that rely on the internal structure of the propositions involved. To see this, consider the valid syllogistic argument:
which upon translation into propositional logic yields:
(taking According to propositional logic, this translation is invalid: Propositional logic validates arguments according to their structure, and nothing in the structure of this translated argument (C follows from A and B, for arbitrary A, B, C) suggests that it is valid. A translation that preserves the intuitive (and formal) validity of the argument must take into consideration the deeper structure of propositions, such as the essential notions of predication and quantification. Propositional logic deals only with truth-functional validity: any assignment of truth-values to the variables of the argument should make either the conclusion true or at least one of the premises false. Clearly we may (uniformly) assign truth values to the variables of the above argument such that A, B are both true but C is false. Hence the argument is truth-functionally invalid. On the other hand, it is impossible to (uniformly) assign truth values to the argument "A follows from (A and B)" such that (A and B) is true (hence A is true and B is true) and A false. In contrast, this argument can be easily translated into first-order logic: (Where "
FOL can also express the existence of something ( Where " Variables in first-order logic and in propositional logicEvery propositional formula can be translated into an essentially equivalent first-order formula by replacing each propositional variable with a zero-arity predicate. For example, the formula: While variables in the propositional logics are used to represent propositions that can be true or false, variables in first-order logic represent objects the formula is referring to. In the example above, the variable x in Defining first-order logicA predicate calculus consists of
The axioms considered here are logical axioms which are part of classical FOL. It is important to note that FOL can be formalized in many equivalent ways; there is nothing canonical about the axioms and rules of inference given in this article. There are infinitely many equivalent formalizations all of which yield the same theorems and non-theorems, and all of which have equal right to the title 'FOL'. FOL is used as the basic "building block" for many mathematical theories. FOL provides several built-in rules, such as the axiom Syntax of first-order logicSymbolsThe terms and formulas of first-order logic are strings of symbols. As for all formal languages, the nature of the symbols themselves is outside the scope of formal logic; it is best to think of them as letters and punctuation symbols. The alphabet (set of all symbols of the language) is divided into the non-logical symbols and the logical symbols. The latter are the same, and have the same meaning, for all applications. Non-logical symbolsThe non-logical symbols represent predicates (relations), functions and constants on the domain. For a long time it was standard practice to use a fixed, infinite set of non-logical symbols for all purposes. A more recent practice is to use different non-logical symbols according to the application one has in mind. Therefore it has become necessary to name the set of all non-logical symbols used in a particular application. It is now known as the signature.[1]
The traditional approach is to have only one, infinite, set of non-logical symbols (one signature) for all applications. Consequently, under the traditional approach there is only one language of first-order logic.[2] This approach is still common, especially in philosophically oriented books.
In modern mathematical treatments of first-order logic, the signature varies with the applications. Typical signatures in mathematics are {1, ×} or just {×} for groups, or {0, 1, +, ×, <} for ordered fields. There are no restrictions on the number of non-logical symbols. The signature can be empty, finite, or infinite, even uncountable. Uncountable signatures occur for example in modern proofs of (the upward part of) the Löwenheim-Skolem theorem. Every non-logical symbol is of one of the following types.
We can recover the traditional approach by considering the following signature:
Logical symbolsBesides logical connectives such as
First-order logic as described here is often called first-order logic with identity, because of the presence of an identity symbol = with special semantics. In first-order logic without identity this symbol is omitted. [3] There are numerous minor variations that may define additional logical symbols:
Not all logical symbols as defined above need occur. For example:
There are also some frequently used variants of notation:
Formation rulesThe 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. The concept of free variable is used to define the sentences as a subset of the formulas. TermsThe set of terms is recursively defined by the following rules:
FormulasThe set of well-formed formulas (usually called wffs or just formulas) is recursively defined by the following rules:
For example, In Computer science terminology, a formula implements a built-in "boolean" type, while a term implements all other types. ExampleIn mathematics the language of ordered abelian groups has one constant 0, one unary function −, one binary function +, and one binary relation ≤. So:
Additional syntactic conceptsFree and Bound VariablesIn a formula, a variable may occur free or bound. Intuitively, a variable is free in a formula if it is not quantified: in
For example, in Freeness and boundness can be also specialized to specific occurrences of variables in a formula. For example, in SubstitutionIf t is a term and φ is a formula possibly containing the variable x, then φ[t/x] is the result of replacing all free instances of x by t in φ. This replacement results in a formula that logically follows the original one provided that no free variable of t becomes bound in this process. If some free variable of t becomes bound, then to substitute t for x it is first necessary to change the names of bound variables of φ to something other than the free variables of t. To see why this condition is necessary, consider the formula φ given by Proof theoryInference rulesAn inference rule is a function from sets of (well-formed) formulas, called premises, to sets of formulas called conclusions. In most well-known deductive systems, inference rules take a set of formulas to a single conclusion. (Notice this is true even in the case of most sequent calculi.) Inference rules are used to prove theorems, which are formulas provable in or members of a theory. If the premises of an inference rule are theorems, then its conclusion is a theorem as well. In other words, inference rules are used to generate "new" theorems from "old" ones--they are theoremhood preserving. Systems for generating theories are often called predicate calculi. These are described in a section below. An important inference rule, modus ponens, states that if φ and φ
where A second important inference rule is Universal Generalization. It can be stated as
Which reads: if φ is a theorem, then "for every x, φ" is a theorem as well. The similar-looking schema AxiomsHere follows a description of the axioms of first-order logic. As explained above, a given first-order theory has further, non-logical axioms. The following logical axioms characterize a predicate calculus for this article's example of first-order logic[4]. For any theory, it is of interest to know whether the set of axioms can be generated by an algorithm, or if there is an algorithm which determines whether a well-formed formula is an axiom. If there is an algorithm to generate all axioms, then the set of axioms is said to be recursively enumerable. If there is an algorithm which determines after a finite number of steps whether a formula is an axiom or not, then the set of axioms is said to be recursive or decidable. In that case, one may also construct an algorithm to generate all axioms: this algorithm simply builds all possible formulas one by one (with growing length), and for each formula the algorithm determines whether it is an axiom. Axioms of first-order logic are always decidable. However, in a first-order theory non-logical axioms are not necessarily such. Quantifier axiomsQuantifier axioms change according to how the vocabulary is defined, how the substitution procedure works, what the formation rules are and which inference rules are used. Here follows a specific example of these axioms
These are actually axiom schemata: the expression W stands for any wff in which x is not free, and the expression Z(x) stands for any wff with the additional convention that Z(t) stands for the result of substitution of the term t for x in Z(x). Thus this is a recursive set of axioms. Another axiom, Equality and its axiomsThere are several different conventions for using equality (or identity) in first-order logic. This section summarizes the main ones. The various conventions all give essentially the same results with about the same amount of work, and differ mainly in terminology.
SemanticsInterpretationsIn logic and mathematics, an interpretation (also mathematical interpretation, logico-mathematical interpretation, or commonly a model) gives meaning to an artificial or formal language by assigning a denotation to all non-logical constants in that language or in a sentence of that language. For a given formal language L, or a sentence Φ of L, an interpretation assigns a denotation to each non-logical constant occurring in L or Φ. To individual constants it assigns individuals (from some universe of discourse); to predicates of degree 1 it assigns properties (more precisely sets) ; to predicates of degree 2 it assigns binary relations of individuals; to predicates of degree 3 it assigns ternary relations of individuals, and so on; and to sentential letters it assigns truth-values. More precisely, an interpretation of a formal language L or of a sentence Φ of L, consists of a non-empty domain D (i.e. a non-empty set) as the universe of discourse together with an assignment that associates with each n-ary operation or function symbol of L or of Φ an n-ary operation with respect to D (i.e. a function from Dn into D); with each n-ary predicate of L or of Φ an n-ary relation among elements of D and (optionally) with some binary predicate I of L, the identity relation among elements of D. In this way an interpretation provides meaning or semantic values to the terms or formulae of the language. The study of the interpretations of formal languages is called formal semantics. In mathematical logic an interpretation is a mathematical object that contains the necessary information for an interpretation in the former sense. The symbols used in a formal language include variables, logical-constants, quantifiers and punctuation symbols as well as the non-logical constants. The interpretation of a sentence or language therefore depends on which non-logical constants it contains. Languages of the sentential (or propositional) calculus are allowed sentential symbols as non-logical constants. Languages of the first order predicate calculus allow in addition predicate symbols and operation or function symbols. ModelsA model is a pair
The following is an intuitive explanation of these elements. The domain D is a set of "objects" of some kind. Intuitively, a first-order formula is a statement about objects; for example, The model also includes an interpretation of the signature. Since the elements of the signature are function symbols and predicate symbols, the interpretation gives the "value" of functions and predicates. The interpretation of a function symbol is a function. For example, the 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 the function I(f) of addition in this interpretation. In particular, the interpretation of a constant is a function from the one-element set D0 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 c. The interpretation of a predicate of arity n is a set of n-tuples of elements of the domain. This means that, given an interpretation, a predicate, and n elements of the domain, one can tell whether the predicate is true over those elements and according to the given interpretation. As an example, an interpretation I(P) of a predicate P of arity two 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 the second. EvaluationA formula evaluates to true or false given a model and an interpretation of the value of the variables. Such an interpretation μ associates every variable to a value of the domain. The evaluation of a formula under a model
The interpretation of a formula is given as follows.
If a formula does not contain free variables, then the evaluation of the variables does not affects its truth. In other words, in this case F is true according to M and μ if and only if is true according to M and a different interpretation of the variables μ'. Validity and satisfiabilityA model M satisfies a formula F if this formula is true according to M and every possible evaluation of its variables. A formula is valid if it is true in every possible model and interpretation of the variables. A formula is satisfiable if there exists a model and an interpretation of the variables that satisfy the formula. Predicate calculusThe predicate calculus is a proper extension of the propositional calculus that defines which statements of first-order logic are provable. Many (but not all) mathematical theories can be formulated in the predicate calculus. If the propositional calculus is defined with a suitable set of axioms and the single rule of inference modus ponens (this can be done in many ways), then the predicate calculus can be defined by appending to the propositional calculus several axioms and the inference rule called "universal generalization". As axioms for the predicate calculus we take:
A sentence is defined to be provable in first-order logic if it can be derived from the axioms of the predicate calculus, by repeatedly applying the inference rules "modus ponens" and "universal generalization". In other words:
If we have a theory T (a set of statements, called axioms, in some language) then a sentence φ is defined to be provable in the theory T if is provable in first-order logic, for some finite set of axioms
One apparent problem with this definition of provability is that it seems rather ad hoc: we have taken some apparently random collection of axioms and rules of inference, and it is unclear that we have not accidentally missed out some vital axiom or rule. Gödel's completeness theorem assures us that this is not really a problem: any statement true in all models (semantically true) is provable in first-order logic (syntactically true). In particular, any reasonable definition of "provable" in first-order logic must be equivalent to the one above (though it is possible for the lengths of proofs to differ vastly for different definitions of provability). There are many different (but equivalent) ways to define provability. The above definition is typical for a "Hilbert style" calculus, which has many axioms but very few rules of inference. By contrast, a "Gentzen style" predicate calculus has few axioms but many rules of inference. Provable identitiesThe following sentences can be called "identities" because the main connective in each is the biconditional. They are all provable in FOL, and are useful when manipulating the quantifiers:
Provable inference rulesThe main connective in the following sentences, also provable in FOL, is the conditional. These sentences can be seen as the justification for inference rules in addition to modus ponens and universal generalization discussed above and assumed valid:
Metalogical theorems of first-order logicSome important metalogical theorems are listed below in bulleted form. What they roughly mean is that a sentence is valid if and only if it is provable. Furthermore, one can construct a program which works as follows: if a sentence is provable, the program will always answer "provable" after some unknown, possibly very large, amount of time. If a sentence is not provable, the program may run forever. In the latter case, we will not know whether the sentence is provable or not, since we cannot tell whether the program is about to answer or not. In other words, the validity of sentences is semidecidable. One may construct an algorithm which will determine in finite number of steps whether a sentence is provable (a decidable algorithm) only for simple classes of first-order logic.
Translating natural language to first-order logicConcepts expressed in natural language must be "translated" to first-order logic (FOL) before FOL can be used to address them, and there are a number of potential pitfalls in this translation. In FOL, Limitations of first-order logicAll mathematical notations have their strengths and weaknesses; here are a few such issues with first-order logic. Difficulty in characterizing finiteness or countabilityIt follows from the Löwenheim–Skolem theorem that it is not possible to define finiteness or countability in a first-order language. That is, there is no first-order formula φ(x) such that for any model M, M is a model of φ iff the extension of φ in M is finite (or in the other case, countable). In first-order logic without identity the situation is even worse, since no first-order formula φ(x) can define "there exist n elements satisfying φ" for some fixed finite cardinal n. A number of properties not definable in first-order languages are definable in stronger languages. For example, in first-order logic one cannot assert the least-upper-bound property for sets of real numbers, which states that every bounded, nonempty set of real numbers has a supremum; A second-order logic is needed for that. Difficulty representing if-then-elseOddly enough, FOL with equality (as typically defined) does not include or permit defining an if-then-else predicate or function if(c,a,b), where "c" is a condition expressed as a formula, while a and b are either both terms or both formulas, and its result would be "a" if c is true, and "b" if it is false. The problem is that in FOL, both predicates and functions can only accept terms ("non-booleans") as parameters, but the "obvious" representation of the condition is a formula ("boolean"). This is unfortunate[citation needed], since many mathematical functions are conveniently expressed in terms of if-then-else, and if-then-else is fundamental for describing most computer programs. Mathematically, it is possible to redefine a complete set of new functions that match the formula operators, but this is quite clumsy.[6] A predicate if(c,a,b) can be expressed in FOL if rewritten as Typing (Sorts)FOL does not include types (sorts) into the notation itself, other than the difference between formulas ("booleans") and terms ("non-booleans"). Some argue that this lack of types is a great advantage [8], but many others find advantages in defining and using types (sorts), such as helping reject some erroneous or undesirable specifications[9]. Those who wish to indicate types must provide such information using the notation available in FOL. Doing so can make such expressions more complex, and can also be easy to get wrong. Single-parameter predicates can be used to implement the notion of types where appropriate. For example, in: Graph reachability cannot be expressedMany situations can be modeled as a graph of nodes and directed connections (edges). For example, validating many systems requires showing that a "bad" state cannot be reached from a "good" state, and these interconnections of states can often be modelled as a graph. However, it can be proved that connectedness cannot be fully expressed in predicate logic. In other words, there is no predicate-logic formula φ and R as its only predicate symbol (of arity 2) such that φ holds in a interpretation I if and only if the extension of R in I describes a connected graph: that is, connected graphs cannot be axiomatized. Note that given a binary relation R encoding a graph, one can describe R in terms of a conjunction of first order formulas, and write a formula φR which is satisfiable if and only if R is connected.[10] Comparison with other logics
Most of these logics are in some sense extensions of FOL: they include all the quantifiers and logical operators of FOL with the same meanings. Lindström showed that FOL has no extensions (other than itself) that satisfy both the compactness theorem and the downward Löwenheim–Skolem theorem. A precise statement of Lindström's theorem requires a few technical conditions that the logic is assumed to satisfy; for example, changing the symbols of a language should make no essential difference to which sentences are true. AlgebraizationsThree ways of eliminating quantified variables from FOL, and that do not involve replacing quantifiers with other variable binding term operators, are known:
These algebras:
Tarski and Givant (1987) show that the fragment of FOL 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 ZFC. They also prove that FOL with a primitive ordered pair is equivalent to a relation algebra with two ordered pair projection functions. AutomationTheorem proving for first-order logic is one of the most mature subfields of automated theorem proving. The logic is expressive enough to allow the specification of arbitrary problems, often in a reasonably natural and intuitive way. On the other hand, it is still semidecidable, and a number of sound and complete calculi have been developed, enabling fully automated systems. In 1965 J. Alan Robinson achieved an important breakthrough with his resolution approach; to prove a theorem it tries to refute the negated theorem, in a goal-directed way, resulting in a much more efficient method to automatically prove theorems in FOL. More expressive logics, such as higher-order and modal logics, allow the convenient expression of a wider range of problems than first-order logic, but theorem proving for these logics is less well developed. A modern and particularly disruptive new technology is that of SMT solvers, which add arithmetic and propositional support to the powerful classes of SAT solvers. See also
References
External links
| ||||||||||||||||||||||||||||||||