Co-inductive proofs?

101 views
Skip to first unread message

Carl Factora

unread,
Aug 10, 2015, 6:47:51 PM8/10/15
to Idris Programming Language
Hi,

I'm trying to see what Idris can do with a proof like this (I've included a screenshot and the file):

I'm trying to prove that two Streams of nats are equivalent. I've included the error that I get (which I don't understand). I've seen something like this done in Coq, but I want to see how it's done in Idris

Anything helps.

stream-proof.idr

David Feuer

unread,
Aug 10, 2015, 6:52:41 PM8/10/15
to Idris Programming Language

I think you meant

StreamEq ones ones'

rather than

ones seq ones'

in the type signature for the simple theorem.

--
You received this message because you are subscribed to the Google Groups "Idris Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to idris-lang+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Carl Factora

unread,
Aug 10, 2015, 6:58:29 PM8/10/15
to Idris Programming Language
Hello again, David.

Make sense, since that's actually the type (derp). What are the commands for handling codata? I get this as the beginning of the proof:

----------                 Goal:                  ----------
{hole0} : StreamEq (1 :: Delay (repeat 1))   (1 :: Delay (map S (0 :: Delay (repeat 0))))

I think it would be best to make the constructors to appear (i.e. seq).

Carl Factora

unread,
Aug 10, 2015, 7:06:38 PM8/10/15
to Idris Programming Language
I also thought that maybe of a proof of:

map_repeat_thm : (f : a -> b) -> map f (repeat a) = repeat b

would help, but I'm not sure if it's necessary.

David Feuer

unread,
Aug 10, 2015, 7:10:35 PM8/10/15
to Idris Programming Language

Dunno. I've never used coinduction.

Carl Factora

unread,
Aug 10, 2015, 7:43:03 PM8/10/15
to Idris Programming Language
I see. Seems to be the norm as of the moment. I've been trying to find something about co-induction in Idris for about 2 weeks now.

Brian McKenna

unread,
Aug 10, 2015, 10:50:47 PM8/10/15
to idris...@googlegroups.com
Here's how to use coinduction to prove Stream's functor laws:

http://stackoverflow.com/q/30448651/108359

I think you've gotten close but I'd avoid using head and tail in the seq constructor and instead turn them into variables, just constructing a StreamEq of the right type.
Reply all
Reply to author
Forward
0 new messages