Skip to content

Instantly share code, notes, and snippets.

@edwinb
Created August 18, 2014 12:51
Show Gist options
  • Save edwinb/3e940ccef4fb4e1aa469 to your computer and use it in GitHub Desktop.
Save edwinb/3e940ccef4fb4e1aa469 to your computer and use it in GitHub Desktop.
A simple coinductive proof
ones : Num a => Stream a
ones = 1 :: ones
twos : Num a => Stream a
twos = 2 :: twos
codata EqStream : Stream a -> Stream a -> Type where
ReflStream : x = y -> EqStream xs ys -> EqStream (x :: xs) (y :: ys)
-- can't do it for all Num since we don't know how * behaves!
p : EqStream (map (*2) (ones {a=Int})) twos
p = ReflStream refl p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment