caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Christopher L Conway" <cconway@cs.nyu.edu>
To: "Brian Hurt" <bhurt@janestcapital.com>
Cc: "Geoffrey Alan Washburn" <geoffw@cis.upenn.edu>, caml-list@inria.fr
Subject: Re: [Caml-list] Re: Void type?
Date: Mon, 30 Jul 2007 09:32:24 -0400	[thread overview]
Message-ID: <4a051d930707300632h1e7d9cbbta3f833f512a810db@mail.gmail.com> (raw)
In-Reply-To: <46ADE367.8020801@janestcapital.com>

I'm no expert on this subject, but I'd like to pause this thread to
point out that we  have, on the one hand, people trying to explain the
Curry-Howard isomorphism and, on the other, people trying to explain
the pragmatics of the OCaml type system, and that it does not appear
that this thread is converging towards either party comprehending the
other...

So... from the Curry-Howard perspective the "void" (uninhabited) type
represents false, because it is a proposition (=type) that has no
proofs (=values). I think (and here I'm treading on thin ice) that a
type (X -> void) would represent a reductio ad absurdum proof of (not
X) whereas a type (void -> X) would simply have no meaning. If you're
interested in the connection between ML and Curry-Howard, and you have
some spare time, you might read:
research.microsoft.com/~simonpj/papers/not-not-ml/index.htm

Chris

On 7/30/07, Brian Hurt <bhurt@janestcapital.com> wrote:
> Geoffrey Alan Washburn wrote:
>
> > Arnaud Spiwack wrote:
> >
> >> Well, I don't really know why to use a void type in OCaml as well,
> >> thus my answer may be quite abstract. But when I provide a new type,
> >> I give a way to build it and a way to use it. In the case of the void
> >> type, there is no way to build an element of that type, but there is
> >> a way to use one such element : a void element can be used in place
> >> of any type.
> >
> >
> > I think this is a slightly, or perhaps merely subtly, misleading
> > characterization.  A void type (0), not to be confused with "void" as
> > used by C, Java, etc. is a type without any inhabitants.  It is the
> > the programming language equivalent of falsehood in logic.  Dually,
> > the unit type (1), called "unit" in OCaml, has a single inhabitant and
> > is the programming language equivalent of truth in logic.
> >
> > It is important to distinguish between a void element and the
> > reasoning principle provided by its elimination form.  A term of type
> > void cannot
> > be used in place of any type, but its elimination form which can be
> > realized as a function with the signature
> >
> >   val elim_void : void -> 'a
> >
> > can be used to seemingly produce a value of any type.
>
>
> I'm not sure I agree with this- especially the proposition that unit ==
> truth.  That would make a function of the type:
>     unit -> 'a
> equivelent to the proposition "If true then for all a, a", which is
> obviously bogus.  The assumption of the Ocaml type system is that you
> can not form "false" theorems within the type system (these correspond
> to invalid types).  So either this assumption is false, or unit is the
> void type in the Ocaml type system.
>
> More pragmatically, I don't see any situation in which void can be used
> where unit couldn't be used just as well, if not better.  Specially, the
> utility of void type is strictly limited.  Given a function of type void
> -> whatever, you can't call it- because to call it, you need to create a
> value of type void, and by definition the type void has no element.  You
> can create empty data structures of type void, but (since you can't
> change the type held by the data structure) you can never add elements
> to the data structure.
>
> The type of bottom (the function that either throws an exception or
> never returns) in Ocaml is unit -> 'a.   Note that the return type of
> this function, since it's completely unconstrained, can unify with any
> other type.
>
> Brian
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>


  reply	other threads:[~2007-07-30 13:32 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-28  4:14 Stefan Monnier
2007-07-28  4:33 ` [Caml-list] " Erik de Castro Lopo
2007-07-28  4:51 ` Chris King
2007-07-28 18:49   ` Stefan Monnier
2007-07-28 18:53     ` Basile STARYNKEVITCH
2007-07-29  0:48       ` Stefan Monnier
2007-07-28 18:57     ` Arnaud Spiwack
2007-07-28  6:12 ` Daniel de Rauglaudre
2007-07-28  6:15 ` Chung-chieh Shan
2007-07-28  8:22   ` [Caml-list] " rossberg
2007-07-29  6:31     ` Chung-chieh Shan
2007-07-29 11:05       ` [Caml-list] " Arnaud Spiwack
2007-07-29 11:16         ` Jon Harrop
2007-07-29 11:36           ` Arnaud Spiwack
2007-07-29 12:43             ` Richard Jones
2007-07-29 12:58               ` Arnaud Spiwack
2007-07-29 17:02                 ` Richard Jones
2007-07-29 20:06                   ` Arnaud Spiwack
2007-07-29 22:55                     ` Brian Hurt
2007-07-30  4:40                     ` skaller
2007-07-30 23:13                       ` Brian Hurt
2007-07-31  8:52                         ` Richard Jones
2007-07-31 13:08                           ` Chris King
2007-07-31 15:27                             ` Markus Mottl
2007-08-01 11:37                         ` Tom
2007-08-01 16:23                           ` Markus Mottl
2007-07-30  4:44                     ` Geoffrey Alan Washburn
2007-07-30 13:11                       ` [Caml-list] " Brian Hurt
2007-07-30 13:32                         ` Christopher L Conway [this message]
2007-07-30 13:35                         ` Geoffrey Alan Washburn
2007-07-30 13:41                         ` [Caml-list] " Chris King
2007-07-30 17:43                         ` Christophe Raffalli
2007-07-30 17:58                         ` Markus Mottl
2007-07-30 14:27                   ` Jeff Polakow
2007-07-28  7:58 ` Sébastien Hinderer
2007-07-28  8:13   ` [Caml-list] " Basile STARYNKEVITCH
2007-07-28 12:29     ` Christophe TROESTLER
2007-07-28 13:36     ` Brian Hurt

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=4a051d930707300632h1e7d9cbbta3f833f512a810db@mail.gmail.com \
    --to=cconway@cs.nyu.edu \
    --cc=bhurt@janestcapital.com \
    --cc=caml-list@inria.fr \
    --cc=geoffw@cis.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).