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

Offer a tcSmtFile option for writing typechecker SMT solver output to a file #1782

Open
RyanGlScott opened this issue Dec 6, 2024 · 0 comments · May be fixed by #1783
Open

Offer a tcSmtFile option for writing typechecker SMT solver output to a file #1782

RyanGlScott opened this issue Dec 6, 2024 · 0 comments · May be fixed by #1783
Labels
feature request Asking for new or improved functionality typechecker Issues related to type-checking Cryptol code.

Comments

@RyanGlScott
Copy link
Contributor

There are two situations in which Cryptol can interact with an SMT solver:

  1. When running the :prove command. This SMT solver is controlled by the prover option.
  2. When typechecking code. This SMT solver is controlled by the tcSolver option.

With (1), one has the ability to write the SMT solver interactions to a file by enabling the smtFile option. There is no such option for (2), however, which means that the only way to record typechecker-related SMT solver interactions is to enable tcDebug and copy-paste the output that gets printed to stdout, which will look something like this:

[send->] (set-option :print-success true )
[<-recv] success
[send->] (set-option :produce-models true )
[<-recv] success
[send->] (set-option :global-decls false )
[<-recv] success
[send->] (declare-datatypes () ((InfNat (mk-infnat (value Int ) (isFin Bool ) (isErr Bool ) ) ) ) )
[<-recv] success
...

But this is not a valid SMT-LIB file, so one then has to scrub out the [send->] prefixes and remove the [<-recv] lines entirely. All told, this is quite tedious.

To avoid this tedium, Cryptol should offer a tcSmtFile option, where tcSmtFile is to tcSolver as smtFile is to prover. Moreover, it should format the typechecker-related SMT solver interactions such that it is a valid SMT-LIB file, e.g.,

[send->] (set-option :print-success true )
; success
[send->] (set-option :produce-models true )
; success
[send->] (set-option :global-decls false )
; success
[send->] (declare-datatypes () ((InfNat (mk-infnat (value Int ) (isFin Bool ) (isErr Bool ) ) ) ) )
; success
...
@RyanGlScott RyanGlScott added feature request Asking for new or improved functionality typechecker Issues related to type-checking Cryptol code. labels Dec 6, 2024
RyanGlScott added a commit that referenced this issue Dec 9, 2024
`tcSmtFile` is to `tcSolver` as `smtFile` is to `prover`. The `tcSmtFile`
option allows users to record typechecker-related SMT solver interactions to a
file.

This requires using a more recent `simple-smt` version to bring in the changes
from yav/simple-smt#25 and
yav/simple-smt#27, which are needed to plumb the
relevant information down to the `simple-smt` API.

Fixes #1782.
@RyanGlScott RyanGlScott linked a pull request Dec 9, 2024 that will close this issue
RyanGlScott added a commit that referenced this issue Dec 9, 2024
`tcSmtFile` is to `tcSolver` as `smtFile` is to `prover`. The `tcSmtFile`
option allows users to record typechecker-related SMT solver interactions to a
file.

This requires using a more recent `simple-smt` version to bring in the changes
from yav/simple-smt#25 and
yav/simple-smt#27, which are needed to plumb the
relevant information down to the `simple-smt` API.

Fixes #1782.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Asking for new or improved functionality typechecker Issues related to type-checking Cryptol code.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant