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

Documentation of the ADT #1013

Merged
merged 2 commits into from
Dec 20, 2023
Merged

Conversation

Halbaroth
Copy link
Collaborator

@Halbaroth Halbaroth commented Dec 14, 2023

This PR documents and cleans a bit the ADT theory.

Replace the PR #544 but this old PR contains more documentation on Shostak so I didn't close it yet.

Copy link
Collaborator

@bclement-ocp bclement-ocp left a comment

Choose a reason for hiding this comment

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

This is a PR that documents the ADT theory, but also includes code simplifications, which makes it hard to read as it requires many mental context switches. The code simplifications look correct, and more documentation is always good, however there are some points in the documentation that need clarification (questions inline).

I also think that it would be better to add a link to #1014 rather than copying the description of that bug in a comment.

src/lib/reasoners/adt.ml Outdated Show resolved Hide resolved
src/lib/structures/ty.mli Outdated Show resolved Hide resolved
src/lib/reasoners/adt_rel.ml Show resolved Hide resolved
In this case, we deduce the constructor of the semantic value and
we add this equation to the pending queue using [deduce_is_constr].

- When we add a guarded destructor for the first time, we add a new
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you mean when the guard is activated (i.e. when we learn the tester)?

Copy link
Collaborator Author

@Halbaroth Halbaroth Dec 18, 2023

Choose a reason for hiding this comment

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

It's the opposite situation. We know that the domain is a singleton, thus we call deduce_is_constr. This function propagate two literals to CC(X) through the queue pending_deds:

  • an equation of the form t = cons x_1 ... x_n
  • the literal (_ cons t).

Thus in this situation we activate any guard on destructors of cons because the domain is a singleton. It makes sense as a singleton domain means that the only consistent way to produce a value for t is to use the constructor cons, so we can active the guard of any destructor of cons.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This explanation corresponds to my understanding (although I think you meant ((_ is cons) t)), but I still don't understand what "when we add a guarded destructor for the first time" means. Can you clarify the second list item?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If we have already assumed the tester of the associated constructor of the destructor d and we add d to the theory, we don't create a pending equation in selectors.

src/lib/reasoners/adt_rel.ml Show resolved Hide resolved
src/lib/reasoners/adt_rel.ml Show resolved Hide resolved
src/lib/reasoners/adt_rel.ml Outdated Show resolved Hide resolved
src/lib/reasoners/adt_rel.ml Outdated Show resolved Hide resolved
This PR documents and cleans a bit the ADT theory.
In this case, we deduce the constructor of the semantic value and
we add this equation to the pending queue using [deduce_is_constr].

- When we add a guarded destructor for the first time, we add a new
Copy link
Collaborator

Choose a reason for hiding this comment

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

This explanation corresponds to my understanding (although I think you meant ((_ is cons) t)), but I still don't understand what "when we add a guarded destructor for the first time" means. Can you clarify the second list item?

Copy link
Collaborator

@bclement-ocp bclement-ocp left a comment

Choose a reason for hiding this comment

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

This is more clear now, thanks!

@Halbaroth Halbaroth merged commit d069a0a into OCamlPro:next Dec 20, 2023
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants