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

fix: Core.transform API and uses #1512

Merged
merged 1 commit into from
Aug 26, 2022
Merged

Conversation

Kha
Copy link
Member

@Kha Kha commented Aug 25, 2022

Core.transform's docs for pre currently say

If the result is TransformStep.visit sNew, then sNew is traversed by transform.

This description is ambiguous: is sNew passed to pre again, or do we only visit its children (which is the correct thing to do for the default implementation of returning .visit s)? The current implementation does the latter, but multiple use sites assume it is the former (I stopped further investigating after isolating the first two such bugs).

This PR separates the two interpretations into two distinct TransformStep constructors, fixing the two isolated bugs and possibly more.

@Kha Kha requested a review from leodemoura August 25, 2022 12:00
@@ -1297,7 +1297,7 @@ If `useZeta = true`, then `let`-expressions are visited. That is, it assumes
that zeta-reduction (aka let-expansion) is going to be used.
-/
def isHeadBetaTarget (e : Expr) (useZeta := false) : Bool :=
e.getAppFn.isHeadBetaTargetFn useZeta
e.isApp && e.getAppFn.isHeadBetaTargetFn useZeta
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Necessary change to ensure termination of if isHeadBetaTarget e then .visit e.headBeta ... uses

@Kha
Copy link
Member Author

Kha commented Aug 25, 2022

!bench

@leanprover-bot
Copy link
Collaborator

Here are the benchmark results for commit e39ea0b.
There were no significant changes.

@leodemoura leodemoura merged commit e81ba95 into leanprover:master Aug 26, 2022
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.

3 participants