7 #include <boost/optional.hpp> 9 #include <vcsn/algos/fwd.hh> 11 #include <vcsn/dyn/fwd.hh> 32 automaton
add(
const automaton& lhs,
const automaton& rhs,
33 const std::string& algo =
"auto");
51 bool are_equal(
const automaton& lhs,
const automaton& rhs);
71 automaton
cerny(
const context&
ctx,
unsigned num_states);
86 const std::string& algo =
"auto");
95 const std::string& algo =
"auto");
101 int compare(
const automaton& lhs,
const automaton& rhs);
143 automaton
complete(
const automaton& aut);
149 automaton
component(
const automaton& aut,
unsigned num);
156 automaton
compose(
const automaton& lhs,
const automaton& rhs,
160 context
compose(
const context& lhs,
const context& rhs);
181 automaton
condense(
const automaton& aut);
189 automaton
conjunction(
const automaton& lhs,
const automaton& rhs,
197 automaton
conjunction(
const std::vector<automaton>& as,
201 automaton
conjunction(
const automaton& aut,
unsigned n);
213 automaton
conjugate(
const automaton& aut);
234 automaton
copy(
const automaton& aut);
237 automaton
copy(
const automaton& aut,
const context&
ctx);
259 automaton
cotrie(
const context&
ctx, std::istream& is,
260 const std::string&
format =
"default");
278 bool breaking =
false);
290 const std::string& algo =
"auto");
302 const std::string& algo =
"auto");
313 automaton
difference(
const automaton& lhs,
const automaton& rhs);
320 automaton
divkbaseb(
const context&
ctx,
unsigned divisor,
unsigned base);
324 const std::vector<unsigned>& f);
347 automaton
factor(
const automaton& aut);
350 automaton
filter(
const automaton& aut,
const std::vector<unsigned>& ss);
353 automaton
focus(
const automaton& aut,
unsigned tape);
378 automaton
infiltrate(
const automaton& lhs,
const automaton& rhs);
382 automaton
infiltrate(
const std::vector<automaton>& as);
397 std::ostream&
info(
const automaton& aut, std::ostream&
out = std::cout,
398 unsigned details = 2);
413 automaton
insplit(
const automaton& aut,
bool lazy =
false);
448 bool is_empty(
const automaton& aut);
496 bool is_trim(
const automaton& aut);
509 context
join(
const context& lhs,
const context& rhs);
512 automaton
ladybird(
const context&
ctx,
unsigned n);
515 automaton
ldivide(
const automaton& lhs,
const automaton& rhs);
547 const std::string& algo =
"auto");
559 bool less_than(
const automaton& lhs,
const automaton& rhs);
565 automaton
letterize(
const automaton& aut);
578 automaton
lift(
const automaton& aut,
579 const std::vector<unsigned>& tapes = {},
591 const std::string& algo =
"auto");
596 const std::string& algo =
"auto");
604 const std::string&
format =
"default",
620 const std::string&
format =
"default");
624 const std::string& format =
"default");
637 const std::string& format =
"default");
650 automaton
multiply(
const automaton& lhs,
const automaton& rhs,
651 const std::string& algo =
"auto");
667 automaton
multiply(
const automaton& aut,
int min,
int max = -2,
668 const std::string& algo =
"auto");
712 automaton
minimize(
const automaton& aut,
713 const std::string& algo =
"auto");
719 automaton
normalize(
const automaton& aut);
729 std::size_t
num_tapes(
const context& ctx);
732 automaton
pair(
const automaton& aut,
bool keep_initials =
false);
741 automaton
prefix(
const automaton& aut);
757 std::ostream&
print(
const automaton& aut, std::ostream&
out = std::cout,
758 const std::string& format =
"default");
761 std::ostream&
print(
const context& c, std::ostream&
out = std::cout,
762 const std::string& format =
"default");
766 const std::string& format =
"default");
770 const std::string& format =
"default");
773 std::ostream&
print(
const label& l, std::ostream&
out = std::cout,
774 const std::string& format =
"default");
778 const std::string& format =
"default");
781 std::ostream&
print(
const weight& w, std::ostream&
out = std::cout,
782 const std::string& format =
"default");
786 automaton
quotkbaseb(
const context& ctx,
unsigned divisor,
unsigned base);
789 void set_format(std::ostream&
out,
const std::string& format);
795 automaton
project(
const automaton& aut,
unsigned tape);
798 context
project(
const context& ctx,
unsigned tape);
824 automaton
proper(
const automaton& aut,
826 bool prune =
true,
const std::string& algo =
"auto");
861 unsigned num_initial = 1,
862 unsigned num_final = 1,
863 boost::optional<unsigned> max_labels = {},
864 float loop_chance = 0.0,
865 const std::string& weights =
"");
874 unsigned num_states);
889 const std::string& param =
"+, ., *=.2, w., .w, length=10",
903 automaton
rdivide(
const automaton& lhs,
const automaton& rhs);
923 const std::string& format =
"default",
936 const std::string& format =
"default",
945 const std::string& format =
"default");
960 automaton
realtime(
const automaton& aut);
963 automaton
reduce(
const automaton& aut);
983 const std::string& algo =
"auto");
999 automaton
scc(
const automaton& aut,
const std::string& algo =
"auto");
1007 boost::optional<unsigned> num = {},
1008 boost::optional<unsigned> len = {});
1012 automaton
shuffle(
const automaton& lhs,
const automaton& rhs);
1016 automaton
shuffle(
const std::vector<automaton>& as);
1026 automaton
sort(
const automaton& a);
1035 automaton
standard(
const automaton& a);
1050 automaton
star(
const automaton& aut,
const std::string& algo =
"auto");
1062 automaton
strip(
const automaton& a);
1065 automaton
suffix(
const automaton& aut);
1071 automaton
subword(
const automaton& aut);
1078 const std::string& algo =
"greedy");
1099 const std::string& algo =
"auto");
1113 const std::string& algo =
"auto");
1135 bool accept =
true);
1158 automaton
trie(
const context& ctx, std::istream& is,
1159 const std::string& format =
"default");
1162 automaton
trim(
const automaton& aut);
1168 automaton
tuple(
const automaton& lhs,
const automaton& rhs);
1173 automaton
tuple(
const std::vector<automaton>& as);
1176 context
tuple(
const context& lhs,
const context& rhs);
1181 context
tuple(
const std::vector<context>& ctxs);
1196 std::string
type(
const automaton& a);
1199 automaton
u(
const context& ctx,
unsigned n);
1202 automaton
universal(
const automaton& aut);
1218 automaton
zpc(
const expression& exp,
const std::string& algo =
"auto");
1221 std::ostream&
operator<<(std::ostream& o,
const automaton& a);
1224 std::ostream&
operator<<(std::ostream& o,
const context& c);
value_impl< detail::expansion_tag > expansion
expansion to_expansion(const expression &exp)
First order development of a exp.
expression expression_one(const context &c, identities ids)
The expression for \\e.
automaton conjugate(const automaton &aut)
The conjugate of aut.
automaton eliminate_state(const automaton &aut, int s=-1)
The LAO automaton aut with state s removed.
bool is_normalized(const automaton &aut)
Whether is normalized (in the Thompson sense), i.e., standard and co-standard.
std::string configuration(const std::string &key)
Access a configuration value.
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 tuple(const automaton &lhs, const automaton &rhs)
Build a two-tape automaton from two automata.
polynomial make_polynomial(const context &ctx, const std::string &s)
Build a polynomial from a string.
weightset_mixin< detail::r_impl > r
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.
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 project(const automaton &aut, unsigned tape)
Keep a single tape from a multiple-tape automaton.
bool are_equal(const automaton &lhs, const automaton &rhs)
Whether are the same automaton.
weight constant_term(const expression &e)
The weight associated to the empty word in e.
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 derived_term(const expression &exp, const std::string &algo="auto")
The derived-term automaton of exp.
automaton make_automaton(const std::string &data, const std::string &format="default", bool strip=true)
Read an automaton from a string.
bool is_useless(const automaton &aut)
Whether has no useful state.
automaton complement(const automaton &aut)
The complement of aut.
automaton normalize(const automaton &aut)
Normalize automaton aut.
weight random_weight(const context &ctx, const std::string ¶m)
A random weight.
automaton cominimize(const automaton &aut, const std::string &algo="auto")
The cominimized automaton.
bool less_than(const automaton &lhs, const automaton &rhs)
Ordering between automata.
context make_word_context(const context &ctx)
The context for words.
expansion denormalize(const expansion &x)
Denormalize expansion x.
automaton sort(const automaton &a)
A copy of a with normalized state numbers.
bool is_partial_identity(const automaton &aut)
Whether aut realizes a partial identity.
automaton compose(const automaton &lhs, const automaton &rhs, bool lazy=false)
The composition of transducers lhs and rhs.
automaton push_weights(const automaton &aut)
The weight pushing automaton of aut.
expression to_expression(const automaton &aut, identities ids={}, const std::string &algo="auto")
An expression denoting the language of aut.
automaton infiltrate(const automaton &lhs, const automaton &rhs)
The infiltration of automata lhs and rhs.
context make_context(const std::string &name)
Build a context from its name.
automaton lweight(const weight &w, const automaton &aut, const std::string &algo="auto")
The left-multiplication of an automaton with w as weight.
expression make_expression(const context &ctx, const std::string &s, identities ids={}, const std::string &format="default")
Read an expression from a stream.
::vcsn::direction direction
Direction for proper on automata.
bool is_standard(const automaton &aut)
Whether is standard (unique initial state, with weight one, no incoming transition).
automaton realtime(const automaton &aut)
Create the realtime automaton (letterized and proper).
weight weight_one(const context &c)
The weight one.
automaton focus(const automaton &aut, unsigned tape)
Focus on a specific tape of a tupleset automaton.
expression star_normal_form(const expression &e)
A normalized form where star is applied only to proper expressions.
expression read_expression(const context &ctx, identities ids, std::istream &is, const std::string &format="default", const location &loc=location{})
Read an expression from a stream.
automaton read_automaton(std::istream &is, const std::string &format="default", bool strip=true, const location &loc=location{})
Read an automaton from a stream.
bool is_realtime(const automaton &aut)
Whether has no spontaneous transition, and is letterized.
automaton universal(const automaton &aut)
The universal automaton of aut.
automaton suffix(const automaton &aut)
Create a suffix automaton from aut.
expression transposition(const expression &r)
Add the transposition operator to r.
automaton levenshtein(const context &ls)
The transducer representing the Levenshtein distance.
automaton copy(const automaton &aut)
A copy of aut.
automaton trie(const polynomial &p)
A trie-like automaton (single initial state, multiple final states) to accept p.
std::string get_format(std::ostream &out)
Get the output format for out.
value_impl< detail::polynomial_tag > polynomial
bool is_trim(const automaton &aut)
Whether has no useless state.
bool are_equivalent(const automaton &lhs, const automaton &rhs)
Whether compute the same series.
automaton rweight(const automaton &aut, const weight &w, const std::string &algo="auto")
The right-mult automaton with w as weight.
bool is_cycle_ambiguous(const automaton &aut)
Whether the automaton is cycle-ambiguous.
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.
automaton cotrie(const polynomial &p)
A reversed trie-like automaton (multiple initial states, single final state) automaton to accept p...
bool is_coaccessible(const automaton &aut)
Whether aut is coaccessible.
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.
std::size_t num_tapes(const context &ctx)
The number of input tapes.
bool has_lightening_cycle(const automaton &aut)
Whether the automaton has a cycle with lightening weight.
expression expand(const expression &e)
Distribute product over addition recursively under the starred subexpressions and group the equal mon...
bool has_bounded_lag(const automaton &aut)
Whether the transducer has bounded lag.
vcsn::rat::location location
Pairs of positions in a file/stream.
bool is_normal(const expansion &x)
Whether has no polynomial for the empty word.
bool is_synchronizing(const automaton &aut)
Whether is synchronizing.
label make_label(const context &ctx, const std::string &s, const std::string &format="default")
Build a label from a string.
automaton condense(const automaton &aut)
The condensation of aut such that each state is a strongly connected component.
automaton rdivide(const automaton &lhs, const automaton &rhs)
Right-division of two automata (lhs / rhs).
std::size_t num_components(const automaton &aut)
The number of strongly connected components.
bool is_functional(const automaton &aut)
Whether aut is functional.
void set_format(std::ostream &out, const std::string &format)
Specify the output format for out.
bool is_synchronized(const automaton &aut)
Whether is synchronized.
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 standard(const automaton &a)
A standardized a.
bool is_ambiguous(const automaton &aut)
Whether aut is ambiguous.
weight weight_zero(const context &c)
The weight zero.
automaton conjunction(const automaton &lhs, const automaton &rhs, bool lazy=false)
The conjunction (aka synchronized product) of automata.
label word
The type of a word.
word synchronizing_word(const automaton &aut, const std::string &algo="greedy")
A synchronizing word, or raise if there is none.
expression random_expression(const context &ctx, const std::string ¶m="+, ., *=.2, w., .w, length=10", identities ids={})
A random expression.
automaton trim(const automaton &aut)
The trim subautomaton of aut.
expression concatenate(const expression &lhs, const expression &rhs)
Concatenate two expressions.
polynomial shortest(const automaton &aut, boost::optional< unsigned > num={}, boost::optional< unsigned > len={})
The approximated behavior of an automaton.
std::ostream & operator<<(std::ostream &o, const automaton &a)
Output automaton a on o.
weight weight_series(const automaton &aut)
Compute weight of the series.
automaton delay_automaton(const automaton &a)
The automaton with the delay of each state.
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.
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 thompson(const expression &e)
The Thompson automaton of e.
automaton factor(const automaton &aut)
Create a factor automaton from aut.
automaton component(const automaton &aut, unsigned num)
The automaton of a strongly connected component.
context context_of(const automaton &a)
The context of this automaton.
bool is_accessible(const automaton &aut)
Whether aut is accessible.
std::string type(const automaton &a)
The implementation type of a.
automaton lightest_automaton(const automaton &aut, unsigned num=1, const std::string &algo="auto")
The shortest path automaton using the given algorithm.
automaton prefix(const automaton &aut)
Create a prefix automaton from aut.
std::set< std::pair< std::string, std::string > > letter_class_t
A set of letter ranges.
identities identities_of(const expression &exp)
The identities of expression exp.
automaton transpose(automaton &aut)
Transpose aut.
automaton star(const automaton &aut, const std::string &algo="auto")
Star of an automaton.
automaton shuffle(const automaton &lhs, const automaton &rhs)
The shuffle product of automata lhs and rhs.
bool is_complete(const automaton &aut)
Whether aut is complete.
automaton strip(const automaton &a)
The automaton in a with its metadata layers removed.
bool is_deterministic(const automaton &aut)
Whether aut is deterministic.
automaton complete(const automaton &aut)
A completed copy of aut.
polynomial lightest(const automaton &aut, unsigned num=1, const std::string &algo="auto")
The approximated behavior of an automaton with smallest weights.
automaton ladybird(const context &ctx, unsigned n)
The ladybird automaton with n states.
automaton zpc(const expression &exp, const std::string &algo="auto")
The ZPC automaton of exp.
automaton difference(const automaton &lhs, const automaton &rhs)
An automaton whose behavior is that of lhs on words not accepted by rhs.
automaton partial_identity(const automaton &aut)
Create a partial identity transducer from aut.
weight make_weight(const context &ctx, const std::string &s)
Build a weight from a string.
automaton proper(const automaton &aut, direction dir=direction::backward, bool prune=true, const std::string &algo="auto")
An equivalent automaton without spontaneous transitions.
automaton multiply(const automaton &lhs, const automaton &rhs, const std::string &algo="auto")
Multiply (concatenate) two automata.
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.
bool has_twins_property(const automaton &aut)
Whether the automaton has the twins property.
automaton costandard(const automaton &a)
A co-standardized a.
polynomial derivation(const expression &exp, const label &lbl, bool breaking=false)
Derive exp with respect to s.
bool are_isomorphic(const automaton &lhs, const automaton &rhs)
Whether there exists an isomorphism between the states of lhs and those of rhs.
label make_word(const context &ctx, const std::string &s, const std::string &format="default")
Build a word from a string.
bool is_proper(const automaton &aut)
Whether has no spontaneous transition.
value_impl< detail::label_tag > label
automaton pair(const automaton &aut, bool keep_initials=false)
Build the pair automaton of the given automaton.
value_impl< detail::expression_tag > expression
automaton coaccessible(const automaton &aut)
The coaccessible subautomaton of aut.
automaton reduce(const automaton &aut)
Reduce aut.
bool is_valid(const automaton &e)
Whether automaton is valid (epsilon-cycles converge).
unsigned star_height(const expression &rs)
Star height of an expression.
automaton u(const context &ctx, unsigned n)
The Brzozowski universal witness.
automaton random_automaton_deterministic(const context &ctx, unsigned num_states)
A random deterministic automaton.
std::string format(const Value &v, const std::string &format="default")
static identities ids(const driver &d)
Get the identities of the driver.
::vcsn::rat::identities identities
Sets of identities on expressions.
automaton letterize(const automaton &aut)
The automaton with letter transitions instead of words.
std::ostream & print(const automaton &aut, std::ostream &out=std::cout, const std::string &format="default")
Print automaton a on out using format format.
weight evaluate(const automaton &aut, const word &l)
Evaluate l on aut.
automaton synchronize(const automaton &aut)
Create a synchronized transducer from aut.
expression name(const expression &exp, const std::string &name)
Name an expression.
std::ostream & info(const automaton &aut, std::ostream &out=std::cout, unsigned details=2)
Output various facts about an automaton.
automaton de_bruijn(const context &ctx, unsigned n)
A simple NFA for (a+b)*a(a+b)^n.
automaton inductive(const expression &e, const std::string &algo="auto")
The inductive translation of e in an automaton.
bool is_letterized(const automaton &aut)
Whether aut is letterized.
automaton determinize(const automaton &aut, const std::string &algo="auto")
The determinized automaton.
automaton codeterminize(const automaton &aut, const std::string &algo="auto")
The codeterminized automaton.
bool is_costandard(const automaton &aut)
Whether is costandard (unique final state, with weight one, no outcoming transition).
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, const std::string &weights="")
A random automaton.
bool is_synchronized_by(const automaton &aut, const word &word)
Whether the word synchronizes aut.
automaton_editor * make_automaton_editor(const context &ctx)
Build an automaton editor from its context.
automaton subword(const automaton &aut)
Create a subword automaton from aut.
automaton accessible(const automaton &aut)
The accessible subautomaton of aut.
bool is_out_sorted(const automaton &aut)
Whether the outgoing transitions of each state have increasing labels.
word ambiguous_word(const automaton &aut)
An ambiguous word, or raise if there is none.
automaton ldivide(const automaton &lhs, const automaton &rhs)
Left-division of two automata (lhs \ rhs).
int compare(const automaton &lhs, const automaton &rhs)
Three-way comparison between automata.
value_impl< detail::weight_tag > weight
automaton cerny(const context &ctx, unsigned num_states)
Produce a Černý automaton of num_states states.
expression expression_zero(const context &c, identities ids)
The expression for \\z.
context join(const context &lhs, const context &rhs)
The join between two contexts, i.e., their lowest common supertype.
automaton add(const automaton &lhs, const automaton &rhs, const std::string &algo="auto")
Sum of two automata.
bool is_empty(const automaton &aut)
Whether has no state.
polynomial read_polynomial(const context &ctx, std::istream &is)
Read a polynomial from a stream.
auto out(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions leaving state s.