Documentation |
Domains of expressions forming a field
Dom::ExpressionField(<Normal, <IsZero>>)
Dom::ExpressionField(Normal, IsZero)(e)
Dom::ExpressionField(Normal, IsZero) creates a domain of expressions forming a field, where the functions Normal and IsZero are used to normalize expressions and test for zero.
The function Normal is used to normalize the expressions representing the elements, the function IsZero is used to test the expressions for zero. It is assumed that the field has characteristic 0.
The domain cannot decide if the element expressions—given the normalizing function and zero test—actually form a field. It is up to the user to choose correct functions for normalizing and zero test and to enter only valid expressions as domains elements.
One should view this domain constructor as a pragmatic way to create a field of characteristic 0 in an ad-hoc fashion. Note that the default of using id and iszero does not yield a field really, but it is often convenient and sensible to use the resulting structure as a field.
Normal must be a function which takes an expression representing a domain element and returns the normalized expression. Normal should return FAIL if the expression is not valid.
If Normal is not given, then the system function id is used, i.e., only the kernel simplifier is used to normalize expressions.
If a normalizing function other than id is given, it is assumed that this functions returns a normal form where the zero element is uniquely represented by the constant 0.
IsZero must be a function which takes an expression representing a domain element and returns TRUE if the expression represents zero and FALSE otherwise.
If IsZero is not given, then iszero @ Normal is used for zero testing. If Normal is equal to id this functional expression is simplified to iszero.
If Normal is equal to id and IsZero is equal to iszero, a façade domain is created, i.e., the domain elements are simply expressions and are not explicitly created by new.
Otherwise the elements of the domain are explicitly created by new. Each such element has one operand, which is the expression representing the domain element. The element expressions are normalized after each operation using the function Normal.
Dom::ExpressionField(Normal, IsZero)(e) creates a field element represented by the expression e. The expression is normalized using the function Normal.
If Normal returns FAIL, it is assumed that the expression does not represent a valid field element. If this test is not fully implemented the domain cannot decide if the expression represents a valid field element. In this case it is up to the user to enter only valid expressions as field elements.
If Normal is equal to id and IsZero is equal to iszero, the domain is only a façade domain. In this case the expression e is returned after being simplified by the built-in kernel simplifier.
If Normal = id and IsZero = iszero, then Dom::ArithmeticalExpression, else Dom::BaseDomain.
If Normal = id and IsZero = iszero, then Ax::efficientOperation ("_divide"), Ax::efficientOperation ("_mult"), Ax::efficientOperation("_invert"), else Ax::normalRep.
If Normal = id and IsZero = iszero and IsZero = iszero, then Ax::systemRep.
Dom::ExpressionField(normal) creates a field of rational expressions over the rationals. The expressions representing the field elements are allways normalized by normal:
Fn := Dom::ExpressionField(normal): a := Fn((x^2 - 1)/(x - 1))
The field elements are explicit elements of the domain:
domtype(a)
In the domain Dom::ExpressionField(id, iszero@normal) the expressions representing the elements are normalized by the kernel simplifier only:
Fi := Dom::ExpressionField(id, iszero@normal): a := Fi((x^2 - 1)/(x - 1))
The elements of this domain are not normalized (when viewed as rational expressions over the rationals), thus the domain does not have the axiom Ax::normalRep:
b := a/Fi(x + 1) - Fi(1)
But nevertheless this domain also represents the field of rational expressions over the rationals, because zero is detected correctly by the function iszero @ normal:
iszero(b)
Normal |
A function used to normalize the expressions of the domain; default is id. |
IsZero |
A function used to test the expressions of the domain for zero; default is iszero @ Normal. |
e |
An expression representing a field element. |
"characteristic" | The characteristic of the fields created by this constructor is assumed to be 0. |
"one" | The element represented by the expression 1 is assumed to be a neutral element w.r.t. "_mult". |
"zero" | The element represented by the expression 0 is assumed to be a neutral element w.r.t. "_plus". |