我对ordType和它的布尔比较运算符==、<b和<=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.现在考虑以下show_H的Ltac定义,该定义打印类型为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)为什么解析器无法检测到假设中的符号==?
发布于 2018-08-16 18:24:34
这是因为强制is_true -- H假设实际上是H : is_true (x == y)。
如果您像这样启用强制打印,就可以看到它:
Set Printing Coercions.https://stackoverflow.com/questions/51873274
复制相似问题