斯拉瓦的幺半群动物园
Slava's Monoid Zoo

原始链接: https://factorcode.org/slava/monoids.html

## Slava 的单体动物园:摘要 这项工作研究有限表示的单体——由生成元和关系定义的代数结构,重点在于寻找“最小”的表示,其词问题*不能*通过有限完全重写系统 (FCRS) 解决,FCRS 是一种用于 Swift 编译器类型检查的技术。词问题询问在给定一组重写规则的情况下,两个符号串是否等价。 虽然词问题对于有限表示的单体来说通常是不可判定的,但即使是*可判定的*单体也可能缺乏 FCRS 解决方案。这项研究探讨了像 Squier 的 S1 以及其他例子,寻找表现出这种特性的最小表示。 作者的主要结果表明,单体 ⟨a, b | aaa=a, abba=bb⟩ 是唯一的、有两个生成元、两个关系的、长度为 10 的“非 FCRS”单体。 该研究还扩展到单关系单体,为许多单体找到 FCRS 解决方案,并确定了一些例外。 提供了数据集,分析短表示及其与 FCRS 的可解性,以及与经典有限群和单体的联系。 最终目标是促进对字符串重写和 Knuth-Bendix 完备化算法的理解。

黑客新闻 新的 | 过去的 | 评论 | 提问 | 展示 | 工作 | 提交 登录 Slava 的 Monoid 动物园 (factorcode.org) 12 分,luu 发表于 1 小时前 | 隐藏 | 过去的 | 收藏 | 1 条评论 帮助 voidUpdate 0 分钟前 [–] > “你能看到一种将 8 个苹果的字符串 "" 转换为 10 个苹果的字符串 "" 的方法吗?” 我错过了什么吗?我们拥有的唯一规则是 BAB -> AAA 和 BBB -> BB,并且我们只从 A 开始,没有 B,所以这两个规则都不能使用,所以答案是否定的?回复 考虑申请 YC 的 2026 年夏季批次!申请截止至 5 月 4 日 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文
Slava's Monoid Zoo Return to my home page.
My interest in finitely-presented monoids stems from the Swift compiler's use of the Knuth-Bendix completion algorithm to implement same-type requirements. There are multiple possible formulations of the Knuth-Bendix algorithm, but in Swift's case, we're using it to solve the word problem in a finitely-presented monoid.

In the Swift compiler, the finitely-presented monoids are the generic signatures of function and type declarations, and the relations in each monoid correspond to the generic requirements imposed upon that declaration. This is all documented in Chapters 16--18 of Compiling Swift Generics, if you're curious.

The word problem

The word problem asks the yes/no question of whether two words over a finite alphabet are equivalent under a given set of bidirectional string rewriting rules, or "relations". Here is an example. Suppose you're given these two relations:
  1. 🍌🍎🍌 = 🍎🍎🍎
  2. 🍌🍌🍌 = 🍌🍌
Can you see a way to transform a string of 8 apples "🍎🍎🍎🍎🍎🍎🍎🍎" into a string of 10 apples "🍎🍎🍎🍎🍎🍎🍎🍎🍎🍎"?

It is not at all obvious that this can be done, and in fact it takes a minimum of 15 steps. (You can discover the solution for yourself by playing this simple game.) This is a concrete instance of the word problem: we have two words a8 and a10, and the monoid presentation ⟨a, b | bab=aaa, bbb=bb⟩, and we want to know if the two words are equivalent with respect to those two rules.

