MathClasses.misc.stdlib_hints

Require Import Setoid Morphisms RelationClasses.
Require Import Utf8.

Hint Unfold Proper respectful.

Hint Unfold Reflexive Symmetric Transitive.
Hint Constructors PreOrder.

Ltac auto_symm := match goal with
                    [ H: ?R ?x ?y |- ?R ?y ?x] ⇒ apply (symmetry H)
                  end.
Ltac auto_trans := match goal with
                    [ H: ?R ?x ?y, I: ?R ?y ?z |- ?R ?x ?z] ⇒ apply (transitivity H I)
                  end.

Ltac exist_hyp := match goal with [ H : sig ?P |- ?P _ ] ⇒ exact (proj2_sig H) end.
Hint Extern 0 ⇒ exist_hyp: core typeclass_instances.

Ltac exist_proj1 :=
  match goal with
    | [ |- context [proj1_sig ?x] ] ⇒ apply (proj2_sig x)
  end.
Hint Extern 0 ⇒ exist_proj1: core typeclass_instances.