Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module A := A vs Include Module #27

Open
InfiniteEchoes opened this issue Jul 22, 2024 · 0 comments
Open

Module A := A vs Include Module #27

InfiniteEchoes opened this issue Jul 22, 2024 · 0 comments

Comments

@InfiniteEchoes
Copy link

InfiniteEchoes commented Jul 22, 2024

Suppose we have something like

(* file_1.v*)
Module A.
    Inductive Ind_1 : Set :=
    | TERM_1
    | TERM_2
    .
End A.

And we want to import this module in another file:

(* file_2.v *)
Require file_1.A.
(* For brevity we rename this module in this new file *)
Module A := file_1.A.

Everything should work fine.

However if we have more content, for example, the Schemes in the Coq:

(* file_1.v *)
Module A.
    Inductive Ind_1 : Set :=
    | TERM_1
    | TERM_2
    .
    Scheme Boolean Equality for Ind_1. 
End.

It turns out that file_2 doesn't import the generated scheme as supposed and we cannot use it in file_2.

The correct solution is a slightly different way to import the module:

(* file_2.v *)
Require file_1.A.
Module A.
  Include file_1.A.
End A.

Previously I have referred to the official documentation, and the official introduction to the Module system says that these two ways should be completely equivalent. Turns out to be not, and turns out that this can be a pretty special Coq trick.

@InfiniteEchoes InfiniteEchoes changed the title Module := Module vs Include Module Module A := A vs Include Module Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant