fix theory combination for LRA

This commit is contained in:
Simon Cruanes 2022-01-05 11:59:50 -05:00
parent eb97161992
commit 849d4319f2
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
3 changed files with 10 additions and 5 deletions

View file

@ -50,6 +50,8 @@ module type RATIONAL = sig
val minus_infinity : t
val of_bigint : bigint -> t
val is_real : t -> bool
(** A proper real, not nan/infinity *)

View file

@ -98,6 +98,7 @@ module Th_lra = Sidekick_arith_lra.Make(struct
let mk_bool = T.bool
let rec view_as_lra t = match T.view t with
| T.LIA (Arith_const i) -> LRA.LRA_const (Q.of_bigint i)
| T.LRA l ->
let open Base_types in
let module LRA = Sidekick_arith_lra in

View file

@ -630,11 +630,13 @@ module Make(A : ARG) : S with module A = A = struct
(* look for subterms of type Real, for they will need theory combination *)
let on_subterm (self:state) _ (t:T.t) : unit =
Log.debugf 50 (fun k->k "(@[lra.cc-on-subterm@ %a@])" T.pp t);
if A.has_ty_real t &&
not (T.Tbl.mem self.needs_th_combination t) then (
Log.debugf 5 (fun k->k "(@[lra.needs-th-combination@ %a@])" T.pp t);
T.Tbl.add self.needs_th_combination t ()
)
match A.view_as_lra t with
| LRA_other _ when not (A.has_ty_real t) -> ()
| _ ->
if not (T.Tbl.mem self.needs_th_combination t) then (
Log.debugf 5 (fun k->k "(@[lra.needs-th-combination@ %a@])" T.pp t);
T.Tbl.add self.needs_th_combination t ()
)
let create_and_setup si =
Log.debug 2 "(th-lra.setup)";