{-# LANGUAGE TypeSynonymInstances #-}
module Algebra.Z 
  ( Z
  , Ring(..)
  ) where

import Test.QuickCheck

import Algebra.Structures.IntegralDomain
import Algebra.Structures.EuclideanDomain
import Algebra.Structures.BezoutDomain
import Algebra.Structures.StronglyDiscrete
import Algebra.Ideal


-- | Type synonym for integers.
type Z = Integer

instance Ring Z where
  (<*>) = (*)
  (<+>) = (+)
  neg   = negate
  one   = 1
  zero  = 0

instance CommutativeRing Z

instance IntegralDomain Z

propIntegralDomainZ :: Z -> Z -> Z -> Property
propIntegralDomainZ = propIntegralDomain

instance EuclideanDomain Z where
  d = abs
  quotientRemainder = quotRem


propEuclideanDomainZ :: Z -> Z -> Z -> Property
propEuclideanDomainZ = propEuclideanDomain

propBezoutDomainZ :: Ideal Z -> Z -> Z -> Z -> Property
propBezoutDomainZ = propBezoutDomain

propStronglyDiscreteZ :: Z -> Ideal Z -> Bool
propStronglyDiscreteZ = propStronglyDiscrete