Vcsn  2.2
Be Rational
vcsn::detail::derived_term_automaton_impl< ExpSet > Class Template Reference

Compute the derived-term automaton from an expression. More...

#include <derived-term.hh>

Inheritance diagram for vcsn::detail::derived_term_automaton_impl< ExpSet >:
Collaboration diagram for vcsn::detail::derived_term_automaton_impl< ExpSet >:

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_decoratoroperator= (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_tmembers_ = {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...
 

Detailed Description

template<typename ExpSet>
class vcsn::detail::derived_term_automaton_impl< ExpSet >

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.

Member Typedef Documentation

The type of the (strict) automaton we build.

Definition at line 141 of file derived-term.hh.

template<typename ExpSet >
using vcsn::detail::derived_term_automaton_impl< ExpSet >::context_t = context_t_of<expressionset_t>

Definition at line 137 of file derived-term.hh.

Might be needed to determinize.

Definition at line 294 of file derived-term.hh.

template<typename ExpSet >
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.

template<typename ExpSet >
using vcsn::detail::derived_term_automaton_impl< ExpSet >::expressionset_t = ExpSet

Definition at line 133 of file derived-term.hh.

The polynomialset for expressions.

Definition at line 288 of file derived-term.hh.

template<typename ExpSet >
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.

template<typename ExpSet >
using vcsn::detail::derived_term_automaton_impl< ExpSet >::state_t = state_t_of<automaton_t>

Definition at line 142 of file derived-term.hh.

template<typename ExpSet >
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.

Used for expansions.

Definition at line 297 of file derived-term.hh.

template<typename ExpSet >
using vcsn::detail::derived_term_automaton_impl< ExpSet >::weightset_t = weightset_t_of<context_t>

Definition at line 138 of file derived-term.hh.

Constructor & Destructor Documentation

Member Function Documentation

template<typename ExpSet >
auto vcsn::detail::derived_term_automaton_impl< ExpSet >::all_out ( state_t  s) const -> decltype(vcsn::detail::all_out(aut_, s))
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().

Here is the call graph for this function:

template<typename ExpSet >
void vcsn::detail::derived_term_automaton_impl< ExpSet >::complete_ ( state_t  s) const
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().

Here is the call graph for this function:

template<typename ExpSet >
automaton_t vcsn::detail::derived_term_automaton_impl< ExpSet >::operator() ( const expression_t expression)
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().

Here is the call graph for this function:

template<typename ExpSet >
std::ostream& vcsn::detail::derived_term_automaton_impl< ExpSet >::print_set ( std::ostream &  o,
format  fmt = {} 
) const
inline

Definition at line 157 of file derived-term.hh.

template<typename ExpSet >
static symbol vcsn::detail::derived_term_automaton_impl< ExpSet >::sname ( )
inlinestatic

Definition at line 149 of file derived-term.hh.

References vcsn::sname().

Here is the call graph for this function:

template<typename ExpSet >
automaton_t vcsn::detail::derived_term_automaton_impl< ExpSet >::via_derivation ( const expression_t expression)
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()().

Here is the call graph for this function:

template<typename ExpSet >
automaton_t vcsn::detail::derived_term_automaton_impl< ExpSet >::via_expansion ( const expression_t expression)
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()().

Here is the call graph for this function:

Member Data Documentation

template<typename ExpSet >
to_expansion_t vcsn::detail::derived_term_automaton_impl< ExpSet >::to_expansion_ = {rs_}

The documentation for this class was generated from the following file: