Right-Cancellability of a Family of Operations on Binary Trees

We prove some new results on a family of operations on binary trees, some of which are similar to addition, multiplication and exponentiation for natural numbers. The main result is that each operation in the family is right-cancellable.


Introduction
The product ✂✁ ☎✄ , where and ✄ are positive integers, can be expressed as the sum of ✄ terms, each being equal to .Similarly, ✝✆ can be expressed as the product of ✄ factors, each being equal to .This basically works well because the sum and product operations for integers are associative; to push this process one level further (i.e.define a new operation by iterating exponentiation), one needs to decides on how to order the operations in the expression ✟✞ ✠ ✟✞ ✡✁ ☛✁ ☞✁ ☞✞ ✌ (where ✞ is the exponentiation operation).
One solution is to always perform the operations in a fixed order, usually right-to-left (see Blackley and Borosh [1] or Knuth [2]).Another, richer solution is to use the structure of a binary tree to set the order, and use binary trees instead of integers.
Blondel [3,4] defines a family of operations on binary trees.Each new operation is defined in terms of the preceding one.The first three operations are generalizations of addition, multiplication and exponentiation for positive integers, while the others have no natural counterpart among positive integers.
The first operation, ✍ ✁ , is defined in the following way: if and ✄ are binary trees, ✍ ✁ ✄ is the binary tree whose left subtree is , and whose right subtree is ✄ .Writing trees as parentheses systems, this translates to ✍ ✁ ✄ ✏✎ ✒✑ ✓ ✔✄ ✖✕ .
Operation ✗ ✁ is defined recursively using ✗ ✙✘ ✚✍ ✁ : Another way of defining ✗ ✁ is that the shape of tree ✄ indicates an order in which to compute the ✗ ✝✘ ✥✍ ✁ - product of ✬ copies of , ✬ being the number of leaves of ✄ .For example, Using the number of leaves as the weight, operations ✍ ✁ , ✰ ✁ and ✱ ✁ act as the natural operations of addition, multiplication, and exponentiation, respectively: Our main result is the proof of a conjecture given by Blondel, which states that all the operations ✗ ✁ are right-cancellable, i.e. for any integer ✷ and trees , ✄ and ✸ , ✗ ✁ ✄ ✹✎ ✸ ✂✗ ✁ ✄ implies ✌✎ ✸ .This result is easy to prove for ✷ ✎ ✒✺ ✙✻ ✤✼ ✽✻ ✤✾ ; we show that it holds for all ✷ ✡✿ ✾ .
Sect. 2 introduces a few notations, and recalls some definitions and results on the family of operations.In Sect.3, the conjecture is reduced to a particular case.The partial ordering defined in Sect. 4 has no direct use in the proof, but appears to be the best to obtain growth results.Sect. 5 redefines the operations using the notion of synthetic attributes, and Sect.6 finally gives the proof of the conjecture.

Notation
The weight (number of leaves) of a tree ✄ will be written ✲ ✄ ✲ .When dealing with a word ❀ , ✲ ❀ ❁✲ will denote its length.Blondel [3] proves several algebraic properties of the ✗ ✁ operations, a few of which are recalled below.
✛ ✱ ✁ ✄ depends only on the weight of ✄ , not on its shape, which justifies the use of notation ✱ ✁ ✲ ✄ ✲ .
✛ All operations ✗ ✁ with ✷ ▼▲ ✾ can be defined in terms of ✱ ✁ the following way : ✗ where the natural number ✢ ✗ ✄ is defined inductively by: ✛ Each tree has a unique factorization into an ordered ✰ ✁ -product of prime binary trees, i.e. trees that cannot be further factorized.Any tree with a prime number of leaves is clearly prime, but the reverse is not true.

