subhask-0.1.0.0: Type safe interface for programming in subcategories of Hask

Safe HaskellNone
LanguageHaskell2010

SubHask.Algebra.Group

Description

This module contains most of the math types not directly related to linear algebra

FIXME: there is probably a better name for this

Synopsis

Documentation

newtype NonNegative t Source

Constructors

NonNegative 

Fields

unNonNegative :: t
 

Instances

Read t0 => Read (NonNegative t) Source 
Show t0 => Show (NonNegative t) Source 
Arbitrary t0 => Arbitrary (NonNegative t) Source 
NFData t0 => NFData (NonNegative t) Source 
IsMutable t0 => IsMutable (NonNegative t) Source 
(Metric t0, HasScalar t0, Eq_ t0, Boolean (Logic t0), (~) * (Logic (Scalar t0)) (Logic t0)) => Metric (NonNegative t) Source 
(Rig t0, Monoid t0, Rg t0) => Rig (NonNegative t) Source 
(Rg t0, Abelian t0, Monoid t0) => Rg (NonNegative t) Source 
(Abelian t0, Semigroup t0) => Abelian (NonNegative t) Source 
(Ord t, Group t) => Cancellative (NonNegative t) Source 
(Monoid t0, Semigroup t0) => Monoid (NonNegative t) Source 
(Semigroup t0, IsMutable t0) => Semigroup (NonNegative t) Source 
(Boolean t0, Complemented t0, Heyting t0) => Boolean (NonNegative t) Source 
(Heyting t0, Bounded t0) => Heyting (NonNegative t) Source 
(Complemented t0, Bounded t0) => Complemented (NonNegative t) Source 
(Bounded t0, Lattice_ t0, MinBound_ t0) => Bounded (NonNegative t) Source 
(Ord_ t0, Lattice_ t0) => Ord_ (NonNegative t) Source 
(Graded t0, Lattice t0) => Graded (NonNegative t) Source 
(Enum t0, Graded t0, Ord_ t0) => Enum (NonNegative t) Source 
(Lattice_ t0, POrd_ t0) => Lattice_ (NonNegative t) Source 
(MinBound_ t0, POrd_ t0) => MinBound_ (NonNegative t) Source 
(POrd_ t0, Eq_ t0) => POrd_ (NonNegative t) Source 
Eq_ t0 => Eq_ (NonNegative t) Source 
data Mutable m (NonNegative t0) = Mutable_NonNegative (Mutable m t) Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Elem (NonNegative t0) = Elem t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Scalar (NonNegative t0) = Scalar t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Actor (NonNegative t0) = Actor t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 
type Logic (NonNegative t0) = Logic t0 Source 

class Quotient a b where Source

Maps members of an equivalence class into the "canonical" element.

Methods

mkQuotient :: a -> a / b Source

newtype a / b Source

The type of equivalence classes created by a mod b.

Constructors

Mod a 

Instances

