fix: model evaluation must prioritize defined constants' semantics

This commit is contained in:
Simon Cruanes 2019-03-22 20:26:06 -05:00
parent 539186bfe6
commit 14992f07ec
2 changed files with 10 additions and 8 deletions

View file

@ -155,14 +155,14 @@ let eval (m:t) (t:Term.t) : Value.t option =
let b = aux b in let b = aux b in
if Value.equal a b then Value.true_ else Value.false_ if Value.equal a b then Value.true_ else Value.false_
| App_cst (c, args) -> | App_cst (c, args) ->
try Term.Map.find t m.values match Cst.view c with
with Not_found -> | Cst_def udef ->
match Cst.view c with (* use builtin interpretation function *)
| Cst_def udef -> let args = IArray.map aux args in
(* use builtin interpretation function *) udef.eval args
let args = IArray.map aux args in | Cst_undef _ ->
udef.eval args try Term.Map.find t m.values
| Cst_undef _ -> with Not_found ->
begin match Cst.Map.find c m.funs with begin match Cst.Map.find c m.funs with
| fi -> | fi ->
let args = IArray.map aux args |> IArray.to_list in let args = IArray.map aux args |> IArray.to_list in

View file

@ -181,6 +181,8 @@ module Arg = struct
let eval args = let eval args =
let module Value = Sidekick_smt.Value in let module Value = Sidekick_smt.Value in
Log.debugf 5
(fun k->k "(@[distinct.eval@ %a@])" (Fmt.seq Value.pp) (IArray.to_seq args));
if if
Iter.diagonal (IArray.to_seq args) Iter.diagonal (IArray.to_seq args)
|> Iter.for_all (fun (x,y) -> not @@ Value.equal x y) |> Iter.for_all (fun (x,y) -> not @@ Value.equal x y)