我正在尝试使用此库中的引理eqb_sym: https://coq.inria.fr/library/Coq.Structures.Equalities.html
我尝试了“需要导入Coq.Structures.Equalities”。和“需要导入BoolEqualityFacts”,但都不会让我使用引理eqb_sym。 Coq抱怨说,在当前环境中找不到引理。通常,当我从https://coq.inria.fr/library/的库中找到要使用的引理时,在哪里可以找到要导入的正确模块,而“ Require Import Module-Name”是否是正确的使用方法? / p>
答案 0 :(得分:1)
eqb_sym
引理在由BooleanEqualityType'
类型的模块参数化的函子内部定义。要使用它,您必须实例化该函子并将其导入。这是标准自然数类型nat
的可能用法:
Require Import Coq.Structures.Equalities.
(* We are defining an implementation of a module of
type BooleanEqualityType'. You can check what fields are required
by asking Coq to print BooleanEqualityType'. *)
Module N <: BooleanEqualityType'.
Definition t := nat.
Definition eq := @eq nat.
Lemma eq_equiv : Equivalence eq.
Proof. split; congruence. Qed.
Definition eqb := Nat.eqb.
Lemma eqb_eq : forall n m, eqb n m = true <-> eq n m.
Proof. (* Fill in here *) Admitted.
End N.
(* Instantiate the generic lemmas for our implementation *)
Module Import NBoolEqualityFacts := BoolEqualityFacts(N).
(* We can now use the lemma *)
Check eqb_sym.