diff options
author | dos-reis <gdr@axiomatics.org> | 2013-05-17 09:37:33 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2013-05-17 09:37:33 +0000 |
commit | 1e6db8d4424e63a8992d7fc04917ddfd6ce94378 (patch) | |
tree | 17c39a95de3b5e19945aada5dded01b26757c129 /src/algebra/aggcat.spad.pamphlet | |
parent | 1a4d9fc1eef3c6ac261907a42a1d6e0cf0490dfc (diff) | |
download | open-axiom-1e6db8d4424e63a8992d7fc04917ddfd6ce94378.tar.gz |
* algebra/aggcat.spad.pamphlet (FiniteAggregate): Add default
implementation for empty?.
Diffstat (limited to 'src/algebra/aggcat.spad.pamphlet')
-rw-r--r-- | src/algebra/aggcat.spad.pamphlet | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/algebra/aggcat.spad.pamphlet b/src/algebra/aggcat.spad.pamphlet index f95287ad..ebbf2f97 100644 --- a/src/algebra/aggcat.spad.pamphlet +++ b/src/algebra/aggcat.spad.pamphlet @@ -122,7 +122,7 @@ HomogeneousAggregate(S:Type): Category == Aggregate with members: % -> List S ++ members(u) returns a list of the consecutive elements of u. ++ For collections, \axiom{parts([x,y,...,z]) = (x,y,...,z)}. - if S has SetCategory then + if S has BasicType then count: (S,%) -> NonNegativeInteger ++ count(x,u) returns the number of occurrences of x in u. ++ For collections, \axiom{count(x,u) = reduce(+,[x=y for y in u],0)}. @@ -145,7 +145,7 @@ HomogeneousAggregate(S:Type): Category == Aggregate with x = y == #x = #y and (and/[a = b for a in parts x for b in parts y]) - if S has SetCategory then + if S has BasicType then count(s:S, x:%) == count(s = #1, x) member?(e, c) == any?(e = #1,c) @@ -188,7 +188,7 @@ FiniteAggregate(S: Type): Category == Exports where members: % -> List S ++ \spad{members(u)} returns a list of the consecutive elements of u. ++ For collections, \axiom{parts([x,y,...,z]) = (x,y,...,z)}. - if S has SetCategory then + if S has BasicType then count: (S,%) -> NonNegativeInteger ++ \spad{count(x,u)} returns the number of occurrences ++ of \spad{x} in \spad{u}. @@ -197,6 +197,8 @@ FiniteAggregate(S: Type): Category == Exports where ++ \spad{member?(x,u)} tests if \spad{x} is a member of \spad{u}. ++ For collections, ++ \axiom{member?(x,u) = reduce(or,[x=y for y in u],false)}. + add + empty? x == #x = 0 @ |