Z3

Keep getting “unknown” result with :pattern usage in SMTLIB v2 input

蹲街弑〆低调 提交于 2019-12-12 12:09:44
问题 I'm encountering a problem when using the SMTLIBv2 input format and patterns with Z3: I keep getting the result "unknown" with the following input: (declare-datatypes () ((L L0 L1))) (declare-fun path () (List L)) (declare-fun checkTransition ((List L)) Bool) (define-fun isCons ((p (List L))) Bool (not (= p nil)) ) ; configuration options for :pattern, taken from the Z3 tutorial (set-option :auto-config false) ; disable automatic self configuration (set-option :smt.mbqi false) ; disable model

Why does 0 = 0.5?

风流意气都作罢 提交于 2019-12-12 11:09:14
问题 I noticed some strange behavior with Z3 4.3.1 when working with .smt2 files. If I do (assert (= 0 0.5)) it will be satisfiable. However, if I switch the order and do (assert (= 0.5 0)) it's not satisfiable. My guess as to what is happening is that if the first parameter is an integer, it casts both of them to integers (rounding 0.5 down to 0), then does the comparison. If I change "0" to "0.0" it works as expected. This is in contrast to most programming languages I've worked with where if

TryFor in Z3 does not stop checking after the given timelimit

本秂侑毒 提交于 2019-12-12 11:01:05
问题 I am using the .NET API of Z3. When I instantiate a solver by calling: Solver s = ctx.MkSolver(ctx.TryFor(ctx.MkTactic("qflia"), TimeLimit)); and give it a TimeLimit of 60 seconds (60000 milliseconds) for some models the statement s.Check() does not return after 60 seconds. For some models it returns a few seconds later, which in my case would not be a problem, but for some models it doesn't return at all (I cancelled the process after 3 days). How can I force Z3 to stop checking after a

Parallel solving in Z3

余生长醉 提交于 2019-12-12 09:55:42
问题 One of the new features in Z3 4.8.1 is parallel solving: A parallel mode is available for select theories, including QF_BV. By setting parallel.enable=true Z3 will spawn a number of worker threads proportional to the number of available CPU cores to apply cube and conquer solving on the goal. It mentions that just parallel.enable=true needs to be set but I can't find that parallel structure in the code. Can someone provide some example code to see how to implement this new feature? Thank you

Incremental calls to Z3 on UFBV with and without push calls

一笑奈何 提交于 2019-12-12 09:46:07
问题 I am running Z3 on UFBV queries. Currently the query contains 2 calls check-sat . If put push 1 just after check-sat Z3 solves the query in 30sec. If don't put any push 1 at all - Z3 solves it in 200sec. Interesting. Any specific reasons or just a coincidence? 回答1: Z3 3.x has a "strategy specification language" based on tactics and tacticals. I'm not "advertising" that yet because it is working in progress. The basic idea is described in this slide deck. We have a different built-in strategy

Horn clauses in Z3

大兔子大兔子 提交于 2019-12-12 08:58:15
问题 Z3 now supports solving for inductive invariants (implying a desired property) if the semantics of the program to analyze is given as Horn clauses. The version in the master branch of the Z3 source code on z3.codeplex.com however does not support this feature. Since Z3 solves these Horn clauses problems by the PDR algorithm, which uses interpolation, I compiled instead the interp branch ( d8b31773b809 ), which supports (set-logic HORN) . As far as I understood, a Horn-clause problem is to be

What is the importance of the order of the assertions in Z3?

前提是你 提交于 2019-12-12 07:19:59
问题 I have two files whose content is identical except for the order in which I placed the assertions: in one file, the assertions are placed in the reverse order of the other. The first file (po-9.z3) is declared unsatifiable by Z3 in less than a second while the other (po.z3) cannot be verified within a minute. What could be the reason for this difference? I assumed that placing the assertions that will be involved in the verification earlier in the file would improve performances. However, the

Solvability of nonlinear real arithmetic with premises

孤街浪徒 提交于 2019-12-12 06:15:02
问题 A small example indicates that the nonlinear real arithmetic (NRA) solvers are hindered when NRA assertions are labeled by premises pi in connection with (sat p1 ... pn) checks. The following SMT2 example returns SAT with the correct model: (declare-const p1 Bool) (declare-const p2 Bool) (declare-const p3 Bool) (declare-const p4 Bool) (declare-const x1 Real) (declare-const x2 Real) (declare-const x3 Real) (assert (=> p1 (= x1 (/ 1.0 (* x2 x2))))) (assert (=> p2 (not (= x2 0.0)))) (assert (=>

Does Z3 support variable-only patterns in quantified formulas?

ⅰ亾dé卋堺 提交于 2019-12-12 05:27:11
问题 I'd like to use variable-only patterns to obtain decision procedures for certain theories encoded using quantified axioms. More precisely, I want to enforce that certain variables in these axioms are instantiated with all terms of the corresponding sort. These variables only appear below predicate symbols, so there is no danger for creating matching loops. For example, consider the following partial query: (declare-sort Loc 0) (declare-sort Map 2) (declare-fun read ((Map Loc Loc) Loc) Loc)

Z3 Segmentation Fault

删除回忆录丶 提交于 2019-12-12 05:16:46
问题 I have written the following Perl script to generate the logical constraints in smt2 format to solve a sudoku puzzle for a given input file. The input file is in this format: 5 3 * * 7 * * * * 6 * * 1 9 5 * * * * 9 8 * * * * 6 * 8 * * * 6 * * * 3 4 * * 8 * 3 * * 1 7 * * * 2 * * * 6 * 6 * * * * 2 8 * * * * 4 1 9 * * 5 * * * * 8 * * 7 9 The big ugly Perl script is: #! /usr/local/bin/perl # CSC 410 A2 Q2 # Sudoku use strict; use warnings; # All of the indices in a sudoku array my @row1 = qw(r1c1