Z3

(四点共面) 51nod1265 四点共面

。_饼干妹妹 提交于 2021-02-12 22:38:55
1265 四点共面 1 秒 131,072 KB 0 分 基础题 给出三维空间上的四个点(点与点的位置均不相同),判断这4个点是否在同一个平面内(4点共线也算共面)。如果共面,输出"Yes",否则输出"No"。 收起 输入 第1行:一个数T,表示输入的测试数量(1 <= T <= 1000) 第2 - 4T + 1行:每行4行表示一组数据,每行3个数,x, y, z, 表示该点的位置坐标(-1000 <= x, y, z <= 1000)。 输出 输出共T行,如果共面输出"Yes",否则输出"No"。 输入样例 1 1 2 0 2 3 0 4 0 0 0 0 0 输出样例 Yes 四点共面可以化为三条直线共面的问题,而三条直线的共面的必要条件为三条直线的向量所构成的行列式的值为0 C++代码: #include<iostream> #include <cstdio> using namespace std; struct point{ double x,y,z; }p[ 4 ]; bool cmp(point a,point b,point c,point d){ double x1 = a.x - b.x; double y1 = a.y - b.y; double z1 = a.z - b.z; double x2 = a.x - c.x; double y2 = a.y -

CVC4 minimize/maximize model optimization

不想你离开。 提交于 2021-02-11 18:26:11
问题 Does CVC4 an option to maximize or minimize the result model for bitvectors as Z3 does? Thanks. 回答1: Unfortunately, CVC4 does not (yet) support optimization. For bitvectors, you can always do it yourself using multiple queries and binary search, but it's not built-in. 来源: https://stackoverflow.com/questions/37304885/cvc4-minimize-maximize-model-optimization

CVC4 minimize/maximize model optimization

北慕城南 提交于 2021-02-11 18:26:07
问题 Does CVC4 an option to maximize or minimize the result model for bitvectors as Z3 does? Thanks. 回答1: Unfortunately, CVC4 does not (yet) support optimization. For bitvectors, you can always do it yourself using multiple queries and binary search, but it's not built-in. 来源: https://stackoverflow.com/questions/37304885/cvc4-minimize-maximize-model-optimization

Do you know how to set “weak” initial values to each of z3 Array element?

我与影子孤独终老i 提交于 2021-02-11 17:01:23
问题 For example, is there a something like below weak_Store function in Z3? from z3 import * a = Array('a', IntSort(), IntSort()) a = weak_Store(a, 0, 0) a = weak_Store(a, 1, 1) s = Solver() s.add(a[0] == 100) print(s.check()) # should print "sat" print(s.model().eval(a[0])) # should print "100" print(s.model().eval(a[1])) # should print "1" which is stored as weak_Store. Since a[1] is not involved in the above constraint solving, this should not be computed and changed even after s.check(). I

Turning Off Z3py Print Truncation

家住魔仙堡 提交于 2021-02-11 14:55:24
问题 I need to print an entire Z3 problem to debug it, but when I print it the output is truncated. from z3 import * s = Solver() ... Add many assertions to s ... print(s) How do I display everything? 回答1: Try: set_option(max_args=10000000, max_lines=1000000, max_depth=10000000, max_visited=1000000) You might want to play with actual values to come up with something that suits your needs. 来源: https://stackoverflow.com/questions/62008181/turning-off-z3py-print-truncation

ScalaZ3 installation issue

牧云@^-^@ 提交于 2021-02-11 07:01:47
问题 I am trying to install ScalaZ3 by using the site https://github.com/epfl-lara/ScalaZ3 . I cloned the code into my directory on Windows, opened a Linux terminal and ran sbt +package . At first it returned several errors since I am using Ubuntu Linux subsystem on Windows, so I had to comment out some lines in mk_util.py to make it work. I now encounter another problem where it is trying to run a "make" file but it can't find it. It has the correct directory path and the file exists in that

ScalaZ3 installation issue

我怕爱的太早我们不能终老 提交于 2021-02-11 07:01:32
问题 I am trying to install ScalaZ3 by using the site https://github.com/epfl-lara/ScalaZ3 . I cloned the code into my directory on Windows, opened a Linux terminal and ran sbt +package . At first it returned several errors since I am using Ubuntu Linux subsystem on Windows, so I had to comment out some lines in mk_util.py to make it work. I now encounter another problem where it is trying to run a "make" file but it can't find it. It has the correct directory path and the file exists in that

How to visit Z3 expressions with quantifiers

随声附和 提交于 2021-02-10 13:25:09
问题 I would like to visit a z3::expr . The examples directory provides this snippet: void visit(expr const & e) { if (e.is_app()) { unsigned num = e.num_args(); for (unsigned i = 0; i < num; i++) { visit(e.arg(i)); } // do something // Example: print the visited expression func_decl f = e.decl(); std::cout << "application of " << f.name() << ": " << e << "\n"; } else if (e.is_quantifier()) { visit(e.body()); // do something } else { assert(e.is_var()); // do something } } I am ok with the

Length function for generic lists

ⅰ亾dé卋堺 提交于 2021-02-10 05:49:46
问题 This post shows how to axiomatise a length function for Z3's built-in lists. However, the function is sort-specific (here Int) and not applicable to lists of bools or custom sorts. ; declare len as an uninterpreted function (declare-fun len ((List Int)) Int) ; assert defining equations for len as an axiom (assert (forall ((xs (List Int))) (ite (= nil xs) (= 0 (len xs)) (= (+ 1 (len (tail xs))) (len xs))))) What would be the smartest way of encoding sort-generic list functions? (If I remember

Z3 Solver Java API: Unexpected behaviour

删除回忆录丶 提交于 2021-02-09 07:54:34
问题 By adding conditions to the solver, I want to check with "solver.check()", whether there exists a solution or not. Therefore, I created a simple example to find a solution for t1. I know that there is a solution for t1, namely t1 = 0. Nevertheless, the solver has not the status "SATISFIABLE". public static void main(String[] args) { int h_max = 7; HashMap<String, String> cfg = new HashMap<String, String>(); cfg.put("model", "true"); Context ctx = new Context(cfg); FPSort s = ctx.mkFPSort(5,