[英]How do you read the coq quantifier `forall P: Set -> Prop`?
[英]Coq: Prop versus Set in Type(n)
我想考慮以下三個(相關的?)Coq定義。
Inductive nat1: Prop :=
| z1 : nat1
| s1 : nat1 -> nat1.
Inductive nat2 : Set :=
| z2 : nat2
| s2 : nat2 -> nat2.
Inductive nat3 : Type :=
| z3 : nat3
| s3 : nat3 -> nat3.
這三種類型都給出了歸納原則來證明一個命題。
nat1_ind
: forall P : Prop, P -> (nat1 -> P -> P) -> nat1 -> P
nat2_ind
: forall P : nat2 -> Prop,
P z2 -> (forall n : nat2, P n -> P (s2 n)) -> forall n : nat2, P n
nat3_ind
: forall P : nat3 -> Prop,
P z3 -> (forall n : nat3, P n -> P (s3 n)) -> forall n : nat3, P n
set和type版本還包含set和type定義的歸納原則(分別為rec和rect)。 這是我對Prop和Set之間差異的了解程度; Prop的誘導較弱。
我還讀到,雖然Set是預測性的,但Prop是不可預測的,但這似乎是屬性而不是定義的質量。
雖然Set和Prop之間的一些實際(道德?)差異是明確的,但Set和Prop之間的確切定義差異以及它們適合類型范圍的位置尚不清楚(運行檢查Prop和Set給出類型(*(設置)+ 1 *)),我不確定如何解釋這個...
Type : Type
不一致。
具有排除中間的Impredicative Set
意味着證明不相關,因此具有證明相關性的impredicative Set
,例如true <> false
,駁斥被排除的中間,這是直覺主義不應該做的。
因此,我們在Prop
留下了不可信度,而類型層次結構的其余部分給我們帶來了困境。
順便說說,
forall P : nat1 -> Prop, P z1 -> (forall n : nat1, P n -> P (s1 n)) -> forall n : nat1, P n
是可證明的。 不要問我Coq的好處是什么才能自動證明其他較弱的感應原理......
另外,你讀過CPDT的這一章嗎?
請在一小時內閱讀此內容。 這是因為Coq將假設同一Prop
的兩個證明對象相等。 這是一個公理,被稱為證明不相關。
https://coq.inria.fr/library/Coq.Logic.ProofIrrelevance.html
它只是認為關於Prop
(這里是P
)的謂詞並不需要將一些證據作為其論證(或假設)傳遞並將其刪除。
考慮一下。 因為每個nat1
是相同的,每當我們嘗試證明某些屬性P
,我們可以只抽象一些nat1
,同時使用公理將其重寫為必需的屬性。 因此,Coq產生了感應原理的“簡化”版本。
要生成“完整”版本,您可以使用
Scheme nat1_ind_full := Induction for nat1 Sort Prop.
REF。 Prop和Type的不同歸納原則
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.