Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "François Pottier" <francois.pottier@inria.fr>
To: Andreas Rossberg <rossberg@mpi-sws.org>,
	Peter Thiemann <thiemann@informatik.uni-freiburg.de>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] coinductive data types
Date: Wed, 31 Aug 2022 15:49:38 +0200	[thread overview]
Message-ID: <a1c5433b-afb8-d77c-b592-fa4027b6889d@inria.fr> (raw)
In-Reply-To: <9C63A771-E4AD-42E4-A889-56CB1FFB563E@mpi-sws.org>

Le 31/08/2022 à 11:41, Andreas Rossberg a écrit :
> yes, I think they are different things. With (nominal) algebraic data types:
> 
>    type peano = Z | S of peano
>    type nat = Z | S of nat
>    let f (x : peano) : nat = x   -- type error
> 
> But with iso-recursive types:
> 
>    type peano = mu peano. 1 + peano
>    type nat = mu nat. 1 + nat
>    let f (x : peano) : nat = x   -- ok

Good point! Indeed, in the second example, peano and nat are plain
abbreviations for the same type (which happens to be a recursive
type), up to alpha-equivalence. So, not even an explicit coercion
is needed to convert x from peano to nat.

-- 
François Pottier
francois.pottier@inria.fr
http://cambium.inria.fr/~fpottier/

  reply	other threads:[~2022-08-31 13:49 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-29 15:43 Aaron Gray
2022-08-30  7:24 ` François Pottier
2022-08-30 11:11   ` Xavier Leroy
2022-08-30 12:33     ` Aaron Gray
2022-08-31  1:21       ` Jacques Garrigue
     [not found]       ` <11E3A59A-BD33-4EC0-9FAD-711A1EACA35E@gmail.com>
2022-08-31  3:22         ` Aaron Gray
2022-09-01 12:13           ` Jacques Garrigue
2022-08-30 12:37   ` Aaron Gray
2022-08-30 13:57     ` Nate Foster
2022-08-30 15:27       ` Aaron Gray
2022-08-30 15:47     ` François Pottier
2022-08-30 16:32       ` Aaron Gray
2022-08-31  8:19         ` François Pottier
2022-08-30 16:45       ` Andreas Rossberg
2022-08-30 17:01         ` Aaron Gray
2022-08-30 18:20           ` Nate Foster
2022-08-31  8:25         ` François Pottier
2022-08-31  8:46           ` Peter Thiemann
2022-08-31  9:41             ` Andreas Rossberg
2022-08-31 13:49               ` François Pottier [this message]
2022-08-31 15:40               ` Peter Thiemann
2022-08-31 16:44                 ` Andreas Rossberg
2022-08-31 15:55               ` Basile Clement
2022-08-31 18:42                 ` Andreas Rossberg

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=a1c5433b-afb8-d77c-b592-fa4027b6889d@inria.fr \
    --to=francois.pottier@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=rossberg@mpi-sws.org \
    --cc=thiemann@informatik.uni-freiburg.de \
    /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