deferred class interface EUCLIDEAN_DOMAIN
— For objects that satisfy the requirements of a Euclidean domain:
— multiplicative identity, no zero divisors, and a division function
— that "reduces" the elements as we divide.

feature(s) from RING_ELEMENT

— additive identity

zero: like Current

deferred

ensure

Result.is_zero

is_zero: BOOLEAN

deferred

feature(s) from RING_ELEMENT

— additive inverse

prefix "-": like Current

— need to ensure the sign changed

deferred

is_negative: BOOLEAN

— if it doesn't make sense, set this to False

deferred

feature(s) from RING_ELEMENT

— operations of elements of algebraic rings

infix "+" (other: like Current): like Current

deferred

infix "#*" (mul: INTEGER): like Current

— synonym for integer_multiple

integer_multiple (mul: INTEGER): like Current

— unoptimized. You *really* want to redefine this!

infix "-" (other: like Current): like Current

infix "*" (other: like Current): like Current

deferred

infix "#^" (exp: INTEGER): like Current

integer_power (exp: INTEGER): like Current

— slightly optimized integer exponentiation. Needs more optimization.

feature(s) from RING_ELEMENT

— output

to_string: STRING

deferred

to_latex: STRING

deferred

feature(s) from EUCLIDEAN_DOMAIN

— multiplicative identity

one: like Current

deferred

ensure

Result.is_one

is_one: BOOLEAN

deferred

feature(s) from EUCLIDEAN_DOMAIN

— division

size: INTEGER

— calculates size of Current, necessary for division
— in the case of an integer, this would be the absolute value

deferred

ensure

Result >= 0

infix "//" (other: like Current): like Current

— Euclidean division

deferred

require

not other.is_zero

ensure

(other * Result + Current \\ other).is_equal(Current)

infix "\\" (other: like Current): like Current

— Euclidean remainder

deferred

require

not other.is_zero

ensure

— requirement of Euclidean ring (e.g. Hungerford, pg. 139)

Result.is_zero or else Result.size < other.size

gcd (other: like Current): like Current

— Euclidean algorithm to compute the greatest common divisor

require

not other.is_zero

end of deferred EUCLIDEAN_DOMAIN