(Context ctx)
| 1193 | // / <remarks>This function demonstrates how to create uninterpreted |
| 1194 | // / types and functions.</remarks> |
| 1195 | public void proveExample1(Context ctx) throws TestFailedException |
| 1196 | { |
| 1197 | System.out.println("ProveExample1"); |
| 1198 | Log.append("ProveExample1"); |
| 1199 | |
| 1200 | /* create uninterpreted type. */ |
| 1201 | Sort U = ctx.mkUninterpretedSort(ctx.mkSymbol("U")); |
| 1202 | |
| 1203 | /* declare function g */ |
| 1204 | FuncDecl g = ctx.mkFuncDecl("g", U, U); |
| 1205 | |
| 1206 | /* create x and y */ |
| 1207 | Expr x = ctx.mkConst("x", U); |
| 1208 | Expr y = ctx.mkConst("y", U); |
| 1209 | /* create g(x), g(y) */ |
| 1210 | Expr gx = g.apply(x); |
| 1211 | Expr gy = g.apply(y); |
| 1212 | |
| 1213 | /* assert x = y */ |
| 1214 | BoolExpr eq = ctx.mkEq(x, y); |
| 1215 | |
| 1216 | /* prove g(x) = g(y) */ |
| 1217 | BoolExpr f = ctx.mkEq(gx, gy); |
| 1218 | System.out.println("prove: x = y implies g(x) = g(y)"); |
| 1219 | prove(ctx, ctx.mkImplies(eq, f), false); |
| 1220 | |
| 1221 | /* create g(g(x)) */ |
| 1222 | Expr ggx = g.apply(gx); |
| 1223 | |
| 1224 | /* disprove g(g(x)) = g(y) */ |
| 1225 | f = ctx.mkEq(ggx, gy); |
| 1226 | System.out.println("disprove: x = y implies g(g(x)) = g(y)"); |
| 1227 | disprove(ctx, ctx.mkImplies(eq, f), false); |
| 1228 | |
| 1229 | /* Print the model using the custom model printer */ |
| 1230 | Model m = check(ctx, ctx.mkNot(f), Status.SATISFIABLE); |
| 1231 | System.out.println(m); |
| 1232 | } |
| 1233 | |
| 1234 | // / Prove <tt>not(g(g(x) - g(y)) = g(z)), x + z <= y <= x implies z < 0 |
| 1235 | // </tt>. |
no test coverage detected