Exemple #1
0
def write_smtlib(formula, fname):
    """Writes the given formula in Smt-Lib format to the given file.

    :param formula: Specify the SMT formula to be written
    :param fname: Specify the filename
    """
    with open(fname, "w") as fout:
        script = pysmt.smtlib.script.smtlibscript_from_formula(formula)
        script.serialize(fout)
Exemple #2
0
def write_smtlib(formula, fname):
    """Reads the SMT formula from the given file.

    :param formula: Specify the SMT formula to look for
    :param fname: Specify the filename
    """
    with open(fname, "w") as fout:
        script = pysmt.smtlib.script.smtlibscript_from_formula(formula)
        script.serialize(fout)
Exemple #3
0
def write_smtlib(formula, fname):
    """Writes the given formula in Smt-Lib format to the given file.

    :param formula: Specify the SMT formula to be written
    :param fname: Specify the filename
    """
    with open(fname, "w") as fout:
        script = pysmt.smtlib.script.smtlibscript_from_formula(formula)
        script.serialize(fout)
Exemple #4
0
def write_smtlib(formula, fname):
    """Reads the SMT formula from the given file.

    :param formula: Specify the SMT formula to look for
    :param fname: Specify the filename
    """
    with open(fname, "w") as fout:
        script = pysmt.smtlib.script.smtlibscript_from_formula(formula)
        script.serialize(fout)
Exemple #5
0
    real = []
    int = []
    for cmd in script:
        if cmd.name == 'declare-fun':
            if FNode.get_type(cmd.args[0]) == INT:
                int.append(cmd.args[0])
            if FNode.get_type(cmd.args[0]) == REAL:
                real.append(cmd.args[0])
    return int, real


if __name__ == "__main__":
    f = VariableInfusion([])
    parser = SmtLibParser()
    script = parser.get_script(cStringIO(DEMO_SMTLIB))
    buf_out = cStringIO()
    script.serialize(buf_out, daggify=False)

    variable_inversion(
        script, {
            Symbol('p', INT): Times(Symbol('y', INT), Symbol('q', INT)),
            Symbol('q', INT): Div(Symbol('p', INT), Symbol('y', INT))
        })

    # print(get_all_number_symbols(script, [REAL, INT]))
    # print(get_all_symbols(script))

    # print(get_all_symbols(script))
    script.serialize(buf_out, daggify=False)
    print(buf_out.getvalue())
Exemple #6
0
def write_smtlib(formula, fname):
    """Reads the SMT formula from the given file."""
    with open(fname, "w") as fout:
        script = pysmt.smtlib.script.smtlibscript_from_formula(formula)
        script.serialize(fout)