StructureClassRec:
TYPE =
RECORD [
Structure properties
category: Category,
flavor: Rope.
ROPE ←
NIL,
Flavor identifies outermost constructor (if any) used to build objects of this structure. Is a rope to allow expansion without interface changes. Examples:
"Ints"
"BigRats"
"Points"
"Polynomials"
"Matrices"
"Quotients"
printName: PrintNameProc,
shortPrintName: PrintNameProc, -- if none, should be set to printName
hashCode: CARDINAL ← 0, -- for quick checks of structure equality
structureEqual: StructureEqualityTest,
characteristic: StructureRankOp ← NIL, -- rings, fields, modules, vector spaces, algebras, divisionAlgebras only
dimension: StructureRankOp ←
NIL,--
modules, vector spaces, algebras, divisionAlgebras
only
Test whether a given item belongs to this structure (run-time typechecking)
isElementOf: ElementOfProc,
I/O and Conversion
legalFirstChar: LegalFirstCharOp,
read: ReadOp,
fromRope: FromRopeOp,
toRope: ToRopeOp,
write: WriteOp,
fromExpr: FromExprOp ← NIL,
toExpr: ToExprOp ← NIL,
recast: UnaryImbedOp ← NIL, -- convert an element of a structure that conforms to this one (should be a noop on elements of this structure). Should use fastest available determination of structure, e.g. hashCode or shortPrintName.
Addition (lattices, rings, fields, vectorSpaces, algebras, divisionAlgebras only)
add: BinaryOp ← NIL,
negate: UnaryOp ← NIL,
subtract: BinaryOp ← NIL,
zero: NullaryOp ← NIL,
Multiplication (lattices, groups, rings, fields, algebras, divisionAlgebras only)
multiply: BinaryOp ← NIL, -- assumed associative; commutative or noncommutative ok
commutative: BOOL ← TRUE,
invert: UnaryOp ← NIL,
divide: BinaryOp ← NIL, -- (lattices only) set difference operation goes here if appropriate
one: NullaryOp,
Equality testing
equal: EqualityOp ← NIL, -- need not be present in sets and lattices
Modules
rightModule: BOOL ← FALSE, -- modules are left modules by default
Scalar multiplication (modules, vectorSpaces, algebras, divisionAlgebras only)
scalarMultiply: BinaryOp ← NIL, -- unless rightModule, this is left multiplication, i.e. scalar * vector. The underlying field of a vector space may be commutative or noncommutative.
Lattice ops
booleanAlgebra: BOOL ← FALSE,
complement: UnaryOp ← NIL,
Ordered structure ops (rings, fields, modules, vectorSpaces, algebras, divisionAlgebras only)
ordered: BOOL ← FALSE,
sign: CompareToZeroOp ← NIL,
abs: UnaryOp ← NIL,
compare: BinaryCompareOp ← NIL,
Some common varieties of rings (and algebras)
integralDomain: BOOL ← FALSE,
gcdDomain: BOOL ← FALSE,
gcd: BinaryOp ← NIL, -- gcdDomains only
euclideanDomain: BOOL ← FALSE,
remainder: BinaryOp ← NIL, -- euclideanDomains only
degree: ElementRankOp ← NIL, -- euclideanDomains only
Some common varieties of fields (and divisionAlgebras)
completeField: BOOL ← FALSE,
realField: BOOL ← FALSE,
realClosedField: BOOL ← FALSE,
algebraicallyClosedField: BOOL ← FALSE,
propList: Atom.PropList ← NIL
];