Can canonical structure resolution be interleaved with coercion insertion?

最后都变了- 提交于 2019-12-13 13:58:23

问题


In trying to solve (How) can I define partial coercions in Coq?, I discovered that canonical structure resolution is not interleaved with coercion insertion:

Structure foo := { ty1 : Type ; ty2 : Type }.
Canonical Structure default_foo ty := {| ty1 := option ty ; ty2 := ty |}.
Definition Some_nat := @Some nat.
Coercion Some_nat : nat >-> option.
Check Some 0 : ty1 _.
Check 0 : ty1 _. (* fails *)

Is there a different way to invoke canonical structures or coercions such that they are interleaved? More generally, how are canonical structure resolution and coercion insertion used in the unification / typechecking algorithm in Coq?

来源:https://stackoverflow.com/questions/46147655/can-canonical-structure-resolution-be-interleaved-with-coercion-insertion

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!