New mode constraint solver supporting morphisms#160
Closed
riaqn wants to merge 50 commits intoocaml-flambda:mainfrom
Closed
New mode constraint solver supporting morphisms#160riaqn wants to merge 50 commits intoocaml-flambda:mainfrom
riaqn wants to merge 50 commits intoocaml-flambda:mainfrom
Conversation
1f1ed32 to
1e7d3db
Compare
Closed
f871e35 to
f485c6d
Compare
Contributor
Author
|
This is now rebased and better abstracted (with the |
Contributor
Author
|
Reminder to myself that I should expose the two products, and I need to implement what's described in #138 (comment) |
Contributor
Author
|
Rebased on top of the latest uniqueness PR. This is functional but will need clean up. |
Contributor
Author
|
This is superseded by oxcaml/oxcaml#1760. |
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.
Based on #138
This PR adds a new mode constraint solver to the type checker. The new solver supports morphisms between mode axes. An example of such morphisms is
unique_to_linear:The new solver allows us to apply such morphisms to mode variables, and use the resulted variables in submode constraints. All morphisms needs to be monotone and having appropriate left/right adjoint for the solver to work. We slightly extend the solver so that antitone morphisms can also work with some limitations.
Some other notable features/changes:
submode m0.x m1.xfor each axisx, we introduce the product object in the category so that submoding relation can be expressed on the product as a whole. Note that axes of opposite polarities can't be product together. As a result, currently locality and linearity are packed into the product object, while uniqueness (being of negative polarity) is standalone.vloweris no longer compressed. It was compressed in the hope for an optimization - but that optimization turned out to be hard to implement in ocaml. Compressingvlowerwould also cause explosion problem once morphisms are introduced.submode_vcuntil it succeeds.mode.mlandtypes.ml. Previously (in the uniqueness PR) it was solved by preceeding type definitions which has became dirtier with bigger types. This is now solved bysolver.mlhaving its own implementation of logging (which is minimalistic).