Specifying Datastructures via Coinduction
Consider the specification of Queue: we've got the
constructors of a list, but the destructors of a reversed list! In
other words, it is an Algebra for
, and a Coalgebra
for
that's been "twisted" by the map
rev : List A → Colist A
.