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

Unification modulo overloaded constructors proposal #882

Merged

Conversation

traiansf
Copy link
Member

…l proposal

Reviewer checklist
  • Test coverage: stack test --coverage
  • Public API documentation: stack haddock
  • Style conformance: stylish-haskell

@traiansf traiansf changed the title docs/2019-08-27-Unification-modulo-overloaded-constructors.md: Initia… Unification modulo overloaded constructors proposal Aug 27, 2019
other constructors, as overloaded constructors are injective
- overloaded constructor vs. different (overloaded) constructor: unification
fails, similarly to the other constructors
- overloaded constructor vs. injection:
Copy link
Contributor

Choose a reason for hiding this comment

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

We can also short-circuit this step by looking at the klabel attribute: If the overload-ed constructor and the inj's child do not have the same klabel, then there is no reason to even attempt an overload axiom.

Copy link
Member Author

Choose a reason for hiding this comment

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

true.

This is K's way to deal with overloading. An additional restriction imposed by
K implementations is that of __SingleOverloadPerSort__:

> Given sort `s` and label `l` there exists at most one production of result
Copy link

Choose a reason for hiding this comment

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

This additional restriction should be checked and an error or at least a warning should be generated if the semantics violates it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added a TODO for that; I'm thinking this should be done in the frontend though (as the frontend generates the overloading axioms).

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be a good idea to check in the backend, also.

oveloaded operation is that with an injection operation as given by the
overloading axioms.

Hence, the proposed solution for handling problem (1) specified above is to
Copy link

Choose a reason for hiding this comment

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

This will break the "additivity" of attributes because constructor doesn't mean the symbol is indeed a constructor. Therefore, all backends, even those designed to handle only constructors without overloading, need to read all attributes to tell if a symbol is a constructor. I think it is better to use a different attribute keyword, say overloaded-constructor.

Copy link
Member Author

Choose a reason for hiding this comment

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

Based on your comments (and the way it's implemented in the llvm-backend) I've proposed a different mechanism which collects overloaded information from the attributes associated to overloading axioms

@traiansf traiansf marked this pull request as ready for review August 28, 2019 09:21
@traiansf traiansf requested a review from ttuegel August 28, 2019 09:21
Copy link
Contributor

@ttuegel ttuegel left a comment

Choose a reason for hiding this comment

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

To summarize, the plan is to apply rules left-to-right during simplification and right-to-left (only as needed) during unification and matching, is that right? That sounds good to me!

This is K's way to deal with overloading. An additional restriction imposed by
K implementations is that of __SingleOverloadPerSort__:

> Given sort `s` and label `l` there exists at most one production of result
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be a good idea to check in the backend, also.

@traiansf traiansf merged commit 3de7983 into runtimeverification:master Aug 28, 2019
@traiansf traiansf deleted the overloaded-unification-proposal branch August 28, 2019 12:04
```

The rule above requires that the second argument of the application expression
(which should be a list of expressions, is actually a list of values).
Copy link
Contributor

Choose a reason for hiding this comment

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

This parenthesis seems wrong. The open parenthesis should probably be a comma, the closing one should probably be removed.

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.

None yet

4 participants