Let $[n] = \{m \in \mathbb{N}: m < n\}$. Suppose $\Sigma$ is a set and $\Sigma^*$ is the set of sequences on $\Sigma$. That is $\sigma \in \Sigma^*$ means there exists $n\in \mathbb{N}$ such that $\sigma:[n] \to \Sigma$, that is, $\sigma$ is a function from $[n]$ to $\Sigma$, i.e. and ordered sequence on $\Sigma$.
Suppose $\circ: \Sigma^2 \to \Sigma$ is binary operation. I would like to define the concept of all "parenthesizations" of a sequence $\Sigma^*$ of elements of $\Sigma$. Especially, I would like to define that behaves like the following. Suppose $a, b, c, d \in \Sigma$ and $[a, b, c, d] \in \Sigma^*$.
\begin{align*} \circ_*([a]) =& \{a\}\\ \circ_*([a, b]) =& \{a \circ b\}\\ \circ_*([a, b, c]) =& \{a \circ (b \circ c), (a \circ b) \circ c)\}\\ \circ_*([a, b, c, d]) =& \{a \circ (b \circ (c \circ d)), a \circ ((b\circ c) \circ d), (a\circ b) \circ (c \circ d), (a \circ (b \circ c)) \circ d, ((a\circ b) \circ c) \circ d\} \end{align*}
That is, $\circ_*$ should map the sequence $\sigma$ to all the "parenthesizations" of the elements of $\sigma$.
My question is how, rigourously, to define the function $\circ_*:\Sigma^* \to \mathcal{P}(\Sigma)?$
I can define it sort in a way I consider to be not 100% rigorously as follows. Suppose $\sigma \in \Sigma^*$.
- If $|\sigma| = 1$ then $\sigma = [a]$ for some $a\in \Sigma$. We define $\circ_*(\sigma) = \circ_*([a]) = \{a\}$.
- If $|\sigma| = n > 1$ then let \begin{align*} \circ_*(\sigma) = \{\tau \in \Sigma:&\text{There exists } i \in \mathbb{N} \text{ with } 1 \le i < n \text{ such that } \\ & \text{there exists } x \in \circ_*(\sigma[0:i]) \text{ and there exists } y \in \circ_*(\sigma[i:n])\\ & \text{ such that } \tau = x \circ y\} \end{align*} That is, $\circ_*(\sigma)$ is the collection of $\tau \in \Sigma$ which correspond to splitting the sequence $\sigma$ at some $i$, applying $\circ_*$ to the smaller sequences, and applying $\circ$ to all pairs of the resulting sets.
The reason this approach doesn't feel totally rigorous is it relies on using $\circ_*$ to define $\circ_*$. It requires us to know $\circ_*$ on shorter sequences $\sigma$ to determine $\circ_*$ on longer sequences. A similar approach involves defining separate functions $\circ_n$ depending on the length of $\sigma$. In this case $\circ_n$ depends on having $\circ_m$ defined for $m< n$ but I can't think how to define in a finite number of steps (that is not needing an independent definition for each $n \in \mathbb{N}$ relying on the earlier ones). Clearly some sort of recursion is needed for this definition but I can't seem to get it right.
I've tried two approaches but haven't been able to get them to work.
The first approach is to use structural recursion to define the function $\circ_*$. My understand of structural recursion is we have a set $U$ with a base subset $B$ and "generator" functions $\mathcal{F}$ where each $f\in \mathcal{F}$ maps an element of $U$ (or a tuple in $U^n$) to another element of $U$. If $C$ is the inductive closure of $B$ under the functions in $\mathcal{F}$ then we can apply a structural recursion theorem. If $S$ is a set and we have a (1) function $h_B: B \to S$, (2) a function $\tilde{f}:S^n \to S$ for each $f\in \mathcal{F}$ with $f:U^n \to U$, and (3) the functions $f\in \mathcal{F}$ satisfy some hypotheses to ensure the inductive closure is freely generated, then it is possibly to uniquely extend $h_B$ to a function $h:C\to S$ so that $h|_B = h_B$ and we have $h(f(c_0, \ldots, c_{n-1})) = \tilde{f}(h(c_0), \ldots, h(c_{n-1}))$. In simple examples this is how addition or the factorial functions can be defined.
I have trouble seeing how to apply structural recursion to prove the existence of the function $\circ_*$. I would think $\circ_*$ is the target recursive function $h$ which means $U = C = \Sigma^*$ and $S = \mathcal{P}(\Sigma)$ and clearly $B = \Sigma^1$, the length one sequences. But I can't really tell what the functions $f\in \mathcal{F}$ should be or the corresponding functions $\tilde{f}$. It seems like I want the function $f$ to be something like "appending one element of $\Sigma$ to the a list $\sigma \in \Sigma^*$. That is, something like $+_d([a, b, c]) = [a, b, c, d]$. But with this definition I would need one function $+_{\alpha}$ for each $\alpha \in \Sigma$ which feels like a lot of functions in $\mathcal{F}$. The corresponding functions $\tilde{f}$ are even more mysterious.
The other approach is to try to recursively generate the functions $\circ_n$ for $n\in \mathbb{N}$. We have $\circ_1([a]) = \{a\}$ which is easy enough. And then I can somehow define $\circ_n$ assuming $\circ_m$ for $1 \le m < n$ has been defined. The problem is I can't figure out how to put this into the framework of the recursion relation I've given above. Like I guess we would have $U=\mathbb{N}$ but $S$ would somehow be the set of all functions from $\Sigma^* \to \mathcal{P}(\Sigma)$? I guess we might denote this set $Z = \mathcal{P}(\Sigma)^{\Sigma^*}$? so we're trying to find a function $h$ that maps natural numbers $n$ to functions $\sigma_n \in Z$? Clearly $\mathcal{F} = \{+_1\}$ the add-by-one operation, but what is the corresponding function $\tilde{f}:Z \to Z$? I get tripped up because we would have $h(n) = \circ_n$ which is fine, but $h(n+1) = \circ_{n+1}$ and I know the definition of $\circ_{n+1}$ will rely on $\circ_m$ for all $m<n$, it won't only rely on $\circ_n$.
Apologies for such a long post and maybe a lack of clarity, just trying to get out all my thoughts so readers can see what I'm thinking. I'm open to any hints on any of these approaches, or, if there is another easier approach I would be very open to hearing that as well! Basically the question is how to, formally, use the recursion theorem to define the function $\circ_*$ I gave an example of above?
Let's try this.
Let $[n] = \{m \in \mathbb{N}: m < n\}$.
For any set $X$ define $X^n$ by
$$ X^n = \{f\in \mathcal{P}([n] \times X)| f: [n] \to X\} = [n]^X $$ That is $X^n$ is the set of all functions from $[n]$ to $X$. If $\mathbf{x} \in X^n$ then for $0 \le i < n$ we have $\mathbf{x}(i) = \mathbf{x}_i \in X$.
In the question we have the set $\Sigma$. An $n$-sequence on $\Sigma$ is an element $\sigma \in \Sigma^n$. We define $$ \Sigma^* = \bigcup \{z \in \mathcal{P}(\mathbb{N}\times X)| \exists n \in \mathbb{N}(n \ge 1 \text{ and }z = \Sigma^n)\} = \bigcup_{i=1}^n\Sigma^i $$
There is a function $\circ: \Sigma \to \Sigma$
We desire a function $\circ_*:\Sigma^* \to $ which satisfies
We will build this up using approximations to $\circ_*$ called $\circ_n$ for $n\in \mathbb{N}\setminus \{0\}$ on sets $\Sigma^{\le n} \subset \Sigma^*$.. Define $$ \Sigma^{\le n} = \bigcup \{z\in \mathcal{P}(\mathbb{N}\times X)| \exists i\in \mathbb{N}(1 \le i \le n \text{ and } z = \Sigma^i\} = \bigcup_{i=1}^n\Sigma^i $$
We will inductively prove the existence of functions $\circ_n: \Sigma^{\le n} \to \mathcal{P}(\Sigma)$ that all satisfy the same conditions as $\circ_*$, just on a restricted domain.
For $n=1$ it is clear that $\circ_1(\boldsymbol{\sigma}) = \{\boldsymbol{\sigma}_0\}$.
Now we consider the case $n>1$. The induction hypothesis is that such a function $\circ_n:\Sigma^{\le n} \to \mathcal{P}(\Sigma)$ exists and we must show that a function $\circ_{n+1}:\Sigma^{\le n+1} \to \mathcal{P}(\Sigma)$ exists. $\circ_{n+1}$ should be a total functional relation between $\Sigma^{\le n+1}$ and $\mathcal{P}(\Sigma)$ which means it is subset of $\Sigma^{\le n+1} \times \mathcal{P}(\Sigma)$. First we choose $\circ_{n+1}$ so that $\circ_n \subset \circ_{n+1}$. That is, for $\boldsymbol{\sigma}$ with $|\boldsymbol{\sigma}|\le n$ we have $\langle \boldsymbol{\sigma}, \circ_n(\boldsymbol{\sigma})\rangle \in \circ_{n+1}$. Now we need only figure out how to handle $|\boldsymbol{\sigma}| = n+1$. Well we simply define the target of $\boldsymbol{\sigma}$ to be exactly the set in $\mathcal{P}(\Sigma)$ to satisfy the condition on $\circ_*$. That is for $\boldsymbol{\sigma}$ with $|\boldsymbol{\sigma}|=n+1$ we define
\begin{align*} \circ_{n+1}(\boldsymbol{\sigma}) = \{\tau \in \Sigma^*|& \text{ There exists } i \in \mathbb{N} \text{ with } 1 \le i < n \text{ such that}\\ &\text{there exists } x \in \circ_n(\boldsymbol{\sigma}_{0:i}) \text{ and there exists } y \in \circ_n(\boldsymbol{\sigma}_{i:n})\\ & \text{such that } \tau = x \circ y\} \end{align*}
We've avoided circularity here by defining $\circ_{n+1}$ in terms of $\circ_n$ which exists by the induction hypothesis. We then know such a $\circ_n$ exists for each $n$ by induction. We could have been slightly more careful in the proof if we had first defined $\circ_{n+1}$ as a subset of $\Sigma^{\le n+1}\times \mathcal{P}(\Sigma)$ and proven that $\circ_{n+1}$ is total and functional but we leave that level of rigor out here.
We then have
$$ \circ_* = \bigcup \{f \in \mathcal{P}({\Sigma^*} \times \mathcal{P})|\text{There exists } n \in \mathbb{N} \text{ such that } f=\circ_n\} $$ $\circ_*$ is total because for any $\boldsymbol{\sigma}\in \Sigma^*$ with $|\boldsymbol{\sigma}| = n$ there is a $\circ_n$ we can use to calculate $\circ_*(\boldsymbol{\sigma})$ and $\circ_*$ is functional because for $m \le n$ we have that $\circ_m$ agrees with $\circ_n$ restricted to $\Sigma^{\le m}$.
Here I've proven the existence of a function $\circ_*$ by forming approximations to $\circ_*$ called $\circ_n$ on restricted domains. I have not used any recursion theorems, however, I think it's possible that this proof could be generalized into another type of recursion theorem (which are proved by induction on their domains anyways..). I'd appreciate any details or references about how to generalize this proof into a recursion theorem.