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

Add proper support for :named smtlib annotations #199

Merged
merged 5 commits into from
Nov 20, 2023
Merged

Add proper support for :named smtlib annotations #199

merged 5 commits into from
Nov 20, 2023

Conversation

Gbury
Copy link
Owner

@Gbury Gbury commented Nov 13, 2023

The :named smtlib annotation has relatively annoying semantics. In particular, it implicitly introduces a global definition. Therefore this PR does a few things:

  • Add a generic support for implicit definition/declarations that can ben generated during typechecking, and propagate that change. In particular this means that the result of typechecking one "thing"( be it a term/formula/declaration/definition) is actually a list of implicit declarations, a list of implicit definitions, and then the result of typechecking that "thing". Also, typechecking a single statement now results in multiple statements. This PR decides to keep these as a list, instead of exploding them as could be possible with an adequate Pipeline transformation. This is because if we exploded them, then the intermediate typechecking state could be surprising to downstream pipes, since it would contain statements that these pipes have not yet seen.
  • That support is used by the typechecker to emit the various implicit definition and declarations that were already recorded but not emitted, for instance, all the constants (but not the variables) that are inferred.
  • A new Hook result for tags is added in the typechecker to allow for tags to arbitrarily change the typechecked term (instead of simply adding/setting some flags/tags in terms)
  • Lastly, the core theory of smtlib2 is adapted to use the Hook mechanism to properly replace named expression by their symbol, which is required since named expressions can be referred later by their symbol.

Copy link
Contributor

@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.

That looks good to me, I like the design of the Hook capability. Just a few minor questions and comments.

src/loop/typer.ml Outdated Show resolved Hide resolved
src/loop/typer.ml Outdated Show resolved Hide resolved
doc/tuto.md Show resolved Hide resolved
src/loop/typer_intf.ml Show resolved Hide resolved
src/typecheck/core.ml Outdated Show resolved Hide resolved
Gbury and others added 3 commits November 17, 2023 15:12
Co-authored-by: Basile Clément <129742207+bclement-ocp@users.noreply.github.com>
@Gbury Gbury merged commit b14eb8a into master Nov 20, 2023
21 checks passed
bclement-ocp added a commit to bclement-ocp/alt-ergo that referenced this pull request Mar 8, 2024
We are not compatible with the development release of Dolmen due to the
`implicit` field added in [1]. Further, we currently require that Dolmen
move trigger annotations in SMT-LIB format from the body of the formula
to the quantifier itself, but this was removed in [2].

Since both of these will be part of the next release of dolmen, let us
pre-emptively ensure that release won't break Alt-Ergo.

[1] : Gbury/dolmen#199
[2] : Gbury/dolmen#207
Halbaroth pushed a commit to OCamlPro/alt-ergo that referenced this pull request Mar 13, 2024
We are not compatible with the development release of Dolmen due to the
`implicit` field added in [1]. Further, we currently require that Dolmen
move trigger annotations in SMT-LIB format from the body of the formula
to the quantifier itself, but this was removed in [2].

Since both of these will be part of the next release of dolmen, let us
pre-emptively ensure that release won't break Alt-Ergo.

[1] : Gbury/dolmen#199
[2] : Gbury/dolmen#207
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.

2 participants