axiom-developer
[Top][All Lists]

## [Axiom-developer] [#187 trouble with tuples]

 From: Bill Page Subject: [Axiom-developer] [#187 trouble with tuples] Date: Mon, 04 Jul 2005 12:08:17 -0500

Changes
http://page.axiom-developer.org/zope/mathaction/187TroubleWithTuples/diff
--
William Sit wrote:

> I agree that the Cartesian product of A, B is implied in the notion
> of Mapping(T,A,B). But that is not the issue here.

??? But that *is* precisely the issue with which **I am** concerned.

> products, if they exist, are formed from objects of the same
> category

Yes, I agree. I think program semantics must be expressed in some
"cartesian closed" category. See

http://en.wikipedia.org/wiki/Cartesian_closed_category

In the case of Axiom I think that it is highly significant
that "The category Cat of all small categories (with functors
as morphisms) is cartesian closed;". And the choice of Mapping,
Record and Union as primatives in Axiom directly supports this
notion.

> The two are not equivalent as mappings: f is binary and g is unary.

I disagree strongly with your analysis. These two things are formally
identical. No "subtle distinction" is necessary or relevant.

> A Record, even if it is a primary domain, is a single object.
> You cannot have the compiler sometimes treat it as one object
> and sometimes not.

I agree. My point is that the expression '(A,B)' in the Mapping
'(A,B)->C', does in fact denote a single object, not two objects.
It is clear that when we write 'f(a,b) == a+b' in the definition
of the function 'f:(A,B)-> C', that 'a' and 'b' denote composition
with the necessary projections - that is precisely what we mean
when we say that 'a' and 'b' are "formal parameters" of the
function.

Your definition of "arity" is wrong. A function with multiple
inputs is necessarily defined over a product and has an "arity"
equal to the size of that product. I think Axiom's definition of
Mapping is wrong to admit more than two arguments (mapping should
be semantically equivalent to exponentiation in a cartesian closed
category). It is confusing and unnecessarily complicated from a
mathematical point of view to define Mapping(C,A,B) as different
from Mapping(C,Product(A,B)). It makes a vacuous distinction where
none is necessary.

> In a record, the order of the items is not important (conceptually
> speaking), each field is tagged by an identifier. In a tuple, the
> physical order is important and items are not tagged.

That is not true. As long as we admit a Tuple as a domain and not
"just a syntactic construct" (what ever that might mean), in a Tuple
the "fields" are simply tagged by their order - or better: indexed
by '1..n'. In Records these "tags" are given names. In both cases
these are formally just different names for projections from a
product. In Axiom the fields of a Record are also given in an order
that allows for example the assignment:
\begin{axiom}
R:Record(a:Integer,b:Float):=[1,1.1]
\end{axiom}

--