Ralf Hemmecke wrote:
> 
> > One remark: if we want just preserve existing functionality,
> > then the simplest way is probably to remove the third argument to
> > Localize and LocalAlgebra.  Namely, currentlty there is probably
> > no way to create nontrivial domain of SubsetCategory, so the
> > in working code third argument will be the same as the second
> > one.
> 
> Oh, good that you yourself say this. I was exactly thinking in this 
> direction and wanted to create a two parameter Localize and LocalAlgebra 
> (*in addition*, in order not to break other people's code that relies on 
> 3-parameter version).
> 

In Spad there is no overloading of constructors, so we can only
have one version of Localize and LocalAlgebra.

> But yes, I am very much in favour of removing the third parameter. Or 
> rather to replace it with a boolean function in the following sense 
> (It's similar to SubDomain.):
> 
> Instead of
> 
> Localize(M:Module R,
>           R:CommutativeRing,
>           S:SubsetCategory(Monoid, R)): Module R with
> 
> we would have
> 
> Localize(M:Module R,
>           R:CommutativeRing,
>           denominator?: R -> Boolean): Module R with
> 
> where denominator is the characteristic function for the subset S of R 
> that can be used for denominators.
> 
> Of course, there is a big problem: It cannot be ensured that the set of 
> all r for which denominator?(r) returns true is indeed a sub-monoid of 
> R.

<snip>

> > So it seems that the only current
> > use of Localize and LocalAlgebra is via Fraction.
> 
> In this case, I would even go to the extreme and remove LocalAlgebra and 
> Localize completely. If somebody later sees some need for their 
> reimplementation then we have someone who is familiar with all the 
> issues and who knows probably some use cases that should work.
> 

I am tempted to apply the patch below which just removes the
third argument.  Why:

1) Adding extra function for membership test _may_ be a good idea.
   However, I am reluctant to add untested and unused code, while
   proper developement (including creating test domain which actually
   uses new functionlity) would take a bit more time that
   I want to spent on this.
2) I think that Localize and LocalAlgebra represent important
   concept and that current domain may be good start for future
   developement.  So I am not eager to remove them.

BTW: the patch passes all tests and AFAICS should cause no
performance difference.

diff -ru trunk.bb/src/algebra/fraction.spad.pamphlet 
trunk/src/algebra/fraction.spad.pamphlet
--- trunk.bb/src/algebra/fraction.spad.pamphlet 2008-12-13 19:28:26.000000000 
+0100
+++ trunk/src/algebra/fraction.spad.pamphlet    2008-12-13 19:47:37.000000000 
+0100
@@ -24,28 +24,27 @@
 ++ Description: Localize(M,R,S) produces fractions with numerators
 ++ from an R module M and denominators from some multiplicative subset
 ++ D of R.
-Localize(M:Module R,
-         R:CommutativeRing,
-         S:SubsetCategory(Monoid, R)): Module R with
+Localize(M : Module R,
+         R : CommutativeRing): Module R with
       if M has OrderedAbelianGroup then OrderedAbelianGroup
-      _/ :(%,S) -> %
+      _/ : (%, R) -> %
          ++ x / d divides the element x by d.
-      _/ :(M,S) -> %
+      _/ : (M, R) -> %
          ++ m / d divides the element m by d.
       numer: % -> M
          ++ numer x returns the numerator of x.
-      denom: % -> S
+      denom: % -> R
          ++ denom x returns the denominator of x.
  ==
   add
     --representation
-      Rep:= Record(num:M,den:S)
+      Rep:= Record(num : M, den : R)
     --declarations
-      x,y: %
+      x, y: %
       n: Integer
       m: M
       r: R
-      d: S
+      d: R
     --definitions
       0 == [0,1]
       zero? x == zero? (x.num)
@@ -62,7 +61,7 @@
       n*x == [n*x.num,x.den]
       r*x == if r=x.den then [x.num,1] else [r*x.num,x.den]
       x/d ==
-        zero?(u:S:=d*x.den) => error "division by zero"
+        zero?(u:R:=d*x.den) => error "division by zero"
         [x.num,u]
       m/d == if zero? d then error "division by zero" else [m,d]
       coerce(x:%):OutputForm ==
@@ -92,19 +91,18 @@
 ++ Description: LocalAlgebra produces the localization of an algebra, i.e.
 ++ fractions whose numerators come from some R algebra.
 LocalAlgebra(A: Algebra R,
-             R: CommutativeRing,
-             S: SubsetCategory(Monoid, R)): Algebra R with
+             R: CommutativeRing): Algebra R with
           if A has OrderedRing then OrderedRing
-          _/ : (%,S) -> %
+          _/ : (%,R) -> %
             ++ x / d divides the element x by d.
-          _/ : (A,S) -> %
+          _/ : (A,R) -> %
             ++ a / d divides the element \spad{a} by d.
           numer: % -> A
             ++ numer x returns the numerator of x.
-          denom: % -> S
+          denom: % -> R
             ++ denom x returns the denominator of x.
- == Localize(A, R, S) add
-        1 == 1$A / 1$S
+ == Localize(A, R) add
+        1 == 1$A / 1$R
         x:% * y:% == (numer(x) * numer(y)) / (denom(x) * denom(y))
         characteristic() == characteristic()$A
 
@@ -315,7 +313,7 @@
        if S has Canonical and S has GcdDomain and S has canonicalUnitNormal
            then Canonical
             ++ \spad{Canonical} means that equal elements are in fact 
identical.
-  == LocalAlgebra(S, S, S) add
+  == LocalAlgebra(S, S) add
     Rep:= Record(num:S, den:S)
     coerce(d:S):% == [d,1]
     zero?(x:%) == zero? x.num
diff -ru trunk.bb/src/algebra/solverad.spad.pamphlet 
trunk/src/algebra/solverad.spad.pamphlet
--- trunk.bb/src/algebra/solverad.spad.pamphlet 2008-12-13 19:28:26.000000000 
+0100
+++ trunk/src/algebra/solverad.spad.pamphlet    2008-12-13 19:49:19.000000000 
+0100
@@ -35,7 +35,6 @@
     ST ==> String
     PR ==> Polynomial R
     UP ==> SparseUnivariatePolynomial PR
-    LA ==> LocalAlgebra(PR, Z, Z)
     RF ==> Fraction PR
     RE ==> Expression R
     EQ ==> Equation


-- 
                              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
-~----------~----~----~----~------~----~------~--~---

Reply via email to