2

Define a placeholder to be either an empty list $()$ or a list $(p q)$ of two placeholders $p$ and $q$. Does it exist a set of all placeholders? Of all finite placeholders?


My intention with placeholders is to abstract the structure of expressions in magmas: $(a\cdot ((b\cdot c)\cdot(d\cdot e)))\mapsto (()((()())(()())))$ where the empty lists replace all terms in the expressions. The number of atoms associated with a placeholder can be defined formally as: $|p|=1$ if p is a empty list and $|p|=|p^\prime |+|p^{\prime\prime}|$ if $\;p=(p^\prime p^{\prime\prime})$.

If $M$ is a magma and $|p|=n$, $p$ defines an obvious function $M^n\to M$ and the set of all placeholders is a magma itself with the multiplication $p_1\cdot p_2= (p_1 p_2)$.

The purpose is to study questions as in A simple question about rational numbers without a simple proof?

Lehs
  • 14,252
  • 4
  • 28
  • 82
  • It seems you have defined it. So it would contain $(()()),$ if in saying $(pq)$ in your definition you mean the extra parentheses must be included. – coffeemath Aug 15 '15 at 20:47
  • @coffeemath: but also (()(()())) etc are placeholders... – Lehs Aug 15 '15 at 20:50
  • 1
    Your notation is not clear. What does () mean? If $p$ and $q$ are lists, what does $pq$ mean? If () means the empty list and $pq$ means the concatenation of $p$ and $q$ then there is only one placeholder, namely the empty list. If your $pq$ is supposed to denote the pair, $(p, q)$, then why mention lists? – Rob Arthan Aug 15 '15 at 21:48
  • 2
    Your set of placeholders is inductively defined, and every such placeholders is automatically finite. If you want to deal with infinite structures, you may want to have a look at coinductive techniques. – Klaus Draeger Aug 15 '15 at 22:12
  • 1
    @KlausDraeger: inductively defined to be what? What does the OP's notation mean? – Rob Arthan Aug 15 '15 at 22:27
  • @RobArthan, $()$ means an empty list. All lists are supposed to start and end with matching brackets. The sequence $pq$ is just a variant of $p,q$ and $(pq)$ is a list with two elements. Just like in Lisp. – Lehs Aug 15 '15 at 23:43
  • 2
    @Lehs: You are confusing syntax with semantics: the list that you would write in Lisp as (1 2 3 4) starts with 1 and ends with 4 and contains no brackets at all. – Rob Arthan Aug 16 '15 at 00:02
  • @RobArthan: in lisp there could also be lists of lists. A placeholder is defined to be a certain class of lists without no other atoms but the empty list. – Lehs Aug 16 '15 at 05:34
  • @RobArthan, my understanding was that a placeholder is a special kind of parenthesized expression, i.e. anything generated by the context-free grammar $S\to (), S\to (SS)$. – Klaus Draeger Aug 16 '15 at 08:12
  • @KlausDraeger: fine: if the OP cares to reword the question along those lines, I would have no objections to it. – Rob Arthan Aug 16 '15 at 14:26

4 Answers4

3

Sure. Let $X_0=\{()\}$ and let $X_{n+1}=X_n\cup\{ (pq)\mid p,q\in X_n\}$

Then $\bigcup_{n=0}^\infty X_n$ is the set you are seeking.

The number of such expression of length $2n$ is the $n-1$st Catalan number.

Thomas Andrews
  • 186,215
  • I guess you are right, but I specially wonder about infinite patterns. – Lehs Aug 15 '15 at 21:04
  • No infinite pattern was defined, nor is it clear what an infinite pattern would be. This is the smallest set meeting your criteria. – Thomas Andrews Aug 15 '15 at 21:06
  • You are right again. Or, could there be anything like p=(()p) that might work? – Lehs Aug 15 '15 at 21:08
  • For what is worth, the technique you are using to define this set is the same as used to define "valid computer programs," only that is far more complicated. When I say "it's not clear what you mean by infinite cases," I mean that as a rule, if you have a formula that is infinite, it is possible that string "....()" and ".....())" for the same start. That's because you are dealing with trying to match infinite sets, which can be done in many different ways. – Thomas Andrews Aug 15 '15 at 21:11
  • 2
    One way you could define an "infinite" such expression is to define it as an possibly infinite perfect binary tree - that is, a tree where every node has either zero or $2$ child nodes. This can go on infinitely. It's not really an expression, however. – Thomas Andrews Aug 15 '15 at 21:14
  • @Lehs Regarding definitions like $p = (()p)$, it is useful to make a distinction between finite and well-founded. In general when you have a recursive definition, you very much want to deal only with well-founded realizations. In general, this doesn't always mean finite. For example, all sets are well-founded in a similar sense (axiom of foundation), but they certainly aren't all finite. The definition $p = (()p)$ is not well-founded. –  Aug 15 '15 at 21:17
  • I think you are wrong about the Catalan numbers. Then you have to involve a wider definition that includes also expressions like $(()),(()()()),\dots$ The expressions above are binary only. – Lehs Aug 27 '15 at 09:07
