(Context ctx)
| 1359 | // / <remarks>Check that the projection of a tuple |
| 1360 | // / returns the corresponding element.</remarks> |
| 1361 | public void tupleExample(Context ctx) throws TestFailedException |
| 1362 | { |
| 1363 | System.out.println("TupleExample"); |
| 1364 | Log.append("TupleExample"); |
| 1365 | |
| 1366 | Sort int_type = ctx.getIntSort(); |
| 1367 | TupleSort tuple = ctx.mkTupleSort(ctx.mkSymbol("mk_tuple"), // name of |
| 1368 | // tuple |
| 1369 | // constructor |
| 1370 | new Symbol[] { ctx.mkSymbol("first"), ctx.mkSymbol("second") }, // names |
| 1371 | // of |
| 1372 | // projection |
| 1373 | // operators |
| 1374 | new Sort[] { int_type, int_type } // types of projection |
| 1375 | // operators |
| 1376 | ); |
| 1377 | FuncDecl first = tuple.getFieldDecls()[0]; // declarations are for |
| 1378 | // projections |
| 1379 | @SuppressWarnings("unused") |
| 1380 | FuncDecl second = tuple.getFieldDecls()[1]; |
| 1381 | Expr x = ctx.mkConst("x", int_type); |
| 1382 | Expr y = ctx.mkConst("y", int_type); |
| 1383 | Expr n1 = tuple.mkDecl().apply(x, y); |
| 1384 | Expr n2 = first.apply(n1); |
| 1385 | BoolExpr n3 = ctx.mkEq(x, n2); |
| 1386 | System.out.println("Tuple example: " + n3); |
| 1387 | prove(ctx, n3, false); |
| 1388 | } |
| 1389 | |
| 1390 | // / Simple bit-vector example. |
| 1391 |
no test coverage detected