Skip to content

Commit

Permalink
Unify associative and nonassociative categories
Browse files Browse the repository at this point in the history
git-svn-id: https://fricas.svn.sourceforge.net/svnroot/fricas/trunk@2102 b0c55286-4f34-0410-a049-a1e7e93b0762
  • Loading branch information
hebisch committed Sep 7, 2016
1 parent 99c4d21 commit 4a3f9d3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 56 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
@@ -1,3 +1,9 @@
2016-02-07 Waldek Hebisch <hebisch@math.uni.wroc.pl>

* src/algebra/Makefile.in, src/algebra/catdef.spad,
src/algebra/exposed.lsp, src/interp/i-funsel.boot:
Unify associative and nonassociative categories

2016-02-06 Waldek Hebisch <hebisch@math.uni.wroc.pl>

* src/algebra/si.spad: Remove LinearlyExplicitOver Integer
Expand Down
6 changes: 3 additions & 3 deletions src/algebra/Makefile.in
Expand Up @@ -356,12 +356,12 @@ CATDOMS= A1AGG ABELGRP ABELMON ABELSG ACF ACFS AGG ALGEBRA AMR ARR2CAT \
GROUP HOAGG HYPCAT IEVALAB INS IXAGG \
JBBFC JBC JBFC KDAGG LALG LIECAT \
LNAGG LODOCAT LSAGG LZSTAGG MAGMA MAGMAWU MATCAT MODULE \
MONOGEN MONOID MTSCAT NAALG NARING NARNG NASRNG \
MONOGEN MTSCAT NAALG NARING NARNG NASRNG \
OC OM ORDRING ORDSET OREPCAT \
PDRING PFECAT POLYCAT PORDER POSET PSCAT PSETCAT QFCAT QUATCAT RADCAT \
RCAGG RCFIELD RETFROM RETRACT RING RMATCAT RNG \
RCAGG RCFIELD RETFROM RETRACT RMATCAT RNG \
RNS RPOLCAT RRCC RSETCAT \
SETAGG SETCAT SGROUP SMATCAT SPTCAT SRAGG STAGG TBAGG TENSPC TRANFUN \
SETAGG SETCAT SMATCAT SPTCAT SRAGG STAGG TBAGG TENSPC TRANFUN \
TRIGCAT TSEREXP TSETCAT UFD \
ULSCAT ULSCCAT UPOLYC UPSCAT UPXSCCA URAGG \
UTSCAT VECTCAT VSPACE XF
Expand Down
57 changes: 8 additions & 49 deletions src/algebra/catdef.spad
Expand Up @@ -367,7 +367,7 @@ DivisionRing() : Category ==
++ canonicalUnitNormal\tab{20}the canonical field is the same for
++ all associates
++ canonicalsClosed\tab{20}the product of two canonicals is itself canonical
EntireRing() : Category == Join(Ring, BiModule(%, %), noZeroDivisors) with
EntireRing() : Category == Join(Ring, noZeroDivisors) with
--operations
"exquo": (%,%) -> Union(%,"failed")
++ exquo(a, b) either returns an element c such that
Expand Down Expand Up @@ -900,28 +900,7 @@ Module(R : CommutativeRing) : Category == BiModule(R, R)
++
++ Conditional attributes:
++ unitsKnown\tab{15}\spadfun{recip} only returns "failed" on non-units
Monoid() : Category == SemiGroup with
--operations
1 : constant -> % ++ 1 is the multiplicative identity.
sample : constant -> % ++ sample yields a value of type %
one? : % -> Boolean ++ one?(x) tests if x is equal to 1.
"^": (%,NonNegativeInteger) -> %
++ x^n returns the repeated product
++ of x n times, i.e. exponentiation.
recip : % -> Union(%,"failed")
++ recip(x) tries to compute the multiplicative inverse for x
++ or "failed" if it cannot find the inverse (see unitsKnown).
add
import from RepeatedSquaring(%)
one? x == x = 1
sample() == 1
recip x ==
-- one? x => x
(x = 1) => x
"failed"
x : % ^ n : NonNegativeInteger ==
zero? n => 1
expt(x, qcoerce(n)@PositiveInteger)
Monoid() : Category == Join(SemiGroup, MagmaWithUnit)


)abbrev category OAGROUP OrderedAbelianGroup
Expand Down Expand Up @@ -1373,28 +1352,16 @@ RightModule(R : SemiRng) : Category == AbelianSemiGroup with
++ not necessarily commutative.

