(math) Weak compositions as products of compositions and weak compositions
Let us start by recalling the definitions of compositions and weak compositions. A composition of of length is a list of positive integers that sum to . A weak composition is the same idea but we are allowed to use zeros. Denote the former set by and the set of weak compositions of of length by . The list and .
I am going to prove the following result for ,
but before I do that, I wanna tell you how I ended here in the first place. A project of mine looks at the behavior of the statistic on weak compositions. The details of this function don't matter at the moment. If I want to understand this function for an input composition , I first need to compute it on a subset of weak compositions and sum all the outputs. What is this particular subset? These are all the weak compositions of length which yield when I remove all the zeros and preserve the order of entries. So, for a composition and , the subset would include the weak compositions , and so on. One method to generate this subset is to start with the composition, and insert zeros between the entries. For a composition of length , there are spots to insert the zeros, and I can choose how to insert them.
Okay, it's now time for the proof! I will use exponential notation which means that appears times consecutively. If , then is the empty string.
Proof. First pick . Define to be the composition obtained by removing all the zeros in while preserving the order of the entries. Suppose has entries, then let be a weak composition where is the number of zeros in the beginning of , for is the number of zeros to the right of and to the left of , and is the number of zeros at the end of . This gives us the map from to the pair .
On the other hand, if we start with , then we can define , which is an element of .
Bonus: the way to generate weak compositions in SageMath is by using IntegerVectors.