def get_problem_inline_scripts(pair): if pair.name in problem_inline_scripts: return problem_inline_scripts[pair.name] p = check.build_problem(pair, avoid_abort=True) scripts = p.inline_scripts problem_inline_scripts[pair.name] = scripts return scripts
def get_problem_inline_scripts (pair): if pair.name in problem_inline_scripts: return problem_inline_scripts[pair.name] p = check.build_problem (pair, skip_underspec = True) scripts = p.inline_scripts problem_inline_scripts[pair.name] = scripts return scripts
def toplevel_check (pair, check_loops = True, report = False, count = None, only_build_problem = False): if not only_build_problem: printout ('Testing Function pair %s' % pair) if count and not only_build_problem: (i, n) = count printout (' (function pairing %d of %d)' % (i + 1, n)) for (tag, fname) in pair.funs.iteritems (): if not functions[fname].entry: printout ('Skipping %s, underspecified %s' % (pair, tag)) return 'None' prev_tracer = tracer[0] if report: tracer[0] = lambda s, n: () exception = None trace (time.asctime ()) start_time = time.time() sys.stdout.flush () try: p = check.build_problem (pair) if only_build_problem: tracer[0] = prev_tracer return 'True' if report: printout (' .. built problem, finding proof') if not check_loops and p.loop_data: printout ('Problem has loop!') tracer[0] = prev_tracer return 'Loop' if check_loops == 'only' and not p.loop_data: printout ('No loop in problem.') tracer[0] = prev_tracer return 'NoLoop' proof = search.build_proof (p) if report: printout (' .. proof found.') try: if report: result = check.check_proof_report (p, proof) else: result = check.check_proof (p, proof) if result: printout ('Refinement proven.') else: printout ('Refinement NOT proven.') except solver.SolverFailure, e: printout ('Solver timeout/failure in proof check.') result = 'CheckSolverFailure' except Exception, e: trace ('EXCEPTION in checking %s:' % p.name) exception = sys.exc_info () result = 'CheckEXCEPT'
def test_interesting_linear_series_exprs(): pairs = set([pair for f in pairings for pair in pairings[f]]) notes = {} for pair in pairs: p = check.build_problem(pair) for n in search.init_loops_to_split(p, ()): intr = logic.interesting_linear_series_exprs(p, n, search.get_loop_var_analysis_at(p, n)) if intr: notes[pair.name] = True if "Call" in str(intr): notes[pair.name] = "Call!" return notes
def test_interesting_linear_series_exprs(): pairs = set([pair for f in pairings for pair in pairings[f]]) notes = {} for pair in pairs: p = check.build_problem(pair) for n in search.init_loops_to_split(p, ()): intr = logic.interesting_linear_series_exprs( p, n, search.get_loop_var_analysis_at(p, n)) if intr: notes[pair.name] = True if 'Call' in str(intr): notes[pair.name] = 'Call!' return notes
def toplevel_check (pair, check_loops = True, report = False, count = None): printout ('Testing Function pair %s' % pair) if count: (i, n) = count printout (' (function pairing %d of %d)' % (i + 1, n)) for (tag, fname) in pair.funs.iteritems (): if not functions[fname].entry: printout ('Skipping %s, underspecified %s' % (pair, tag)) return 'None' prev_tracer = tracer[0] if report: tracer[0] = lambda s, n: () exception = None trace (time.asctime ()) start_time = time.time() sys.stdout.flush () try: p = check.build_problem (pair) if report: printout (' .. built problem, finding proof') if not check_loops and p.loop_data: printout ('Problem has loop!') tracer[0] = prev_tracer return 'Loop' if check_loops == 'only' and not p.loop_data: printout ('No loop in problem.') tracer[0] = prev_tracer return 'NoLoop' proof = search.build_proof (p) if report: printout (' .. proof found.') try: if report: result = check.check_proof_report (p, proof) else: result = check.check_proof (p, proof) if result: printout ('Refinement proven.') else: printout ('Refinement NOT proven.') except solver.SolverFailure, e: printout ('Solver timeout/failure in proof check.') result = 'CheckSolverFailure' except Exception, e: trace ('EXCEPTION in checking %s:' % p.name) exception = sys.exc_info () result = 'CheckEXCEPT'
def all_problems (proofs, filt = None): problems = [] for (pair, proof) in proofs.iteritems (): if filt != None: if not [pn for pn in proof.all_subproofs () if filt (pn)]: continue p = check.build_problem (pair) probs = proof.all_subproblems (p, (), check.init_point_hyps (p), 'problem') problems.extend ([(p, pn, restrs, hyps) for (pn, restrs, hyps) in probs if filt == None or filt (pn)]) return problems
def problem_search (s): pair = name_search (s) print pair.name return check.build_problem (pair)