Coq: Prop versus Set in Type(n)

后端 未结 2 1418
南方客
南方客 2021-02-14 04:56

I want to consider the following three (related?) Coq definitions.

Inductive nat1: Prop :=
  | z1 : nat1
  | s1 : nat1 -> nat1.

Inductive nat2 : Set := 
  |          


        
相关标签:
2条回答
  • 2021-02-14 05:25

    Just read about this in an hour. This is because Coq will assume equality of two proof object of a same Prop. This is an axiom and is called proof irrelevance.

    https://coq.inria.fr/library/Coq.Logic.ProofIrrelevance.html

    It just thinks a predicate over Prop (Here P) doesn't really need to have some proof passed as its argument (or hypothesis) and removed it.

    Consider this. Because of every nat1 are the same, whenever we try to proof some property P, we can just abstract over some nat1, while use the axiom to rewrite it to required ones. Thus Coq generated the "simplified" version of induction principle.

    To generate the "full" version, you can use

    Scheme nat1_ind_full := Induction for nat1 Sort Prop.
    

    ref. Different induction principles for Prop and Type

    0 讨论(0)
  • 2021-02-14 05:27

    Type : Type is inconsistent.

    Impredicative Set with excluded middle implies proof irrelevance, so impredicative Set with proof relevance, e.g. true <> false, refutes excluded middle, which intuitionism isn't supposed to do.

    Therefore we leave impredicativity in Prop and the rest of the type hierarchy gives us predicativity.

    By the way,

    forall P : nat1 -> Prop, P z1 -> (forall n : nat1, P n -> P (s1 n)) -> forall n : nat1, P n
    

    is provable. Don't ask me what's the benefit of Coq only automatically proving that other weaker induction principle...

    Also, have you read this chapter of CPDT?

    0 讨论(0)
提交回复
热议问题