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

Use Continuation Passing Style #3

Open
doyougnu opened this issue Sep 16, 2020 · 1 comment
Open

Use Continuation Passing Style #3

doyougnu opened this issue Sep 16, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request memory relating to memory performance performance related to runtime performance

Comments

@doyougnu
Copy link
Owner

After tinkering around with variational arithmetic I've concluded I need a zipper to handle deeply nested choices. Consider this formula:

deepChoicesLHS :: IO Result
deepChoicesLHS = flip sat Nothing $
   (1 - 2 - (3 - c)) .== 23
  where c = iChc "AA" (iRef ("Aleft" :: Text)) (iRef "Aright") +
            iChc "BB" (iRef "Bleft") (iRef "BRight")

The trick for the booleans was to rotate the AST hence allows plain values to be accumulated/evaluated thereby lifting choices, but for arithmetic this does not work because - is neither commutative or associative, and thus the only way to get to the choice here is to crawl the tree, capturing the context until we find the choice. In Vsat I used a zipper for this before I understood the tree rotations. For VSMT CPS will likely be faster than a zipper and more memory efficient, thus it is desirable. Furthermore, I conjectured and am pretty confident that continuations are the essence of variation and so the fact that CPS sticks out to me is likely an indication of this conjecture.

@doyougnu doyougnu added enhancement New feature or request memory relating to memory performance performance related to runtime performance labels Sep 16, 2020
@doyougnu doyougnu self-assigned this Sep 16, 2020
@doyougnu
Copy link
Owner Author

zipper for arithmetic expressions added in a892f0e and produces sound results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request memory relating to memory performance performance related to runtime performance
Projects
None yet
Development

No branches or pull requests

1 participant