Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Tuple

From Wikipedia, the free encyclopedia
Finite ordered list of elements
For the musical term, seeTuplet."Octuple" redirects here. For the boat, seeOctuple scull."Duodecuple" redirects here. For the musical technique, seeTwelve-tone technique."Sextuple" redirects here. For the sporting achievement of association football, seeSextuple (association football).

Inmathematics, atuple is a finitesequence orordered list ofnumbers or, more generally,mathematical objects, which are called theelements of the tuple. Ann-tuple is a tuple ofn elements, wheren is a non-negativeinteger. There is only one 0-tuple, called theempty tuple. A 1-tuple and a 2-tuple are commonly called asingleton and anordered pair, respectively. The term"infinite tuple" is occasionally used for"infinite sequences".

Tuples are usually written by listing the elements within parentheses "( )" and separated by commas; for example,(2, 7, 4, 1, 7) denotes a 5-tuple. Other types of brackets are sometimes used, although they may have a different meaning.[a]

Ann-tuple can be formally defined as theimage of afunction that has the set of then firstnatural numbers as itsdomain.Tuples may be also defined from ordered pairs by arecurrence starting fromordered pairs; indeed, ann-tuple can be identified with the ordered pair of its(n − 1) first elements and itsnth element.

Incomputer science, tuples come in many forms. Most typedfunctional programming languages implement tuples directly asproduct types,[1] tightly associated withalgebraic data types,pattern matching, anddestructuring assignment.[2] Many programming languages offer an alternative to tuples, known asrecord types, featuring unordered elements accessed by label.[3] A few programming languages combine ordered tuple product types and unordered record types into a single construct, as inC structs and Haskell records.Relational databases may formally identify theirrows (records) astuples.

Tuples also occur inrelational algebra; when programming thesemantic web with theResource Description Framework (RDF); inlinguistics;[4] and inphilosophy.[5]

Etymology

[edit]

The term originated as an abstraction of the sequence: single, couple/double, triple, quadruple, quintuple, sextuple, septuple, octuple, ...,n‑tuple, ..., where the prefixes are taken from theLatin names of the numerals. The unique 0-tuple is called thenull tuple orempty tuple. A 1‑tuple is called asingle (orsingleton), a 2‑tuple is called anordered pair orcouple, and a 3‑tuple is called atriple (ortriplet). The numbern can be any nonnegativeinteger. For example, acomplex number can be represented as a 2‑tuple of reals, aquaternion can be represented as a 4‑tuple, anoctonion can be represented as an 8‑tuple, and asedenion can be represented as a 16‑tuple.

Although these uses treat‑tuple as the suffix, the original suffix was‑ple as in "triple" (three-fold) or "decuple" (ten‑fold). This originates frommedieval Latinplus (meaning "more") related toGreek ‑πλοῦς, which replaced the classical and late antique‑plex (meaning "folded"), as in "duplex".[6][b]

Properties

[edit]

The general rule for the identity of twon-tuples is

(a1,a2,,an)=(b1,b2,,bn){\displaystyle (a_{1},a_{2},\ldots ,a_{n})=(b_{1},b_{2},\ldots ,b_{n})}if and only ifa1=b1, a2=b2, , an=bn{\displaystyle a_{1}=b_{1},{\text{ }}a_{2}=b_{2},{\text{ }}\ldots ,{\text{ }}a_{n}=b_{n}}.

Thus a tuple has properties that distinguish it from aset:

  1. A tuple may contain multiple instances of the same element, so
    tuple(1,2,2,3)(1,2,3){\displaystyle (1,2,2,3)\neq (1,2,3)}; but set{1,2,2,3}={1,2,3}{\displaystyle \{1,2,2,3\}=\{1,2,3\}}.
  2. Tuple elements are ordered: tuple(1,2,3)(3,2,1){\displaystyle (1,2,3)\neq (3,2,1)}, but set{1,2,3}={3,2,1}{\displaystyle \{1,2,3\}=\{3,2,1\}}.
  3. A tuple has a finite number of elements, while a set or amultiset may have an infinite number of elements.

