group

package
v0.0.0-...-2f16d0f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package group is some stuff for working with finitely-generated groups.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs[I signedInt](x I) I

Abs returns |x|.

func GenerateRelations

func GenerateRelations(relators ...Word) map[Word][]Word

GenerateRelations converts a relator word into a map from longer words into shorter equivalent words.

func Sign

func Sign[I signedInt](x I) I

Sign returns 1 if x > 0, -1 if x < 0, and 0 if x == 0.

Types

type Basic

type Basic struct {
	G rune // is an alias of int32, btw
	P int32
}

Basic is a generator-power pair. (Does this have another name? I forget.)

func DecodeBasic

func DecodeBasic(e Word) Basic

DecodeBasic decodes the first basic within the word, and returns the zero Basic if e is empty.

func (Basic) Encode

func (b Basic) Encode() Word

Encode encodes the basic as a word.

func (Basic) Gen

func (b Basic) Gen() Basic

Gen returns the generator of b, i.e. for b = g^p returns one of {g, g⁰, g⁻¹}. Examples: - (a⁷).Gen() = a - (b⁻⁵).Gen() = b⁻¹ - (c⁰).Gen() = c⁰

func (Basic) Inv

func (b Basic) Inv() Basic

Inv returns b⁻¹. If b = g^p then b⁻¹ = g^{-p}.

func (Basic) Pow

func (b Basic) Pow(n int32) Basic

Pow returns b^n. If b = g^p, then b^n = g^{p*n}.

func (Basic) String

func (b Basic) String() string

type Word

type Word string

Word is a string of (encoded) Basics. It can be used to represent elements of finitely-generated groups.

func Commutator

func Commutator(x, y Word) Word

Commutator returns the commutator of x and y, [x, y] = xyx⁻¹y⁻¹.

func Conjugate

func Conjugate(a, x Word) Word

Conjugate returns the conjugate of a by x, a^x = x⁻¹ax.

func Mul

func Mul(ws ...Word) Word

Mul freely multiplies words, which is equivalent to freely reducing the concatenation of them.

func NewWord

func NewWord(gps ...int32) Word

NewWord constructs a word from generator-power pairs. It panics if the argument slice does not have an even length.

func Reduce

func Reduce(it iter.Seq[Basic]) Word

Reduce freely reduces the input sequence of basics into a Word.

func Replace

func Replace(w, old, new Word) Word

func (Word) BasicLen

func (w Word) BasicLen() int

BasicLen returns the number of basics the word is composed of.

func (Word) Basics

func (w Word) Basics() iter.Seq[Basic]

Basics returns an iterator over the basics.

func (Word) Generators

func (w Word) Generators() iter.Seq[Basic]

Generators returns an iterator that yields Len generators, the product of which equal the word.

func (Word) Inv

func (w Word) Inv() Word

Inv returns w⁻¹. It does not require the input to be reduced, nor does it reduce its output. However a reduced input has a reduced inverse. Example: (aba⁻¹b⁻¹).Inv() = bab⁻¹a⁻¹.

func (Word) LRot

func (w Word) LRot() Word

LRot returns the word left-rotated by a single generator. For an input word W = ab...yz, where a...z are generators, W.LRot() = a⁻¹Wa = b...yza. If the word is a relator for a presentation, this returns an equivalent relator. It does not require the receiver to be reduced, but reduces its output if the receiver is nontrivial. Examples: - (aba⁻¹b⁻¹).LRot() = bab⁻¹a - (a³ba³).LRot() = a²ba⁴

func (Word) Len

func (w Word) Len() int

Len returns |w|, the length of the word measured in generators or their inverses - essentially the sum of b.P for each basic b. To ensure w.Len returns the geodesic length, ensure w is reduced before calling.

func (Word) Pow

func (w Word) Pow(n int32) Word

Pow returns w^n. It doesn't go out of its way to reduce the result.

func (Word) RRot

func (w Word) RRot() Word

RRot returns the word right-rotated by a single generator. For an input word W = ab...yz, where a...z are generators, W.RRot() = zWz⁻¹ = zab...y. If the word is a relator for a presentation, this returns an equivalent relator. It does not require the receiver to be reduced, but reduces its output if the receiver is nontrivial. Examples: - (aba⁻¹b⁻¹).RRot() = b⁻¹aba⁻¹ - (a³ba³).RRot() = a⁴ba²

func (Word) Reduce

func (w Word) Reduce() Word

Reduce returns the free reduction of the word.

func (Word) Split

func (w Word) Split(n int32) (prefix, suffix Word)

func (Word) String

func (w Word) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL