Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Set-builder notation

From Wikipedia, the free encyclopedia
Use of braces for specifying sets

{nkZ,n=2k}{\displaystyle \{n\mid \exists k\in \mathbb {Z} ,n=2k\}}

The set of alleven integers,
expressed in set-builder notation.

Inmathematics and more specifically inset theory,set-builder notation is anotation for specifying aset by a property that characterizes its members.[1]

Specifying sets by member properties is allowed by theaxiom schema of specification. This is also known asset comprehension andset abstraction.

Sets defined by a predicate

[edit]

Set-builder notation can be used to describe a set that is defined by apredicate, that is, a logical formula that evaluates totrue for an element of the set, andfalse otherwise.[2] In this form, set-builder notation has three parts: a variable, acolon orvertical 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:

{xΦ(x)}{\displaystyle \{x\mid \Phi (x)\}}

or

{x:Φ(x)}.{\displaystyle \{x\colon \Phi (x)\}.}

The vertical bar (or colon) is a separator that can be read as "such that", "for which", or "with the property that". The formulaΦ(x) is said to be therule or thepredicate. All values ofx for which the predicate holds (is true) belong to the set being defined. All values ofx for which the predicate does not hold do not belong to the set. Thus{xΦ(x)}{\displaystyle \{x\mid \Phi (x)\}} is the set of all values ofx that satisfy the formulaΦ.[3] It may be theempty set, if no value ofx satisfies the formula.

Specifying the domain

[edit]

A domainE can appear on the left of the vertical bar:[4]

{xEΦ(x)},{\displaystyle \{x\in E\mid \Phi (x)\},}

or by adjoining it to the predicate:

{xxE and Φ(x)}or{xxEΦ(x)}.{\displaystyle \{x\mid x\in E{\text{ and }}\Phi (x)\}\quad {\text{or}}\quad \{x\mid x\in E\land \Phi (x)\}.}

The ∈ symbol here denotesset membership, while the{\displaystyle \land } symbol denotes the logical "and" operator, known aslogical conjunction. This notation represents the set of all values ofx that belong to some given setE for which the predicate is true (see "Set existence axiom" below). IfΦ(x){\displaystyle \Phi (x)} is a conjunctionΦ1(x)Φ2(x){\displaystyle \Phi _{1}(x)\land \Phi _{2}(x)}, then{xEΦ(x)}{\displaystyle \{x\in E\mid \Phi (x)\}} is sometimes written{xEΦ1(x),Φ2(x)}{\displaystyle \{x\in E\mid \Phi _{1}(x),\Phi _{2}(x)\}}, using a comma instead of the symbol{\displaystyle \land }.

In general, it is not a good idea to consider sets without defining adomain of discourse, as this would represent thesubset ofall possible things that may exist for which the predicate is true. This can easily lead to contradictions and paradoxes. For example,Russell's paradox shows that the expression{x | xx},{\displaystyle \{x~|~x\not \in x\},} although seemingly well formed as a set builder expression, cannot define a set without producing a contradiction.[5]

In cases where the setE 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

[edit]

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

[edit]

An extension of set-builder notation replaces the single variablex with anexpression. So instead of{xΦ(x)}{\displaystyle \{x\mid \Phi (x)\}}, we may have{f(x)Φ(x)},{\displaystyle \{f(x)\mid \Phi (x)\},} which should be read

{f(x)Φ(x)}={yx(y=f(x)Φ(x))}{\displaystyle \{f(x)\mid \Phi (x)\}=\{y\mid \exists x(y=f(x)\wedge \Phi (x))\}}.

For example:

When inverse functions can be explicitly stated, the expression on the left can be eliminated through simple substitution. Consider the example set{2t+1tZ}{\displaystyle \{2t+1\mid t\in \mathbb {Z} \}}. Make the substitutionu=2t+1{\displaystyle u=2t+1}, which is to sayt=(u1)/2{\displaystyle t=(u-1)/2}, then replacet in the set builder notation to find

{2t+1tZ}={u(u1)/2Z}.{\displaystyle \{2t+1\mid t\in \mathbb {Z} \}=\{u\mid (u-1)/2\in \mathbb {Z} \}.}

Equivalent predicates yield equal sets

[edit]

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

{xAP(x)}={xBQ(x)}{\displaystyle \{x\in A\mid P(x)\}=\{x\in B\mid Q(x)\}}

if and only if

