SAW-core translator: lets in lambda bodies #1524
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It looks like the SAW core to Coq translator had a small bug, where the the translator was not inserting let-bindings for duplicated terms inside the bodies of lambda-abstractions. More specifically,
translateTerm
was being called to translate the bodies of lambda-abstractions instead oftranslateTermLet
. This was probably just an oversight at some point, as the translator does calltranslateTermLet
on the bodies of pi-abstractions. This PR fixes this issue.Also addressed in this PR: when the SAW core unit type is translated to Coq, it needs to be explicitly coerced to be a
Type
, otherwise Coq can sometimes think it needs to beSet
, which can cause type errors in weird corner cases. One of these weird corner cases was exposed by the above altered translation of lambda-abstractions, so this PR addresses this problem as well, by adding a newAscription
constructor to the Coq AST type and using it to explicitly ascribeType
to the unit type.