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

Improve evar_map handling in tmMkDefinition and friends #1111

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MathisBD
Copy link

@MathisBD MathisBD commented Nov 1, 2024

Fixes (part of) #1108.

This PR fixes a bug in the implementation of the template monad. When modifying the global environment (tmDefinitionRed and friends), we currently ditch the old evar map and create a fresh one using Evd.from_env (see e.g. template-coq/run_template_monad.ml, in the main loop, the TmDefinition case).

This is a problem since the evar map can contain evars and universes which are still used afterwards, and we discard them, leading to Undeclared universe errors e.g. when calling tmMkDefinition multiple times.

The fix is to replace :

let evm = Evd.from_env (Global.env ())

by :

let evm = Evd.update_sigma_univs (Environ.universes env) evm

in the relevant places.

@MathisBD
Copy link
Author

MathisBD commented Nov 1, 2024

I tried manually building MetaCoq and the only error seems to be in translations/standard_model.v.

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

Successfully merging this pull request may close these issues.

1 participant