From 087ef557a5826b106ea3a8a568ebd74a6ca31e5d Mon Sep 17 00:00:00 2001 From: dos-reis Date: Fri, 10 May 2013 10:16:13 +0000 Subject: * algebra/indexedp.spad.pamphlet (IndexedDirectProductOrderedAbelianMonoid) [<]: Rewrite iteratively. --- src/ChangeLog | 5 +++++ src/algebra/indexedp.spad.pamphlet | 25 ++++++++++++++----------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index ac33f792..4534563d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2013-05-10 Gabriel Dos Reis + + * algebra/indexedp.spad.pamphlet + (IndexedDirectProductOrderedAbelianMonoid) [<]: Rewrite iteratively. + 2013-05-10 Gabriel Dos Reis * algebra/catdef.spad.pamphlet (AbelianMonoid) [opposite?]: New. diff --git a/src/algebra/indexedp.spad.pamphlet b/src/algebra/indexedp.spad.pamphlet index c296f271..ad4ae9c8 100644 --- a/src/algebra/indexedp.spad.pamphlet +++ b/src/algebra/indexedp.spad.pamphlet @@ -249,18 +249,21 @@ IndexedDirectProductAbelianMonoid(A:AbelianMonoid,S:OrderedType): IndexedDirectProductOrderedAbelianMonoid(A:OrderedAbelianMonoid,S:OrderedType): Join(OrderedAbelianMonoid,IndexedDirectProductCategory(A,S)) == IndexedDirectProductAbelianMonoid(A,S) add - --representations - Term:= Record(k:S,c:A) - Rep:= List Term - x,y: % x false - empty? x => true -- note careful order of these two lines - y.first.k > x.first.k => true - y.first.k < x.first.k => false - y.first.c > x.first.c => true - y.first.c < x.first.c => false - x.rest < y.rest + u := terms x + v := terms y + repeat + -- note careful order of next two lines + empty? v => return false + empty? u => return true + xt := first u + yt := first v + index xt < index yt => return true + index yt < index xt => return false + coefficient xt < coefficient yt => return true + coefficient yt < coefficient xt => return false + u := rest u + v := rest v @ \section{domain IDPOAMS IndexedDirectProductOrderedAbelianMonoidSup} -- cgit v1.2.3