17 #ifndef AWALI_ALGOS_WITNESS_HH
18 # define AWALI_ALGOS_WITNESS_HH
26 namespace awali {
namespace sttc {
61 template <
typename Context>
62 mutable_automaton<Context>
65 using context_t = Context;
67 require(2 <=
n,
"u: n must be at least 3");
68 const auto& gens = ctx.labelset()->genset();
69 std::vector<typename context_t::labelset_t::letter_t> letters
70 {std::begin(gens), std::end(gens)};
71 require(3 <= letters.size(),
"u: the alphabet needs at least 3 letters");
72 automaton_t res = make_shared_ptr<automaton_t>(ctx);
75 std::vector<state_t>
states;
76 for (
unsigned i = 0; i <
n; ++i)
77 states.push_back(res->add_state());
78 res->set_initial(
states[0]);
83 for (
unsigned i = 0; i <
n; ++i)
90 for (
unsigned i = 2; i <
n; ++i)
95 for (
unsigned i = 0; i <
n - 1; ++i)
The Boolean semring.
Definition: b.hh:38
The semiring of complex numbers.
Definition: c.hh:44
The semiring of Natural numbers.
Definition: n.hh:34
std::vector< state_t > states(abstract_automaton_t const *aut, bool all)
mutable_automaton< Context > witness(const Context &ctx, unsigned n)
Returns an automaton with n states.
Definition: witness.hh:63
std::shared_ptr< internal::mutable_automaton_impl< Context > > mutable_automaton
Definition: mutable_automaton.hh:45
void require(bool b, Args &&... args)
If b is not verified, raise an error with args as message.
Definition: raise.hh:55
Main namespace of Awali.
Definition: ato.hh:22