<> <> <> <<>> DIRECTORY SafeStorage, IO, Atom, Rope, Basics; AlgebraClasses: CEDAR DEFINITIONS = BEGIN <> Structure: TYPE = REF StructureRec; StructureRec: TYPE = RECORD [ class: StructureClass, instanceData: REF ]; <> ClassFlavor: TYPE = {group, ring, field, vectorSpace, algebra, divisionAlgebra}; StructureClass: TYPE = REF StructureClassRec; StructureClassRec: TYPE = RECORD [ <> flavor: ClassFlavor, printName: PrintNameProc, characteristic: StructureRankOp _ NIL, -- rings, fields, vector spaces, algebras, divisionAlgebras only dimension: StructureRankOp _ NIL,-- vector spaces, algebras, divisionAlgebras only <> isElementOf: ElementOfProc _ NIL, <> legalFirstChar: LegalFirstCharOp, read: ReadOp, fromRope: FromRopeOp, toRope: ToRopeOp, write: WriteOp, <> add: BinaryOp _ NIL, negate: UnaryOp _ NIL, subtract: BinaryOp _ NIL, zero: NullaryOp _ NIL, <> multiply: BinaryOp, -- assumed associative; commutative or noncommutative ok commutative: BOOL _ TRUE, invert: UnaryOp _ NIL, divide: BinaryOp _ NIL, one: NullaryOp, <> scalarMultiply: BinaryOp _ NIL, -- this is left multiplication, i.e. scalar * vector. The underlying field of a vector space may be commutative or noncommutative. <> equal: EqualityOp, <> ordered: BOOL _ TRUE, sign: CompareToZeroOp _ NIL, abs: UnaryOp _ NIL, compare: BinaryCompareOp _ NIL, <> integralDomain: BOOL _ FALSE, gcdDomain: BOOL _ FALSE, gcd: BinaryOp _ NIL, -- gcdDomains only euclideanDomain: BOOL _ FALSE, remainder: BinaryOp _ NIL, -- euclideanDomains only degree: ElementRankOp _ NIL, -- euclideanDomains only <> completeField: BOOL _ FALSE, realField: BOOL _ FALSE, realClosedField: BOOL _ FALSE, algebraicallyClosedField: BOOL _ FALSE, <> <<$PolynomialRing>> <<$MatrixRing>> <<$EuclideanDomainMod>> <<$ExtensionField (ground field cannot be an algebraicallyClosedField)>> <<$RealExtensionField (ground field must be a realField, not also a realClosedField)>> <<$QuotientField>> <<$PowerSeriesRing>> propList: Atom.PropList _ NIL ]; <> PrintNameProc: TYPE = PROC [structure: Structure] RETURNS [Rope.ROPE]; <> StructureRankOp: TYPE = PROC [structure: Structure] RETURNS [CARDINAL]; <> <> ElementOfProc: TYPE = PROC [item: REF, structure: Structure] RETURNS [BOOL]; << True if item is an element of the structure.>> <<>> LegalFirstCharOp: TYPE = PROC [char: CHAR, structure: Structure] RETURNS [BOOL]; << True if char is legal first char in an external rep of a structure element.>> <<>> ReadOp: TYPE = PROC [in: IO.STREAM, structure: Structure _ NIL] RETURNS [out: REF]; FromRopeOp: TYPE = PROC [in: Rope.ROPE, structure: Structure _ NIL] RETURNS [out: REF]; ToRopeOp: TYPE = PROC [in: REF, structure: Structure _ NIL] RETURNS [out: Rope.ROPE]; WriteOp: TYPE = PROC [stream: IO.STREAM, in: REF, structure: Structure _ NIL]; NullaryOp: TYPE = PROC[structure: Structure _ NIL] RETURNS [result: REF]; <> UnaryOp: TYPE = PROC [arg: REF, structure: Structure _ NIL] RETURNS [result: REF]; BinaryOp: TYPE = PROC [firstArg, secondArg: REF, structure: Structure _ NIL] RETURNS [result: REF]; EqualityOp: TYPE = PROC [firstArg, secondArg: REF, structure: Structure _ NIL] RETURNS [BOOL]; CompareToZeroOp: TYPE = PROC [arg: REF, structure: Structure _ NIL] RETURNS [Basics.Comparison]; BinaryCompareOp: TYPE = PROC [firstArg, secondArg: REF, structure: Structure _ NIL] RETURNS [Basics.Comparison]; StructuredToGroundOp: TYPE = PROC [structuredElt: REF, structure: Structure _ NIL] RETURNS [groundElement: REF]; <> <<>> ElementRankOp: TYPE = PROC [arg: REF, structure: Structure _ NIL] RETURNS [CARDINAL]; <> <> FlavorToRope: PROC [flavor: ClassFlavor] RETURNS [rope: Rope.ROPE]; GetProperty: PROC [structure: Structure, prop: ATOM] RETURNS [val: REF]; <> END.