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

The Coq translator incorrectly translates globals that are not applied #1748

Closed
eddywestbrook opened this issue Oct 5, 2022 · 0 comments · Fixed by #1749
Closed

The Coq translator incorrectly translates globals that are not applied #1748

eddywestbrook opened this issue Oct 5, 2022 · 0 comments · Fixed by #1749
Assignees
Labels
subsystem: saw-core-coq Issues related to converting saw-core to Gallina for use with the Coq/Rocq theorem prover

Comments

@eddywestbrook
Copy link
Contributor

The Coq translator currently does not add module names when it translates globals not in the module where they were defined if they are not applied to arguments.

For example, consider the following SAW core definition in a module other than the prelude:

my_sym : (a : sort 1) -> (x y : a) -> Eq a x y -> Eq a y x;
my_sym = sym;

This is translated to Coq as follows:

Definition my_sym : forall (a : Type), forall (x : a), forall (y : a), SAWCoreScaffolding.Eq a x y -> SAWCoreScaffolding.Eq a y x :=
  fun (a : Type) => sym a.

The call to sym in the above causes an error, because it is actually supposed to refer to SAWCorePrelude.sym. If instead we translate the following definition:

my_sym : (a : sort 1) -> (x y : a) -> Eq a x y -> Eq a y x;
my_sym a = sym a;

then we get the correct result:

Definition my_sym : forall (a : Type), forall (x : a), forall (y : a), SAWCoreScaffolding.Eq a x y -> SAWCoreScaffolding.Eq a y x :=
  fun (a : Type) => SAWCorePrelude.sym a.

The difficulty is likely because of the different code paths in Verifier.SAW.Translation.Coq.Term for translating Constants and ExtCnss than for translating applications whose function component is a global.

@eddywestbrook eddywestbrook self-assigned this Oct 5, 2022
eddywestbrook pushed a commit that referenced this issue Oct 6, 2022
…slation for SAW core identifiers when those constants have identifiers as names; also did some refactoring and updates to the documentation around this change
@eddywestbrook eddywestbrook added the subsystem: saw-core-coq Issues related to converting saw-core to Gallina for use with the Coq/Rocq theorem prover label Oct 6, 2022
eddywestbrook pushed a commit that referenced this issue Oct 6, 2022
…slation for SAW core identifiers when those constants have identifiers as names; also did some refactoring and updates to the documentation around this change (#1749)
eddywestbrook pushed a commit that referenced this issue Oct 6, 2022
…1748; changed uses of LetRecTypes to use List1 LetRecType, to be consistent with the SpecM module
eddywestbrook pushed a commit that referenced this issue Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
subsystem: saw-core-coq Issues related to converting saw-core to Gallina for use with the Coq/Rocq theorem prover
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant