Lifted boolean operations retain their Racket semantics on both concrete and symbolic values. In particular, Rosette extends the intepretation of these operations to work on symbolic values in (logically) the same way that they work on concrete values.
#t
#t
#t
#f
(! b)
Lifted numeric operations, in contrast, match their Racket semantics only when applied to concrete values. Their symbolic semantics depends on the current reasoning precision, as determined by the current-bitwidth parameter. In particular, if this parameter is set to #f, operations on symbolic numbers retain their infinite-precision Racket semantics. However, because infinite-precision reasoning is not efficiently (or at all) decidable for arbitrary numeric operations, programs may need to set current-bitwidth to a small positive integer k. With this setting, symbolic numbers are treated as signed k-bit integers. See Reasoning Precision for details and examples.
In addition to lifting Racket’s operations on booleans, Rosette supports the following logical operations: conjunction (&& ), disjunction (|| ), implication (=> ), bi-implication (<=> ), and negation (! ). These operations have their usual logical meaning; e.g., unlike Racket’s shortcircuiting and operator, the logical && operator evaluates all of its arguments before taking their conjunction.
Rosette also provides constructs for creating universally (forall ) and existentially (exists ) quantified formulas. These differ from the usual logical quantifiers in that the evaluation of a quantified formula’s body may have side effects (e.g., generate assertions). When there are no side effects, however, these constructs have their usual logical meaning.
(exists (x y) (= x y))
(forall (b x y) (= y (+ 1 x)))
(vc #t b)
> (clear-vc!);To avoid surprises, capture assertions and assumptions using with-vc,;and handle as desired, e.g.:> out(normal (= y (+ 1 x)) (vc #t b))
(forall (b x y) (|| (! b) (= y (+ 1 x))))
(vc #t #t)
The usual lexical scoping rules apply to quantified symbolics; if body is a quantified formula over a variable v in vs, then the innermost quantification of v shadows any enclosing quantifications. Quantified symbolics are not bound in a model , unless they also appear freely in some formulas.
(model)
(model
[y 0])
(unsat)
When executing queries over assertions that contain quantified formulas, the current-bitwidth parameter must be set to #f. Quantified formulas may not appear in any assertion or assumption that is passed to a synthesize query.