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);
271 automaton
factor(
const automaton& aut);
274 automaton
filter(
const automaton& aut,
const std::vector<unsigned>& ss);
277 automaton
focus(
const automaton& aut,
unsigned tape);
302 automaton
infiltrate(
const automaton& lhs,
const automaton& rhs);
306 automaton
infiltrate(
const std::vector<automaton>& as);
318 std::ostream&
info(
const automaton& aut, std::ostream&
out = std::cout,
319 unsigned details = 2);
334 automaton
insplit(
const automaton& aut,
bool lazy =
false);
369 bool is_empty(
const automaton& aut);
414 bool is_trim(
const automaton& aut);
427 context
join(
const context& lhs,
const context& rhs);
430 automaton
ladybird(
const context&
ctx,
unsigned n);
433 automaton
ldivide(
const automaton& lhs,
const automaton& rhs);
465 const std::string& algo =
"auto");
480 automaton
letterize(
const automaton& aut);
493 automaton
lift(
const automaton& aut,
494 const std::vector<unsigned>& tapes = {},
495 identities
ids = {});
506 const std::string& algo =
"auto");
511 const std::string& algo =
"auto");
533 automaton
multiply(
const automaton& lhs,
const automaton& rhs,
534 const std::string& algo =
"auto");
550 automaton
multiply(
const automaton& aut,
int min,
int max = -2,
551 const std::string& algo =
"auto");
595 automaton
minimize(
const automaton& aut,
596 const std::string& algo =
"auto");
599 automaton
normalize(
const automaton& aut);
609 automaton
pair(
const automaton& aut,
bool keep_initials =
false);
618 automaton
prefix(
const automaton& aut);
634 std::ostream&
print(
const automaton& aut, std::ostream&
out = std::cout,
635 const std::string& format =
"default");
638 std::ostream&
print(
const context& c, std::ostream&
out = std::cout,
639 const std::string& format =
"default");
643 const std::string& format =
"default");
647 const std::string& format =
"default");
650 std::ostream&
print(
const label& l, std::ostream&
out = std::cout,
651 const std::string& format =
"default");
655 const std::string& format =
"default");
658 std::ostream&
print(
const weight& w, std::ostream&
out = std::cout,
659 const std::string& format =
"default");
663 automaton
quotkbaseb(
const context&
ctx,
unsigned divisor,
unsigned base);
666 void set_format(std::ostream&
out,
const std::string& format);
672 automaton
project(
const automaton& aut,
unsigned tape);
675 context
project(
const context&
ctx,
unsigned tape);
701 automaton
proper(
const automaton& aut,
703 bool prune =
true,
const std::string& algo =
"auto");
738 unsigned num_initial = 1,
739 unsigned num_final = 1,
740 boost::optional<unsigned> max_labels = {},
741 float loop_chance = 0.0,
742 const std::string& weights =
"");
751 unsigned num_states);
766 const std::string& param =
"+, ., *=.2, w., .w, length=10",
767 identities ids = {});
780 automaton
rdivide(
const automaton& lhs,
const automaton& rhs);
797 const std::string& format =
"default",
808 const std::string& format =
"default");
816 const std::string& format =
"default");
831 automaton
realtime(
const automaton& aut);
834 automaton
reduce(
const automaton& aut);
854 const std::string& algo =
"auto");
870 automaton
scc(
const automaton& aut,
const std::string& algo =
"auto");
878 boost::optional<unsigned> num = {},
879 boost::optional<unsigned> len = {});
883 automaton
shuffle(
const automaton& lhs,
const automaton& rhs);
887 automaton
shuffle(
const std::vector<automaton>& as);
894 automaton
sort(
const automaton& a);
903 automaton
standard(
const automaton& a);
918 automaton
star(
const automaton& aut,
const std::string& algo =
"auto");
930 automaton
strip(
const automaton& a);
933 automaton
suffix(
const automaton& aut);
939 automaton
subword(
const automaton& aut);
951 automaton
add(
const automaton& lhs,
const automaton& rhs,
952 const std::string& algo =
"auto");
971 const std::string& algo =
"greedy");
992 const std::string& algo =
"auto");
1005 identities ids = {},
1006 const std::string& algo =
"auto");
1025 bool accept =
true);
1048 automaton
trie(
const context& ctx, std::istream& is,
1049 const std::string& format =
"default");
1052 automaton
trim(
const automaton& aut);
1058 automaton
tuple(
const automaton& lhs,
const automaton& rhs);
1063 automaton
tuple(
const std::vector<automaton>& as);
1066 context
tuple(
const context& lhs,
const context& rhs);
1071 context
tuple(
const std::vector<context>& ctxs);
1086 std::string
type(
const automaton& a);
1089 automaton
u(
const context& ctx,
unsigned n);
1092 automaton
universal(
const automaton& aut);
1108 automaton
zpc(
const expression& exp,
const std::string& algo =
"auto");
1111 std::ostream&
operator<<(std::ostream& o,
const automaton& a);
1114 std::ostream&
operator<<(std::ostream& o,
const context& c);
bool is_valid(const automaton &e)
Whether automaton is valid (epsilon-cycles converge).
value_impl< detail::expansion_tag > expansion
expansion to_expansion(const expression &exp)
First order development of a exp.
automaton eliminate_state(const automaton &aut, int s=-1)
The LAO automaton aut with state s removed.
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 condense(const automaton &aut)
The condensation of aut such that each state is a strongly connected component.
automaton tuple(const automaton &lhs, const automaton &rhs)
Build a two-tape automaton from two automata.
weight evaluate(const automaton &aut, const word &l)
Evaluate l on aut.
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).
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.
automaton zpc(const expression &exp, const std::string &algo="auto")
The ZPC automaton of exp.
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...
expression transposition(const expression &r)
Add the transposition operator to r.
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).
context make_word_context(const context &ctx)
The context for words.
word ambiguous_word(const automaton &aut)
An ambiguous word, or raise if there is none.
bool less_than(const expression &lhs, const expression &rhs)
Ordering between expressions.
static identities ids(const driver &d)
Get the identities of the driver.
expression random_expression(const context &ctx, const std::string ¶m="+, ., *=.2, w., .w, length=10", identities ids={})
A random expression.
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.
expression read_expression(const context &ctx, identities ids, std::istream &is, const std::string &format="default")
Read an expression from a stream.
value_impl< detail::weight_tag > weight
context join(const context &lhs, const context &rhs)
The join between two contexts, i.e., their lowest common supertype.
bool is_coaccessible(const automaton &aut)
Whether aut is coaccessible.
bool are_isomorphic(const automaton &lhs, const automaton &rhs)
Whether there exists an isomorphism between the states of lhs and those of rhs.
expression expression_zero(const context &c, identities ids)
The expression for \\z.
automaton cotrie(const polynomial &p)
A reversed trie-like automaton (multiple initial states, single final state) automaton to accept p...
polynomial read_polynomial(const context &ctx, std::istream &is)
Read a polynomial from a stream.
automaton coaccessible(const automaton &aut)
The coaccessible subautomaton of aut.
automaton focus(const automaton &aut, unsigned tape)
Focus on a specific tape of a tupleset automaton.
polynomial split(const expression &exp)
Break exp.
bool is_functional(const automaton &aut)
Whether aut is functional.
bool is_normalized(const automaton &aut)
Whether is normalized (in the Thompson sense), i.e., standard and co-standard.
automaton read_automaton(std::istream &is, const std::string &format="default", bool strip=true)
Read an automaton from a stream.
label read_label(const context &ctx, std::istream &is, const std::string &format="default")
Read a label from a stream.
automaton shuffle(const automaton &lhs, const automaton &rhs)
The shuffle product of automata lhs and rhs.
bool is_synchronized(const automaton &aut)
Whether is synchronized.
automaton rdivide(const automaton &lhs, const automaton &rhs)
Right-division of two automata (lhs / rhs).
automaton normalize(const automaton &aut)
Normalize automaton aut.
weight random_weight(const context &ctx, const std::string ¶m)
A random weight.
automaton strip(const automaton &a)
The automaton in a with its metadata layers removed.
automaton de_bruijn(const context &ctx, unsigned n)
A simple NFA for (a+b)*a(a+b)^n.
automaton derived_term(const expression &exp, const std::string &algo="auto")
The derived-term automaton of exp.
weightset_mixin< detail::r_impl > r
automaton complement(const automaton &aut)
The complement of aut.
word synchronizing_word(const automaton &aut, const std::string &algo="greedy")
A synchronizing word, or raise if there is none.
automaton proper(const automaton &aut, direction dir=direction::backward, bool prune=true, const std::string &algo="auto")
An equivalent automaton without spontaneous transitions.
automaton copy(const automaton &aut)
A copy of aut.
std::string get_format(std::ostream &out)
Get the output format for out.
automaton ldivide(const automaton &lhs, const automaton &rhs)
Left-division of two automata (lhs \ rhs).
automaton cerny(const context &ctx, unsigned num_states)
Produce a Černý automaton of num_states states.
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.
automaton compose(const automaton &lhs, const automaton &rhs, bool lazy=false)
The composition of transducers lhs and rhs.
bool is_cycle_ambiguous(const automaton &aut)
Whether the automaton is cycle-ambiguous.
automaton insplit(const automaton &aut, bool lazy=false)
Split automaton on the incoming transition.
context make_context(const std::string &name)
Build a context from its name.
automaton factor(const automaton &aut)
Create a factor automaton from aut.
weight weight_series(const automaton &aut)
Compute weight of the series.
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 thompson(const expression &e)
The Thompson automaton of e.
bool has_bounded_lag(const automaton &aut)
Whether the transducer has bounded lag.
automaton realtime(const automaton &aut)
Create the realtime automaton (letterized and proper).
automaton conjugate(const automaton &aut)
The conjugate of aut.
std::string type(const automaton &a)
The implementation type of a.
bool is_complete(const automaton &aut)
Whether aut is complete.
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 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...
auto out(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions leaving state s.
bool is_useless(const automaton &aut)
Whether has no useful state.
automaton suffix(const automaton &aut)
Create a suffix automaton from aut.
automaton conjunction(const automaton &lhs, const automaton &rhs, bool lazy=false)
The conjunction (aka synchronized product) of automata.
bool is_deterministic(const automaton &aut)
Whether aut is deterministic.
weight weight_zero(const context &c)
The weight zero.
automaton ladybird(const context &ctx, unsigned n)
The ladybird automaton with n states.
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.
weight read_weight(const context &ctx, std::istream &is)
Read a weight from a stream.
std::set< std::pair< std::string, std::string >> letter_class_t
A set of letter ranges.
polynomial shortest(const automaton &aut, boost::optional< unsigned > num={}, boost::optional< unsigned > len={})
The approximated behavior of an automaton.
automaton trie(const polynomial &p)
A trie-like automaton (single initial state, multiple final states) to accept p.
automaton infiltrate(const automaton &lhs, const automaton &rhs)
The infiltration of automata lhs and rhs.
std::ostream & operator<<(std::ostream &o, const automaton &a)
Output automaton a on o.
automaton lweight(const weight &w, const automaton &aut, const std::string &algo="auto")
The left-multiplication of an automaton with w as weight.
std::size_t num_tapes(const context &ctx)
The number of input tapes.
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.
expression expand(const expression &e)
Distribute product over addition recursively under the starred subexpressions and group the equal mon...
automaton costandard(const automaton &a)
A co-standardized a.
bool is_standard(const automaton &aut)
Whether is standard (unique initial state, with weight one, no incoming transition).
automaton component(const automaton &aut, unsigned num)
The automaton of a strongly connected component.
bool is_accessible(const automaton &aut)
Whether aut is accessible.
automaton lightest_automaton(const automaton &aut, unsigned num=1, const std::string &algo="auto")
The shortest path automaton using the given algorithm.
bool is_synchronizing(const automaton &aut)
Whether is synchronizing.
expression star_normal_form(const expression &e)
A normalized form where star is applied only to proper expressions.
identities identities_of(const expression &exp)
The identities of expression exp.
expression expression_one(const context &c, identities ids)
The expression for \\e.
automaton filter(const automaton &aut, const std::vector< unsigned > &ss)
The subautomaton based on aut, with only states in ss visible.
automaton letterize(const automaton &aut)
The automaton with letter transitions instead of words.
automaton star(const automaton &aut, const std::string &algo="auto")
Star of an automaton.
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.
bool is_letterized(const automaton &aut)
Whether aut is letterized.
polynomial lightest(const automaton &aut, unsigned num=1, const std::string &algo="auto")
The approximated behavior of an automaton with smallest weights.
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.
automaton levenshtein(const context &ls)
The transducer representing the Levenshtein distance.
automaton cominimize(const automaton &aut, const std::string &algo="auto")
The cominimized automaton.
expression concatenate(const expression &lhs, const expression &rhs)
Concatenate two expressions.
bool is_out_sorted(const automaton &aut)
Whether the outgoing transitions of each state have increasing labels.
automaton multiply(const automaton &lhs, const automaton &rhs, const std::string &algo="auto")
Multiply (concatenate) two automata.
automaton trim(const automaton &aut)
The trim subautomaton of aut.
automaton_editor * make_automaton_editor(const context &ctx)
Build an automatonset from its context.
automaton subword(const automaton &aut)
Create a subword automaton from aut.
polynomial derivation(const expression &exp, const label &lbl, bool breaking=false)
Derive exp with respect to s.
automaton add(const automaton &lhs, const automaton &rhs, const std::string &algo="auto")
Sum of two automata.
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.
value_impl< detail::label_tag > label
value_impl< detail::expression_tag > expression
automaton prefix(const automaton &aut)
Create a prefix automaton from aut.
unsigned star_height(const expression &rs)
Star height of an expression.
automaton transpose(automaton &aut)
Transpose aut.
automaton complete(const automaton &aut)
A completed copy of aut.
void set_format(std::ostream &out, const std::string &format)
Specify the output format for out.
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 synchronize(const automaton &aut)
Create a synchronized transducer from aut.
std::ostream & info(const automaton &aut, std::ostream &out=std::cout, unsigned details=2)
Output various facts about an automaton.
automaton standard(const automaton &a)
A standardized a.
bool is_ambiguous(const automaton &aut)
Whether aut is ambiguous.
automaton inductive(const expression &e, const std::string &algo="auto")
The inductive translation of e in an automaton.
label word
The type of a word.
automaton universal(const automaton &aut)
The universal automaton of aut.
bool is_partial_identity(const automaton &aut)
Whether aut realizes a partial identity.
bool has_twins_property(const automaton &aut)
Whether the automaton has the twins property.
automaton accessible(const automaton &aut)
The accessible subautomaton of aut.
value_impl< detail::polynomial_tag > polynomial
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.
automaton sort(const automaton &a)
A copy of a with normalized state numbers.
automaton delay_automaton(const automaton &a)
The automaton with the delay of each state.
bool is_trim(const automaton &aut)
Whether has no useless state.
bool is_proper(const automaton &aut)
Whether has no spontaneous transition.
automaton pair(const automaton &aut, bool keep_initials=false)
Build the pair automaton of the given automaton.
bool is_empty(const automaton &aut)
Whether has no state.
automaton reduce(const automaton &aut)
Reduce aut.
bool has_lightening_cycle(const automaton &aut)
Whether the automaton has a cycle with lightening weight.
weight weight_one(const context &c)
The weight one.