def opposite(asker, object, x): underlying = asker.ask(properties.check(x, object)).firm_answer return asker.reply(answer=booleans.opposite(underlying))
def test_concat_empty(asker, a, b): return booleans.both( convert.hold(properties.check(is_empty(), a)), convert.hold(properties.check(is_empty(), b)) )
def irreducible(asker, rep): head = asker.ask(fields.get_field(representations.head(), rep)).firm_answer result = strings.to_str(asker, head) not in reducible_heads return asker.reply(answer=T.from_bool(result)) #FIXME this is much cleaner, but too slow; at any rate could remove duplicate code return asker.ask_tail(properties.check(opposite(reducible()), rep))