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

[analysis] Add a FullLattice concept and Inverted lattice #6038

Merged
merged 5 commits into from
Oct 25, 2023
Merged

Conversation

tlively
Copy link
Member

@tlively tlively commented Oct 21, 2023

The FullLattice concept extends the base Lattice with getTop and meet
operations. The Inverted lattice uses these operations to reverse the order of
an arbitrary full lattice, for example to create a lattice of integers ordered
by > rather than by <.

template<typename L>
concept FullLattice =
Lattice<L> && requires(const L& lattice,
const typename L::Element& constElem,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you explain why access to L::Element& is needed as both a const and !const?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is for the join and meet operations, which need to take a mutable reference as their first argument because it will be modified in-place. Otherwise all other uses of elements are const.

const typename L::Element& constElem,
typename L::Element& elem) {
{ lattice.getTop() } noexcept -> std::same_as<typename L::Element>;
{ lattice.meet(elem, constElem) } noexcept -> std::same_as<bool>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is meet intended to be the greatest lower bound?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, will add a comment.

@tlively
Copy link
Member Author

tlively commented Oct 25, 2023

Merge activity

  • Oct 25, 1:00 PM: @tlively started a stack merge that includes this pull request via Graphite.
  • Oct 25, 2:55 PM: Graphite rebased this pull request as part of a merge.
  • Oct 25, 3:30 PM: @tlively merged this pull request with Graphite.

Base automatically changed from int-lattice to main October 25, 2023 18:55
The FullLattice concept extends the base Lattice with `getTop` and `meet`
operations. The `Inverted` lattice uses these operations to reverse the order of
an arbitrary full lattice, for example to create a lattice of integers ordered
by `>` rather than by `<`.
@tlively tlively merged commit 6ba0f3d into main Oct 25, 2023
13 of 14 checks passed
@tlively tlively deleted the full-lattice branch October 25, 2023 19:30
radekdoulik pushed a commit to dotnet/binaryen that referenced this pull request Jul 12, 2024
…y#6038)

The FullLattice concept extends the base Lattice with `getTop` and `meet`
operations. The `Inverted` lattice uses these operations to reverse the order of
an arbitrary full lattice, for example to create a lattice of integers ordered
by `>` rather than by `<`.
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.

3 participants