Coq";“护航模式”;
我试图使用“护航模式”来保留3个变量(两个参数和返回值)之间的依赖关系:Coq";“护航模式”;,coq,dependent-type,convoy-pattern,Coq,Dependent Type,Convoy Pattern,我试图使用“护航模式”来保留3个变量(两个参数和返回值)之间的依赖关系: 问题出现在最后一个定义中。有什么建议说明它为什么不起作用吗?你几乎说对了。问题出现在您的return子句中,该子句是非依赖性的。你需要的是 match n return forall (w: svector A n), (svector_is_dense w) -> (Vector.t A n) with 因此,D0不像您的情况那样属于svector\u密集型v,而是svector\u密集型v0 顺便说一下,在第二
问题出现在最后一个定义中。有什么建议说明它为什么不起作用吗?你几乎说对了。问题出现在您的
return
子句中,该子句是非依赖性的。你需要的是
match n return forall (w: svector A n), (svector_is_dense w) -> (Vector.t A n) with
因此,D0
不像您的情况那样属于svector\u密集型v
,而是svector\u密集型v0
顺便说一下,在第二个构造函数中,我猜您的意思是Vector.tl v0
和svector\u tl\u densite D0
。这是我写的完整术语(不要介意cons
中的附加,我没有激活它):
谢谢这很有帮助!
match n return forall (w: svector A n), (svector_is_dense w) -> (Vector.t A n) with
Fixpoint vector_from_svector {A} {n} {v:svector A n} (D:svector_is_dense v): Vector.t A n :=
match n return forall (w:svector A n), (svector_is_dense w) -> (Vector.t A n) with
| O => fun _ _ => @Vector.nil A
| (S p) => fun v0 D0 => Vector.cons _
(svector_hd v0 D0) _
(vector_from_svector (svector_tl_dense D0))
end v D.