diff options
| author | coqbot-app[bot] | 2020-11-13 06:47:33 +0000 |
|---|---|---|
| committer | GitHub | 2020-11-13 06:47:33 +0000 |
| commit | 51e759fb2ff92dd89ab4823ddea3ea81be7f8046 (patch) | |
| tree | c8418f536a91e5267545be8a7567d350da423b9d | |
| parent | a10e7b3e470d1f944179c5bc7c85ec5a2c3c4025 (diff) | |
| parent | 9d63d29f508ad4a86088344f041645632c64b638 (diff) | |
Merge PR #12420: [stdlib] Decidable instance for negation
Reviewed-by: Blaisorblade
Ack-by: SkySkimmer
| -rw-r--r-- | doc/changelog/10-standard-library/12420-decidable.rst | 4 | ||||
| -rw-r--r-- | theories/Classes/DecidableClass.v | 10 |
2 files changed, 14 insertions, 0 deletions
diff --git a/doc/changelog/10-standard-library/12420-decidable.rst b/doc/changelog/10-standard-library/12420-decidable.rst new file mode 100644 index 0000000000..6a4da91fa3 --- /dev/null +++ b/doc/changelog/10-standard-library/12420-decidable.rst @@ -0,0 +1,4 @@ +- **Added:** + ``Decidable`` instance for negation + (`#12420 <https://github.com/coq/coq/pull/12420>`_, + by Yishuai Li). diff --git a/theories/Classes/DecidableClass.v b/theories/Classes/DecidableClass.v index 94fcd55aa5..7169aa673d 100644 --- a/theories/Classes/DecidableClass.v +++ b/theories/Classes/DecidableClass.v @@ -65,6 +65,16 @@ Tactic Notation "decide" constr(P) := Require Import Bool Arith ZArith. +Program Instance Decidable_not {P} `{Decidable P} : Decidable (~ P) := { + Decidable_witness := negb Decidable_witness +}. +Next Obligation. + split; intro Heq. + - apply negb_true_iff in Heq. + eapply Decidable_complete_alt; intuition. + - erewrite Decidable_sound_alt; intuition. +Qed. + Program Instance Decidable_eq_bool : forall (x y : bool), Decidable (eq x y) := { Decidable_witness := Bool.eqb x y }. |
