From: Arnaud Spiwack <aspiwack@lix.polytechnique.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Depend-type beginner question
Date: Sat, 06 Oct 2007 01:29:41 +0200 [thread overview]
Message-ID: <4706C8E5.4040908@lix.polytechnique.fr> (raw)
In-Reply-To: <5334A8EA-1D74-4BFA-8F7D-5154D441C561@gmail.com>
>
> Of course. So languages that claim to have dependant types all delay
> the type checking to compile-time or formal proof. I am reassured, I
> thought I was missing some big thing...
I'm not sure I'm quite getting what you mean here.
In any case, dependent types mainly means that there is a bit of
computation inside types. This raises quite a lot of issues.
It is way preferable, for instance, that type-checking is decidable,
which means that one can't put arbitrary computation inside types,
moreover, it would be preferable that a type does not read or write into
files, that would be rather annoying.
In order to get things done, there are a few approachs, languages like
OCaml, Haskell, and such, try to build up from decidable inference to
richer type systems and see what they can get done, this have the
advantages of manipulating fully usable languages; languages like Coq,
Agda, Epigram, start with dependent types as highly expressive as
possible, and try to retrieve features bit by bit (and thus are not
fully usable languages). (I haven't quoted DML and PML because I still
haven't quite looked into them, thus I can't really place them :p ).
However, to get back to the list example.
Let us suppose, in Coq syntax, that we defined lists the following way :
Inductive list (A:Type) : nat -> Type :=
| Nil : forall A, list A 0
| Cons : forall A n, A -> list A n -> list A (S n)
These are lists that carry their length.
The program :
if b then
[]
else
[a]
can only be typed as a *dependent* elimination of b, as Christophe said
the type is "if b then list A 0 else list A 1". The whole point of
dependent types is that this is a perfectly well-formed type. And it can
be checked before compiling "if b then [] else [a]" that it actually
have type "if b then list A 0 else list A 1". The schyzophrenia of
dependent types, is that types depend on previously compiled (and types)
expressions, it still is static typing, just weirder (and much more fun
if you want my opinion ;) ).
Arnaud Spiwack
next prev parent reply other threads:[~2007-10-05 23:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-05 15:32 Vincent Aravantinos
2007-10-05 15:41 ` [Caml-list] " Christopher L Conway
2007-10-05 15:53 ` Vincent Aravantinos
2007-10-05 16:05 ` Ashish Agarwal
2007-10-05 16:15 ` Vincent Aravantinos
2007-10-05 16:18 ` Christophe Raffalli
2007-10-05 16:34 ` Vincent Aravantinos
2007-10-05 23:29 ` Arnaud Spiwack [this message]
2007-10-05 16:51 ` Lukasz Stafiniak
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=4706C8E5.4040908@lix.polytechnique.fr \
--to=aspiwack@lix.polytechnique.fr \
--cc=caml-list@inria.fr \
/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