Library Decidable
The Decidable Class
Decidability
Class DecidableProp (A : Type) := {
dec_p :> Decidable A;
is_hprop_p :> IsHProp A }.
Instance DecidableProp_Decidable_HProp (A : Type) {Hdec: Decidable A}
{Hprop:IsHProp A} : DecidableProp A :=
{|dec_p := Hdec ; is_hprop_p := Hprop |}.
Instance Hedberg (A : Type) `{DecidablePaths A} : IsHSet A.
Instance DecidablePaths_DecidableProp A
(DecidablePaths_A : DecidablePaths A)
: ∀ (a b : A), DecidableProp (a = b).
Defined.
Class Checkable (A : Type) :=
{
checkP : Type;
checkP_dec : Decidable checkP ;
convert : checkP → A
}.
Class CheckableProp (A : Type) := {
check :> Checkable A;
is_hprop_c :> IsHProp A }.
Instance checkable_decidable (A : Type) {H:Checkable A} : Decidable (@checkP _ H)
:= checkP_dec.
Instance decidable_is_checkable (A : Type) {H:Decidable A} : Checkable A
:= {| checkP := A ; checkP_dec := H ; convert := id |}.
Instance decidablep_is_checkableprop (A : Type) {H:DecidableProp A} : CheckableProp A
:= {| is_hprop_c := _ |}.
Set Implicit Arguments.
Instance Decidable_bool (t : bool) : Decidable (Is_true t) :=
match t with
| true ⇒ inl tt
| false ⇒ inr id
end.
Instance Decidable_eq_bool : ∀ (x y : bool), Decidable (eq x y).
Defined.
Instance DecidablePaths_bool : DecidablePaths bool :=
{ dec_paths := Decidable_eq_bool }.
Instance Decidable_eq_nat : ∀ (x y : nat), Decidable (eq x y).
Defined.
Instance DecidablePaths_nat : DecidablePaths nat :=
{ dec_paths := Decidable_eq_nat }.
Instance DecidablePaths_list :
∀ A (HA: DecidablePaths A), DecidablePaths (list A) :=
{ dec_paths := Decidable_eq_list HA }.
Instance Decidable_eq_option : ∀ A (HA: DecidablePaths A)
(x y: option A), Decidable (eq x y).
Defined.
Instance DecidablePaths_option :
∀ A (HA: DecidablePaths A), DecidablePaths (option A) :=
{ dec_paths := Decidable_eq_option HA }.
Instance Decidable_and P Q (HP : Decidable P)
(HQ : Decidable Q) : Decidable (P × Q).
Defined.
Instance Decidable_or P Q (HP : Decidable P)
(HQ : Decidable Q) : Decidable (P + Q).
Defined.
Instance Decidable_not P (HP : Decidable P) :
Decidable (not P).
Defined.
Instance Decidable_implies P Q (HP : Decidable P)
(HQ : Decidable Q) : Decidable (P → Q).
Defined.
Instance Decidable_True : Decidable True := inl I.
Instance Decidable_False : Decidable False.
Defined.
Instance DecidablePaths_unit : DecidablePaths unit.
Defined.
Instance Decidable_proven (P : Type) (ev : P): Decidable P :=
inl ev.
Instance DecidablePaths_prod A B `{DecidablePaths A} `{DecidablePaths B}:
DecidablePaths (A×B).
Defined.
Instance DecidablePaths_fun A B A'
(H : ∀ a, DecidablePaths (B a)) (f : A' → A)
a' : DecidablePaths (B (f a')) .