簡體   English   中英

Coq中計算類型的隱式參數

[英]Implicit arguments in a computed type in 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確實隱含這個論點?

沒有。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM