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

Restore record printing functionality #793

Merged
merged 1 commit into from
Sep 5, 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
8 changes: 7 additions & 1 deletion src/lib/frontend/models.ml
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,13 @@ module SmtlibCounterExample = struct
else
reps_aux representants
in
print_fun_def fmt f xs_ty_named ty rep;
(* Only print declared (but not defined!) function symbols -- note
that we still need to *handle* other symbols without printing them
because they could be record accessors that must be added to the
`records` reference *)
match f with
| Sy.Name (_, _, false) -> print_fun_def fmt f xs_ty_named ty rep
| _ -> ()
) fprofs;
!records
end
Expand Down
4 changes: 3 additions & 1 deletion src/lib/reasoners/uf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,9 @@ let compute_concrete_model ({ make; _ } as env) =
ME.fold
(fun t _mk ((fprofs, cprofs, carrays, mrepr) as acc) ->
let { E.f; xs; ty; _ } = E.term_view t in
if X.is_solvable_theory_symbol f ty
(* Keep record constructors because models.ml expects them to be there *)
if (X.is_solvable_theory_symbol f ty
&& not (Shostak.Records.is_mine_symb f ty))
|| E.is_fresh t || E.is_fresh_skolem t
|| E.equal t E.vrai || E.equal t E.faux
then
Expand Down
25 changes: 25 additions & 0 deletions tests/dune.inc
Original file line number Diff line number Diff line change
Expand Up @@ -186828,6 +186828,31 @@
; Auto-generated part end
; File auto-generated by gentests

; Auto-generated part begin
(subdir models/records
(rule
(target record1.models_tableaux.output)
(deps (:input record1.models.smt2))
(package alt-ergo)
(action
(chdir %{workspace_root}
(with-stdout-to %{target}
(ignore-stderr
(with-accepted-exit-codes 0
(run %{bin:alt-ergo}
--output=smtlib2
--frontend dolmen
--timelimit=2
--sat-solver Tableaux
%{input})))))))
(rule
(alias runtest-quick)
(package alt-ergo)
(action
(diff record1.models.expected record1.models_tableaux.output))))
; Auto-generated part end
; File auto-generated by gentests

; Auto-generated part begin
(subdir models/uf
(rule
Expand Down
5 changes: 5 additions & 0 deletions tests/models/records/record1.models.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

unknown
(
(define-fun a () Pair (pair 5 0))
)
8 changes: 8 additions & 0 deletions tests/models/records/record1.models.smt2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(set-logic ALL)
(set-option :produce-models true)
(declare-datatype Pair
((pair (first Int) (second Int))))
(declare-const a Pair)
(assert (= (first a) 5))
(check-sat)
(get-model)