↑ arvau

Wikipedia / Set-builder notation

In mathematics and more specifically in set theory, set-builder notation is a notation for specifying a set by a property that characterizes its members. Roster notation is a similar notation used for specifying a set by enumerating its elements.

Specifying sets by member properties is allowed by the axiom schema of specification. This is also known as set comprehension and set abstraction.

Sets defined by a predicate

Set-builder notation can be used to describe a set that is defined by a predicate, 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 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 that is a set to which the notation defines a subsetcan appear on the left of the vertical bar:

or by adjoining it to the predicate:

(The symbol denotes set membership denotes the logical and operator). This notation represents the set of all values of that belong to the set and for which the predicate is true. The subset axiom insures that if is a set and is a predicate, the notation defines always a set, which is a subset of .

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.

In the cases where the domain is not defined (implicitly or explicitly), it may occur that the notation does not define a set, but a proper class. For example, Russell's paradox although seemingly well formed as a set builder expression, cannot define a set without producing a contradiction.

In some cases, the notation may define a set that is not a subset of a previously defined set. This is the case of the power set of a set The fact that this defines a set is an axiom of set theory, called the axiom of power set.

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.

More complex expressions on the left side of the notation

An extension of set-builder notation replaces the single variable with an expression which should be read

  1. .

For example:

  • is the set of all natural numbers, is the set of all even natural numbers.

  • 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.

, 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

  1. .

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:

This equivalence holds because, for any real number x if and only if x.

Set existence axiom

In many formal set theories, such as Zermelo–Fraenkel set theory, 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 :

The set .

In programming languages

A similar notation available in a number of programming languages (notably Python and Haskell) is the list comprehension, which combines map and filter 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 with a zero element.

See also

Notes

is:Mengjaskilgreiningarritháttur