HaskellForMaths-0.4.8: Combinatorics, group theory, commutative algebra, non-commutative algebra

Safe HaskellNone
LanguageHaskell98

Math.Core.Field

Description

A module defining the field Q of rationals and the small finite fields (Galois fields) F2, F3, F4, F5, F7, F8, F9, F11, F13, F16, F17, F19, F23, F25.

Given a prime power q, Fq is the type representing elements of the field (eg F4), fq is a list of the elements of the field, beginning 0,1,... (eg f4), and for prime power fields, aq is a primitive element, which generates the multiplicative group (eg a4).

The design philosophy is that fq, the list of elements, represents the field. Thus, many functions elsewhere in the library expect to take fq as an argument, telling them which field to work over.

Synopsis

Documentation

newtype Q Source #

Q is just the rationals, but with a better show function than the Prelude version

Constructors

Q Rational 

Instances

Eq Q Source # 

Methods

(==) :: Q -> Q -> Bool #

(/=) :: Q -> Q -> Bool #

Fractional Q Source # 

Methods

(/) :: Q -> Q -> Q #

recip :: Q -> Q #

fromRational :: Rational -> Q #

Fractional QNF # 

Methods

(/) :: QNF -> QNF -> QNF #

recip :: QNF -> QNF #

fromRational :: Rational -> QNF #

Num Q Source # 

Methods

(+) :: Q -> Q -> Q #

(-) :: Q -> Q -> Q #

(*) :: Q -> Q -> Q #

negate :: Q -> Q #

abs :: Q -> Q #

signum :: Q -> Q #

fromInteger :: Integer -> Q #

Ord Q Source # 

Methods

compare :: Q -> Q -> Ordering #

(<) :: Q -> Q -> Bool #

(<=) :: Q -> Q -> Bool #

(>) :: Q -> Q -> Bool #

(>=) :: Q -> Q -> Bool #

max :: Q -> Q -> Q #

min :: Q -> Q -> Q #

Show Q Source # 

Methods

showsPrec :: Int -> Q -> ShowS #

show :: Q -> String #

showList :: [Q] -> ShowS #

newtype F2 Source #

F2 is a type for the finite field with 2 elements

Constructors

F2 Int 

Instances

Eq F2 Source # 

Methods

(==) :: F2 -> F2 -> Bool #

(/=) :: F2 -> F2 -> Bool #

Fractional F2 Source # 

Methods

(/) :: F2 -> F2 -> F2 #

recip :: F2 -> F2 #

fromRational :: Rational -> F2 #

Num F2 Source # 

Methods

(+) :: F2 -> F2 -> F2 #

(-) :: F2 -> F2 -> F2 #

(*) :: F2 -> F2 -> F2 #

negate :: F2 -> F2 #

abs :: F2 -> F2 #

signum :: F2 -> F2 #

fromInteger :: Integer -> F2 #

Ord F2 Source # 

Methods

compare :: F2 -> F2 -> Ordering #

(<) :: F2 -> F2 -> Bool #

(<=) :: F2 -> F2 -> Bool #

(>) :: F2 -> F2 -> Bool #

(>=) :: F2 -> F2 -> Bool #

max :: F2 -> F2 -> F2 #

min :: F2 -> F2 -> F2 #

Show F2 Source # 

Methods

showsPrec :: Int -> F2 -> ShowS #

show :: F2 -> String #

showList :: [F2] -> ShowS #

FinSet F2 Source # 

Methods

elts :: [F2] Source #

f2 :: [F2] Source #

f2 is a list of the elements of F2

newtype F3 Source #

F3 is a type for the finite field with 3 elements

Constructors

F3 Int 

Instances

Eq F3 Source # 

Methods

(==) :: F3 -> F3 -> Bool #

(/=) :: F3 -> F3 -> Bool #

Fractional F3 Source # 

Methods

(/) :: F3 -> F3 -> F3 #