Definitions

[edit]

There are several definitions of tuples that give them the properties described in the previous section.

Tuples as functions

[edit]

The0{\displaystyle 0}-tuple may be identified as theempty function. Forn1,{\displaystyle n\geq 1,} then{\displaystyle n}-tuple(a1,,an){\displaystyle \left(a_{1},\ldots ,a_{n}\right)} may be identified with the (surjective)function

F : {1,,n}  {a1,,an}{\displaystyle F~:~\left\{1,\ldots ,n\right\}~\to ~\left\{a_{1},\ldots ,a_{n}\right\}}

withdomain

domainF={1,,n}={iN:1in}{\displaystyle \operatorname {domain} F=\left\{1,\ldots ,n\right\}=\left\{i\in \mathbb {N} :1\leq i\leq n\right\}}

and withcodomain

codomainF={a1,,an},{\displaystyle \operatorname {codomain} F=\left\{a_{1},\ldots ,a_{n}\right\},}

that is defined atidomainF={1,,n}{\displaystyle i\in \operatorname {domain} F=\left\{1,\ldots ,n\right\}} by

F(i):=ai.{\displaystyle F(i):=a_{i}.}

That is,F{\displaystyle F} is the function defined by

1a1nan{\displaystyle {\begin{alignedat}{3}1\;&\mapsto &&\;a_{1}\\\;&\;\;\vdots &&\;\\n\;&\mapsto &&\;a_{n}\\\end{alignedat}}}

in which case the equality

(a1,a2,,an)=(F(1),F(2),,F(n)){\displaystyle \left(a_{1},a_{2},\dots ,a_{n}\right)=\left(F(1),F(2),\dots ,F(n)\right)}

necessarily holds.

Tuples as sets of ordered pairs

Functions are commonly identified with theirgraphs, which is a certain set of ordered pairs. Indeed, many authors use graphs as the definition of a function. Using this definition of "function", the above functionF{\displaystyle F} can be defined as:

F := {(1,a1),,(n,an)}.{\displaystyle F~:=~\left\{\left(1,a_{1}\right),\ldots ,\left(n,a_{n}\right)\right\}.}

Tuples as nested ordered pairs

[edit]

Another way of modeling tuples in set theory is as nestedordered pairs. This approach assumes that the notion of ordered pair has already been defined.

  1. The 0-tuple (i.e. the empty tuple) is represented by the empty set{\displaystyle \emptyset }.
  2. Ann-tuple, withn > 0, can be defined as an ordered pair of its first entry and an(n − 1)-tuple (which contains the remaining entries whenn > 1):
    (a1,a2,a3,,an)=(a1,(a2,a3,,an)){\displaystyle (a_{1},a_{2},a_{3},\ldots ,a_{n})=(a_{1},(a_{2},a_{3},\ldots ,a_{n}))}

This definition can be applied recursively to the(n − 1)-tuple:

(a1,a2,a3,,an)=(a1,(a2,(a3,(,(an,))))){\displaystyle (a_{1},a_{2},a_{3},\ldots ,a_{n})=(a_{1},(a_{2},(a_{3},(\ldots ,(a_{n},\emptyset )\ldots ))))}

Thus, for example:

(1,2,3)=(1,(2,(3,)))(1,2,3,4)=(1,(2,(3,(4,)))){\displaystyle {\begin{aligned}(1,2,3)&=(1,(2,(3,\emptyset )))\\(1,2,3,4)&=(1,(2,(3,(4,\emptyset ))))\\\end{aligned}}}

A variant of this definition starts "peeling off" elements from the other end:

  1. The 0-tuple is the empty set{\displaystyle \emptyset }.
  2. Forn > 0:
    (a1,a2,a3,,an)=((a1,a2,a3,,an1),an){\displaystyle (a_{1},a_{2},a_{3},\ldots ,a_{n})=((a_{1},a_{2},a_{3},\ldots ,a_{n-1}),a_{n})}

