Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Yes, you're right, you want to <code>pop</code> (remove) the last assertion. To do this, you first need to save the current set of assertions with <code>push</code>. This is how Z3 supports scope.</p> <p>By add some part of the formula, I'm going to assume you mean to define a variable containing an additional chunk of some original large formula you're doing the incremental checking on. I'll also assume the original formula is a large conjunction of sub-formulas. This new formula will remain defined between pushes and pops (assuming you keep a variable referencing it).</p> <p>Here is a link to an example of roughly the following pseudo-code in z3py, except in the z3py script I also assume the formula and the constraint are actually the same thing, but maybe you want to create some different constraint based on that piece of the subformula: <a href="http://rise4fun.com/Z3Py/LIxW" rel="nofollow noreferrer">http://rise4fun.com/Z3Py/LIxW</a></p> <p>I haven't used Scala^Z3, but roughly you want to do the following:</p> <pre><code>formula // list containing parts (sub-formulas) of original large formula while (formulaPart = formula.removeFirst()) // remove first element of list Z3Context.push() // save current set of assertions assertion = makeConstraint( formulaPart ) // assertion based on sub-formula Z3Context.assertCnstr( assertion ) // add new assertion if !Z3Context.check() // check if assertions cannot be satisfied Z3Context.pop() // remove most recent assertion </code></pre> <p>Here is an example using pop/push from the .NET API: <a href="http://research.microsoft.com/en-us/um/redmond/projects/z3/test__managed_8cs_source.html#l00637" rel="nofollow noreferrer">http://research.microsoft.com/en-us/um/redmond/projects/z3/test__managed_8cs_source.html#l00637</a></p> <p>You'd also be interested in this: <a href="https://stackoverflow.com/questions/8439556/soft-hard-constraints-in-z3">Soft/Hard constraints in Z3</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload