7 #include <boost/optional.hpp>
9 #include <vcsn/algos/fwd.hh>
56 const std::string& algo =
"auto");
65 const std::string& algo =
"auto");
167 const std::string& format =
"default");
182 bool breaking =
false);
194 const std::string& algo =
"auto");
206 const std::string& algo =
"auto");
225 const std::vector<unsigned>& f);
284 bool detailed =
false);
413 const std::string& algo =
"auto");
439 const std::vector<unsigned>& tapes = {},
451 const std::string& algo =
"auto");
455 const std::string& algo =
"auto");
478 const std::string& algo =
"auto");
493 const std::string& algo =
"auto");
528 const std::string& algo =
"auto");
564 const std::string& format =
"default");
568 const std::string& format =
"default");
572 const std::string& format =
"default");
576 const std::string& format =
"default");
579 std::ostream&
print(
const label& l, std::ostream& o,
580 const std::string& format =
"default");
584 const std::string& format =
"default");
587 std::ostream&
print(
const weight& w, std::ostream& o,
588 const std::string& format =
"default");
591 void set_format(std::ostream& o,
const std::string& format);
622 bool prune =
true,
const std::string& algo =
"auto");
651 unsigned num_initial = 1,
652 unsigned num_final = 1,
653 float loop_chance = 0.0);
662 unsigned num_states);
673 const std::string& format =
"default",
684 const std::string& format =
"default");
692 const std::string& format =
"default");
730 const std::string& algo =
"auto");
751 boost::optional<unsigned> num = {},
752 boost::optional<unsigned> len = {});
825 const std::string& algo =
"auto");
844 const std::string& algo =
"greedy");
864 const std::string& algo =
"auto");
878 const std::string& algo =
"auto");
921 const std::string& format =
"default");
label synchronizing_word(const automaton &aut, const std::string &algo="greedy")
A synchronizing word, or raise if there is none.
bool is_valid(const automaton &e)
Whether automaton is valid (epsilon-cycles converge).
bool are_equivalent(const automaton &lhs, const automaton &rhs)
Whether compute the same series.
rat::identities identities(const expression &exp)
The identities of expression exp.
expression expand(const expression &e)
Distribute product over addition recursively under the starred subexpressions and group the equal mon...
weight read_weight(const context &ctx, std::istream &is)
Read a weight from a stream.
automaton universal(const automaton &aut)
The universal automaton of aut.
bool is_partial_identity(const automaton &aut)
Whether aut realizes a partial identity.
expression rdiv(const expression &lhs, const expression &rhs)
Right-division of two expressions (lhs \ rhs).
polynomial lgcd(const polynomial &lhs, const polynomial &rhs)
Left greatest common divisor of two polynomials (lhs \ rhs).
bool is_proper(const automaton &aut)
Whether has no spontaneous transition.
bool is_eps_acyclic(const automaton &aut)
Whether has no cycle of spontaneous transitions.
weight constant_term(const expression &e)
The weight associated to the empty word in e.
context make_word_context(const context &ctx)
The context for words.
automaton eliminate_state(const automaton &aut, int s=-1)
The LAO automaton aut with state s removed.
automaton normalize(const automaton &aut)
Normalize automaton aut.
std::shared_ptr< const detail::polynomial_base > polynomial
unsigned star_height(const expression &rs)
Star height of an expression.
automaton accessible(const automaton &aut)
The accessible subautomaton of aut.
expansion tuple(const std::vector< expansion > &rs)
Build a k-tape expansion from k expansions.
label ambiguous_word(const automaton &aut)
An ambiguous word, or raise if there is none.
weight eval(const automaton &aut, const label &l)
Evaluate l on aut.
automaton lightest_automaton(const automaton &aut, const std::string &algo="auto")
The shortest path automaton using the given algorithm.
bool is_empty(const automaton &aut)
Whether has no state.
automaton focus(const automaton &aut, unsigned tape)
Focus on a specific tape of a tupleset automaton.
std::shared_ptr< const detail::weight_base > weight
bool has_twins_property(const automaton &aut)
Whether the automaton has the twins property.
weight weight_series(const automaton &aut)
Compute weight of the series.
automaton complement(const automaton &aut)
The complement of aut.
automaton subword(const automaton &aut)
Create a subword automaton from aut.
std::size_t num_tapes(const context &ctx)
The number of input tapes.
automaton sum(const automaton &lhs, const automaton &rhs, const std::string &algo="auto")
Sum of two automata.
bool is_synchronized_by(const automaton &aut, const label &word)
Whether the word synchronizes aut.
automaton compose(automaton &lhs, automaton &rhs, bool lazy=false)
The composition of transducers lhs and rhs.
std::shared_ptr< const detail::expansion_base > expansion
automaton difference(const automaton &lhs, const automaton &rhs)
An automaton whose behavior is that of lhs on words not accepted by rhs.
expression concatenate(const expression &lhs, const expression &rhs)
Concatenate two expressions.
automaton transpose(automaton &aut)
Transpose aut.
automaton factor(const automaton &aut)
Create a factor automaton from aut.
automaton minimize(const automaton &aut, const std::string &algo="auto")
The minimized automaton.
automaton delay_automaton(const automaton &a)
The automaton with the delay of each state.
std::set< std::pair< std::string, std::string >> letter_class_t
A set of letter ranges.
automaton suffix(const automaton &aut)
Create a suffix automaton from aut.
std::string type(const automaton &a)
The implementation type of a.
bool is_ambiguous(const automaton &aut)
Whether aut is ambiguous.
weightset_mixin< detail::r_impl > r
context context_of(const automaton &a)
The context of this automaton.
automaton trie(const polynomial &p)
A trie-like automaton (single initial state, multiple final states) to accept p.
automaton de_bruijn(const context &ctx, unsigned n)
A simple NFA for (a+b)*a(a+b)^n.
std::string get_format(std::ostream &o)
Get the output format for o.
automaton insplit(const automaton &aut, bool lazy=false)
Split automaton on the incoming transition.
automaton read_automaton(std::istream &is, const std::string &format="default", bool strip=true)
Read an automaton from a stream.
automaton right_mult(const automaton &aut, const weight &w, const std::string &algo="auto")
The right-mult automaton with w as weight.
automaton conjugate(const automaton &aut)
The conjugate of aut.
bool are_isomorphic(const automaton &lhs, const automaton &rhs)
Whether there exists an isomorphism between the states of lhs and those of rhs.
bool is_functional(const automaton &aut)
Whether aut is functional.
automaton scc(const automaton &aut, const std::string &algo="auto")
Build the SCC automaton whose states are labeled with number of the strongly-connected component they...
std::shared_ptr< const detail::label_base > label
auto out(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions leaving state s.
automaton coaccessible(const automaton &aut)
The coaccessible subautomaton of aut.
automaton zpc(const expression &exp, const std::string &algo="auto")
The ZPC automaton of exp.
bool is_complete(const automaton &aut)
Whether aut is complete.
automaton trim(const automaton &aut)
The trim subautomaton of aut.
automaton strip(const automaton &a)
The automaton in a with its metadata layers removed.
bool is_coaccessible(const automaton &aut)
Whether aut is coaccessible.
automaton shuffle(const automaton &lhs, const automaton &rhs)
The shuffle product of automata lhs and rhs.
std::ostream & operator<<(std::ostream &o, type_t t)
bool is_codeterministic(const automaton &aut)
Whether aut is codeterministic.
expansion to_expansion(const expression &exp)
First order development of a exp.
polynomial shortest(const automaton &aut, boost::optional< unsigned > num={}, boost::optional< unsigned > len={})
The approximated behavior of an automaton.
bool is_standard(const automaton &aut)
Whether is standard (unique initial state, with weight one, no incoming transition).
bool is_accessible(const automaton &aut)
Whether aut is accessible.
automaton proper(const automaton &aut, direction dir=direction::backward, bool prune=true, const std::string &algo="auto")
An equivalent automaton without spontaneous transitions.
std::shared_ptr< const detail::context_base > context
A dyn::context.
automaton partial_identity(const automaton &aut)
Create a partial identity transducer from aut.
automaton project(const automaton &aut, unsigned tape)
Keep a single tape from a multiple-tape automaton.
automaton costandard(const automaton &a)
A standardized transpositive a.
bool is_synchronized(const automaton &aut)
Whether is synchronized.
bool is_deterministic(const automaton &aut)
Whether aut is deterministic.
automaton realtime(const automaton &aut)
Create the realtime automaton (letterized and proper).
std::shared_ptr< detail::automaton_base > automaton
bool has_bounded_lag(const automaton &aut)
Whether the transducer has bounded lag.
expression to_expression(const automaton &aut, rat::identities ids={}, const std::string &algo="auto")
An expression denoting the language of aut.
automaton random_automaton(const context &ctx, unsigned num_states, float density=0.1, unsigned num_initial=1, unsigned num_final=1, float loop_chance=0.0)
Produce a random automaton.
automaton star(const automaton &aut, const std::string &algo="auto")
Star of an automaton.
bool is_synchronizing(const automaton &aut)
Whether is synchronizing.
automaton conjunction(const automaton &lhs, const automaton &rhs, bool lazy=false)
The conjunction (aka synchronized product) of automata.
bool is_normalized(const automaton &aut)
Whether is normalized (in the Thompson sense), i.e., standard and co-standard.
std::ostream & print(const automaton &aut, std::ostream &out, const std::string &format="default")
Print automaton a on o using format format.
automaton cotrie(const polynomial &p)
A reversed trie-like automaton (multiple initial states, single final state) automaton to accept p...
automaton thompson(const expression &e)
The Thompson automaton of e.
automaton codeterminize(const automaton &aut, const std::string &algo="auto")
The codeterminized automaton.
automaton_editor * make_automaton_editor(const context &ctx)
Build an automatonset from its context.
automaton pair(const automaton &aut, bool keep_initials=false)
Build the pair automaton of the given automaton.
bool is_useless(const automaton &aut)
Whether has no useful state.
automaton left_mult(const weight &w, const automaton &aut, const std::string &algo="auto")
The left-multiplication of an automaton with w as weight.
std::istringstream is
The input stream: the specification to translate.
automaton cerny(const context &ctx, unsigned num_states)
Produce a Černý automaton of num_states states.
automaton lift(const automaton &aut, const std::vector< unsigned > &tapes={}, rat::identities ids={})
Lift some tapes of the transducer, or turn an automaton into a spontaneous automaton.
automaton divkbaseb(const context &ctx, unsigned divisor, unsigned base)
An automaton which accepts a word n representing a number in base b iff k|n.
expression star_normal_form(const expression &e)
A normalized form where star is applied only to proper expressions.
context make_context(const std::string &name)
Build a context from its name.
polynomial derivation(const expression &exp, const label &lbl, bool breaking=false)
Derive exp with respect to s.
automaton levenshtein(const context &ls)
The transducer representing the Levenshtein distance.
automaton push_weights(const automaton &aut)
The weight pushing automaton of aut.
void set_format(std::ostream &o, const std::string &format)
Specify the output format for o.
automaton complete(const automaton &aut)
A completed copy of aut.
automaton random_automaton_deterministic(const context &ctx, unsigned num_states)
Produce a random deterministic automaton.
static dyn::context ctx(const driver &d)
Get the context of the driver.
automaton multiply(const automaton &lhs, const automaton &rhs, const std::string &algo="auto")
Multiply (concatenate) two automata.
automaton condense(const automaton &aut)
The condensation of aut such that each state is a strongly connected component.
bool is_costandard(const automaton &aut)
Whether is costandard (unique final state, with weight one, no outcoming transition).
bool is_out_sorted(const automaton &aut)
Whether the outgoing transitions of each state have increasing labels.
automaton cominimize(const automaton &aut, const std::string &algo="auto")
The cominimized automaton.
polynomial ldiv(const polynomial &lhs, const polynomial &rhs)
Left-division of two polynomials (lhs \ rhs).
automaton letterize(const automaton &aut)
The automaton with letter transitions instead of words.
automaton component(const automaton &aut, unsigned num)
The automaton of a strongly connected component.
polynomial read_polynomial(const context &ctx, std::istream &is)
Read a polynomial from a stream.
expression read_expression(const context &ctx, rat::identities ids, std::istream &is, const std::string &format="default")
Read an expression from a stream.
bool is_trim(const automaton &aut)
Whether has no useless state.
bool is_letterized(const automaton &aut)
Whether aut is letterized.
automaton infiltration(const automaton &lhs, const automaton &rhs)
The infiltration of automata lhs and rhs.
automaton standard(const automaton &a)
A standardized a.
polynomial lightest(const automaton &aut, unsigned num=1, const std::string &algo="auto")
The approximated behavior of an automaton with smallest weights.
context join(const context &lhs, const context &rhs)
The join between two contexts, i.e., their lowest common supertype.
polynomial split(const expression &exp)
Break exp.
automaton derived_term(const expression &exp, const std::string &algo="auto")
The derived-term automaton of exp.
expression expression_zero(const context &c, rat::identities ids)
The expression for \z.
automaton reduce(const automaton &aut)
Reduce aut.
automaton prefix(const automaton &aut)
Create a prefix automaton from aut.
std::shared_ptr< detail::expression_base > expression
bool has_lightening_cycle(const automaton &aut)
Whether the automaton has a cycle with lightening weight.
automaton u(const context &ctx, unsigned n)
The Brzozowski universal witness.
expression transposition(const expression &r)
Add the transposition operator to r.
static identities ids(const driver &d)
Get the identities of the driver.
bool is_cycle_ambiguous(const automaton &aut)
Whether the automaton is cycle-ambiguous.
automaton synchronize(const automaton &aut)
Create a synchronized transducer from aut.
bool less_than(const expression &lhs, const expression &rhs)
Ordering between expressions.
bool is_realtime(const automaton &aut)
Whether has no spontaneous transition, and is letterized.
automaton determinize(const automaton &aut, const std::string &algo="auto")
The determinized automaton.
std::ostream & info(const automaton &aut, std::ostream &out, bool detailed=false)
Output various facts about an automaton.
expression expression_one(const context &c, rat::identities ids)
The expression for \e.
automaton to_automaton(const expression &exp, const std::string &algo="auto")
An automaton denoting the language of exp.
automaton double_ring(const context &ctx, unsigned n, const std::vector< unsigned > &f)
The double_ring automaton with n states and f the list of finals.
automaton filter(const automaton &aut, const std::vector< unsigned > &ss)
The subautomaton based on aut, with only states in ss visible.
label read_label(const context &ctx, std::istream &is, const std::string &format="default")
Read a label from a stream.
automaton copy(const automaton &aut)
A copy of aut.
automaton ladybird(const context &ctx, unsigned n)
The ladybird automaton with n states.
std::size_t num_components(const automaton &aut)
The number of strongly connected components.
automaton sort(const automaton &a)
A copy of a with normalized state numbers.