coset enumeration

todd-coxeter with HLT coincidence handling — working, with the two wrong versions kept below.

the toy that came after tc-fail. a real coset enumerator: give it generators, relators and a subgroup, get the index. i got it wrong twice before this one worked. the working algorithm is at the bottom; the failures are kept because they're the interesting part.

try it

one relator per line, letters are generators, uppercase = inverse, a number after a letter is a power. put subgroup generators after H:.

S₃ = ⟨a,b | a², b³, (ab)²⟩ A₅ = ⟨a,b | a², b³, (ab)⁵⟩ von Dyck {5,4} (infinite)

press enumerate

the actual algorithm, for the record

the bug in attempt 2 (below) was conflating two different events. a relator walk can do exactly one of two things at an undefined table entry: define a brand-new coset (fine, keep walking) — or, when a walk ends somewhere other than where it started, record a coincidence (two cosets that turned out to be the same). only coincidences go in the merge queue. attempt 2 pushed definitions into the queue too, and the cascade ate the whole table.

the working loop keeps them separate: walk every relator from every coset; define freely; if a walk closes on the wrong coset, merge (union-find) and rescan everything, because merging rewrites rows that other relators passed through. that rescan is what attempt 1 was missing. there's one more subtlety the naive union-find misses: when you merge b into a, b's row entries have to be copied into a — and any entry that disagrees on the two rows is itself a fresh coincidence. drop that copy and you silently lose table info. definitions and coincidences in separate books, copy-on-merge, rescan on merge — that's the whole discipline.

attempt 1 — over-defines

scan every relator from every coset once per sweep, force a new coset whenever a table entry is undefined, and when a relator closes on the wrong coset push a merge. don't rescan after merging.

result: S₃ came out 324 instead of 6. the merges fired, but nothing re-examined the rows that got merged, so fresh cosets kept spawning faster than the merges could catch up. the table grew until it hit the guard limit.

this is the failure tc-fail.html already describes. the missing piece is the rescan: after you merge two cosets, every relator that passed through either one has to be walked again.

attempt 2 — over-merges

fix it with a union-find over cosets, drain the coincidence queue to a fixpoint after every single relator scan, rescan everything each sweep.

result: S₃ came out 1. everything collapsed into one coset. the too-eager draining cascaded — one spurious equality unioned a chain that swallowed the whole table. guard finished in 5 sweeps with 1 root.

the truth is somewhere between "rescan too little" and "rescan too much".

the working version above was written by keeping definitions and coincidences in separate books, copying row entries on every merge, and rescanning on every merge. feed it the {5,4} von Dyck group and watch it never close, which is the correct answer too.

← the negative result that started this · home