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

Issue 705 #755

Merged
merged 6 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
25 changes: 25 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
## unreleased

### New features
* add context reinitialisation (PR #490)
* add Dolmen frontend (PR #491,#541,#545)
* add model generation (PR #530)
* support mutually recursive definitions in the native language (PR #549, #550)
* support of some options of the SMT-LIB statement (set-option) (PR #608)
* support for the (get-model) statement (required the Dolmen frontend) (PR #614)
* support ground reasoning with some bitvector primitives (PR #730, #733, #745).
* improve the ite reasoning (simplification of some ites) (PR #731)

### Build
* update to the new version of ocplib-simplex (0.5)
* remove the support of the deprecated library num. Alt-Ergo only uses Zarith (PR #600)
* remove the deprecated graphical interface (PR #601)
* use Dune >= 3.5.

### Bug fixes
* issue 475 (PR #478)
* issue 504 (PR #524)
* issue 509 (PR #524)
* fix infinite loop in Expr.SMTPrinter (PR #540)
* remove flattening of arithmetic expressions in order to fix some regressions (PR #566)
* fix a leak memory in the vector module (PR #606)
* issue 737 (PR #738)

Halbaroth marked this conversation as resolved.
Show resolved Hide resolved
## v2.4.3 (2023-04-14)

### Build
Expand Down
5 changes: 5 additions & 0 deletions src/lib/frontend/models.ml
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,11 @@ let pp_constant ppf (_, t) =
Format.fprintf ppf "%a" SmtlibCounterExample.pp_dummy_value_of_type t

let output_concrete_model fmt props ~functions ~constants ~arrays =
if ModelMap.(is_suspicious_model functions || is_suspicious_model constants
|| is_suspicious_model arrays) then
Format.fprintf fmt "This model is a best-effort. Please note tht it \
could be wrong. @.";
Halbaroth marked this conversation as resolved.
Show resolved Hide resolved

Format.fprintf fmt "@[<v 2>(";
if Options.get_model_type_constraints () then
begin
Expand Down
45 changes: 35 additions & 10 deletions src/lib/structures/modelMap.ml
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,49 @@ module V = Set.Make

type key = P.key
type elt = V.t
type t = V.t P.t

let add p v mp =
let prof_p = try P.find p mp with Not_found -> V.empty in
if V.mem v prof_p then mp
else P.add p (V.add v prof_p) mp
type t = {
values : V.t P.t;
suspicious : bool;
}

let iter f =
let is_suspicious_name hs =
match Hstring.view hs with
| "@/" | "@%" | "@*" -> true
| _ -> false

(* The model generation is not ready for FPA and Bitvector theories. *)
Copy link
Collaborator

Choose a reason for hiding this comment

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

s/not ready/known to be incomplete

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please don't resolve conversations asking for a change without making the corresponding change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry, I thought I did it.

let is_suspicious_symbol = function
| Sy.Op (Float | Fixed | Abs_int | Abs_real | Sqrt_real
| Sqrt_real_default | Sqrt_real_excess
| Real_of_int | Int_floor | Int_ceil
| Max_int | Max_real | Min_int | Min_real
| Pow | Integer_log2 | Int2BV _ | BV2Nat
| BVand | BVor | Integer_round) -> true
| Sy.Name (hs, _, _) when is_suspicious_name hs -> true
| _ -> false

let add ((sy, _, _) as p) v { values; suspicious } =
let prof_p = try P.find p values with Not_found -> V.empty in
let values =
if V.mem v prof_p then values
else P.add p (V.add v prof_p) values
in
{ values; suspicious = suspicious || is_suspicious_symbol sy }

let iter f { values; _ } =
P.iter (fun ((sy, _, _) as key) value ->
match sy with
| Sy.Name (_, _, true) ->
(* We don't print constants defined by the user. *)
()
| _ -> f key value
)
) values

let[@inline always] is_suspicious_model { suspicious; _ } = suspicious

let fold = P.fold
let fold f { values; _ } acc = P.fold f values acc

let empty = P.empty
let empty = { values = P.empty; suspicious = false }

let is_empty = P.is_empty
let is_empty { values; _ } = P.is_empty values
7 changes: 6 additions & 1 deletion src/lib/structures/modelMap.mli
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ module V : Set.S with type elt =

type key = P.key
type elt = V.t
type t = V.t P.t

type t

val add : key -> V.elt -> t -> t

Expand All @@ -53,3 +54,7 @@ val fold : (key -> elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc
val empty : t

val is_empty : t -> bool

val is_suspicious_model : t -> bool
Halbaroth marked this conversation as resolved.
Show resolved Hide resolved
(* Determine if the model is suspicious as it contains symbols
of theories for which the model generation is not properly supported. *)
Loading