Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2ba4568
feat: add initial to-presentaiton funcitonality for Kambites, and som…
jmacgowan Sep 21, 2026
b77fa34
simplify tests
jmacgowan Sep 21, 2026
d5fecd3
feat: added to pres -> ToddC, KnuthB, FroidPin
jmacgowan Sep 22, 2026
1783724
feat: added to presentation
jmacgowan Sep 22, 2026
583775b
feat: add conversions to knuth and tc
jmacgowan Sep 22, 2026
e5aac36
feat: adding inverse, still some missing
jmacgowan Sep 22, 2026
484a232
Formatting
jmacgowan Sep 22, 2026
ad79c0a
Comments and Doc
jmacgowan Sep 23, 2026
7449374
made everything the same
jmacgowan Sep 23, 2026
3c3dd82
Fixed the froidure pin to be in presentation and added docs
jmacgowan Sep 25, 2026
1b49a71
Added docs
jmacgowan Sep 25, 2026
d65b6dd
Merge pull request #1 from jmacgowan/feat/to-func
jmacgowan Sep 25, 2026
d66f57f
Refactor FroidurePin and update conversions to use UInt32; enhance do…
jmacgowan Oct 6, 2026
d206108
Formatting
jmacgowan Oct 6, 2026
54eb363
Update src/to-cong.jl
jmacgowan Oct 8, 2026
dc8d011
Update src/to-froidure-pin.jl
jmacgowan Oct 8, 2026
861b662
Update src/to-inverse-presentation.jl
jmacgowan Oct 8, 2026
cbcd909
Fixed jswent review
jmacgowan Oct 8, 2026
6ccb203
Merge branch 'main' of https://github.com/jmacgowan/Semigroups.jl
jmacgowan Oct 8, 2026
cbc4a5b
Format
jmacgowan Oct 8, 2026
dc0ea63
Update to inital presentaitont ype
jmacgowan Oct 15, 2026
3ced98c
added support for presentaiton, refactor of presentaiotn exmaples to …
jmacgowan Oct 15, 2026
ac461ba
Merge remote-tracking branch 'upstream/main' into feat/final/presenta…
jmacgowan Oct 15, 2026
2fede1e
to.jl consolidation
jmacgowan Oct 15, 2026
6ececd6
Format
jmacgowan Oct 15, 2026
364fd1c
opefully added a test to get full coverage
jmacgowan Oct 16, 2026
a6d3451
removed mistake
jmacgowan Oct 16, 2026
574c2af
Attmeoting fix
jmacgowan Oct 16, 2026
059fb65
Aiming for 100% test coverage & praying
jmacgowan Oct 16, 2026
9bc208f
remove changes file
jmacgowan Oct 16, 2026
b0f4bd4
Delete .vscode/settings.json
jmacgowan Oct 16, 2026
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
532 changes: 251 additions & 281 deletions deps/src/presentation.cpp

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion src/cong-common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ const CongruenceCommon = LibSemigroups.CongruenceCommon

const Congruence = LibSemigroups.CongruenceWord

# The C++ binding takes the congruence kind as an Integer and a raw
# `PresentationWord`; adapt the public Julia types to that.
function Congruence(kind::congruence_kind, p::Presentation)
return @wrap_libsemigroups_call LibSemigroups.CongruenceWord(
_kind_to_cpp(kind),
_cxx_word(p),
)
end

"""
number_of_classes(cong::CongruenceCommon) -> UInt64

Expand All @@ -38,7 +47,7 @@ number_of_classes(cong::CongruenceCommon) =

Return the presentation associated with `cong`.
"""
presentation(cong::CongruenceCommon) = LibSemigroups.presentation(cong)
presentation(cong::CongruenceCommon) = _wrap_presentation(LibSemigroups.presentation(cong))

"""
kind(cong::CongruenceCommon) -> congruence_kind
Expand Down
4 changes: 2 additions & 2 deletions src/kambites.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function init!(k::Kambites)
end

function init!(k::Kambites, kind::congruence_kind, p::Presentation)
@wrap_libsemigroups_call LibSemigroups.init!(k, kind, p)
@wrap_libsemigroups_call LibSemigroups.init!(k, kind, _cxx_word(p))
return k
end

Expand All @@ -168,7 +168,7 @@ presentation is returned. The Julia binding returns by value (an
independent copy) rather than by reference; mutating the returned
object does not affect `k`.
"""
presentation(k::Kambites) = LibSemigroups.presentation(k)
presentation(k::Kambites) = _wrap_presentation(LibSemigroups.presentation(k))

"""
generating_pairs(k::Kambites) -> Vector{Tuple{Vector{Int}, Vector{Int}}}
Expand Down
23 changes: 18 additions & 5 deletions src/knuth-bendix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,17 @@ number_of_classes(kb) # POSITIVE_INFINITY
"""
const KnuthBendix = LibSemigroups.KnuthBendixRewriteTrie

# The C++ binding takes the congruence kind as an Integer and a raw
# `PresentationWord`; adapt the public Julia types to that.
_kind_to_cpp(kind) = Int(kind)

function KnuthBendix(kind::congruence_kind, p::Presentation)
return @wrap_libsemigroups_call LibSemigroups.KnuthBendixRewriteTrie(
_kind_to_cpp(kind),
_cxx_word(p),
)
end

"""
overlap_ABC

Expand Down Expand Up @@ -141,8 +152,8 @@ function init!(kb::KnuthBendix)
return kb
end

function init!(kb::KnuthBendix, kind::congruence_kind, p::Presentation)
@wrap_libsemigroups_call LibSemigroups.init!(kb, kind, p)
function init!(kb::KnuthBendix, kind::congruence_kind, p::Presentation{Vector{Int}})
@wrap_libsemigroups_call LibSemigroups.init!(kb, _kind_to_cpp(kind), p.cxx_obj)
return kb
end

Expand Down Expand Up @@ -499,7 +510,7 @@ Return a copy of the presentation used by `kb`.
required by the algorithm. This extra letter also appears in the output of
[`active_rules`](@ref Semigroups.active_rules).
"""
presentation(kb::KnuthBendix) = LibSemigroups.presentation(kb)
presentation(kb::KnuthBendix) = _wrap_presentation(LibSemigroups.presentation(kb))

# ============================================================================
# Rules access
Expand Down Expand Up @@ -657,8 +668,10 @@ no redundant rule is identified within the timeout.
"""
function redundant_rule(p::Presentation, timeout::TimePeriod)
ns = convert(Nanosecond, timeout)
idx =
@wrap_libsemigroups_call LibSemigroups.kb_redundant_rule(p, Int64(Dates.value(ns)))
idx = @wrap_libsemigroups_call LibSemigroups.kb_redundant_rule(
_cxx_word(p),
Int64(Dates.value(ns)),
)
n_flat = 2 * number_of_rules(p)
# If idx == n_flat, no redundant rule was found
if idx >= n_flat
Expand Down
Loading
Loading