dreal4 icon indicating copy to clipboard operation
dreal4 copied to clipboard

let + forall

Open soonho-tri opened this issue 7 years ago • 4 comments

From https://github.com/dreal/dreal4/pull/78#issuecomment-380218590

Input:

(set-logic QF_NRA)
(assert
 (forall ((x Real [0.0, 7.0]))
  (let ((y (+ x 1)))
   (>= y (* x 2)))))
(check-sat)
(exit)

Output:

Running local dreal
terminate called after throwing an instance of 'std::runtime_error'
  what():  dreal/util/ibex_converter.cc:90 Variable x is not appeared in L0\y .
Aborted (core dumped)

/cc @martinjos

soonho-tri avatar Apr 10 '18 19:04 soonho-tri

This is because we process a let_binding_list and add the temporary terms (i.e. L0\y = x + 1) at the top-level. This strategy works for the exist-case but does not work when let is embedded inside of forall (which is this case).

https://github.com/dreal/dreal4/blob/8fbce2e029c05f4fd95d7299dfd69bec8b400fb2/dreal/smt2/parser.yy#L360-L362

https://github.com/dreal/dreal4/blob/8fbce2e029c05f4fd95d7299dfd69bec8b400fb2/dreal/smt2/parser.yy#L501-L519

I'll change the parser so that let_binding_list: returns a formula (a conjunction of bindings) so that we can combine it with the term in let. This will make sure that nothing is leaked outside of the scope.

soonho-tri avatar Apr 12 '18 13:04 soonho-tri

We need more than this since we also have let-expressions.

soonho-tri avatar Apr 14 '18 22:04 soonho-tri

Is there any plan to support forall with lets in upcoming releases?

benjholla avatar Aug 09 '19 21:08 benjholla

@benjholla , we do not have a specific timeline for this.

soonho-tri avatar Aug 12 '19 12:08 soonho-tri