This definition can be applied recursively:

(a1,a2,a3,,an)=(((((,a1),a2),a3),),an){\displaystyle (a_{1},a_{2},a_{3},\ldots ,a_{n})=((\ldots (((\emptyset ,a_{1}),a_{2}),a_{3}),\ldots ),a_{n})}

Thus, for example:

(1,2,3)=(((,1),2),3)(1,2,3,4)=((((,1),2),3),4){\displaystyle {\begin{aligned}(1,2,3)&=(((\emptyset ,1),2),3)\\(1,2,3,4)&=((((\emptyset ,1),2),3),4)\\\end{aligned}}}

Tuples as nested sets

[edit]

UsingKuratowski's representation for an ordered pair, the second definition above can be reformulated in terms of pureset theory:

  1. The 0-tuple (i.e. the empty tuple) is represented by the empty set{\displaystyle \emptyset };
  2. Letx{\displaystyle x} be ann-tuple(a1,a2,,an){\displaystyle (a_{1},a_{2},\ldots ,a_{n})}, and letxb(a1,a2,,an,b){\displaystyle x\rightarrow b\equiv (a_{1},a_{2},\ldots ,a_{n},b)}. Then,xb{{x},{x,b}}{\displaystyle x\rightarrow b\equiv \{\{x\},\{x,b\}\}}. (The right arrow,{\displaystyle \rightarrow }, could be read as "adjoined with".)

In this formulation:

()=(1)=()1={{()},{(),1}}={{},{,1}}(1,2)=(1)2={{(1)},{(1),2}}={{{{},{,1}}},{{{},{,1}},2}}(1,2,3)=(1,2)3={{(1,2)},{(1,2),3}}={{{{{{},{,1}}},{{{},{,1}},2}}},{{{{{},{,1}}},{{{},{,1}},2}},3}}{\displaystyle {\begin{array}{lclcl}()&&&=&\emptyset \\&&&&\\(1)&=&()\rightarrow 1&=&\{\{()\},\{(),1\}\}\\&&&=&\{\{\emptyset \},\{\emptyset ,1\}\}\\&&&&\\(1,2)&=&(1)\rightarrow 2&=&\{\{(1)\},\{(1),2\}\}\\&&&=&\{\{\{\{\emptyset \},\{\emptyset ,1\}\}\},\\&&&&\{\{\{\emptyset \},\{\emptyset ,1\}\},2\}\}\\&&&&\\(1,2,3)&=&(1,2)\rightarrow 3&=&\{\{(1,2)\},\{(1,2),3\}\}\\&&&=&\{\{\{\{\{\{\emptyset \},\{\emptyset ,1\}\}\},\\&&&&\{\{\{\emptyset \},\{\emptyset ,1\}\},2\}\}\},\\&&&&\{\{\{\{\{\emptyset \},\{\emptyset ,1\}\}\},\\&&&&\{\{\{\emptyset \},\{\emptyset ,1\}\},2\}\},3\}\}\\\end{array}}}

n-tuples ofm-sets

[edit]

Indiscrete mathematics, especiallycombinatorics and finiteprobability theory,n-tuples arise in the context of various counting problems and are treated more informally as ordered lists of lengthn.[7]n-tuples whose entries come from a set ofm elements are also calledarrangements with repetition,permutations of a multiset and, in some non-English literature,variations with repetition. The number ofn-tuples of anm-set ismn. This follows from the combinatorialrule of product.[8] IfS is a finite set ofcardinalitym, this number is the cardinality of then-foldCartesian powerS ×S × ⋯ ×S. Tuples are elements of this product set.

Type theory

[edit]
Main article:Product type

Intype theory, commonly used inprogramming languages, a tuple has aproduct type; this fixes not only the length, but also the underlying types of each component. Formally:

(x1,x2,,xn):T1×T2××Tn{\displaystyle (x_{1},x_{2},\ldots ,x_{n}):{\mathsf {T}}_{1}\times {\mathsf {T}}_{2}\times \ldots \times {\mathsf {T}}_{n}}

