• 検索結果がありません。

1Introduction PhilippeDuchon Right-cancellabilityofafamilyofoperationsonbinarytrees

N/A
N/A
Protected

Academic year: 2022

シェア "1Introduction PhilippeDuchon Right-cancellabilityofafamilyofoperationsonbinarytrees"

Copied!
7
0
0

読み込み中.... (全文を見る)

全文

(1)

Right-cancellability of a family of operations on binary trees

Philippe Duchon

LaBRI, U.R.A. CNRS 1304, Universit´e Bordeaux 1, 33405 Talence, France E-Mail:[email protected]

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

Keywords: binary trees

1 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 exponen- tiation 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 :

- .

- if !", then # $!% .

1365–8050 c& 1998 Maison de l’Informatique et des Math ´ematiques Discr`etes (MIMD), Paris, France

(2)

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: - - - -/.- -,- + - - -- -, and- , - - -10 0.

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 integer2 and trees , and3, 4 3 implies 3. This result is easy to prove for2 567869 ; we show that it holds for all2: 9 .

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.

2 Notation

The weight (number of leaves) of a tree will be written- -. When dealing with a word; ,-;<- will denote its length.

=?>A@@BCBCDE@/B @BCBCDDD

=F>G@/B @B @/B @BCBCDDDD

For any tree

H

,

HIJ =K> HIJ =F

Fig. 1: Two trees with weight 5.

Blondel [3] proves several algebraic properties of the operations, a few of which are recalled below.

Only operation+ is associative.

(3)

No is commutative.

,

depends only on the weight of , not on its shape, which justifies the use of notation , - -.

All operations with2ML 9 can be defined in terms of, the following way : NO ,#P

/, where the natural numberP

is defined inductively by:

P

,

- -

P

5

P

C!*P

8P

!"

if2?: 9 .

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.

Since operation+ acts somewhat like multiplication, we will write Q for + . Similarly, since , does not depend upon the shape of tree but only on its weight, and is only the result ofRS (with- - factors), we will write 0 0 for , .

Using these notations, we have the familiar propertyTVUWOXTW (this translates into , 3 Y

,

+

, 3

, which follows from the definitions of, and).

3 Preliminary Lemma

To prove the conjecture, we will first reduce it to a simpler form using the following lemmas:

Lemma 1 Let , ,3 andZ be four binary trees, with\[ and3 [ , and let2 and2] be integers no smaller than 3.

If 3E^ Z , then there is a binary tree_ and two integers` and' such that _ T and3 _ W . Proof. We can rewrite abcQd/e and 3^ Z 3f d e

^g

, so we only need to prove the lemma for

2 2]

h9 .

Consider the factorization of and3 into products of prime trees, and write them as wordsi andj on the (infinite) alphabet of prime trees. The factorizations ofk and3l are, respectively,i repeatedm times, andj repeatedn times (writteni k andjl, but bear in mind that -i k - m8-io-). -i-, here, is the number of (not necessarily distinct) prime trees involved in the factorization of .

SincekoX l , the same applies to the words: i kN jl. Letp be the gcd of -io- and-jq-, andr the left factor of lengthp of bothi andj . Sincei , repeatedm times, is the same asj , repeatedn times, it follows thati r0s*0t(u , andj r0v*0t(u .

Converting r back into a binary tree, we get exactly h _ T and a _ W with ' -io-wxp and

` -jq-wp . y

Using this lemma, we can reduce the conjecture to the case where trees and3 are powers of a common tree_ , which means we only need to prove that, when' and` are different integers,_ T and_ W are different. In fact, when'{zO` , _ WY is a vastly larger tree (in most sensible senses of ‘larger’, including the one defined in the next section) than_ TQ , but we will only prove that _ T8 is a strict subtree of _ W| .

(4)

4 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_ TVU _ _ T , we can see that successive powers of a single tree_ are prefixes of each other, in the sense that a copy of_ T with the same root is included in_ TVU . This property is not limited to powers of a single tree (the same relationship exists between andQ ), 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< _ T and _ W . We will then writeK}~ 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 : since-_ T - -_-T , the relation is the weight semi-ordering, restricted to pairs of trees that are powers of a common tree.

€ € € €

Leaves of

€  €*

Fig. 2: The identity‚ƒ„…†‡‚8ˆ‚ƒ .

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 3 4}‰# 3 and3 VŠ}‹3 , when2ŒL 9 ). 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.

(5)

Definition 3 Let2L 9 be an integer, and_ a binary tree. We defineŽ

as the function of two integer variables' and` defined by

Ž



' 6 `

"

_ T 8P

_ W

or, equivalently,

_ T _ W

_ T

“’”•

e/–T  W˜—

_ Tš™

’”•

e$–T  W4—

When 2 ›9 , Ž 

,

is simple: Ž 

, ' 6 `

-_ W - -_*-

W . 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 2: 9 , Ž 

is strictly increasing according to both its variables. This translates to the following: operationsP

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) ( and) () : is a prefix of, but , is not a prefix of , .

5 Redefining Operations

2

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 ‘com- puting 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, respec- tively, of an internal node, have values¢ and£ , then the node has valueŽ ¢ 6 £ . 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_4 ¤ .

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 whenever2 ‘9[ . For example, if is the tree in Figure 3 (4X) ), is

V

.

When computing Ž

' 6 `

, we get : Ž

' 6 `

is the synthetic attribute value for tree _ W when leaves have value-_*-T and the computing rule isŽ .