3

If you want to handle infinite structures, there are various ways to model that, though you have to make some deliberate choices about which kind of infinity you want -- for example, are the solutions to $x=(()x)$ and $y=(()(()y))$ to count as the same or different "placeholders"? Or are you going to have multiple different solutions to $x=(()x)$?

It is possible if you are too careless to end up with proper-class many placeholders, in which case there is of course no set of them. But usually you won't need such extravagance.

One common approach would be to represent a "placeholder" with the possible paths through it, where a path is a finite sequence of words over the alphabet $\{\mathtt{car},\mathtt{cdr}\}$. A path set $A$ represents a placeholder if it satisfies these conditions:

  • $A$ is non-empty.
  • $A$ is closed under prefixes: If $wu\in A$, then $w\in A$ too. (In particular the empty word is in $A$).
  • If $w\in A$ then either $w.\mathtt{car}$ and $w.\mathtt{cdr}$ are both in $A$, or neither of them is.

This gives what Thomas Andrews described as "possibly infinite perfect binary trees".

Thus defined, the set of possibly infinite placeholders is the (unique, up to isomorphism) final coalgebra over the signature $\{\mathtt{nil}:\sigma, \mathtt{cons}:\sigma\times\sigma\to\sigma\}$ (that is, in more category-theoretic phrasing, the $\mathbf{Set}$-endofunctor that takes $X$ to $1\uplus X\times X$).

2

Yes, there is such a set. Furthermore, it is countable, and all placeholders are "finite" in the natural sense (i.e., they have finite rank as defined below). You can use the following basic pattern of definition by recursion to make precise any such definitions. Note that, in cases with only "finite branching", like yours, the definition @ThomasAndrews gave is equivalent and simpler. For any ordinal $\alpha$, define $P_\alpha$, the set of all placeholders of rank $\leq \alpha$, by recursion: $P_\alpha$ is comprised of:

  • $()$, together with
  • $(pq)$, for any placeholders $p$ and $q$ of rank strictly less than $\alpha$.

A priori, the collection of all placeholders is a class, since it is the collection of all placeholders of any ordinal rank. However, we can see in this (and similar) cases, that any placeholder must have finite rank. We proceed by transfinite induction on the rank. Assume we know that, for every placeholder of rank strictly less than $\alpha$, we know that the placeholder has finite rank, and consider any placeholder of rank $\leq \alpha$. If our placeholder is $()$, then it has rank 0, and we're done. If it is $(pq)$, we know that $p$ has some finite rank $n$ and $q$ has some finite rank $m$, so $(pq)$ has rank $\max(n,m) + 1$, which is finite. Therefore every placeholder actually has finite rank. This implies that the placeholders form a set, since we only need $\cup_{\alpha < \omega} P_\alpha$ to get them all. Finally, since it is an easy induction to see that each $P_n$ is finite for $n < \omega$, we can see that the set of placeholders is countable.

1

It's defined by ordinary recursion on $\mathbb{N}$, so it does exist.

Alternatively, as pointed out by coffeemath in the comments, you may also encode a placeholder as a finite sequence of open/close brackets $(, )$, and so once again there is a set of all placeholders (defined by subset selection on the set of all finite strings of brackets).

  • So there couldn't be any infinite patterns of the kind? – Lehs Aug 15 '15 at 21:03
  • @Lehs No. The most sensible definition that allows for the possibility of infinite patterns is the one I gave in my answer, and you can prove from that definition that there are in fact no infinite patterns. –  Aug 15 '15 at 21:13