-
Notifications
You must be signed in to change notification settings - Fork 0
/
tac_utils.v
50 lines (40 loc) · 1.57 KB
/
tac_utils.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
(**************************************************************)
(* Copyright Dominique Larchey-Wendling [*] *)
(* *)
(* [*] Affiliation LORIA -- CNRS *)
(**************************************************************)
(* This file is distributed under the terms of the *)
(* CeCILL v2 FREE SOFTWARE LICENSE AGREEMENT *)
(**************************************************************)
Require Import Arith Eqdep_dec.
Ltac injc H := injection H; clear H;
repeat match goal with
|- _ = _ -> _ =>
intro; subst end.
Ltac eqgoal :=
match goal with
|- ?a -> ?b => replace a with b; auto
end.
Ltac inst H :=
let K := fresh in
match goal with
| [ G : ?x -> _ |- _ ] =>
match G with
H => assert (x) as K; [ clear H | specialize (H K); clear K ]
end
end.
Fact eq_gen { X } (P : X -> Type) x : (forall y, y = x -> P y) -> P x.
Proof. intros H; apply H, eq_refl. Qed.
Ltac gen_eq t := apply eq_gen with (x := t).
Fact eq_nat_pirr (n m : nat) (H1 H2 : n = m) : H1 = H2.
Proof. apply UIP_dec, eq_nat_dec. Qed.
(* Remove identities of the form H : n = n :> nat and eliminates H
by replacing it with eq_refl *)
Ltac natid :=
repeat
match goal with
| [ H: ?x = ?x :> nat |- _ ] => let G := fresh
in generalize (@eq_nat_pirr _ _ H eq_refl);
intros G; subst H
end;
simpl eq_rect in * |- *.