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

Method findModelExample1

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

Source from the content-addressed store, hash-verified

929 // / Find a model for <code>x xor y</code>.
930
931 public void findModelExample1(Context ctx) throws TestFailedException
932 {
933 System.out.println("FindModelExample1");
934 Log.append("FindModelExample1");
935
936 BoolExpr x = ctx.mkBoolConst("x");
937 BoolExpr y = ctx.mkBoolConst("y");
938 BoolExpr x_xor_y = ctx.mkXor(x, y);
939
940 Model model = check(ctx, x_xor_y, Status.SATISFIABLE);
941 System.out.printf("x = %s, y = %s%n", model.evaluate(x, false), model.evaluate(y, false));
942 }
943
944 // / Find a model for <tt>x < y + 1, x > 2</tt>.
945 // / Then, assert <tt>not(x = y)</tt>, and find another model.

Callers 1

mainMethod · 0.95

Calls 5

appendMethod · 0.95
checkMethod · 0.95
evaluateMethod · 0.95
mkBoolConstMethod · 0.80
mkXorMethod · 0.80

Tested by

no test coverage detected