(t)[(tAP(t))(tBQ(t))]{\displaystyle (\forall t)[(t\in A\land P(t))\Leftrightarrow (t\in B\land Q(t))]}.

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,

{xRx2=1}={xQ|x|=1}{\displaystyle \{x\in \mathbb {R} \mid x^{2}=1\}=\{x\in \mathbb {Q} \mid |x|=1\}}

because the two rule predicates are logically equivalent:

(xRx2=1)(xQ|x|=1).{\displaystyle (x\in \mathbb {R} \land x^{2}=1)\Leftrightarrow (x\in \mathbb {Q} \land |x|=1).}

This equivalence holds because, for any real numberx, we havex2=1{\displaystyle x^{2}=1} if and only ifx is a rational number with|x|=1{\displaystyle |x|=1}. In particular, both sets are equal to the set{1,1}{\displaystyle \{-1,1\}}.

Set existence axiom

[edit]

In many formal set theories, such asZermelo–Fraenkel set theory, set builder notation is not part of the formal syntax of the theory. Instead, there is aset existence axiom scheme, which states that ifE is a set andΦ(x) is a formula in the language of set theory, then there is a setY whose members are exactly the elements ofE that satisfyΦ:

(E)(Y)(x)[xYxEΦ(x)].{\displaystyle (\forall E)(\exists Y)(\forall x)[x\in Y\Leftrightarrow x\in E\land \Phi (x)].}

The setY obtained from this axiom is exactly the set described in set builder notation as{xEΦ(x)}{\displaystyle \{x\in E\mid \Phi (x)\}}.

In programming languages

[edit]
Main article:List comprehension

A similar notation available in a number ofprogramming languages (notablyPython andHaskell) is thelist comprehension, which combinesmap andfilter operations over one or morelists.

It has been suggested that parts of this page bemoved intoList comprehension. (Discuss)(December 2023)

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 inScala using Sequence Comprehensions, where the "for" keyword returns a list of the yielded variables using the "yield" keyword.[6]

Consider these set-builder notation examples in some programming languages:

Example 1Example 2
Set-builder{l | lL}{\displaystyle \{l\ |\ l\in L\}}{(k,x) | kKxXP(x)}{\displaystyle \{(k,x)\ |\ k\in K\wedge x\in X\wedge P(x)\}}
Python
{lforlinL}
{(k,x)forkinKforxinXifP(x)}
Haskell
[l|l<-ls]
[(k,x)|k<-ks,x<-xs,px]
Scala
for(l<-L)yieldl
for(k<-K;x<-XifP(x))yield(k,x)
C#
fromlinLselectl
fromkinKfromxinXwhereP(x)select(k,x)
SQL
SELECTlFROML_set
SELECTk,xFROMK_set,X_setWHEREP(x)
Prolog
setof(L,member(L,Ls),Result)
setof((K,X),(member(K,Ks),member(X,Xs),call(P,X)),Result)
Erlang
[L||L<-Ls]
[{K,X}||K<-Ks,X<-Xs,p(X)]
Julia
[lforlL]
[(k,x)forkKforxXifP(x)]
Mathematica
(l|->l)/@L
Cases[Tuples[{K,X}],{k_,x_}/;P[x]]

The set builder notation and list comprehension notation are both instances of a more general notation known asmonad comprehensions, which permits map/filter-like operations over anymonad with azero element.

See also

[edit]

Notes

[edit]
  1. ^Rosen, Kenneth (2007).Discrete Mathematics and its Applications (6th ed.). New York, NY: McGraw-Hill. pp. 111–112.ISBN 978-0-07-288008-3.
  2. ^Michael J Cullinan, 2012,A Transition to Mathematics with Proofs, Jones & Bartlett, pp. 44ff.
  3. ^Weisstein, Eric W."Set".mathworld.wolfram.com. Retrieved20 August 2020.
  4. ^"Set-Builder Notation".mathsisfun.com. Retrieved20 August 2020.
  5. ^Irvine, Andrew David; Deutsch, Harry (9 October 2016) [1995]."Russell's Paradox".Stanford Encyclopedia of Philosophy. Retrieved6 August 2017.
  6. ^"Sequence Comprehensions". Scala. Retrieved6 August 2017.
Overview
Venn diagram of set intersection
Axioms
Operations
  • Concepts
  • Methods
Set types
Theories
Set theorists
Retrieved from "https://en.wikipedia.org/w/index.php?title=Set-builder_notation&oldid=1312232894"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp