def build_proof_tree(args, prop, lm): statement = prop.statement proof = prop.proof proof_steps_stack = [] statement_stack = [] index = 0 use = [args.gt_subs, args.gt_prop, args.gt_payout] while index<len(proof): label = proof[index] #print (label) if label in prop.e: index+=1 statement_stack.append(prop.e[label].tree) proof_steps_stack.append(ProofTree(prop.e[label].tree, prop, prop.e[label], [], 'e', use)) elif label in prop.f: index+=1 statement_stack.append(prop.f[label].tree) proof_steps_stack.append(ProofTree(prop.f[label].tree, prop, prop.f[label], [], 'f', use)) else: axiom = lm.database.propositions[label] arity = axiom.arity() if arity>0: new_statement,_ = axiom.unify(statement_stack[-arity:],prop) statement_stack = statement_stack[0:-arity] new_proof_step = ProofTree(new_statement, prop, axiom, proof_steps_stack[-arity:], 'p', use) proof_steps_stack = proof_steps_stack[0:-arity] else: new_statement = axiom.tree new_proof_step = ProofTree(axiom.tree, prop, axiom, [], 'p', use) statement_stack.append(new_statement) proof_steps_stack.append(new_proof_step) index += 1 assert len(statement_stack)==1 assert statement==[prop.statement[0]]+tree_parser.tree_to_string(statement_stack[0],lm.database,prop) return proof_steps_stack[-1]
def print_pp(tree, depth): string = tree_parser.tree_to_string(tree, global_problem.lm.database, global_context) string = ' '.join(string) #string = string.replace(" ", "") # so that the display fits on one line return string
def get_equation(self, lm, context): string = tree_parser.tree_to_string(self, lm.database, context) string = ' '.join(string) #string = string.replace(" ", "") # so that the display fits on one line return string
def print_pp(tree, depth): string = tree_parser.tree_to_string(tree, global_problem.lm.database, global_context) string = ' '.join(string) #string = string.replace(" ", "") # so that the display fits on one line return string
def get_equation(self, lm, context): string = tree_parser.tree_to_string(self, lm.database, context) string = ' '.join(string) #string = string.replace(" ", "") # so that the display fits on one line return string