你确实可以使用Coq的符号系统:
Notation "x '[' R ']*' y" := (star R x y) (at level 20).
Goal
forall A (x y z : A) R,
x [R]* y ->
y [R]* z ->
x [R]* z.
还有其他一些符号可以尝试,这是一个明确提到R的例子。
您只能将这个泛型符号与一个特殊符号结合使用以进行简化。
Section Terms.
Context (term : Type).
Context (red : term -> term -> Prop).
Notation "x â y" := (red x y) (at level 0).
Notation "x â* y" := (x [red]* y) (at level 19).
Goal forall x y, x â y -> x â* y.
Abort.
End Terms.
Reserved Notation "x '[' R ']*' y" (at level 20).
Inductive star {A : Type} (r : A -> A -> Prop) : A -> A -> Prop :=
| star_refl x : x [r]* x
| star_step x y z : r x y -> y [r]* z -> x [r]* z
where "x '[' R ']*' y" := (star R x y).
Notation "x 'â<' R '>*' y" := (star R x y) (at level 20).
Goal
forall A (x y z : A) R,
x â<R>* y ->
y â<R>* z ->
x â<R>* z.
Abort.