30 bool has_one = labelset_t_of<Aut>::has_one()>
33 detail::proper_context<context_t_of<Aut>>>>
51 static auto res =
symbol{
"lazy_proper_automaton<" 59 o <<
"lazy_proper_automaton<";
60 this->
aut_->print_set(o, fmt);
67 lazy_proper_automaton_impl(const in_automaton_t& a, bool prune = true) 68 : super_t(make_proper_context(a->context())) 69 , remover_(transpose(a), prune) 71 this->aut_ = transpose(remover_.get_proper()); 72 proper_states_.emplace(this->post()); // post is already proper 73 known_states_.emplace(this->pre()); // pre is always there 74 known_states_.emplace(this->post()); // post is always there 78 bool state_has_spontaneous_out(state_t s) const 80 // We work on the transpose automaton, in and out are reversed 81 return remover_.state_has_spontaneous_in(s); 90 void complete_(state_t s) const 92 auto& self = const_cast<self_t&>(*this); 94 bool has_removed = true; 97 auto ts = vcsn::detail::all_out(this->aut_, s); 98 auto todo = std::vector<state_t>(ts.size()); 99 std::transform(begin(ts), end(ts), begin(todo), 100 [this](auto t){ return this->aut_->dst_of(t); }); 102 for (auto succ : todo) 103 if (state_has_spontaneous_out(succ)) 105 self.remover_.remover_on(succ); 110 for (auto t : vcsn::detail::all_out(this->aut_, s)) 111 self.known_states_.emplace(this->aut_->dst_of(t)); 112 self.proper_states_.emplace(s); 116 auto all_out(state_t s) const 117 -> decltype(vcsn::detail::all_out(this->aut_, s)) 121 return vcsn::detail::all_out(this->aut_, s); 124 bool is_lazy(state_t s) const 126 return !has(proper_states_, s); 131 auto all_states() const 133 return all_states([](state_t){ return true; }); 138 template <typename Pred> 139 auto all_states(Pred pred) const 141 return this->aut_->all_states( 142 [this, pred](state_t s) 144 return pred(s) && has(known_states_, s); 155 return s != this->aut_->pre() && s != this->aut_->post(); 160 epsilon_remover_separate<transpose_in_automaton_t> remover_; 163 std::unordered_set<state_t> proper_states_; 167 std::unordered_set<state_t> known_states_; 172 template <Automaton Aut> 173 class lazy_proper_automaton_impl<Aut, false> 174 : public automaton_decorator<Aut> 177 using automaton_t = Aut; 178 using super_t = automaton_decorator<automaton_t>; 179 using state_t = state_t_of<automaton_t>; 181 static symbol sname() 183 static auto res = symbol{"lazy_proper_automaton<" 184 + automaton_t::element_type::sname() 189 std::ostream& print_set(std::ostream& o, format fmt) const 191 o << "lazy_proper_automaton<"; 192 this->aut_->print_set(o, fmt); 196 lazy_proper_automaton_impl(const automaton_t& a, bool) 202 template <Automaton Aut> 203 using lazy_proper_automaton 204 = std::shared_ptr<detail::lazy_proper_automaton_impl<Aut>>; transpose_automaton< in_automaton_t > transpose_in_automaton_t
typename detail::transition_t_of_impl< base_t< ValueSet > >::type transition_t_of
typename detail::state_t_of_impl< base_t< ValueSet > >::type state_t_of
state_t_of< automaton_t > state_t
lazy_proper_automaton_impl(const in_automaton_t &a, bool prune=true)
We cannot initialize super_t with the input automaton, we have to call remover_() first with the tran...
boost::flyweight< std::string, boost::flyweights::no_tracking, boost::flyweights::intermodule_holder > symbol
An internalized string.
automaton_t aut_
The wrapped automaton, possibly const.
transition_t_of< automaton_t > transition_t
typename detail::context_t_of_impl< base_t< ValueSet > >::type context_t_of
An input/output format for valuesets.
std::ostream & print_set(std::ostream &o, format fmt) const
fresh_automaton_t_of< Aut, context_t > automaton_t
std::shared_ptr< detail::transpose_automaton_impl< Aut > > transpose_automaton
An automaton wrapper that presents the transposed automaton.
Build a "lazy proper" automaton from the input with nullable labels.
Aggregate an automaton, and forward calls to it.
context_t_of< in_automaton_t > in_context_t
typename Aut::element_type::template fresh_automaton_t< Context > fresh_automaton_t_of
Given an automaton type, the type of its copies.