Exercise · Volume 1 · 2.2.1-8
Exercise 2.2.1-8
not stated yet in Lean solution written
| Rating | 22 |
|---|---|
| Kind | K2, decide: say whether a claim holds from the written solution |
| Section | Section 2.2.1 of Volume 1 |
The task
Decide whether some permutation of cannot be obtained with a deque that has no restriction on either end.
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
For , count: there are permutations of . How many does the general deque give?
Hint 2
For , look at permutations that start with , and use the shape of the deque from Exercise 2.2.1-7.
Solution
Show the solution
Plan. Small has no failures. At a failure appears, and it carries over to all larger .
Case . A search over all move sequences gives all permutations. The only permutation of that neither restricted deque gives is , by Exercise 2.2.1-7. The general deque gives it as follows. Insert . Insert at the right end. Insert at the left end. Insert at the left end. The deque reads . Remove at the left end, then at the right end, then at the left end, then . The output is .
Case . The permutation cannot be obtained. The car is the last to enter, so all five cars have entered when it leaves. The cars entered in the order , each at one of the two ends. So the deque, read from left to right, falls to and then rises, and is at an end. After leaves, the cars stay in an arrangement of the same shape, with at one end. The next car out must be , so is at the other end. Say is at the left end. Then is the last car on the right side of , so that side holds and nothing else. Car lies on the left side, and the deque is . Remove . The ends are now and , but the output needs . This fails. If is at the right end, the mirror image of this argument applies.
The search shows that exactly four permutations of fail: , , , .
Case . Suppose a permutation of cars is obtained. Then the cars of any subset leave in the same relative order, by the same moves with the other cars ignored. So a permutation that holds the cars in this relative order cannot be obtained. An example is . Unobtainable permutations exist for every .
So the answer is: none for , and yes for every .
Check
A search over all move sequences gave obtainable permutations for . For this is . For it is . The four missing permutations of are those listed above.
Remarks
The count for is the start of the data for the open question of Exercise 2.2.1-13.
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.