Debian Codegraph @

src/Util/Tactics/ETransitivity.v

raw
1 From Coq Require Import RelationClasses.
2
3 (** We call Coq's [etransitivity] for compatibility
4 because it's more powerful than [etransitivity _] in some cases,
5 e.g., when things need to be unfolded. *)
6 Tactic Notation "etransitivity" := etransitivity.
7 Tactic Notation "etransitivity" open_constr(y) :=
8 intros;
9 let R := match goal with |- ?R ?x ?z => constr:(R) end in
10 let x := match goal with |- ?R ?x ?z => constr:(x) end in
11 let z := match goal with |- ?R ?x ?z => constr:(z) end in
12 let pre_proof_term_head := constr:(@transitivity _ R _) in
13 let proof_term_head := (eval cbn in pre_proof_term_head) in
14 refine (proof_term_head x y z _ _); [ change (R x y) | change (R y z) ].
15 Tactic Notation "etransitivity_rev" uconstr(y) := [ > etransitivity y; cycle 1.. ].
16 Tactic Notation "etransitivity_rev" := [ > etransitivity; cycle 1.. ].
17
18 Ltac transitivity_rev y := [ > transitivity y; cycle 1.. ].