KnownNat n => FiniteType (Z n) Source 
Eq a0 => Eq ((/) k a b) Source 
(Ord a0, Eq a0) => Ord ((/) k a b) Source 
Read a0 => Read ((/) k a b) Source 
Show a0 => Show ((/) k a b) Source 
(Quotient k a b, Arbitrary a) => Arbitrary ((/) k a b) Source 
NFData a0 => NFData ((/) k a b) Source 
IsMutable a0 => IsMutable ((/) k a b) Source 
(Module a, Quotient k a b) => Module ((/) k a b) Source 
(Ring a, Quotient k a b) => Ring ((/) k a b) Source 
(Rig a, Quotient k a b) => Rig ((/) k a b) Source 
(Rg a, Quotient k a b) => Rg ((/) k a b) Source 
(Abelian a, Quotient k a b) => Abelian ((/) k a b) Source 
(Group a, Quotient k a b) => Group ((/) k a b) Source 
(Cancellative a, Quotient k a b) => Cancellative ((/) k a b) Source 
(Monoid a, Quotient k a b) => Monoid ((/) k a b) Source 
(Semigroup a, Quotient k a b) => Semigroup ((/) k a b) Source 
Eq_ a0 => Eq_ ((/) k a b) Source 
type (><) * k ((/) k1 a b) c = (/) k1 ((><) * k a c) b Source 
data Mutable m ((/) k a0 b0) = Mutable_Mod (Mutable m a) Source 
type Order (Z n) = n Source 
type Elem ((/) k a0 b0) = Elem a0 Source 
type Elem ((/) k a0 b0) = Elem a0 Source 
type Elem ((/) k a0 b0) = Elem a0 Source 
type Elem ((/) k a0 b0) = Elem a0 Source 
type Elem ((/) k a0 b0) = Elem a0 Source 
type Elem ((/) k a0 b0) = Elem a0 Source 
type Scalar ((/) k a0 b0) = Scalar a0 Source 
type Scalar ((/) k a0 b0) = Scalar a0 Source 
type Scalar ((/) k a0 b0) = Scalar a0 Source 
type Scalar ((/) k a0 b0) = Scalar a0 Source 
type Scalar ((/) k a0 b0) = Scalar a0 Source 
type Scalar ((/) k a0 b0) = Scalar a0 Source 
type Actor ((/) k a0 b0) = Actor a0 Source 
type Actor ((/) k a0 b0) = Actor a0 Source 
type Actor ((/) k a0 b0) = Actor a0 Source 
type Actor ((/) k a0 b0) = Actor a0 Source 
type Actor ((/) k a0 b0) = Actor a0 Source 
type Actor ((/) k a0 b0) = Actor a0 Source 
type Logic ((/) k a0 b0) = Logic a0 Source 
type Logic ((/) k a0 b0) = Logic a0 Source 
type Logic ((/) k a0 b0) = Logic a0 Source 
type Logic ((/) k a0 b0) = Logic a0 Source 
type Logic ((/) k a0 b0) = Logic a0 Source 
type Logic ((/) k a0 b0) = Logic a0 Source 

type Z n = Integer / n Source

The type of integers modulo n

extendedEuclid :: (Eq t, Integral t) => t -> t -> (t, t, t, t, t, t) Source

Extended Euclid's algorithm is used to calculate inverses in modular arithmetic

newtype Galois p k Source

Galois p k is the type of integers modulo p^k, where p is prime. All finite fields have this form.

See wikipedia https://en.wikipedia.org/wiki/Finite_field for more details.

FIXME: Many arithmetic operations over Galois Fields can be implemented more efficiently than the standard operations. See http://en.wikipedia.org/wiki/Finite_field_arithmetic.

Constructors

Galois (Z (p ^ k)) 

Instances

