-
Notifications
You must be signed in to change notification settings - Fork 147
/
Copy pathUniquePose.v
30 lines (26 loc) · 1.17 KB
/
UniquePose.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
Require Export Crypto.Util.FixCoqMistakes.
Require Import Crypto.Util.Tactics.FindHyp.
(** [pose proof defn], but only if no hypothesis of the same type exists.
most useful for proofs of a proposition *)
Tactic Notation "unique" "pose" "proof" constr(defn) :=
let T := type of defn in
tryif let H := find_hyp T in fail 2 "Already a hypothesis" H "of type" T
then fail
else pose proof defn.
(** [pose defn], but only if that hypothesis doesn't exist *)
Tactic Notation "unique" "pose" constr(defn) :=
tryif let H := find_hyp_with_body defn in fail 2 "Already a hypothesis" H "with body" defn
then fail
else pose defn.
(** [assert T], but only if no hypothesis of the same type exists.
most useful for proofs of a proposition *)
Tactic Notation "unique" "assert" constr(T) :=
tryif let H := find_hyp T in fail 2 "Already a hypothesis" H "of type" T
then fail
else assert T.
(** [assert T], but only if no hypothesis of the same type exists.
most useful for proofs of a proposition *)
Tactic Notation "unique" "assert" constr(T) "by" tactic3(tac) :=
tryif let H := find_hyp T in fail 2 "Already a hypothesis" H "of type" T
then fail
else assert T by tac.