# Can we define a function as a cartesian product of *tuples*? Could we make use of the implict indices of the variables when defining the function?

First, as noted in the comments, this question is on notation and so it might not be the easiest to understand. The crux of my question is whether the notation that I am using makes sense and whether one could use such ideas (e.g., making use of the value of the index of a variable within some tuple)

We will say that an n-tuple $(a_0, a_1,...,a_n)$ is the ordered collection that has $a_i$ as its i-th element for all integers i such that $0 \leq i \leq n$

Two n-tuples are equal if each pair of corresponding entries are equal. That is, $(a_0, a_1,...,a_n) = (b_0, b_1,...,a_n)$ if and only if $a_i = b_i$ for all $i \in$ {$0,1,2,...,n$}

Also note the following:

We will be considering only finite tuples where no tuple contains repeated elements. That is, each element in the tuples we are considering is distinct.

Now, as for the definition of an n-tuple we could get more technical, but I don't believe it should matter. The main point I want to utilize about tuples is that they have index values (that is, their elements are ordered). And in our case, I want to utilize the fact that the each element corresponds to a unique index. This holds in our case since no tuple has repeated elements.

I will now give some examples of what I would like to do. I am wondering if such things are conventional, and if not, whether they would still be acceptable.

Consider the 2 tuples $t = (a, b, c)$ and $r = (a, d, f)$ and the set $S =$ {${a,b,c}$ }

First:

• Does it make sense to ask something like "Is $a \in t$?" as we do when we ask (for example as exercises in some introduction to set-theory book) "Is $a \in S$?" ? Does the symbol $'\in$'make sense when applied to tuples? I am working on something where I am explicitly working with tuples and I would like to be able to pose statements such as "if x is an element of tuple t, then...". But I am not sure if that even makes mathematical sense. To talk of "elements" of a tuple, I think intuitively makes sense, but I am not sure if technically the '$\in$' symbol is how one goes about doing it.

Remark: And if I am to use '$\forall x \in t$' I mean all values in the tuple $t$ in the same way that $\forall x \in S$ means all values in $S$.

Second:

• Could we have a Cartesian product of the 2 tuples? If using the $\in$ symbol like I did in the first question makes sense, then can we define the Cartesian-product of two tuples as: The Cartesian-Product of two tuples $t$ and $r$ denoted by ($t \times r$) is the set of ordered-pairs $(a,b)$ where $a \in t$ and $b \in r$.

That is, (just like the definition w.r.t. sets), we have that ($t \times r) :=${ $(a, b) : a \in t \wedge b \in r$}

Is this used at all, if not, would it be acceptable?

Example: Using the tuples $t$, $r$ defined earlier, ($t \times r) =$ {$(a,a) ,(a,d) , (a,f) , (b,a) , (b,d) , (b,f) , (c,a) , (c,d) , (c,f)$}

Note, this results in a set, not a tuple.

Third:

First, let us also say that for any tuple $t$ (where the domain consists of only the kinds of tuples we are considering), $I_t(x)$ denotes the value-of-the-index associated with the element x of the tuple t, for all x in t.

• Ok, now I am also curious about whether the following kind of statement makes sense or not. What I want to do is define a function but when defining this function I want to make use of the implict-indices associated with the values of the tuples we are considering. What I want is to have a tuple itself be the domain. That is, I want to have a function a $f$: $t \rightarrow$ $\mathbb{N}$

So what does this mean? I want the domain to be all the values of the tuple $t$, but I don't just want the values. I also want to make use of the values of the indices. That is, I want those values to in some way be part of the input-argument.

So why not just create a set whose elements are all those elements in the tuple $t$? Well, the problem is that there would be no associated index-values with those elements. Only the elements of a tuple have an associated index (in our case, each value has a unique associated index).

I want to define $f$ as something like: for each tuple $t$, we define a function $f: t \rightarrow \mathbb{N}$ as being $f(x) = I_t(x) + 2$ , $\forall x \in t$.

Example: Using the tuple $r$ defined in the beginning, $f(d) = 1 + 2 = 3$

The point is, that I want the value of the function to—in part—be determined by the index that the argument is associated with/resides in, with respect to the tuple that it comes from.

My question is whether this is done anywhere in mathematics, and if it isn't, would it be acceptable to do so provided I give the explanation I am giving here (with slightly more rigor)?

Fourth:

Taking things one step further, I would also like to have a function that goes from the Cartesian-product of 2 tuples $a$ and $b$ to the natural-numbers. That is I would like to have, $g : (a \times b) \rightarrow \mathbb{N}$ And then define $g$ to be something like $g( (x,y) ) = I_a(x) + I_b(y) + 2$ for all $x \in a$ and $b \in b$

