From: "David Allsopp" <dra-news@metastack.com>
To: "'ocaml ml'" <caml-list@inria.fr>
Subject: RE: [Caml-list] how to upset the ocaml type system....
Date: Tue, 28 Aug 2007 22:21:52 +0100 [thread overview]
Message-ID: <004c01c7e9b9$7460a1e0$017ca8c0@countertenor> (raw)
In-Reply-To: <20070828131850.GA32264@pulp.rsise.anu.edu.au>
> are there any other examples that exhibit worst-case complexity ?
let pair = fun x -> (fun y -> (fun z -> ((z x) y)))
in
let x1 = fun y -> (pair y) y
in
let x2 = fun y -> x1 (x1 y)
in
let x3 = fun y -> x2 (x2 y)
in
let x4 = fun y -> x3 (x3 y)
in
let x5 = fun y -> x4 (x4 y)
in
x5 (fun y -> y);;
This one computes much faster (by which I mean the type checker does get
there in a few minutes!) but demonstrates the exponential blow-up of the
length of a type compared with the code it comes from (the type of this
expression 131070 lines long on my console...). It is translated from
http://www.cl.cam.ac.uk/teaching/2006/Types/typ.pdf p. 29 (Slide 25) which
is itself from Mairson, H. G. (1990). Deciding ML typability is complete for
deterministic exponential time. (In Proc. 17th ACM Symposium on Principles
of Programming Languages, pp. 382--401.)
David
next prev parent reply other threads:[~2007-08-28 21:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-28 13:18 Pietro Abate
2007-08-28 21:21 ` David Allsopp [this message]
2007-08-29 0:56 ` [Caml-list] " Daniel de Rauglaudre
2007-08-29 10:57 ` Christophe Raffalli
2007-08-29 14:58 ` Oliver Bandel
2007-08-29 15:48 ` Daniel de Rauglaudre
2007-08-29 16:15 ` Christophe Raffalli
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='004c01c7e9b9$7460a1e0$017ca8c0@countertenor' \
--to=dra-news@metastack.com \
--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