recip :: F3 -> F3 #

fromRational :: Rational -> F3 #

Num F3 Source # 

Methods

(+) :: F3 -> F3 -> F3 #

(-) :: F3 -> F3 -> F3 #

(*) :: F3 -> F3 -> F3 #

negate :: F3 -> F3 #

abs :: F3 -> F3 #

signum :: F3 -> F3 #

fromInteger :: Integer -> F3 #

Ord F3 Source # 

Methods

compare :: F3 -> F3 -> Ordering #

(<) :: F3 -> F3 -> Bool #

(<=) :: F3 -> F3 -> Bool #

(>) :: F3 -> F3 -> Bool #

(>=) :: F3 -> F3 -> Bool #

max :: F3 -> F3 -> F3 #

min :: F3 -> F3 -> F3 #

Show F3 Source # 

Methods

showsPrec :: Int -> F3 -> ShowS #

show :: F3 -> String #

showList :: [F3] -> ShowS #

FinSet F3 Source # 

Methods

elts :: [F3] Source #

f3 :: [F3] Source #

f3 is a list of the elements of F3

newtype F5 Source #

F5 is a type for the finite field with 5 elements

Constructors

F5 Int 

Instances

Eq F5 Source # 

Methods

(==) :: F5 -> F5 -> Bool #

(/=) :: F5 -> F5 -> Bool #

Fractional F5 Source # 

Methods

(/) :: F5 -> F5 -> F5 #

recip :: F5 -> F5 #

fromRational :: Rational -> F5 #

Num F5 Source # 

Methods

(+) :: F5 -> F5 -> F5 #

(-) :: F5 -> F5 -> F5 #

(*) :: F5 -> F5 -> F5 #

negate :: F5 -> F5 #

abs :: F5 -> F5 #

signum :: F5 -> F5 #

fromInteger :: Integer -> F5 #

Ord F5 Source # 

Methods

compare :: F5 -> F5 -> Ordering #

(<) :: F5 -> F5 -> Bool #

(<=) :: F5 -> F5 -> Bool #

(>) :: F5 -> F5 -> Bool #

(>=) :: F5 -> F5 -> Bool #

max :: F5 -> F5 -> F5 #

min :: F5 -> F5 -> F5 #

Show F5 Source # 

Methods

showsPrec :: Int -> F5 -> ShowS #

show :: F5 -> String #

showList :: [F5] -> ShowS #

FinSet F5 Source # 

Methods

elts :: [F5] Source #

f5 :: [F5] Source #

f5 is a list of the elements of F5

newtype F7 Source #

F7 is a type for the finite field with 7 elements

Constructors

F7 Int 

Instances

Eq F7 Source # 

Methods

(==) :: F7 -> F7 -> Bool #

(/=) :: F7 -> F7 -> Bool #

Fractional F7 Source # 

Methods

(/) :: F7 -> F7 -> F7 #

recip :: F7 -> F7 #

fromRational :: Rational -> F7 #

Num F7 Source # 

Methods

(+) :: F7 -> F7 -> F7 #

(-) :: F7 -> F7 -> F7 #

(*) :: F7 -> F7 -> F7 #

negate :: F7 -> F7 #

abs :: F7 -> F7 #

signum :: F7 -> F7 #

fromInteger :: Integer -> F7 #

Ord F7 Source # 

Methods

compare :: F7 -> F7 -> Ordering #

(<) :: F7 -> F7 -> Bool #

(<=) :: F7 -> F7 -> Bool #

(>) :: F7 -> F7 -> Bool #

(>=) :: F7 -> F7 -> Bool #

max :: F7 -> F7 -> F7 #

min :: F7 -> F7 -> F7 #

Show F7 Source # 

Methods

showsPrec :: Int -> F7 -> ShowS #

show :: F7 -> String #

showList :: [F7] -> ShowS #

FinSet F7 Source # 

Methods

elts :: [F7] Source #

f7 :: [F7] Source #

