def check_discovery(spec, expected, state_vars=[], args=[], examples=[], assumptions=ETRUE): ctx = RootCtx(state_vars=state_vars, args=args) for r in improve(spec, assumptions=assumptions, context=ctx, examples=examples): print("GOT RESULT ==> {}".format(pprint(r))) if isinstance(expected, Exp): if alpha_equivalent(r, expected): return True elif expected(r): return True return False
def test_incomplete_binders_list_2(self): res = None x = EVar("x").with_type(BOOL) xs = EVar("xs").with_type(TBag(BOOL)) target = EFilter(EStateVar(xs), ELambda(x, T)) assumptions = EUnaryOp(UOp.All, xs) assert retypecheck(target) assert retypecheck(assumptions) def should_stop(): return res == EStateVar(EVar("xs")) for r in improve(target, assumptions, [], [xs], [], CompositeCostModel(), BinderBuilder([], [xs], []), stop_callback=should_stop): print(pprint(r)) res = r assert should_stop()