Log*_*ins 7 types type-theory coq dependent-type idris
假设我有两个归纳定义的数据类型:
Inductive list1 (A : Type) : Type :=
| nil1 : list1 A
| cons1 : A -> list1 A -> list1 A.
Run Code Online (Sandbox Code Playgroud)
和
Inductive list2 (A : Type) : Type :=
| nil2 : list2 A
| cons2 : A -> list2 A -> list2 A.
Run Code Online (Sandbox Code Playgroud)
对于任何P (list1 a)我应该能够以构造P (list2 a),通过施加予用于构造完全相同的方法P (list1 a),只是用nil1与nil2,list1与list2和cons1用cons2.类似地,任何list1 a作为参数的函数都可以扩展为a list2 a.
是否有类型系统允许我以这种方式说两个具有相同形状的数据类型(具有相同形状的构造函数),并证明P (list1 a) -> P (list2 a)?例如,这是单值,HOTT或立方/观察类型系统允许的东西吗?它也可能允许定义类似的函数reverse: list_like a -> list_like a接受list1s和list2s作为参数.