[Aldor-l] Axioms in Aldor [was: Re: "has" and "with" and bug]

Christian Aistleitner tmgisi at gmx.at
Mon Aug 20 05:07:00 EDT 2007


Hello Martin,

On Mon, 20 Aug 2007 08:17:55 +0200, Martin Rubey  
<martin.rubey at univie.ac.at> wrote:

> Ralf Hemmecke <ralf at hemmecke.de> writes:
>
>> It would be nice if there were any better means in Aldor to state  
>> axioms for
>> functions than just creating a category (like AbelianMonoid).
>
> Axioms seem rather redundant to me.  What's the problem with introducing  
> a
> category like:
>
>   define CommutativeTimes: Category == with { *: (%,%) -> % }
>
> ?

to me, it's clearly better to have categories than to have nothing.

However, Categories aren't the best thing there is.
In Aldor, you'd probably state that the binary * function is commutative  
by introducing the above Category.

But we also know that for the greatest common divisor, it should not  
matter whether you plug in ( a, b ) or ( b, a ). Would you consider the  
gcd commutative?
What if I implement a ternary gcd function (computing the gcd of the three  
arguments). Is that still commutative?

I am not saying that Mathematica is superior to Aldor, but Mathematica has  
for example Attributes that can be applied to _functions_:
http://reference.wolfram.com/mathematica/tutorial/Attributes.html

Thereby, you can specify that you expect f( a, b ) to be equivalent to  
f( b, a ) by attaching the "Orderless" Attribute to "f".
Mathematica in turn can exploit this knowledge to speed things up.

Adding Attribute support in Mathematica's way to Aldor would not help  
much, but I hope the Mathematica example showed that Categories aren't the  
absolutely best thing.

Kind regards,
Christian




More information about the Aldor-l mailing list