Read (Z ((^) p0 k0)) => Read (Galois p k) Source 
Show (Z ((^) p0 k0)) => Show (Galois p k) Source 
Arbitrary (Z ((^) p0 k0)) => Arbitrary (Galois p k) Source 
NFData (Z ((^) p0 k0)) => NFData (Galois p k) Source 
IsMutable (Galois p k) Source 
KnownNat ((^) p k) => Module (Galois p k) Source 
(Prime p, KnownNat ((^) p k)) => Field (Galois p k) Source 
(Ring (Z ((^) p0 k0)), Rng (Z ((^) p0 k0)), Rig (Z ((^) p0 k0))) => Ring (Galois p k) Source 
(Rig (Z ((^) p0 k0)), Monoid (Z ((^) p0 k0)), Rg (Z ((^) p0 k0))) => Rig (Galois p k) Source 
(Rg (Z ((^) p0 k0)), Abelian (Z ((^) p0 k0)), Monoid (Z ((^) p0 k0))) => Rg (Galois p k) Source 
(Abelian (Z ((^) p0 k0)), Semigroup (Z ((^) p0 k0))) => Abelian (Galois p k) Source 
(Group (Z ((^) p0 k0)), Cancellative (Z ((^) p0 k0)), Monoid (Z ((^) p0 k0))) => Group (Galois p k) Source 
(Cancellative (Z ((^) p0 k0)), Semigroup (Z ((^) p0 k0))) => Cancellative (Galois p k) Source 
(Monoid (Z ((^) p0 k0)), Semigroup (Z ((^) p0 k0))) => Monoid (Galois p k) Source 
(Semigroup (Z ((^) p0 k0)), IsMutable (Z ((^) p0 k0))) => Semigroup (Galois p k) Source 
Eq_ (Z ((^) p0 k0)) => Eq_ (Galois p k) Source 
type (><) * * (Galois p k) Integer = Galois p k Source 
data Mutable m (Galois p0 k0) = Mutable_Galois (Mutable m (Z ((^) p k))) Source 
type Elem (Galois p0 k0) = Elem (Z ((^) p0 k0)) Source 
type Elem (Galois p0 k0) = Elem (Z ((^) p0 k0)) Source 
type Elem (Galois p0 k0) = Elem (Z ((^) p0 k0)) Source 
type Elem (Galois p0 k0) = Elem (Z ((^) p0 k0)) Source 
type Elem (Galois p0 k0) = Elem (Z ((^) p0 k0)) Source 
type Elem (Galois p0 k0) = Elem (Z ((^) p0 k0)) Source 
type Elem (Galois p0 k0) = Elem (Z ((^) p0 k0)) Source 
type Elem (Galois p0 k0) = Elem (Z ((^) p0 k0)) Source 
type Elem (Galois p0 k0) = Elem (Z ((^) p0 k0)) Source 
type Elem (Galois p0 k0) = Elem (Z ((^) p0 k0)) Source 
type Elem (Galois p0 k0) = Elem (Z ((^) p0 k0)) Source 
type Elem (Galois p0 k0) = Elem (Z ((^) p0 k0)) Source 
type Elem (Galois p0 k0) = Elem (Z ((^) p0 k0)) Source 
type Scalar (Galois p0 k0) = Scalar (Z ((^) p0 k0)) Source 
type Scalar (Galois p0 k0) = Scalar (Z ((^) p0 k0)) Source 
type Scalar (Galois p0 k0) = Scalar (Z ((^) p0 k0)) Source 
type Scalar (Galois p0 k0) = Scalar (Z ((^) p0 k0)) Source 
type Scalar (Galois p0 k0) = Scalar (Z ((^) p0 k0)) Source 
type Scalar (Galois p0 k0) = Scalar (Z ((^) p0 k0)) Source 
type Scalar (Galois p0 k0) = Scalar (Z ((^) p0 k0)) Source 
type Scalar (Galois p0 k0) = Scalar (Z ((^) p0 k0)) Source 
type Scalar (Galois p0 k0) = Scalar (Z ((^) p0 k0)) Source 
type Scalar (Galois p0 k0) = Scalar (Z ((^) p0 k0)) Source 
type Scalar (Galois p0 k0) = Scalar (Z ((^) p0 k0)) Source 
type Scalar (Galois p0 k0) = Scalar (Z ((^) p0 k0)) Source 
type Scalar (Galois p0 k0) = Scalar (Z ((^) p0 k0)) Source 
type Actor (Galois p0 k0) = Actor (Z ((^) p0 k0)) Source 
type Actor (Galois p0 k0) = Actor (Z ((^) p0 k0)) Source 
type Actor (Galois p0 k0) = Actor (Z ((^) p0 k0)) Source 
type Actor (Galois p0 k0) = Actor (Z ((^) p0 k0)) Source 
type Actor (Galois p0 k0) = Actor (Z ((^) p0 k0)) Source 
type Actor (Galois p0 k0) = Actor (Z ((^) p0 k0)) Source 
type Actor (Galois p0 k0) = Actor (Z ((^) p0 k0)) Source 
type Actor (Galois p0 k0) = Actor (Z ((^) p0 k0)) Source 
type Actor (Galois p0 k0) = Actor (Z ((^) p0 k0)) Source 
type Actor (Galois p0 k0) = Actor (Z ((^) p0 k0)) Source 
type Actor (Galois p0 k0) = Actor (Z ((^) p0 k0)) Source 
type Actor (Galois p0 k0) = Actor (Z ((^) p0 k0)) Source 
type Actor (Galois p0 k0) = Actor (Z ((^) p0 k0)) Source 
type Logic (Galois p0 k0) = Logic (Z ((^) p0 k0)) Source 
type Logic (Galois p0 k0) = Logic (Z ((^) p0 k0)) Source 
type Logic (Galois p0 k0) = Logic (Z ((^) p0 k0)) Source 
type Logic (Galois p0 k0) = Logic (Z ((^) p0 k0)) Source 
type Logic (Galois p0 k0) = Logic (Z ((^) p0 k0)) Source 
type Logic (Galois p0 k0) = Logic (Z ((^) p0 k0)) Source 
type Logic (Galois p0 k0) = Logic (Z ((^) p0 k0)) Source 
type Logic (Galois p0 k0) = Logic (Z ((^) p0 k0)) Source 
type Logic (Galois p0 k0) = Logic (Z ((^) p0 k0)) Source 
type Logic (Galois p0 k0) = Logic (Z ((^) p0 k0)) Source 
type Logic (Galois p0 k0) = Logic (Z ((^) p0 k0)) Source 
type Logic (Galois p0 k0) = Logic (Z ((^) p0 k0)) Source 
type Logic (Galois p0 k0) = Logic (Z ((^) p0 k0)) Source 

