Lukasiewicz Words and Paths

Lukasiewicz words are strings of natural numbers (n0) where each prefix of the string has a sum at least as large as its length and the string as a whole has a sum equal to its length. For example, 2,1,0 is a Lukasiewicz word since its sum and length are both 3, and all of its prefixes (2,1 and 2) have sums at least as large as their lengths.
A Lukasiewicz path of length n is a lattice path from (0,0) to (n,0) that never goes below the x-axis and which uses steps of the form (1,k) for integers k-1. Encoding each (1,k) step in a Lukasiewicz path as the integer k+1 yields a Lukasiewicz word. The Lukasiewicz word 401120100 and its corresponding Lukasiewicz path are displayed below.
an illustration of the Lukasiewicz path corresponding to the string 401120100

Generating Fixed Content Lukasiewicz Words

Definitions: Fixed Content and Left-Shifts

The paper I co-authored with Aaron Williams and presented at IWOCA 2022 presented an algorithm for exhaustively generating Lukasiewicz words with a fixed set of content. More specifically, given a multiset of integers, our algorithm generates all rearrangements of those integers that yield valid Lukasiewicz words. For example, the valid Lukasiewicz words obtainable by rearranging {0,1,2} are 210, 120, and 201. Note that 012,102, and 021, also rearrangements of the content set {0,1,2} but are not valid Lukasiewicz words because they each have at least one prefix with a sum smaller than its length. For a multiset to yield any valid Lukasiewicz words, it must have a sum equal to its cardinality.

Our algorithm generates all Lukasiewicz words with a given set of content using one left-shift per generated string. This means that each string generated by our algorithm differs from the previous string by shifting one symbol in the string to a different position to the left. For example, left-shifting the 2 in 310020 to the first position in the string yields 231000. We denote shifting the ith symbol of a string into the jth position as left(i,j). So, as before, executing left(5,1) on 310020 generates 231000.

Illustration

To illustrate our result, the 30 Lukasiewicz words with content {0,0,0,1,2,3} are displayed below in the order generated by our algorithm. The arrow on top of each Lukasiewicz word illustrates the left-shift used to transform the Lukasiewicz word into its successor: in the first row, shifts the 2 to the front of the string to generate 230100, the string in the next row.

Successor Rule

The strings in this figure are generated by a simple rule. First, we define the non-increasing prefix of a Łukasiewicz word to be the longest prefix of the string such that each symbol in the prefix is at most as large as the symbol before it. Unsurprisingly, this results in a prefix of the string that does not contain any 'increases' (from left to right) beteween successive symbols. For example, the non-increasing prefix of 320010 is 3200, as it is the longest prefix of 320010 that does not contain any increases. We will refer to the non increasing prefix of a string as ρ, the length of ρ as m, and the sum of all symbols in ρ as Σ(ρ). Given this definition, repeatedly applying the following rule to a Łukasiewicz word will generate wll Łukasiewicz words with its set of content.

Let a=a1,a2,...,an be a Lukasiewicz word of length n. To generate all Lukasiewicz words with the same content set as a, repeatedly apply the following successor rule, next(a). successor rule for Lukasiewicz words

As a example, let's consider applying next(a) to the first couple strings in the illustration.

next(302100): 302100 has non-increasing prefix 30 with length 2. Therefore, case 4b is applied: left(1,3) applied to 302100. This shifts the 2 to position 1 and genereates 230100

next(230100): 230100 has non-increasing prefix 3 with length 1. Therefore, case 4d is applied: left(2,3) is applied to 230100. This shifts the 0 into the second position, yielding 203100.

Repeatedly following this process will generate all Lukasiewicz words with content {0,0,0,1,2,3}.

Observations

A notable property of this successor rule is that it always shifts positive symbols to position 1 and zeroes to position 2. The successor rule can therefore be restated as the following two step process:

Find the symbol to shift Find the location to shift it to

Implementation

Goals

Challenges



Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent facilisis quam velit, vitae feugiat sapien lacinia non. Nulla in libero vitae risus tincidunt vestibulum sodales eu ante. Donec id lacinia ipsum. Nam pellentesque lacinia suscipit. Duis maximus metus vitae volutpat laoreet. Nulla facilisi. Ut sit amet nibh orci. Nulla nunc arcu, luctus id quam a, facilisis rhoncus dui. Aliquam egestas commodo nulla a eleifend. Quisque enim nisl, tempus pellentesque elementum eu, faucibus placerat mi. Etiam egestas tristique dapibus. Duis ultricies nisi et rutrum blandit. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In hendrerit est eros, nec dapibus leo volutpat ultrices. Nulla a est sed quam venenatis placerat. Nullam commodo, diam et congue pellentesque, odio tellus tristique quam, varius eleifend elit magna nec sem. Donec id arcu id dolor elementum lacinia a eget mauris. Sed porttitor metus eu feugiat lacinia. Aliquam erat volutpat. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus nunc elit, ultricies a metus eget, malesuada tincidunt sem. Aliquam dolor mi, euismod quis aliquam et, dignissim non erat. Duis massa tellus, porttitor id turpis convallis, tempus vehicula urna. Nam ac mollis magna, at dapibus nunc. Vestibulum tristique euismod fermentum. Maecenas sed sapien cursus, condimentum quam ut, faucibus massa. Etiam sit amet varius urna. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Fusce consectetur tincidunt erat, vel viverra velit rhoncus a. Mauris molestie varius dolor, quis ultricies nunc finibus non. Etiam facilisis odio ac imperdiet tempus. Donec vitae lectus egestas, elementum ante at, maximus urna. Vestibulum dictum, neque in ornare tincidunt, mi eros gravida leo, sit amet consequat orci ex ac leo. Sed a consequat orci. Fusce sed tempus ex. Duis ut dui pharetra, viverra arcu sed, sodales velit. Phasellus metus justo, fringilla eget facilisis quis, fringilla eget leo. Integer in fringilla massa, ac vehicula mi. Suspendisse maximus dolor eget leo gravida accumsan. Sed et placerat ante, vel tincidunt tellus. Curabitur varius eget nisi eget auctor. Donec nisl ex, condimentum ac ex a, tempus pretium velit. In venenatis, massa rutrum placerat lacinia, justo dolor vestibulum tortor, sit amet condimentum nisl nunc eu justo. Cras nunc dolor, elementum ac mi sit amet, auctor eleifend quam. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Phasellus ornare est mi, ut ornare enim bibendum et. Nulla nisi massa, euismod id sem a, convallis tincidunt nulla. Nulla aliquet augue velit, aliquam fringilla nisi scelerisque quis. Praesent pharetra scelerisque mattis. Sed mollis porta arcu in mollis. Aenean finibus massa a rutrum ultrices. Duis fermentum sollicitudin ultrices. Quisque congue turpis vitae lacus iaculis, vitae tempus nisl vestibulum. Ut euismod nulla metus, at mattis ipsum lacinia eu. Nullam sed lectus ac mauris auctor laoreet vel et urna. Quisque placerat erat turpis, iaculis euismod risus dapibus eget. Etiam pharetra est ante, in varius erat laoreet non. Curabitur at auctor diam. Sed dui odio, sagittis vitae ligula vel, euismod vehicula sem. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Duis efficitur ultrices ligula, eu dignissim nisl venenatis eu. Mauris nisi justo, blandit sit amet venenatis volutpat, cursus in metus. Aenean eros augue, laoreet a quam sit amet, feugiat pellentesque nibh. Aliquam erat volutpat.