A principal ideal domain is a ring in which every ideal
(the set of multiples of some generating set of elements)
is principal:
That is,
every element can be written as the multiple of some generating element.
gcd a b gives a generator for the ideal generated by a and b.
The algorithm above works whenever mod x y is smaller
(in a suitable sense) than both x and y;
otherwise the algorithm may run forever.
Laws:
divides x (lcm x y)
x `gcd` (y `gcd` z) == (x `gcd` y) `gcd` z
gcd x y * z == gcd (x*z) (y*z)
gcd x y * lcm x y == x * y(etc: canonical)
Minimal definition: * nothing, if the standard Euclidean algorithm work * if extendedGCD is implemented customly, gcd and lcm make use of it
Instances11C, …
C IntegerDefined in numeric-prelude-0.4.4 · Algebra.PrincipalIdealDomainC Int16Defined in numeric-prelude-0.4.4 · Algebra.PrincipalIdealDomainC Int32Defined in numeric-prelude-0.4.4 · Algebra.PrincipalIdealDomainC Int64Defined in numeric-prelude-0.4.4 · Algebra.PrincipalIdealDomainC Int8Defined in numeric-prelude-0.4.4 · Algebra.PrincipalIdealDomainC IntDefined in numeric-prelude-0.4.4 · Algebra.PrincipalIdealDomainC TDefined in numeric-prelude-0.4.4 · Number.PeanoIntegral a => C (T a)Defined in numeric-prelude-0.4.4 · MathObj.Wrapper.Haskell98C a => C (T a)Defined in numeric-prelude-0.4.4 · MathObj.Wrapper.NumericPrelude(Ord a, C a, C a) => C (T a)Defined in numeric-prelude-0.4.4 · Number.Complex(C a, C a) => C (T a)Defined in numeric-prelude-0.4.4 · MathObj.Polynomial