data GrothendieckGroup g where Source

The symmetric group is one of the simplest and best studied finite groups. It is efficiently implemented as a "BijectiveT SparseFunction (Z n) (Z n)". See https://en.wikipedia.org/wiki/Symmetric_group

The GrothendieckGroup is a general way to construct groups from cancellative semigroups.

FIXME: How should this be related to the Ratio type?

See wikipedia for more details.

newtype VedicSquare n Source

The Vedic Square always forms a monoid, and sometimes forms a group depending on the value of "n". (The type system isn't powerful enough to encode these special cases.)

See wikipedia for more detail.

Constructors

VedicSquare (Z n) 

Instances

Read (Z n0) => Read (VedicSquare n) Source 
Show (Z n0) => Show (VedicSquare n) Source 
Arbitrary (Z n0) => Arbitrary (VedicSquare n) Source 
NFData (Z n0) => NFData (VedicSquare n) Source 
IsMutable (VedicSquare n) Source 
KnownNat n => Monoid (VedicSquare n) Source 
KnownNat n => Semigroup (VedicSquare n) Source 
Eq_ (Z n0) => Eq_ (VedicSquare n) Source 
data Mutable m (VedicSquare n0) = Mutable_VedicSquare (Mutable m (Z n)) Source 
type Elem (VedicSquare n0) = Elem (Z n0) Source 
type Elem (VedicSquare n0) = Elem (Z n0) Source 
type Elem (VedicSquare n0) = Elem (Z n0) Source 
type Elem (VedicSquare n0) = Elem (Z n0) Source 
type Elem (VedicSquare n0) = Elem (Z n0) Source 
type Scalar (VedicSquare n0) = Scalar (Z n0) Source 
type Scalar (VedicSquare n0) = Scalar (Z n0) Source 
type Scalar (VedicSquare n0) = Scalar (Z n0) Source 
type Scalar (VedicSquare n0) = Scalar (Z n0) Source 
type Scalar (VedicSquare n0) = Scalar (Z n0) Source 
type Actor (VedicSquare n0) = Actor (Z n0) Source 
type Actor (VedicSquare n0) = Actor (Z n0) Source 
type Actor (VedicSquare n0) = Actor (Z n0) Source 
type Actor (VedicSquare n0) = Actor (Z n0) Source 
type Actor (VedicSquare n0) = Actor (Z n0) Source 
type Logic (VedicSquare n0) = Logic (Z n0) Source 
type Logic (VedicSquare n0) = Logic (Z n0) Source 
type Logic (VedicSquare n0) = Logic (Z n0) Source 
type Logic (VedicSquare n0) = Logic (Z n0) Source 
type Logic (VedicSquare n0) = Logic (Z n0) Source