HOME

TheInfoList



OR:

In
set theory Set theory is the branch of mathematical logic that studies sets, which can be informally described as collections of objects. Although objects of any kind can be collected into a set, set theory, as a branch of mathematics, is mostly conce ...
and its applications to
logic Logic is the study of correct reasoning. It includes both formal and informal logic. Formal logic is the science of deductively valid inferences or of logical truths. It is a formal science investigating how conclusions follow from premise ...
, mathematics, and
computer science Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to practical disciplines (includi ...
, set-builder notation is a
mathematical notation Mathematical notation consists of using symbols for representing operations, unspecified numbers, relations and any other mathematical objects, and assembling them into expressions and formulas. Mathematical notation is widely used in mathem ...
for describing a set by enumerating its elements, or stating the properties that its members must satisfy. Defining sets by properties is also known as set comprehension, set abstraction or as defining a set's intension.


Sets defined by enumeration

A set can be described directly by enumerating all of its elements between curly brackets, as in the following two examples: * \ is the set containing the four numbers 3, 7, 15, and 31, and nothing else. * \=\ is the set containing , , and , and nothing else (there is no order among the elements of a set). This is sometimes called the "roster method" for specifying a set. When it is desired to denote a set that contains elements from a regular sequence, an ellipses notation may be employed, as shown in the next examples: * \ is the set of integers between 1 and 100 inclusive. * \ is the set of
natural number In mathematics, the natural numbers are those numbers used for counting (as in "there are ''six'' coins on the table") and ordering (as in "this is the ''third'' largest city in the country"). Numbers used for counting are called ''cardinal ...
s. * \= \ is the set of all integers. There is no order among the elements of a set (this explains and validates the equality of the last example), but with the ellipses notation, we use an ordered sequence before (or after) the ellipsis as a convenient notational vehicle for explaining which elements are in a set. The first few elements of the sequence are shown, then the ellipses indicate that the simplest interpretation should be applied for continuing the sequence. Should no terminating value appear to the right of the ellipses, then the sequence is considered to be unbounded. In general, \ denotes the set of all natural numbers i such that 1\leq i\leq n. Another notation for \ is the bracket notation /math>. A subtle special case is n=0, in which = \ is equal to the empty set \emptyset. Similarly, \ denotes the set of all a_i for 1\leq i\leq n. In each preceding example, each set is described by enumerating its elements. Not all sets can be described in this way, or if they can, their enumeration may be too long or too complicated to be useful. Therefore, many sets are defined by a property that characterizes their elements. This characterization may be done informally using general prose, as in the following example. * \ is the set of all addresses on Pine Street. However, the prose approach may lack accuracy or be ambiguous. Thus, set-builder notation is often used with a predicate characterizing the elements of the set being defined, as described in the following section.


Sets defined by a predicate

Set-builder notation can be used to describe a set that is defined by a
predicate Predicate or predication may refer to: * Predicate (grammar), in linguistics * Predication (philosophy) * several closely related uses in mathematics and formal logic: **Predicate (mathematical logic) **Propositional function **Finitary relation, o ...
, that is, a logical formula that evaluates to ''true'' for an element of the set, and ''false'' otherwise. In this form, set-builder notation has three parts: a variable, a colon or vertical bar separator, and a predicate. Thus there is a variable on the left of the separator, and a rule on the right of it. These three parts are contained in curly brackets: :\ or :\. The vertical bar (or colon) is a separator that can be read as "such that", "for which", or "with the property that". The formula is said to be the ''rule'' or the ''predicate''. All values of for which the predicate holds (is true) belong to the set being defined. All values of for which the predicate does not hold do not belong to the set. Thus \ is the set of all values of that satisfy the formula . It may be the empty set, if no value of satisfies the formula.


Specifying the domain

A domain can appear on the left of the vertical bar: :\, or by adjoining it to the predicate: :\\quad\text\quad\. The ∈ symbol here denotes set membership, while the \land symbol denotes the logical "and" operator, known as
logical conjunction In logic, mathematics and linguistics, And (\wedge) is the truth-functional operator of logical conjunction; the ''and'' of a set of operands is true if and only if ''all'' of its operands are true. The logical connective that represents thi ...
. This notation represents the set of all values of that belong to some given set for which the predicate is true (see " Set existence axiom" below). If \Phi(x) is a conjunction \Phi_1(x)\land\Phi_2(x), then \ is sometimes written \, using a comma instead of the symbol \land. In general, it is not a good idea to consider sets without defining a domain of discourse, as this would represent the subset of ''all possible things that may exist'' for which the predicate is true. This can easily lead to contradictions and paradoxes. For example,
Russell's paradox In mathematical logic, Russell's paradox (also known as Russell's antinomy) is a set-theoretic paradox discovered by the British philosopher and mathematician Bertrand Russell in 1901. Russell's paradox shows that every set theory that contains ...
shows that the expression \, although seemingly well formed as a set builder expression, cannot define a set without producing a contradiction. In cases where the set is clear from context, it may be not explicitly specified. It is common in the literature for an author to state the domain ahead of time, and then not specify it in the set-builder notation. For example, an author may say something such as, "Unless otherwise stated, variables are to be taken to be natural numbers," though in less formal contexts where the domain can be assumed, a written mention is often unnecessary.


Examples

The following examples illustrate particular sets defined by set-builder notation via predicates. In each case, the domain is specified on the left side of the vertical bar, while the rule is specified on the right side. * \ is the set of all strictly
positive Positive is a property of positivity and may refer to: Mathematics and science * Positive formula, a logical formula not containing negation * Positive number, a number that is greater than 0 * Plus sign, the sign "+" used to indicate a posi ...
real number In mathematics, a real number is a number that can be used to measure a ''continuous'' one-dimensional quantity such as a distance, duration or temperature. Here, ''continuous'' means that values can have arbitrarily small variations. Every ...
s, which can be written in interval notation as (0, \infty). * \ is the set \. This set can also be defined as \; see
equivalent predicates yield equal sets Equivalence or Equivalent may refer to: Arts and entertainment *Album-equivalent unit, a measurement unit in the music industry *Equivalence class (music) *'' Equivalent VIII'', or ''The Bricks'', a minimalist sculpture by Carl Andre *''Equival ...
below. * For each integer , we can define G_m = \ = \. As an example, G_3 = \ = \ and G_ = \. * \ is the set of pairs of real numbers such that ''y'' is greater than 0 and less than , for a given
function Function or functionality may refer to: Computing * Function key, a type of key on computer keyboards * Function model, a structured representation of processes in a system * Function object or functor or functionoid, a concept of object-oriente ...
. Here the cartesian product \mathbb\times\mathbb denotes the set of ordered pairs of real numbers. * \ is the set of all even
natural number In mathematics, the natural numbers are those numbers used for counting (as in "there are ''six'' coins on the table") and ordering (as in "this is the ''third'' largest city in the country"). Numbers used for counting are called ''cardinal ...
s. The \land sign stands for "and", which is known as
logical conjunction In logic, mathematics and linguistics, And (\wedge) is the truth-functional operator of logical conjunction; the ''and'' of a set of operands is true if and only if ''all'' of its operands are true. The logical connective that represents thi ...
. The ∃ sign stands for "there exists", which is known as
existential quantification In predicate logic, an existential quantification is a type of quantifier, a logical constant which is interpreted as "there exists", "there is at least one", or "for some". It is usually denoted by the logical operator symbol ∃, which, ...
. So for example, (\exists x) P(x) is read as "there exists an such that ". * \ is a notational variant for the same set of even natural numbers. It is not necessary to specify that is a natural number, as this is implied by the formula on the right. * \ is the set of
rational number In mathematics, a rational number is a number that can be expressed as the quotient or fraction of two integers, a numerator and a non-zero denominator . For example, is a rational number, as is every integer (e.g. ). The set of all rat ...
s; that is, real numbers that can be written as the ratio of two
integer An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign ( −1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the languag ...
s.


More complex expressions on the left side of the notation

An extension of set-builder notation replaces the single variable with an
expression Expression may refer to: Linguistics * Expression (linguistics), a word, phrase, or sentence * Fixed expression, a form of words with a specific meaning * Idiom, a type of fixed expression * Metaphorical expression, a particular word, phrase, o ...
. So instead of \, we may have \, which should be read :\=\. For example: * \, where \mathbb N is the set of all natural numbers, is the set of all even natural numbers. * \, where \mathbb Z is the set of all integers, is \mathbb, the set of all rational numbers. * \ is the set of odd integers. * \ creates a set of pairs, where each pair puts an integer into correspondence with an odd integer. When inverse functions can be explicitly stated, the expression on the left can be eliminated through simple substitution. Consider the example set \. Make the substitution u = 2t + 1, which is to say t = (u-1)/2, then replace ''t'' in the set builder notation to find :\ = \.


Equivalent predicates yield equal sets

Two sets are equal if and only if they have the same elements. Sets defined by set builder notation are equal if and only if their set builder rules, including the domain specifiers, are equivalent. That is : \=\ if and only if : (\forall t) (t \in A \land P(t)) \Leftrightarrow (t \in B \land Q(t))/math>. Therefore, in order to prove the equality of two sets defined by set builder notation, it suffices to prove the equivalence of their predicates, including the domain qualifiers. For example, : \ = \ because the two rule predicates are logically equivalent: : (x \in \mathbb \land x^2 = 1) \Leftrightarrow (x \in \mathbb \land , x, = 1). This equivalence holds because, for any real number ''x'', we have x^2 = 1 if and only if ''x'' is a rational number with , x, =1. In particular, both sets are equal to the set \.


Set existence axiom

In many formal set theories, such as
Zermelo–Fraenkel set theory In set theory, Zermelo–Fraenkel set theory, named after mathematicians Ernst Zermelo and Abraham Fraenkel, is an axiomatic system that was proposed in the early twentieth century in order to formulate a theory of sets free of paradoxes such ...
, set builder notation is not part of the formal syntax of the theory. Instead, there is a set existence axiom scheme, which states that if is a set and is a formula in the language of set theory, then there is a set whose members are exactly the elements of that satisfy : :(\forall E)(\exists Y)(\forall x) \in Y \Leftrightarrow x \in E \land \Phi(x) The set obtained from this axiom is exactly the set described in set builder notation as \.


In programming languages

A similar notation available in a number of
programming languages A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
(notably
Python Python may refer to: Snakes * Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia ** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia * Python (mythology), a mythical serpent Computing * Python (pro ...
and
Haskell Haskell () is a general-purpose, statically-typed, purely functional programming language with type inference and lazy evaluation. Designed for teaching, research and industrial applications, Haskell has pioneered a number of programming lan ...
) is the
list comprehension A list comprehension is a syntactic construct available in some programming languages for creating a list based on existing lists. It follows the form of the mathematical ''set-builder notation'' (''set comprehension'') as distinct from the use of ...
, which combines
map A map is a symbolic depiction emphasizing relationships between elements of some space, such as objects, regions, or themes. Many maps are static, fixed to paper or some other durable medium, while others are dynamic or interactive. Although ...
and
filter Filter, filtering or filters may refer to: Science and technology Computing * Filter (higher-order function), in functional programming * Filter (software), a computer program to process a data stream * Filter (video), a software component tha ...
operations over one or more lists. In Python, the set-builder's braces are replaced with square brackets, parentheses, or curly braces, giving list, generator, and set objects, respectively. Python uses an English-based syntax. Haskell replaces the set-builder's braces with square brackets and uses symbols, including the standard set-builder vertical bar. The same can be achieved in Scala using Sequence Comprehensions, where the "for" keyword returns a list of the yielded variables using the "yield" keyword. Consider these set-builder notation examples in some programming languages: The set builder notation and list comprehension notation are both instances of a more general notation known as ''monad comprehensions'', which permits map/filter-like operations over any
monad Monad may refer to: Philosophy * Monad (philosophy), a term meaning "unit" **Monism, the concept of "one essence" in the metaphysical and theological theory ** Monad (Gnosticism), the most primal aspect of God in Gnosticism * ''Great Monad'', a ...
with a
zero element In mathematics, a zero element is one of several generalizations of the number zero to other algebraic structures. These alternate meanings may or may not reduce to the same thing, depending on the context. Additive identities An additive identi ...
.


See also

* Glossary of set theory


Notes

{{bots, deny=Yobot Set theory Mathematical notation Articles with example Haskell code Articles with example Python (programming language) code is:Mengjaskilgreiningarritháttur