caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: Hendrik Tews <tews@tcs.inf.tu-dresden.de>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Coinductive semantics
Date: Wed, 11 Jan 2006 23:19:34 +1100	[thread overview]
Message-ID: <1136981974.8962.100.camel@rosella> (raw)
In-Reply-To: <rl8xtnb1t5.fsf@ithif59.inf.tu-dresden.de>

On Wed, 2006-01-11 at 09:34 +0100, Hendrik Tews wrote:
> "Francisco J. Valverde Albacete" <fva@tsc.uc3m.es> writes:
> 
>    although I may be out on a limb here, I recall reading *somewhere* :(
>    that while initial algebras where good models for stateless abstract
>    data types (and (structural) induction the way to work over terms in
>    the free algebra defined by constructors modulo the laws of the ADT),
>    final algebras where good models for *stateful* datatypes (and
>    coinduction the way to work over the finer "state descriptors" modulo
>    the laws of state equivalence), hence they *might* be better models
>    for *objects* (as stateful datatypes) than initial algebras.
>    
> That's precisely what many people in the field of coalgebras
> believe. There are many papers on coalgebras as semantics for
> object-orientation. There are coalgebraic specification languages
> with an OO touch, etc.

And of course, separate development of these things is fairly
silly, since as the 'co' indicates the two ideas are formally
dual. If I recall the theory connecting them is called
the really ugly name "Bisimulation Theory". Basically every theorem
of functional programming is automatically a theorem of
stateful programming, and the theorem can be found by simply
applying the duality principle. The algorithm is purely
mechanical and well known, however in practice many theorems
are not specified in a formal language, and so some work is
required to find the co-algebraic dual, and even more to
try to figure out what it means in the unfamiliar domain.

The bottom line here is that purely functional programming is
necessarily an entirely stupid idea -- obviously we want
a programming model that allows BOTH functional and stateful
programming, and allows a programmer to easily engineer code
so it can use both models together seamlessly. 

That's the Holy Grail.

Of course subsidiary techniques are known for doing this,
for example Monadic programming in Haskell, but I doubt
anyone would consider this mechanism general enough
to constitute a proper integration of the two dual models.

There is one language that integrates both models seamlessly,
and that's Charity. It has the nice property that all programs
terminate -- however it isn't as expressive as other languages
(it isn't Turing complete .. obviously).

The paper I read on this (I'd love to find it again) shows how
to derive much of the Eiffel semantics -- such as preconditions
etc .. directly from dualising functional programming ideas.
This paper was written for ordinary programmers like me,
not theorists. The most interesting thing was that inheritance
wasn't covered.. we all know inheritance is screwed by the
covariance problem and this should just drop out of dualising
some basic functional programming ideas. In particular, it is
probably the guideline for engineering a solution involving
both OO and functional models (tells the programmer when
to switch models).

Ok .. now a real category theorist can please correct
all my mistakes?

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


  reply	other threads:[~2006-01-11 12:19 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-05 18:23 Alessandro Baretta
2006-01-05 19:48 ` [Caml-list] " David Baelde
2006-01-06 13:12 ` Andrej Bauer
2006-01-10 11:10   ` Francisco J. Valverde Albacete
2006-01-11  8:34     ` Hendrik Tews
2006-01-11 12:19       ` skaller [this message]
2006-01-11 14:54         ` Andrej Bauer
2006-01-12  2:10           ` skaller
2006-01-12 14:03             ` Andrej Bauer
2006-01-12 21:54               ` skaller
2006-01-13 10:23                 ` Hendrik Tews
2006-01-13 14:42                   ` skaller
2006-01-18 12:58                     ` Hendrik Tews
2006-01-18 14:22                       ` skaller
2006-01-20  0:49                         ` William Lovas
2006-01-20  9:57                           ` Andrej Bauer
2006-01-20 18:59                             ` William Lovas
2006-01-20 20:59                               ` skaller
2006-01-21 18:36                                 ` Andrej Bauer
2006-01-22  3:16                                   ` skaller
2006-01-22 12:23                                     ` Andrej Bauer
2006-01-22 15:35                                       ` skaller
2006-01-22 17:26                                       ` Kenn Knowles
2006-01-22 21:52                                         ` Andrej Bauer
2006-01-21 19:06                               ` Andrej Bauer
2006-01-13 10:40                 ` Andrej Bauer
     [not found]                   ` <43C7B17A.1070503@barettadeit.com>
2006-01-14 16:53                     ` Andrej Bauer
2006-01-05 20:38 Don Syme
2006-01-06 15:33 ` Alessandro Baretta
2006-01-08 10:02   ` Andrej Bauer

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=1136981974.8962.100.camel@rosella \
    --to=skaller@users.sourceforge.net \
    --cc=caml-list@inria.fr \
    --cc=tews@tcs.inf.tu-dresden.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;
as well as URLs for NNTP newsgroup(s).