Skip to content

Commit

Permalink
gh-35060: a bijectionist's toolkit
Browse files Browse the repository at this point in the history
We provide a toolkit for the combinatorialist to help find functions
("statistics") s: A -> Z and bijections A -> B given sequences of finite
sets A and B that satisfy various constraints.

Closes #33238

### 📝 Checklist

- [x] I have made sure that the title is self-explanatory and the
description concisely explains the PR.
- [x] I have linked an issue or discussion.
- [x] I have created tests covering the changes.
- [x] I have updated the documentation accordingly.

URL: #35060
Reported by: Martin Rubey
Reviewer(s): Martin Rubey, Matthias Köppe, Travis Scrimshaw
  • Loading branch information
Release Manager committed Mar 11, 2023
2 parents 1aa2370 + a72bd65 commit d6c38e5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 36 deletions.
6 changes: 3 additions & 3 deletions build/pkgs/configure/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tarball=configure-VERSION.tar.gz
sha1=387297d7e488eb9db6de3ceb80e204d2bdedcfdf
md5=21203b7dbe667c4633c98139bb1b51fb
cksum=4016304194
sha1=7b3a894056b94b6a8c83596e7d116fa7eaf3abc9
md5=64679ca3d2223ceed53d9a93edf8eafe
cksum=2254406620
2 changes: 1 addition & 1 deletion build/pkgs/configure/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
96f5cd2fb8aa1a83f1e0ae8112883a64e79031e5
200b6b70e21670d0867e0076fc5d943f238d2b8a
55 changes: 23 additions & 32 deletions src/sage/combinat/bijectionist.py
Original file line number Diff line number Diff line change
Expand Up @@ -1575,41 +1575,32 @@ def _forced_constant_blocks(self):
sage: bij.set_statistics((alpha1, beta1), (alpha2, beta2))
sage: from sage.combinat.cyclic_sieving_phenomenon import orbit_decomposition
sage: bij.set_constant_blocks(orbit_decomposition(A, rotate_permutation))
sage: for p in bij.constant_blocks(): print(list(p))
[[2, 1, 3, 4], [1, 2, 4, 3], [1, 3, 2, 4], [4, 2, 3, 1]]
[[3, 2, 1], [1, 3, 2], [2, 1, 3]]
[[2, 4, 3, 1], [3, 2, 4, 1], [2, 3, 1, 4], [1, 3, 4, 2]]
[[1, 4, 2, 3], [3, 1, 2, 4], [4, 2, 1, 3], [4, 1, 3, 2]]
sage: P = bij.constant_blocks()
sage: P = [sorted(p, key=lambda p: (len(p), p)) for p in P]
sage: P = sorted(P, key=lambda p: (len(next(iter(p))), len(p)))
sage: for p in P:
....: print(p)
[[1, 3, 2], [2, 1, 3], [3, 2, 1]]
[[1, 4, 3, 2], [3, 2, 1, 4]]
[[2, 1, 4, 3], [4, 3, 2, 1]]
[[2, 4, 1, 3], [3, 4, 2, 1], [4, 3, 1, 2], [3, 1, 4, 2]]
sage: for p in bij.constant_blocks(optimal=True): sorted(p, key=len)
[[1, 2, 4, 3], [1, 3, 2, 4], [2, 1, 3, 4], [4, 2, 3, 1]]
[[1, 3, 4, 2], [2, 3, 1, 4], [2, 4, 3, 1], [3, 2, 4, 1]]
[[1, 4, 2, 3], [3, 1, 2, 4], [4, 1, 3, 2], [4, 2, 1, 3]]
[[2, 4, 1, 3], [3, 1, 4, 2], [3, 4, 2, 1], [4, 3, 1, 2]]
sage: P = bij.constant_blocks(optimal=True)
sage: P = [sorted(p, key=lambda p: (len(p), p)) for p in P]
sage: P = sorted(P, key=lambda p: (len(next(iter(p))), len(p)))
sage: for p in P:
....: print(p)
[[1], [1, 2], [1, 2, 3], [1, 2, 3, 4]]
[[1, 3, 2],
[2, 1, 3],
[3, 2, 1],
[2, 3, 4, 1],
[1, 3, 4, 2],
[2, 1, 3, 4],
[1, 3, 2, 4],
[2, 3, 1, 4],
[1, 2, 4, 3],
[3, 2, 4, 1],
[2, 1, 4, 3],
[2, 4, 3, 1],
[4, 2, 3, 1],
[4, 3, 2, 1],
[1, 4, 3, 2],
[3, 2, 1, 4]]
[[1, 4, 2, 3],
[4, 2, 1, 3],
[2, 4, 1, 3],
[4, 3, 1, 2],
[4, 1, 3, 2],
[3, 4, 2, 1],
[3, 1, 2, 4],
[3, 1, 4, 2]]
[[1, 3, 2], [2, 1, 3], [3, 2, 1],
[1, 2, 4, 3], [1, 3, 2, 4], [1, 3, 4, 2], [1, 4, 3, 2],
[2, 1, 3, 4], [2, 1, 4, 3], [2, 3, 1, 4], [2, 3, 4, 1],
[2, 4, 3, 1], [3, 2, 1, 4], [3, 2, 4, 1], [4, 2, 3, 1],
[4, 3, 2, 1]]
[[1, 4, 2, 3], [2, 4, 1, 3], [3, 1, 2, 4], [3, 1, 4, 2],
[3, 4, 2, 1], [4, 1, 3, 2], [4, 2, 1, 3], [4, 3, 1, 2]]
The permutation `[2, 1]` is in none of these blocks::
Expand Down

0 comments on commit d6c38e5

Please sign in to comment.