def backward(rules, query, *pmode): global known, kbase # avoid extra args backwrd1.kbase = rules # set for browsing known, kbase = [['true']], rules # local to module try: for (stack, proof) in AND(query, [{}], [], []): try: report(stack[0], query, pmode, proof) except backtrack: pass print 'no (more) solutions [backwrd2.py]' except stop_proof: pass
def report(kbase, topenv, query, pmode, how): import backward try: backward.report(kbase, topenv, query, pmode, how) except backward.backtrack: return