Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Christophe TROESTLER <Christophe.Troestler+ocaml@umh.ac.be>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Compiler feature - useful or not?
Date: Fri, 16 Nov 2007 01:46:20 +0100 (CET)	[thread overview]
Message-ID: <20071116.014620.919650100.Christophe.Troestler+ocaml@umh.ac.be> (raw)
In-Reply-To: <20071115132649.GB15754@yquem.inria.fr>

Hi,

On Thu, 15 Nov 2007 14:26:49 +0100, Pierre Weis wrote:
> 
> we define Z (the set of relative integer numbers) as a quotient of NxN),

I believe Z is generally defined as a quotient of the disjoint union
(borrowed as variants in programming languages) of N and N
(identifying the two 0).  Of course you can also define it as a
quotient of N×N by the smaller equivalent relation "~" s.t. (n,m) ~
(n+1,m+1) and it is quite nice as addition is "inherited" from the one
on N×N but I am not sure it is the way it is usually done.

>  In the previous definition of quotient structures, there is a
> careful distinction between the base set S and the quotient set
> S/R. In fact, there always exists a canonical injection from S to S/R,

Sorry for the nit-picking (I'm a mathematician, you know how we
are :) ), but unless R is diagonal, the function S -> S/R is not
injective (since we identify R-equivalent elements) but it is
surjective.

> We understand why the mathematicians always write after having designed a
> quotient structure: ``thanks to this isomorphism, and if no confusion may
> arise, we always assimilate S to its canonical injection in S/R''.

By the above remark, S can be identified to a subset of S'/R for some
S' but definitely not (of) S/R.

> (...)
> - the canonical projection from S/R to S is automatic.
> (...)
> More exactly, the canonical injection from S to S/R maps each element of S to
> its equivalent class in S/R; if we assimilate each equivalence class to its
> canonical representant (an element of S), the canonical injection maps each
> element of S to the canonical representant of its equivalence class. Hence
> the canonical injection has type S -> S.

This is rather the projection (and generally not an injection) as,
mathematically, p : S -> S is a projection means p(p x) = p x, forall x.
Moreover, in the abstract, there is no canonical representative of an
equivalent class -- that depends on the situation at hand.

Given your example (deleted), I suppose what you mean is that the
projection S -> S (representing S -> S/R) has to be written (since one
has to actually choose a representative) while the injection S/R -> S
comes for free or up to a coerecion (since we identified S/R to a
subset of S).

> What about private abbreviations ? (...)
> If not implicit, the injection function should granted to be the
> identity function (something that we would get for free, if we allow
> projection via sub-typing coercion).

I second the use of a subtyping coercion for that (after all, it would
be really annoying to have to use a private type abbreviation from a
module "forgetting" to provide a way out :) ).

> The moca compiler (see http://moca.inria.fr/) helps you to write the
> canonical injection by generating one for you, provided you can express the
> injection at hand via a set of predefined algebraic relations (and/or rewrite

May you tell a bit more ?  That looks quite interesting ! Since there
is nothing canonical about the injection S/R -> S, what does moca do
if several representatives are possible (e.g. pick one by preferring
left associativity to the right one?).  (I saw there is some paper on
the page but I have no time to dig through it right now.)

Best regards,
ChriS


  parent reply	other threads:[~2007-11-16  0:46 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-13 23:41 Edgar Friendly
2007-11-14  0:08 ` [Caml-list] " Yaron Minsky
2007-11-14  0:21   ` Martin Jambon
2007-11-14  7:58     ` Pierre Weis
2007-11-14 12:37       ` Alain Frisch
2007-11-14 13:56         ` Virgile Prevosto
2007-11-14 14:35         ` Pierre Weis
2007-11-14 16:38           ` Alain Frisch
2007-11-14 18:43             ` Pierre Weis
2007-11-14 19:19               ` Edgar Friendly
2007-11-15  6:29               ` Alain Frisch
2007-11-15 13:26                 ` Pierre Weis
2007-11-15 17:29                   ` Edgar Friendly
2007-11-15 20:28                     ` Fernando Alegre
2007-11-16  0:47                       ` Brian Hurt
2007-11-15 22:37                     ` Michaël Le Barbier
2007-11-15 22:24                   ` Michaël Le Barbier
2007-11-16  0:30                   ` Yaron Minsky
2007-11-16  1:51                     ` Martin Jambon
2007-11-16  9:23                       ` Alain Frisch
2007-11-16 14:17                         ` rossberg
2007-11-16 15:08                         ` Martin Jambon
2007-11-16 16:43                           ` Martin Jambon
2007-11-16 16:46                             ` Till Varoquaux
2007-11-16 17:27                             ` Edgar Friendly
2007-11-16 17:47                               ` Martin Jambon
2007-11-16 17:54                                 ` Edgar Friendly
2007-11-16 18:10                                   ` Fernando Alegre
2007-11-16 19:18                                     ` David Allsopp
2007-11-16 19:32                                       ` Fernando Alegre
2007-11-16 19:50                                         ` Gerd Stolpmann
2007-11-16 17:31                             ` Fernando Alegre
2007-11-16 17:43                               ` Edgar Friendly
2007-11-16  0:46                   ` Christophe TROESTLER [this message]
2007-11-16  8:23                     ` Andrej Bauer
2007-11-16  8:58                       ` Jean-Christophe Filliâtre
2007-11-16  9:13                         ` Andrej Bauer
2007-11-16  9:48                           ` Christophe TROESTLER
2007-11-14 16:57       ` Edgar Friendly
2007-11-14 21:04         ` Pierre Weis
2007-11-14 22:09           ` Edgar Friendly
2007-11-15  0:17         ` Jacques Garrigue
2007-11-15  6:23           ` Edgar Friendly
2007-11-15 10:53             ` Vincent Hanquez
2007-11-15 13:48               ` Jacques Carette
2007-11-15 14:43                 ` Jon Harrop
2007-11-15 16:54                   ` Martin Jambon
2007-11-14 16:09   ` Edgar Friendly
2007-11-14 16:20     ` Brian Hurt
2007-11-14 11:01 ` Gerd Stolpmann
2007-11-14 10:57   ` Jon Harrop
2007-11-14 14:37 ` Zheng Li

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=20071116.014620.919650100.Christophe.Troestler+ocaml@umh.ac.be \
    --to=christophe.troestler+ocaml@umh.ac.be \
    --cc=caml-list@yquem.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