(Context ctx)
| 682 | // cref="inj_axiom"/> |
| 683 | |
| 684 | public void quantifierExample4(Context ctx) throws TestFailedException |
| 685 | { |
| 686 | System.out.println("QuantifierExample4"); |
| 687 | Log.append("QuantifierExample4"); |
| 688 | |
| 689 | /* |
| 690 | * If quantified formulas are asserted in a logical context, then the |
| 691 | * model produced by Z3 should be viewed as a potential model. |
| 692 | */ |
| 693 | |
| 694 | /* declare function f */ |
| 695 | IntSort I = ctx.getIntSort(); |
| 696 | FuncDecl<IntSort> f = ctx.mkFuncDecl("f", new Sort[] { I, I }, I); |
| 697 | |
| 698 | /* f is injective in the second argument. */ |
| 699 | BoolExpr inj = injAxiomAbs(ctx, f, 1); |
| 700 | |
| 701 | /* create x, y, v, w, fxy, fwv */ |
| 702 | IntExpr x = ctx.mkIntConst("x"); |
| 703 | IntExpr y = ctx.mkIntConst("y"); |
| 704 | IntExpr v = ctx.mkIntConst("v"); |
| 705 | IntExpr w = ctx.mkIntConst("w"); |
| 706 | Expr<IntSort> fxy = ctx.mkApp(f, x, y); |
| 707 | Expr<IntSort> fwv = ctx.mkApp(f, w, v); |
| 708 | |
| 709 | /* f(x, y) = f(w, v) */ |
| 710 | BoolExpr p1 = ctx.mkEq(fxy, fwv); |
| 711 | |
| 712 | /* prove f(x, y) = f(w, v) implies y = v */ |
| 713 | BoolExpr p2 = ctx.mkEq(y, v); |
| 714 | prove(ctx, p2, false, inj, p1); |
| 715 | |
| 716 | /* disprove f(x, y) = f(w, v) implies x = w */ |
| 717 | BoolExpr p3 = ctx.mkEq(x, w); |
| 718 | disprove(ctx, p3, false, inj, p1); |
| 719 | } |
| 720 | |
| 721 | // / Some basic tests. |
| 722 |
no test coverage detected