caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Andrej Bauer <Andrej.Bauer@andrej.com>
To: caml-list@inria.fr
Cc: William Lovas <wlovas@stwing.upenn.edu>
Subject: Re: [Caml-list] Coinductive semantics
Date: Sat, 21 Jan 2006 20:06:02 +0100	[thread overview]
Message-ID: <43D2861A.7070906@andrej.com> (raw)
In-Reply-To: <20060120185911.GA22920@coruscant.stwing.upenn.edu>

William Lovas wrote:
>> This is false. Products and sums are dual concepts, both classically and
>> intuitionistically.
> 
> Perhaps you can explain this in more detail; my training is in type theory,
> not category theory, and i had deMorgan duals in mind.

Concepts X and Y are dual if X's in a category C are the same thing as
Y's in the opposite category C^op. There is no classical logic involved
when you ask "are products and coproducts dual"--it is apparent that
they are if you look at their definitions in terms of categorical limits
and colimits.

The type-theory training explains (to me) what you had in mind. In type
theory, types and propositions are the same thing, so it makes sense to
talk about deMorgan rules that involve types. Presumably one could do
that in categories as well: consider a category that is equipped with an
involution * such that

  X + Y = (X* x Y*)*

This would be an analogue of deMorgan rules and it would give you
coproducts out of products. But it's a rather special thing and I don't
know how to even express the above equation without first postulating
that coproducts exist. There are several other ways of getting
coproducts out of other things that exist in a category.

> Maybe what i mean when i say "product" and "sum" is something different
> from what you mean?

I mean categorical products and coproducts.

> These encodings do not have the same force as the original type; they are
> complete, but unsound -- every value of person has a corresponding value in
> person', but not every value of person' has a corresponding person value
> (like (3, 'c', 0.0), for example).  To do this sort of encoding correctly,
> wouldn't you need dependent types in the language?  So you could write
> something like:
> 
>     type person''' = Sigma x:bool. if x then char else float
> 
> with
> 
>     Programmer(c) =def= (true, c)
>     Mathematician(x) =def= (false, x)
> 
> Perhaps this afterthought subobject is similar to what i'm referring to
> above, but i don't know enough category theory to be certain.

Not quite, in terms of dependent type theory the aftertaught would be
something like defining a coproduct u+t as a setoid with underlying type
int * u * t and "equality" relation ~

    (a,x,y) ~ (b,x',y') <==>  (a=b=0 and x=x') or (a=b=1 and y=y')

I am not too well-versed in type theory, so you'll have to translate
that into "real" type-theoretic lingo.

As I said, there are many ways to get coproducts. Above you mention one
which uses dependent sums and the type of booleans, which is the
simplest instance of a sum, namely bool = unit + unit.

Another well known construction of coproducts comes from the polymorphic
lambda calculus, where the coproduct u + t is represented by the type

  (u -> 'a) -> (t -> 'a) -> 'a

To see this, use the exponential laws:

  (u -> 'a) -> (t -> 'a) -> 'a =
  (u -> 'a) * (t -> 'a) -> 'a =
  ((u + t) -> 'a) -> 'a .

Nevertheless, none of the above is an argument in favor of eliminating
coproducts from a programming language. In general, the argument "we may
eliminate concept X because it can be reconstructed using other concepts
already present" must be used with caution, lest one ends up programming
directly in assembler.

We are way off topic for this mailing list here, aren't we?

Andrej


  parent reply	other threads:[~2006-01-21 19:05 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-05 18:23 Alessandro Baretta
2006-01-05 19:48 ` [Caml-list] " David Baelde
2006-01-06 13:12 ` Andrej Bauer
2006-01-10 11:10   ` Francisco J. Valverde Albacete
2006-01-11  8:34     ` Hendrik Tews
2006-01-11 12:19       ` skaller
2006-01-11 14:54         ` Andrej Bauer
2006-01-12  2:10           ` skaller
2006-01-12 14:03             ` Andrej Bauer
2006-01-12 21:54               ` skaller
2006-01-13 10:23                 ` Hendrik Tews
2006-01-13 14:42                   ` skaller
2006-01-18 12:58                     ` Hendrik Tews
2006-01-18 14:22                       ` skaller
2006-01-20  0:49                         ` William Lovas
2006-01-20  9:57                           ` Andrej Bauer
2006-01-20 18:59                             ` William Lovas
2006-01-20 20:59                               ` skaller
2006-01-21 18:36                                 ` Andrej Bauer
2006-01-22  3:16                                   ` skaller
2006-01-22 12:23                                     ` Andrej Bauer
2006-01-22 15:35                                       ` skaller
2006-01-22 17:26                                       ` Kenn Knowles
2006-01-22 21:52                                         ` Andrej Bauer
2006-01-21 19:06                               ` Andrej Bauer [this message]
2006-01-13 10:40                 ` Andrej Bauer
     [not found]                   ` <43C7B17A.1070503@barettadeit.com>
2006-01-14 16:53                     ` Andrej Bauer
2006-01-05 20:38 Don Syme
2006-01-06 15:33 ` Alessandro Baretta
2006-01-08 10:02   ` Andrej Bauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43D2861A.7070906@andrej.com \
    --to=andrej.bauer@andrej.com \
    --cc=caml-list@inria.fr \
    --cc=wlovas@stwing.upenn.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).