我有一个库来编写索引类型,而不必显式地索引索引.这通过隐藏不相关的管道导致更清洁的顶级类型.它是这样的:
Section Indexed.
Local Open Scope type.
Context {I : Type} (T : Type) (A B : I -> Type).
Definition IArrow : I -> Type :=
fun i => A i -> B i.
Definition IForall : Type :=
forall {i}, A i.
End Indexed.
Notation "A :-> B" := (IArrow A B) (at level 20, right associativity).
Notation "[ A ]" := (IForall A) (at level 70).
Run Code Online (Sandbox Code Playgroud)
然而,Coq忽略了我的要求,使IForall
隐式引入的通用量词如下所示:
Fail Definition id {A : nat -> Type} : [ A :-> A ] := fun a => a.
Definition id {A : nat -> Type} : [ A :-> A ] := fun (n : nat) a => a.
Run Code Online (Sandbox Code Playgroud)
有没有办法让我让Coq确实隐含这个论点?
不。
参见错误#3357
我希望有一天,PR #668会被合并,然后你就能做到
Notation IArrow A B :=
(fun i => A i -> B i)
Notation IForall A :=
(forall {i}, A i).
Notation "A :-> B" := (IArrow A B) (at level 20, right associativity).
Notation "[ A ]" := (IForall A) (at level 70).
Definition id {A : nat -> Type} : [ A :-> A ] := fun a => a.
Definition id {A : nat -> Type} : [ A :-> A ] := fun (n : nat) a => a.
Run Code Online (Sandbox Code Playgroud)