【发布时间】:2017-06-18 04:04:10
【问题描述】:
Require Import Streams.
CoFixpoint map {X Y : Type} (f : X -> Y) (s : Stream X) : Stream Y :=
Cons (f (hd s)) (map f (tl s)).
CoFixpoint interleave {X : Type} (s : Stream X * Stream X) : Stream X := Cons (hd (fst s)) (Cons (hd (snd s)) (interleave (tl (fst s), tl (snd s)))).
Lemma map_interleave : forall {X Y : Type} (f : X -> Y) (s1 s2 : Stream X), map f (interleave (s1, s2)) = interleave (map f s1, map f s2).
Proof.
Fail cofix. (* error *)
Abort.
输出:
Ltac call to "cofix" failed.
Error: All methods must construct elements in coinductive types.
我不确定这意味着什么 - map 和 interleave 都是直接构建共归纳类型值的核心递归函数。有什么问题?
【问题讨论】:
标签: coq coq-tactic coinduction