kdrag.solvers.kb.string.shortlex_swap
- kdrag.solvers.kb.string.shortlex_swap(s, t)
Order by length, then tie break by contents lexicographically. Returns a tuple (s’, t’) where t’ is the “shorter” or “smaller” of the two. Asserts False if s and t are equal.
>>> shortlex_swap((1,2,3), (0,0)) ((1, 2, 3), (0, 0)) >>> shortlex_swap((1,2,3), (1,2,4)) ((1, 2, 4), (1, 2, 3))