Extraction as a top-level command in the frontend for the new backend#571
Merged
FTRobbin merged 33 commits intobackend-mergefrom May 22, 2025
Merged
Extraction as a top-level command in the frontend for the new backend#571FTRobbin merged 33 commits intobackend-mergefrom
FTRobbin merged 33 commits intobackend-mergefrom
Conversation
no action extraction in progress
Alex-Fischman
requested changes
May 22, 2025
Collaborator
Alex-Fischman
left a comment
There was a problem hiding this comment.
I have not reviewed the actual extraction algorithm. My comments are about style and software engineering.
oflatt
requested changes
May 22, 2025
oflatt
reviewed
May 22, 2025
oflatt
approved these changes
May 22, 2025
Member
oflatt
left a comment
There was a problem hiding this comment.
never mind, the external function is necessary
Alex-Fischman
approved these changes
May 22, 2025
Collaborator
Alex-Fischman
left a comment
There was a problem hiding this comment.
All of my comments have been resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR implements extraction as a top-level command in the frontend. It uses the default additive tree cost model and can only be triggered through
(extract [term] [variant]).Implementation overview:
query-extractas a top-level command has also been removed.Extractis now aCommandand is interpreted in the frontendrun_command.Extractfirst runs two backend queries to resolve the eclass and the number of variants to be extracted and then callsExtractorAlterto perform the extraction.ExtractorAlterfirst needs to be initialized by passing the list of rootsorts to be extracted. It computes all relevant costs using Bellman-Ford and remembers the necessary information for reconstruction in this step. Then, it can be queried multiple times to reconstruct the terms in termdags. It does not hold a reference toEGraph, so it can be reused as long as the relevant tables do not change.ExtractorAlterfirst performs a BFS on the sorts to filter out tables unreachable from the root sort.ExtractorAlterenumerates all rows again to copy information for reconstruction. Ties are broken arbitrarily.Additional remarks:
Extractorto this new architecture. So, no extraction in the old backend after this PR.