def decode_load_trace_file(erlport, erlz3, cmd): r = cIO.JsonReader(cmd["f"], cmd["e"]) for tp, tag, x, rev in r: if cglb.__TTY__: print x if cc.is_interpretable(tp): erlz3.command_toZ3(tp, x, rev)
def decode_load_trace_file(erlport, erlSolver, cmd): """ Loads a trace file. """ r = cIO.JsonReader(cmd.filename, cmd.to_constraint) for entry, rev in r: if cc.is_interpretable(entry): erlSolver.command_toSolver(entry, rev)
def solve(fname, n, printConstraints, withSmt, withPrint): # Do the initializations. cglb.init() erlSolver = cz3.ErlangZ3() if not withSmt else cSMT.ErlangSMT() # Load the trace. r = cIO.JsonReader(fname, n) for entry, rev in r: if printConstraints: cpt.print_cmd(entry, rev) if cc.is_interpretable(entry): erlSolver.command_toSolver(entry, rev) # Load the axioms to the solver. erlSolver.add_axioms() # Solve the model. if withPrint: print "Solving the model ...", slv = erlSolver.solve() if withPrint: print slv if cc.is_sat(slv): m = erlSolver.model if withPrint: print m return (slv, str(m)) return slv
def solve(fname, n, printConstraints, withPrint): # Do the initializations. cglb.init() erlz3 = cz3.ErlangZ3() # Load the trace. r = cIO.JsonReader(fname, n) for tp, tag, x, rev in r: if printConstraints: cpt.print_cmd(tp, tag, x, rev) if cc.is_interpretable(tp): erlz3.command_toZ3(tp, x, rev) # Load the axioms to the solver. erlz3.add_axioms() # Solve the model. if withPrint: print "Solving the model ...", slv = erlz3.solve() if withPrint: print slv if slv == "sat": m = erlz3.model if withPrint: print m ps = erlz3.encode_parameters() return (slv, str(m))
def solve(fname, n, printConstraints, withPrint): # Do the initializations. cglb.init() erlSolver = cSMT.ErlangSMT(1) # Load the trace. r = cIO.JsonReader(fname, n) for entry, rev in r: if printConstraints: cpt.print_cmd(entry, rev) if cc.is_interpretable(entry): erlSolver.command_toSolver(entry, rev) # Load the axioms to the solver. erlSolver.add_axioms() # Solve the model. if withPrint: print("Solving the model ...", ) slv = erlSolver.solve() if withPrint: print(slv) if cc.is_sat(slv): m = erlSolver.encode_model() if withPrint: print(m) values = [e.value.value for e in m.model.entries] return (slv, values) return slv
def decode_load_trace_file(erlport, erlz3, cmd): r = cIO.JsonReader(cmd["f"], cmd["e"]) for tp, tag, x, rev in r: if cc.is_interpretable(tp): erlz3.command_toZ3(tp, x, rev)