(Context ctx)
| 641 | // cref="inj_axiom"/> |
| 642 | |
| 643 | public void quantifierExample3(Context ctx) throws TestFailedException |
| 644 | { |
| 645 | System.out.println("QuantifierExample3"); |
| 646 | Log.append("QuantifierExample3"); |
| 647 | |
| 648 | /* |
| 649 | * If quantified formulas are asserted in a logical context, then the |
| 650 | * model produced by Z3 should be viewed as a potential model. |
| 651 | */ |
| 652 | |
| 653 | /* declare function f */ |
| 654 | IntSort I = ctx.getIntSort(); |
| 655 | FuncDecl<IntSort> f = ctx.mkFuncDecl("f", new Sort[] { I, I }, I); |
| 656 | |
| 657 | /* f is injective in the second argument. */ |
| 658 | BoolExpr inj = injAxiom(ctx, f, 1); |
| 659 | |
| 660 | /* create x, y, v, w, fxy, fwv */ |
| 661 | IntExpr x = ctx.mkIntConst("x"); |
| 662 | IntExpr y = ctx.mkIntConst("y"); |
| 663 | IntExpr v = ctx.mkIntConst("v"); |
| 664 | IntExpr w = ctx.mkIntConst("w"); |
| 665 | Expr<IntSort> fxy = ctx.mkApp(f, x, y); |
| 666 | Expr<IntSort> fwv = ctx.mkApp(f, w, v); |
| 667 | |
| 668 | /* f(x, y) = f(w, v) */ |
| 669 | BoolExpr p1 = ctx.mkEq(fxy, fwv); |
| 670 | |
| 671 | /* prove f(x, y) = f(w, v) implies y = v */ |
| 672 | BoolExpr p2 = ctx.mkEq(y, v); |
| 673 | prove(ctx, p2, false, inj, p1); |
| 674 | |
| 675 | /* disprove f(x, y) = f(w, v) implies x = w */ |
| 676 | BoolExpr p3 = ctx.mkEq(x, w); |
| 677 | disprove(ctx, p3, false, inj, p1); |
| 678 | } |
| 679 | |
| 680 | // / Prove that <tt>f(x, y) = f(w, v) implies y = v</tt> when |
| 681 | // / <code>f</code> is injective in the second argument. <seealso |
no test coverage detected