void test2() { VC vc = vc_createValidityChecker(NULL); // Check x = y -> g(x,y) = g(y,x) Type r = vc_realType(vc); Expr x = vc_varExpr(vc, "x", r); Expr y = vc_varExpr(vc, "y", r); Type realxreal2real = vc_funType2(vc, r, r, r); Op g = vc_createOp(vc, "g", realxreal2real); Expr gxy = vc_funExpr2(vc, g, x, y); Expr gyx = vc_funExpr2(vc, g, y, x); Expr xeqy = vc_eqExpr(vc, x, y); Expr gxyeqgyx = vc_eqExpr(vc, gxy, gyx); Expr e = vc_impliesExpr(vc, xeqy, gxyeqgyx); Type v[2]; Op h; Expr hxy, hyx, hxyeqhyx; int res; res = check(vc, e); FatalAssert(res == 1, "Expected Valid"); vc_deleteType(realxreal2real); vc_deleteOp(g); vc_deleteExpr(gxy); vc_deleteExpr(gyx); vc_deleteExpr(gxyeqgyx); vc_deleteExpr(e); v[0] = r; v[1] = r; realxreal2real = vc_funTypeN(vc, v, r, 2); h = vc_createOp(vc, "h", realxreal2real); hxy = vc_funExpr2(vc, h, x, y); hyx = vc_funExpr2(vc, h, y, x); hxyeqhyx = vc_eqExpr(vc, hxy, hyx); e = vc_impliesExpr(vc, xeqy, hxyeqhyx); res = check(vc, e); FatalAssert(res == 1, "Expected Valid"); vc_deleteType(r); vc_deleteExpr(x); vc_deleteExpr(y); vc_deleteType(realxreal2real); vc_deleteExpr(hxy); vc_deleteExpr(hxyeqhyx); vc_deleteExpr(e); vc_destroyValidityChecker(vc); }
value caml_vc_funType2(value vc, value a1, value a2, value tr) { CAMLparam4(vc,a1,a2,tr); CAMLreturn(alloc_Type(vc_funType2(VC_val(vc),Type_val(a1), Type_val(a2),Type_val(tr)))); }