f7 is a list of the elements of F7

newtype F11 Source #

F11 is a type for the finite field with 11 elements

Constructors

F11 Int 

Instances

Eq F11 Source # 

Methods

(==) :: F11 -> F11 -> Bool #

(/=) :: F11 -> F11 -> Bool #

Fractional F11 Source # 

Methods

(/) :: F11 -> F11 -> F11 #

recip :: F11 -> F11 #

fromRational :: Rational -> F11 #

Num F11 Source # 

Methods

(+) :: F11 -> F11 -> F11 #

(-) :: F11 -> F11 -> F11 #

(*) :: F11 -> F11 -> F11 #

negate :: F11 -> F11 #

abs :: F11 -> F11 #

signum :: F11 -> F11 #

fromInteger :: Integer -> F11 #

Ord F11 Source # 

Methods

compare :: F11 -> F11 -> Ordering #

(<) :: F11 -> F11 -> Bool #

(<=) :: F11 -> F11 -> Bool #

(>) :: F11 -> F11 -> Bool #

(>=) :: F11 -> F11 -> Bool #

max :: F11 -> F11 -> F11 #

min :: F11 -> F11 -> F11 #

Show F11 Source # 

Methods

showsPrec :: Int -> F11 -> ShowS #

show :: F11 -> String #

showList :: [F11] -> ShowS #

FinSet F11 Source # 

Methods

elts :: [F11] Source #

f11 :: [F11] Source #

f11 is a list of the elements of F11

newtype F13 Source #

F13 is a type for the finite field with 13 elements

Constructors

F13 Int 

Instances

Eq F13 Source # 

Methods

(==) :: F13 -> F13 -> Bool #

(/=) :: F13 -> F13 -> Bool #

Fractional F13 Source # 

Methods

(/) :: F13 -> F13 -> F13 #

recip :: F13 -> F13 #

fromRational :: Rational -> F13 #

Num F13 Source # 

Methods

(+) :: F13 -> F13 -> F13 #

(-) :: F13 -> F13 -> F13 #

(*) :: F13 -> F13 -> F13 #

negate :: F13 -> F13 #

abs :: F13 -> F13 #

signum :: F13 -> F13 #

fromInteger :: Integer -> F13 #

Ord F13 Source # 

Methods

compare :: F13 -> F13 -> Ordering #

(<) :: F13 -> F13 -> Bool #

(<=) :: F13 -> F13 -> Bool #

(>) :: F13 -> F13 -> Bool #

(>=) :: F13 -> F13 -> Bool #

max :: F13 -> F13 -> F13 #

min :: F13 -> F13 -> F13 #

Show F13 Source # 

Methods

showsPrec :: Int -> F13 -> ShowS #

show :: F13 -> String #

showList :: [F13] -> ShowS #

FinSet F13 Source # 

Methods

elts :: [F13] Source #

f13 :: [F13] Source #

f13 is a list of the elements of F13

newtype F17 Source #

F17 is a type for the finite field with 17 elements

Constructors

F17 Int 

Instances

Eq F17 Source # 

Methods

(==) :: F17 -> F17 -> Bool #

(/=) :: F17 -> F17 -> Bool #

Fractional F17 Source # 

Methods

(/) :: F17 -> F17 -> F17 #

recip :: F17 -> F17 #

fromRational :: Rational -> F17 #

Num F17 Source # 

Methods

(+) :: F17 -> F17 -> F17 #

(-) :: F17 -> F17 -> F17 #

(*) :: F17 -> F17 -> F17 #

negate :: F17 -> F17 #

abs :: F17 -> F17 #

signum :: F17 -> F17 #

fromInteger :: Integer -> F17 #

Ord F17 Source # 

Methods

compare :: F17 -> F17 -> Ordering #

(<) :: F17 -> F17 -> Bool #

(<=) :: F17 -> F17 -> Bool #

(>) :: F17 -> F17 -> Bool #

