All Topics  
Set-builder notation

 

   Email Print
   Bookmark   Link






 

Set-builder notation



 
 
In set theory
Set theory

Set theory is the branch of mathematics that studies Set , which are collections of objects. Although any type of object can be collected into a set, set theory is applied most often to objects that are relevant to mathematics....
 and its applications to logic
Logic

Logic is the study of the principles of valid demonstration and inference. Logic is a branch of philosophy, a part of the classical Trivium . The word derives from Greek language ?????? , fem....
, mathematics
Mathematics

Mathematics is the study of quantity, structure, space, change, and related topics of pattern and form. Mathematicians seek out patterns whether found in numbers, space, natural science, computers, imaginary abstractions, or elsewhere....
, and computer science
Computer science

Computer science is the study of the theoretical foundations of information and computation, and of practical techniques for their implementation and application in computer systems....
, set-builder notation (sometimes simply set notation
Set notation

Set are fundamental objects in mathematics. Intuitively, a set is merely a collection of element or members. There are various conventions for textually denoting sets....
) is a mathematical notation
Mathematical notation

A mathematical notation is a system of symbolic representations of mathematical objects and ideas. Mathematical notations are used in mathematics and the physical sciences, engineering and economics....
 for describing a set by stating the properties that its members must satisfy. Forming sets in this manner is also known as set comprehension, set abstraction or as defining a set's intension.

Φ(x) be a schematic formula in which x appears free.






Discussion
Ask a question about 'Set-builder notation'
Start a new discussion about 'Set-builder notation'
Answer questions from other users
Full Discussion Forum



Encyclopedia


In set theory
Set theory

Set theory is the branch of mathematics that studies Set , which are collections of objects. Although any type of object can be collected into a set, set theory is applied most often to objects that are relevant to mathematics....
 and its applications to logic
Logic

Logic is the study of the principles of valid demonstration and inference. Logic is a branch of philosophy, a part of the classical Trivium . The word derives from Greek language ?????? , fem....
, mathematics
Mathematics

Mathematics is the study of quantity, structure, space, change, and related topics of pattern and form. Mathematicians seek out patterns whether found in numbers, space, natural science, computers, imaginary abstractions, or elsewhere....
, and computer science
Computer science

Computer science is the study of the theoretical foundations of information and computation, and of practical techniques for their implementation and application in computer systems....
, set-builder notation (sometimes simply set notation
Set notation

Set are fundamental objects in mathematics. Intuitively, a set is merely a collection of element or members. There are various conventions for textually denoting sets....
) is a mathematical notation
Mathematical notation

A mathematical notation is a system of symbolic representations of mathematical objects and ideas. Mathematical notations are used in mathematics and the physical sciences, engineering and economics....
 for describing a set by stating the properties that its members must satisfy. Forming sets in this manner is also known as set comprehension, set abstraction or as defining a set's intension.

Building sets

Let Φ(x) be a schematic formula in which x appears free. Set builder notation has the form (some write , using the vertical bar
Vertical bar

The vertical bar has various names including the pipe , verti-bar, vbar, stick, vertical line, vertical slash, think colon, or divider line by others....
 instead of the colon), denoting the set of all individuals in the universe of discourse satisfying the formula
Predicate (logic)

Sometimes it is inconvenient or impossible to describe a set by listing all of its elements. Another useful way to define a set is by specifying a property that the elements of the set have in common....
 Φ(x), that is, the set whose members are every individual x such that Φ(x) is true: formally, the extension
Extension (predicate logic)

The extension of a predicate a truth-valued function is the Set of tuples of values that, used as arguments, satisfy the predicate. Such a set of tuples is a relation ....
 of the predicate. Set builder notation binds the variable x and must be used with the same care applied to variables bound by quantifiers.

Examples (the universe of discourse can be taken to be, for example, all complex number
Complex number

In mathematics, the complex numbers are an extension of the real numbers obtained by adjoining an imaginary unit, denoted i, which satisfies:...
s):
  • is the set ,
  • is the set of all positive real numbers. This, like all infinite sets involving real numbers, is an example of a set that cannot be given by enumeration
    Enumeration

    In mathematics and theoretical computer science, the broadest and most abstract definition of an enumeration of a Set is an exact listing of all of its element s ....
    .
  • is the set of all even natural numbers,
  • is the set of rational number
    Rational number

    In mathematics, a rational number is a number which can be expressed as a quotient of two integers. Non-integer rational numbers are usually written as the vulgar fraction , where b is not 0 ....
    s, or numbers that can be written as the ratio of two integers.
  • Thus, e.g., , etc. (n.b.: in the case of sets, the order is not important, so that one could call and so forth). As an example, This shows how convenient set-builder notation is.


The sign stands for and, requiring both conditions be fulfilled simultaneously. It is often replaced by a comma () semicolon (;) or written out as and. Alternatively, sets of the form can be written as . The set of positive real numbers would then be notated .

