[Haskell-beginners] Nested data types and bisimilarity
Brent Yorgey
byorgey at seas.upenn.edu
Mon Mar 7 22:30:44 CET 2011
On Sat, Mar 05, 2011 at 03:17:57AM -0800, dan portin wrote:
> > Actually, you are missing the point. ;) The point of bisimulations is
> > that they are defined *coinductively*, so they let you work with
> > potentially infinite data structures. In your example, proving that
> > xs and ys are in the relation R really is that simple -- 1 = 1, and
> > then to complete the proof we are allowed to use the coinduction
> > hypothesis that xs and ys are in the relation R, since they are
> > guarded by a constructor (:).
> >
> > Dan, does this help answer your original question? If not I can try
> > to give a more detailed answer in the morning.
> >
>
> I understand the coinduction principle for data structures like streams
> (e.g., Felipe's example) and finitely branching trees (from papers like "A
> calculus of binary trees"). In general, for lists and types constructed from
> arrow, product, and so on, it's easy to define conditions for a relation to
> be a bisimulation. For instance, I know that a relation *R* is a
> bisimulation over *n*-branching trees *t1 *and *t2* (for some *n*) if their
> roots are equal and each of their subtrees are in *R*. My problem is,
> specifically, with the case of infinitely branching trees. In Haskell, these
> are modeled by the data type
>
> T a = T a [T a]
>
> and the possibility arises, of course, that the list [T a] is a stream.
> Clearly, we can't just say that a relation *R* is a bisimulation on trees *
> t1* and *t2* of type T a if their root values are equal and their *lists* of
> subtrees are equal. Because if the lists are infinite, we have to prove that
> they are bisimilar. And the coinduction principle for lists requires us to
> have established that the head of each list is equal. But this is what we're
> trying to prove!
I don't actually see a problem here, as long as we generalize the
notion of "equality" to "bisimilarity" (which is of course the point
of bisimilarity). We say that two trees are bisimilar if there is a
relation R, for which
* if the roots of the two trees are equal
* and their forest-streams are bisimilar
then the trees are in relation R.
It's perfectly fine that the notion of bisimilarity for the
forest-streams is defined in terms of bisimilarity of trees. Perhaps
to be completely rigorous we should say that we define the notions of
bisimilarity for trees and for streams of trees by simultaneous
coinduction.
-Brent
More information about the Beginners
mailing list