I am using:
$ coqtop -v
The Coq Proof Assistant, version 8.4pl5 (February 2015)
compiled on Feb 06 2015 17:44:41 with OCaml 4.02.1
I defined the following CoInductive
type, stream
:
$ coqtop
Welcome to Coq 8.4pl5 (February 2015)
Coq < CoInductive stream (A : Type) : Type :=
Coq < | Cons : A -> stream A -> stream A.
stream is defined
Coq < Check stream.
stream
: Type -> Type
Coq < Check Cons.
Cons
: forall A : Type, A -> stream A -> stream A
Then, I tried to define the following CoFixpoint
definition, zeros
:
Coq < CoFixpoint zeros : stream nat := Cons 0 zeros.
However, I got the following error instead:
Toplevel input, characters 38-39:
> CoFixpoint zeros : stream nat := Cons 0 zeros.
> ^
Error: In environment
zeros : stream nat
The term "0" has type "nat" while it is expected to have type
"Type".
I figured out that I have to explicitly instantiate the variable A
:
Coq < CoFixpoint zeros : stream nat := Cons nat 0 zeros.
zeros is corecursively defined
Why doesn't the Coq infer the type of A
by itself? How do I make it infer the type of A
?