7 #include <boost/optional.hpp>
9 #include <vcsn/algos/fwd.hh>
11 #include <vcsn/dyn/fwd.hh>
40 automaton
cerny(
const context&
ctx,
unsigned num_states);
55 const std::string& algo =
"auto");
64 const std::string& algo =
"auto");
82 automaton
complete(
const automaton& aut);
88 automaton
component(
const automaton& aut,
unsigned num);
95 automaton
compose(
const automaton& lhs,
const automaton& rhs,
114 automaton
condense(
const automaton& aut);
122 automaton
conjunction(
const automaton& lhs,
const automaton& rhs,
130 automaton
conjunction(
const std::vector<automaton>& as,
134 automaton
conjunction(
const automaton& aut,
unsigned n);
146 automaton
conjugate(
const automaton& aut);
164 automaton
copy(
const automaton& aut);
167 automaton
copy(
const automaton& aut,
const context&
ctx);
171 const context&
ctx, identities
ids);
189 automaton
cotrie(
const context&
ctx, std::istream& is,
190 const std::string& format =
"default");
205 bool breaking =
false);
217 const std::string& algo =
"auto");
229 const std::string& algo =
"auto");
237 automaton
difference(
const automaton& lhs,
const automaton& rhs);
244 automaton
divkbaseb(
const context&
ctx,
unsigned divisor,
unsigned base);
248 const std::vector<unsigned>& f);
268 automaton
factor(
const automaton& aut);
271 automaton
filter(
const automaton& aut,
const std::vector<unsigned>& ss);
274 automaton
focus(
const automaton& aut,
unsigned tape);
299 automaton
infiltrate(
const automaton& lhs,
const automaton& rhs);
303 automaton
infiltrate(
const std::vector<automaton>& as);
315 std::ostream&
info(
const automaton& aut, std::ostream&
out = std::cout,
316 bool detailed =
false);
331 automaton
insplit(
const automaton& aut,
bool lazy =
false);
366 bool is_empty(
const automaton& aut);
411 bool is_trim(
const automaton& aut);
424 context
join(
const context& lhs,
const context& rhs);
427 automaton
ladybird(
const context&
ctx,
unsigned n);
430 automaton
ldivide(
const automaton& lhs,
const automaton& rhs);
453 const std::string& algo =
"auto");
468 automaton
letterize(
const automaton& aut);
481 automaton
lift(
const automaton& aut,
482 const std::vector<unsigned>& tapes = {},
483 identities
ids = {});
494 const std::string& algo =
"auto");
499 const std::string& algo =
"auto");
521 automaton
multiply(
const automaton& lhs,
const automaton& rhs,
522 const std::string& algo =
"auto");
538 automaton
multiply(
const automaton& aut,
int min,
int max = -2,
539 const std::string& algo =
"auto");
583 automaton
minimize(
const automaton& aut,
584 const std::string& algo =
"auto");
587 automaton
normalize(
const automaton& aut);
597 automaton
pair(
const automaton& aut,
bool keep_initials =
false);
603 automaton
prefix(
const automaton& aut);
619 std::ostream&
print(
const automaton& aut, std::ostream&
out = std::cout,
620 const std::string& format =
"default");
623 std::ostream&
print(
const context& c, std::ostream&
out = std::cout,
624 const std::string& format =
"default");
628 const std::string& format =
"default");
632 const std::string& format =
"default");
635 std::ostream&
print(
const label& l, std::ostream&
out = std::cout,
636 const std::string& format =
"default");
640 const std::string& format =
"default");
643 std::ostream&
print(
const weight& w, std::ostream&
out = std::cout,
644 const std::string& format =
"default");
648 automaton
quotkbaseb(
const context&
ctx,
unsigned divisor,
unsigned base);
651 void set_format(std::ostream&
out,
const std::string& format);
657 automaton
project(
const automaton& aut,
unsigned tape);
660 context
project(
const context&
ctx,
unsigned tape);
686 automaton
proper(
const automaton& aut,
688 bool prune =
true,
const std::string& algo =
"auto");
720 unsigned num_initial = 1,
721 unsigned num_final = 1,
722 boost::optional<unsigned> max_labels = {},
723 float loop_chance = 0.0);
732 unsigned num_states);
748 automaton
rdivide(
const automaton& lhs,
const automaton& rhs);
759 const std::string& format =
"default",
770 const std::string& format =
"default");
778 const std::string& format =
"default");
793 automaton
realtime(
const automaton& aut);
796 automaton
reduce(
const automaton& aut);
816 const std::string& algo =
"auto");
832 automaton
scc(
const automaton& aut,
const std::string& algo =
"auto");
840 boost::optional<unsigned> num = {},
841 boost::optional<unsigned> len = {});
845 automaton
shuffle(
const automaton& lhs,
const automaton& rhs);
849 automaton
shuffle(
const std::vector<automaton>& as);
856 automaton
sort(
const automaton& a);
865 automaton
standard(
const automaton& a);
880 automaton
star(
const automaton& aut,
const std::string& algo =
"auto");
892 automaton
strip(
const automaton& a);
895 automaton
suffix(
const automaton& aut);
901 automaton
subword(
const automaton& aut);
913 automaton
add(
const automaton& lhs,
const automaton& rhs,
914 const std::string& algo =
"auto");
933 const std::string& algo =
"greedy");
953 const std::string& algo =
"auto");
967 const std::string& algo =
"auto");
1009 automaton
trie(
const context&
ctx, std::istream& is,
1010 const std::string& format =
"default");
1013 automaton
trim(
const automaton& aut);
1019 automaton
tuple(
const automaton& lhs,
const automaton& rhs);
1024 automaton
tuple(
const std::vector<automaton>& as);
1039 std::string
type(
const automaton& a);
1042 automaton
u(
const context&
ctx,
unsigned n);
1045 automaton
universal(
const automaton& aut);
1055 automaton
zpc(
const expression& exp,
const std::string& algo =
"auto");
1058 std::ostream&
operator<<(std::ostream& o,
const automaton& a);
1061 std::ostream&
operator<<(std::ostream& o,
const context& c);
automaton difference(const automaton &lhs, const automaton &rhs)
An automaton whose behavior is that of lhs on words not accepted by rhs.
value_impl< detail::weight_tag > weight
context make_context(const std::string &name)
Build a context from its name.
std::ostream & operator<<(std::ostream &o, const automaton &a)
Output automaton a on o.
automaton lift(const automaton &aut, const std::vector< unsigned > &tapes={}, identities ids={})
Lift some tapes of the transducer, or turn an automaton into a spontaneous automaton.
std::size_t num_tapes(const context &ctx)
The number of input tapes.
automaton thompson(const expression &e)
The Thompson automaton of e.
automaton random_automaton(const context &ctx, unsigned num_states, float density=0.1, unsigned num_initial=1, unsigned num_final=1, boost::optional< unsigned > max_labels={}, float loop_chance=0.0)
Produce a random automaton.
std::string type(const automaton &a)
The implementation type of a.
bool is_synchronizing(const automaton &aut)
Whether is synchronizing.
automaton pair(const automaton &aut, bool keep_initials=false)
Build the pair automaton of the given automaton.
bool is_normalized(const automaton &aut)
Whether is normalized (in the Thompson sense), i.e., standard and co-standard.
bool is_empty(const automaton &aut)
Whether has no state.
automaton letterize(const automaton &aut)
The automaton with letter transitions instead of words.
automaton filter(const automaton &aut, const std::vector< unsigned > &ss)
The subautomaton based on aut, with only states in ss visible.
automaton star(const automaton &aut, const std::string &algo="auto")
Star of an automaton.
automaton conjunction(const automaton &lhs, const automaton &rhs, bool lazy=false)
The conjunction (aka synchronized product) of automata.
std::ostream & print(const automaton &aut, std::ostream &out=std::cout, const std::string &format="default")
Print automaton a on out using format format.
automaton tuple(const automaton &lhs, const automaton &rhs)
Build a two-tape automaton from two automata.
automaton complete(const automaton &aut)
A completed copy of aut.
bool is_realtime(const automaton &aut)
Whether has no spontaneous transition, and is letterized.
automaton levenshtein(const context &ls)
The transducer representing the Levenshtein distance.
automaton standard(const automaton &a)
A standardized a.
bool is_ambiguous(const automaton &aut)
Whether aut is ambiguous.
automaton cominimize(const automaton &aut, const std::string &algo="auto")
The cominimized automaton.
bool is_partial_identity(const automaton &aut)
Whether aut realizes a partial identity.
weight weight_series(const automaton &aut)
Compute weight of the series.
automaton subword(const automaton &aut)
Create a subword automaton from aut.
automaton sort(const automaton &a)
A copy of a with normalized state numbers.
context context_of(const automaton &a)
The context of this automaton.
bool is_codeterministic(const automaton &aut)
Whether aut is codeterministic.
automaton to_automaton(const expression &exp, const std::string &algo="auto")
An automaton denoting the language of exp.
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 delay_automaton(const automaton &a)
The automaton with the delay of each state.
automaton lightest_automaton(const automaton &aut, unsigned num=1, const std::string &algo="auto")
The shortest path automaton using the given algorithm.
identities identities_of(const expression &exp)
The identities of expression exp.
auto out(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions leaving state s.
bool is_valid(const automaton &e)
Whether automaton is valid (epsilon-cycles converge).
automaton eliminate_state(const automaton &aut, int s=-1)
The LAO automaton aut with state s removed.
automaton transpose(automaton &aut)
Transpose aut.
bool is_deterministic(const automaton &aut)
Whether aut is deterministic.
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 determinize(const automaton &aut, const std::string &algo="auto")
The determinized automaton.
expression concatenate(const expression &lhs, const expression &rhs)
Concatenate two expressions.
automaton multiply(const automaton &lhs, const automaton &rhs, const std::string &algo="auto")
Multiply (concatenate) two automata.
polynomial shortest(const automaton &aut, boost::optional< unsigned > num={}, boost::optional< unsigned > len={})
The approximated behavior of an automaton.
automaton universal(const automaton &aut)
The universal automaton of aut.
automaton zpc(const expression &exp, const std::string &algo="auto")
The ZPC automaton of exp.
automaton trim(const automaton &aut)
The trim subautomaton of aut.
expression transposition(const expression &r)
Add the transposition operator to r.
polynomial derivation(const expression &exp, const label &lbl, bool breaking=false)
Derive exp with respect to s.
automaton minimize(const automaton &aut, const std::string &algo="auto")
The minimized automaton.
bool is_eps_acyclic(const automaton &aut)
Whether has no cycle of spontaneous transitions.
automaton costandard(const automaton &a)
A co-standardized a.
weight eval(const automaton &aut, const label &l)
Evaluate l on 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.
expression to_expression(const automaton &aut, identities ids={}, const std::string &algo="auto")
An expression denoting the language of aut.
bool is_proper(const automaton &aut)
Whether has no spontaneous transition.
bool is_trim(const automaton &aut)
Whether has no useless state.
automaton add(const automaton &lhs, const automaton &rhs, const std::string &algo="auto")
Sum of two automata.
std::string get_format(std::ostream &out)
Get the output format for out.
value_impl< detail::label_tag > label
automaton reduce(const automaton &aut)
Reduce aut.
bool is_coaccessible(const automaton &aut)
Whether aut is coaccessible.
expression expression_zero(const context &c, identities ids)
The expression for \z.
automaton factor(const automaton &aut)
Create a factor automaton from aut.
automaton u(const context &ctx, unsigned n)
The Brzozowski universal witness.
automaton conjugate(const automaton &aut)
The conjugate of aut.
automaton inductive(const expression &e, const std::string &algo="auto")
The inductive translation of e in an automaton.
bool is_functional(const automaton &aut)
Whether aut is functional.
automaton partial_identity(const automaton &aut)
Create a partial identity transducer from aut.
bool is_synchronized(const automaton &aut)
Whether is synchronized.
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...
automaton normalize(const automaton &aut)
Normalize automaton aut.
bool is_synchronized_by(const automaton &aut, const label &word)
Whether the word synchronizes aut.
context make_word_context(const context &ctx)
The context for words.
value_impl< detail::polynomial_tag > polynomial
automaton_editor * make_automaton_editor(const context &ctx)
Build an automatonset from its context.
bool has_twins_property(const automaton &aut)
Whether the automaton has the twins property.
automaton codeterminize(const automaton &aut, const std::string &algo="auto")
The codeterminized automaton.
automaton proper(const automaton &aut, direction dir=direction::backward, bool prune=true, const std::string &algo="auto")
An equivalent automaton without spontaneous transitions.
bool are_isomorphic(const automaton &lhs, const automaton &rhs)
Whether there exists an isomorphism between the states of lhs and those of rhs.
automaton ldivide(const automaton &lhs, const automaton &rhs)
Left-division of two automata (lhs \ rhs).
automaton compose(const automaton &lhs, const automaton &rhs, bool lazy=false)
The composition of transducers lhs and rhs.
automaton infiltrate(const automaton &lhs, const automaton &rhs)
The infiltration of automata lhs and rhs.
automaton lweight(const weight &w, const automaton &aut, const std::string &algo="auto")
The left-multiplication of an automaton with w as weight.
bool is_cycle_ambiguous(const automaton &aut)
Whether the automaton is cycle-ambiguous.
value_impl< detail::expansion_tag > expansion
expansion to_expansion(const expression &exp)
First order development of a exp.
automaton prefix(const automaton &aut)
Create a prefix automaton from aut.
unsigned star_height(const expression &rs)
Star height of an expression.
automaton cotrie(const polynomial &p)
A reversed trie-like automaton (multiple initial states, single final state) automaton to accept p...
automaton coaccessible(const automaton &aut)
The coaccessible subautomaton of aut.
expression expand(const expression &e)
Distribute product over addition recursively under the starred subexpressions and group the equal mon...
polynomial read_polynomial(const context &ctx, std::istream &is)
Read a polynomial from a stream.
automaton component(const automaton &aut, unsigned num)
The automaton of a strongly connected component.
std::size_t num_components(const automaton &aut)
The number of strongly connected components.
polynomial lgcd(const polynomial &lhs, const polynomial &rhs)
Left greatest common divisor of two polynomials (lhs \ rhs).
polynomial split(const expression &exp)
Break exp.
automaton realtime(const automaton &aut)
Create the realtime automaton (letterized and proper).
bool has_bounded_lag(const automaton &aut)
Whether the transducer has bounded lag.
automaton synchronize(const automaton &aut)
Create a synchronized transducer from aut.
automaton quotkbaseb(const context &ctx, unsigned divisor, unsigned base)
A transducer that computes the quotient of the division of a word n by k in base b iff k|n...
automaton shuffle(const automaton &lhs, const automaton &rhs)
The shuffle product of automata lhs and rhs.
automaton project(const automaton &aut, unsigned tape)
Keep a single tape from a multiple-tape automaton.
weight constant_term(const expression &e)
The weight associated to the empty word in e.
automaton derived_term(const expression &exp, const std::string &algo="auto")
The derived-term automaton of exp.
bool is_useless(const automaton &aut)
Whether has no useful state.
automaton complement(const automaton &aut)
The complement of aut.
bool less_than(const expression &lhs, const expression &rhs)
Ordering between expressions.
expression random_expression(const context &ctx, const std::string ¶m, identities ids)
Produce a random expression.
automaton accessible(const automaton &aut)
The accessible subautomaton of aut.
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.
automaton push_weights(const automaton &aut)
The weight pushing automaton of aut.
std::ostream & info(const automaton &aut, std::ostream &out=std::cout, bool detailed=false)
Output various facts about an automaton.
automaton ladybird(const context &ctx, unsigned n)
The ladybird automaton with n states.
automaton copy(const automaton &aut)
A copy of aut.
automaton cerny(const context &ctx, unsigned num_states)
Produce a Černý automaton of num_states states.
expression read_expression(const context &ctx, identities ids, std::istream &is, const std::string &format="default")
Read an expression from a stream.
automaton rweight(const automaton &aut, const weight &w, const std::string &algo="auto")
The right-mult automaton with w as weight.
context join(const context &lhs, const context &rhs)
The join between two contexts, i.e., their lowest common supertype.
bool is_out_sorted(const automaton &aut)
Whether the outgoing transitions of each state have increasing labels.
bool are_equivalent(const automaton &lhs, const automaton &rhs)
Whether compute the same series.
automaton trie(const polynomial &p)
A trie-like automaton (single initial state, multiple final states) to accept p.
weight read_weight(const context &ctx, std::istream &is)
Read a weight from a stream.
automaton insplit(const automaton &aut, bool lazy=false)
Split automaton on the incoming transition.
bool has_lightening_cycle(const automaton &aut)
Whether the automaton has a cycle with lightening weight.
label synchronizing_word(const automaton &aut, const std::string &algo="greedy")
A synchronizing word, or raise if there is none.
automaton focus(const automaton &aut, unsigned tape)
Focus on a specific tape of a tupleset automaton.
static identities ids(const driver &d)
Get the identities of the driver.
automaton condense(const automaton &aut)
The condensation of aut such that each state is a strongly connected component.
label read_label(const context &ctx, std::istream &is, const std::string &format="default")
Read a label from a stream.
automaton read_automaton(std::istream &is, const std::string &format="default", bool strip=true)
Read an automaton from a stream.
bool is_complete(const automaton &aut)
Whether aut is complete.
automaton rdivide(const automaton &lhs, const automaton &rhs)
Right-division of two automata (lhs / rhs).
expression star_normal_form(const expression &e)
A normalized form where star is applied only to proper expressions.
expression expression_one(const context &c, identities ids)
The expression for \e.
value_impl< detail::expression_tag > expression
automaton strip(const automaton &a)
The automaton in a with its metadata layers removed.
label ambiguous_word(const automaton &aut)
An ambiguous word, or raise if there is none.
automaton de_bruijn(const context &ctx, unsigned n)
A simple NFA for (a+b)*a(a+b)^n.
automaton random_automaton_deterministic(const context &ctx, unsigned num_states)
Produce a random deterministic automaton.
bool is_costandard(const automaton &aut)
Whether is costandard (unique final state, with weight one, no outcoming transition).
void set_format(std::ostream &out, const std::string &format)
Specify the output format for out.
polynomial lightest(const automaton &aut, unsigned num=1, const std::string &algo="auto")
The approximated behavior of an automaton with smallest weights.
weightset_mixin< detail::r_impl > r
bool is_letterized(const automaton &aut)
Whether aut is letterized.