Logical equivalence

An important fact is the logical equivalence:

.

This means that sets two sets are equal if and only if
If and only if

If and only if, in logic and fields that rely on it such as mathematics and philosophy, is a biconditional logical connective between statements....
 their "membership requirements" are logically equivalent.

For example, because, for any real number x, x2 = 1 if and only if |x| = 1.

Russell's paradox

Let denote the set of all sets that do not belong to themselves. This set cannot exist; Russell's paradox
Russell's paradox

Part of fundamental mathematics, Russell's paradox , discovered by Bertrand Russell in 1901, showed that the naive set theory of Gottlob Frege leads to a contradiction....
 explains why.

Solutions to the paradox restrict set-builder notation in certain ways. Let X = denote the set of every element of A satisfying the predicate P(x). The canonical restriction on set builder notation asserts that X is a set only if A is already known to be a set. This restriction is codified in the axiom schema of separation present in standard axiomatic set theory. Note that this axiom schema
Axiom schema

In mathematical logic, an axiom schema generalizes the notion of axiom.An axiom schema is a well-formed formula in the language of an axiomatic system, in which one or more schematic variables appear....
 excludes from sethood.

Other problems

The notation can be complicated, especially as in the previous example, and abbreviations are often employed when context indicates the nature of a variable. For example:
  • , in a context where the variable x is used only for real numbers, indicates the set of all positive real numbers;
  • , in a context where the variables p and q are used only for integers, indicates the set of all rational numbers; and
  • , in a context where the variable S is used only for sets, indicates the set of all sets that don't belong to themselves.
As the last example shows, such an abbreviated notation again might not denote an actual nonparadoxical set, unless there is in fact a set of all objects that might be described by the variable in question.

Variations


Defining sets in terms of other sets

Another variation on set-builder notation describes the members of the set in terms of members of some other set. Specifically, , where F is a function symbol and A is a previously defined set, indicates the set of all values of members of A under F. For example:
  • , where N is the set of all natural numbers, is the set of all even natural numbers.
In axiomatic set theory, this set is guaranteed to exist by the axiom schema of replacement
Axiom schema of replacement

In set theory, the axiom schema of replacement is a schema of axioms in Zermelo-Fraenkel set theory that asserts that the of any Set under any definable functional predicate is also a set....
.

These notations can be combined in the form , which indicates the set of all values under F of those members of A that satisfy P. For example:
  • , where Z is the set of all integers, is the set of all rational numbers (Q).
This example also shows how multiple variables can be used (both p and q in this case). This notation is acceptable even though e.g. 2/3 and 4/6 are both included in this definition, and a set can not contain multiple copies of an element; the case p=4, q=6 says with harmless redundancy that 2/3 is in the set.

Parallels in programming languages

Set-builder notation is closely related to a construct in some programming languages, most notably Python and Haskell
Haskell (programming language)

Haskell is a standardized, purely functional programming language with non-strict programming language, named after logician Haskell Curry. The goals of the language are described as:...
, called list comprehension
List comprehension

A list comprehension is a Syntax of programming languages construct available in some programming languages for creating a list based on existing lists....
.

In Python, list comprehensions are denoted by square brackets, and have a different syntax to set-builder, but are fundamentally the same. Consider these examples, given in both set-builder notation and Python list comprehension.
  • Set-builder:
    • List comprehension:
    • Python:
      • [l for l in L]
      • [(k, x) for k in K for x in X if P(x)]
    • Haskell
      • (Haskell does not allow uppercase names so ks = K, xs = X and p = P)
      • [l | l <- L]
      • [(k,x) | k <- ks, x <- xs, p(x)]


Note that in Python [l for l in L] equals to just list(L).

While Python's list comprehension works similarly to set-builder notation, it does not denote a set but rather creates a mathematical tuple
Tuple

In mathematics, a tuple is a sequence of a specific number of values, called the components of the tuple. These components can be any kind of mathematical objects, where each component of a tuple is a value of a specified type....
 (as opposed to Python's native tuple datatype; the actual returned value's type is list) based on existing tuples. It is possible to use true sets in Python with the set keyword and set class, but this causes additional deviations from set-builder notation:
  • set(l for l in L)
  • set((k, x) for k in K for x in X if P(x))
The first can be written just as:
  • set(L).


Note that Python 3.0 supports proper set comprehensions using a hybrid of mathematical set-builder and Python list comprehension notation:


See also

  • Set notation
    Set notation

    Set are fundamental objects in mathematics. Intuitively, a set is merely a collection of element or members. There are various conventions for textually denoting sets....
  • SQL
    SQL

    SQL is a database computer language designed for the retrieval and management of data in relational database management systems , database schema creation and modification, and database object access control management....
     - Structured Query Language, used to implement set operations upon a relational database
    Relational database

    A relational database is a database that groups data using common attributes found in the data set. The resulting "clumps" of organized data are much easier for people to understand....