Library Util

Require Import Coq.Setoids.Setoid List.

Set Implicit Arguments.
Unset Printing Records.

Tactic Notation "inv" hyp(H) := inversion H; subst.
Tactic Notation "inv" integer(H) := inversion H; subst.

Ltac invt ty :=
  match goal with
      | h: ty |- _inv h
      | h: ty _ |- _inv h
      | h: ty _ _ |- _inv h
      | h: ty _ _ _ |- _inv h
      | h: ty _ _ _ _ |- _inv h
      | h: ty _ _ _ _ _ |- _inv h
      | h: ty _ _ _ _ _ _ |- _inv h
      | h: ty _ _ _ _ _ _ _ |- _inv h
      | h: ty _ _ _ _ _ _ _ _ |- _inv h
      | h: ty _ _ _ _ _ _ _ _ _ |- _inv h
  end.

Ltac isabsurd :=
  try now (hnf; intros; match goal with
                 [ H : _ |- _ ] ⇒ exfalso; inversion H; try congruence
               end).

Lemma modus_ponens P Q
: P → (PQ) → Q.
tauto.
Defined.

Ltac exploit H :=
  eapply modus_ponens;
  [
    let H' := fresh "exploitH" in
    pose proof H as H'; hnf in H';
      eapply H'; clear H'
  | intros].

Tactic Notation "dcr" :=
  repeat (
      match goal with
      | H: _ |- _progress (decompose record H); clear H
      end).