There's a practice problem I've been working on that's been bothering me. I've been searching for answers here and elsewhere online but I can't the answer I'm looking for. The question is as follows:
"Consider the abstract data types Sequence and Set, paying attention to how objects are treated mathematically. What is the relationship between sets, sequences, and functions?"
So far I know that sequences and sets can both consist of collections of elements, and functions are the operations that can be done on them, but that isn't enough to answer the question. What else am I missing?
Recall that
A map $F$ from $A$ to $B$ is a binary relation having no two distinct pairs with the same first coordinate. Usually you write $F:A\longrightarrow B$ to specify that $F$ is from $A$ to $B$. The common notation is $y=F(x)$ which means that: $$(x,y)\in F \ \Longleftrightarrow y=F(x)$$ The condition to be a map is the following: $$(x,y_1)\in F \ \text{and}\ (x,y_2)\in F \ \Longrightarrow y_1=y_2,\quad \forall x\in A,\ \forall y_1,y_2\in B.$$
Let $X$ be a non-empty set. A sequence of elements of $X$ is map $s$ from $\mathbb{N}$ to $X$. That is, the domain of $s$ is the whole set $N$ $$ s:\mathbb{N}\longrightarrow X $$ where $s_{n}:=s(n)\in X$, for all $n\in\mathbb{N}$. Recall that $$\mathbb{N}=\{1,2,3,\ldots\}$$ It's ok also to define $\mathbb{N}=\{0,1,2,3,\ldots\}$ depending how you prefer it.