diff --git a/include/libsemigroups/presentation.hpp b/include/libsemigroups/presentation.hpp index d7fedf3fa..1f8f1b951 100644 --- a/include/libsemigroups/presentation.hpp +++ b/include/libsemigroups/presentation.hpp @@ -2346,6 +2346,20 @@ namespace libsemigroups { template std::string to_human_readable_repr(Presentation const& p); + //! \ingroup presentations_group + //! + //! \brief Return a human readable representation of an InversePresentation. + //! + //! Return a human readable representation of an InversePresentation. + //! + //! \tparam Word the type of the words in the InversePresentation. + //! \param p the InversePresentation. + //! + //! \exceptions + //! \no_libsemigroups_except + template + std::string to_human_readable_repr(InversePresentation const& p); + namespace detail { template struct IsPresentationHelper : std::false_type {}; diff --git a/include/libsemigroups/presentation.tpp b/include/libsemigroups/presentation.tpp index 448e3a9ce..8faa3d426 100644 --- a/include/libsemigroups/presentation.tpp +++ b/include/libsemigroups/presentation.tpp @@ -1061,6 +1061,32 @@ namespace libsemigroups { return out; } + template + std::string to_human_readable_repr(InversePresentation const& p) { + size_t alphabet_size = p.alphabet().size(); + size_t n_rules = p.rules.size() / 2; + std::string out = "<"; + if (p.contains_empty_word()) { + out += "Monoid "; + } else { + out += "Semigroup "; + } + out += "Presentation with inverses on "; + if (alphabet_size == 1) { + out += "1 letter "; + } else { + out += std::to_string(alphabet_size) + " letters "; + } + out += "with "; + if (n_rules == 1) { + out += "1 rule"; + } else { + out += std::to_string(n_rules) + " rules"; + } + out += ">"; + return out; + } + template InversePresentation& InversePresentation::inverses_no_checks(word_type const& w) {