caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: oleg@okmij.org
To: Andrej.Bauer@fmf.uni-lj.si
Cc: caml-list@inria.fr
Subject: Re: Unexpected restriction in "let rec" expressions
Date: Wed, 27 Feb 2008 21:23:36 -0800 (PST)	[thread overview]
Message-ID: <20080228052336.355ADA99B@Adric.metnet.fnmoc.navy.mil> (raw)


Andrej Bauer wrote:
> More precisely, consider any term
>    fix : (c -> c) -> c,
> where the name "fix" suggests that we will plug in a fix-point operator
> at the end of the day.
> ...
> P.S. Can someone think of anything else other than a fixpoint operator
> that we could use in place of fix to get an interesting program (maybe
> for special cases of c, such as c = int -> int)?

`For special cases if c' makes the problem very easy. For example, let
c = int:

# let pseudofixint f : int = f 0;;
val pseudofixint : (int -> int) -> int = <fun>

or let c = int-> int

# let anotherpseudofix f : int -> int = f (fun (x:int) -> x);;
val anotherpseudofix : ((int -> int) -> int -> int) -> int -> int = <fun>

It is only if we insist on a polymorphic function (for all c or at least
c = a-> b for all a and b) that we obtain that fix must be either a
fix-point combinator or a similar misbehaving term such as

# let almostfix (f:'c -> 'c) = f (failwith "what could you expect");;
val almostfix : ('a -> 'a) -> 'a = <fun>

This is because only fix or similar misbehaving combinators let us
`produce' values that do not exist (or at least, claim to produce those
values). For example:

# type unicorn  (* abstract *)
# let f (x:unicorn) = x
val f : unicorn -> unicorn = <fun>

Indeed, we can always demonstrate a value of the type c->c no matter
how bizarre c is. Thus, expression (almostfix f) has the type unicorn
and `gives' us the value of unicorns, `proving' that unicorns exist.


             reply	other threads:[~2008-02-28  5:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-28  5:23 oleg [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-02-26 12:24 Loup Vaillant

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=20080228052336.355ADA99B@Adric.metnet.fnmoc.navy.mil \
    --to=oleg@okmij.org \
    --cc=Andrej.Bauer@fmf.uni-lj.si \
    --cc=caml-list@inria.fr \
    --cc=oleg@pobox.com \
    /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).