and theprojections are term constructors:

π1(x):T1, π2(x):T2, , πn(x):Tn{\displaystyle \pi _{1}(x):{\mathsf {T}}_{1},~\pi _{2}(x):{\mathsf {T}}_{2},~\ldots ,~\pi _{n}(x):{\mathsf {T}}_{n}}

The tuple with labeled elements used in therelational model has arecord type. Both of these types can be defined as simple extensions of thesimply typed lambda calculus.[9]

The notion of a tuple in type theory and that in set theory are related in the following way: If we consider the naturalmodel of a type theory, and use the Scott brackets to indicate the semantic interpretation, then the model consists of some setsS1,S2,,Sn{\displaystyle S_{1},S_{2},\ldots ,S_{n}} (note: the use of italics here that distinguishes sets from types) such that:

[[T1]]=S1, [[T2]]=S2, , [[Tn]]=Sn{\displaystyle [\![{\mathsf {T}}_{1}]\!]=S_{1},~[\![{\mathsf {T}}_{2}]\!]=S_{2},~\ldots ,~[\![{\mathsf {T}}_{n}]\!]=S_{n}}

and the interpretation of the basic terms is:

[[x1]][[T1]], [[x2]][[T2]], , [[xn]][[Tn]]{\displaystyle [\![x_{1}]\!]\in [\![{\mathsf {T}}_{1}]\!],~[\![x_{2}]\!]\in [\![{\mathsf {T}}_{2}]\!],~\ldots ,~[\![x_{n}]\!]\in [\![{\mathsf {T}}_{n}]\!]}.

Then-tuple of type theory has the natural interpretation as ann-tuple of set theory:[10]

[[(x1,x2,,xn)]]=([[x1]],[[x2]],,[[xn]]){\displaystyle [\![(x_{1},x_{2},\ldots ,x_{n})]\!]=(\,[\![x_{1}]\!],[\![x_{2}]\!],\ldots ,[\![x_{n}]\!]\,)}

Theunit type has as semantic interpretation the 0-tuple.

See also

[edit]

Notes

[edit]
  1. ^Square brackets are used formatrices, includingrow vectors.Braces are used forsets. Eachprogramming language has its own convention for the different brackets.
  2. ^Compare the etymology ofploidy, from the Greek for -fold.

References

[edit]
  1. ^"Algebraic data type - HaskellWiki".wiki.haskell.org.
  2. ^"Destructuring assignment".MDN Web Docs. 18 April 2023.
  3. ^"Does JavaScript Guarantee Object Property Order?".Stack Overflow.
  4. ^Matthews, P. H., ed. (January 2007)."N-tuple".The Concise Oxford Dictionary of Linguistics. Oxford University Press.ISBN 9780199202720. Retrieved1 May 2015.
  5. ^Blackburn, Simon (1994). "ordered n-tuple".The Oxford Dictionary of Philosophy. Oxford guidelines quick reference (3 ed.). Oxford: Oxford University Press (published 2016). p. 342.ISBN 9780198735304. Retrieved2017-06-30.ordered n-tuple[:] A generalization of the notion of an [...] ordered pair to sequences of n objects.
  6. ^OED,s.v. "triple", "quadruple", "quintuple", "decuple"
  7. ^D'Angelo & West 2000, p. 9
  8. ^D'Angelo & West 2000, p. 101
  9. ^Pierce, Benjamin (2002).Types and Programming Languages. MIT Press. pp. 126–132.ISBN 0-262-16209-1.
  10. ^Steve Awodey,From sets, to types, to categories, to sets, 2009,preprint

Sources

[edit]

External links

[edit]
  • The dictionary definition oftuple at Wiktionary
Overview
Venn diagram of set intersection
Axioms
Operations
  • Concepts
  • Methods
Set types
Theories
Set theorists
Authority control databases: NationalEdit this at Wikidata
Retrieved from "https://en.wikipedia.org/w/index.php?title=Tuple&oldid=1281619645"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp