Пример #1
0
def satmain2(formula, opts):
    ltlmp_root = parse_input(formula)

    # or-list of and-pair of (ltl, [mp, ..])
    # [(ltl, [mp]), (ltl, [mp]), ...]
    ltl_mp_pair_list = tltl.get_mpnf_list(ltlmp_root)

    # FUTURE: improve LTL tree
    sat_content = SatContent(ltl_mp_pair_list, opts)
    sat_content.strat_all_through_old()
    sat_content.print_result()
Пример #2
0
def satmain(formula, opts):
    total_result = {'sat': False, 'time': [], 'graphs': [], 'total_wg_time': 0.0 }

    ltlmp_root = parse_input(formula)
    if opts.showprogress: show_progress1(ltlmp_root)

    # or-list of and-pair (ltl, mp)
    ltl_mp_pair_list = tltl.get_mpnf_list(ltlmp_root)
    if opts.debug: debug1(ltl_mp_pair_list)

    # FUTURE: improve LTL tree

    mpnf_list = []
    make_graph(ltl_mp_pair_list, mpnf_list, opts)


    if opts.showprogress: print '---- Weighted Graph generating ----'

    wg_st = time.time()
    for mpnf in mpnf_list:
        convert_mpnf(mpnf)
    wg_en = time.time()
    total_result['total_wg_time'] = wg_en - wg_st

    show_progress2(mpnf_list)
    if opts.showprogress: print '---- SMT input generating ----'

    # for SCC which includes 'accept' state'
    #     do SAT
    # convert Weighted Graph to SMT-Solver Sentence
    for mpnf in mpnf_list:
        mpnf['Code/SCC'] = get_SMTCode(mpnf['mdg'], mpnf['mp-prop-pair'], opts)

    if opts.showprogress: print '---- solving SAT ----'
    show_progress3(mpnf_list)

    sat = 1
    for mpnf in mpnf_list:
        # SAT for Each MPNF
        for scc_acc in mpnf['Code/SCC']['AccSCCs']:
            # SAT for each SCC
            st = time.time()
            smt_result = execute_smt_solver(scc_acc['SMTCode'], opts)
            en = time.time()
            scc_acc['sat_time'] = en - st
            if smt_result['sat']:
                print "   SCC-SAT found"
                total_result['sat'] = True
                return process_result(mpnf_list, total_result)
            else:
                print '      SCC-partial UNSAT'
                sat = 0
        print '    SCC-total-UNSAT'
    if sat == 0:
        print '  Totally UNSAT'
        total_result['sat'] = False
        return process_result(mpnf_list, total_result)
        # do SAT-checking for Each SCC
    else:
        print 'ERROR?:  passed all SCC, maybe no BA/TGBA acceptable SCCs, or no SMT code'
        total_result['sat'] = False
        return process_result(mpnf_list, total_result)