Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/libsemigroups.bib
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@

%% Saved with string encoding Unicode (UTF-8)

@article{Luo2026aa,
author = {Luo, Yan Feng and Xie, Jia Jia and Zhang, Wen Ting},
title = {A presentation of the grammic monoid},
journal = {Semigroup Forum},
volume = {113},
number = {2},
pages = {575--593},
year = {2026},
doi = {10.1007/s00233-026-10671-1},
url = {https://doi.org/10.1007/s00233-026-10671-1}
}

@misc{Hivert2026aa,
author = {Hivert, Florent and Scott, Jeanne},
title = {Diagrammatic {Okada} monoid and cellularity of the {Okada} algebra},
Expand Down
31 changes: 31 additions & 0 deletions include/libsemigroups/presentation-examples.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ namespace libsemigroups {
Presentation<word_type> dual_symmetric_inverse_monoid(size_t n);
Presentation<word_type> fibonacci_semigroup(size_t r, size_t n);
Presentation<word_type> full_transformation_monoid(size_t n);
Presentation<word_type> grammic_monoid(size_t n);
Presentation<word_type> hypo_plactic_monoid(size_t n);
Presentation<word_type> monogenic_semigroup(size_t m, size_t r);
Presentation<word_type> motzkin_monoid(size_t n);
Expand Down Expand Up @@ -336,6 +337,22 @@ namespace libsemigroups {
[[nodiscard]] Presentation<word_type>
full_transformation_monoid_MW24_b(size_t n);

//! \brief A presentation for the grammic monoid.
//!
//! This function returns a monoid presentation defining the grammic monoid
//! with \p n generators, as in Theorem 3.17 of \cite Luo2026aa.
//!
//! This presentation consists of the Knuth relations from
//! \ref plactic_monoid_Knu70 together with \f$dbac = badc\f$ for all
//! \f$0 \leq a < b \leq c < d < n\f$.
//!
//! \param n the number of generators.
//!
//! \returns A value of type `Presentation<word_type>`.
//!
//! \throws LibsemigroupsException if `n < 1`.
[[nodiscard]] Presentation<word_type> grammic_monoid_LXZ26(size_t n);

//! \brief A presentation for the hypoplactic monoid.
//!
//! This function returns a presentation for the hypoplactic monoid with
Expand Down Expand Up @@ -1019,6 +1036,20 @@ namespace libsemigroups {
//! * `full_transformation_monoid_MW24_b`.
[[nodiscard]] Presentation<word_type> full_transformation_monoid(size_t n);

//! \copydoc grammic_monoid_LXZ26
//!
//! \note
//! This function performs exactly the same as `grammic_monoid_LXZ26`,
//! and exists as a convenience function for when a presentation for the
//! grammic monoid is required, but the relations of the presentation are
//! not important.
//!
//! \sa
//! `grammic_monoid_LXZ26`.
[[nodiscard]] inline Presentation<word_type> grammic_monoid(size_t n) {
return grammic_monoid_LXZ26(n);
}

//! \copydoc hypo_plactic_monoid_Nov00
//!
//! \note
Expand Down
19 changes: 19 additions & 0 deletions src/presentation-examples.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,25 @@ namespace libsemigroups {
return p;
}

// Theorem 3.17 of https://doi.org/10.1007/s00233-026-10671-1.
Presentation<word_type> grammic_monoid_LXZ26(size_t n) {
auto p = plactic_monoid_Knu70(n);
p.contains_empty_word(true);
// Use dbac = badc as in the abstract; the Knuth relations identify
// badc and bdac, the right-hand side used in Equation (3.3).
for (size_t d = 2; d < n; ++d) {
for (size_t c = 1; c < d; ++c) {
for (size_t b = 1; b <= c; ++b) {
for (size_t a = 0; a < b; ++a) {
presentation::add_rule_no_checks(
p, word_type({d, b, a, c}), word_type({b, a, d, c}));
}
}
}
}
return p;
}

Presentation<word_type> catalan_monoid_Sol96(size_t n) {
if (n < 1) {
LIBSEMIGROUPS_EXCEPTION(
Expand Down
67 changes: 67 additions & 0 deletions tests/test-presentation-examples-2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,4 +320,71 @@ namespace libsemigroups {
REQUIRE(kb.number_of_classes() == POSITIVE_INFINITY);
}

LIBSEMIGROUPS_TEST_CASE("Example",
"110",
"grammic_monoid arguments and small ranks",
"[quick][presentation-examples]") {
REQUIRE_THROWS_AS(grammic_monoid(0), LibsemigroupsException);
REQUIRE_THROWS_AS(grammic_monoid_LXZ26(0), LibsemigroupsException);

auto p = grammic_monoid(1);
REQUIRE(p.alphabet() == 0_w);
REQUIRE(p.rules.empty());
REQUIRE(p.contains_empty_word());
REQUIRE(grammic_monoid(2) == plactic_monoid(2));

for (size_t n = 1; n <= 6; ++n) {
p = grammic_monoid(n);
REQUIRE(p == grammic_monoid_LXZ26(n));
REQUIRE(p.alphabet().size() == n);
REQUIRE(p.contains_empty_word());
REQUIRE_NOTHROW(p.throw_if_bad_alphabet_or_rules());
}
}

LIBSEMIGROUPS_TEST_CASE("Example",
"111",
"grammic_monoid(3) is a proper plactic quotient",
"[quick][presentation-examples]") {
auto rg = ReportGuard(false);
auto p = grammic_monoid(3);
REQUIRE(p.rules.size() == 18);
KnuthBendix kb(congruence_kind::twosided, p);
REQUIRE(is_obviously_infinite(kb));
REQUIRE(kb.number_of_classes() == POSITIVE_INFINITY);
// The b = c case: cbab = bacb, equivalently cbab = bcab.
REQUIRE(knuth_bendix::contains(kb, 2101_w, 1021_w));
REQUIRE(knuth_bendix::contains(kb, 2101_w, 1201_w));
REQUIRE(!knuth_bendix::contains(kb, 01_w, 10_w));
REQUIRE(!knuth_bendix::contains(kb, 0_w, 00_w));
REQUIRE(knuth_bendix::normal_forms(kb).min(4).max(4).count() == 38);

KnuthBendix plactic(congruence_kind::twosided, plactic_monoid(3));
REQUIRE(!knuth_bendix::contains(plactic, 2101_w, 1021_w));
}

LIBSEMIGROUPS_TEST_CASE("Example",
"112",
"grammic_monoid relations for larger ranks",
"[quick][presentation-examples]") {
auto p = grammic_monoid(4);
auto expected = plactic_monoid(4).rules;
// All five instances of dbac = badc with a < b <= c < d.
expected.insert(expected.end(),
{2101_w,
1021_w,
3101_w,
1031_w,
3102_w,
1032_w,
3202_w,
2032_w,
3212_w,
2132_w});
REQUIRE(p.rules == expected);
// There are binomial(n + 1, 4) extra relations.
REQUIRE(grammic_monoid(5).rules.size() == 110);
REQUIRE(grammic_monoid(6).rules.size() == 210);
}

} // namespace libsemigroups
Loading