(>=) :: F17 -> F17 -> Bool #

max :: F17 -> F17 -> F17 #

min :: F17 -> F17 -> F17 #

Show F17 Source # 

Methods

showsPrec :: Int -> F17 -> ShowS #

show :: F17 -> String #

showList :: [F17] -> ShowS #

FinSet F17 Source # 

Methods

elts :: [F17] Source #

f17 :: [F17] Source #

f17 is a list of the elements of F17

newtype F19 Source #

F19 is a type for the finite field with 19 elements

Constructors

F19 Int 

Instances

Eq F19 Source # 

Methods

(==) :: F19 -> F19 -> Bool #

(/=) :: F19 -> F19 -> Bool #

Fractional F19 Source # 

Methods

(/) :: F19 -> F19 -> F19 #

recip :: F19 -> F19 #

fromRational :: Rational -> F19 #

Num F19 Source # 

Methods

(+) :: F19 -> F19 -> F19 #

(-) :: F19 -> F19 -> F19 #

(*) :: F19 -> F19 -> F19 #

negate :: F19 -> F19 #

abs :: F19 -> F19 #

signum :: F19 -> F19 #

fromInteger :: Integer -> F19 #

Ord F19 Source # 

Methods

compare :: F19 -> F19 -> Ordering #

(<) :: F19 -> F19 -> Bool #

(<=) :: F19 -> F19 -> Bool #

(>) :: F19 -> F19 -> Bool #

(>=) :: F19 -> F19 -> Bool #

max :: F19 -> F19 -> F19 #

min :: F19 -> F19 -> F19 #

Show F19 Source # 

Methods

showsPrec :: Int -> F19 -> ShowS #

show :: F19 -> String #

showList :: [F19] -> ShowS #

FinSet F19 Source # 

Methods

elts :: [F19] Source #

f19 :: [F19] Source #

f19 is a list of the elements of F19

newtype F23 Source #

F23 is a type for the finite field with 23 elements

Constructors

F23 Int 

Instances

Eq F23 Source # 

Methods

(==) :: F23 -> F23 -> Bool #

(/=) :: F23 -> F23 -> Bool #

Fractional F23 Source # 

Methods

(/) :: F23 -> F23 -> F23 #

recip :: F23 -> F23 #

fromRational :: Rational -> F23 #

Num F23 Source # 

Methods

(+) :: F23 -> F23 -> F23 #

(-) :: F23 -> F23 -> F23 #

(*) :: F23 -> F23 -> F23 #

negate :: F23 -> F23 #

abs :: F23 -> F23 #

signum :: F23 -> F23 #

fromInteger :: Integer -> F23 #

Ord F23 Source # 

Methods

compare :: F23 -> F23 -> Ordering #

(<) :: F23 -> F23 -> Bool #

(<=) :: F23 -> F23 -> Bool #

(>) :: F23 -> F23 -> Bool #

(>=) :: F23 -> F23 -> Bool #

max :: F23 -> F23 -> F23 #

min :: F23 -> F23 -> F23 #

Show F23 Source # 

Methods

showsPrec :: Int -> F23 -> ShowS #

show :: F23 -> String #

showList :: [F23] -> ShowS #

FinSet F23 Source # 

Methods

elts :: [F23] Source #

f23 :: [F23] Source #

f23 is a list of the elements of F23

newtype F4 Source #

F4 is a type for the finite field with 4 elements. F4 is represented as the extension of F2 by an element a4 satisfying x^2+x+1 = 0

Constructors

F4 Int 

Instances

Eq F4 Source # 

Methods

(==) :: F4 -> F4 -> Bool #

(/=) :: F4 -> F4 -> Bool #

Fractional F4 Source # 

Methods

(/) :: F4 -> F4 -> F4 #

recip :: F4 -> F4 #

fromRational :: Rational -> F4 #

Num F4 Source # 

Methods

(+) :: F4 -> F4 -> F4 #

