拼接(元组)
拼接 | |
---|---|
术语名称 | 拼接 |
英语名称 | concatenation |
别名 | 连接 |
元组的拼接(concatenation)是将两个或多个元组按顺序连接形成新元组的运算。
定义
元组拼接 | |
---|---|
运算名称 | 元组拼接 |
运算符号 | |
Latex | |
运算对象 | 元组 |
运算元数 | 2 |
运算结果 | 元组
|
对两个元组 [math]\displaystyle{ A = (a_1, a_2, \dots, a_m) }[/math] 和 [math]\displaystyle{ B = (b_1, b_2, \dots, b_n) }[/math] ,将元组 [math]\displaystyle{ (a_1, a_2, \dots, a_m, b_1, b_2, \dots, b_n) }[/math] 称为元组 [math]\displaystyle{ A }[/math] 和 [math]\displaystyle{ B }[/math] 的拼接(concatenation)。
类似地,可以定义多个元组的拼接:对元组 [math]\displaystyle{ A_1, A_2, \dots, A_k }[/math] ,将这些元组按顺序两两拼接的结果定义为这一组元组的拼接。
注:由于使用元组时,较少使用涉及拼接的建模,因此拼接并没有公认标准的运算符和记号,需要根据上下文判断。
性质
元组拼接具有以下基本性质:
- 长度可加:拼接后的元组长度等于各元组长度的和。
- 结合律。
- 0-元组 [math]\displaystyle{ () }[/math] 是拼接运算的幺元。
- 不可交换:一般情况下不可交换,除非 [math]\displaystyle{ A = B }[/math] 或 [math]\displaystyle{ A,B }[/math] 中至少有一个是 0-元组。
与笛卡尔积的关系
元组拼接与笛卡尔积密切相关但不相同:
- 笛卡尔积的结果是由二元组构成的集合,其中每个二元组的第一个分量来自 [math]\displaystyle{ A }[/math] ,第二个分量来自 [math]\displaystyle{ B }[/math] 。
- 元组拼接的结果是一个元组,其元素依次为 [math]\displaystyle{ A }[/math] 的元素和 [math]\displaystyle{ B }[/math] 的元素。
若忽略元组的嵌套结构,元组的集合间进行笛卡尔积与元组间的拼接是完全对应的操作。
元组 | |
---|---|
特殊元组 | 0-元组 [math]\displaystyle{ () }[/math] |
生成 | 笛卡尔积、多元谓词、多元映射、多元函数 |
运算 | 拼接 |
投影映射 [math]\displaystyle{ \operatorname{proj} }[/math] | |
相等关系 [math]\displaystyle{ = }[/math] |