Ralf Hemmecke wrote:
> 
> On 02/01/2018 02:46 AM, oldk1331 wrote:
> > We can add default implementation of 'leftRecip', 'rightRecip'
> > to be 'recip' in Group.
> 
> The patch
> 
> https://github.com/hemmecke/fricas/commit/a9a7c7d72cdc2a7e3527a505c675ee3b09fcbb05
> 
> https://github.com/hemmecke/fricas/commit/a9a7c7d72cdc2a7e3527a505c675ee3b09fcbb05.patch
> 
> looks fine to me, but I think, it should be extended, because it doesn't
> solve my original problem with Fraction Integer.
> 
> In fact, we should at least implement left/rightRecip in each place
> where recip or inv is implemented. DivisionRing is, for example, such a
> candidate. I have, however, not yet done a complete search for all such
> candidates.

It is best to do defaulting of left/right recip to recip just in
one place, that is in implementation part of MagmaWithUnit.  To do
this we need appropriate condition.  For left/right recip correct
condtion seem to be a bit tricky, so we probably need extra
attribute say TwoSidedRecip.  Then we need to set TwoSidedRecip
in CommutativeStar, DivisionRing, finite rank algebra and other
relevant places.

Anyway, the patch below amond other adds 'leftRecip' to Fraction(Integer):


--- ../trunk.pp6/src/algebra/attribs.spad       2016-09-09 14:55:45.000000000 
+0000
+++ attribs.spad        2018-02-06 15:06:58.365215225 +0000
@@ -73,13 +73,19 @@
 ++ that is if mathematically equal elements have the same data structures.
 Canonical() : Category == with ()
 
+)abbrev category ATTWSR TwoSidedRecip
+++ Description:
+++  The class of all magmas where \spad{leftRecip} and \spad{rightRecip} are
+++  the same as \spad{recip}.
+TwoSidedRecip() : Category == with ()
+
 )abbrev category ATCS CommutativeStar
 ++ Description:
 ++ The class of all commutative semigroups in multiplicative
 ++ notation.  In other words domains \spad{D} with
 ++ \spad{"*": (D, D) -> D} which is commutative.
 ++ Typically applied to rings.
-CommutativeStar() : Category == with ()
+CommutativeStar() : Category == TwoSidedRecip
 
 )abbrev category ATLR lazyRepresentation
 ++ Description:
--- ../trunk.pp6/src/algebra/naalgc.spad        2017-03-05 00:23:31.000000000 
+0000
+++ naalgc.spad 2018-02-06 15:02:31.337205716 +0000
@@ -113,6 +113,12 @@
           (x = 1) => x
           "failed"
 
+      if % has TwoSidedRecip then
+
+          leftRecip x == recip x
+
+          rightRecip x == recip x
+
 )abbrev category NASRNG NonAssociativeSemiRng
 ++ Author: Waldek Hebisch
 ++ Description:
-- 
                              Waldek Hebisch

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fricas-devel+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to