Even though the above presentation is very short, the word problem here is already quite difficult. A classic result is that the word problem for finitely-presented monoids is undecidable in the general case. A very short example of a monoid with an undecidable word problem appears in the paper An associative calculus with an insoluble problem of equivalence (for an English translation with commentary, see G. S. Tseytin's seven-relation semigroup with undecidable word problem):

⟨a, b, c, d, e | ac=ca, ad=da, bc=cb, bd=db, eca=ce, edb=de, cca=ccae⟩

Finite complete rewriting systems

Knuth-Bendix attempts to construct a finite complete rewriting system from the bidirectional equivalences that define the monoid. A finite complete rewriting system is a set of directed reduction rules which allows us to reduce any word into a normal form in a finite number of steps. This completely solves the word problem for the original monoid: given any pair of words, we can first reduce both words to their normal form by applying the reduction rules in our FCRS, and then we check if we get identical normal forms.

Knuth-Bendix completion will sometimes fail; the failure mode is that it runs forever, continuing to add new rules which never converge. At the very least, Knuth-Bendix must fail if the given input rules define a monoid with an undecidable word problem. Undecidable instances aside, one might then ask: if our monoid has a decidable word problem, can we still solve the word problem with an FCRS? This was answered in the negative by Craig C. Squier in the late 1980's. In a paper titled A finiteness condition for rewriting systems, Squier considered the monoid S1, with five generators and five relations:

S1 := ⟨a, b, t, x, y | ab=1, xa=atx, xt=tx, xb=bx, xy=1⟩
Squier shows that this monoid does not have finite derivation type, which is a necessary condition for the existence of an FCRS presenting the same monoid. Thus, Knuth-Bendix completion will fail with any presentation of this monoid, not just the one given above, no matter what generating set or reduction order we choose. Despite that, S1 happens to have a decidable word problem. An even shorter example, with three generators and three relations, appears in a paper titled On finite complete rewriting systems, finite derivation type, and automaticity for homogeneous monoids:
⟨a, b, c | ac=ca, bc=cb, cab=cbb⟩
The above monoid again has a decidable word problem (the relations preserve the length of the word, so we can decide if two words are equivalent by first comparing their lengths, followed by an exhaustive enumeration if both words have equal length); just not by Knuth-Bendix completion.

The goal of this investigation

The above examples serve as motivation for my investigation, which can be summarized as follows:
Goal: To find, in some subjective sense, the "smallest" or "shortest" monoid presentations whose whose word problem cannot be solved by a finite complete rewriting system (in practical terms, applying some variant of Knuth-Bendix completion).
To search for a finite complete rewriting system that presents a monoid, I use a variation of the technique described in Morphocompletion for one-relation monoids, to introduce new generators to the presentation; I then attempt completion with a variety of reduction orders simultaneously:
  • Shortlex for all permutations of the alphabet
  • Recursive path for all permutations of the alphabet together with all possible distinct degree assignments
Besides solving the word problem, an FCRS tells you if the presented monoid has a finite number of elements (distinct equivalence classes of strings), in which case it is possible to enumerate the elements, and construct a Cayley table and Cayley graph for the monoid. It is also decidable if an FCRS presents a group, in which case the inverses of the generators can be determined as well. My side quest has been to collect and analyze this data about short presentations, which you can find in the data sets below.

To answer the one final question you may have:

Why? Because it's an interesting problem.

The data set

I can find a finite complete rewriting system for every two-generated two-relation monoid with sum of sides ≤ 11, with 24 exceptions that are listed on the page below.

Explore:

A fair number of instances in the enumeration "collapse" in various trivial ways:
  • ⟨a, b | aa=a, ab=1⟩ is the first presentation of the trivial group with one element, but there are 2030 more.
  • ⟨a, b | aa=1, ab=1⟩ is the first presentation of the group with two elements, but there are 1990 more.
  • ⟨a, b | aa=a, aaa=b⟩ is the other possible monoid structure with two elements; not nearly as popular, with only 46 other duplicates in the enumeration.
This enumeration also includes some nice short presentations of various classic finite groups:

⟨a, b | aaa=a, abba=bb⟩

My main result so far is that ⟨a, b | aaa=a, abba=bb⟩ is the unique two generator, two relation monoid with length 10 that cannot be presented by a finite complete rewriting system over any alphabet (the monoid is "not FCRS"). In fact, just like Squier's S1, it does not have finite derivation type.

Read the proof:

Note that the article describes an earlier enumeration of two-relation monoids up to length 10; at the time, this monoid was one of three "hard" instances. Since then, I've found an FCRS for the other two:

⟨a, b | aba=aa, baa=aab⟩

I also have an earlier result that one of the length 11 hard instances is not FCRS. The main proof fits in two pages, and it is (relatively speaking) quite straightforward, relying only on nothing more than the preliminary definitions and the pumping lemma for regular languages. I would be very happy if this was incorporated as an example in someone's textbook on string rewriting or Knuth-Bendix completion!

Read the proof:

An interesting question (I do not know the answer) is if this monoid also fails to have finite derivation type.

Resolving the status of the remaining length 11 hard instances in the two relation enumeration is still an open problem. (A very observant reader might notice that the "8 apples" monoid from the introduction, ⟨a, b | bab=aaa, bbb=bb⟩, appears among them. I'm pretty sure it's not FCRS.) Let me know if you figure anything out!


I've also investigated monoids with one defining relation.

The data set

I can find a finite complete rewriting system for every two-generated one-relation monoid with sum of sides ≤ 10, with five exceptions that are listed at the page below. It is not known if every one-relation monoid can be presented by a finite complete rewriting system. Maybe it is too much to hope for, but if the answer is "no", perhaps one of these will be the first such counterexample!

Explore:

A number of classical one-relation monoids can be found in this enumeration: There are no finite monoids in this enumeration, because it takes at least two relations to present a finite monoid with two generators. A team led by James D. Mitchell at University of St Andrews has been looking at solving the word problem in one relation monoids using a variety of techniques, not just FCRS, with a larger enumeration than mine---they're enumerating all ⟨a, b | u=v⟩ where |u| ≤ 10 and |v| ≤ 10, not just |u|+|v| ≤ 10. Check out their publications:

Minor results

I've found finite complete rewriting systems for a handful of one relation monoids that have stumped others, which is perhaps mildly interesting. You can see the slightly absurd phenomenon in action here, where even though we're starting from a single relation, we might get a finite complete rewriting system with a large number of rules.

(1) The below monoid, due to Victor Maltcev, appears as Exercise 4.10:8 (ii) in An invitation to General Algebra and Universal Constructions by George M. Bergman:

(ii) (Victor Maltcev) Does there exist a normal form or other useful description for the monoid presented by generators a, b and the relation abbab = baabb ? (I do not know the answer.)
The monoid ⟨a, b | abbab=baabb⟩ is anti-isomorphic to ⟨a, b | abaab=aabba⟩, which admits a finite complete rewriting system.

(2) The next example appears in the fantastic survey of The Word Problem for One-Relation Monoids by C.F. Brodda, where he writes:

We note in passing that the smallest monadic one-relation monoid to which no result in the literature appears to be available to solve the word problem for is ⟨a, b | bababbbabba=a⟩. The author has not found a finite complete rewriting system for this monoid, but has solved the word problem for this monoid by other means.
The presentation ⟨a, b | bababbbabba=a⟩ does not appear in my enumeration, for it has length 12. It has the following finite complete rewriting system, once we add a letter c=bba:
  1. caac
  2. b2ac
  3. cbacabc2
  4. cbabc2ba
  5. ba2(ab)2c3
  6. (ba)2caba(bc2)2
  7. b(ab)2c2a
  8. c(ba)2abcba
  9. cbabcbaa
  10. (ba)3(ab)2c(cb)2a
  11. b(ab)2cba(ab)2c2
(3) In the paper On the Dehn functions of a class of monadic one-relation monoids, the same author defines this family of monoids:
ΠN := ⟨a,b | baa(ba)N=a⟩
He then asks:
Question 3. Does ΠN admit a finite complete rewriting system for all N ≥ 2?
I believe they all admit finite complete rewriting systems. Here is N=2, ⟨a, b | baababa=a⟩:
  1. cac3ac
  2. cac2aa2
  3. a2c3c(ac)2
  4. a2c2acaca2
  5. adca
  6. dc3c
  7. dc2aa
  8. dacac5
  9. dcacac3
  10. da2ac4a
  11. dca2ac2a
  12. abc
  13. bcdb
  14. bad
And N=3, ⟨a, b | baabababa=a⟩:
  1. cac5ac
  2. cac4aa2
  3. a2c5cac3ac
  4. a2c4acac3a2
  5. adca
  6. dc5c
  7. dc4aa
  8. dacac17
  9. dcacac13
  10. dc2acac9
  11. dc3acac5
  12. da2ac16a
  13. dca2ac12a
  14. dc2a2ac8a
  15. dc3a2ac4a
  16. abc
  17. bcdb
  18. bad
And N=4, ⟨a, b | baababababa=a⟩:
  1. cac6ac
  2. cac5aa2
  3. a2c6cac4ac
  4. a2c5acac4a2
  5. adca
  6. dc6c
  7. dc5aa
  8. dacac26
  9. dcacac21
  10. dc2acac16
  11. dc3acac11
  12. dc4acac6
  13. da2ac25a
  14. dca2ac20a
  15. dc2a2ac15a
  16. dc3a2ac10a
  17. dc4a2ac5a
  18. abc
  19. bcdb
  20. bad
This pattern continues for N=5, 6, 7, ... as well, and you seem to always get an FCRS by adding two generators c=ab and d=ba.

(4) The next example is from a talk titled Off with the head! Termination provers and the word problem for 1-relation monoids by Reinis Cirpons:

The 1-relation Thue systems for which the decidability of the word problem is unknown to us: {baabbbaba ↔ a} {baaabaaa ↔ aba}.
The first one is anti-isomorphic to ⟨a, b | ababbbaab=a⟩, which is FCRS. The second one ⟨a, b | baaabaaa=aba⟩ has length 11 so it does not appear in my enumeration, but it can also be solved by FCRS if we add c=aaaba and d=abaaa:
  1. bc3dbd
  2. bc2addba
  3. abdbcad
  4. accad
  5. abcdba
  6. dbcadcadbd
  7. cbcadcad2bd
  8. adbccba
  9. ab2cd2bcdbad2
  10. ab2c2bcdbcad
  11. ab2cdcbcdbadc
  12. ab2cdbcbcdbcba
  13. ababca2
  14. a2dca2
  15. dbc(ad)2adba
  16. cbc(ad)2ad2ba
  17. ab2cadbcdbca2
  18. ab2cdadbcdb(ad)2
  19. adbad2cbda2
  20. ab2cdbad2bcdbcbda2
  21. adbadccbd(ad)2
  22. ab2cdbadcbcdbcbd(ad)2
  23. ab2ca2bcdba3
  24. adb(ad)2cbdada2
  25. ab2cdb(ad)2bcdbcbdada2
  26. bca4d
  27. adba3c
  28. ab2cdba3bcdbc
  29. dba5ad
  30. cba5ad2
联系我们 contact @ memedata.com