--Ring(): Category == Join(Rng, Monoid, LeftModule(%: Rng)) with
Ring() : Category == Join(Rng, SemiRing, LeftModule(%), unitsKnown) 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.
-- recip: % -> Union(%,"failed") -- inherited from Monoid
add
n : Integer
coerce(n) == n * 1$%
Ring() : Category == Join(Rng, SemiRing, NonAssociativeRing,
unitsKnown)

)abbrev category SRNG SemiRng
++ Author: Waldek Hebisch
++ Description:
++ The category of associative semirings, not necessarily commutative, and not
++ necessarily with a 1.

SemiRng() : Category == Join(AbelianSemiGroup, SemiGroup)
SemiRng() : Category == Join(NonAssociativeSemiRng, BiModule(%, %), SemiGroup)


)abbrev category SRING SemiRing
Expand All @@ -1403,7 +1370,7 @@ SemiRng() : Category == Join(AbelianSemiGroup, SemiGroup)
++ The category of associative semirings, not necessarily commutative,
++ with 0 and 1.

SemiRing() : Category == Join(SemiRng, AbelianMonoid, Monoid)
SemiRing() : Category == Join(NonAssociativeSemiRing, SemiRng, Monoid)


)abbrev category RNG Rng
Expand All @@ -1425,7 +1392,7 @@ SemiRing() : Category == Join(SemiRng, AbelianMonoid, Monoid)
++
++ Conditional attributes:
++ \spadnoZeroDivisors\tab{25}\spad{ ab = 0 => a=0 or b=0}
Rng() : Category == Join(AbelianGroup, SemiRng) with
Rng() : Category == Join(NonAssociativeRng, SemiRng) with
annihilate? : (%,%) -> Boolean
++ \spad{annihilate?(x,y)} holds when the product
++ of \spad{x} and \spad{y} is \spad{0}.
Expand All @@ -1450,15 +1417,7 @@ Rng() : Category == Join(AbelianGroup, SemiRng) with
++
++ Conditional attributes:
++ \spad{CommutativeStar}\tab{30}\spad{ x*y = y*x }
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.
add
import from RepeatedSquaring(%)
x : % ^ n : PositiveInteger == expt(x, n)
SemiGroup : Category == Magma

)abbrev category SETCAT SetCategory
++ Author:
Expand Down
3 changes: 0 additions & 3 deletions src/algebra/exposed.lsp
Expand Up @@ -1021,7 +1021,6 @@
(|MagmaWithUnit&| . MAGMAWU-)
(|MatrixCategory&| . MATCAT-)
(|Module&| . MODULE-)
(|Monoid&| . MONOID-)
(|MonogenicAlgebra&| . MONOGEN-)
(|NonAssociativeAlgebra&| . NAALG-)
(|NonAssociativeRing&| . NASRING-)
Expand All @@ -1046,8 +1045,6 @@
(|RecursivePolynomialCategory&| . RPOLCAT-)
(|RegularTriangularSetCategory&| . RSETCAT-)
(|RetractableTo&| . RETRACT-)
(|Ring&| . RING-)
(|SemiGroup&| . SGROUP-)
(|SetAggregate&| . SETAGG-)
(|SetCategory&| . SETCAT-)
(|SquareMatrixCategory&| . SMATCAT-)
Expand Down
2 changes: 1 addition & 1 deletion src/interp/i-funsel.boot
Expand Up @@ -1433,7 +1433,7 @@ hasCateSpecialNew(v,dom,cat,SL) ==
partialResult :=
EQCAR(dom, 'Variable) or EQCAR(dom, 'Symbol) =>
first(cat) in
'(SemiGroup AbelianSemiGroup Monoid AbelianGroup AbelianMonoid
'(Magma AbelianSemiGroup Monoid AbelianGroup AbelianMonoid
PartialDifferentialRing Ring InputForm) =>
d := ['Polynomial, $Integer]
augmentSub(v, d, SL)
Expand Down

0 comments on commit 4a3f9d3

Please sign in to comment.