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

Use a separated counter for abstract value #835

Merged
Merged
Changes from 1 commit
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
7 changes: 6 additions & 1 deletion src/lib/frontend/models.ml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ module Pp_smtlib_term = struct
end

module SmtlibCounterExample = struct
let fresh_counter = ref 0

let reset_counter () = fresh_counter := 0

let pp_term fmt t =
if Options.get_output_format () == Why3 then
Pp_smtlib_term.print fmt t
Expand All @@ -238,7 +242,7 @@ module SmtlibCounterExample = struct

let pp_abstract_value_of_type ppf ty =
if not @@ Options.get_interpretation_use_underscore () then
Fmt.pf ppf "(as @@%s %a)" (Hstring.fresh_string ()) Ty.pp_smtlib ty
Fmt.pf ppf "(as @@a%i %a)" !fresh_counter Ty.pp_smtlib ty
Copy link
Collaborator

Choose a reason for hiding this comment

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

This needs to increment the counter, otherwise this will always be a0.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oupsi! We should have a test with two abstract values :p

else
Fmt.pf ppf "_ "

Expand Down Expand Up @@ -478,6 +482,7 @@ let pp_constant ppf (_sy, t) =
Fmt.pf ppf "%a" SmtlibCounterExample.pp_abstract_value_of_type t

let output_concrete_model fmt props ~functions ~constants ~arrays =
SmtlibCounterExample.reset_counter ();
if ModelMap.(is_suspicious functions || is_suspicious constants
|| is_suspicious arrays) then
Format.fprintf fmt "; This model is a best-effort. It includes symbols
Expand Down
Loading