From 9d63d29f508ad4a86088344f041645632c64b638 Mon Sep 17 00:00:00 2001 From: Yishuai Li Date: Wed, 27 May 2020 14:14:33 -0400 Subject: [stdlib] Decidable instance for negation Added Changelog --- doc/changelog/10-standard-library/12420-decidable.rst | 4 ++++ theories/Classes/DecidableClass.v | 10 ++++++++++ 2 files changed, 14 insertions(+) create mode 100644 doc/changelog/10-standard-library/12420-decidable.rst 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 `_, + 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 }. -- cgit v1.2.3