diff options
author | dos-reis <gdr@axiomatics.org> | 2011-03-09 23:54:10 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2011-03-09 23:54:10 +0000 |
commit | 8c47810df65c610513d4be825bd6ee9a56f97f9f (patch) | |
tree | 7117bf9c5177324de1e4a012b635ed667dec817f /src/algebra | |
parent | ccd024277fb8eab4a8b22ed160f4da1609dd94e9 (diff) | |
download | open-axiom-8c47810df65c610513d4be825bd6ee9a56f97f9f.tar.gz |
* algebra/catdef.spad.pamphlet (StepThrough) [nextItem]: Now
return Maybe %.
* algebra/ffcat.spad.pamphlet: Propagate change.
* algebra/fmod.spad.pamphlet: Likewise.
* algebra/fraction.spad.pamphlet: Likewise.
* algebra/integer.spad.pamphlet: Likewise.
* algebra/pfbr.spad.pamphlet: Likewise.
* algebra/polycat.spad.pamphlet: Likewise.
* algebra/si.spad.pamphlet: Likewise.
Diffstat (limited to 'src/algebra')
-rw-r--r-- | src/algebra/catdef.spad.pamphlet | 7 | ||||
-rw-r--r-- | src/algebra/ffcat.spad.pamphlet | 7 | ||||
-rw-r--r-- | src/algebra/fmod.spad.pamphlet | 6 | ||||
-rw-r--r-- | src/algebra/fraction.spad.pamphlet | 6 | ||||
-rw-r--r-- | src/algebra/integer.spad.pamphlet | 2 | ||||
-rw-r--r-- | src/algebra/pfbr.spad.pamphlet | 10 | ||||
-rw-r--r-- | src/algebra/polycat.spad.pamphlet | 20 | ||||
-rw-r--r-- | src/algebra/si.spad.pamphlet | 8 |
8 files changed, 34 insertions, 32 deletions
diff --git a/src/algebra/catdef.spad.pamphlet b/src/algebra/catdef.spad.pamphlet index 2ca2216b..694d169f 100644 --- a/src/algebra/catdef.spad.pamphlet +++ b/src/algebra/catdef.spad.pamphlet @@ -1963,13 +1963,14 @@ SetCategory(): Category == Join(BasicType,CoercibleTo OutputForm) with ++ starting from any initial element. ++ ++ Conditional attributes: -++ infinite\tab{15}repeated \spad{nextItem}'s are never "failed". +++ infinite\tab{15}repeated \spad{nextItem}'s are never \spad{nothing}. StepThrough(): Category == SetCategory with --operations init: % ++ init() chooses an initial object for stepping. - nextItem: % -> Union(%,"failed") - ++ nextItem(x) returns the next item, or "failed" if domain is exhausted. + nextItem: % -> Maybe % + ++ \spad{nextItem(x)} returns the next item, or \spad{failed} + ++ if domain is exhausted. @ \section{category UFD UniqueFactorizationDomain} diff --git a/src/algebra/ffcat.spad.pamphlet b/src/algebra/ffcat.spad.pamphlet index 2d1d6337..78a1c6a3 100644 --- a/src/algebra/ffcat.spad.pamphlet +++ b/src/algebra/ffcat.spad.pamphlet @@ -585,9 +585,10 @@ FiniteFieldCategory() : Category ==_ differentiate x == 0 init() == 0 - nextItem(a) == - zero?(a:=index(lookup(a)+1)) => "failed" - a + nextItem a == + a := index(lookup(a)+1) + zero? a => nothing + just a order(e):OnePointCompletion(PositiveInteger) == (order(e)@PI)::OnePointCompletion(PositiveInteger) diff --git a/src/algebra/fmod.spad.pamphlet b/src/algebra/fmod.spad.pamphlet index b40501f5..071bd6e7 100644 --- a/src/algebra/fmod.spad.pamphlet +++ b/src/algebra/fmod.spad.pamphlet @@ -40,10 +40,10 @@ IntegerMod(p:PositiveInteger): 0 == per(0$Rep) 1 == per(1$Rep) init == 0 - nextItem(n) == + nextItem n == m := n+1 - m = 0 => "failed" - m + m = 0 => nothing + just m zero? x == rep x = 0 one? x == rep x = 1 diff --git a/src/algebra/fraction.spad.pamphlet b/src/algebra/fraction.spad.pamphlet index a1ef630b..1e691362 100644 --- a/src/algebra/fraction.spad.pamphlet +++ b/src/algebra/fraction.spad.pamphlet @@ -173,10 +173,10 @@ QuotientFieldCategory(S: IntegralDomain): Category == init() == init()$S / 1$S nextItem(n) == - m:= nextItem(numer(n)) - m case "failed" => + m:= nextItem numer n + m case nothing => error "We seem to have a Fraction of a finite object" - m / 1 + just(m / 1) map(fn, x) == (fn numer x) / (fn denom x) reducedSystem(m:Matrix %):Matrix S == clearDenominator m diff --git a/src/algebra/integer.spad.pamphlet b/src/algebra/integer.spad.pamphlet index f660ec96..0b70def4 100644 --- a/src/algebra/integer.spad.pamphlet +++ b/src/algebra/integer.spad.pamphlet @@ -78,7 +78,7 @@ Integer: Join(IntegerNumberSystem, ConvertibleTo String, OpenMath) with noetherian ++ ascending chain condition on ideals. infinite - ++ nextItem never returns "failed". + ++ nextItem never returns \spad{nothing}. == add ZP ==> SparseUnivariatePolynomial % ZZP ==> SparseUnivariatePolynomial Integer diff --git a/src/algebra/pfbr.spad.pamphlet b/src/algebra/pfbr.spad.pamphlet index 85943f84..5919c7ec 100644 --- a/src/algebra/pfbr.spad.pamphlet +++ b/src/algebra/pfbr.spad.pamphlet @@ -176,10 +176,10 @@ PolynomialFactorizationByRecursionUnivariate(R, S): public == private where while true repeat tempAns:=factorSFBRlcUnitInner(pp,val) not (tempAns case "failed") => return tempAns - val1:=nextItem val - val1 case "failed" => + val1 := nextItem val + val1 case nothing => error "at this point, we know we have a finite field" - val:=val1 + val := val1 else factorSFBRlcUnit(pp) == val:R := randomR() @@ -191,7 +191,7 @@ PolynomialFactorizationByRecursionUnivariate(R, S): public == private where randomCount:R:= init() randomR() == v:=nextItem(randomCount) - v case "failed" => + v case nothing => SAY$Lisp "Taking another set of random values" randomCount:=init() randomCount @@ -404,7 +404,7 @@ PolynomialFactorizationByRecursion(R,E, VarSet:OrderedSet, S): public == tempAns:=factorSFBRlcUnitInner(lvpp,pp,val) not (tempAns case "failed") => return tempAns val1:=nextItem val - val1 case "failed" => + val1 case nothing => error "at this point, we know we have a finite field" val:=val1 else diff --git a/src/algebra/polycat.spad.pamphlet b/src/algebra/polycat.spad.pamphlet index 8931a6de..499b3903 100644 --- a/src/algebra/polycat.spad.pamphlet +++ b/src/algebra/polycat.spad.pamphlet @@ -842,25 +842,25 @@ UnivariatePolynomialCategory(R:Ring): Category == if R has StepThrough then init() == init()$R::% - nextItemInner: % -> Union(%,"failed") + nextItemInner: % -> Maybe % nextItemInner(n) == - zero? n => nextItem(0$R)::R::% -- assumed not to fail + zero? n => just(nextItem(0$R)::R::%) -- assumed not to fail zero? degree n => nn:=nextItem leadingCoefficient n - nn case "failed" => "failed" - nn::R::% + nn case nothing => nothing + just(nn::R::%) n1:=reductum n n2:=nextItemInner n1 -- try stepping the reductum - n2 case % => monomial(leadingCoefficient n,degree n) + n2 + n2 case % => just(monomial(leadingCoefficient n,degree n) + n2) 1+degree n1 < degree n => -- there was a hole between lt n and n1 - monomial(leadingCoefficient n,degree n)+ - monomial(nextItem(init()$R)::R,1+degree n1) + just(monomial(leadingCoefficient n,degree n)+ + monomial(nextItem(init()$R)::R,1+degree n1)) n3:=nextItem leadingCoefficient n - n3 case "failed" => "failed" - monomial(n3,degree n) + n3 case nothing => nothing + just monomial(n3,degree n) nextItem(n) == n1:=nextItemInner n - n1 case "failed" => monomial(nextItem(init()$R)::R,1+degree(n)) + n1 case nothing => just monomial(nextItem(init()$R)::R,1+degree(n)) n1 if R has GcdDomain then diff --git a/src/algebra/si.spad.pamphlet b/src/algebra/si.spad.pamphlet index ded2a935..085cc0fe 100644 --- a/src/algebra/si.spad.pamphlet +++ b/src/algebra/si.spad.pamphlet @@ -109,10 +109,10 @@ IntegerNumberSystem(): Category == init() == 0 -- iterates in order 0,1,-1,2,-2,3,-3,... - nextItem(n) == - zero? n => 1 - n>0 => -n - 1-n + nextItem n == + zero? n => just 1 + n > 0 => just(-n) + just(1-n) patternMatch(x, p, l) == patternMatch(x, p, l)$PatternMatchIntegerNumberSystem(%) |