How can I use the Lemma div_0_l from the standard library? Somehow I cannot instantiate the module that is defined as
Module Type NDivProp (Import N : NAxiomsSig')(Import NP : NSubProp N).
How can I use the Lemma div_0_l from the standard library? Somehow I cannot instantiate the module that is defined as
Module Type NDivProp (Import N : NAxiomsSig')(Import NP : NSubProp N).
To use the lemma div_0_l
, you should import the Arith
library as follows.
Require Import Arith.
Search (0 / ?a = 0).
----
Nat.div_0_l: forall a : nat, a <> 0 -> 0 / a = 0
Module Type
The reason why you cannot instantiate the module defined as
Module Type NDivProp (Import N : NAxiomsSig')(Import NP : NSubProp N).
is that the entire file is wrapped in a so-called Module Type. All the lemmas and other stuffs in this file can be used only if you pass two arguments to this module functor.
Putting it all together, NDivProp
is a module type that depends on two other modules: one that adheres to NAxiomsSig'
and another that conforms to NSubProp
, which itself depends on the first module.
If you are interested you can look up the Coq's library:
(* Declared in Coq.Numbers.Natural.Abstract.NAxioms. *)
Module Type NAxiomsSig := NAxiomsMiniSig <+ OrderFunctions
<+ NZParity.NZParity <+ NZPow.NZPow <+ NZSqrt.NZSqrt <+ NZLog.NZLog2
<+ NZGcd.NZGcd <+ NZDiv.NZDiv <+ NZBits.NZBits <+ NZSquare.
and then PeanoNat
says that Nat
module implements these modules:
Module Nat
<: NAxiomsSig
<: UsualDecidableTypeFull
<: OrderedTypeFull
<: TotalOrder.
The module type design, to some extent, resembles the notion of class in OOP languages, you can defined interfaces and some concrete object that implements these interfaces but you cannot directly use interfaces since they do not have an instance.
Require Import Arith.
and then used that lemma byNat.div_0_l
? $\endgroup$Search
orSearchPattern
command instead $\endgroup$