predicate (mathematical logic)

40
Predicate (mathematical logic) From Wikipedia, the free encyclopedia

Upload: man

Post on 04-Sep-2015

268 views

Category:

Documents


1 download

DESCRIPTION

1. From Wikipedia, the free encyclopedia2. Lexicographical order

TRANSCRIPT

  • Predicate (mathematical logic)From Wikipedia, the free encyclopedia

  • Contents

    1 Free variables and bound variables 11.1 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    1.1.1 Variable-binding operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2 Formal explanation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    1.2.1 Function expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.3 Natural language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.4 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

    2 Open sentence 62.1 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    3 Predicate (mathematical logic) 83.1 Simplied overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83.2 Formal denition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83.3 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.4 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.5 External links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    4 Quantier (logic) 104.1 Mathematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104.2 Algebraic approaches to quantication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104.3 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114.4 Nesting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124.5 Equivalent expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124.6 Range of quantication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134.7 Formal semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134.8 Paucal, multal and other degree quantiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154.9 Other quantiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154.10 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164.11 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164.12 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164.13 External links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

    i

  • ii CONTENTS

    5 Sentence (logic) 185.1 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185.2 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185.3 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

    6 String (computer science) 206.1 Formal theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

    6.1.1 Concatenation and substrings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.1.2 Prexes and suxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.1.3 Rotations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.1.4 Reversal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226.1.5 Lexicographical ordering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226.1.6 String operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226.1.7 Topology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

    6.2 String datatypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236.2.1 String length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236.2.2 Character encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236.2.3 Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246.2.4 Representations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246.2.5 Security concerns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

    6.3 Text le strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266.4 Non-text strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266.5 String processing algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266.6 Character string-oriented languages and utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . 266.7 Character string functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276.8 String buers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

    6.8.1 In Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276.8.2 In .NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286.8.3 In other languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

    6.9 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286.10 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

    7 Well-formed formula 307.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317.2 Propositional calculus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317.3 Predicate logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327.4 Atomic and open formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327.5 Closed formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337.6 Properties applicable to formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337.7 Usage of the terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337.8 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337.9 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

  • CONTENTS iii

    7.10 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347.11 External links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347.12 Text and image sources, contributors, and licenses . . . . . . . . . . . . . . . . . . . . . . . . . . 35

    7.12.1 Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357.12.2 Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357.12.3 Content license . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

  • Chapter 1

    Free variables and bound variables

    For bound variables in computer programming, see Name binding.

    In mathematics, and in other disciplines involving formal languages, including mathematical logic and computerscience, a free variable is a notation that species places in an expression where substitution may take place. Someolder books use the terms real variable and apparent variable for free variable and bound variable. The idea isrelated to a placeholder (a symbol that will later be replaced by some literal string), or a wildcard character thatstands for an unspecied symbol.In computer programming, the term free variable refers to variables used in a function that are neither local variablesnor parameters of that function.[1] The term non-local variable is often a synonym in this context.A bound variable is a variable that was previously free, but has been bound to a specic value or set of values. Forexample, the variable x becomes a bound variable when we write:

    'For all x, (x + 1)2 = x2 + 2x + 1.'

    or

    'There exists x such that x2 = 2.'

    In either of these propositions, it does not matter logically whether we use x or some other letter. However, it couldbe confusing to use the same letter again elsewhere in some compound proposition. That is, free variables becomebound, and then in a sense retire from being available as stand-in values for other values in the creation of formulae.The term dummy variable is also sometimes used for a bound variable (more often in general mathematics than incomputer science), but that use can create an ambiguity with the denition of dummy variables in regression analysis.

    1.1 ExamplesBefore stating a precise denition of free variable and bound variable, the following are some examples that perhapsmake these two concepts clearer than the denition would:In the expression

    10Xk=1

    f(k; n);

    n is a free variable and k is a bound variable; consequently the value of this expression depends on the value of n, butthere is nothing called k on which it could depend.In the expression

    1

  • 2 CHAPTER 1. FREE VARIABLES AND BOUND VARIABLES

    Z 10

    xy1ex dx;

    y is a free variable and x is a bound variable; consequently the value of this expression depends on the value of y, butthere is nothing called x on which it could depend.In the expression

    limh!0

    f(x+ h) f(x)h

    ;

    x is a free variable and h is a bound variable; consequently the value of this expression depends on the value of x, butthere is nothing called h on which it could depend.In the expression

    8x 9yh'(x; y; z)

    i;

    z is a free variable and x and y are bound variables; consequently the logical value of this expression depends on thevalue of z, but there is nothing called x or y on which it could depend.

    1.1.1 Variable-binding operatorsThe following

    Xx2S

    Yx2S

    Z 10

    dx limx!0

    8x 9x

    are variable-binding operators. Each of them binds the variable x.Note that many of these are operators which act on functions of the bound variable. In more complicated contexts,such notations can become awkward and confusing. It can be useful to switch to notations which make the bindingexplicit, such as

    X1 ::: 10

    (k 7! f(k; n))

    for sums or

    Dx 7! x2 + 2x+ 1

    for dierentiation.

    1.2 Formal explanationVariable-binding mechanisms occur in dierent contexts in mathematics, logic and computer science. In all cases,however, they are purely syntactic properties of expressions and variables in them. For this section we can sum-marize syntax by identifying an expression with a tree whose leaf nodes are variables, constants, function constantsor predicate constants and whose non-leaf nodes are logical operators. This expression can then be determined bydoing an inorder traversal of the tree. Variable-binding operators are logical operators that occur in almost everyformal language. Indeed languages that do not have them are either extremely inexpressive or extremely dicult touse. A binding operator Q takes two arguments: a variable v and an expression P, and when applied to its arguments

  • 1.2. FORMAL EXPLANATION 3

    x

    xy z

    AB

    Tree summarizing the syntax of the expression 8x (9y A(x) _B(z))

    produces a new expression Q(v, P). The meaning of binding operators is supplied by the semantics of the languageand does not concern us here.Variable binding relates three things: a variable v, a location a for that variable in an expression and a non-leaf noden of the form Q(v, P). Note: we dene a location in an expression as a leaf node in the syntax tree. Variable bindingoccurs when that location is below the node n.In the lambda calculus, x is a bound variable in the term M = x . T, and a free variable of T. We say x is bound inM and free in T. If T contains a subterm x . U then x is rebound in this term. This nested, inner binding of x is saidto shadow the outer binding. Occurrences of x in U are free occurrences of the new x.Variables bound at the top level of a program are technically free variables within the terms to which they are boundbut are often treated specially because they can be compiled as xed addresses. Similarly, an identier bound to arecursive function is also technically a free variable within its own body but is treated specially.A closed term is one containing no free variables.

  • 4 CHAPTER 1. FREE VARIABLES AND BOUND VARIABLES

    1.2.1 Function expressionsTo give an example from mathematics, consider an expression which denes a function

    f = [(x1; : : : ; xn) 7! t]where t is an expression. t may contain some, all or none of the x1, ..., xn and it may contain other variables. In thiscase we say that function denition binds the variables x1, ..., xn.In this manner, function denition expressions of the kind shown above can be thought of as the variable bindingoperator, analogous to the lambda expressions of lambda calculus. Other binding operators, like the summation sign,can be thought of as higher-order functions applying to a function. So, for example, the expression

    Xx2A

    x2

    could be treated as a notation for

    XA

    (x 7! x2)

    wherePS f is an operator with two parametersa one-parameter function, and a set to evaluate that function over.The other operators listed above can be expressed in similar ways; for example, the universal quantier 8x 2 S P (x)can be thought of as an operator that evaluates to the logical conjunction of the boolean-valued function P appliedover the (possibly innite) set S.

    1.3 Natural languageWhen analyzed in formal semantics, natural languages can be seen to have free and bound variables. In English,personal pronouns like he, she, they, etc. can act as free variables.

    Lisa found her book.

    In the sentence above, the possessive pronoun her is a free variable. It may refer to the previously mentioned Lisa or toany other female. In other words, her book could be referring to Lisas book (an instance of coreference) or to a bookthat belongs to a dierent female (e.g. Janes book). Whoever the referent of her is can be established according tothe situational (i.e. pragmatic) context. The identity of the referent can be shown using coindexing subscripts wherei indicates one referent and j indicates a second referent (dierent from i). Thus, the sentence Lisa found her bookhas the following interpretations:

    Lisai found heri book. (interpretation #1: her = Lisa)Lisai found herj book. (interpretation #2: her = female that is not Lisa)

    The distinction is not purely of academic interest, as some languages do actually have dierent forms for heri andherj: for example, Norwegian translates coreferent heri as sin and noncoreferent herj as hennes.However, reexive pronouns, such as himself, herself, themselves, etc., and reciprocal pronouns, such as each other,act as bound variables. In a sentence like the following:

    Jane hurt herself.

    the reexive herself can only refer to the previously mentioned antecedent Jane. It can never refer to a dierentfemale person. In other words, the person being hurt and the person doing the hurting are both the same person, i.e.Jane. The semantics of this sentence is abstractly: JANE hurt JANE. And it cannot be the case that this sentence

  • 1.4. SEE ALSO 5

    could mean JANE hurt LISA. The reexive herself must refer and can only refer to the previously mentioned Jane. Inthis sense, the variable herself is bound to the noun Jane that occurs in subject position. Indicating the coindexation,the rst interpretation with Jane and herself coindexed is permissible, but the other interpretation where they are notcoindexed is ungrammatical (the ungrammatical interpretation is indicated with an asterisk):

    Janei hurt herselfi. (interpretation #1: herself = Jane)*Janei hurt herselfj. (interpretation #2: herself = a female that is not Jane)

    Note that the coreference binding can be represented using a lambda expression as mentioned in the previous Formalexplanation section. The sentence with the reexive could be represented as

    (x.x hurt x)Jane

    in which Jane is the subject referent argument and x.x hurt x is the predicate function (a lambda abstraction) withthe lambda notation and x indicating both the semantic subject and the semantic object of sentence as being bound.This returns the semantic interpretation JANE hurt JANE with JANE being the same person.Pronouns can also behave in a dierent way. In the sentence below

    Ashley hit her.

    the pronoun her can only refer to a female that is not Ashley. This means that it can never have a reexive meaningequivalent to Ashley hit herself. The grammatical and ungrammatical interpretations are:

    *Ashleyi hit heri. (interpretation #1: her = Ashley)Ashleyi hit herj. (interpretation #2: her = a female that is not Ashley)

    The rst interpretation is impossible. Only the second interpretation is permitted by the grammar.Thus, it can be seen that reexives and reciprocals are bound variables (known technically as anaphors) while truepronouns are free variables in some grammatical structures but variables that cannot be bound in other grammaticalstructures. The binding phenomena found in natural languages was particularly important to the syntactic governmentand binding theory (see also: Binding (linguistics)).

    1.4 See also Closure (computer science) Combinatory logic Lambda lifting Name binding Scope (programming)

    1.5 References[1] Free variables in Lisp

  • Chapter 2

    Open sentence

    In mathematics, an open sentence (usually an equation or equality) is described as open in the sense that its truthvalue is meaningless until its variables are replaced with specic numbers, at which point the truth value can usuallybe determined (and hence the sentences are no longer regarded as open). These possible replacement values areassumed to range over a subset of either the real or complex numbers, depending on the equation or inequality underconsideration (in applications, real numbers are usually associated also with measurement units). The replacementvalues which produce a true equation or inequality are called solutions of the equation or inequality, and are said tosatisfy it.In mathematical logic, a non-closed formula is a formula which contains free variables. (Note that in logic, a"sentence" is a formula without free variables, and a formula is open if it contains no quantiers, which disagreeswith the terminology of this article.) Unlike closed formulas, which contain constants, non-closed formulas do notexpress propositions; they are neither true nor false. Hence, the formula

    has no truth-value. A formula is said to be satised by any object(s) such that if it is written in place of the variable(s),it will form a sentence expressing a true proposition. Hence, 5 satises (1). Any sentence which results from aformula in such a way is said to be a substitution instance of that formula. Hence, 5 is a number is a substitutioninstance of (1).Mathematicians have not adopted that nomenclature, but refer instead to equations, inequalities with free variables,etc.Such replacements are known as solutions to the sentence. An identity is an open sentence for which every number isa solution.Examples of open sentences include:

    1. 3x 9 = 21, whose only solution for x is 10;

    2. 4x + 3 > 9, whose solutions for x are all numbers greater than 3/2;

    3. x + y = 0, whose solutions for x and y are all pairs of numbers that are additive inverses;

    4. 3x + 9 = 3(x + 3), whose solutions for x are all numbers.

    5. 3x + 9 = 3(x + 4), which has no solution.

    Example 4 is an identity. Examples 1, 3, and 4 are equations, while example 2 is an inequality. Example 5 is acontradiction.Every open sentence must have (usually implicitly) a universe of discourse describing which numbers are under con-sideration as solutions. For instance, one might consider all real numbers or only integers. For example, in example2 above, 1.6 is a solution if the universe of discourse is all real numbers, but not if the universe of discourse is onlyintegers. In that case, only the integers greater than 3/2 are solutions: 2, 3, 4, and so on. On the other hand, if the

    6

  • 2.1. REFERENCES 7

    universe of discourse consists of all complex numbers, then example 2 doesn't even make sense (although the otherexamples do). An identity is only required to hold for the numbers in its universe of discourse.This same universe of discourse can be used to describe the solutions to the open sentence in symbolic logic usinguniversal quantication. For example, the solution to example 2 above can be specied as:

    For all x, 4x + 3 > 9 if and only if x > 3/2.

    Here, the phrase for all implicitly requires a universe of discourse to specify which mathematical objects are allthe possibilities for x.The idea can even be generalised to situations where the variables don't refer to numbers at all, as in a functionalequation. For an example of this, consider

    f * f = f,

    which says that f(x) * f(x) = f(x) for every value of x. If the universe of discourse consists of all functions from thereal lineR to itself, then the solutions for f are all functions whose only values are one and zero. But if the universe ofdiscourse consists of all continuous functions from R to itself, then the solutions for f are only the constant functionswith value one or zero.

    2.1 References Denition at The Math Resource The Math Forum @ Drexel

  • Chapter 3

    Predicate (mathematical logic)

    For other uses, see Predicate (disambiguation).

    In mathematics, a predicate is commonly understood to be a Boolean-valued function P: X {true, false}, calledthe predicate on X. However, predicates have many dierent uses and interpretations in mathematics and logic, andtheir precise denition, meaning and use will vary from theory to theory. So, for example, when a theory denesthe concept of a relation, then a predicate is simply the characteristic function or the indicator function of a relation.However, not all theories have relations, or are founded on set theory, and so one must be careful with the properdenition and semantic interpretation of a predicate.

    3.1 Simplied overviewInformally, a predicate is a statement that may be true or false depending on the values of its variables.[1] It canbe thought of as an operator or function that returns a value that is either true or false.[2] For example, predicatesare sometimes used to indicate set membership: when talking about sets, it is sometimes inconvenient or impossibleto describe a set by listing all of its elements. Thus, a predicate P(x) will be true or false, depending on whether xbelongs to a set.Predicates are also commonly used to talk about the properties of objects, by dening the set of all objects that havesome property in common. So, for example, when P is a predicate on X, one might sometimes say P is a property ofX. Similarly, the notation P(x) is used to denote a sentence or statement P concerning the variable object x. The setdened by P(x) is written as {x | P(x)}, and is just a collection of all the objects for which P is true.For instance, {x | x is a positive integer less than 4} is the set {1,2,3}.If t is an element of the set {x | P(x)}, then the statement P(t) is true.Here, P(x) is referred to as the predicate, and x the subject of the proposition. Sometimes, P(x) is also called apropositional function, as each choice of x produces a proposition.A simple form of predicate is a Boolean expression, in which case the inputs to the expression are themselves Booleanvalues, combined using Boolean operations. Similarly, a Boolean expression with inputs predicates is itself a morecomplex predicate.

    3.2 Formal denitionThe precise semantic interpretation of an atomic formula and an atomic sentence will vary from theory to theory.

    In propositional logic, atomic formulas are called propositional variables.[3] In a sense, these are nullary (i.e.0-arity) predicates.

    In rst-order logic, an atomic formula consists of a predicate symbol applied to an appropriate number of terms.

    8

  • 3.3. SEE ALSO 9

    In set theory, predicates are understood to be characteristic functions or set indicator functions, i.e. functionsfrom a set element to a truth value. Set-builder notation makes use of predicates to dene sets.

    In autoepistemic logic, which rejects the law of excluded middle, predicates may be true, false, or simplyunknown; i.e. a given collection of facts may be insucient to determine the truth or falsehood of a predicate.

    In fuzzy logic, predicates are the characteristic functions of a probability distribution. That is, the stricttrue/false valuation of the predicate is replaced by a quantity interpreted as the degree of truth.

    3.3 See also Free variables and bound variables Predicate functor logic Truthbearer Multigrade predicate Opaque predicate Classifying topos

    3.4 References[1] Cunningham, Daniel W. (2012). A Logical Introduction to Proof. New York: Springer. p. 29. ISBN 9781461436317.

    [2] Haas, Guy M. What If? (Predicates)". Introduction to Computer Programming. Berkeley Foundation for Opportunities inIT (BFOIT),. Retrieved 20 July 2013.

    [3] Lavrov, Igor Andreevich and Larisa Maksimova (2003). Problems in Set Theory, Mathematical Logic, and the Theory ofAlgorithms. New York: Springer. p. 52. ISBN 0306477122.

    3.5 External links Introduction to predicates

  • Chapter 4

    Quantier (logic)

    In logic, quantication is a construct that species the quantity of specimens in the domain of discourse that satisfyan open formula. For example, in arithmetic, it allows the expression of the statement that every natural numberhas a successor. A language element which generates a quantication (such as every) is called a quantier. Theresulting expression is a quantied expression, it is said to be quantied over the predicate (such as the naturalnumber x has a successor) whose free variable is bound by the quantier. In formal languages, quantication is aformula constructor that produces new formulas from old ones. The semantics of the language species how theconstructor is interpreted. Two fundamental kinds of quantication in predicate logic are universal quantication andexistential quantication. The traditional symbol for the universal quantier all is "", a rotated letter "A", and forthe existential quantier exists is "", a rotated letter "E". These quantiers have been generalized beginning withthe work of Mostowski and Lindstrm.Quantication is used as well in natural languages; examples of quantiers in English are for all, for some, many,few, a lot, and no; see Quantier (linguistics) for details.

    4.1 MathematicsConsider the following statement:

    1 2 = 1 + 1, and 2 2 = 2 + 2, and 3 2 = 3 + 3, ..., and 100 2 = 100 + 100, and ..., etc.

    This has the appearance of an innite conjunction of propositions. From the point of view of formal languages this isimmediately a problem, since syntax rules are expected to generate nite objects. The example above is fortunate inthat there is a procedure to generate all the conjuncts. However, if an assertion were to be made about every irrationalnumber, there would be no way to enumerate all the conjuncts, since irrationals cannot be enumerated. A succinctformulation which avoids these problems uses universal quantication:

    For each natural number n, n 2 = n + n.

    A similar analysis applies to the disjunction,

    1 is equal to 5 + 5, or 2 is equal to 5 + 5, or 3 is equal to 5 + 5, ... , or 100 is equal to 5 + 5, or ..., etc.

    which can be rephrased using existential quantication:

    For some natural number n, n is equal to 5+5.

    4.2 Algebraic approaches to quanticationIt is possible to devise abstract algebras whose models include formal languages with quantication, but progress hasbeen slow and interest in such algebra has been limited. Three approaches have been devised to date:

    10

  • 4.3. NOTATION 11

    Relation algebra, invented by Augustus De Morgan, and developed by Charles Sanders Peirce, Ernst Schrder,Alfred Tarski, and Tarskis students. Relation algebra cannot represent any formula with quantiers nestedmore than three deep. Surprisingly, the models of relation algebra include the axiomatic set theory ZFC andPeano arithmetic;

    Cylindric algebra, devised by Alfred Tarski, Leon Henkin, and others; The polyadic algebra of Paul Halmos.

    4.3 NotationThe two most common quantiers are the universal quantier and the existential quantier. The traditional symbolfor the universal quantier is "", an inverted letter "A", which stands for for all or all. The corresponding symbolfor the existential quantier is "", a rotated letter "E", which stands for there exists or exists.An example of translating a quantied English statement would be as follows. Given the statement, Each of Petersfriends either likes to dance or likes to go to the beach, we can identify key aspects and rewrite using symbols includingquantiers. So, letX the set of all Peters friends, P(x) be the predicate "x likes to dance, and lastlyQ(x) the predicate"x likes to go to the beach. Then the above sentence can be written in formal notation as 8x2X;P (x) _ Q(x) ,which is read, for every x that is a member of X, P applies to x or Q applies to x.Some other quantied expressions are constructed as follows,

    9xP 8xPfor a formula P. These two expressions (using the denitions above) are read as there exists a friend of Peter who likesto dance and all friends of Peter like to dance respectively. Variant notations include, for set X and set membersx:

    (9x)P (9x : P ) 9x P (9x : P ) 9x(P ) 9x P 9x; P 9x2X P 9x:X PAll of these variations also apply to universal quantication. Other variations for the universal quantier are

    (x)P^x

    P

    Some versions of the notation explicitly mention the range of quantication. The range of quantication must alwaysbe specied; for a given mathematical theory, this can be done in several ways:

    Assume a xed domain of discourse for every quantication, as is done in ZermeloFraenkel set theory, Fix several domains of discourse in advance and require that each variable have a declared domain, which is thetype of that variable. This is analogous to the situation in statically typed computer programming languages,where variables have declared types.

    Mention explicitly the range of quantication, perhaps using a symbol for the set of all objects in that domainor the type of the objects in that domain.

    One can use any variable as a quantied variable in place of any other, under certain restrictions in which variablecapture does not occur. Even if the notation uses typed variables, variables of that type may be used.Informally or in natural language, the "x" or "x" might appear after or in the middle of P(x). Formally, however,the phrase that introduces the dummy variable is placed in front.Mathematical formulas mix symbolic expressions for quantiers, with natural language quantiers such as

    For every natural number x, ....There exists an x such that ....For at least one x.

  • 12 CHAPTER 4. QUANTIFIER (LOGIC)

    Keywords for uniqueness quantication include:

    For exactly one natural number x, ....There is one and only one x such that ....

    Further, x may be replaced by a pronoun. For example,

    For every natural number, its product with 2 equals to its sum with itselfSome natural number is prime.

    4.4 NestingThe order of quantiers is critical to meaning, as is illustrated by the following two propositions:

    For every natural number n, there exists a natural number s such that s = n2.

    This is clearly true; it just asserts that every natural number has a square. The meaning of the assertion in which thequantiers are turned around is dierent:

    There exists a natural number s such that for every natural number n, s = n2.

    This is clearly false; it asserts that there is a single natural number s that is at the same time the square of everynatural number. This is because the syntax directs that any variable cannot be a function of subsequently introducedvariables.A less trivial example from mathematical analysis are the concepts of uniform and pointwise continuity, whose def-initions dier only by an exchange in the positions of two quantiers. A function f from R to R is called

    pointwise continuous if >0 xR >0 hR (|h| < |f(x) f(x + h)| < ) uniformly continuous if >0 >0 xR hR (|h| < |f(x) f(x + h)| < )

    In the former case, the particular value chosen for can be a function of both and x, the variables that precede it.In the latter case, can be a function only of , i.e. it has to be chosen independent of x. For example, f(x) = x2satises pointwise, but not uniform continuity. In contrast, interchanging the two initial universal quantiers in thedenition of pointwise continuity does not change the meaning.The maximum depth of nesting of quantiers inside a formula is called its quantier rank.

    4.5 Equivalent expressionsIf D is a domain of x and P(x) is a predicate dependent on x, then the universal proposition can be expressed as

    8x2D P (x)This notation is known as restricted or relativized or bounded quantication. Equivalently,

    8x (x2D ! P (x))The existential proposition can be expressed with bounded quantication as

    9x2D P (x)

  • 4.6. RANGE OF QUANTIFICATION 13

    or equivalently

    9x (x2D ^ P (x))Together with negation, only one of either the universal or existential quantier is needed to perform both tasks:

    :(8x2D P (x)) 9x2D :P (x);which shows that to disprove a for all x" proposition, one needs no more than to nd an x for which the predicate isfalse. Similarly,

    :(9x2D P (x)) 8x2D :P (x);to disprove a there exists an x" proposition, one needs to show that the predicate is false for all x.

    4.6 Range of quanticationEvery quantication involves one specic variable and a domain of discourse or range of quantication of that variable.The range of quantication species the set of values that the variable takes. In the examples above, the range ofquantication is the set of natural numbers. Specication of the range of quantication allows us to express thedierence between, asserting that a predicate holds for some natural number or for some real number. Expositoryconventions often reserve some variable names such as "n" for natural numbers and "x" for real numbers, althoughrelying exclusively on naming conventions cannot work in general since ranges of variables can change in the courseof a mathematical argument.A more natural way to restrict the domain of discourse uses guarded quantication. For example, the guarded quan-tication

    For some natural number n, n is even and n is prime

    means

    For some even number n, n is prime.

    In some mathematical theories a single domain of discourse xed in advance is assumed. For example, in ZermeloFraenkel set theory, variables range over all sets. In this case, guarded quantiers can be used to mimic a smallerrange of quantication. Thus in the example above to express

    For every natural number n, n2 = n + n

    in ZermeloFraenkel set theory, it can be said

    For every n, if n belongs to N, then n2 = n + n,

    where N is the set of all natural numbers.

    4.7 Formal semanticsMathematical Semantics is the application of mathematics to study the meaning of expressions in a formal language.It has three elements: A mathematical specication of a class of objects via syntax, a mathematical specication ofvarious semantic domains and the relation between the two, which is usually expressed as a function from syntacticobjects to semantic ones. This article only addresses the issue of how quantier elements are interpreted.

  • 14 CHAPTER 4. QUANTIFIER (LOGIC)

    Given a model theoretical logical framework, the syntax of a formula can be given by a syntax tree. Quantiers havescope and a variable x is free if it is not within the scope of a quantication for that variable. Thus in

    8x(9yB(x; y)) _ C(y; x)the occurrence of both x and y in C(y,x) is free.

    Syntactic tree illustrating scope and variable capture

    An interpretation for rst-order predicate calculus assumes as given a domain of individualsX. A formulaAwhose freevariables are x1, ..., x is interpreted as a boolean-valued function F(v1, ..., vn) of n arguments, where each argumentranges over the domain X. Boolean-valued means that the function assumes one of the values T (interpreted as truth)or F (interpreted as falsehood). The interpretation of the formula

    8xnA(x1; : : : ; xn)is the function G of n1 arguments such that G(v1, ...,vn) = T if and only if F(v1, ..., vn, w) = T for every w inX. If F(v1, ..., vn, w) = F for at least one value of w, then G(v1, ...,vn) = F. Similarly the interpretation of theformula

    9xnA(x1; : : : ; xn)is the function H of n1 arguments such that H(v1, ...,vn) = T if and only if F(v1, ...,vn, w) = T for at least onew and H(v1, ..., vn) = F otherwise.The semantics for uniqueness quantication requires rst-order predicate calculus with equality. This means thereis given a distinguished two-placed predicate "="; the semantics is also modied accordingly so that "=" is alwaysinterpreted as the two-place equality relation on X. The interpretation of

    9!xnA(x1; : : : ; xn)

  • 4.8. PAUCAL, MULTAL AND OTHER DEGREE QUANTIFIERS 15

    then is the function of n1 arguments, which is the logical and of the interpretations of

    9xnA(x1; : : : ; xn)8y; z fA(x1; : : : ; xn1; y) ^A(x1; : : : ; xn1; z) =) y = zg :

    4.8 Paucal, multal and other degree quantiersSee also: Fubinis theorem and measurable

    None of the quantiers previously discussed apply to a quantication such as

    There are many integers n < 100, such that n is divisible by 2 or 3 or 5.

    One possible interpretation mechanism can be obtained as follows: Suppose that in addition to a semantic domain X,we have given a probability measure P dened on X and cuto numbers 0 < a b 1. If A is a formula with freevariables x1,...,xn whose interpretation is the function F of variables v1,...,vn then the interpretation of

    9manyxnA(x1; : : : ; xn1; xn)is the function of v1,...,vn which is T if and only if

    Pfw : F (v1; : : : ; vn1; w) = Tg band F otherwise. Similarly, the interpretation of

    9fewxnA(x1; : : : ; xn1; xn)is the function of v1,...,vn which is F if and only if

    0 < Pfw : F (v1; : : : ; vn1; w) = Tg aand T otherwise.

    4.9 Other quantiersA few other quantiers have been proposed over time. In particular, the solution quantier,[1] noted (section sign)and read those. For example:

    xn 2 N n2 4 = f0; 1; 2gis read those n in N such that n2 4 are in {0,1,2}. The same construct is expressible in set-builder notation:

    fn 2 N : n2 4g = f0; 1; 2gSome other quantiers sometimes used in mathematics include:

    There are innitely many elements such that...

  • 16 CHAPTER 4. QUANTIFIER (LOGIC)

    For all but nitely many elements... (sometimes expressed as for almost all elements...). There are uncountable many elements such that... For all but countably many elements... For all elements in a set of positive measure... For all elements except those in a set of measure zero...

    4.10 HistoryTerm logic, also called Aristotelian logic, treats quantication in a manner that is closer to natural language, and alsoless suited to formal analysis. Term logic treated All, Some and No in the 4th century BC, in an account also touchingon the alethic modalities.Gottlob Frege, in his 1879 Begrisschrift, was the rst to employ a quantier to bind a variable ranging over a domainof discourse and appearing in predicates. He would universally quantify a variable (or relation) by writing the variableover a dimple in an otherwise straight line appearing in his diagrammatic formulas. Frege did not devise an explicitnotation for existential quantication, instead employing his equivalent of ~x~, or contraposition. Freges treatmentof quantication went largely unremarked until Bertrand Russell's 1903 Principles of Mathematics.In work that culminated in Peirce (1885), Charles Sanders Peirce and his student Oscar Howard Mitchell indepen-dently invented universal and existential quantiers, and bound variables. Peirce and Mitchell wrote and wherewe now write x and x. Peirces notation can be found in the writings of Ernst Schrder, Leopold Loewenheim,Thoralf Skolem, and Polish logicians into the 1950s. Most notably, it is the notation of Kurt Gdel's landmark 1930paper on the completeness of rst-order logic, and 1931 paper on the incompleteness of Peano arithmetic.Peirces approach to quantication also inuenced William Ernest Johnson and Giuseppe Peano, who invented yetanother notation, namely (x) for the universal quantication of x and (in 1897) x for the existential quantication ofx. Hence for decades, the canonical notation in philosophy and mathematical logic was (x)P to express all individualsin the domain of discourse have the property P, and "(x)P" for there exists at least one individual in the domainof discourse having the property P. Peano, who was much better known than Peirce, in eect diused the lattersthinking throughout Europe. Peanos notation was adopted by the Principia Mathematica of Whitehead and Russell,Quine, and Alonzo Church. In 1935, Gentzen introduced the symbol, by analogy with Peanos symbol. did notbecome canonical until the 1960s.Around 1895, Peirce began developing his existential graphs, whose variables can be seen as tacitly quantied.Whether the shallowest instance of a variable is even or odd determines whether that variables quantication isuniversal or existential. (Shallowness is the contrary of depth, which is determined by the nesting of negations.)Peirces graphical logic has attracted some attention in recent years by those researching heterogeneous reasoningand diagrammatic inference.

    4.11 See also Generalized quantier a higher-order property used as standard semantics of quantied noun phrases Lindstrm quantier a generalized polyadic quantier Quantier elimination

    4.12 References[1] Hehner, Eric C. R., 2004, Practical Theory of Programming, 2nd edition, p. 28

    Barwise, Jon; and Etchemendy, John, 2000. Language Proof and Logic. CSLI (University of Chicago Press)and New York: Seven Bridges Press. A gentle introduction to rst-order logic by two rst-rate logicians.

  • 4.13. EXTERNAL LINKS 17

    Frege, Gottlob, 1879. Begrisschrift. Translated in Jean van Heijenoort, 1967. From Frege to Gdel: A SourceBook on Mathematical Logic, 1879-1931. Harvard University Press. The rst appearance of quantication.

    Hilbert, David; and Ackermann, Wilhelm, 1950 (1928). Principles of Mathematical Logic. Chelsea. Transla-tion ofGrundzge der theoretischen Logik. Springer-Verlag. The 1928 rst edition is the rst time quanticationwas consciously employed in the now-standard manner, namely as binding variables ranging over some xeddomain of discourse. This is the dening aspect of rst-order logic.

    Peirce, C. S., 1885, On the Algebra of Logic: A Contribution to the Philosophy of Notation,American Journalof Mathematics, Vol. 7, pp. 180202. Reprinted in Kloesel, N. et al., eds., 1993. Writings of C. S. Peirce, Vol.5. Indiana University Press. The rst appearance of quantication in anything like its present form.

    Reichenbach, Hans, 1975 (1947). Elements of Symbolic Logic, Dover Publications. The quantiers are dis-cussed in chapters 18 Binding of variables through 30 Derivations from Synthetic Premises.

    Westersthl, Dag, 2001, Quantiers, in Goble, Lou, ed., The Blackwell Guide to Philosophical Logic. Black-well.

    Wiese, Heike, 2003. Numbers, language, and the human mind. Cambridge University Press. ISBN 0-521-83182-2.

    4.13 External links Hazewinkel, Michiel, ed. (2001), Quantier, Encyclopedia of Mathematics, Springer, ISBN 978-1-55608-010-4

    Stanford Encyclopedia of Philosophy: "Classical Logic by Stewart Shapiro. Covers syntax, model theory, and metatheory for rst order logicin the natural deduction style.

    "Generalized quantiers" by Dag Westersthl. Peters, Stanley; Westersthl, Dag (2002). "Quantiers."

  • Chapter 5

    Sentence (logic)

    This article is a technical mathematical article in the area of predicate logic. For the ordinary Englishlanguage meaning see Sentence (linguistics), for a less technical introductory article see Statement (logic).

    In mathematical logic, a sentence of a predicate logic is a boolean-valued well-formed formula with no free variables.A sentence can be viewed as expressing a proposition, something that may be true or false. The restriction of havingno free variables is needed to make sure that sentences can have concrete, xed truth values: As the free variables ofa (general) formula can range over several values, the truth value of such a formula may vary.Sentences without any logical connectives or quantiers in them are known as atomic sentences; by analogy to atomicformula. Sentences are then built up out of atomic sentences by applying connectives and quantiers.A set of sentences is called a theory; thus, individual sentences may be called theorems. To properly evaluate thetruth (or falsehood) of a sentence, one must make reference to an interpretation of the theory. For rst-order theories,interpretations are commonly called structures. Given a structure or interpretation, a sentence will have a xed truthvalue. A theory is satisable when all of its sentences are true. The study of algorithms to automatically discoverinterpretations of theories that render all sentences as being true is known as the satisability modulo theories problem.

    5.1 ExampleThe following example is in rst-order logic.

    8y9x(x2 = y)is a sentence. This sentence is true in the positive real numbers +, false in the real numbers , and true in the complexnumbers . (In plain English, this sentence is interpreted to mean that every member of the structure concerned isthe square of a member of that particular structure.) On the other hand, the formula

    9x(x2 = y)is not a sentence, because of the presence of the free variable y. In the structure of the real numbers, this formula istrue if we substitute (arbitrarily) y = 2, but is false if y = 2.

    5.2 See also Ground expression Open sentence Statement (logic) Proposition

    18

  • 5.3. REFERENCES 19

    5.3 References Hinman, P. (2005). Fundamentals of Mathematical Logic. A K Peters. ISBN 1-56881-262-0. Rautenberg, Wolfgang (2010), A Concise Introduction to Mathematical Logic (3rd ed.), New York: SpringerScience+Business Media, doi:10.1007/978-1-4419-1221-3, ISBN 978-1-4419-1220-6.

  • Chapter 6

    String (computer science)

    This article is about the data type. For other uses, see String (disambiguation).In computer programming, a string is traditionally a sequence of characters, either as a literal constant or as some

    Strings are applied e.g. in Bioinformatics to describe DNA strands composed of nitrogenous bases.

    kind of variable. The latter may allow its elements to be mutated and the length changed, or it may be xed (aftercreation). A string is generally understood as a data type and is often implemented as an array of bytes (or words)that stores a sequence of elements, typically characters, using some character encoding. A string may also denotemore general arrays or other sequence (or list) data types and structures.Depending on programming language and precise data type used, a variable declared to be a string may either causestorage in memory to be statically allocated for a predetermined maximum length or employ dynamic allocation toallow it to hold variable number of elements.

    20

  • 6.1. FORMAL THEORY 21

    When a string appears literally in source code, it is known as a string literal or an anonymous string.[1]

    In formal languages, which are used in mathematical logic and theoretical computer science, a string is a nitesequence of symbols that are chosen from a set called an alphabet.

    6.1 Formal theorySee also: Tuple

    Let be a non-empty nite set of symbols (alternatively called characters), called the alphabet. No assumption ismade about the nature of the symbols. A string (or word) over is any nite sequence of symbols from .[2] Forexample, if = {0, 1}, then 01011 is a string over .The length of a string s is the number of symbols in s (the length of the sequence) and can be any non-negative integer;it is often denoted as |s|. The empty string is the unique string over of length 0, and is denoted or .[2][3]

    The set of all strings over of length n is denoted n. For example, if = {0, 1}, then 2 = {00, 01, 10, 11}. Notethat 0 = {} for any alphabet .The set of all strings over of any length is the Kleene closure of and is denoted *. In terms of n,

    =[

    n2N[f0gn

    For example, if = {0, 1}, then * = {, 0, 1, 00, 01, 10, 11, 000, 001, 010, 011, ...}. Although the set * itself iscountably innite, each element of * is a string of nite length.A set of strings over (i.e. any subset of *) is called a formal language over . For example, if = {0, 1}, the setof strings with an even number of zeros, {, 1, 00, 11, 001, 010, 100, 111, 0000, 0011, 0101, 0110, 1001, 1010,1100, 1111, ...}, is a formal language over .

    6.1.1 Concatenation and substrings

    Concatenation is an important binary operation on *. For any two strings s and t in *, their concatenation is denedas the sequence of symbols in s followed by the sequence of characters in t, and is denoted st. For example, if ={a, b, ..., z}, s = bear, and t = hug, then st = bearhug and ts = hugbear.String concatenation is an associative, but non-commutative operation. The empty string serves as the identityelement; for any string s, s = s = s. Therefore, the set * and the concatenation operation form a monoid, the freemonoid generated by . In addition, the length function denes a monoid homomorphism from * to the non-negativeintegers (that is, a function L : 7! N [ f0g , such that L(st) = L(s) + L(t) 8s; t 2 ).A string s is said to be a substring or factor of t if there exist (possibly empty) strings u and v such that t = usv. Therelation is a substring of denes a partial order on *, the least element of which is the empty string.

    6.1.2 Prexes and suxes

    A string s is said to be a prex of t if there exists a string u such that t = su. If u is nonempty, s is said to be a properprex of t. Symmetrically, a string s is said to be a sux of t if there exists a string u such that t = us. If u is nonempty,s is said to be a proper sux of t. Suxes and prexes are substrings of t. Both the relations is a prex of and is asux of are prex orders.

    6.1.3 Rotations

    A string s = uv is said to be a rotation of t if t = vu. For example, if = {0, 1} the string 0011001 is a rotation of0100110, where u = 00110 and v = 01.

  • 22 CHAPTER 6. STRING (COMPUTER SCIENCE)

    6.1.4 Reversal

    The reverse of a string is a string with the same symbols but in reverse order. For example, if s = abc (where a, b,and c are symbols of the alphabet), then the reverse of s is cba. A string that is the reverse of itself (e.g., s = madam)is called a palindrome, which also includes the empty string and all strings of length 1.

    6.1.5 Lexicographical ordering

    It is often useful to dene an ordering on a set of strings. If the alphabet has a total order (cf. alphabetical order)one can dene a total order on * called lexicographical order. For example, if = {0, 1} and 0 < 1, then thelexicographical order on * includes the relationships < 0 < 00 < 000 < ... < 0001 < 001 < 01 < 010 < 011 < 0110< 01111 < 1 < 10 < 100 < 101 < 111 < 1111 < 11111 ... The lexicographical order is total if the alphabetical orderis, but isn't well-founded for any nontrivial alphabet, even if the alphabetical order is.See Shortlex for an alternative string ordering that preserves well-foundedness.

    6.1.6 String operations

    A number of additional operations on strings commonly occur in the formal theory. These are given in the article onstring operations.

    6.1.7 Topology

    000 001

    010

    100

    011

    111

    101

    110

    (Hyper)cube of binary strings of length 3

    Strings admit the following interpretation as nodes on a graph:

  • 6.2. STRING DATATYPES 23

    Fixed-length strings can be viewed as nodes on a hypercube Variable-length strings (of nite length) can be viewed as nodes on the k-ary tree, where k is the number ofsymbols in

    Innite strings (otherwise not considered here) can be viewed as innite paths on the k-ary tree.

    The natural topology on the set of xed-length strings or variable-length strings is the discrete topology, but thenatural topology on the set of innite strings is the limit topology, viewing the set of innite strings as the inverselimit of the sets of nite strings. This is the construction used for the p-adic numbers and some constructions of theCantor set, and yields the same topology.Isomorphisms between string representations of topologies can be found by normalizing according to the lexicographicallyminimal string rotation.

    6.2 String datatypesSee also: Comparison of programming languages (string functions)

    A string datatype is a datatype modeled on the idea of a formal string. Strings are such an important and usefuldatatype that they are implemented in nearly every programming language. In some languages they are available asprimitive types and in others as composite types. The syntax of most high-level programming languages allows for astring, usually quoted in some way, to represent an instance of a string datatype; such a meta-string is called a literalor string literal.

    6.2.1 String lengthAlthough formal strings can have an arbitrary (but nite) length, the length of strings in real languages is oftenconstrained to an articial maximum. In general, there are two types of string datatypes: xed-length strings, whichhave a xed maximum length to be determined at compile time and which use the same amount of memory whetherthis maximum is needed or not, and variable-length strings, whose length is not arbitrarily xed and which can usevarying amounts of memory depending on the actual requirements at run time. Most strings in modern programminglanguages are variable-length strings. Of course, even variable-length strings are limited in length theoretically bythe number of bits available to a pointer, practically by the current size of memory. The string length can be storedas a separate integer (which may put an articial limit on the length) or implicitly through a termination character,usually a character value with all bits zero. See also Null-terminated below.

    6.2.2 Character encodingString datatypes have historically allocated one byte per character, and, although the exact character set varied byregion, character encodings were similar enough that programmers could often get away with ignoring this, sincecharacters a program treated specially (such as period and space and comma) were in the same place in all theencodings a program would encounter. These character sets were typically based on ASCII or EBCDIC.Logographic languages such as Chinese, Japanese, and Korean (known collectively as CJK) need far more than 256characters (the limit of a one 8-bit byte per-character encoding) for reasonable representation. The normal solutionsinvolved keeping single-byte representations for ASCII and using two-byte representations for CJK ideographs. Useof these with existing code led to problems with matching and cutting of strings, the severity of which depended onhow the character encoding was designed. Some encodings such as the EUC family guarantee that a byte value in theASCII range will represent only that ASCII character, making the encoding safe for systems that use those charactersas eld separators. Other encodings such as ISO-2022 and Shift-JIS do not make such guarantees, making matchingon byte codes unsafe. These encodings also were not self-synchronizing, so that locating character boundariesrequired backing up to the start of a string, and pasting two strings together could result in corruption of the secondstring (these problems were much less with EUC as any ASCII character did synchronize the encoding).Unicode has simplied the picture somewhat. Most programming languages now have a datatype for Unicode strings.Unicodes preferred byte stream format UTF-8 is designed not to have the problems described above for older multi-byte encodings. UTF-8, UTF-16 and UTF-32 require the programmer to know that the xed-size code units are

  • 24 CHAPTER 6. STRING (COMPUTER SCIENCE)

    dierent than the characters, the main diculty currently is incorrectly designed APIs that attempt to hide thisdierence (UTF-32 does make code points xed-sized, but these are not characters due to composing codes).

    6.2.3 Implementations

    Some languages like C++ implement strings as templates that can be used with any datatype, but this is the exception,not the rule.Some languages, such as C++ and Ruby, normally allow the contents of a string to be changed after it has beencreated; these are termed mutable strings. In other languages, such as Java and Python, the value is xed and a newstring must be created if any alteration is to be made; these are termed immutable strings.Strings are typically implemented as arrays of bytes, characters, or code units, in order to allow fast access to individualunits or substringsincluding characters when they have a xed length. A few languages such as Haskell implementthem as linked lists instead.Some languages, such as Prolog and Erlang, avoid implementing a dedicated string datatype at all, instead adoptingthe convention of representing strings as lists of character codes.

    6.2.4 Representations

    Representations of strings depend heavily on the choice of character repertoire and the method of character encoding.Older string implementations were designed to work with repertoire and encoding dened by ASCII, or more recentextensions like the ISO 8859 series. Modern implementations often use the extensive repertoire dened by Unicodealong with a variety of complex encodings such as UTF-8 and UTF-16.The term byte string usually indicates a general-purpose string of bytes, rather than strings of only (readable) charac-ters, strings of bits, or such. Byte strings often imply that bytes can take any value and any data can be stored as-is,meaning that there should be no value interpreted as a termination value.Most string implementations are very similar to variable-length arrays with the entries storing the character codes ofcorresponding characters. The principal dierence is that, with certain encodings, a single logical character may takeup more than one entry in the array. This happens for example with UTF-8, where single codes (UCS code points)can take anywhere from one to four bytes, and single characters can take an arbitrary number of codes. In these cases,the logical length of the string (number of characters) diers from the logical length of the array (number of bytes inuse). UTF-32 avoids the rst part of the problem.

    Null-terminated

    Main article: Null-terminated string

    The length of a string can be stored implicitly by using a special terminating character; often this is the null character(NUL), which has all bits zero, a convention used and perpetuated by the popular C programming language.[4] Hence,this representation is commonly referred to as a C string. This representation of an n-character string takes n + 1space (1 for the terminator), and is thus an implicit data structure.In terminated strings, the terminating code is not an allowable character in any string. Strings with length eld donot have this limitation and can also store arbitrary binary data. In C two things are needed to handle binary data: acharacter pointer and the length of the data.An example of a null-terminated string stored in a 10-byte buer, along with its ASCII (or more modern UTF-8)representation as 8-bit hexadecimal numbers is:The length of the string in the above example, FRANK, is 5 characters, but it occupies 6 bytes. Characters after theterminator do not form part of the representation; they may be either part of another string or just garbage. (Stringsof this form are sometimes called ASCIZ strings, after the original assembly language directive used to declare them.)

  • 6.2. STRING DATATYPES 25

    Length-prexed

    The length of a string can also be stored explicitly, for example by prexing the string with the length as a byte value(a convention used in many Pascal dialects): as a consequence, some people call it a Pascal string or P-string.Storing the string length as byte limits the maximum string length to 255. To avoid such limitations, improvedimplementations of P-strings use 16-, 32-, or 64-bit words to store the string length. When the length eld coversthe address space, strings are limited only by the available memory. Encoding the length n takes log(n) space (seexed-length code), so length-prexed strings are a succinct data structure, encoding a string of length n in log(n) +n space. However, if the length is bounded, then the length can be encoded in constant space, typically a machineword, and thus is an implicit data structure, taking n + k space, where k is the number of characters in a word (8 for8-bit ASCII on a 64-bit machine, 1 for 32-bit UTF-32/UCS-4 on a 32-bit machine, etc.).Here is the equivalent Pascal string stored in a 10-byte buer, along with its ASCII / UTF-8 representation:

    Strings as records

    Many languages, including object-oriented ones, implement strings as records in a structure like:class string { unsigned int length; char *text; };

    Although this implementation is hidden, and accessed through member functions. The text will be a dynamicallyallocated memory area, that might be expanded if needed. See also string (C++).

    Linked-list

    Both character termination and length codes limit strings: For example, C character arrays that contain null (NUL)characters cannot be handled directly by C string library functions: Strings using a length code are limited to themaximum value of the length code.Both of these limitations can be overcome by clever programming, but such workarounds are by denition not stan-dard.Rough equivalents of the C termination method have historically appeared in both hardware and software. Forexample, data processing machines like the IBM 1401 used a special word mark bit to delimit strings at the left,where the operation would start at the right. This meant that, while the IBM 1401 had a seven-bit word in reality,almost no-one ever thought to use this as a feature, and override the assignment of the seventh bit to (for example)handle ASCII codes.It is possible to create data structures and functions that manipulate them that do not have the problems associatedwith character termination and can in principle overcome length code bounds. It is also possible to optimize the stringrepresented using techniques from run length encoding (replacing repeated characters by the character value and alength) and Hamming encoding.While these representations are common, others are possible. Using ropes makes certain string operations, such asinsertions, deletions, and concatenations more ecient.

    6.2.5 Security concerns

    The diering memory layout and storage requirements of strings can aect the security of the program accessingthe string data. String representations requiring a terminating character are commonly susceptible to buer overowproblems if the terminating character is not present, caused by a coding error or an attacker deliberately altering thedata. String representations adopting a separate length eld are also susceptible if the length can be manipulated. Insuch cases, program code accessing the string data requires bounds checking to ensure that it does not inadvertentlyaccess or change data outside of the string memory limits.String data is frequently obtained from user-input to a program. As such, it is the responsibility of the program tovalidate the string to ensure that it represents the expected format. Performing limited or no validation of user-inputcan cause a program to be vulnerable to code injection attacks.

  • 26 CHAPTER 6. STRING (COMPUTER SCIENCE)

    6.3 Text le stringsIn computer readable text les, for example programming language source les or conguration les, strings can berepresented. The NUL byte is normally not used as terminator since that does not correspond to the ASCII textstandard, and the length is usually not stored, since the le should be human editable without bugs.Two common representations are:

    Surrounded by quotation marks (ASCII 2216), used by most programming languages. To be able to includequotation marks, newline characters etc., escape sequences are often available, usually using the backslashcharacter (ASCII 5C16).

    Terminated by a newline sequence, for example in Windows INI les.

    See also: String literal

    6.4 Non-text stringsWhile character strings are very common uses of strings, a string in computer science may refer generically to anysequence of homogeneously typed data. A string of bits or bytes, for example, may be used to represent non-textualbinary data retrieved from a communications medium. This data may or may not be represented by a string-specicdatatype, depending on the needs of the application, the desire of the programmer, and the capabilities of the pro-gramming language being used. If the programming languages string implementation is not 8-bit clean, data cor-ruption may ensue.

    6.5 String processing algorithmsThere aremany algorithms for processing strings, each with various trade-os. Some categories of algorithms include:

    String searching algorithms for nding a given substring or pattern String manipulation algorithms Sorting algorithms Regular expression algorithms Parsing a string Sequence mining

    Advanced string algorithms often employ complex mechanisms and data structures, among them sux trees and nitestate machines.The name stringologywas coined in 1984 by computer scientist Zvi Galil for the issue of algorithms and data structuresused for string processing.[5]

    6.6 Character string-oriented languages and utilitiesCharacter strings are such a useful datatype that several languages have been designed in order to make string pro-cessing applications easy to write. Examples include the following languages:

    awk Icon

  • 6.7. CHARACTER STRING FUNCTIONS 27

    MUMPS Perl Rexx Ruby sed SNOBOL Tcl TTM

    Many Unix utilities perform simple string manipulations and can be used to easily program some powerful stringprocessing algorithms. Files and nite streams may be viewed as strings.Some APIs like Multimedia Control Interface, embedded SQL or printf use strings to hold commands that will beinterpreted.Recent scripting programming languages, including Perl, Python, Ruby, and Tcl employ regular expressions to fa-cilitate text operations. Perl is particularly noted for its regular expression use,[6] and many other languages andapplications implement Perl compatible regular expressions.Some languages such as Perl and Ruby support string interpolation, which permits arbitrary expressions to be evalu-ated and included in string literals.

    6.7 Character string functionsSee also: Comparison of programming languages (string functions)

    String functions are used to manipulate a string or change or edit the contents of a string. They also are used to queryinformation about a string. They are usually used within the context of a computer programming language.The most basic example of a string function is the string length function the function that returns the length ofa string (not counting any terminator characters or any of the strings internal structural information) and does notmodify the string. This function is often named length or len. For example, length(hello world) would return 11.

    6.8 String buersIn some programming languages, a string buer is an alternative to a string. It has the ability to be altered throughadding or appending, whereas a String is normally xed or immutable.

    6.8.1 In JavaTheory

    Java's standard way to handle text is to use its String class. Any given String in Java is an immutable object, whichmeans its state cannot be changed. A String has an array of characters. Whenever a String must be manipulated, anychanges require the creation of a new String (which, in turn, involves the creation of a new array of characters, andcopying of the original array). This happens even if the original Strings value or intermediate Strings used for themanipulation are not kept.Java provides an alternate class for string manipulation, called StringBuer. A StringBuer, like a String, has anarray to hold characters. It, however, is mutable (its state can be altered). Its array of characters is not necessarilycompletely lled (as opposed to a String, whose array is always the exact required length for its contents). Thus, ithas the capability to add, remove, or change its state without creating a new object (and without the creation of a new

  • 28 CHAPTER 6. STRING (COMPUTER SCIENCE)

    array, and array copying). The exception to this is when its array is no longer of suitable length to hold its content.In this case, it is required to create a new array, and copy the contents.For these reasons, Java would handle an expression likeString newString = aString + anInt + aChar + aDouble;

    like this:String newString = (new StringBuilder(aString)).append(anInt).append(aChar).append(aDouble).toString();

    Implications

    Generally, a StringBuer is more ecient than a String in string handling. However, this is not necessarily the case,since a StringBuer will be required to recreate its character array when it runs out of space. Theoretically, this ispossible to happen the same number of times as a new String would be required, although this is unlikely (and theprogrammer can provide length hints to prevent this). Either way, the eect is not noticeable in modern desktopcomputers.As well, the shortcomings of arrays are inherent in a StringBuer. In order to insert or remove characters at arbitrarypositions, whole sections of arrays must be moved.The method by which a StringBuer is attractive in an environment with low processing power takes this ability byusing too much memory, which is likely also at a premium in this environment. This point, however, is trivial, con-sidering the space required for creating many instances of Strings in order to process them. As well, the StringBuercan be optimized to waste as little memory as possible.The StringBuilder class, introduced in J2SE 5.0, diers from StringBuer in that it is unsynchronized. When only asingle thread at a time will access the object, using a StringBuilder processes more eciently than using a StringBuer.StringBuer and StringBuilder are included in the java.lang package.

    6.8.2 In .NETMicrosofts .NET Framework has a StringBuilder class in its Base Class Library.

    6.8.3 In other languages In C++ and Ruby, the standard string class is already mutable, with the ability to change the contents andappend strings, etc., so a separate mutable string class is unnecessary.

    InObjective-C (Cocoa/OpenStep frameworks), theNSMutableString class is themutable version of theNSStringclass.

    6.9 See also Formal language a (possibly innite) set of strings in theoretical computer science Connection string passed to a driver to initiate a connection e.g. to a database Rope a data structure for eciently manipulating long strings Bitstring a string of binary digits Binary-safe a property of string manipulating functions treating their input as raw data stream Improper input validation a type of software security vulnerability particularly relevant for user-given strings Incompressible string a string that cannot be compressed by any algorithm

  • 6.10. REFERENCES 29

    Empty string its properties and representation in programming languages String metric notions of similarity between strings string (C++) overview of C++ string handling string.h overview of C string handling Analysis of algorithms determining time and storage needed by a particular (e.g. string manipulation)algorithm

    6.10 References[1] Introduction To Java - MFC 158 G. String literals (or constants) are called anonymous strings

    [2] Barbara H. Partee; Alice ter Meulen; Robert E. Wall (1990). Mathematical Methods in Linguistics. Kluwer.

    [3] John E. Hopcroft, Jerey D. Ullman (1979). Introduction to Automata Theory, Languages, and Computation. Addison-Wesley. ISBN 0-201-02988-X. Here: sect.1.1, p.1

    [4] Bryant, Randal E.; David, O'Hallaron (2003), Computer Systems: A Programmers Perspective (2003 ed.), Upper SaddleRiver, NJ: Pearson Education, p. 40, ISBN 0-13-034074-X

    [5] The Prague Stringology Club. stringology.org. Retrieved 23 May 2015.

    [6] Essential Perl. Perls most famous strength is in string manipulation with regular expressions.

  • Chapter 7

    Well-formed formula

    Symbols andstrings of symbols

    Well-formed formulas

    Theorems

    This diagram shows the syntactic entities which may be constructed from formal languages. The symbols and strings of symbolsmay be broadly divided into nonsense and well-formed formulas. A formal language can be thought of as identical to the set of itswell-formed formulas. The set of well-formed formulas may be broadly divided into theorems and non-theorems.

    In mathematical logic, a well-formed formula, shortly w, often simply formula, is a word (i.e. a nite sequenceof symbols from a given alphabet) that is part of a formal language.[1] A formal language can be considered to beidentical to the set containing all and only its formulas.A formula is a syntactic formal object that can be given a semantic meaning by means of semantics.

    30

  • 7.1. INTRODUCTION 31

    7.1 IntroductionA key use of formulae is in propositional logic and predicate logics such as rst-order logic. In those contexts, aformula is a string of symbols for which it makes sense to ask is true?", once any free variables in have beeninstantiated. In formal logic, proofs can be represented by sequences of formulas with certain properties, and thenal formula in the sequence is what is proven.Although the term formula may be used for written marks (for instance, on a piece of paper or chalkboard), it ismore precisely understood as the sequence being expressed, with the marks being a token instance of formula. It isnot necessary for the existence of a formula that there be any actual tokens of it. A formal language may thus have aninnite number of formulas regardless whether each formula has a token instance. Moreover, a single formula mayhave more than one token instance, if it is written more than once.Formulas are quite often interpreted as propositions (as, for instance, in propositional logic). However formulas aresyntactic entities, and as such must be specied in a formal language without regard to any interpretation of them.An interpreted formula may be the name of something, an adjective, an adverb, a preposition, a phrase, a clause, animperative sentence, a string of sentences, a string of names, etc.. A formula may even turn out to be nonsense, if thesymbols of the language are specied so that it does. Furthermore, a formula need not be given any interpretation.

    7.2 Propositional calculusThe formulas of propositional calculus, also called propositional formulas,[2] are expressions such as (A ^ (B _C)). Their denition begins with the arbitrary choice of a set V of propositional variables. The alphabet consists of theletters in V along with the symbols for the propositional connectives and parentheses "(" and ")", all of which areassumed to not be in V. The formulas will be certain expressions (that is, strings of symbols) over this alphabet.The formulas are inductively dened as follows:

    Each propositional variable is, on its own, a formula. If is a formula, then : is a formula. If and are formulas, and is any binary connective, then ( ) is a formula. Here could be (but is notlimited to) the usual operators , , , or .

    This denition can also be written as a formal grammar in BackusNaur form, provided the set of variables is nite:

    ::= p | q | r | s | t | u | ... (the arbitrary nite set of propositional variables) ::= | : | ( ^ ) | ( _ ) | (! ) |($ )

    Using this grammar, the sequence of symbols

    (((p! q) ^ (r! s)) _ ( : q ^ : s))

    is a formula, because it is grammatically correct. The sequence of symbols

    ((p! q)! (qq))p))

    is not a formula, because it does not conform to the grammar.A complex formula may be dicult to read, owing to, for example, the proliferation of parentheses. To alleviatethis last phenomenon, precedence rules (akin to the standard mathematical order of operations) are assumed amongthe operators, making some operators more binding than others. For example, assuming the precedence (from mostbinding to least binding) 1. : 2. ! 3. ^ 4. _ . Then the formula

    (((p! q) ^ (r! s)) _ ( : q ^ : s))

  • 32 CHAPTER 7. WELL-FORMED FORMULA

    may be abbreviated as

    p! q ^ r! s _ : q ^ : s

    This is, however, only a convention used to simplify the written representation of a formula. If the precedence wasassumed, for example, to be left-right associative, in following order: 1. : 2. ^ 3. _ 4. ! , then the same formulaabove (without parentheses) would be rewritten as

    (p! (q ^ r))! (s _ (( : q) ^ ( : s)))

    7.3 Predicate logicThe denition of a formula in rst-order logic QS is relative to the signature of the theory at hand. This signaturespecies the constant symbols, relation symbols, and function symbols of the theory at hand, along with the arities ofthe function and relation symbols.The denition of a formula comes in several parts. First, the set of terms is dened recursively. Terms, informally,are expressions that represent objects from the domain of discourse.

    1. Any variable is a term.2. Any constant symbol from the signature is a term3. an expression of the form f(t1,...,tn), where f is an n-ary function symbol, and t1,...,tn are terms, is again a

    term.

    The next step is to dene the atomic formulas.

    1. If t1 and t2 are terms then t1=t2 is an atomic formula2. If R is an n-ary relation symbol, and t1,...,tn are terms, then R(t1,...,tn) is an atomic formula

    Finally, the set of formulas is dened to be the smallest set containing the set of atomic formulas such that thefollowing holds:

    1. : is a formula when is a formula2. ( ^ ) and ( _ ) are formulas when and are formulas;3. 9x is a formula when x is a variable and is a formula;4. 8x is a formula when x is a variable and is a formula (alternatively, 8x could be dened as an abbreviation

    for :9x: ).

    If a formula has no occurrences of 9x or 8x , for any variable x , then it is called quantier-free. An existentialformula is a formula starting with a sequence of existential quantication followed by a quantier-free formula.

    7.4 Atomic and open formulasMain article: Atomic formula

    An atomic formula is a formula that contains no logical connectives nor quantiers, or equivalently a formula that hasno strict subformulas. The precise form of atomic formulas depends on the formal system under consideration; forpropositional logic, for example, the atomic formulas are the propositional variables. For predicate logic, the atomsare predicate symbols together with their arguments, each argument being a term.According to some terminology, an open formula is formed by combining atomic formulas using only logical con-nectives, to the exclusion of quantiers.[3] This has not to be confused with a formula which is not closed.

  • 7.5. CLOSED FORMULAS 33

    7.5 Closed formulasMain article: Sentence (mathematical logic)

    A closed formula, also ground formula or sentence, is a formula in which there are no free occurrences of any variable.If A is a formula of a rst-order language in which the variables v1, ..., vn have free occurrences, then A preceded byv1 ... vn is a closure of A.

    7.6 Properties applicable to formulas A formula A in a language Q is valid if it is true for every interpretation of Q . A formula A in a language Q is satisable if it is true for some interpretation of Q . A formula A of the language of arithmetic is decidable if it represents a decidable set, i.e. if there is aneective method which, given a substitution of the free variables of A, says that either the resulting instance ofA is provable or its negation is.

    7.7 Usage of the terminologyIn earlier works on mathematical logic (e.g. by Church[4]), formulas referred to any strings of symbols and amongthese strings, well-formed formulas were the strings that followed the formation rules of (correct) formulas.Several authors simply say formula.[5][6][7][8] Modern usages (especially in the context of computer science withmathematical software such as model checkers, automated theorem provers, interactive theorem provers) tend toretain of the notion of formula only the algebraic concept and to leave the question of well-formedness, i.e. of theconcrete string representation of formulas (using this or that symbol for connectives and quantiers, using this or thatparenthesizing convention, using Polish or inx notation, etc.) as a mere notational problem.However, the expression well-formed formulas can still be found in various works,[9][10][11] these authors using thename well-formed formula without necessarily opposing it to the old sense of formula as arbitrary string of symbols sothat it is no longer common in mathematical logic to refer to arbitrary strings of symbols in the old sense of formulas.The expression well-formed formulas (WFF) also pervaded in popular culture. Indeed,WFF is part of an esotericpun used in the name of the academic game "WFF 'N PROOF: The Game of Modern Logic, by Layman Allen,[12]developed while he was at Yale Law School (he was later a professor at the University of Michigan). The suite ofgames is designed to teach the principles of symbolic logic to children (in Polish notation).[13] Its name is an echoof whienpoof, a nonsense word used as a cheer at Yale University made popular in The Whienpoof Song and TheWhienpoofs.[14]

    7.8 See also Ground expression

    7.9 Notes[1] Formulas are a standard topic in introductory logic, and are covered by all introductory textbooks, including Enderton

    (2001), Gamut (1990), and Kleene (1967)

    [2] First-order logic and automated theorem proving, Melvin Fitting, Springer, 1996

    [3] Handbook of the history of logic, (Vol 5, Logic from Russell to Church), Tarskis logic by Keith Simmons, D. Gabbay andJ. Woods Eds, p568 .

    [4] Alonzo Church, [1996] (1944), Introduction to mathematical logic, page 49

  • 34 CHAPTER 7. WELL-FORMED FORMULA

    [5] Hilbert, David; Ackermann, Wilhelm (1950) [1937], Principles of Mathematical Logic, New York: Chelsea

    [6] Hodges, Wilfrid (1997), A shorter model theory, Cambridge University Press, ISBN 978-0-521-58713-6

    [7] Barwise, Jon, ed. (1982), Handbook of Mathematical Logic, Studies in Logic and the Foundations of Mathematics, Am-sterdam: North-Holland, ISBN 978-0-444-86388-1

    [8] Cori, Rene; Lascar, Daniel (2000), Mathematical Logic: A Course with Exercises, Oxford University Press, ISBN 978-0-19-850048-3

    [9] Enderton, Herbert [2001] (1972), A mathematical introduction to logic (2nd ed.), Boston, MA: Academic Press, ISBN978-0-12-238452-3

    [10] R. L. Simpson (1999), Essentials of Symbolic Logic, page 12

    [11] Mendelson, Elliott [2010] (1964), An Introduction to Mathematical Logic (5th ed.), London: Chapman & Hall

    [12] Ehrenburg 2002

    [13] More technically, propositional logic using the Fitch-style calculus.

    [14] Allen (1965) acknowledges the pun.

    7.10 References Allen, Layman E. (1965), TowardAutotelic Learning ofMathematical Logic by theWFF 'N PROOFGames,Mathematical Learning: Report of a Conference Sponsored by the Committee on Intellective Processes Researchof the Social Science Research Council, Monographs of the Society for Research in Child Development 30 (1):2941

    Boolos, George; Burgess, John; Jerey, Richard (2002), Computability and Logic (4th ed.), Cambridge Uni-versity Press, ISBN 978-0-521-00758-0

    Ehrenberg, Rachel (Spring 2002). Hes Positively Logical. Michigan Today (University of Michigan). Re-trieved 2007-08-19.

    Enderton, Herbert (2001), A mathematical introduction to logic (2nd ed.), Boston, MA: Academic Press, ISBN978-0-12-238452-3

    Gamut, L.T.F. (1990), Logic, Language, and Meaning, Volume 1: Introduction to Logic, University Of ChicagoPress, ISBN 0-226-28085-3

    Hodges, Wilfrid (2001), Classical Logic I: First-Order Logic, in Goble, Lou, The Blackwell Guide to Philo-sophical Logic, Blackwell, ISBN 978-0-631-20692-7

    Hofstadter, Douglas (1980), Gdel, Escher, Bach: An Eternal Golden Braid, Penguin Books, ISBN 978-0-14-005579-5

    Kleene, Stephen Cole (2002) [1967], Mathematical logic, New York: Dover Publications, ISBN 978-0-486-42533-7, MR 1950307

    Rautenberg, Wolfgang (2010), A Concise Introduction to Mathematical Logic (3rd ed.), New York: SpringerScience+Business Media, doi:10.1007/978-1-4419-1221-3, ISBN 978-1-4419-1220-6

    7.11 External links Well-Formed Formula for First Order Predicate Logic - includes a short Java quiz. Well-Formed Formula at ProvenMath WFF N PROOF game site

  • 7.12. TEXT AND IMAGE SOURCES, CONTRIBUTORS, AND LICENSES 35

    7.12 Text and image sources, contributors, and licenses7.12.1 Text

    Free variables and bound variables Source: https://en.wikipedia.org/wiki/Free_variables_and_bound_variables?oldid=671743800Con-tributors: Toby Bartels, Edward, Michael Hardy, Emperorbma, Charles Matthews, Bevo, Robbot, MathMartin, Pengo, Tobias Bergemann,Ssd, CSTAR, SeanProctor, Spayrard, Shenme, Homerjay, DiegoMoya, Ish ishwar, Daira Hopwood, MFH, BD2412, R.e.b., Eubot, Fresh-eneesz, Algebraist, YurikBot, SimonMorgan, Wasseralm, Mustard~enwiki, SmackBot, Mhss, Jerome Charles Potts, Shunpiker, Cyberco-bra, Jon Awbrey, Henning Makholm, Ysoldak, MagnaMopus, Physis, Paul Foxworthy, CBM, Gregbard, Nick Number, JohnPaulPagano,AnAj, Abcarter, Faizhaider, Usien6, R'n'B, Arronax50, Trumpet marietta 45750, Xnuala, Camrn86, Aaron Rotenberg, Reuqr, Ddxc,Maxalbanese, Classicalecon, 718 Bot, SchreiberBike, Franklin.vp, Subversive.sound, Addbot, Ojb500, Yobot, Pcap, Gongshow, 4th-otaku, Iitmadras, Cmccormick8, FrescoBot, Winterst, Lotje, WikitanvirBot, BattyBot, TrebDozer and Anonymous: 41

    Open sentence Source: https://en.wikipedia.org/wiki/Open_sentence?oldid=671189026 Contributors: Toby Bartels, Michael Hardy,Oliver Pereira, AugPi, Pizza Puzzle, Ruakh, Alan Liefting, Jason Quinn, Klemen Kocjancic, Rgdboer, EmilJ, Oleg Alexandrov, Linas,LOL, Ledy, BD2412, Kbdank71, Jshadias, Mathbot, DevastatorIIC, Wimt, ENeville, Malcolma, Sharkb, Melchoir, Bigbluesh, Mhss,Chris the speller, Clconway, Atoll, CBM, Gregbard, AndrewHowse, Cydebot, Alaibot, Nemti, Mhaitham.shammaa, JamesBWatson,JaGa, Unisonus, AlnoktaBOT, Randomblue, ClueBot, Addbot, Magog the Ogre, Etincelles, ClueBot NG, Suelru and Anonymous: 15

    Predicate (mathematical logic) Source: https://en.wikipedia.org/wiki/Predicate_(mathematical_logic)?oldid=672299216 Contributors:Zundark, Toby Bartels, William Avery, SimonP, Marknew, Alex S, Hyacinth, Barbara Shack, Jason Quinn, Abdull, Csar (usurped),Arthena, Kenyon, Velho, Linas, Action po