17 #ifndef AWALI_ALGOS_UNIVERSAL_HH
18 # define AWALI_ALGOS_UNIVERSAL_HH
27 namespace awali {
namespace sttc {
32 template <
typename Aut>
37 "requires free labelset");
39 "requires Boolean weights");
44 using map_t = std::map<state_t, state_set_t>;
54 return work_(automaton);
64 state_t i = aut->dst_of(aut->initial_transitions().front());
70 auto h=codet->history();
82 automaton_t res = make_shared_ptr<automaton_t>(aut->context());
85 std::set<state_t> automaton_finals;
86 for (
auto t: aut->final_transitions())
87 automaton_finals.insert(aut->src_of(t));
93 for (
const auto s: univers_states)
96 state_t new_s = res->add_state();
97 subset_label[new_s] = s;
100 res->set_initial(new_s);
102 if (
subset(s, automaton_finals))
103 res->set_final(new_s);
107 for (
const auto x: res->states())
108 for (
const auto y: res->states())
109 for (
const auto a: *res->labelset())
113 for (
auto s: subset_label[x])
116 for (
auto t: aut->out(s, a))
119 delta_ret.insert(aut->dst_of(t));
131 if (
subset(delta_ret, subset_label[y]))
132 res->new_transition(x, y, a);
The Boolean semring.
Definition: b.hh:38
Functor for universal.
Definition: universal.hh:34
Aut automaton_t
Definition: universal.hh:41
std::map< state_t, state_set_t > map_t
Definition: universal.hh:44
std::set< state_set_t > pstate_t
Definition: universal.hh:43
std::set< state_t > state_set_t
Definition: universal.hh:42
automaton_t operator()(const Aut &automaton)
The universal automaton of automaton.
Definition: universal.hh:47
specialisation of history_base
Definition: partition_history.hh:43
json_ast_t empty()
Builds an empty json_ast_t.
Definition: json_ast.hh:33
static constexpr TOP< void > value
Definition: priority.hh:93
bool subset(const Container1 &set1, const Container2 &set2) ATTRIBUTE_PURE
Whether set1 ⊆ set2.
Definition: set.hxx:105
bool has(const std::map< Key, Value, Compare, Alloc > &s, const Key &e)
Definition: map.hh:53
std::set< typename std::map< Key, Value, Comp, Alloc >::mapped_type > image(const std::map< Key, Value, Comp, Alloc > &m)
The set of values of a map.
Definition: set.hxx:33
bool is_deterministic(const Aut &aut, state_t s)
Whether state s is deterministic in aut.
Definition: is_deterministic.hxx:48
std::set< std::set< T, Compare, Alloc > > intersection_closure(std::set< std::set< T, Compare, Alloc >> pset)
The set of all the intersections of the sets in pset.
auto complete(const Aut &aut, bool keep_history=true) -> decltype(copy(aut, keep_history))
Completion of a deterministic automaton.
Definition: complete.hh:90
bool is_complete(const Aut &aut)
Whether aut is complete.
Definition: is_complete.hh:28
Aut universal(const Aut &a)
Definition: universal.hh:142
typename internal::labelset_t_of_impl< internal::base_t< ValueSet > >::type labelset_t_of
Helper to retrieve the type of the labelset of a value set.
Definition: traits.hh:76
auto determinize(const Aut &a, bool keep_history=true) -> mutable_automaton< context_t_of< Aut >>
Determinization of the automaton.
Definition: determinize.hh:41
AutOut transpose(Aut &aut, bool keep_history=true)
Definition: transpose.hh:79
typename internal::weightset_t_of_impl< internal::base_t< ValueSet > >::type weightset_t_of
Helper to retrieve the type of the weightset of a value set.
Definition: traits.hh:86
Main namespace of Awali.
Definition: ato.hh:22
unsigned state_t
Definition: types.hh:21