-
Notifications
You must be signed in to change notification settings - Fork 745
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] Implement an Int lattice #6037
Conversation
Current dependencies on/for this PR:
This stack of pull requests is managed by Graphite. |
ASSERT_EQ(elem, 0); | ||
|
||
EXPECT_TRUE(int32.join(elem, 100)); | ||
ASSERT_EQ(elem, 100); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How am I supposed to understand this conceptually? That is, why does joining go "up" the integer values rather than down?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the literature, a lattice is a set and a "less than or equal" relation that together satisfy various properties (e.g. reflexivity, transitivity, anti-symmetry, least upper bound, greatest lower bound). Since we call the lattice relation "less than or equal," it is natural to use <=
as the default relation for the lattice of integers.
Use cases that require >=
instead can use Inverted<UInt32>
, introduced in a later PR. If neither ordering is appropriate, it might be a use case for Flat<uint32_t>
, also introduced in a later PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thanks. I think comments that briefly mention this and related things would be useful, to not assume the reader is completely familiar with that literature.
Implement a generic lattice template for integral types ordered by `<`.
Implement a generic lattice template for integral types ordered by `<`.
Implement a generic lattice template for integral types ordered by
<
.