Skip to content
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

Add support for Sims for v1 release, please dont merge #198

Draft
wants to merge 12 commits into
base: v1
Choose a base branch
from
18 changes: 17 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,19 @@ def no_doc_run(self):
r"libsemigroups::DynamicMatrix<libsemigroups::IntegerPlus<long long>, "
r"libsemigroups::IntegerProd<long long>, libsemigroups::IntegerZero"
r"<long long>, libsemigroups::IntegerOne<long long>, long long>"
): "Matrix",
): r"Matrix",
r"libsemigroups::SimsStats": r"SimsStats",
r"libsemigroups::Sims1": r"Sims1",
r"SimsSettingsSims1": r"Sims1",
r"libsemigroups::Sims2": r"Sims2",
r"SimsSettingsSims2": r"Sims2",
r"libsemigroups::RepOrc": r"RepOrc",
r"SimsSettingsRepOrc": r"RepOrc",
(
r"libsemigroups::DynamicMatrix<libsemigroups::BooleanPlus, "
r"libsemigroups::BooleanProd, libsemigroups::BooleanZero, "
r"libsemigroups::BooleanOne, int>"
): r"Matrix",
}

# This dictionary should be of the form class_name -> (pattern, repl), where
Expand Down Expand Up @@ -216,6 +228,10 @@ def no_doc_run(self):
("PTransfBase16", "StaticPerm16"),
("Transf", "StaticPerm16"),
],
"Sims1": [("SubclassType", "Sims1")],
"Sims2": [("SubclassType", "Sims2")],
"RepOrc": [("SubclassType", "RepOrc")],
"MinimalRepOrc": [("SubclassType", "MinimalRepOrc")],
}

# This is what sphinx considers to be a signature
Expand Down
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ See the installation instructions:
main-algorithms/knuth-bendix/index
main-algorithms/konieczny/index
main-algorithms/radoszewski-rytter/index
main-algorithms/sims/index
main-algorithms/stephen/index
main-algorithms/todd-coxeter/index
main-algorithms/ukkonen/index
Expand Down
20 changes: 20 additions & 0 deletions docs/source/main-algorithms/sims/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.. Copyright (c) 2024 R. Cirpons

Distributed under the terms of the GPL license version 3.

The full license is in the file LICENSE, distributed with this software.

Sims
=======

This page contains links to the functionality in ``libsemigroups_pybind11``
related to Sims's low-index congruence algorithm
:cite:`Anagnostopoulou-Merkouri2023aa` for finitely presented semigroups.

.. toctree::
:maxdepth: 1

sims
sims-helpers


38 changes: 38 additions & 0 deletions docs/source/main-algorithms/sims/sims-helpers.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.. Copyright (c) 2024 R. Cirpons

Distributed under the terms of the GPL license version 3.

The full license is in the file LICENSE, distributed with this software.

.. currentmodule:: _libsemigroups_pybind11

Sims helpers
============

This page contains the documentation for various helper functions for
manipulating ``Sims1``, ``Sims2``, ``RepOrc`` or ``MinimalRepOrc`` objects.
All such functions are contained in the submodule
``libsemigroups_pybind11.sims``.


Contents
--------

.. currentmodule:: libsemigroups_pybind11.sims

.. autosummary::
:nosignatures:

is_maximal_right_congruence
is_right_congruence
is_right_congruence_of_dual
is_two_sided_congruence
poset
right_generating_pairs
two_sided_generating_pairs

Full API
--------
.. automodule:: libsemigroups_pybind11.sims
:members:
:imported-members:
76 changes: 76 additions & 0 deletions docs/source/main-algorithms/sims/sims.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
.. Copyright (c) 2024 R. Cirpons

Distributed under the terms of the GPL license version 3.

The full license is in the file LICENSE, distributed with this software.

.. currentmodule:: _libsemigroups_pybind11

Sims
====

On this page we describe the functionality relating to the Sims's
low-index congruence algorithm for semigroups and monoids that is available in
``libsemigroups_pybind11``. This page contains a details of the methods
of the classes:

* :py:class:`Sims1` for computing finite index right congruences,
* :py:class:`Sims2` for computing finite index two-sided congruences,
* :py:class:`RepOrc` for computing small degree transformation representations of a finite semigroup or monoid,
* :py:class:`MinimalRepOrc` for computing minimal degree transformation representations of a finite semigroup or monoid.

.. doctest::

>>> from libsemigroups_pybind11 import Sims1, Presentation, presentation
>>> p = Presentation([0, 1])
>>> presentation.add_rule(p, [0, 1], [1, 0])
>>> sims = Sims1(p)
>>> sims.number_of_congruences(4)
117

Contents
--------

.. autosummary::
:nosignatures:

~Sims1
~Sims2
~RepOrc
~MinimalRepOrc
~SimsStats
~SimsRefinerFaithful
~SimsRefinerIdeals

Full API
--------

.. autoclass:: Sims1
:members:
:inherited-members:

.. autoclass:: Sims2
:members:
:inherited-members:

.. autoclass:: RepOrc
:members:
:inherited-members:

.. autoclass:: MinimalRepOrc
:members:
:inherited-members:

.. autoclass:: SimsStats
:members:
:inherited-members:

.. autoclass:: SimsRefinerFaithful
:members:
:inherited-members:
:special-members: __call__

.. autoclass:: SimsRefinerIdeals
:members:
:inherited-members:
:special-members: __call__
6 changes: 6 additions & 0 deletions libsemigroups_pybind11/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@
Dot,
PBR,
Ukkonen,
Sims1,
Sims2,
RepOrc,
MinimalRepOrc,
SimsRefinerFaithful,
SimsRefinerIdeals,
)
except ModuleNotFoundError as e:
raise ModuleNotFoundError(
Expand Down
25 changes: 25 additions & 0 deletions libsemigroups_pybind11/sims.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-

# Copyright (c) 2024 R. Cirpons
#
# Distributed under the terms of the GPL license version 3.
#
# The full license is in the file LICENSE, distributed with this software.

# pylint: disable=no-name-in-module, invalid-name, unused-import, fixme,
# pylint: disable=unidiomatic-typecheck

"""
This package provides the user-facing python part of libsemigroups_pybind11 for
the Sims class from libsemigroups.
"""

from _libsemigroups_pybind11 import (
right_generating_pairs,
two_sided_generating_pairs,
is_right_congruence,
is_right_congruence_of_dual,
is_two_sided_congruence,
is_maximal_right_congruence,
poset,
)
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,11 @@ requires = [
]

build-backend = "setuptools.build_meta"

[tool.pytest.ini_options]
markers = [
"quick",
"standard",
"extreme",
"fail",
]
1 change: 1 addition & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ namespace libsemigroups {
init_present(m);
init_inverse_present(m);
init_to_present(m);
init_sims(m);
init_transf(m);
init_ranges(m);
init_words(m);
Expand Down
1 change: 1 addition & 0 deletions src/main.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ namespace libsemigroups {
void init_present(py::module&);
void init_inverse_present(py::module&);
void init_to_present(py::module&);
void init_sims(py::module&);
void init_transf(py::module&);
void init_ranges(py::module&);
void init_words(py::module&);
Expand Down
Loading
Loading