diff options
author | dos-reis <gdr@axiomatics.org> | 2009-05-25 18:04:22 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2009-05-25 18:04:22 +0000 |
commit | e9cb4189b0833dd88163889d9b68a00b2e15f26c (patch) | |
tree | 1ed2443eedbd14e14b9ce6474bc9bfa1b392a3f8 /src/algebra/op.spad.pamphlet | |
parent | 785f36fcc98e8cbbd206342a73b274bc361508d6 (diff) | |
download | open-axiom-e9cb4189b0833dd88163889d9b68a00b2e15f26c.tar.gz |
* algebra/kl.spad.pamphlet (KernelFunctions2): Remove OrderedSet
requirements.
* algebra/op.spad.pamphlet (BasicOperatorFunctions1): Likewise.
Diffstat (limited to 'src/algebra/op.spad.pamphlet')
-rw-r--r-- | src/algebra/op.spad.pamphlet | 81 |
1 files changed, 37 insertions, 44 deletions
diff --git a/src/algebra/op.spad.pamphlet b/src/algebra/op.spad.pamphlet index dc1f4220..a467dd0e 100644 --- a/src/algebra/op.spad.pamphlet +++ b/src/algebra/op.spad.pamphlet @@ -251,13 +251,12 @@ BasicOperatorFunctions1(A:SetCategory): Exports == Implementation where derivative : OP -> Union(List(List A -> A), "failed") ++ derivative(op) returns the value of the "%diff" property of ++ op if it has one, and "failed" otherwise. - if A has OrderedSet then - constantOperator: A -> OP - ++ constantOperator(a) returns a nullary operator op - ++ such that \spad{op()} always evaluate to \spad{a}. - constantOpIfCan : OP -> Union(A, "failed") - ++ constantOpIfCan(op) returns \spad{a} if op is the constant - ++ nullary operator always returning \spad{a}, "failed" otherwise. + constantOperator: A -> OP + ++ constantOperator(a) returns a nullary operator op + ++ such that \spad{op()} always evaluate to \spad{a}. + constantOpIfCan : OP -> Union(A, "failed") + ++ constantOpIfCan(op) returns \spad{a} if op is the constant + ++ nullary operator always returning \spad{a}, "failed" otherwise. Implementation ==> add macro EVAL == '%eval @@ -288,43 +287,37 @@ BasicOperatorFunctions1(A:SetCategory): Exports == Implementation where derivative(op, [f first #1]$List(List A -> A)) error "Operator is not unary" - if A has OrderedSet then - cdisp : (OutputForm, List OutputForm) -> OutputForm - csex : (InputForm, List InputForm) -> InputForm - eqconst?: (OP, OP) -> Boolean - ltconst?: (OP, OP) -> Boolean - constOp : A -> OP - - opconst:OP := - comparison(equality(operator('constant, 0), eqconst?), - ltconst?) - - cdisp(a, l) == a - csex(a, l) == a - - eqconst?(a, b) == - (va := property(a, CONST)) case nothing => not has?(b, CONST) - ((vb := property(b, CONST)) case None) and - ((va@None) pretend A) = ((vb@None) pretend A) - - ltconst?(a, b) == - (va := property(a, CONST)) case nothing => has?(b, CONST) - ((vb := property(b, CONST)) case None) and - ((va@None) pretend A) < ((vb@None) pretend A) - - constOp a == - setProperty(display(copy opconst, cdisp(a::OutputForm, #1)), - CONST, a pretend None) - - constantOpIfCan op == - is?(op,'constant) and - ((u := property(op, CONST)) case None) => (u@None) pretend A - "failed" - - if A has ConvertibleTo InputForm then - constantOperator a == input(constOp a, csex(convert a, #1)) - else - constantOperator a == constOp a + cdisp(a: OutputForm, l: List OutputForm): OutputForm == a + + csex(a: InputForm, l: List InputForm): InputForm == a + + eqconst?(a: OP, b: OP): Boolean == + (va := property(a, CONST)) case nothing => not has?(b, CONST) + ((vb := property(b, CONST)) case None) and + ((va@None) pretend A) = ((vb@None) pretend A) + + ltconst?(a: OP, b: OP): Boolean == + (va := property(a, CONST)) case nothing => has?(b, CONST) + ((vb := property(b, CONST)) case None) and + before?((va@None) pretend A, (vb@None) pretend A) + + opconst:OP := + comparison(equality(operator('constant, 0), eqconst?), + ltconst?) + + constOp(a: A): OP == + setProperty(display(copy opconst, cdisp(a::OutputForm, #1)), + CONST, a pretend None) + + constantOpIfCan op == + is?(op,'constant) and + ((u := property(op, CONST)) case None) => (u@None) pretend A + "failed" + + if A has ConvertibleTo InputForm then + constantOperator a == input(constOp a, csex(convert a, #1)) + else + constantOperator a == constOp a @ \section{package COMMONOP CommonOperators} |