Preliminary Lemma
To prove the conjecture, we will first reduce it to a simpler form using the following lemmas: Lemma 1 Let , ✄ , ✸ and ) be four binary trees, with ❭❬ ✎ ✛ and ✸ ❬ ✎ ✛ , and let ✷ and ✷ ✔( be integers no smaller than 3.
, then there is a binary tree ❴ and two integers ❵ and ✬ such that ✌✎ ❴ ❚ and ✸ ✎ ❴ ❲ .

Partial Ordering of Binary Trees
Operation ✰ ✁ can be described geometrically in the following way : ✰ ✁ ✄ is obtained by changing every leaf of ✄ into a copy of .Thus, since ❴ ❚ ❱❯ ✍ ✎ ❴ ✁ ❴ ❚ , we can see that successive powers of a single tree ❴ are prefixes of each other, in the sense that a copy of ❴ ❚ with the same root is included in ❴ ❚ ❱❯ ✍ .This property is not limited to powers of a single tree (the same relationship exists between ✄ and ◗✁ ☎✄ ), but we will only consider such a situation when defining a partial ordering on the set of binary trees.
Definition 2 Two binary trees and ✄ are called comparable if there exist a tree ❴ and two integers ✬ and ❵ , such that ❁✎ ❴ ❚ and ✄ ✏✎ ❴ ❲ .We will then write ❑⑥ ⑦✄ if ✬ ⑥ ❵ .The above definition is correct: if more than one tree ❴ can be chosen, ✬ and ❵ will always be in the same order whatever the chosen tree.The defined relation is a partial ordering on the set of binary trees : Using this partial ordering, minimal elements are those trees that are not a power of some other tree.Each minimal element is comparable only to its powers, and the order is exactly that of the exponents.Finally, each tree is comparable to exactly one minimal element.This partial ordering is not explicitly used in the proof of the conjecture.It is only given here because it is the underlying ordering that is somewhat compatible with the ✗ ✁ operations and related functions (in the sense that ❄⑥ ✜✄ implies ✑ ✓ ✗ ✁ ✸ ✕ ✹⑥ ❽✑ ★✄ ✗ ✁ ✸ and ✑ ✸ ✂✗ ✁ ❱✕ ❾⑥ ❿✑ ✸ ✂✗ ✁ ✄ ✖✕ , when ✷ ➀▲ ✾ ).Obtaining similar properties for more 'natural' orderings (like those obtained by considering prefix trees, or prime factorizations as subwords or factors of each other) has proved to be difficult.

Definition 3
Let ✷ ➁▲ ✾ be an integer, and ❴ a binary tree.We define ➂ ☞➃ ✔➄ ✗ as the function of two integer variables ✬ and ❵ defined by This function is thus strictly increasing according to ❵ (as long as ❴ ❬ ✎ ✛ ), and increasing (in fact, constant) according to ✬ .The proof of the conjecture is based on proving that, for each ✷ ✒✿ ✾ , ➂ ➃ ✔➄ ✗ is strictly increasing according to both its variables.This translates to the following: operations ✗ and ✗ ✁ are compatible with the ordering defined above as long as their operands are comparable.
Surprisingly enough, having be a prefix of ✄ is not sufficient, as can be seen by taking

Redefining Operations ✷ ➑
We now show that operations ✗ ✁ and the related ➂ ☞➃ ✔➄ ✗ functions can be defined in terms of a very particular case of synthetic attributes.Attributes are normally associated to a context-free grammar (see Knuth [5] for a detailed definition), which is a formal rewriting system used to recursively define the structure of the combinatorial objects studied.In the case of binary trees, the simplest thing to do is to say that a binary tree is either the single node ✛ , either composed of left and right subtrees which themselves are binary trees.This translates into the formal grammar ➒ ✎ ✛ ✳ ✑ ➒ ✁ ➒ ✕ , which is the underlying grammar in all the attributes defined below.
A synthetic attribute can be defined on a binary tree by choosing a two-variable function ➂ (the 'computing rule') and a value to be given to each leaf in the tree (➂ should be defined on ➓ →➔ ➁➓ with values in ➓ , where ➓ is some domain including all values given to leaves).This allows us to compute a value (attribute) for each node in the tree, using the following recurrence rule: if the left and right sons, respectively, of an internal node, have values ➣ and ↔ , then the node has value ➂ ✑ ➣ ✻ ↔ ✕ .The attribute for the tree is the value of its root node.
Using this context, the definition for ✗ ✁ ✄ can be translated into a synthetic attribute computed on binary tree ✄ : ✛ each leaf in ✄ has value ; ✛ the computing rule is ✗ ✙✘ ✚✍ ✁ : if the left and right sons of an internal node have respective values ❴ and ↕ , this node has value ❴ ✹✗ ✝✘ ✥✍ ✁ ↕ .This description of ✗ ✁ corresponds to the fact that, when computing ✗ ✁ ✄ , the shape of tree ✄ indicates exactly how to associate terms in the calculus of ✗ ✙✘ ✚✍ ✁ ➛➙ ☞➙ ☞➙ ➜ ✗ ✝✘ ✥✍ ✁ (where appears ✲ ✄ ✲ times), since this expression is ambiguous whenever ✷ ❬ ✎ ➅✾ .For example, if ✄ is the tree in Figure 3  Proof.Recall that ❴ ❲ ✹❯ ✍ is obtained by replacing all leaves of ❴ ❲ by copies of ❴ , so while computing ➂ ➃ ✔➄ ✗ ✑ ✬ ✻ ❵ ❽✳ ✺ ☛✕ as an attribute on ❴ ❲ ✹❯ ✍ , all internal nodes that are leaves in the prefix tree ❴ ❲ (the roots of copies of ❴ ) have value ➂ ➃ ✔➄ ✗ ✑ ✬ ✻ ☛✺ ☞✕ .Thus, the value of the root node is not changed when these nodes are considered as leaves with value ➂ ➃ ✔➄ ✗ ✑ ✬ ✻ ☞✺ ☛✕ .② Given a binary tree of weight ✬ and a computing rule ➂ , we can now define a function of ✬ variables as follows: ➳ ✑ ✓➵ ✍ ✻ ☞✁ ☛✁ ☞✁ ✮✻ ✤➵ ❚ ✕ is the attribute computed with rule ➂ on tree if the leaves (in prefix or symmetric order) have respective values ➵ ✍ ✻ ☞✁ ☛✁ ☞✁ ✤✻ ➲➵ ❚ .We will use two very simple results: ✛ Initial values growth property: assume the computing rule ➂ is weakly increasing with respect to both its variables; then the resulting function ➳ is also weakly increasing with respect to all of its variables.If ➂ is additionally strictly increasing with respect to its first variable, then ➳ is strictly increasing with respect to its first variable.If ➂ is strictly increasing with respect to all its variables, then so is ➳ .✛ Tree branches growth property: if ➂ is weakly increasing with respect to one of its variables and strictly increasing with respect to the other, and if for some integer ❵ we have ➂ ✑ ❵ ✻ ❵ ✕ ✿ ➸❵ , then ➳ ✑ ★➵ ✍ ✻ ☞✁ ☞✁ ☛✁ ✤✻ ✤➵ ❚ ✕ ✿ ➸➺ ❄➻ ➧➼ ✑ ✓➵ ✍ ✻ ☛✁ ☞✁ ☛✁ ✤✻ ✤➵ ❚ ✕ provided the minimum is at least ❵ (which is always true if the domain for ➂ is restricted to pairs of positive integers).
These results are easily proved by induction on the height of tree .
We are now ready to state and prove the main property: Proposition 5 Set ✷ ✒✿ ✾ an integer, and ❴ a binary tree, ❴ ❬ ✎ ✛ .Then the ➂ ☞➃ ✔➄ ✗ function is strictly increasing with respect to each of its variables.
Proof.The proof is by induction on ✷ .