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 a SMT-LIB compliant printer for Expr #952

Merged
merged 3 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/lib/frontend/models.ml
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,21 @@ module SmtlibCounterExample = struct
| [Ty.Trecord _r, _arg] -> begin
match xs_values with
| [record_name,_] ->
(* HOTFIX: this fix is temporary. The current implementation of
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ideally, there would be a GitHub issue referenced here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, actually it will be fix by the new representation of model values because we will use Expr.t here instead of string.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's done #958.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The comment should mention a link to #958 — the point of having an issue is so that we can track what we have to do, and the point of having the link in the comment is so that we know which issue to update if the problem ends up fixed by an unrelated refactor.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done :)

model generation for records relies on string representants,
which means the printer for access symbols has to agree with
the name of the field in the type trecord. As the printer
[Symbols.print] will always output AE native format, this
doesn't agree when the output format is SMT-LIB. But the
printer of expression will output the right string if we don't
give the arguments of the field.

Issue: https://github.com/OCamlPro/alt-ergo/issues/958 *)
let access = Fmt.str "%a" Expr.print (Expr.mk_term f [] ty) in
add_records_destr
records
(asprintf "%a" Expr.print record_name)
(Sy.to_string f)
access
rep
| [] | _ -> records
end
Expand Down
Loading
Loading