ordType
我对其布尔比较运算符==
,<b
和的 an 和中缀表示法有以下定义 <=b
。
Module Order.
Structure type: Type:= Pack {
sort: Type;
eqb: sort-> sort -> bool;
ltb: sort-> sort -> bool;
eq_P: forall x y, reflect (eq x y)(eqb x y);
ltb_irefl: forall x, ltb x x=false;
ltb_antisym: forall x y,x<>y -> ltb x y =negb (ltb y x);
ltb_trans: forall x y z, ltb x y -> ltb y z -> ltb x z }.
Module Exports.
Coercion sort : type >-> Sortclass.
Notation ordType:= type.
End Exports.
End Order.
Definition eqb := Order.eqb.
Definition ltb := Order.ltb.
Definition leb (T:ordType) := fun (x y:T) => (ltb x y || eqb x y).
Notation "x == y":= (@eqb _ x y)(at level 70, no associativity): bool_scope.
Notation "x <b y":= (@ltb _ x y)(at level 70, no associativity): bool_scope.
Notation " x <=b y" := (@leb _ x y)(at level 70, no associativity): bool_scope.
现在考虑下面的 Ltac 定义,show_H
它打印类型为 形式的假设x == y
。
Ltac show_H:=
match goal with
| H: ?x == ?y |- _ => idtac H
end.
但是,当我使用此定义在以下引理中显示假设的名称时,它会失败并显示以下消息。
Lemma triv (T:ordType)(x y:T): x == y -> y <b x -> 2=3.
Proof. intros. show_H.
(Error: No matching clauses for match)
为什么解析器无法检测==
假设中的符号?