Skip to content

Instantly share code, notes, and snippets.

@mroman42
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mroman42/a43481027bd61c8e3bc8 to your computer and use it in GitHub Desktop.
Save mroman42/a43481027bd61c8e3bc8 to your computer and use it in GitHub Desktop.
Computes the multiplication table of a group
-- Computes the multiplication table of a group
-- Using the Knuth-Bendix algorithm
-- Uses HaskellForMath, which can be installed:
-- cabal install HaskellForMath
import Math.Algebra.Group.StringRewriting
-- Computes the multiplication table, given the group generators
-- and the set of relations as strings, as in this example:
-- multtable "tw" [("www",""),("tt",""),("tw","wwt")]
multtable g r = [[rewrite cs (a ++ b) | a <- nf] | b <- nf]
where cs = knuthBendix r
nf = nfs (g,cs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment