小编7Or*_*on7的帖子

为什么这个 Coq 定义失败了?归纳类型的 Coq 命名空间错误

我有以下感应类型和测试功能:

Inductive parameter : Type :=
| Nop
| OneP : forall A, A -> parameter  
| TwoP : forall (A : Type) (r : nat) (b : A), parameter
.
Check (TwoP nat 1 5).


Definition test (p : parameter) : option (nat * nat) :=
match p with 
| TwoP nat x y => Some (x, y)
| _ => None
end.
Run Code Online (Sandbox Code Playgroud)

测试功能失败并出现错误:

术语“Some (x, y)”的类型为“option (Datatypes.nat * nat)”,而预期的类型为“option (Datatypes.nat * Datatypes.nat)”。

我不明白为什么我的定义不起作用。nat 和 Datataypes.nat 之间有区别吗?

任何帮助,将不胜感激。谢谢!

coq

2
推荐指数
1
解决办法
175
查看次数

标签 统计

coq ×1