Example: Again using the already defined tuples $t$ and $r$, g((c,d)) = 2 + 1 + 2 = 5

The thing about mathematics though is that it is about creation in a lot of ways, as long as you are precise enough. So even if these ideas aren’t really conventional, am I coming off (more-or-less) precise enough so that I could use these ideas? My concern is that maybe having a tuple itself be a domain, for example, is too outside the realm of normalcy.

Thank you for taking the time to read it all, I hope it makes sense.

• Comments are not for extended discussion; this conversation has been moved to chat. Apr 2, 2017 at 17:09

## 1 Answer

I like you. Unlike most people, you actually think about things.

The usual way of doing this is to think of a tuple $x \in X^n$ as a function $n \rightarrow X$, not necessarily injective, where $n$ is identified with the set $\{0,\ldots,n-1\}$. Then:

First.

• $a \in x$ can be interpreted as shorthand for $a \in \mathrm{img}(x)$, so yes, this makes sense.

• You may wish to define a new symbol $\dot{\in}$ and assert that $a \mathbin{\dot{\in}} x$ is the number of times $a$ occurs in the tuple $x$. Explicitly, if $x \in X^n$, then $$a \mathbin{\dot{\in}} x = |i \in n : x_i = a|.$$

• You can write $x^{-1}(a)$ for the set of all indices at which the value $a$ occurs. Explicitly, if $x \in X^n$, then $$x^{-1}(a) = \{i \in n : x_i = a\}.$$

Second. Yes, you can take Cartesian products of functions, so Cartesian products of tuples is a special case. In particular:$$\frac{f : A \rightarrow B \qquad f' : A' \rightarrow B'}{f \times f' : A \times A' \rightarrow B \times B'}$$ $$(f \times f')(a,a') = (f(a),f(a'))$$

According to category theory, this is all packaged up into something called the "Cartesian product functor." Judging by your interests, you should definitely learn some category theory.

As you noted, the Cartesian product of tuples won't usually be a tuple. You can solve this as follows. For each pair of natural numbers $a$ and $b$, there's a function $\lambda_{a,b} : ab \rightarrow a \times b$ that implements of the lexicographical order. Then if $x \in X^a$ and $y \in Y^b$, we can build $x \times y : a \times b \rightarrow Y \times X$, and then compose with $\lambda$ to obtain $$(x \times y) \circ \lambda_{a,b} : ab \rightarrow X \times Y,$$ which is a tuple. This has something to do with commutativity.

Third. Instead of defining functions on tuples, the usual thing is to define functions on the domain or codomain. For instance, if you want to count the number occurrences in a tuple $x \in X^n$, this could be viewed as the function $X \rightarrow \mathbb{N}$ defined by $a \mapsto a \mathbin{\dot{\in}} x$.

Fourth. Everything I've said ignores your initial injectivity assumption. If this is fundamental to what you're doing, perhaps what you're really looking for is the notion of a "finite totally-ordered set." These can be treated as if they were sets in a rather direct way. You're correct to note that if $A$ and $B$ are finite totally-ordered sets, then $A \times B$ isn't totally-ordered with the usual order. It is, however, partially ordered. And you can use to lexicographic order to totalize this, if desired.

• The cartesian products you're talking about are not the ones OP is interested in (or is asking about). Apr 2, 2017 at 2:01
• I'm looking over this now. Let me just say though, thanks for taking the time to write it up and for the kind words. Apr 2, 2017 at 2:02
• @Parry, no worries. I don't answer all of your questions directly, and some of the details of what I'm talking about here are a bit different to what you're asking for, but that's because I suspect you'll change your mind about what you're after slightly after reading this. If not, you may find my answer slightly annoying :) sorry about this. Apr 2, 2017 at 2:02
• Well firstly I didn't find it annoying at all, quite the opposite. It's interesting stuff and I've been wanting to get into category-theory for a while now, actually. ...Unfortunately, though the initial injectivity assumption is fundamental. But hm, never thought of using totally-ordered sets. I was studying a lot about them/posets last year, but that idea never struck me here for some reason. Thanks for the suggestion. Apr 2, 2017 at 2:25
• @Parry, cool. Personally I'm always a bit annoyed when someone answers a tangential or related question but phrases it as if this answers my actual question, so I've tried not to do that. Anyway, perhaps define that a foo of $X$ is a finite subset of $X$ equipped with a total ordering, where foo is replaced by a word of your choice. Apr 2, 2017 at 2:31