(-) :: F4 -> F4 -> F4 #

(*) :: F4 -> F4 -> F4 #

negate :: F4 -> F4 #

abs :: F4 -> F4 #

signum :: F4 -> F4 #

fromInteger :: Integer -> F4 #

Ord F4 Source # 

Methods

compare :: F4 -> F4 -> Ordering #

(<) :: F4 -> F4 -> Bool #

(<=) :: F4 -> F4 -> Bool #

(>) :: F4 -> F4 -> Bool #

(>=) :: F4 -> F4 -> Bool #

max :: F4 -> F4 -> F4 #

min :: F4 -> F4 -> F4 #

Show F4 Source # 

Methods

showsPrec :: Int -> F4 -> ShowS #

show :: F4 -> String #

showList :: [F4] -> ShowS #

FinSet F4 Source # 

Methods

elts :: [F4] Source #

a4 :: F4 Source #

a4 is a primitive element for F4 as an extension over F2. a4 satisfies x^2+x+1 = 0.

f4 :: [F4] Source #

f4 is a list of the elements of F4

powers :: (Num a, Eq a) => a -> [a] Source #

newtype F8 Source #

F8 is a type for the finite field with 8 elements. F8 is represented as the extension of F2 by an element a8 satisfying x^3+x+1 = 0

Constructors

F8 Int 

Instances

Eq F8 Source # 

Methods

(==) :: F8 -> F8 -> Bool #

(/=) :: F8 -> F8 -> Bool #

Fractional F8 Source # 

Methods

(/) :: F8 -> F8 -> F8 #

recip :: F8 -> F8 #

fromRational :: Rational -> F8 #

Num F8 Source # 

Methods

(+) :: F8 -> F8 -> F8 #

(-) :: F8 -> F8 -> F8 #

(*) :: F8 -> F8 -> F8 #

negate :: F8 -> F8 #

abs :: F8 -> F8 #

signum :: F8 -> F8 #

fromInteger :: Integer -> F8 #

Ord F8 Source # 

Methods

compare :: F8 -> F8 -> Ordering #

(<) :: F8 -> F8 -> Bool #

(<=) :: F8 -> F8 -> Bool #

(>) :: F8 -> F8 -> Bool #

(>=) :: F8 -> F8 -> Bool #

max :: F8 -> F8 -> F8 #

min :: F8 -> F8 -> F8 #

Show F8 Source # 

Methods

showsPrec :: Int -> F8 -> ShowS #

show :: F8 -> String #

showList :: [F8] -> ShowS #

FinSet F8 Source # 

Methods

elts :: [F8] Source #

a8 :: F8 Source #

a8 is a primitive element for F8 as an extension over F2. a8 satisfies x^3+x+1 = 0.

f8 :: [F8] Source #

f8 is a list of the elements of F8

newtype F9 Source #

F9 is a type for the finite field with 9 elements. F9 is represented as the extension of F3 by an element a9 satisfying x^2+2x+2 = 0

Constructors

F9 Int 

Instances

Eq F9 Source # 

Methods

(==) :: F9 -> F9 -> Bool #

(/=) :: F9 -> F9 -> Bool #

Fractional F9 Source # 

Methods

(/) :: F9 -> F9 -> F9 #

recip :: F9 -> F9 #

fromRational :: Rational -> F9 #

Num F9 Source # 

Methods

(+) :: F9 -> F9 -> F9 #

(-) :: F9 -> F9 -> F9 #

(*) :: F9 -> F9 -> F9 #

negate :: F9 -> F9 #

abs :: F9 -> F9 #

signum :: F9 -> F9 #

fromInteger :: Integer -> F9 #

Ord F9 Source # 

Methods

compare :: F9 -> F9 -> Ordering #

(<) :: F9 -> F9 -> Bool #

(<=) :: F9 -> F9 -> Bool #

(>) :: F9 -> F9 -> Bool #

