Vcsn
2.2
Be Rational
|
Compute the derived-term automaton from an expression. More...
#include <derived-term.hh>
Public Types | |
using | expressionset_t = ExpSet |
using | expression_t = typename expressionset_t::value_t |
Our state names: expressions. More... | |
using | context_t = context_t_of< expressionset_t > |
using | weightset_t = weightset_t_of< context_t > |
using | automaton_t = expression_automaton< mutable_automaton< context_t >> |
The type of the (strict) automaton we build. More... | |
using | state_t = state_t_of< automaton_t > |
using | self_t = derived_term_automaton_impl |
This class. More... | |
using | super_t = automaton_decorator< automaton_t > |
Base class. More... | |
using | polynomialset_t = rat::expression_polynomialset_t< expressionset_t > |
The polynomialset for expressions. More... | |
using | expansionset_t = rat::expansionset< expressionset_t > |
Might be needed to determinize. More... | |
using | to_expansion_t = rat::to_expansion_visitor< expressionset_t > |
Used for expansions. More... | |
Public Types inherited from vcsn::detail::automaton_decorator< expression_automaton< mutable_automaton< context_t_of< ExpSet > > > > | |
using | automaton_t = Aut |
The type of automaton to wrap. More... | |
using | context_t = context_t_of< Aut > |
using | element_type = typename automaton_t::element_type |
The automaton type, without shared_ptr. More... | |
using | fresh_automaton_t = typename element_type::template fresh_automaton_t< Ctx > |
The (shared pointer) type to use it we have to create an automaton of the same (underlying) type. More... | |
using | kind_t = typename context_t::kind_t |
using | labelset_t = typename context_t::labelset_t |
using | labelset_ptr = typename context_t::labelset_ptr |
using | label_t = typename labelset_t::value_t |
using | weightset_t = typename context_t::weightset_t |
using | weightset_ptr = typename context_t::weightset_ptr |
using | weight_t = typename weightset_t::value_t |
using | state_t = state_t_of< automaton_t > |
using | transition_t = transition_t_of< automaton_t > |
Public Member Functions | |
std::ostream & | print_set (std::ostream &o, format fmt={}) const |
derived_term_automaton_impl (const expressionset_t &rs, derived_term_algo algo) | |
automaton_t | operator() (const expression_t &expression) |
Compute the derived-term automaton. More... | |
automaton_t | via_derivation (const expression_t &expression) |
Compute the derived-term automaton via derivation. More... | |
automaton_t | via_expansion (const expression_t &expression) |
Compute the derived-term automaton via expansion. More... | |
void | init_ (const expression_t &expression) |
Initialize the computation: build the initial states. More... | |
void | complete_ (state_t s) const |
Complete a state: find its outgoing transitions. More... | |
auto | all_out (state_t s) const -> decltype(vcsn::detail::all_out(aut_, s)) |
All the outgoing transitions. More... | |
template<typename ES = expressionset_t, typename = std::enable_if<labelset_t_of<ES>::is_free()>> | |
void | complete_via_derivation_ (state_t s, const expression_t &src) |
Compute the outgoing transitions of src. More... | |
void | complete_via_expansion_ (state_t s, const expression_t &src) |
Compute the outgoing transitions of src. More... | |
Public Member Functions inherited from vcsn::detail::automaton_decorator< expression_automaton< mutable_automaton< context_t_of< ExpSet > > > > | |
automaton_decorator (automaton_t aut) | |
automaton_decorator (const automaton_decorator &aut) | |
automaton_decorator (const context_t &ctx) | |
automaton_decorator (automaton_decorator &&aut) | |
automaton_decorator & | operator= (automaton_decorator &&that) |
automaton_t | strip () |
The automaton we decorate. More... | |
auto | all_in (Args &&...args) const -> decltype(aut_-> all_in(std::forward< Args >(args)...)) |
auto | all_out (Args &&...args) const -> decltype(aut_-> all_out(std::forward< Args >(args)...)) |
auto | all_states (Args &&...args) const -> decltype(aut_-> all_states(std::forward< Args >(args)...)) |
auto | all_transitions (Args &&...args) const -> decltype(aut_-> all_transitions(std::forward< Args >(args)...)) |
auto | context (Args &&...args) const -> decltype(aut_-> context(std::forward< Args >(args)...)) |
auto | dst_of (Args &&...args) const -> decltype(aut_-> dst_of(std::forward< Args >(args)...)) |
auto | get_final_weight (Args &&...args) const -> decltype(aut_-> get_ final _weight(std |
auto | get_initial_weight (Args &&...args) const -> decltype(aut_-> get_initial_weight(std::forward< Args >(args)...)) |
auto | get_transition (Args &&...args) const -> decltype(aut_-> get_transition(std::forward< Args >(args)...)) |
auto | has_state (Args &&...args) const -> decltype(aut_-> has_state(std::forward< Args >(args)...)) |
auto | has_transition (Args &&...args) const -> decltype(aut_-> has_transition(std::forward< Args >(args)...)) |
auto | is_final (Args &&...args) const -> decltype(aut_-> is_ final(std |
auto | is_initial (Args &&...args) const -> decltype(aut_-> is_initial(std::forward< Args >(args)...)) |
auto | label_of (Args &&...args) const -> decltype(aut_-> label_of(std::forward< Args >(args)...)) |
auto | labelset (Args &&...args) const -> decltype(aut_-> labelset(std::forward< Args >(args)...)) |
auto | num_all_states (Args &&...args) const -> decltype(aut_-> num_all_states(std::forward< Args >(args)...)) |
auto | num_finals (Args &&...args) const -> decltype(aut_-> num_ final s(std |
auto | num_initials (Args &&...args) const -> decltype(aut_-> num_initials(std::forward< Args >(args)...)) |
auto | num_states (Args &&...args) const -> decltype(aut_-> num_states(std::forward< Args >(args)...)) |
auto | num_transitions (Args &&...args) const -> decltype(aut_-> num_transitions(std::forward< Args >(args)...)) |
auto | prepost_label (Args &&...args) const -> decltype(aut_-> prepost_label(std::forward< Args >(args)...)) |
auto | print (Args &&...args) const -> decltype(aut_-> print(std::forward< Args >(args)...)) |
auto | print_set (Args &&...args) const -> decltype(aut_-> print_set(std::forward< Args >(args)...)) |
auto | print_state (Args &&...args) const -> decltype(aut_-> print_state(std::forward< Args >(args)...)) |
auto | print_state_name (Args &&...args) const -> decltype(aut_-> print_state_name(std::forward< Args >(args)...)) |
auto | src_of (Args &&...args) const -> decltype(aut_-> src_of(std::forward< Args >(args)...)) |
auto | state_has_name (Args &&...args) const -> decltype(aut_-> state_has_name(std::forward< Args >(args)...)) |
auto | is_lazy (Args &&...args) const -> decltype(aut_-> is_lazy(std::forward< Args >(args)...)) |
auto | is_lazy_in (Args &&...args) const -> decltype(aut_-> is_lazy_in(std::forward< Args >(args)...)) |
auto | states (Args &&...args) const -> decltype(aut_-> states(std::forward< Args >(args)...)) |
auto | weight_of (Args &&...args) const -> decltype(aut_-> weight_of(std::forward< Args >(args)...)) |
auto | weightset (Args &&...args) const -> decltype(aut_-> weightset(std::forward< Args >(args)...)) |
auto | add_final (Args &&...args) -> decltype(aut_-> add_ final(std |
auto | add_initial (Args &&...args) -> decltype(aut_-> add_initial(std::forward< Args >(args)...)) |
auto | add_transition (Args &&...args) -> decltype(aut_-> add_transition(std::forward< Args >(args)...)) |
auto | add_transition_copy (Args &&...args) -> decltype(aut_-> add_transition_copy(std::forward< Args >(args)...)) |
auto | add_weight (Args &&...args) -> decltype(aut_-> add_weight(std::forward< Args >(args)...)) |
auto | del_state (Args &&...args) -> decltype(aut_-> del_state(std::forward< Args >(args)...)) |
auto | del_transition (Args &&...args) -> decltype(aut_-> del_transition(std::forward< Args >(args)...)) |
auto | lmul_weight (Args &&...args) -> decltype(aut_-> lmul_weight(std::forward< Args >(args)...)) |
auto | new_state (Args &&...args) -> decltype(aut_-> new_state(std::forward< Args >(args)...)) |
auto | new_transition (Args &&...args) -> decltype(aut_-> new_transition(std::forward< Args >(args)...)) |
auto | new_transition_copy (Args &&...args) -> decltype(aut_-> new_transition_copy(std::forward< Args >(args)...)) |
auto | rmul_weight (Args &&...args) -> decltype(aut_-> rmul_weight(std::forward< Args >(args)...)) |
auto | set_final (Args &&...args) -> decltype(aut_-> set_ final(std |
auto | set_lazy (Args &&...args) -> decltype(aut_-> set_lazy(std::forward< Args >(args)...)) |
auto | set_lazy_in (Args &&...args) -> decltype(aut_-> set_lazy_in(std::forward< Args >(args)...)) |
auto | set_initial (Args &&...args) -> decltype(aut_-> set_initial(std::forward< Args >(args)...)) |
auto | set_transition (Args &&...args) -> decltype(aut_-> set_transition(std::forward< Args >(args)...)) |
auto | set_weight (Args &&...args) -> decltype(aut_-> set_weight(std::forward< Args >(args)...)) |
auto | unset_final (Args &&...args) -> decltype(aut_-> unset_ final(std |
auto | unset_initial (Args &&...args) -> decltype(aut_-> unset_initial(std::forward< Args >(args)...)) |
Static Public Member Functions | |
static symbol | sname () |
Static Public Member Functions inherited from vcsn::detail::automaton_decorator< expression_automaton< mutable_automaton< context_t_of< ExpSet > > > > | |
static constexpr auto | lazy_transition (Args &&...args) -> decltype(element_type::lazy_transition(std::forward< Args >(args)...)) |
static constexpr auto | null_state (Args &&...args) -> decltype(element_type::null_state(std::forward< Args >(args)...)) |
static constexpr auto | null_transition (Args &&...args) -> decltype(element_type::null_transition(std::forward< Args >(args)...)) |
static constexpr auto | post (Args &&...args) -> decltype(element_type::post(std::forward< Args >(args)...)) |
static constexpr auto | pre (Args &&...args) -> decltype(element_type::pre(std::forward< Args >(args)...)) |
static constexpr auto | sname (Args &&...args) -> decltype(element_type::sname(std::forward< Args >(args)...)) |
Public Attributes | |
expressionset_t | rs_ |
The expression's set. More... | |
weightset_t | ws_ = *rs_.weightset() |
Its weightset. More... | |
polynomialset_t | ps_ = make_expression_polynomialset(rs_) |
derived_term_algo | algo_ |
How derived terms are computed. More... | |
expansionset_t | es_ = {rs_} |
to_expansion_t | to_expansion_ = {rs_} |
derived_term_automaton_members< expressionset_t > | members_ = {rs_} |
Possibly the generators. More... | |
Additional Inherited Members | |
Protected Attributes inherited from vcsn::detail::automaton_decorator< expression_automaton< mutable_automaton< context_t_of< ExpSet > > > > | |
automaton_t | aut_ |
The wrapped automaton, possibly const. More... | |
Compute the derived-term automaton from an expression.
Supports derivation/expansion as its core computation, with breaking/non breaking flavors for both.
The handling of initial and final states can be simplified by working on a delimited rational expression ($r$
with $
being the special label), and mapping $r$
to pre()
, and \e
to post()
. Then, there is no special treatment needed to handle the initial split in the case of a breaking derivation, and there is no special need to handle the final transitions.
However there are two problems.
One is that derivation loops over the alphabets, so we have to add $, the special label, to the alphabet. But then, the handling of complement starts making idiotic things by trying to add $-labels in inner transitions. This is a real problem, with no clear work-around.
But this is not an issue for expansion-based construction. However it means that the states are no longer labeled by the expressions as the user would expect them: there is always the terminating $. Not showing it does not address the issue, which is why we'd rather not have it at all.
So, after experimentation, as of 2014-10, I prefer not to use the pre/post based construct in either case.
Definition at line 129 of file derived-term.hh.
using vcsn::detail::derived_term_automaton_impl< ExpSet >::automaton_t = expression_automaton<mutable_automaton<context_t>> |
The type of the (strict) automaton we build.
Definition at line 141 of file derived-term.hh.
using vcsn::detail::derived_term_automaton_impl< ExpSet >::context_t = context_t_of<expressionset_t> |
Definition at line 137 of file derived-term.hh.
using vcsn::detail::derived_term_automaton_impl< ExpSet >::expansionset_t = rat::expansionset<expressionset_t> |
Might be needed to determinize.
Definition at line 294 of file derived-term.hh.
using vcsn::detail::derived_term_automaton_impl< ExpSet >::expression_t = typename expressionset_t::value_t |
Our state names: expressions.
Definition at line 135 of file derived-term.hh.
using vcsn::detail::derived_term_automaton_impl< ExpSet >::expressionset_t = ExpSet |
Definition at line 133 of file derived-term.hh.
using vcsn::detail::derived_term_automaton_impl< ExpSet >::polynomialset_t = rat::expression_polynomialset_t<expressionset_t> |
The polynomialset for expressions.
Definition at line 288 of file derived-term.hh.
using vcsn::detail::derived_term_automaton_impl< ExpSet >::self_t = derived_term_automaton_impl |
This class.
Definition at line 145 of file derived-term.hh.
using vcsn::detail::derived_term_automaton_impl< ExpSet >::state_t = state_t_of<automaton_t> |
Definition at line 142 of file derived-term.hh.
using vcsn::detail::derived_term_automaton_impl< ExpSet >::super_t = automaton_decorator<automaton_t> |
Base class.
Definition at line 147 of file derived-term.hh.
using vcsn::detail::derived_term_automaton_impl< ExpSet >::to_expansion_t = rat::to_expansion_visitor<expressionset_t> |
Used for expansions.
Definition at line 297 of file derived-term.hh.
using vcsn::detail::derived_term_automaton_impl< ExpSet >::weightset_t = weightset_t_of<context_t> |
Definition at line 138 of file derived-term.hh.
|
inline |
|
inline |
All the outgoing transitions.
Definition at line 229 of file derived-term.hh.
References vcsn::detail::all_out(), vcsn::detail::automaton_decorator< expression_automaton< mutable_automaton< context_t_of< ExpSet > > > >::aut_, vcsn::detail::derived_term_automaton_impl< ExpSet >::complete_(), and vcsn::detail::automaton_decorator< expression_automaton< mutable_automaton< context_t_of< ExpSet > > > >::is_lazy().
|
inline |
Complete a state: find its outgoing transitions.
Definition at line 221 of file derived-term.hh.
References vcsn::detail::automaton_decorator< expression_automaton< mutable_automaton< context_t_of< ExpSet > > > >::aut_, and vcsn::detail::derived_term_automaton_impl< ExpSet >::complete_via_expansion_().
Referenced by vcsn::detail::derived_term_automaton_impl< ExpSet >::all_out().
|
inline |
Compute the outgoing transitions of src.
Definition at line 240 of file derived-term.hh.
References vcsn::detail::derived_term_automaton_impl< ExpSet >::algo_, vcsn::detail::automaton_decorator< expression_automaton< mutable_automaton< context_t_of< ExpSet > > > >::aut_, vcsn::detail::derived_term_algo::breaking, vcsn::constant_term(), vcsn::derivation(), vcsn::detail::derived_term_algo::determinize, vcsn::detail::derived_term_automaton_members< ExpSet, bool >::gens, vcsn::detail::automaton_decorator< expression_automaton< mutable_automaton< context_t_of< ExpSet > > > >::label_of(), vcsn::detail::derived_term_automaton_impl< ExpSet >::members_, vcsn::detail::derived_term_automaton_impl< ExpSet >::ps_, vcsn::detail::derived_term_automaton_impl< ExpSet >::rs_, and vcsn::detail::automaton_decorator< expression_automaton< mutable_automaton< context_t_of< ExpSet > > > >::weight_of().
Referenced by vcsn::detail::derived_term_automaton_impl< ExpSet >::via_derivation().
|
inline |
Compute the outgoing transitions of src.
Definition at line 259 of file derived-term.hh.
References vcsn::detail::derived_term_automaton_impl< ExpSet >::algo_, vcsn::detail::automaton_decorator< expression_automaton< mutable_automaton< context_t_of< ExpSet > > > >::aut_, vcsn::detail::derived_term_algo::breaking, vcsn::detail::derived_term_algo::determinize, vcsn::rat::expansionset< ExpSet >::determinize(), vcsn::detail::derived_term_automaton_impl< ExpSet >::es_, vcsn::detail::automaton_decorator< expression_automaton< mutable_automaton< context_t_of< ExpSet > > > >::label_of(), vcsn::detail::derived_term_automaton_impl< ExpSet >::ps_, vcsn::detail::derived_term_automaton_impl< ExpSet >::rs_, vcsn::split(), vcsn::detail::derived_term_automaton_impl< ExpSet >::to_expansion_, vcsn::detail::automaton_decorator< expression_automaton< mutable_automaton< context_t_of< ExpSet > > > >::weight_of(), and vcsn::detail::derived_term_automaton_impl< ExpSet >::ws_.
Referenced by vcsn::detail::derived_term_automaton_impl< ExpSet >::complete_(), and vcsn::detail::derived_term_automaton_impl< ExpSet >::via_expansion().
|
inline |
Initialize the computation: build the initial states.
Definition at line 211 of file derived-term.hh.
References vcsn::detail::derived_term_automaton_impl< ExpSet >::algo_, vcsn::detail::automaton_decorator< expression_automaton< mutable_automaton< context_t_of< ExpSet > > > >::aut_, vcsn::detail::derived_term_algo::breaking, vcsn::detail::automaton_decorator< expression_automaton< mutable_automaton< context_t_of< ExpSet > > > >::label_of(), vcsn::detail::derived_term_automaton_impl< ExpSet >::rs_, vcsn::split(), vcsn::detail::automaton_decorator< expression_automaton< mutable_automaton< context_t_of< ExpSet > > > >::weight_of(), and vcsn::detail::derived_term_automaton_impl< ExpSet >::ws_.
Referenced by vcsn::detail::derived_term_automaton_impl< ExpSet >::via_derivation(), and vcsn::detail::derived_term_automaton_impl< ExpSet >::via_expansion().
|
inline |
Compute the derived-term automaton.
Definition at line 172 of file derived-term.hh.
References vcsn::detail::derived_term_algo::algo, vcsn::detail::derived_term_automaton_impl< ExpSet >::algo_, vcsn::detail::derived_term_algo::derivation, vcsn::detail::derived_term_automaton_impl< ExpSet >::via_derivation(), and vcsn::detail::derived_term_automaton_impl< ExpSet >::via_expansion().
|
inline |
Definition at line 157 of file derived-term.hh.
|
inlinestatic |
Definition at line 149 of file derived-term.hh.
References vcsn::sname().
|
inline |
Compute the derived-term automaton via derivation.
Definition at line 181 of file derived-term.hh.
References vcsn::detail::automaton_decorator< expression_automaton< mutable_automaton< context_t_of< ExpSet > > > >::aut_, vcsn::detail::derived_term_automaton_impl< ExpSet >::complete_via_derivation_(), and vcsn::detail::derived_term_automaton_impl< ExpSet >::init_().
Referenced by vcsn::detail::derived_term_automaton_impl< ExpSet >::operator()().
|
inline |
Compute the derived-term automaton via expansion.
Definition at line 194 of file derived-term.hh.
References vcsn::detail::automaton_decorator< expression_automaton< mutable_automaton< context_t_of< ExpSet > > > >::aut_, vcsn::detail::derived_term_automaton_impl< ExpSet >::complete_via_expansion_(), and vcsn::detail::derived_term_automaton_impl< ExpSet >::init_().
Referenced by vcsn::detail::derived_term_automaton_impl< ExpSet >::operator()().
derived_term_algo vcsn::detail::derived_term_automaton_impl< ExpSet >::algo_ |
How derived terms are computed.
Definition at line 291 of file derived-term.hh.
Referenced by vcsn::detail::derived_term_automaton_impl< ExpSet >::complete_via_derivation_(), vcsn::detail::derived_term_automaton_impl< ExpSet >::complete_via_expansion_(), vcsn::detail::derived_term_automaton_impl< ExpSet >::derived_term_automaton_impl(), vcsn::detail::derived_term_automaton_impl< ExpSet >::init_(), and vcsn::detail::derived_term_automaton_impl< ExpSet >::operator()().
expansionset_t vcsn::detail::derived_term_automaton_impl< ExpSet >::es_ = {rs_} |
Definition at line 295 of file derived-term.hh.
Referenced by vcsn::detail::derived_term_automaton_impl< ExpSet >::complete_via_expansion_().
derived_term_automaton_members<expressionset_t> vcsn::detail::derived_term_automaton_impl< ExpSet >::members_ = {rs_} |
Possibly the generators.
Definition at line 300 of file derived-term.hh.
Referenced by vcsn::detail::derived_term_automaton_impl< ExpSet >::complete_via_derivation_(), and vcsn::detail::derived_term_automaton_impl< ExpSet >::derived_term_automaton_impl().
polynomialset_t vcsn::detail::derived_term_automaton_impl< ExpSet >::ps_ = make_expression_polynomialset(rs_) |
Definition at line 289 of file derived-term.hh.
Referenced by vcsn::detail::derived_term_automaton_impl< ExpSet >::complete_via_derivation_(), and vcsn::detail::derived_term_automaton_impl< ExpSet >::complete_via_expansion_().
expressionset_t vcsn::detail::derived_term_automaton_impl< ExpSet >::rs_ |
The expression's set.
Definition at line 284 of file derived-term.hh.
Referenced by vcsn::detail::derived_term_automaton_impl< ExpSet >::complete_via_derivation_(), vcsn::detail::derived_term_automaton_impl< ExpSet >::complete_via_expansion_(), vcsn::detail::derived_term_automaton_impl< ExpSet >::derived_term_automaton_impl(), and vcsn::detail::derived_term_automaton_impl< ExpSet >::init_().
to_expansion_t vcsn::detail::derived_term_automaton_impl< ExpSet >::to_expansion_ = {rs_} |
Definition at line 298 of file derived-term.hh.
Referenced by vcsn::detail::derived_term_automaton_impl< ExpSet >::complete_via_expansion_().
weightset_t vcsn::detail::derived_term_automaton_impl< ExpSet >::ws_ = *rs_.weightset() |
Its weightset.
Definition at line 286 of file derived-term.hh.
Referenced by vcsn::detail::derived_term_automaton_impl< ExpSet >::complete_via_expansion_(), and vcsn::detail::derived_term_automaton_impl< ExpSet >::init_().