taocp

This site has no text of the book. Keep your own copy of TAOCP next to it. See what is checked.

Exercise · Volume 1 · 2.3-12

Exercise 2.3-12

not stated yet in Lean solution written

RatingM23
MarkersM (mathematical)
KindK1, prove: show that a stated fact is true from the written solution
SectionSection 2.3 of Volume 1

The task

Find the condition that a partially ordered set must satisfy to correspond to an unordered tree or an unordered forest.

The exact wording is in your copy of the book.

Hints

Open one hint at a time. Try the exercise again after each.

Hint 1

In a forest, the ancestors of a node are linearly ordered. Make this the condition on the poset.

Hint 2

Define the parent of xx as the smallest element above xx.

Solution

Show the solution

Let ⪯\preceq be a partial order on a finite set PP. Write x≺yx \prec y for x⪯yx \preceq y and x≠yx \ne y, and read x≺yx \prec y as "yy is an ancestor of xx".

Condition. For every x∈Px \in P the set U(x)={y:x⪯y}U(x) = \{y : x \preceq y\} is a chain, that is, any two of its elements are comparable. In other words, if x⪯yx \preceq y and x⪯zx \preceq z then y⪯zy \preceq z or z⪯yz \preceq y.

Claim. A finite poset corresponds to an unordered forest if and only if the condition holds. It corresponds to a tree if and only if the condition holds and PP has a largest element.

Proof, forest to poset. In a finite unordered forest let x⪯yx \preceq y mean that yy is an ancestor of xx or y=xy = x. This is reflexive. It is transitive, because an ancestor of an ancestor is an ancestor. It is antisymmetric, because the level of a proper ancestor is smaller. The set U(x)U(x) is the set of nodes on the path from xx up to its root. By exercise 2.3-3 this path is a chain.

Proof, poset to forest. Let the condition hold. For x∈Px \in P the set U(x)∖{x}U(x) \setminus \{x\} is a finite chain. If it is not empty, it has a smallest element. Call it the parent of xx. If it is empty, call xx a root. Then the chain U(x)U(x) is xx, its parent, the parent of its parent, and so on up to a root. This is the path from xx to a root. So each element has at most one parent, and the elements above xx are exactly the ancestors in this parent relation. The elements with the same root form a tree. So PP is a forest, and its order relation is the ancestor relation.

The poset is one tree when there is one root. If PP has a largest element rr, then r∈U(x)r \in U(x) for every xx, and the top of the chain U(x)U(x) is rr, so rr is the only root. Conversely, with one root rr, every xx has rr at the top of its chain, so rr is largest.

The condition fails in a poset with elements x,y,zx, y, z where x≺yx \prec y, x≺zx \prec z and y,zy, z are not comparable. In it xx has two parents, which no forest allows.

Check

Python3 listed all partial orders on nn labelled elements for n=1,2,3,4n = 1, 2, 3, 4 and kept those where each set U(x)U(x) is a chain. The counts of partial orders are 1,3,19,2191, 3, 19, 219. The counts that satisfy the condition are 1,3,16,1251, 3, 16, 125. These equal (n+1)n−1(n+1)^{n-1}, which is the number of unordered rooted forests on nn labelled nodes.

Remarks

The infinite case needs one more condition, because a chain above xx may have no smallest element. See exercise 2.3-11 for nodes without parents.

This solution is drafted, and a person has not reviewed it yet. The source.

In Lean

not stated yet The exercise is not stated in Lean yet.

The status is computed from the Lean build. The node of the map.

Something is wrong? Report it.