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

Method bitvectorExample1

examples/java/JavaGenericExample.java:1184–1200  ·  view source on GitHub ↗
(Context ctx)

Source from the content-addressed store, hash-verified

1182 // machine integers
1183 // / </remarks>
1184 public void bitvectorExample1(Context ctx) throws TestFailedException
1185 {
1186 System.out.println("BitvectorExample1");
1187 Log.append("BitvectorExample1");
1188
1189 BitVecSort bv_type = ctx.mkBitVecSort(32);
1190 Expr<BitVecSort> x = ctx.mkConst("x", bv_type);
1191 Expr<BitVecSort> zero = ctx.mkNumeral("0", bv_type);
1192 BitVecNum ten = ctx.mkBV(10, 32);
1193 BitVecExpr x_minus_ten = ctx.mkBVSub(x, ten);
1194 /* bvsle is signed less than or equal to */
1195 BoolExpr c1 = ctx.mkBVSLE(x, ten);
1196 BoolExpr c2 = ctx.mkBVSLE(x_minus_ten, zero);
1197 BoolExpr thm = ctx.mkIff(c1, c2);
1198 System.out.println("disprove: x - 10 <= 0 IFF x <= 10 for (32-bit) machine integers");
1199 disprove(ctx, thm, false);
1200 }
1201
1202 // / Find x and y such that: x ^ y - 103 == x * y
1203

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