What is the exact semantics of Include M1
inside another module, say M ? How is it different from doing Import M1
inside the module M ? More precisely what is the semantics of the following command:
Module Type M := M1 <+ M2 <+ M3.
What is the exact semantics of Include M1
inside another module, say M ? How is it different from doing Import M1
inside the module M ? More precisely what is the semantics of the following command:
Module Type M := M1 <+ M2 <+ M3.
To summarize the semantics of both vernacular commands:
Include M1
(which can be used in the definition of a module or a module type) asks Coq to make a copy of all the fields ofM1
. Thus, it acts just like a "copy-and-paste" of the contents ofM1
inside the ambient module (resp. module type).Import M1
(which can also be used in the definition of a module or a module type, but additionally requires thatM1
is a module) allows one to refer to the fields ofM1
with their short identifier (i.e., without needing to use qualified identifiersM1.field_name
)Next, the syntax
Module Type M := M1 <+ M2 <+ M3
is a shortcut for:The relevant sections of Coq's reference manual are Sect. 2.5.1 (Include), Sect. 2.5.8 (Import) and you may also want to take a look at the Export command (a variant of
Import
).If at some point you hesitate between
Include
andImport
, you should probably try to useImport
in the first place, because it will have a lighter effect (it won't clone the contents of the specified module but just define shorter names).Finally, below are two comprehensive examples that illustrate the use of modules, module types, and functors in Coq as well as the commands
Include
andImport
:and I recall that Compute is a shortcut for
Eval vm_compute in