Why is there 1 binary bracketing when n = 1?

149 Views Asked by At

My professor gave a question that started with: Imagine a unary alphabet with a single letter x. A (valid) bracketing B is a string over three symbols x, (, ) defined recursively as follows: (1) a single letter x is a bracketing, and (2) for any k >= 2, if B1,...,Bk are (valid) bracketings, then so is B = (B1B2...Bk). A bracketing B is called binary if rule (2) can only be applied with k = 2. Then length n of B is the number of x's it has(i.e., one ignores the parenthesis).

In his solution, he started out with "For n = 1, there is clearly only one binary bracketing."

My searches online led me to learn that it was related to Catalan Parantheses, which did not have "x". In the Catalan Parantheses, there was only 1 way to arrange 1 pair of brackets correctly: (). Using n-1 for the Catalan binomial coefficients also give a result of 1.

However, my searches online also led me to see the binary bracketings as bracketings that can be "resolved" with only binary operators. (xx)(xx) -> (y)(y) -> z all use binary operators, but (xx)xx -> yxx -> z would need a ternary operator.

Why is there 1 binary bracketing when n = 1 instead of 0 binary bracketings? How do you feed a single input into a binary operator? If "A bracketing B is called binary if rule (2) can only be applied with k = 2.", then why does n = 1 have a binary bracketing if k = 1 for n = 1? Is this a $2^0$ = 1 thing?

1

There are 1 best solutions below

9
On BEST ANSWER

The length of a string in the ternary alphabet is the number of $x$s it contains, so the string $$ x $$ is the only bracketing with one $x$. It is a bracketing by rule 1: "a single letter $x$ is a bracketing". No other string constructed by rules 1 and 2 has only one $x$, though this takes a few steps to show. Let $\ell(B)$ denote the length of $B$. Rule 1 gives us $B = x$ with $\ell(B) = 1$. Rule 2 (in the binary case) gives us $B = (B_1 B_2)$, as long as $B_1$ and $B_2$ are valid binary bracketings, with $\ell(B) = \ell(B_1) + \ell(B_2)$. As a consequence, $\ell(B) \geq \ell(B_1)$, with equality only if $\ell(B_2) = 0$, and similarly $\ell(B) \geq \ell(B_2)$. So rule 1 gives us a binary bracketing of length $1$ and rule $2$ gives us binary bracketings at least as long as the shorter of the $B_1$ and $B_2$ used to construct it. This means there are no $0$ length binary bracketings. Therefore, use of rule 2 strictly increases the length of a binary bracketing, eliminating the possibility of other binary bracketings having length $1$. Therefore, there is only one binary bracketing having length $1$ and it is $x$.

Notice that rule 2 also guarantees that any $B$ with $\ell(B) > 1$ has at least one pair of opening and closing parentheses. This means $xx$ is not a binary bracketing produced by rules 1 and 2 and neither is any longer string of $x$s without brackets.

It might help to realize that, relative to the references you are reading about Catalan Parentheses, the symbol "$x$" used here represents an empty pair of parentheses "$()$". If you picture a bracketing as a fork in a tree, the whole bracketing corresponds to the base of the tree, where it meets the ground. Since we only apply rule 2 with $k=2$, every fork is 2-way, that is, it is a binary fork. Then the outermost application of rule 2 gives the first forking to two branches. Nested applications of rule 2 give further forkings. All binary bracketing forkings eventually terminate with "$x$"s and all Catalan Parentheses forkings eventually terminate with "$()$"s. These two substrings are serving similar purposes in the two problems.

Regarding the operators re-setting of the problem. Definitely, "$(xx)xx$" requires a ternary operator. Since $xx$ is not a valid binary bracketing by rules 1 and 2, we must have $$ \underbrace{(xx)}_{B_1} \underbrace{x}_{B_2} \underbrace{x}_{B_3} \text{,} $$ which is not a binary bracketing. This does require that $k = 3$ be permitted in rule 2, which is not the case for binary bracketing.