group-theory-0.2.2: The theory of groups
Copyright(c) 2020-2021 Emily Pillmore
LicenseBSD-style
MaintainerEmily Pillmore <emilypi@cohomolo.gy>, Reed Mullanix <reedmullanix@gmail.com>
Stabilitystable
Portabilitynon-portable
Safe HaskellSafe
LanguageHaskell2010

Data.Group.Cyclic

Description

This module contains definitions for Cyclic groups, along with the relevant combinators.

Synopsis

Cyclic groups

Cyclic is a Group that is generated by a single element. This element is called a generator of the group. There can be many generators for a group, e.g., any representative of an equivalence class of prime numbers of the integers modulo n, but to make things easy, we ask for only one generator.

class Group a => Cyclic a where #

A Group G is Cyclic if there exists an element x of G such that for all y in G, there exists an n, such that

y = pow x n

Methods

generator :: a #

The generator of the Cyclic group.

Instances

Instances details
Cyclic () 
Instance details

Defined in Data.Group

Methods

generator :: () #

Cyclic a => Cyclic (Identity a) 
Instance details

Defined in Data.Group

Methods

generator :: Identity a #

Integral a => Cyclic (Sum a) 
Instance details

Defined in Data.Group

Methods

generator :: Sum a #

Cyclic a => Cyclic (Down a) 
Instance details

Defined in Data.Group

Methods

generator :: Down a #

Cyclic (Proxy x) 
Instance details

Defined in Data.Group

Methods

generator :: Proxy x #

Cyclic a => Cyclic (Const a x) 
Instance details

Defined in Data.Group

Methods

generator :: Const a x #

Combinators

classify :: (Eq a, Cyclic a) => (a -> Bool) -> [a] Source #

Classify elements of a Cyclic group.

Apply a classifying function a -> Bool to the elements of a Cyclic group as generated by its designated generator.

Examples:

>>> classify @(Sum Word8) (< 3)
[Sum {getSum = 1},Sum {getSum = 2},Sum {getSum = 0}]

generated :: Cyclic a => [a] #

Generate all elements of a Cyclic group using its generator.

Note: Fuses, does not terminate even for finite groups.

generated' :: (Eq a, Cyclic a) => [a] #

Lazily generate all elements of a Cyclic group using its generator.

Note: Fuses, terminates if the underlying group is finite.