Safe Haskell | None |
---|---|
Language | Haskell2010 |
Arbitrary prime fields, naive implementation
Synopsis
- newtype WitnessFp (p :: Nat) = WitnessFp {
- fromWitnessFp :: IsPrime p
- data SomeWitnessFp = forall p. SomeWitnessFp (WitnessFp p)
- mkPrimeField :: Integer -> Maybe SomeWitnessFp
- unsafePrimeField :: Integer -> SomeWitnessFp
- data Fp (p :: Nat)
Witness for the existence of the field
data SomeWitnessFp Source #
forall p. SomeWitnessFp (WitnessFp p) |
Instances
Show SomeWitnessFp Source # | |
Defined in Math.FiniteField.PrimeField.Generic showsPrec :: Int -> SomeWitnessFp -> ShowS # show :: SomeWitnessFp -> String # showList :: [SomeWitnessFp] -> ShowS # |
mkPrimeField :: Integer -> Maybe SomeWitnessFp Source #
Note: currently this checks the primality of the input using trial division, so it's not really practical...
But you can use unsafePrimeField
to cheat.
unsafePrimeField :: Integer -> SomeWitnessFp Source #
You are responsible for guaranteeing that the input is a prime.
Field elements
An element of the prime field F_p