Coq中计算类型的隐式参数

时间:2017-11-09 11:02:19

标签: types coq

我有一个库来编写索引类型,而不必显式地索引索引。这通过隐藏不相关的管道导致更清洁的顶级类型。它是这样的:

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).

然而,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.

我有办法让Coq确实隐含这个论点吗?

1 个答案:

答案 0 :(得分:2)

没有

C.f。 Bug #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.