17 #ifndef AWALI_ALGOS_OUTSPLIT_HH
18 # define AWALI_ALGOS_OUTSPLIT_HH
20 # include <unordered_set>
28 namespace awali {
namespace sttc {
33 template <
typename Aut>
36 using automaton_t = Aut;
41 template <
typename Pred>
44 std::unordered_set<state_t> add_states;
45 for (
auto st : aut->states())
47 if(add_states.find(st)!=add_states.end())
49 bool true_out =
false;
51 std::vector<transition_t> false_transitions;
52 for (
auto tr : aut->all_out(st))
57 false_transitions.emplace_back(tr);
59 if(true_out && !false_transitions.empty()) {
61 aut->set_state_name(ns, aut->get_state_name(st)+
"'");
62 add_states.emplace(ns);
63 for(
auto tr : false_transitions) {
64 aut->set_transition(ns, aut->dst_of(tr),
65 aut->label_of(tr), aut->weight_of(tr));
66 aut->del_transition(tr);
68 for(
auto tr : aut->all_in(st)) {
69 aut->set_transition(aut->src_of(tr),ns,
70 aut->label_of(tr), aut->weight_of(tr));
79 template <
typename... T,
size_t I>
85 return std::tuple_element<I,std::tuple<T...>>::type::has_one();
88 template<
typename LS,
typename Tuple>
90 bool get(LS ts, Tuple tu) {
91 return std::get<I>(ts->sets()).is_one(std::get<I>(tu));
97 template<
size_t I,
typename Aut>
98 typename std::enable_if<internal::select_one<labelset_t_of<Aut>,I>::has_one(),
void>::type
102 auto ls=aut->context().labelset();
108 template<
size_t I,
typename Aut>
109 typename std::enable_if<!internal::select_one<labelset_t_of<Aut>,I>::has_one(),
void>::type
113 template <
size_t I,
typename Aut>
118 auto a =
copy(aut, keep_history);
Definition: outsplit.hh:35
void operator()(Aut &aut, const Pred &pred)
Definition: outsplit.hh:42
A ValueSet which is a Cartesian product of ValueSets.
Definition: tupleset.hh:80
Definition: outsplit.hh:78
typename internal::label_t_of_impl< internal::base_t< ValueSet > >::type label_t_of
Helper to retrieve the type of the labels of a value set.
Definition: traits.hh:71
AutOut copy(const AutIn &input, Pred keep_state, bool keep_history=true, bool transpose=false)
A copy of input keeping only its states that are accepted by keep_state.
Definition: copy.hh:189
std::enable_if< internal::select_one< labelset_t_of< Aut >, I >::has_one(), void >::type outsplit_here(Aut &aut)
Definition: outsplit.hh:99
rat::ratexp_polynomial_t< RatExpSet > split(const RatExpSet &rs, const typename RatExpSet::ratexp_t &e)
Split a ratexp.
Definition: split.hh:243
Aut outsplit(const Aut &aut, bool keep_history=true)
Definition: outsplit.hh:116
Main namespace of Awali.
Definition: ato.hh:22
unsigned state_t
Definition: types.hh:21
unsigned transition_t
Definition: types.hh:22
static bool get(LS ts, Tuple tu)
Definition: outsplit.hh:90
static constexpr bool has_one()
Definition: outsplit.hh:84