Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Andrej Bauer <Andrej.Bauer@andrej.com>
To: Alessandro Baretta <a.baretta@barettadeit.com>,
	Caml list <caml-list@inria.fr>
Subject: Re: [Caml-list] Coinductive semantics
Date: Sat, 14 Jan 2006 17:53:35 +0100	[thread overview]
Message-ID: <43C92C8F.6000805@andrej.com> (raw)
In-Reply-To: <43C7B17A.1070503@barettadeit.com>

Alessandro Baretta wrote:
> I am very much ashamed of myself for discovering that I simply I have no clue as 
> to what the terms "algebra" and "co-algebra" mean, formally. I take the first to 
> be an algebraic structure with a single set and any number of operations--within 
> this definition the notion of initial algebra can be interpreted without 
> difficulty

Yes, that's what algebras are, except that you may also impose equations
that operations are supposed to satisfy (such as associativity).

> --but what in the world is the second? I can't think of anything 
> different, really: a set and some operations. Even the definition of final 
> co-algebras can be easily interpreted in this definition.

As my advisor once explained: algebras are about putting things
together--take two numbers and "put them together" with an operation,
take an element and a list and put them together to form a new list.
Coalgebras are about taking things apart--take a stream and decompose it
into the head and the tail, take a binary tree and decompose it into its
left and right subtrees, take a Markov process and "decompose" it into
its first transition and the rest of the process, etc. So, in this sense
coalgebras still are sets with operations, you are perfectly right.
Perhaps we could say that algebras have constructors and coalgebras have
"deconstructors".

What may be confusing is that a final coalgebra is also an algebra. For
example, the coalgebraic structure of (finite and infinite) binary trees
may be described by the operation

  take_apart : tree -> (unit | tree * tree)

which takes a tree and returns either (), signifying the tree cannot be
taken apart (the empty tree), or a pair (l,r) where l and r are the left
and the right subtrees, respectively. By Lambek's Lemma take_apart is an
isomorphism. Its inverse (still acting on infinite and finite trees)

  put_together : (unit | tree * tree) -> tree

is best seen as a pair of constructors: put_together () gives a tree
without any subtrees (the empty tree), whereas put_together (l,r) is the
tree whose left and right subtrees are l and r, respectively.

Exercise for skaller ;-): using basic duality, derive the fact that
every initial algebra is also a colagebra, and give an example. How does
this allow us to relate an initial algebra (finite trees) and the
corresponding final coalgebra (infinite and finite trees)?

> So, is it true that algebras and co-algebras are the same beasts, except that 
> when referring to algebras we implicitly declare interest in inductive 
> properties of initial structures, and when referring to co-algebras we imply 
> interest in the co-inductive properties of final structures?

Both algebras and coalgebras are sets with operations. The difference is
in what these operations are doing (constructors vs. deconstructors) and
what properties they have (induction vs. coinduction).

Andrej


  parent reply	other threads:[~2006-01-14 16:52 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
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 [this message]
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=43C92C8F.6000805@andrej.com \
    --to=andrej.bauer@andrej.com \
    --cc=a.baretta@barettadeit.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