MCPcopy Create free account
hub / github.com/Z3Prover/z3 / bitvectorExample1

Method bitvectorExample1

examples/java/JavaExample.java:1396–1413  ·  view source on GitHub ↗
(Context ctx)

Source from the content-addressed store, hash-verified

1394 // machine integers
1395 // / </remarks>
1396 public void bitvectorExample1(Context ctx) throws TestFailedException
1397 {
1398 System.out.println("BitvectorExample1");
1399 Log.append("BitvectorExample1");
1400
1401 BitVecSort bv_type = ctx.mkBitVecSort(32);
1402 BitVecExpr x = (BitVecExpr) ctx.mkConst("x", bv_type);
1403 BitVecNum zero = (BitVecNum) ctx.mkNumeral("0", bv_type);
1404 BitVecNum ten = ctx.mkBV(10, 32);
1405 BitVecExpr x_minus_ten = ctx.mkBVSub(x, ten);
1406 /* bvsle is signed less than or equal to */
1407 BoolExpr c1 = ctx.mkBVSLE(x, ten);
1408 BoolExpr c2 = ctx.mkBVSLE(x_minus_ten, zero);
1409 BoolExpr thm = ctx.mkIff(c1, c2);
1410 System.out
1411 .println("disprove: x - 10 <= 0 IFF x <= 10 for (32-bit) machine integers");
1412 disprove(ctx, thm, false);
1413 }
1414
1415 // / Find x and y such that: x ^ y - 103 == x * y
1416

Callers 1

mainMethod · 0.95

Calls 9

appendMethod · 0.95
disproveMethod · 0.95
mkBitVecSortMethod · 0.80
mkConstMethod · 0.80
mkNumeralMethod · 0.80
mkBVMethod · 0.80
mkBVSubMethod · 0.80
mkBVSLEMethod · 0.80
mkIffMethod · 0.80

Tested by

no test coverage detected