For what it's worth, the lie is in DivisionRing. Removing the comment
and the join with Algebra Fraction Integer, and recompiling one fails in
InnerPrimeField: DivisionRing compiles, but it seems that one cannot use
it... Minimal code exhibiting the problem below.
> 3) Re-organize expression domains to allow finite fields, but
> still warranty that operations can be done.
>
> If we want faithfully follow Axiom paradigm than only 2) or 3) would
> be acceptable. 3) would be ideal, but I am affraid that the best
> we can get in this direction would be some combination of
> 2) and 3). I must say that I consider 2) as very ugly. So 1)
> looks like best alternative...
why do you think that 3) is difficult?
Martin
DivisionRing(): Category ==
Join(EntireRing, Algebra Fraction Integer) with
"^": (%,Integer) -> %
++ x^n returns x raised to the integer power n.
inv : % -> %
++ inv x returns the multiplicative inverse of x.
++ Error: if x is 0.
-- Q-algebra is a lie, should be conditional on characteristic 0,
-- but knownInfo cannot handle the following commented
-- if % has CharacteristicZero then Algebra Fraction Integer
add
n: Integer
x: %
import RepeatedSquaring(%)
x ^ n: Integer ==
zero? n => 1
zero? x =>
n<0 => error "division by zero"
x
n<0 =>
expt(inv x,(-n) pretend PositiveInteger)
expt(x,n pretend PositiveInteger)
-- if % has CharacteristicZero() then
q:Fraction(Integer) * x:% == numer(q) * inv(denom(q)::%) * x
----------------------------------------------------------------------
-- minimal problematic code
----------------------------------------------------------------------
)abb category DIVRING DivisionRing
DivisionRing(): Category == with
if % has CharacteristicZero then Algebra Fraction Integer
)abb domain TESTOK TestOk
TestOk(): Join(CharacteristicZero, DivisionRing) with
foo: % -> Integer
== Integer add
Rep := Integer
foo x == x pretend Integer
)abb domain TESTKO TestKo
TestKo(): Join(CharacteristicNonZero, DivisionRing) with
foo: % -> Integer
== Integer add
Rep := Integer
foo x == x pretend Integer
--
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.