Recent from talks
Contribute something
Nothing was collected or created yet.
Tuple
View on WikipediaIn mathematics, a tuple is a finite sequence or ordered list of numbers or, more generally, mathematical objects, which are called the elements of the tuple. An n-tuple is a tuple of n elements, where n is a non-negative integer. There is only one 0-tuple, called the empty tuple. A 1-tuple and a 2-tuple are commonly called a singleton and an ordered 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]
An n-tuple can be formally defined as the image of a function that has the set of the n first natural numbers as its domain. Tuples may be also defined from ordered pairs by a recurrence starting from an ordered pair; indeed, an n-tuple can be identified with the ordered pair of its (n − 1) first elements and its nth element, for example, .
In computer science, tuples come in many forms. Most typed functional programming languages implement tuples directly as product types,[1] tightly associated with algebraic data types, pattern matching, and destructuring assignment.[2] Many programming languages offer an alternative to tuples, known as record 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 in C structs and Haskell records. Relational databases may formally identify their rows (records) as tuples.
Tuples also occur in relational algebra; when programming the semantic web with the Resource Description Framework (RDF); in linguistics;[4] and in philosophy.[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 the Latin names of the numerals. The unique 0-tuple is called the null tuple or empty tuple. A 1‑tuple is called a single (or singleton), a 2‑tuple is called an ordered pair or couple, and a 3‑tuple is called a triple (or triplet). The number n can be any nonnegative integer. For example, a complex number can be represented as a 2‑tuple of reals, a quaternion can be represented as a 4‑tuple, an octonion can be represented as an 8‑tuple, and a sedenion 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 from medieval Latin plus (meaning "more") related to Greek ‑πλοῦς, which replaced the classical and late antique ‑plex (meaning "folded"), as in "duplex".[6][b]
Properties
[edit]The general rule for the identity of two n-tuples is
Thus a tuple has properties that distinguish it from a set:
- 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 a multiset 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]The -tuple may be identified as the empty function. For the -tuple may be identified with the (surjective) function
with domain
and with codomain
that is defined at by
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 their graphs, 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 function can be defined as:
Tuples as nested ordered pairs
[edit]Another way of modeling tuples in set theory is as nested ordered 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 .
- An n-tuple, with n > 0, can be defined as an ordered pair of its first entry and an (n − 1)-tuple (which contains the remaining entries when n > 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 .
- For n > 0:
This definition can be applied recursively:
Thus, for example:
Tuples as nested sets
[edit]Using Kuratowski's representation for an ordered pair, the second definition above can be reformulated in terms of pure set theory:
- The 0-tuple (i.e. the empty tuple) is represented by the empty set ;
- Let be an n-tuple , and let . Then, . (The right arrow, , could be read as "adjoined with".)
In this formulation:
n-tuples of m-sets
[edit]In discrete mathematics, especially combinatorics and finite probability theory, n-tuples arise in the context of various counting problems and are treated more informally as ordered lists of length n.[7] n-tuples whose entries come from a set of m elements are also called arrangements with repetition, permutations of a multiset and, in some non-English literature, variations with repetition. The number of n-tuples of an m-set is mn. This follows from the combinatorial rule of product.[8] If S is a finite set of cardinality m, this number is the cardinality of the n-fold Cartesian power S × S × ⋯ × S. Tuples are elements of this product set.
Type theory
[edit]In type theory, commonly used in programming languages, a tuple has a product type; this fixes not only the length, but also the underlying types of each component. Formally:
and the projections are term constructors:
The tuple with labeled elements used in the relational model has a record type. Both of these types can be defined as simple extensions of the simply 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 natural model of 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:
- .
The n-tuple of type theory has the natural interpretation as an n-tuple of set theory:[10]
The unit type has as semantic interpretation the 0-tuple.
For a list of tuple types in programming languages, see Product type#Product types in programming languages.
See also
[edit]Notes
[edit]- ^ Square brackets are used for matrices, including row vectors. Braces are used for sets. Each programming language has its own convention for the different brackets.
- ^ Compare the etymology of ploidy, from the Greek for -fold.
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. ISBN 9780199202720. Retrieved 1 May 2015.
- ^
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. Retrieved 2017-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. ISBN 0-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, ISBN 978-0-13-014412-6
- Keith Devlin, The Joy of Sets. Springer Verlag, 2nd ed., 1993, ISBN 0-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, ISBN 0-7204-2270-1, p. 33
- Gaisi Takeuti, W. M. Zaring, Introduction to Axiomatic Set Theory, Springer GTM 1, 1971, ISBN 978-0-387-90024-7, p. 14
- George J. Tourlakis, Lecture Notes in Logic and Set Theory. Volume 2: Set Theory, Cambridge University Press, 2003, ISBN 978-0-521-75374-6, pp. 182–193
External links
[edit]
The dictionary definition of tuple at Wiktionary
Tuple
View on GrokipediaFundamentals
Basic Concept
A tuple is defined as a finite ordered sequence of elements drawn from a specified domain or set. It consists of a fixed number of components, denoted in parentheses with elements separated by commas, such as the 2-tuple or more generally the -tuple .[1] The order of the elements is essential, meaning that is distinct from unless , and repetitions of elements are permitted.[14] This contrasts sharply with unordered collections like sets, where and duplicates are ignored; for instance, the tuple differs from , while the corresponding sets are identical.[1] This intuitive concept positions tuples as basic sequences that underpin many mathematical structures, providing a prerequisite for understanding more advanced formalizations without requiring proofs or constructions at this stage.[14] In practice, tuples appear in everyday mathematical reasoning, such as representing points or data points where sequence matters. The notion of tuples draws historical intuition from geometry, where ordered coordinates specify locations in space—pioneered by René Descartes in his 1637 La Géométrie, which used ordered pairs of real numbers to map geometric figures algebraically.[15] Similarly, in logic, tuples capture ordered arguments supplied to functions or relations, ensuring the sequence aligns with the intended mapping or interpretation.Etymology
The term "tuple" derives from the suffix "-uple" found in words denoting ordered collections of a specific cardinality, such as "double" (2-tuple), "triple" (3-tuple), "quadruple" (4-tuple), "quintuple" (5-tuple), and higher analogs like "sextuple" or "septuple," generalizing the pattern to arbitrary n without specifying the number explicitly.[16] In mathematical literature, the term "n-tuple" first appeared in the 1940s to describe ordered structures in algebra and related fields. By the 1950s, it had become more common in abstract algebra and geometry texts for denoting ordered n-ary relations or sequences, as seen in John L. Kelley's "General Topology" (1955), a seminal work that employs the term for ordered collections in topological contexts, such as defining functions via tuples of points and neighborhoods.[17] The adoption of "tuple" in computing emerged in the 1960s alongside the development of structured programming languages, where it standardized the representation of fixed-size ordered data aggregates. This shift is evident in the design of ALGOL 68 (finalized in 1968), which explicitly defined modes (data types) using n-tuples, such as trims as ordered sequences of integers for array bounds, influencing subsequent languages in handling composite data.[18] Similarly, early Lisp implementations and documentation from the late 1950s and 1960s referenced tuples for argument sequences and list-like structures, bridging mathematical notation to computational practice.[19]Formal Definitions
As Nested Ordered Pairs
Early set-theoretic definitions of ordered pairs include those proposed by Norbert Wiener in 1914 and Felix Hausdorff shortly thereafter. Wiener defined the ordered pair as . This construction encodes order by using nested sets: the first component is distinguished through the set containing the singleton and the empty set , while the second is in a singleton . Equality holds if and only if and , as the structures ensure unique identification of each position.[20] Hausdorff defined the ordered pair as . Here, order is preserved by pairing the first element with the empty set in one doubleton, and the second element with the singleton in another, creating distinct structures that differentiate the components. Similarly, if and only if and .[20] These definitions, like the later Kuratowski definition, can be extended recursively to finite -tuples for by right-nesting, where an -tuple is constructed as . The 1-tuple is simply the element itself, . This nesting preserves the sequential order through successive applications of the ordered pair construction.[20] For example, using the Wiener definition, the 3-tuple is . Using the Hausdorff definition, the 3-tuple is .[20] In set theory, the ordered pair is defined as the set , known as the Kuratowski definition.[21] This construction encodes order within the unordered nature of sets by distinguishing the first component through a singleton set , which is the unique singleton in the pair, while the second component is incorporated into the doubleton alongside .[22] This definition extends recursively to finite -tuples for , where an -tuple is constructed as the right-nested ordered pair . For example, the 3-tuple is .[22] The 1-tuple is simply the element itself, . This nesting preserves the sequential order of components through successive applications of the ordered pair construction.[22] The order preservation follows from the structural distinction in the Kuratowski encoding: assuming , the pair differs from under set equality, as the singleton belongs to the first but not the second (since and , the latter having two elements by the axiom of pairing). For -tuples, the recursive nesting ensures that any permutation altering the sequence yields a distinct set, as the depth and composition of singletons and doubletons uniquely reflect the original order.[22] Under the Zermelo–Fraenkel set theory with the axiom of choice (ZFC), every finite tuple admits a unique set-theoretic representation via this nested construction, guaranteed by the axiom of extensionality (which equates sets with identical elements) and the explicit, deterministic recursion that precludes alternative encodings for the same sequence.[22]As Functions
In mathematics, an n-tuple can be formally defined as a function , where is the domain of the components, such that for each , and the index set is equipped with the standard total order.[23] This perspective treats the tuple as a mapping from ordered positions to values, providing a structured way to encode sequences within set theory.[24] Within the context of Cartesian products, n-tuples arise naturally as elements of the product space , where each may be the same or distinct domains, and the tuple corresponds to selecting one element from each factor via the function's values at successive indices.[24] This functional representation unifies finite ordered collections under the broader theory of functions, facilitating operations like composition and restriction without relying on recursive set constructions.[23] This view of tuples proves particularly advantageous in relational mathematics, where they model records in databases as ordered assemblies of attribute values, with positions labeled by ordinal indices to ensure positional significance and enable efficient querying and joining.[25] For instance, a 2-tuple can be expressed as a function with and , representing an ordered pair that preserves the distinction between components based on their indexed locations.[26]As Nested Sets
One alternative set-theoretic construction of ordered pairs, proposed by Norbert Wiener in 1914,[20] encodes the pair as the nested set , where serves as the base empty set and the nesting distinguishes the positions through membership levels without relying on explicit pairing primitives. This approach leverages the empty set as a foundational element, akin to the zero ordinal in von Neumann's construction, to impose order via hierarchical inclusion: the first component is embedded in a singleton within a singleton, while occupies a parallel but distinct nesting depth. For n-tuples, this Wiener-style encoding can be generalized recursively by treating an n-tuple as an ordered pair of an (n-1)-tuple and the nth element, yielding deeply nested sets that avoid primitive ordered pairs altogether. For instance, the 2-tuple becomes the above form, and a 3-tuple is then , where denotes the Wiener encoding of the initial pair; this process embeds finite von Neumann ordinals (e.g., for position 0, for 1) as structural markers within the sets to track positions without external ordering mechanisms. A variant, akin to Kuratowski's 1921 refinement but emphasizing pure inclusion chains, represents the 2-tuple as , where order arises from the proper subset relation , and extends recursively to n-tuples through successive nestings that build membership hierarchies.[27] The adequacy of these constructions is established by proving a bijection between the class of n-tuples under the standard equational definition—where if and only if for all —and the class of these nested sets, with order preserved through unique recovery via membership chains. Specifically, projection functions can be defined set-theoretically: for a Wiener-encoded pair, the first element is the unique object at the innermost nesting excluding , and the second is extracted from the singleton branch; recursively, this unpacks the hierarchy to match the tuple components exactly. Such encodings ensure foundational purity in Zermelo-Fraenkel set theory, as all structures are built from the empty set using union and power set operations. However, these nested set representations are less intuitive for practitioners outside pure set theory, as the resulting objects—highly irregular sets with complex membership relations—obscure the linear order of a tuple compared to the more direct recursive pairing in other formalisms.Properties
Equality and Comparison
In mathematics, two finite tuples of the same length are equal if and only if their corresponding components are equal; that is, precisely when for every .[28] This component-wise equality follows from the set-theoretic construction of tuples, typically via recursive ordered pairs, where the equality of an ordered pair holds if and only if and , ensuring the uniqueness of components through extensionality.[28] In the functional representation of tuples as functions from to a set, equality is likewise pointwise.[28] Tuples over ordered domains admit natural comparison relations, including the product order and the lexicographic order. The product order on the Cartesian product , where each carries a partial order , is defined component-wise: if and only if for all ./01:_Foundations/1.04:_Partial_Orders) This induces a partial order on the tuple space, which becomes a total order if each is total. The coordinate projections , defined by , are surjective and collectively injective in the sense that a tuple is uniquely determined by its images under all projections, underscoring the structure's fidelity to components.[28] Alternatively, the lexicographic order provides a total order on tuples over totally ordered domains by comparing components sequentially from left to right: if there exists such that for all and .[29] For example, over the reals, in lexicographic order since the first components match and the second satisfies . In under the product order, tuples are compared component-wise, so holds as well, but and are incomparable unless additional structure is imposed.Operations and Composition
Tuples support several algebraic operations that enable their formation, manipulation, and decomposition within mathematical structures. One fundamental operation is concatenation, which combines two tuples into a single longer tuple by appending the elements of the second to the end of the first. Formally, for tuples and over a set , their concatenation is the ordered tuple of length .[30] This operation is commonly denoted by or simple juxtaposition in algebraic contexts and extends the intuitive joining of finite sequences.[1] Another key operation is projection, which extracts a specific component from a tuple. The -th projection applied to an -tuple yields , where .[31] For nested tuples, such as those constructed via recursive pairing (e.g., a 3-tuple as ), projections compose naturally: retrieves subcomponents by first projecting to an inner tuple and then to the desired element.[32] This composition preserves the ordered structure, allowing systematic access to elements in hierarchically defined tuples. Tuples are formed from relations through the Cartesian product, where the product consists of all possible -tuples with components from each , and a relation is any subset thereof.[32] Selecting subsets from this product yields specific tuples or collections thereof, underpinning tuple construction in set-theoretic frameworks.[33] These operations exhibit important algebraic properties. Concatenation is associative: for tuples , , as the resulting sequence matches element-wise regardless of grouping.[34] Projections are injective in the sense that their joint application on the full family distinguishes distinct tuples, ensuring unique reconstruction from components via the universal property of the product.[35]Generalizations
Finite n-Tuples
A finite n-tuple, where n is a non-negative integer, is an ordered sequence of n elements drawn from a domain set , typically denoted as with each .[36] This structure generalizes the concept of ordered pairs to arbitrary finite lengths, emphasizing the positional order of components. A particular case of a 3-tuple is known as a triplet, an ordered collection of three elements from , constructed recursively via nested ordered pairs as described in the "As Nested Ordered Pairs" subsection of Formal Definitions.[37][38] The collection of all such n-tuples forms the Cartesian power , defined as the n-fold Cartesian product (n times).[39] For , the length is fixed, providing a rigid structure suitable for representing multidimensional data with uniform dimensionality. The case corresponds to the empty tuple , whose space is the empty product, a singleton set containing only this unique empty element.[40] If is a finite set with cardinality , then the cardinality of the n-tuple space satisfies , reflecting the exponential growth in the number of possible ordered sequences.[41] Furthermore, if is countable (finite or countably infinite), then remains countable for any finite n, preserving countability under finite powering.[42] In mathematical applications, finite n-tuples often model vectors in Euclidean space; for instance, elements of are n-tuples of real numbers, such as where each , forming the standard basis for n-dimensional vector spaces.[43] This representation underpins linear algebra, where operations like addition and scalar multiplication are defined componentwise on these tuples.[44]n-Tuples of m-Sets
In combinatorics, an n-tuple of m-sets over a universe is defined as an ordered sequence , where each is a set with exactly elements. Let . The number of possible m-sets from is given by the binomial coefficient , which counts the ways to choose m elements from v without regard to order.[45] By the multiplicative principle, since each of the n positions in the tuple independently selects one such m-set (with repetitions permitted), the total number of n-tuples of m-sets is .[46][45] Such enumerations arise in combinatorics, where m-sets serve as elements in ordered collections for analyzing properties like unions and intersections.[47] If repetitions among the are allowed, the underlying collection corresponds to a multiset of m-sets with possible multiplicities up to n.[46] Conversely, requiring all to be distinct yields the number of injections from an n-element set to the collection of all m-subsets of , which is the falling factorial .[46][45] These structures appear in combinatorial constructions, where ordered selections of uniform subsets facilitate the study of configurations, such as in systems of distinct representatives.[47]Theoretical Contexts
In Type Theory
In type theory, tuples are formalized as product types, which provide a means to combine multiple types into a single structured type. For pairs, the product type consists of elements that are ordered pairs where and , allowing the simultaneous inhabitation of both component types.[48] This construction generalizes to n-tuples via the n-fold product , whose elements are sequences with for each .[49] Associated with these products are projection functions , which extract the -th component from a tuple, ensuring that the structure supports decomposition. In the simply typed lambda calculus, tuples are encoded using pairing and projection constructs, often represented as closures or record-like terms to facilitate computation. The typing rule for formation states that if and , then , with generalization to n-tuples following inductively.[50] Elimination rules for projections, such as and provided the pair is well-typed, enable the recovery of components while preserving type safety through progress and preservation properties. Under the Curry-Howard isomorphism, which equates proofs in intuitionistic logic with programs in typed lambda calculus, product types correspond directly to logical conjunctions, where a term of type serves as a proof of .[51] The pairing acts as an introduction rule for conjunction, while projections and correspond to the elimination rules (left and right projection), bridging computation and proof construction.[52] Dependent variants of tuples arise in dependent type theory through -types, which generalize products to allow the second component's type to depend on the first. Formally, a -type consists of pairs where and , supporting indexed families of types.[53] A canonical example is the type of vectors, defined as , where is the type of lists of length , and the dependent pair includes both the length and a proof of that length via the list structure.[49] Projections for -types, such as and , ensure dependent elimination while maintaining the theory's consistency.[54]In Category Theory
In category theory, an n-tuple of objects in a category is formalized as the product object , equipped with projection morphisms for each , satisfying a universal property: for any object in with morphisms , there exists a unique morphism such that for all .[55] This universal characterization ensures that the product, if it exists, is unique up to isomorphism and captures the essence of simultaneous mapping into each component, abstracting the notion of tuples beyond specific structures like sets.[55] In the category of sets , the categorical product coincides with the classical Cartesian product, where elements are precisely the ordered n-tuples with , and the projections select the i-th component.[55] This recovers the standard set-theoretic definition of tuples as functions from to the disjoint union of the , with the universal property ensuring that any compatible family of functions factors uniquely through the product.[55] Pullbacks provide a generalization of tuples to relational contexts, where the fiber product of morphisms and is the pullback object with projections and such that , satisfying the universal property that any commutative square factors uniquely through .[56] In , this yields the subset of consisting of pairs where , thus generalizing tuples to those constrained by a relation over .[56] Fiber products extend this to fibered categories, such as bundles over a base, where tuples are taken fiberwise.[56] Cartesian closed categories guarantee the existence of finite products as part of their structure, with the product monoidal structure being closed under exponentials.[57] Moreover, the product functor , which maps a tuple of objects to their product, is left adjoint to the diagonal functor that sends an object to the constant n-tuple , with the unit of the adjunction providing the projections.[58] This adjunction underscores the universal role of products in preserving limits and structuring categorical compositions.[58]Applications
In Mathematics
In algebra, tuples play a central role in the study of multilinear forms and tensor components. A multilinear form on vector spaces is a function that is linear in each argument separately, where the domain consists of -tuples with .[59] These forms generalize linear functionals to multiple variables, enabling the analysis of structures like determinants and inner products on products of spaces.[60] In tensor algebra, the components of a tensor are specified by a multi-index , forming a tuple of indices that indexes the entries in a multi-dimensional array, with the tensor product space having dimension .[60] This representation allows tensors to encode multilinear relationships, such as contractions and symmetries, essential for algebraic manipulations in representation theory and invariant theory.[59] In geometry, tuples represent coordinates of points in -dimensional Euclidean space , where each point is identified with an ordered -tuple of real numbers, generalizing the Cartesian plane () and three-dimensional space (), particularly as triplets for coordinates of points and vectors in physics and engineering.[61][62][63] This coordinate system facilitates the description of geometric objects, such as lines as parametric tuples and subspaces as spans of basis tuples. Affine transformations, defined by where is an invertible linear map and a fixed tuple (translation vector), preserve the affine structure of by maintaining collinearity and ratios along lines, though not necessarily distances or angles.[64] For instance, rotations and shears map coordinate tuples to new tuples while keeping parallel lines parallel, underpinning applications in projective geometry and computer-aided design.[64] In combinatorics, tuples model ordered selections, with permutations of a finite set often represented as tuples that rearrange elements, such as the six permutations of as , , etc.[65] A -permutation of an -element set is precisely a tuple of distinct elements from the set, counted by , distinguishing order from combinations.[65] Generating functions provide a powerful tool for enumerating such tuples; the exponential generating function for the number of permutations of elements is , capturing the factorial growth, while ordinary generating functions like count binary tuples (sequences) of length .[66] These functions extend to derangements and cycle structures, aiding in the asymptotic analysis of permutation enumerations.[66] In analysis, sequences of tuples in are studied for convergence properties, where a sequence converges to if and only if it converges componentwise, meaning each scalar sequence converges to for .[67] This equivalence holds because the Euclidean norm is bounded by the maximum component deviation, and conversely, componentwise limits imply norm convergence via the finite dimension.[67] Such componentwise convergence underpins theorems on uniform continuity and differentiability in multiple variables, as seen in the extension of one-dimensional limits to vector-valued functions.[67]In Computer Science
In computer science, tuples serve as fundamental data structures for grouping a fixed number of heterogeneous values into an ordered sequence, often emphasizing immutability for efficiency and safety in operations. In programming languages, tuples are commonly implemented as immutable sequences, distinguishing them from mutable lists by their fixed size and inability to be modified after creation, which enables optimizations like use as dictionary keys. For example, in Python, a tuple is defined with comma-separated values enclosed in parentheses, such as(1, "a"), and supports indexing and slicing while prohibiting in-place changes to prevent unintended side effects.[68] Similarly, in Haskell, tuples represent product types that combine values of different types, like (Float, Float) for a 2D point, with built-in syntax and functions for accessing components via pattern matching, reinforcing their role in functional programming paradigms. Triplets, a specific case of 3-tuples, are often used to represent RGB color values as (red, green, blue) intensity levels ranging from 0 to 255.[69][70] These features trace back to the 1960s, when languages like PL/I introduced structured aggregates for organizing data, evolving into modern tuple implementations for reliable composition of values.[71]
In relational databases, tuples represent individual rows in a table, encapsulating a complete record as an ordered n-tuple of attribute values drawn from predefined domains. This concept originates from Edgar F. Codd's relational model, where a relation is defined as a set of such tuples, with each tuple corresponding to a row in an array representation and ensuring uniqueness without inherent ordering.[25] In SQL, operations like SELECT with projection allow extraction of specific tuple components (attributes), producing a new relation by selecting columns and eliminating duplicates, as in projecting supplier and project from a supply relation to yield a subset of tuples.[25] This structure facilitates declarative querying and data integrity in systems like those built on Codd's framework.
Tuples also play a key role in algorithms, particularly for multi-dimensional processing where lexicographic order enables sorting by comparing components sequentially from left to right, akin to dictionary ordering of words. For instance, in sorting algorithms, tuples of keys (e.g., (name, age)) are ordered first by name, then by age if names match, supporting efficient multi-criteria arrangements as detailed in foundational texts on sorting. In hashing, tuples are processed component-wise to compute a combined hash value, often via iterative mixing (e.g., XOR or rolling hash of individual element hashes), allowing immutable tuples to serve as keys in hash tables for constant-time lookups in applications like caching or indexing. In graph algorithms, edges in weighted graphs are represented as triplets (source node, destination node, weight).[72][73] Additionally, in semantic web technologies, RDF triples represent subject-predicate-object relations as ordered triplets for knowledge representation.[74] This component-wise approach ensures uniform distribution and collision resistance, leveraging tuple immutability for hash consistency.References
- https://proofwiki.org/wiki/Definition:Concatenation_of_Ordered_Tuples
