-
Notifications
You must be signed in to change notification settings - Fork 640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[stdlib] [PeanoNat] Add EvenT and OddT (Even and Odd in Type) #15427
Conversation
Why not define the principles for the Prop predicates instead? |
Mostly to be able to extract the Lemma parity_Type (P : nat -> Type) n : P n.
Proof.
Fail destruct (Nat.Even_Odd_dec n) as [[k ->]|[k ->]].
destruct (Nat.EvenT_OddT_dec n) as [[k ->]|[k ->]].
Admitted. |
Do you think it's a good idea to make these all Qed proofs? I feel like we could refactor them so that only the equality is Qed using abstract or something. That way projecting |
Maybe. I do not have a clear view on that, including where to put the cursor between |
Perhaps this is something to do in the future then, since I am also a bit unsure about how to do it. For now, maybe leave a comment at the top of the T versions stating that they are useful for eliminating into Type but are still opaque. |
Done. |
My 2cts: we should probably design a generic way to do this instead of duplicating everything in the stdlib on a per-need basis. Regarding the Qed vs. Defined debate, the use of SProp would probably solve this kind of issues when the predicate is decidable. |
Absolutely! I am facing the situation again and again. What about the following suggestion (from #11966 (comment)):
|
Could you elaborate on that? I know almost nothing about how to use |
This is not true for recursive predicates. There is a bit of choice axiom hidden in that in general. This will work when the Prop and Type predicates are logically equivalent, though.
With SProp, it just does not matter whether a proof is Qed or Defined, because all proofs are convertible. The price to pay is that some predicates that satisfy singleton elimination in Prop do not anymore in SProp, notably For decidable predicates it does not matter though because you can always obtain a canonical proof in Type or Prop from a proof in SProp. In some sense, SProp is a statically-typed way to enforce the Coq design pattern that "the only things that can be safely wrapped in Qed are statements used to prove a contradiction". The problem is that SProp is still badly supported in the current Coq versions. Many tactics do not handle it correctly, and unification is completely broken when you use it. So it's not yet usable at a large scale, but hopefully there will be progress on the matter. |
merging soon |
@coqbot merge now |
Versions of
Nat.Even
andNat.Odd
with typeType
.Decision and induction principles in
Type
are defined:EvenT_OddT_dec
andEvenT_OddT_rect
.