# What kinds of problems are modeled by a recursive definition of a set of strings?

Given this definition:

The set $\Sigma^*$ of strings over the alphabet $\Sigma$ is defined recursively by:
BASIS STEP: $\lambda \in \Sigma^*$ (where $\lambda$ is the empty string)
RECURSIVE STEP: If $w \in \Sigma^*$ and $x \in \Sigma$ then $wx \in \Sigma^*$

My understanding of this is that the subset $\Sigma^*$ will expand with each iteration by what appears to be $|\Sigma|^n$ elements where $n$ is the number of iterations. So for example, given $\Sigma = \{a,b,c\}$ we have:

1. Base Case: $\Sigma^* = \{\lambda\}$

2. Iteration 1: $\Sigma^* = \{\lambda,\lambda a, \lambda b, \lambda c\}$

3. Iteration 2: $\Sigma^* = \{\lambda,\lambda a, \lambda b, \lambda c, \lambda aa, \lambda ab, \lambda ac, \lambda ba, \lambda bb, \lambda bc, \lambda ca, \lambda cb, \lambda cc \}$

Etc.

If this is the correct interpretation of the data structure described by this recursion, what types of problems are structures like this used to study/prove in CS?

• – Raphael Jun 26 '16 at 0:40

The definition you quote is a formal definition of strings which is particularly conducive to induction. There are many other ways to define strings, for example as sequences of letters, or more exactly as mappings $f\colon \{1,\ldots,n\} \to \Sigma$ for some $n \in \mathbb{N}$.

There are several different ways of understanding your definition, which is stated rather informally. The usual interpretation is as a least fixed point: $\Sigma^*$ is the least set which contains $\lambda$, and for each $w \in \Sigma^*$ and $\sigma \in \Sigma$, also $w\sigma \in \Sigma^*$; here you should think of concatenation as some formal operation, which is perhaps more appropriate to write as (say) $(w.\sigma)$.

What is a least fixed point? In this case, it is the intersection of all sets satisfying the two conditions stated above. One can prove that in general, such sets can be constructed just in the way that you describe: start with the empty set, and repeatedly a closure operation $C$, which in this case is $$S \to S \cup \{\lambda\} \cup \{w\sigma : w \in S, \sigma \in \Sigma\}.$$ Form a sequence $S_0 = \emptyset$, $S_1 = C(S_0)$, $S_2 = C(S_1)$, and so on, and take ${\cal S} = \bigcup_{n=0}^\infty S_n$. It is not too hard to show that ${\cal S} = C({\cal S})$, and moreover ${\cal S}$ is the least fixed point.

Another way of thinking of these rules is as a proof system for demonstrating that a certain expression is in $\Sigma^*$. We have an axiom $\begin{array}{c}\\\hline \lambda\end{array}$ and an inference rule $\begin{array}{c} w \\\hline w\sigma \end{array}$ valid for all $\sigma \in \Sigma$.

A third way is through induction: a property $P$ holds for all $\Sigma^*$ if $P(\lambda)$ and for all $\sigma \in \Sigma$, $P(w) \longrightarrow P(w\sigma)$. This is how we usually use this definition.

Given this definition, it is possible to define operations on strings and to prove theorems on strings. For example, length is defined by $|\lambda| = 0$ and $|w\sigma| = |w| + 1$, and concatenation by $x::\lambda = x$ and $x::(w\sigma) = (x::w)\sigma$; it is straightforward to prove by induction (on $y$) that $|x::y| = |x| + |y|$.

This sort of definition is common in the more formal parts of computer science. Other parts will prefer the informal definition "$\Sigma^*$ is the set of all words over $\Sigma$", or more explicitly, "$\Sigma^*$ is the set of all finite sequences of elements of $\Sigma$".

• Thank you for this outstanding answer. The definition does come directly from a textbook since I'm currently studying discrete math, but I was interested in language construction starting many years ago which led me to this question. Also I'd never heard of a fixed point before, that led me down a fun Wikipedia rabbit hole. :) Thank you! – Dave Jun 26 '16 at 1:35