Serge D. Mechveliani wrote:
>
> ConstructedDomain() : Export == Implementation where
<snip>
>
> I am going to do almost all the needed in parsing a call
> via this ConstructedDomain.
>
> But for auxiliary testing and printing,
> it is desirable to convert
> ConstructedDomain <--> SymbDomCons
> ==> SymbolicConstructionOfDomain.
>
> And performance is not important for this conversion.
> I do not want to repeat this messy stuff with defining a new domain
> for the symbolic construction. Instead, I try SExpression.
> For example,
> UP(x, Fraction INT) presented as ConstructedDomain
> <-->
> (upC x (Fr Z)) :: SExpression.
>
> Here upC, x, Fr, Z are symbols converted to SExpression.
> For this, I need an injective map
> coerce : ConstructedDomain -> SExpression.
>
> By this map, the constructed domains may even occur comparable by `='.
> And the inverse (partial) map, I think, is easy to program
> (the performance is not essential in this part).
> And the result of this `coerce' must be printable to OutputForm (OF)
> easily, and this OF must be naturally readable by a human.
> This `coerce' tends to be something close to printing to OF.
>
> Now, for a Residue Ring of an EuclideanDomain,
>
> the construction includes an ideal generator g: (D: EuclideanDomain)
> (I use coerce-retract-pretend for Any <-> D
> and Type <--> EuclideanDomain).
>
> And this g needs to build into the whole SExpression.
> For this, we need an injective map D -> SExpression,
> and I am lazy to write much code.
> I thought: at run time, D will have :: OF for its elements,
> all such data are printable in my program.
> So, g :: OF :: SExpression will do, only it needs a correct
> expression.
> May be, (coerce(g)::OutputForm) pretend SExpression
>
> suggested by Waldek will do (my variant was in 2 lines). I shall try.
Unfortunatly, mapping to QutputForm is _not_ injective, there
is information loss:
(1) -> P1 := SparseUnivariatePolynomial(Integer)
(1) SparseUnivariatePolynomial(Integer)
Type: Type
(2) -> P2 := SparseUnivariatePolynomial(P1)
(2) SparseUnivariatePolynomial(SparseUnivariatePolynomial(Integer))
Type: Type
(3) -> m1 := monomial(monomial(1,1)$P1, 0)$P2
(3) ?
Type: SparseUnivariatePolynomial(SparseUnivariatePolynomial(Integer))
(4) -> m2 := monomial(1,1)$P2
(4) ?
Type: SparseUnivariatePolynomial(SparseUnivariatePolynomial(Integer))
(5) -> PRETTYPRINT(m1::OutputForm)$Lisp
"?"
(5) ()
Type: SExpression
(6) -> PRETTYPRINT(m2::OutputForm)$Lisp
"?"
(6) ()
Type: SExpression
(7) -> (m1 = m2)@Boolean
(7) false
Type: Boolean
(8) -> degree(m1)
(8) 0
Type: NonNegativeInteger
(9) -> degree(m2)
(9) 1
Type: PositiveInteger
--
Waldek Hebisch
[email protected]
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en.