Skip to content

Simplify tactics state structure#1449

Merged
mergify[bot] merged 15 commits into
haskell:masterfrom
isovector:synthesized-attributes
Feb 27, 2021
Merged

Simplify tactics state structure#1449
mergify[bot] merged 15 commits into
haskell:masterfrom
isovector:synthesized-attributes

Conversation

@isovector

Copy link
Copy Markdown
Collaborator

Refinery implements the tactics search by growing a search tree and collapsing back the results of each branch. But this is a complicated thing to think about, because there is data moving in three different directions. The Judgement moves from root to leaves, while the "extract" moves from leaves to root --- and the TacticState moves sideways between branches, just to make things hard.

This PR formalizes the extract to as a dedicated type Synthesized (it corresponds to a synthesized attribute in the lingo of attribute grammars). Having this new conceptual clarity made me realize that I used to be using the TacticState as a hacky way of passing information back up the search tree. So this PR chops out a lot of that complexity and is more principled about how it implements the same behavior.

Specifically, it does the following things:

  • Separate the creation of a local hypothesis (newly created bindings) from the introduction of them in the judgment
  • Pushes these new local hypotheses into the extract, so that we have provenance information when scoring generated solutions
  • Pushes used variables into the extract as well
  • Greatly simplifies the TacticState structure, and removes a lot of imperative statefulness around that

The TacticState still contains some should-be-extract data about recursion usage, but that can't be removed until there are some changes upstream to refinery.

@jneira jneira left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice summary, thanks

@isovector isovector added the merge me Label to trigger pull request merge label Feb 27, 2021
@mergify
mergify Bot merged commit f4a9671 into haskell:master Feb 27, 2021
@isovector
isovector deleted the synthesized-attributes branch March 1, 2021 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge me Label to trigger pull request merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants