(Context ctx)
| 982 | // / <remarks>This function demonstrates how to create uninterpreted |
| 983 | // / types and functions.</remarks> |
| 984 | public void proveExample1(Context ctx) throws TestFailedException |
| 985 | { |
| 986 | System.out.println("ProveExample1"); |
| 987 | Log.append("ProveExample1"); |
| 988 | |
| 989 | /* create uninterpreted type. */ |
| 990 | UninterpretedSort U = ctx.mkUninterpretedSort(ctx.mkSymbol("U")); |
| 991 | |
| 992 | /* declare function g */ |
| 993 | FuncDecl<UninterpretedSort> g = ctx.mkFuncDecl("g", U, U); |
| 994 | |
| 995 | /* create x and y */ |
| 996 | Expr<UninterpretedSort> x = ctx.mkConst("x", U); |
| 997 | Expr<UninterpretedSort> y = ctx.mkConst("y", U); |
| 998 | /* create g(x), g(y) */ |
| 999 | Expr<UninterpretedSort> gx = g.apply(x); |
| 1000 | Expr<UninterpretedSort> gy = g.apply(y); |
| 1001 | |
| 1002 | /* assert x = y */ |
| 1003 | BoolExpr eq = ctx.mkEq(x, y); |
| 1004 | |
| 1005 | /* prove g(x) = g(y) */ |
| 1006 | BoolExpr f = ctx.mkEq(gx, gy); |
| 1007 | System.out.println("prove: x = y implies g(x) = g(y)"); |
| 1008 | prove(ctx, ctx.mkImplies(eq, f), false); |
| 1009 | |
| 1010 | /* create g(g(x)) */ |
| 1011 | Expr<UninterpretedSort> ggx = g.apply(gx); |
| 1012 | |
| 1013 | /* disprove g(g(x)) = g(y) */ |
| 1014 | f = ctx.mkEq(ggx, gy); |
| 1015 | System.out.println("disprove: x = y implies g(g(x)) = g(y)"); |
| 1016 | disprove(ctx, ctx.mkImplies(eq, f), false); |
| 1017 | |
| 1018 | /* Print the model using the custom model printer */ |
| 1019 | Model m = check(ctx, ctx.mkNot(f), Status.SATISFIABLE); |
| 1020 | System.out.println(m); |
| 1021 | } |
| 1022 | |
| 1023 | // / Prove <tt>not(g(g(x) - g(y)) = g(z)), x + z <= y <= x implies z < 0 |
| 1024 | // </tt>. |
no test coverage detected