¨

There is a ‘left, right, right, left, right, right’ path from the root in©ª«­¬­®®¯, but not in°Eª«±¬­®®¯

(6)

² ³ ´ µR@

²¶³

D

µR@·µR@

²¶³

D

¶´

D

Fig. 3: An example of synthetic attribute.

Proposition 4 (ComputingŽ 

' 6

`‘.

5 on_ W ) Ž 

' 6

`.

5 can be computed as an attribute on

_ W

(instead of_ W4U ), still using computing ruleŽ  , by giving leaves a value ofŽ 

'

65 instead of

-_- T .

Proof. Recall that _ W4U is obtained by replacing all leaves of_ W by copies of _ , so while computing

Ž 

' 6

`‰.

5 as an attribute on_ W4U , all internal nodes that are leaves in the prefix tree_ W (the roots of copies of_ ) have valueŽ 

'

65. Thus, the value of the root node is not changed when these nodes are considered as leaves with valueŽ 

'

65. y

Given a binary tree of weight' and a computing ruleŽ , we can now define a function of' variables as follows:¸ ¹

6)6¹

T

is the attribute computed with ruleŽ on tree if the leaves (in prefix or symmetric order) have respective values¹

66·¹

T . 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Ž ` 6 ` :º` , then

¸

66¹

T :º»?¼±½

¹

66¹

T

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 2: 9 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 on2 .

Assume2 ¿¾ , and recall thatŽÀ ' 6 ` is obtained by computing a synthetic attribute on tree_ W with computing rule Ž

,

and leaf values all set to -_-T . NowŽ

, ' 6 ` R

-_-

W , so this function is strictly increasing with respect to variable` (and constant with respect to variable ' ). By the

(7)

initial values growth property, we can deduce thatŽÀ is strictly increasing with respect to variable

' (if' increases, all leaf values increase).

Now recall thatŽ À ' 6 `X. 5 can also be obtained by computing the synthetic attribute on tree

_ W

, with leaf valuesŽ À ' 65. Using the tree branches growth property on the computation for

ŽÀ '

65 (which uses tree _ and leaf values -_*-T ), we have ŽÀ ' 65 :Á-_*-T , which in turns implies (by the initial values growth property) thatŽÀ ' 6 `‰. 5 :ŽÀ ' 6 ` . This proves that

ŽÀ is strictly increasing with respect to both its variables.

Now set2: ¾ such that the stated property holds for2Kà 5 . ReplacingŽÀ andŽ

,

byŽ

and

Ž , respectively, in the above proof, we prove thatŽ

is itself strictly increasing with respect to both its variables, thus ending the proof.

y

6 Proof of the Conjecture

We will now prove the following:

Theorem 6 (Right-cancellation) Set2K: 9 an integer, and , ,3 three binary trees. If 3 , then

3.

Proof. We have already shown that we only need prove this theorem when and3 are powers of some common tree _ , i.e. if _ TQ _ W , then ' ` (this is only true if _ [ , but the case when

_

reduces to 3 anyway).

We will in fact prove that'?ÄÅ _ TQ8P

is strictly increasing. Recall that_ T88P

can be computed as a synthetic attribute on tree , using Ž  as the computing rule and -_*-T as leaf value. Now, we know from Proposition 5 thatŽ is strictly increasing with respect to both its variables, which is enough to prove (thanks to the initial values growth property) that_ TƚP

increases strictly with' .

Now since-_ T8 - -_-Tš™–­–Ç —de)—, this in turns implies that-_ TQ - increases strictly with' , thus

_ T8

and_ WY can only be equal if' ` . y

References

[1] Blakley, G. R. and Borosh, I. (1979). Knuth’s iterated powers. Adv. in Math., 34: 109–136.

[2] Knuth, D. E. (1976). Mathematics and computer science: coping with finiteness. Science, 194: 1235–

1242.

[3] Blondel, V. (to appear). Properties of a hierarchy of operations on binary trees. Acta Informatica.

[4] Blondel, V. (1995). Une famille d’op´erations sur les arbres binaires. C. R. Acad. Sci. Paris, S´erie 1, 321: 491–494.

[5] Knuth, D. E. (1968). Semantics of context-free languages. Math. Systems Theory, 2: 127–145.

参照

関連したドキュメント

At each turn, players Left and Right select a pile and remove a certain number of stones from it, subjected to the following conditions.. In a bLue pile, Left may only remove an

Geng, On the critical dimension of a semilinear degenerate elliptic equation involving critical Sobolev-Hardy exponent, Nonlinear Anal.. Gazzola, Existence of solutions for

In fact, the paper originated from a discussion with Doron Zeilberger, when he explained to the first author how he verified the quantum MacMahon Master identity for each fixed r

We argue inductively for a tree node that the graph constructed by processing each of the child nodes of that node contains two root vertices and that these roots are available for

This technique allows us to obtain the space regularity of the unique strict solution for our problem.. Little H¨ older space; sum of linear operators;

689 one can find a list of papers treating problems from physics which can be connected with equation (3.1). But there are only a few papers with equations containing the both kinds

A commutative ring A is a principal ideal quasi-Frobenius ring iff every finitely generated ideal of A is principal and every p-injective A-module is injective and flat.. question:

Here these rules are used to obtain monotonicity patterns of the ratios of the pairwise dis- tances between the vertices of the Lambert and Saccheri quadrilaterals in the Poincaré