Vcsn  2.3a
Be Rational
algos.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <iosfwd>
4 #include <string>
5 #include <vector>
6 
7 #include <boost/optional.hpp>
8 
9 #include <vcsn/algos/fwd.hh>
10 #include <vcsn/ctx/fwd.hh>
11 #include <vcsn/dyn/fwd.hh>
12 #include <vcsn/dyn/types.hh>
13 #include <vcsn/misc/export.hh> // LIBVCSN_API
14 
15 namespace vcsn
16 {
17  namespace dyn LIBVCSN_API
18  {
20  automaton accessible(const automaton& aut);
21 
23  word ambiguous_word(const automaton& aut);
24 
28  bool are_equivalent(const automaton& lhs, const automaton& rhs);
29 
33  bool are_equivalent(const expression& lhs, const expression& rhs);
34 
37  bool are_isomorphic(const automaton& lhs, const automaton& rhs);
38 
40  automaton cerny(const context& ctx, unsigned num_states);
41 
43  automaton coaccessible(const automaton& aut);
44 
54  automaton codeterminize(const automaton& aut,
55  const std::string& algo = "auto");
56 
63  automaton cominimize(const automaton& aut,
64  const std::string& algo = "auto");
65 
72  automaton complement(const automaton& aut);
73 
75  expansion complement(const expansion& x);
76 
79 
82  automaton complete(const automaton& aut);
83 
88  automaton component(const automaton& aut, unsigned num);
89 
95  automaton compose(const automaton& lhs, const automaton& rhs,
96  bool lazy = false);
97 
99  expansion compose(const expansion& lhs, const expansion& rhs);
100 
102  expression compose(const expression& lhs, const expression& rhs);
103 
105  polynomial compose(const polynomial& lhs, const polynomial& rhs);
106 
110  expression concatenate(const expression& lhs, const expression& rhs);
111 
114  automaton condense(const automaton& aut);
115 
122  automaton conjunction(const automaton& lhs, const automaton& rhs,
123  bool lazy = false);
124 
130  automaton conjunction(const std::vector<automaton>& as,
131  bool lazy = false);
132 
134  automaton conjunction(const automaton& aut, unsigned n);
135 
137  expansion conjunction(const expansion& lhs, const expansion& rhs);
138 
140  expression conjunction(const expression& lhs, const expression& rhs);
141 
143  polynomial conjunction(const polynomial& lhs, const polynomial& rhs);
144 
146  automaton conjugate(const automaton& aut);
147 
149  weight constant_term(const expression& e);
150 
152  context context_of(const automaton& a);
153 
155  context context_of(const expansion& r);
156 
158  context context_of(const expression& r);
159 
161  context context_of(const polynomial& r);
162 
164  automaton copy(const automaton& aut);
165 
167  automaton copy(const automaton& aut, const context& ctx);
168 
170  expression copy(const expression& exp,
171  const context& ctx, identities ids);
172 
174  automaton costandard(const automaton& a);
175 
180  automaton cotrie(const polynomial& p);
181 
189  automaton cotrie(const context& ctx, std::istream& is,
190  const std::string& format = "default");
191 
193  automaton de_bruijn(const context& ctx, unsigned n);
194 
196  automaton delay_automaton(const automaton& a);
197 
204  polynomial derivation(const expression& exp, const label& lbl,
205  bool breaking = false);
206 
216  automaton derived_term(const expression& exp,
217  const std::string& algo = "auto");
218 
228  automaton determinize(const automaton& aut,
229  const std::string& algo = "auto");
230 
237  automaton difference(const automaton& lhs, const automaton& rhs);
238 
240  expression difference(const expression& lhs, const expression& rhs);
241 
244  automaton divkbaseb(const context& ctx, unsigned divisor, unsigned base);
245 
247  automaton double_ring(const context& ctx, unsigned n,
248  const std::vector<unsigned>& f);
249 
251  automaton eliminate_state(const automaton& aut,
252  int s = -1);
253 
255  weight evaluate(const automaton& aut, const word& l);
256 
258  weight evaluate(const automaton& aut, const polynomial& p);
259 
262  expression expand(const expression& e);
263 
265  expression expression_one(const context& c, identities ids);
266 
268  expression expression_zero(const context& c, identities ids);
269 
271  automaton factor(const automaton& aut);
272 
274  automaton filter(const automaton& aut, const std::vector<unsigned>& ss);
275 
277  automaton focus(const automaton& aut, unsigned tape);
278 
280  bool has_twins_property(const automaton& aut);
281 
283  bool has_lightening_cycle(const automaton& aut);
284 
286  bool has_bounded_lag(const automaton& aut);
287 
289  identities identities_of(const expression& exp);
290 
298  automaton inductive(const expression& e, const std::string& algo = "auto");
299 
302  automaton infiltrate(const automaton& lhs, const automaton& rhs);
303 
306  automaton infiltrate(const std::vector<automaton>& as);
307 
310  expression infiltrate(const expression& lhs, const expression& rhs);
311 
318  std::ostream& info(const automaton& aut, std::ostream& out = std::cout,
319  unsigned details = 2);
320 
322  std::ostream& info(const expression& exp, std::ostream& out = std::cout);
323 
334  automaton insplit(const automaton& aut, bool lazy = false);
335 
337  bool is_accessible(const automaton& aut);
338 
342  bool is_ambiguous(const automaton& aut);
343 
345  bool is_coaccessible(const automaton& aut);
346 
350  bool is_codeterministic(const automaton& aut);
351 
355  bool is_complete(const automaton& aut);
356 
359  bool is_costandard(const automaton& aut);
360 
362  bool is_cycle_ambiguous(const automaton& aut);
363 
366  bool is_deterministic(const automaton& aut);
367 
369  bool is_empty(const automaton& aut);
370 
372  bool is_eps_acyclic(const automaton& aut);
373 
377  bool is_functional(const automaton& aut);
378 
380  bool is_letterized(const automaton& aut);
381 
385  bool is_partial_identity(const automaton& aut);
386 
389  bool is_normalized(const automaton& aut);
390 
392  bool is_out_sorted(const automaton& aut);
393 
395  bool is_proper(const automaton& aut);
396 
398  bool is_realtime(const automaton& aut);
399 
402  bool is_standard(const automaton& aut);
403 
405  bool is_synchronized(const automaton& aut);
406 
408  bool is_synchronized_by(const automaton& aut, const word& word);
409 
411  bool is_synchronizing(const automaton& aut);
412 
414  bool is_trim(const automaton& aut);
415 
417  bool is_useless(const automaton& aut);
418 
420  bool is_valid(const automaton& e);
421 
424  bool is_valid(const expression& e);
425 
427  context join(const context& lhs, const context& rhs);
428 
430  automaton ladybird(const context& ctx, unsigned n);
431 
433  automaton ldivide(const automaton& lhs, const automaton& rhs);
434 
436  expansion ldivide(const expansion& lhs, const expansion& rhs);
437 
439  expression ldivide(const expression& lhs, const expression& rhs);
440 
442  label ldivide(const label& lhs, const label& rhs);
443 
445  polynomial ldivide(const polynomial& lhs, const polynomial& rhs);
446 
448  weight ldivide(const weight& lhs, const weight& rhs);
449 
451  polynomial lgcd(const polynomial& lhs, const polynomial& rhs);
452 
464  automaton lweight(const weight& w, const automaton& aut,
465  const std::string& algo = "auto");
466 
468  expansion lweight(const weight& w, const expansion& exp);
469 
471  expression lweight(const weight& w, const expression& exp);
472 
474  polynomial lweight(const weight& w, const polynomial& p);
475 
477  bool less_than(const expression& lhs, const expression& rhs);
478 
480  automaton letterize(const automaton& aut);
481 
483  automaton levenshtein(const context& ls);
484 
493  automaton lift(const automaton& aut,
494  const std::vector<unsigned>& tapes = {},
495  identities ids = {});
496 
498  expression lift(const expression& e);
499 
505  polynomial lightest(const automaton& aut, unsigned num = 1,
506  const std::string& algo = "auto");
507 
509  automaton lightest_automaton(const automaton& aut,
510  unsigned num = 1,
511  const std::string& algo = "auto");
512 
514  context make_context(const std::string& name);
515 
517  automaton_editor* make_automaton_editor(const context& ctx);
518 
520  context make_word_context(const context& ctx);
521 
533  automaton multiply(const automaton& lhs, const automaton& rhs,
534  const std::string& algo = "auto");
535 
550  automaton multiply(const automaton& aut, int min, int max = -2,
551  const std::string& algo = "auto");
552 
554  expression multiply(const expression& lhs, const expression& rhs);
555 
563  expression multiply(const expression& e, int min, int max = -2);
564 
566  label multiply(const label& lhs, const label& rhs);
567 
572  label multiply(const label& l, int num);
573 
575  polynomial multiply(const polynomial& lhs, const polynomial& rhs);
576 
578  weight multiply(const weight& lhs, const weight& rhs);
579 
587  weight multiply(const weight& e, int min, int max = -2);
588 
595  automaton minimize(const automaton& aut,
596  const std::string& algo = "auto");
597 
599  automaton normalize(const automaton& aut);
600 
602  std::size_t num_components(const automaton& aut);
603 
606  std::size_t num_tapes(const context& ctx);
607 
609  automaton pair(const automaton& aut, bool keep_initials = false);
610 
612  automaton partial_identity(const automaton& aut);
613 
616 
618  automaton prefix(const automaton& aut);
619 
634  std::ostream& print(const automaton& aut, std::ostream& out = std::cout,
635  const std::string& format = "default");
636 
638  std::ostream& print(const context& c, std::ostream& out = std::cout,
639  const std::string& format = "default");
640 
642  std::ostream& print(const expansion& e, std::ostream& out = std::cout,
643  const std::string& format = "default");
644 
646  std::ostream& print(const expression& e, std::ostream& out = std::cout,
647  const std::string& format = "default");
648 
650  std::ostream& print(const label& l, std::ostream& out = std::cout,
651  const std::string& format = "default");
652 
654  std::ostream& print(const polynomial& p, std::ostream& out = std::cout,
655  const std::string& format = "default");
656 
658  std::ostream& print(const weight& w, std::ostream& out = std::cout,
659  const std::string& format = "default");
660 
663  automaton quotkbaseb(const context& ctx, unsigned divisor, unsigned base);
664 
666  void set_format(std::ostream& out, const std::string& format);
667 
669  std::string get_format(std::ostream& out);
670 
672  automaton project(const automaton& aut, unsigned tape);
673 
675  context project(const context& ctx, unsigned tape);
676 
678  expansion project(const expansion& xpn, unsigned tape);
679 
681  expression project(const expression& exp, unsigned tape);
682 
684  polynomial project(const polynomial& p, unsigned tape);
685 
687  label project(const label& p, unsigned tape);
688 
701  automaton proper(const automaton& aut,
703  bool prune = true, const std::string& algo = "auto");
704 
706  automaton push_weights(const automaton& aut);
707 
732  automaton random_automaton(const context& ctx,
733  unsigned num_states,
734  float density = 0.1,
735  unsigned num_initial = 1,
736  unsigned num_final = 1,
737  boost::optional<unsigned> max_labels = {},
738  float loop_chance = 0.0);
739 
746  automaton random_automaton_deterministic(const context& ctx,
747  unsigned num_states);
748 
760  expression random_expression(const context& ctx,
761  const std::string& param,
762  identities ids);
763 
772  weight random_weight(const context& ctx, const std::string& param);
773 
775  automaton rdivide(const automaton& lhs, const automaton& rhs);
776 
778  expression rdivide(const expression& lhs, const expression& rhs);
779 
781  label rdivide(const label& lhs, const label& rhs);
782 
784  weight rdivide(const weight& lhs, const weight& rhs);
785 
791  automaton read_automaton(std::istream& is,
792  const std::string& format = "default",
793  bool strip = true);
794 
801  expression read_expression(const context& ctx, identities ids,
802  std::istream& is,
803  const std::string& format = "default");
804 
810  label read_label(const context& ctx, std::istream& is,
811  const std::string& format = "default");
812 
817  polynomial read_polynomial(const context& ctx, std::istream& is);
818 
823  weight read_weight(const context& ctx, std::istream& is);
824 
826  automaton realtime(const automaton& aut);
827 
829  automaton reduce(const automaton& aut);
830 
848  automaton rweight(const automaton& aut, const weight& w,
849  const std::string& algo = "auto");
850 
852  expansion rweight(const expansion& aut, const weight& w);
853 
855  expression rweight(const expression& exp, const weight& w);
856 
858  polynomial rweight(const polynomial& p, const weight& w);
859 
865  automaton scc(const automaton& aut, const std::string& algo = "auto");
866 
872  polynomial shortest(const automaton& aut,
873  boost::optional<unsigned> num = {},
874  boost::optional<unsigned> len = {});
875 
878  automaton shuffle(const automaton& lhs, const automaton& rhs);
879 
882  automaton shuffle(const std::vector<automaton>& as);
883 
886  expression shuffle(const expression& lhs, const expression& rhs);
887 
889  automaton sort(const automaton& a);
890 
892  polynomial split(const expression& exp);
893 
895  polynomial split(const polynomial& p);
896 
898  automaton standard(const automaton& a);
899 
901  automaton standard(const expression& e);
902 
913  automaton star(const automaton& aut, const std::string& algo = "auto");
914 
916  unsigned star_height(const expression& rs);
917 
923 
925  automaton strip(const automaton& a);
926 
928  automaton suffix(const automaton& aut);
929 
934  automaton subword(const automaton& aut);
935 
946  automaton add(const automaton& lhs, const automaton& rhs,
947  const std::string& algo = "auto");
948 
950  expression add(const expression& lhs, const expression& rhs);
951 
953  expansion add(const expansion& lhs, const expansion& rhs);
954 
956  polynomial add(const polynomial& lhs, const polynomial& rhs);
957 
959  weight add(const weight& lhs, const weight& rhs);
960 
962  automaton synchronize(const automaton& aut);
963 
965  word synchronizing_word(const automaton& aut,
966  const std::string& algo = "greedy");
967 
969  automaton thompson(const expression& e);
970 
986  automaton to_automaton(const expression& exp,
987  const std::string& algo = "auto");
988 
992  expansion to_expansion(const expression& exp);
993 
999  expression to_expression(const automaton& aut,
1000  identities ids = {},
1001  const std::string& algo = "auto");
1002 
1004  expression to_expression(const context& ctx, identities ids,
1005  const label& l);
1006 
1018  expression to_expression(const context& ctx, identities ids,
1019  const letter_class_t& letters,
1020  bool accept = true);
1021 
1023  automaton transpose(automaton& aut);
1024 
1026  expression transpose(const expression& e);
1027 
1030 
1035  automaton trie(const polynomial& p);
1036 
1043  automaton trie(const context& ctx, std::istream& is,
1044  const std::string& format = "default");
1045 
1047  automaton trim(const automaton& aut);
1048 
1053  automaton tuple(const automaton& lhs, const automaton& rhs);
1054 
1058  automaton tuple(const std::vector<automaton>& as);
1059 
1061  context tuple(const context& lhs, const context& rhs);
1062 
1066  context tuple(const std::vector<context>& ctxs);
1067 
1069  expansion tuple(const std::vector<expansion>& rs);
1070 
1072  expression tuple(const expression& lhs, const expression& rhs);
1073 
1075  expression tuple(const std::vector<expression>& rs);
1076 
1078  polynomial tuple(const std::vector<polynomial>& ps);
1079 
1081  std::string type(const automaton& a);
1082 
1084  automaton u(const context& ctx, unsigned n);
1085 
1087  automaton universal(const automaton& aut);
1088 
1090  weight weight_one(const context& c);
1091 
1093  weight weight_series(const automaton& aut);
1094 
1096  weight weight_zero(const context& c);
1097 
1103  automaton zpc(const expression& exp, const std::string& algo = "auto");
1104 
1106  std::ostream& operator<<(std::ostream& o, const automaton& a);
1107 
1109  std::ostream& operator<<(std::ostream& o, const context& c);
1110 
1112  std::ostream& operator<<(std::ostream& o, const expansion& e);
1113 
1115  std::ostream& operator<<(std::ostream& o, const expression& r);
1116 
1118  std::ostream& operator<<(std::ostream& o, const label& l);
1119 
1121  std::ostream& operator<<(std::ostream& o, const polynomial& p);
1122 
1124  std::ostream& operator<<(std::ostream& o, const weight& w);
1125  }
1126 }
weight evaluate(const automaton &aut, const word &l)
Evaluate l on aut.
Definition: evaluate.hh:212
polynomial split(const expression &exp)
Break exp.
Definition: split.hh:275
automaton read_automaton(std::istream &is, const std::string &format="default", bool strip=true)
Read an automaton from a stream.
Definition: read.cc:34
automaton derived_term(const expression &exp, const std::string &algo="auto")
The derived-term automaton of exp.
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.
Definition: prefix.hh:84
automaton determinize(const automaton &aut, const std::string &algo="auto")
The determinized automaton.
Definition: determinize.hh:357
std::set< std::pair< std::string, std::string >> letter_class_t
A set of letter ranges.
Definition: fwd.hh:111
polynomial read_polynomial(const context &ctx, std::istream &is)
Read a polynomial from a stream.
Definition: read.hh:60
bool is_functional(const automaton &aut)
Whether aut is functional.
weight random_weight(const context &ctx, const std::string &param)
A random weight.
automaton transpose(automaton &aut)
Transpose aut.
Definition: transpose.hh:273
bool is_coaccessible(const automaton &aut)
Whether aut is coaccessible.
Definition: accessible.hh:242
expression expression_one(const context &c, identities ids)
The expression for \\e.
Definition: constant.hh:15
expression expand(const expression &e)
Distribute product over addition recursively under the starred subexpressions and group the equal mon...
Definition: expand.hh:30
polynomial derivation(const expression &exp, const label &lbl, bool breaking=false)
Derive exp with respect to s.
Definition: derivation.hh:356
automaton compose(const automaton &lhs, const automaton &rhs, bool lazy=false)
The composition of transducers lhs and rhs.
Definition: compose.hh:495
context context_of(const automaton &a)
The context of this automaton.
Definition: make-context.hh:63
auto out(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions leaving state s.
Definition: automaton.hh:84
automaton partial_identity(const automaton &aut)
Create a partial identity transducer from aut.
bool is_standard(const automaton &aut)
Whether is standard (unique initial state, with weight one, no incoming transition).
Definition: standard.hh:54
unsigned star_height(const expression &rs)
Star height of an expression.
Definition: star-height.hh:158
void set_format(std::ostream &out, const std::string &format)
Specify the output format for out.
Definition: print.cc:164
Definition: a-star.hh:8
context make_word_context(const context &ctx)
The context for words.
automaton conjugate(const automaton &aut)
The conjugate of aut.
Definition: conjugate.hh:59
automaton factor(const automaton &aut)
Create a factor automaton from aut.
Definition: prefix.hh:121
bool is_ambiguous(const automaton &aut)
Whether aut is ambiguous.
Definition: is-ambiguous.hh:97
automaton tuple(const automaton &lhs, const automaton &rhs)
Build a two-tape automaton from two automata.
Definition: others.cc:219
polynomial lightest(const automaton &aut, unsigned num=1, const std::string &algo="auto")
The approximated behavior of an automaton with smallest weights.
Definition: lightest.hh:227
value_impl< detail::polynomial_tag > polynomial
Definition: fwd.hh:27
return exp min
Definition: multiply.hh:361
bool is_useless(const automaton &aut)
Whether has no useful state.
Definition: accessible.hh:260
expression random_expression(const context &ctx, const std::string &param, identities ids)
A random expression.
std::size_t num_components(const automaton &aut)
The number of strongly connected components.
Definition: scc.hh:735
bool is_empty(const automaton &aut)
Whether has no state.
Definition: accessible.hh:269
automaton delay_automaton(const automaton &a)
The automaton with the delay of each state.
automaton accessible(const automaton &aut)
The accessible subautomaton of aut.
Definition: accessible.hh:206
automaton random_automaton_deterministic(const context &ctx, unsigned num_states)
A random deterministic automaton.
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...
Definition: quotkbaseb.hh:76
bool has_lightening_cycle(const automaton &aut)
Whether the automaton has a cycle with lightening weight.
automaton universal(const automaton &aut)
The universal automaton of aut.
Definition: universal.hh:148
bool is_partial_identity(const automaton &aut)
Whether aut realizes a partial identity.
automaton conjunction(const automaton &lhs, const automaton &rhs, bool lazy=false)
The conjunction (aka synchronized product) of automata.
Definition: others.cc:24
bool are_isomorphic(const automaton &lhs, const automaton &rhs)
Whether there exists an isomorphism between the states of lhs and those of rhs.
automaton rweight(const automaton &aut, const weight &w, const std::string &algo="auto")
The right-mult automaton with w as weight.
Definition: weight.hh:351
automaton trim(const automaton &aut)
The trim subautomaton of aut.
Definition: accessible.hh:224
weight constant_term(const expression &e)
The weight associated to the empty word in e.
bool is_trim(const automaton &aut)
Whether has no useless state.
Definition: accessible.hh:251
automaton inductive(const expression &e, const std::string &algo="auto")
The inductive translation of e in an automaton.
Definition: inductive.hh:326
automaton condense(const automaton &aut)
The condensation of aut such that each state is a strongly connected component.
Definition: scc.hh:832
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_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 thompson(const expression &e)
The Thompson automaton of e.
Definition: thompson.hh:215
expression star_normal_form(const expression &e)
A normalized form where star is applied only to proper expressions.
label read_label(const context &ctx, std::istream &is, const std::string &format="default")
Read a label from a stream.
Definition: read.cc:85
Looking upstream.
automaton complete(const automaton &aut)
A completed copy of aut.
Definition: complete.hh:80
polynomial lgcd(const polynomial &lhs, const polynomial &rhs)
Left greatest common divisor of two polynomials (lhs \ rhs).
automaton zpc(const expression &exp, const std::string &algo="auto")
The ZPC automaton of exp.
Definition: zpc.hh:376
bool is_synchronizing(const automaton &aut)
Whether is synchronizing.
automaton infiltrate(const automaton &lhs, const automaton &rhs)
The infiltration of automata lhs and rhs.
Definition: others.cc:56
automaton codeterminize(const automaton &aut, const std::string &algo="auto")
The codeterminized automaton.
Definition: determinize.hh:430
automaton coaccessible(const automaton &aut)
The coaccessible subautomaton of aut.
Definition: accessible.hh:215
polynomial shortest(const automaton &aut, boost::optional< unsigned > num={}, boost::optional< unsigned > len={})
The approximated behavior of an automaton.
Definition: shortest.hh:318
weightset_mixin< detail::r_impl > r
Definition: fwd.hh:54
bool is_synchronized_by(const automaton &aut, const word &word)
Whether the word synchronizes aut.
automaton subword(const automaton &aut)
Create a subword automaton from aut.
Definition: prefix.hh:174
expansion to_expansion(const expression &exp)
First order development of a exp.
automaton minimize(const automaton &aut, const std::string &algo="auto")
The minimized automaton.
Definition: minimize.hh:158
automaton filter(const automaton &aut, const std::vector< unsigned > &ss)
The subautomaton based on aut, with only states in ss visible.
Definition: filter.hh:322
label word
The type of a word.
Definition: types.hh:20
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.
Definition: double-ring.hh:75
std::string get_format(std::ostream &out)
Get the output format for out.
Definition: print.cc:171
bool is_accessible(const automaton &aut)
Whether aut is accessible.
Definition: accessible.hh:233
std::string type(const automaton &a)
The implementation type of a.
Definition: others.cc:239
expression expression_zero(const context &c, identities ids)
The expression for \\z.
Definition: constant.hh:24
expression concatenate(const expression &lhs, const expression &rhs)
Concatenate two expressions.
automaton de_bruijn(const context &ctx, unsigned n)
A simple NFA for (a+b)*a(a+b)^n.
Definition: de-bruijn.hh:57
automaton add(const automaton &lhs, const automaton &rhs, const std::string &algo="auto")
Sum of two automata.
Definition: add.hh:124
bool is_cycle_ambiguous(const automaton &aut)
Whether the automaton is cycle-ambiguous.
automaton pair(const automaton &aut, bool keep_initials=false)
Build the pair automaton of the given automaton.
Definition: pair.hh:264
automaton multiply(const automaton &lhs, const automaton &rhs, const std::string &algo="auto")
Multiply (concatenate) two automata.
Definition: multiply.hh:169
std::ostream & operator<<(std::ostream &o, const automaton &a)
Output automaton a on o.
Definition: print.cc:178
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)
A random automaton.
automaton cominimize(const automaton &aut, const std::string &algo="auto")
The cominimized automaton.
Definition: minimize.hh:196
bool is_valid(const automaton &e)
Whether automaton is valid (epsilon-cycles converge).
Definition: is-valid.hh:150
bool is_out_sorted(const automaton &aut)
Whether the outgoing transitions of each state have increasing labels.
Definition: sort.hh:75
automaton costandard(const automaton &a)
A co-standardized a.
Definition: standard.hh:148
automaton ldivide(const automaton &lhs, const automaton &rhs)
Left-division of two automata (lhs \ rhs).
Definition: conjunction.hh:732
automaton focus(const automaton &aut, unsigned tape)
Focus on a specific tape of a tupleset automaton.
Definition: others.cc:44
automaton sort(const automaton &a)
A copy of a with normalized state numbers.
Definition: sort.hh:176
automaton suffix(const automaton &aut)
Create a suffix automaton from aut.
Definition: prefix.hh:44
automaton strip(const automaton &a)
The automaton in a with its metadata layers removed.
Definition: strip.hh:46
bool is_deterministic(const automaton &aut)
Whether aut is deterministic.
expression read_expression(const context &ctx, identities ids, std::istream &is, const std::string &format="default")
Read an expression from a stream.
bool is_letterized(const automaton &aut)
Whether aut is letterized.
Definition: letterize.hh:201
automaton complement(const automaton &aut)
The complement of aut.
Definition: complement.hh:63
weight read_weight(const context &ctx, std::istream &is)
Read a weight from a stream.
Definition: read.hh:90
bool is_complete(const automaton &aut)
Whether aut is complete.
Definition: is-complete.hh:52
bool is_synchronized(const automaton &aut)
Whether is synchronized.
bool less_than(const expression &lhs, const expression &rhs)
Ordering between expressions.
automaton eliminate_state(const automaton &aut, int s=-1)
The LAO automaton aut with state s removed.
automaton standard(const automaton &a)
A standardized a.
Definition: standard.hh:139
#define LIBVCSN_API
Definition: export.hh:8
bool has_bounded_lag(const automaton &aut)
Whether the transducer has bounded lag.
automaton ladybird(const context &ctx, unsigned n)
The ladybird automaton with n states.
Definition: ladybird.hh:54
expression to_expression(const automaton &aut, identities ids={}, const std::string &algo="auto")
An expression denoting the language of aut.
std::ostream & info(const automaton &aut, std::ostream &out=std::cout, unsigned details=2)
Output various facts about an automaton.
Definition: info.hh:136
automaton star(const automaton &aut, const std::string &algo="auto")
Star of an automaton.
Definition: star.hh:124
automaton u(const context &ctx, unsigned n)
The Brzozowski universal witness.
Definition: u.hh:68
automaton shuffle(const automaton &lhs, const automaton &rhs)
The shuffle product of automata lhs and rhs.
Definition: others.cc:164
automaton realtime(const automaton &aut)
Create the realtime automaton (letterized and proper).
Definition: letterize.hh:231
automaton component(const automaton &aut, unsigned num)
The automaton of a strongly connected component.
Definition: scc.hh:771
automaton trie(const polynomial &p)
A trie-like automaton (single initial state, multiple final states) to accept p.
Definition: trie.hh:242
bool is_proper(const automaton &aut)
Whether has no spontaneous transition.
Definition: is-proper.hh:58
automaton lweight(const weight &w, const automaton &aut, const std::string &algo="auto")
The left-multiplication of an automaton with w as weight.
Definition: weight.hh:149
value_impl< detail::label_tag > label
Definition: fwd.hh:26
automaton project(const automaton &aut, unsigned tape)
Keep a single tape from a multiple-tape automaton.
Definition: others.cc:113
auto rs
Definition: lift.hh:152
automaton synchronize(const automaton &aut)
Create a synchronized transducer from aut.
Definition: synchronize.hh:362
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...
Definition: scc.hh:704
static identities ids(const driver &d)
Get the identities of the driver.
Definition: parse.cc:89
bool is_costandard(const automaton &aut)
Whether is costandard (unique final state, with weight one, no outcoming transition).
Definition: standard.hh:63
automaton reduce(const automaton &aut)
Reduce aut.
Definition: reduce.hh:621
word synchronizing_word(const automaton &aut, const std::string &algo="greedy")
A synchronizing word, or raise if there is none.
automaton insplit(const automaton &aut, bool lazy=false)
Split automaton on the incoming transition.
Definition: insplit.hh:303
automaton cotrie(const polynomial &p)
A reversed trie-like automaton (multiple initial states, single final state) automaton to accept p...
Definition: trie.hh:251
automaton normalize(const automaton &aut)
Normalize automaton aut.
Definition: normalize.hh:41
automaton proper(const automaton &aut, direction dir=direction::backward, bool prune=true, const std::string &algo="auto")
An equivalent automaton without spontaneous transitions.
Definition: proper.hh:299
value_impl< detail::expansion_tag > expansion
Definition: fwd.hh:24
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.
Definition: divkbaseb.hh:69
weight weight_one(const context &c)
The weight one.
Definition: constant.hh:33
bool is_normalized(const automaton &aut)
Whether is normalized (in the Thompson sense), i.e., standard and co-standard.
Definition: normalize.hh:33
value_impl< detail::weight_tag > weight
Definition: fwd.hh:28
automaton levenshtein(const context &ls)
The transducer representing the Levenshtein distance.
Definition: levenshtein.hh:63
automaton copy(const automaton &aut)
A copy of aut.
Definition: copy.hh:435
direction
Orientation.
Definition: direction.hh:11
bool are_equivalent(const automaton &lhs, const automaton &rhs)
Whether compute the same series.
automaton rdivide(const automaton &lhs, const automaton &rhs)
Right-division of two automata (lhs / rhs).
Definition: conjunction.hh:767
weight weight_series(const automaton &aut)
Compute weight of the series.
bool is_realtime(const automaton &aut)
Whether has no spontaneous transition, and is letterized.
Definition: letterize.hh:259
automaton to_automaton(const expression &exp, const std::string &algo="auto")
An automaton denoting the language of exp.
Definition: others.cc:176
word ambiguous_word(const automaton &aut)
An ambiguous word, or raise if there is none.
std::size_t num_tapes(const context &ctx)
The number of input tapes.
expression transposition(const expression &r)
Add the transposition operator to r.
automaton letterize(const automaton &aut)
The automaton with letter transitions instead of words.
Definition: letterize.hh:146
automaton push_weights(const automaton &aut)
The weight pushing automaton of aut.
Definition: push-weights.hh:71
context make_context(const std::string &name)
Build a context from its name.
Definition: others.cc:97
context join(const context &lhs, const context &rhs)
The join between two contexts, i.e., their lowest common supertype.
automaton difference(const automaton &lhs, const automaton &rhs)
An automaton whose behavior is that of lhs on words not accepted by rhs.
identities identities_of(const expression &exp)
The identities of expression exp.
value_impl< detail::expression_tag > expression
Definition: fwd.hh:25
bool is_codeterministic(const automaton &aut)
Whether aut is codeterministic.
bool is_eps_acyclic(const automaton &aut)
Whether has no cycle of spontaneous transitions.
Definition: is-acyclic.hh:145
automaton cerny(const context &ctx, unsigned num_states)
Produce a Černý automaton of num_states states.
Definition: cerny.hh:64
weight weight_zero(const context &c)
The weight zero.
Definition: constant.hh:42
std::ostream & print(const automaton &aut, std::ostream &out=std::cout, const std::string &format="default")
Print automaton a on out using format format.
Definition: print.hh:121