1 #ifndef VCSN_DYN_ALGOS_HH
2 # define VCSN_DYN_ALGOS_HH
8 # include <vcsn/algos/fwd.hh>
113 bool breaking =
false);
124 const std::string& algo =
"auto");
135 const std::string& algo =
"weighted");
146 const std::string& algo =
"weighted");
154 const std::string& algo =
"auto");
176 std::ostream&
dot(
const automaton& aut, std::ostream& out,
177 bool dot2tex =
false);
184 const std::vector<unsigned>& f);
234 bool detailed =
false);
237 std::ostream&
info(
const ratexp& exp, std::ostream& out);
323 const std::string& algo =
"auto");
370 const std::string& format =
"default");
374 const std::string& format =
"default");
378 const std::string& format =
"default");
381 std::ostream&
print(
const label& l, std::ostream& o,
382 const std::string& format =
"default");
386 const std::string& format =
"default");
389 std::ostream&
print(
const ratexp& e, std::ostream& o,
390 const std::string& format =
"default");
393 std::ostream&
print(
const weight& w, std::ostream& o,
394 const std::string& format =
"default");
397 void set_format(std::ostream& o,
const std::string& format);
441 unsigned num_initial = 1,
442 unsigned num_final = 1);
450 unsigned num_states);
456 const std::string& format =
"default");
468 const std::string& format =
"default");
559 const std::string& algo =
"greedy");
573 const std::string& algo =
"auto");
624 #endif // !VCSN_DYN_ALGOS_HH
context make_context(const std::string &name)
Build a context from its name.
bool is_standard(const automaton &aut)
Whether is standard (unique initial state, with weight one, no incoming transition).
automaton proper(const automaton &aut, direction dir=direction::backward, bool prune=true)
An equivalent automaton without spontaneous transitions.
bool are_equivalent(const automaton &lhs, const automaton &rhs)
Whether define the same language.
automaton suffix(const automaton &aut)
Create a suffix automaton from aut.
automaton transpose(automaton &aut)
Transpose aut.
automaton blind(automaton &aut, unsigned tape)
Focus on a specific tape of a tupleset automaton.
label read_label(std::istream &is, const context &ctx)
Read a label from a stream.
automaton random_automaton_deterministic(const context &ctx, unsigned num_states)
Produce a random deterministic automaton.
ratexp star_normal_form(const ratexp &e)
A normalized form where star is applied only to expression without null constant-term.
std::shared_ptr< detail::automaton_base > automaton
automaton star(const automaton &aut)
Star of a standard automaton.
std::string get_format(std::ostream &o)
Get the output format for o.
bool is_useless(const automaton &aut)
Whether has no useful state.
bool is_proper(const automaton &aut)
Whether has no spontaneous transition.
automaton product(const automaton &lhs, const automaton &rhs)
The product of automata lhs and rhs.
bool is_out_sorted(const automaton &aut)
Whether the outgoing transitions of each state have increasing labels.
automaton minimize(const automaton &aut, const std::string &algo="auto")
The minimized automaton.
automaton difference(const automaton &lhs, const automaton &rhs)
An automaton whose behavior is that of lhs on words not accepted by rhs.
std::ostream & operator<<(std::ostream &o, type_t t)
bool is_trim(const automaton &aut)
Whether has no useless state.
ratexpset make_ratexpset(const context &ctx,::vcsn::rat::identities is)
Build an ratexpset from its context.
automaton random_automaton(const context &ctx, unsigned num_states, float density=0.1, unsigned num_initial=1, unsigned num_final=1)
Produce a random automaton.
automaton ladybird(const context &ctx, unsigned n)
The ladybird automaton with n states.
bool is_functional(const automaton &aut)
Whether aut is functional.
std::ostream & print(const automaton &a, std::ostream &o, const std::string &format="default")
Print automaton a on o using format format.
automaton shuffle(const automaton &lhs, const automaton &rhs)
The shuffle product of automata lhs and rhs.
polynomial enumerate(const automaton &aut, unsigned max)
All the accepted words of at most max letters.
automaton push_weights(const automaton &aut)
The weight pushing automaton of aut.
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 cominimize(const automaton &aut, const std::string &algo="auto")
The cominimized automaton.
automaton union_a(const automaton &lhs, const automaton &rhs)
Union of two automata (plain graph union).
automaton right_mult(const automaton &aut, const weight &w)
The right-mult automaton with w as weight.
context context_of(const automaton &a)
The context of this automaton.
std::shared_ptr< const detail::weight_base > weight
bool is_cycle_ambiguous(const automaton &aut)
Whether the automaton is cycle-ambiguous.
bool is_normalized(const automaton &aut)
Whether is normalized (in the Thompson sense), i.e., standard and co-standard.
automaton chain(const automaton &aut, int min, int max)
Repeated concatenation of aut with itself.
automaton filter(const automaton &aut, const std::vector< unsigned > &ss)
The subautomaton based on aut, with only states in ss visible.
polynomial split(const polynomial &p)
Break all the expressions in p.
rat::identities identities(const ratexp &exp)
The identities of ratexp exp.
automaton determinize(const automaton &aut, const std::string &algo="weighted")
The determinized automaton.
std::shared_ptr< detail::ratexp_base > ratexp
bool is_complete(const automaton &aut)
Whether aut is complete.
automaton trim(const automaton &aut)
The useful subautomaton of aut.
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.
expansion to_expansion(const ratexp &exp)
First order development of a exp.
ratexp expand(const ratexp &e)
Distribute product over addition recursively under the starred subexpressions and group the equal mon...
automaton normalize(const automaton &aut)
Normalize automaton aut.
automaton subword(const automaton &aut)
Create a subword automaton from aut.
automaton standard(const automaton &a)
A standardized a.
bool is_codeterministic(const automaton &aut)
Whether aut is codeterministic.
bool is_valid(const automaton &e)
Whether automaton is valid (epsilon-cycles converge).
automaton prefix(const automaton &aut)
Create a prefix automaton from aut.
automaton left_mult(const weight &w, const automaton &aut)
The left-multiplication of an automaton with w as weight.
automaton accessible(const automaton &aut)
The accessible subautomaton of aut.
automaton sort(const automaton &a)
A copy of a with normalized state numbers.
weight constant_term(const ratexp &e)
The weight associated to the empty word in e.
automaton copy(const automaton &aut)
A copy of aut.
context make_word_context(const context &ctx)
The context for words.
automaton costandard(const automaton &a)
A standardized transpositive a.
std::size_t num_sccs(const automaton &aut)
The number of strongly connected components.
bool is_accessible(const automaton &aut)
Whether aut is accessible.
std::shared_ptr< const detail::expansion_base > expansion
automaton pair(const automaton &aut, bool keep_initials=false)
Build the pair automaton of the given automaton.
automaton complete(const automaton &aut)
A completed copy of aut.
std::shared_ptr< const detail::ratexpset_base > ratexpset
bool is_coaccessible(const automaton &aut)
Whether aut is coaccessible.
automaton_editor * make_automaton_editor(const context &ctx)
Build an automatonset from its context.
automaton sum(const automaton &lhs, const automaton &rhs)
Sum of two standard automata.
bool are_isomorphic(const automaton &lhs, const automaton &rhs)
Whether there exists an isomorphism between the states of lhs and those of rhs.
weight read_weight(std::istream &is, const context &ctx)
Read a weight from a stream.
std::istringstream is
The input stream: the specification to translate.
std::ostream & grail(const automaton &aut, std::ostream &out)
Output in Grail format.
label ambiguous_word(const automaton &aut)
An ambiguous word, or raise if there is none.
std::ostream & fado(const automaton &aut, std::ostream &out)
Output in FAdo format.
automaton codeterminize(const automaton &aut, const std::string &algo="weighted")
The codeterminized automaton.
automaton de_bruijn(const context &ctx, unsigned n)
A simple NFA for (a+b)*a(a+b)^n.
bool is_synchronized_by(const automaton &aut, const label &word)
Whether the word synchronizes aut.
ratexp to_expression(const automaton &aut, const std::string &algo="auto")
A ratexp denoting the language of aut.
polynomial read_polynomial(std::istream &is, const context &ctx)
Read a polynomial from a stream.
bool is_synchronizing(const automaton &aut)
Whether is synchronizing.
bool has_twins_property(const automaton &aut)
Whether the automaton has the twins property.
std::shared_ptr< const detail::label_base > label
automaton factor(const automaton &aut)
Create a factor automaton from aut.
automaton derived_term(const ratexp &e, const std::string &algo="auto")
The derived-term automaton of e.
automaton insplit(const automaton &aut)
Split automaton on the incoming transition.
std::shared_ptr< const detail::context_base > context
automaton power(const automaton &aut, unsigned n)
Repeated product of aut with itself.
polynomial derivation(const ratexp &exp, const label &l, bool breaking=false)
Derive exp with respect to s.
bool is_costandard(const automaton &aut)
Whether is costandard (unique final state, with weight one, no outcoming transition).
weight eval(const automaton &aut, const label &l)
Evaluate s on aut.
std::ostream & tikz(const automaton &aut, std::ostream &out)
Output aut in LaTeX's TikZ format.
automaton infiltration(const automaton &lhs, const automaton &rhs)
The infiltration of automata lhs and rhs.
automaton read_automaton(std::istream &is, const std::string &format="default")
Read an automaton from a stream.
bool is_empty(const automaton &aut)
Whether has no state.
label synchronizing_word(const automaton &aut, const std::string &algo="greedy")
A synchronizing word, or raise if there is none.
ratexp read_ratexp(std::istream &is, const ratexpset &rs, const std::string &format="default")
Read a ratexp from a stream.
automaton u(const context &ctx, unsigned n)
The Brzozowski universal witness.
ratexp transposition(const ratexp &r)
Add the transposition operator to r.
automaton complement(const automaton &aut)
The complement of aut.
automaton cerny(const context &ctx, unsigned num_states)
Produce a Černý automaton of num_states states.
automaton universal(const automaton &aut)
The universal automaton of aut.
automaton lift(const automaton &aut)
The lifted LAO automaton from aut.
automaton thompson(const ratexp &e)
The Thompson automaton of e.
automaton reduce(const automaton &aut)
Reduce aut.
automaton compose(automaton &lhs, automaton &rhs)
The composition of transducers lhs and rhs.
weight multiply(const weight &lhs, const weight &rhs)
Multiply two weights.
std::ostream & dot(const automaton &aut, std::ostream &out, bool dot2tex=false)
Output aut in GraphViz' Dot format.
automaton concatenate(const automaton &lhs, const automaton &rhs)
Concatenate two standard automata.
bool is_eps_acyclic(const automaton &aut)
Whether has no cycle of spontaneous transitions.
identities
A ratexpset can implement several different sets of identities on expressions.
std::ostream & info(const automaton &aut, std::ostream &out, bool detailed=false)
Output various facts about an automaton.
void set_format(std::ostream &o, const std::string &format)
Specify the output format for o.
std::ostream & efsm(const automaton &aut, std::ostream &out)
Output in Extended FSM format.
bool is_ambiguous(const automaton &aut)
Whether aut is ambiguous.
automaton coaccessible(const automaton &aut)
The coaccessible subautomaton of aut.
std::shared_ptr< const detail::polynomial_base > polynomial
polynomial shortest(const automaton &aut, unsigned max=1)
The at-most max first accepted words.
variadic_mul_mixin< detail::r_impl > r
automaton eliminate_state(const automaton &aut, int s)
The LAO automaton aut with state s removed.
bool is_deterministic(const automaton &aut)
Whether aut is deterministic.
automaton strip(const automaton &a)
The automaton in a with its metadata layers removed.
unsigned star_height(const ratexp &rs)
Star height of a ratexp.
ratexp conjunction(const ratexp &lhs, const ratexp &rhs)
The Hadamard product of ratexps lhs and rhs.