# [Haskell-beginners] Nested data types and bisimilarity

dan portin danportin at gmail.com
Sat Mar 5 12:17:57 CET 2011

```> 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!

So my questions is: what must be established to show that a relation is a
bisimulation on an infinitely branching tree of type T a? This question
arises because I'm having trouble "combining" the individual principles for
trees and lists.
-------------- next part --------------
An HTML attachment was scrubbed...