--* From BMT%WATSON.vnet.ibm.com@yktvmh.watson.ibm.com  Tue Jul 13 09:57:08 1993
--* Received: from yktvmh.watson.ibm.com by radical.watson.ibm.com (AIX 3.2/UCB 5.64/900524)
--*           id AA15349; Tue, 13 Jul 1993 09:57:08 -0400
--* Received: from watson.vnet.ibm.com by yktvmh.watson.ibm.com (IBM VM SMTP V2R3)
--*    with BSMTP id 9654; Tue, 13 Jul 93 09:58:05 EDT
--* Received: from YKTVMH by watson.vnet.ibm.com with "VAGENT.V1.0"
--*           id <A.BMT.NOTE.VAGENT2.0693.Jul.13.09:58:03.-0400>
--*           for asbugs@watson; Tue, 13 Jul 93 09:58:04 -0400
--* Received: from YKTVMH by watson.vnet.ibm.com with "VAGENT.V1.0"
--*           id 0691; Tue, 13 Jul 1993 09:58:03 EDT
--* Received: from cyst.watson.ibm.com by yktvmh.watson.ibm.com (IBM VM SMTP V2R3)
--*    with TCP; Tue, 13 Jul 93 09:58:02 EDT
--* Received: from spadserv.watson.ibm.com by cyst.watson.ibm.com (AIX 3.2/UCB 5.64/900528)
--*   id AA46615; Tue, 13 Jul 1993 09:58:18 -0400
--* Received: by spadserv.watson.ibm.com (AIX 3.2/UCB 5.64/900524)
--*           id AA19382; Tue, 13 Jul 1993 10:01:25 -0400
--* Date: Tue, 13 Jul 1993 10:01:25 -0400
--* From: bmt@spadserv.watson.ibm.com
--* X-External-Networks: yes
--* Message-Id: <9307131401.AA19382@spadserv.watson.ibm.com>
--* To: asbugs@watson.ibm.com
--* Subject: compiler gives segmentation violation due to Category BiModule whose rhs has no with [catdef777.as][29.2]

--@ Fixed  by:  SSD   Wed Jun 29 16:45:21 EDT 1994 
--@ Tested by:  none 
--@ Summary:    Fixes to code generation for categories removes this bug. 


--Copyright The Numerical Algorithms Group Limited 1991.

#include "aslib.as"

#library DemoLib       "asdem"

import DemoLib

Boolean ==> Bit
SmallInteger ==> SingleInteger
Object ==> Type
SetCategory ==> BasicType
-- temporary def
PositiveInteger ==> NonNegativeInteger

SemiGroup: Category == SetCategory with
    --operations
      *: (%,%) -> %                  ++ x*y returns the product of x and y.
      ^: (%,PositiveInteger) -> %   ++ x^n returns the repeated product
                                       ++ of x n times, i.e. exponentiation.
Rng: Category == Join(AbelianGroup,SemiGroup)

LeftModule(R:Rng):Category == AbelianGroup with
    --operations
      *: (R,%) -> %     ++ r*x returns the left multiplication of the module element x
                          ++ by the ring element r.

RightModule(RR:Rng):Category == AbelianGroup with
    --operations
      *: (%,RR) -> %  ++ x*r returns the right multiplication of the module element x
                       ++ by the ring element r.

OldRing: Category == Join(Rng,Monoid,LeftModule(% pretend Rng)) with
    --operations
      characteristic: () -> NonNegativeInteger
        ++ characteristic() returns the characteristic of the ring
        ++ this is the smallest positive integer n such that
        ++ \spad{n*x=0} for all x in the ring, or zero if no such n
        ++ exists.
        --We can not make this a constant, since some domains are mutable
      coerce: Integer -> %
        ++ coerce(i) converts the integer i to a member of the given domain.

BiModule(R:Ring,S:Ring):Category ==
  Join(LeftModule(R pretend Rng),RightModule(S pretend Rng))


 
