(* Inversion tactic *)

Ltac inv H := inversion H; subst; clear H.(* ** Decidability *)

Definition dec (X : Prop) : Type := {X} + {~ X}.Notation "A === B" := (equi A B) (at level 70).Definition decision (X : Prop) (D : dec X) : dec X := D.Hint Extern 4 =>     
match goal with
  | [  |- dec ?p ] => exact (decision p)
end.(* Regiseva instance rules for dec *)

Instance True_dec :  dec True := 
  left I.Instance False_dec :  dec False := 
  right (fun A => A).Instance impl_dec (X Y : Prop) :  
  dec X -> dec Y -> dec (X -> Y).Instance and_dec (X Y : Prop) :  
  dec X -> dec Y -> dec (X /\ Y).Instance or_dec (X Y : Prop) : 
  dec X -> dec Y -> dec (X \/ Y).(* Coq standard modules make "not" and "iff" opaque for type class inference, can be seen with Print HintDb typeclass_instances. *)

Instance not_dec (X : Prop) : 
  dec X -> dec (~ X).Instance iff_dec (X Y : Prop) : 
  dec X -> dec Y -> dec (X <-> Y).

Lemma dec_DM_and X Y : dec X -> dec Y -> ~ (X /\ Y) -> ~ X \/ ~ Y.