Skip to content

Commit

Permalink
coq: Add assert_neq and setoid_rewrite_in_all
Browse files Browse the repository at this point in the history
  • Loading branch information
math-fehr committed Mar 24, 2020
1 parent 5220c63 commit 854cf71
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions coq/Common.v
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,21 @@ Ltac rewrite_hypotheses_in_match :=
rewrite H in H2
end.

(* Fails if x is equal to v. Can work for hypotheses *)
Ltac assert_neq x v :=
tryif (let _ := (constr:(eq_refl x : x = v)) in idtac) then fail else idtac.

(* Rewrite using setoid_rewrite the hypothesis in all
other hypotheses, as well as in the goal. *)
Ltac setoid_rewrite_in_all Hx :=
repeat match goal with
| _ =>
progress (setoid_rewrite Hx)
| [ H: _ |- _ ] =>
assert_neq Hx H;
progress (setoid_rewrite Hx in H)
end.

Ltac set_fixes :=
repeat match goal with
| [ |- context[?x] ] => is_fix x; set x in *
Expand Down

0 comments on commit 854cf71

Please sign in to comment.