Skip to content

examples: add example of non-iso. fp monoids #300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 19, 2025
Merged
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
38 changes: 38 additions & 0 deletions examples/not_renner_B_5_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""
In this file we give the "proof" that the monoid defined by the presentation
not_renner_type_B_monoid(5, 1) is not isomorphic to the monoid defined by
renner_type_B_monoid(5, 1).
"""

from libsemigroups_pybind11 import Sims2, Presentation, WordGraph
from libsemigroups_pybind11 import word_graph
from libsemigroups_pybind11.presentation import examples


def check_incompat(wg: WordGraph, p: Presentation) -> bool:
for i in range(0, len(p.rules), 2):
if not word_graph.is_compatible(wg, 0, 4096, p.rules[i], p.rules[i + 1]):
return True
return False


def witness(wg: WordGraph, p: Presentation) -> tuple[list[int], list[int]]:
for i in range(0, len(p.rules), 2):
if not word_graph.is_compatible(wg, 0, 1, p.rules[i], p.rules[i + 1]):
return (p.rules[i], p.rules[i + 1])


p = examples.not_renner_type_B_monoid(5, 1)
q = examples.renner_type_B_monoid(5, 1)

# We iterate 2-sided congruences of the monoid defined by "p" with the aim of
# finding one which is not compatible with the relations in "q"
twosided_congs = Sims2(p)
wg = twosided_congs.find_if(4096, lambda wg: check_incompat(wg, q))
word_graph.number_of_nodes_reachable_from(wg, 0) # 2177
wg.induced_subgraph(0, 2177)
witness(wg, q) # ([5, 0, 1, 2, 3, 4, 0, 1, 2, 3, 0, 1, 2, 0, 1, 0, 5], [10])
# meaning that the paths with source 0 labelled by these two words should lead to the same
# node but do not.
word_graph.follow_path(wg, 0, [5, 0, 1, 2, 3, 4, 0, 1, 2, 3, 0, 1, 2, 0, 1, 0, 5]) # 6
word_graph.follow_path(wg, 0, [10]) # 7
Loading