(>=) :: F9 -> F9 -> Bool #

max :: F9 -> F9 -> F9 #

min :: F9 -> F9 -> F9 #

Show F9 Source # 

Methods

showsPrec :: Int -> F9 -> ShowS #

show :: F9 -> String #

showList :: [F9] -> ShowS #

FinSet F9 Source # 

Methods

elts :: [F9] Source #

a9 :: F9 Source #

a9 is a primitive element for F9 as an extension over F3. a9 satisfies x^2+2x+2 = 0.

f9 :: [F9] Source #

f9 is a list of the elements of F9

newtype F16 Source #

F16 is a type for the finite field with 16 elements. F16 is represented as the extension of F2 by an element a16 satisfying x^4+x+1 = 0

Constructors

F16 Int 

Instances

Eq F16 Source # 

Methods

(==) :: F16 -> F16 -> Bool #

(/=) :: F16 -> F16 -> Bool #

Fractional F16 Source # 

Methods

(/) :: F16 -> F16 -> F16 #

recip :: F16 -> F16 #

fromRational :: Rational -> F16 #

Num F16 Source # 

Methods

(+) :: F16 -> F16 -> F16 #

(-) :: F16 -> F16 -> F16 #

(*) :: F16 -> F16 -> F16 #

negate :: F16 -> F16 #

abs :: F16 -> F16 #

signum :: F16 -> F16 #

fromInteger :: Integer -> F16 #

Ord F16 Source # 

Methods

compare :: F16 -> F16 -> Ordering #

(<) :: F16 -> F16 -> Bool #

(<=) :: F16 -> F16 -> Bool #

(>) :: F16 -> F16 -> Bool #

(>=) :: F16 -> F16 -> Bool #

max :: F16 -> F16 -> F16 #

min :: F16 -> F16 -> F16 #

Show F16 Source # 

Methods

showsPrec :: Int -> F16 -> ShowS #

show :: F16 -> String #

showList :: [F16] -> ShowS #

FinSet F16 Source # 

Methods

elts :: [F16] Source #

a16 :: F16 Source #

a16 is a primitive element for F16 as an extension over F2. a16 satisfies x^4+x+1 = 0.

f16 :: [F16] Source #

f16 is a list of the elements of F16

newtype F25 Source #

F25 is a type for the finite field with 25 elements. F25 is represented as the extension of F5 by an element a25 satisfying x^2+4x+2 = 0

Constructors

F25 Int 

Instances

Eq F25 Source # 

Methods

(==) :: F25 -> F25 -> Bool #

(/=) :: F25 -> F25 -> Bool #

Fractional F25 Source # 

Methods

(/) :: F25 -> F25 -> F25 #

recip :: F25 -> F25 #

fromRational :: Rational -> F25 #

Num F25 Source # 

Methods

(+) :: F25 -> F25 -> F25 #

(-) :: F25 -> F25 -> F25 #

(*) :: F25 -> F25 -> F25 #

negate :: F25 -> F25 #

abs :: F25 -> F25 #

signum :: F25 -> F25 #

fromInteger :: Integer -> F25 #

Ord F25 Source # 

Methods

compare :: F25 -> F25 -> Ordering #

(<) :: F25 -> F25 -> Bool #

(<=) :: F25 -> F25 -> Bool #

(>) :: F25 -> F25 -> Bool #

(>=) :: F25 -> F25 -> Bool #

max :: F25 -> F25 -> F25 #

min :: F25 -> F25 -> F25 #

Show F25 Source # 

Methods

showsPrec :: Int -> F25 -> ShowS #

show :: F25 -> String #

showList :: [F25] -> ShowS #

FinSet F25 Source # 

Methods

elts :: [F25] Source #

a25 :: F25 Source #

a25 is a primitive element for F25 as an extension over F5. a25 satisfies x^2+4x+2 = 0.

f25 :: [F25] Source #

f25 is a list of the elements of F25