algebra-4.1: Constructive abstract algebra

Safe HaskellNone

Numeric.Domain.Euclidean

Documentation

class (Ring r, DecidableZero r, DecidableUnits r, Domain r) => Euclidean r whereSource

Methods

splitUnit :: r -> (r, r)Source

splitUnit r calculates its leading unit and normal form.

let (u, n) = splitUnit r in r == u * n && fst (splitUnit n) == one && isUnit u

degree :: r -> Maybe NaturalSource

Euclidean (degree) function on r.

divideSource

Arguments

:: r

elements divided by

-> r

divisor

-> (r, r)

quotient and remin

Division algorithm. a divide b calculates quotient and reminder of a divided by b.

let (q, r) = divide a p in p*q + r == a && degree r < degree q

quot :: r -> r -> rSource

rem :: r -> r -> rSource

gcd :: r -> r -> rSource

gcd a b calculates greatest common divisor of a and b.

euclid :: r -> r -> [(r, r, r)]Source

Extended euclidean algorithm.

euclid f g == xs ==> all (\(r, s, t) -> r == f * s + g * t) xs

Instances

prs :: Euclidean r => r -> r -> [(r, r, r)]Source

normalize :: Euclidean r => r -> rSource

gcd' :: Euclidean r => [r] -> rSource

chineseRemainderSource

Arguments

:: Euclidean r 
=> [(r, r)]

List of (m_i, v_i)

-> r

f with f = v_i (mod v_i)