Tuple
Inmathematics,atupleis a finitesequenceorordered listofnumbersor, more generally,mathematical objects,which are called theelementsof the tuple. Ann-tupleis a tuple ofnelements, wherenis a non-negativeinteger.There is only one 0-tuple, called theempty tuple.A 1-tuple and a 2-tuple are commonly called asingletonand anordered pair,respectively.
Tuples may be formally defined from ordered pairs byrecurrenceby starting fromordered pairs;indeed, ann-tuple can be identified with the ordered pair of its(n− 1)first elements and itsnth element.
Tuples are usually written by listing the elements within parentheses "( )",separated by a comma and a space; for example,(2, 7, 4, 1, 7)denotes a 5-tuple. Sometimes other symbols are used to surround the elements, such as square brackets "[ ]" or angle brackets "⟨ ⟩". Braces "{ }" are used to specifyarraysin some programming languages but not in mathematical expressions, as they are the standard notation forsets.The termtuplecan often occur when discussing other mathematical objects, such asvectors.
Incomputer science,tuples come in many forms. Most typedfunctional programminglanguages 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 structsand Haskell records.Relational databasesmay formally identify theirrows(records) astuples.
Tuples also occur inrelational algebra;when programming thesemantic webwith 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 theLatinnames of the numerals. The unique 0-tuple is called thenull tupleorempty tuple.A 1‑tuple is called asingle(orsingleton), a 2‑tuple is called anordered pairorcouple,and a 3‑tuple is called atriple(ortriplet). The numberncan be any nonnegativeinteger.For example, acomplex numbercan be represented as a 2‑tuple of reals, aquaternioncan be represented as a 4‑tuple, anoctonioncan be represented as an 8‑tuple, and asedenioncan be represented as a 16‑tuple.
Although these uses treat‑upleas the suffix, the original suffix was‑pleas 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][a]
Properties
[edit]The general rule for the identity of twon-tuples is
Thus a tuple has properties that distinguish it from aset:
- A tuple may contain multiple instances of the same element, so
tuple;but set. - Tuple elements are ordered: tuple,but set.
- A tuple has a finite number of elements, while a set or amultisetmay 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]The-tuple may be identified as theempty function.Forthe-tuplemay be identified with the (surjective)function
withdomain
and withcodomain
that is defined atby
That is,is the function defined by
in which case the equality
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 functioncan be defined as:
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.
- The 0-tuple (i.e. the empty tuple) is represented by the empty set.
- 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):
This definition can be applied recursively to the(n− 1)-tuple:
Thus, for example:
A variant of this definition starts "peeling off" elements from the other end:
- The 0-tuple is the empty set.
- Forn> 0:
This definition can be applied recursively:
Thus, for example:
Tuples as nested sets
[edit]UsingKuratowski's representation for an ordered pair,the second definition above can be reformulated in terms of pureset theory:
- The 0-tuple (i.e. the empty tuple) is represented by the empty set;
- Letbe ann-tuple,and let.Then,.(The right arrow,,could be read as "adjoined with".)
In this formulation:
n-tuples ofm-sets
[edit]Indiscrete mathematics,especiallycombinatoricsand 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 ofmelements are also calledarrangements with repetition,permutations of a multisetand, in some non-English literature,variations with repetition.The number ofn-tuples of anm-set ismn.This follows from the combinatorialrule of product.[8]IfSis 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]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:
and theprojectionsare term constructors:
The tuple with labeled elements used in therelational modelhas 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 naturalmodelof a type theory, and use the Scott brackets to indicate the semantic interpretation, then the model consists of some sets(note: the use of italics here that distinguishes sets from types) such that:
and the interpretation of the basic terms is:
- .
Then-tuple of type theory has the natural interpretation as ann-tuple of set theory:[10]
Theunit typehas as semantic interpretation the 0-tuple.
See also
[edit]- Arity
- Coordinate vector
- Exponential object
- Formal language
- Multidimensional Expressions(OLAP)
- Primek-tuple
- Relation (mathematics)
- Sequence
- Tuplespace
- Tuple Names
Notes
[edit]References
[edit]- ^"Algebraic data type - HaskellWiki".wiki.haskell.org.
- ^"Destructuring assignment".MDN Web Docs.18 April 2023.
- ^"Does JavaScript Guarantee Object Property Order?".Stack Overflow.
- ^Matthews, P. H., ed. (January 2007)."N‐tuple".The Concise Oxford Dictionary of Linguistics.Oxford University Press.ISBN9780199202720.Retrieved1 May2015.
- ^
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.ISBN9780198735304.Retrieved2017-06-30.
ordered n-tuple[:] A generalization of the notion of an [...] ordered pair to sequences of n objects.
- ^OED,s.v."triple", "quadruple", "quintuple", "decuple"
- ^D'Angelo & West 2000,p. 9
- ^D'Angelo & West 2000,p. 101
- ^Pierce, Benjamin (2002).Types and Programming Languages.MIT Press. pp.126–132.ISBN0-262-16209-1.
- ^Steve Awodey,From sets, to types, to categories, to sets,2009,preprint
Sources
[edit]- D'Angelo, John P.; West, Douglas B. (2000),Mathematical Thinking/Problem-Solving and Proofs(2nd ed.), Prentice-Hall,ISBN978-0-13-014412-6
- Keith Devlin,The Joy of Sets.Springer Verlag, 2nd ed., 1993,ISBN0-387-94094-4,pp. 7–8
- Abraham Adolf Fraenkel,Yehoshua Bar-Hillel,Azriel Lévy,Foundations of school Set Theory,Elsevier Studies in Logic Vol. 67, 2nd Edition, revised, 1973,ISBN0-7204-2270-1,p. 33
- Gaisi Takeuti,W. M. Zaring,Introduction to Axiomatic Set Theory,SpringerGTM1, 1971,ISBN978-0-387-90024-7,p. 14
- George J. Tourlakis,Lecture Notes in Logic and Set Theory. Volume 2: Set Theory,Cambridge University Press, 2003,ISBN978-0-521-75374-6,pp. 182–193
External links
[edit]The dictionary definition oftupleat Wiktionary