def generate_counter_example(fsm, problem, solver, k, descr="BMC counter example"): """ Generates a counter example for `problem` evaluated against `fsm` as identified by `solver` (problem has a length `k`) but prints nothing. .. note:: If you are looking for something more advanced, you might want to look at :func:`pynusmv.be.encoder.BeEnc.decode_sat_model` which does the same thing but is more complete. :param fsm: the FSM against which problem was evaluated :param problem: the SAT problem used to identify a counter example :param solver: the SAT solver that identified a counter example :param k: the length of the generated problem (length in terms of state) :param descr: a description of what the generated counter example is about :raises ValueError: whenever the problem or the solver is None or when the problem bound `k` is negative. """ if problem is None: raise ValueError("a problem must be given") if solver is None: raise ValueError("a solver must be given") if k < 0: raise ValueError("the problem bound `k` must be non negative") ptr = _bmc.Bmc_Utils_generate_cntexample( fsm.encoding._ptr, solver._as_SatSolver_ptr(), problem._ptr, k, descr, glob.master_bool_sexp_fsm().symbols_list._ptr) return Trace(ptr)