At 16:41 +0200 98/10/19, Gabor Greif wrote:
>I am wondering if it would be feasible to declare laws that are guaranteed
>to hold for some objects in a Haskell-like functional language.
>
>For example I would like to declare that (+) is commutative.
I think such things might be implemented via Universal Algebra, even
though I have not investigated the exact relation. For example, define
Sym^p(V) the set of symmetric p-tuples with value in V. Then a commutative
operator + is a map
Sym^2(V) -> V
An associative operator is implementaed as a map
List(V) -> V -- List(V) = the free monoid on V
and a commutative and associative operator as a map
Sym(V) -> V -- Sym = disjoint union of Sym^p for p >= 0
In a computer language, this provides an interface which the compiler can
choose an implementation of.
Hans Aberg
* Email: Hans Aberg <mailto:[EMAIL PROTECTED]>
* Home Page: <http://www.matematik.su.se/~haberg/>
* AMS member listing: <http://www.ams.org/cml/>