Vcsn  2.5
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>
14 
15 namespace vcsn
16 {
17  namespace dyn LIBVCSN_API
18  {
20  automaton accessible(const automaton& aut);
21 
32  automaton add(const automaton& lhs, const automaton& rhs,
33  const std::string& algo = "auto");
34 
36  expression add(const expression& lhs, const expression& rhs);
37 
39  expansion add(const expansion& lhs, const expansion& rhs);
40 
42  polynomial add(const polynomial& lhs, const polynomial& rhs);
43 
45  weight add(const weight& lhs, const weight& rhs);
46 
48  word ambiguous_word(const automaton& aut);
49 
51  bool are_equal(const automaton& lhs, const automaton& rhs);
52 
54  bool are_equal(const expression& lhs, const expression& rhs);
55 
59  bool are_equivalent(const automaton& lhs, const automaton& rhs);
60 
64  bool are_equivalent(const expression& lhs, const expression& rhs);
65 
68  bool are_isomorphic(const automaton& lhs, const automaton& rhs);
69 
71  automaton cerny(const context& ctx, unsigned num_states);
72 
74  automaton coaccessible(const automaton& aut);
75 
85  automaton codeterminize(const automaton& aut,
86  const std::string& algo = "auto");
87 
94  automaton cominimize(const automaton& aut,
95  const std::string& algo = "auto");
96 
101  int compare(const automaton& lhs, const automaton& rhs);
102 
107  int compare(const expression& lhs, const expression& rhs);
108 
113  int compare(const label& lhs, const label& rhs);
114 
119  int compare(const polynomial& lhs, const polynomial& rhs);
120 
125  int compare(const weight& lhs, const weight& rhs);
126 
133  automaton complement(const automaton& aut);
134 
136  expansion complement(const expansion& x);
137 
140 
143  automaton complete(const automaton& aut);
144 
149  automaton component(const automaton& aut, unsigned num);
150 
156  automaton compose(const automaton& lhs, const automaton& rhs,
157  bool lazy = false);
158 
160  expansion compose(const expansion& lhs, const expansion& rhs);
161 
163  expression compose(const expression& lhs, const expression& rhs);
164 
166  polynomial compose(const polynomial& lhs, const polynomial& rhs);
167 
171  expression concatenate(const expression& lhs, const expression& rhs);
172 
175  automaton condense(const automaton& aut);
176 
183  automaton conjunction(const automaton& lhs, const automaton& rhs,
184  bool lazy = false);
185 
191  automaton conjunction(const std::vector<automaton>& as,
192  bool lazy = false);
193 
195  automaton conjunction(const automaton& aut, unsigned n);
196 
198  expansion conjunction(const expansion& lhs, const expansion& rhs);
199 
201  expression conjunction(const expression& lhs, const expression& rhs);
202 
204  polynomial conjunction(const polynomial& lhs, const polynomial& rhs);
205 
207  automaton conjugate(const automaton& aut);
208 
210  std::string configuration(const std::string& key);
211 
213  weight constant_term(const expression& e);
214 
216  context context_of(const automaton& a);
217 
219  context context_of(const expansion& r);
220 
222  context context_of(const expression& r);
223 
225  context context_of(const polynomial& r);
226 
228  automaton copy(const automaton& aut);
229 
231  automaton copy(const automaton& aut, const context& ctx);
232 
234  expression copy(const expression& exp,
235  const context& ctx, identities ids);
236 
238  automaton costandard(const automaton& a);
239 
244  automaton cotrie(const polynomial& p);
245 
253  automaton cotrie(const context& ctx, std::istream& is,
254  const std::string& format = "default");
255 
257  automaton de_bruijn(const context& ctx, unsigned n);
258 
260  automaton delay_automaton(const automaton& a);
261 
268  polynomial derivation(const expression& exp, const label& lbl,
269  bool breaking = false);
270 
280  automaton derived_term(const expression& exp,
281  const std::string& algo = "auto");
282 
292  automaton determinize(const automaton& aut,
293  const std::string& algo = "auto");
294 
301  automaton difference(const automaton& lhs, const automaton& rhs);
302 
304  expression difference(const expression& lhs, const expression& rhs);
305 
308  automaton divkbaseb(const context& ctx, unsigned divisor, unsigned base);
309 
311  automaton double_ring(const context& ctx, unsigned n,
312  const std::vector<unsigned>& f);
313 
315  automaton eliminate_state(const automaton& aut,
316  int s = -1);
317 
319  weight evaluate(const automaton& aut, const word& l);
320 
322  weight evaluate(const automaton& aut, const polynomial& p);
323 
326  expression expand(const expression& e);
327 
329  expression expression_one(const context& c, identities ids);
330 
332  expression expression_zero(const context& c, identities ids);
333 
335  automaton factor(const automaton& aut);
336 
338  automaton filter(const automaton& aut, const std::vector<unsigned>& ss);
339 
341  automaton focus(const automaton& aut, unsigned tape);
342 
344  bool has_twins_property(const automaton& aut);
345 
347  bool has_lightening_cycle(const automaton& aut);
348 
350  bool has_bounded_lag(const automaton& aut);
351 
353  identities identities_of(const expression& exp);
354 
362  automaton inductive(const expression& e, const std::string& algo = "auto");
363 
366  automaton infiltrate(const automaton& lhs, const automaton& rhs);
367 
370  automaton infiltrate(const std::vector<automaton>& as);
371 
374  expression infiltrate(const expression& lhs, const expression& rhs);
375 
382  std::ostream& info(const automaton& aut, std::ostream& out = std::cout,
383  unsigned details = 2);
384 
386  std::ostream& info(const expression& exp, std::ostream& out = std::cout);
387 
398  automaton insplit(const automaton& aut, bool lazy = false);
399 
401  bool is_accessible(const automaton& aut);
402 
406  bool is_ambiguous(const automaton& aut);
407 
409  bool is_coaccessible(const automaton& aut);
410 
414  bool is_codeterministic(const automaton& aut);
415 
419  bool is_complete(const automaton& aut);
420 
423  bool is_costandard(const automaton& aut);
424 
426  bool is_cycle_ambiguous(const automaton& aut);
427 
430  bool is_deterministic(const automaton& aut);
431 
433  bool is_empty(const automaton& aut);
434 
436  bool is_eps_acyclic(const automaton& aut);
437 
441  bool is_functional(const automaton& aut);
442 
444  bool is_letterized(const automaton& aut);
445 
449  bool is_partial_identity(const automaton& aut);
450 
453  bool is_normalized(const automaton& aut);
454 
456  bool is_out_sorted(const automaton& aut);
457 
459  bool is_proper(const automaton& aut);
460 
462  bool is_realtime(const automaton& aut);
463 
466  bool is_standard(const automaton& aut);
467 
469  bool is_synchronized(const automaton& aut);
470 
472  bool is_synchronized_by(const automaton& aut, const word& word);
473 
475  bool is_synchronizing(const automaton& aut);
476 
478  bool is_trim(const automaton& aut);
479 
481  bool is_useless(const automaton& aut);
482 
484  bool is_valid(const automaton& e);
485 
488  bool is_valid(const expression& e);
489 
491  context join(const context& lhs, const context& rhs);
492 
494  automaton ladybird(const context& ctx, unsigned n);
495 
497  automaton ldivide(const automaton& lhs, const automaton& rhs);
498 
500  expansion ldivide(const expansion& lhs, const expansion& rhs);
501 
503  expression ldivide(const expression& lhs, const expression& rhs);
504 
506  label ldivide(const label& lhs, const label& rhs);
507 
509  polynomial ldivide(const polynomial& lhs, const polynomial& rhs);
510 
512  weight ldivide(const weight& lhs, const weight& rhs);
513 
515  polynomial lgcd(const polynomial& lhs, const polynomial& rhs);
516 
528  automaton lweight(const weight& w, const automaton& aut,
529  const std::string& algo = "auto");
530 
532  expansion lweight(const weight& w, const expansion& exp);
533 
535  expression lweight(const weight& w, const expression& exp);
536 
538  polynomial lweight(const weight& w, const polynomial& p);
539 
541  bool less_than(const automaton& lhs, const automaton& rhs);
542 
544  bool less_than(const expression& lhs, const expression& rhs);
545 
547  automaton letterize(const automaton& aut);
548 
550  automaton levenshtein(const context& ls);
551 
560  automaton lift(const automaton& aut,
561  const std::vector<unsigned>& tapes = {},
562  identities ids = {});
563 
565  expression lift(const expression& e);
566 
572  polynomial lightest(const automaton& aut, unsigned num = 1,
573  const std::string& algo = "auto");
574 
576  automaton lightest_automaton(const automaton& aut,
577  unsigned num = 1,
578  const std::string& algo = "auto");
579 
585  automaton make_automaton(const std::string& data,
586  const std::string& format = "default",
587  bool strip = true);
588 
590  automaton_editor* make_automaton_editor(const context& ctx);
591 
593  context make_context(const std::string& name);
594 
600  expression make_expression(const context& ctx,
601  const std::string& s, identities ids = {},
602  const std::string& format = "default");
603 
605  label make_label(const context& ctx, const std::string& s,
606  const std::string& format = "default");
607 
609  polynomial make_polynomial(const context& ctx, const std::string& s);
610 
612  weight make_weight(const context& ctx, const std::string& s);
613 
615  context make_word_context(const context& ctx);
616 
618  label make_word(const context& ctx, const std::string& s,
619  const std::string& format = "default");
620 
632  automaton multiply(const automaton& lhs, const automaton& rhs,
633  const std::string& algo = "auto");
634 
649  automaton multiply(const automaton& aut, int min, int max = -2,
650  const std::string& algo = "auto");
651 
653  expression multiply(const expression& lhs, const expression& rhs);
654 
662  expression multiply(const expression& e, int min, int max = -2);
663 
665  label multiply(const label& lhs, const label& rhs);
666 
671  label multiply(const label& l, int num);
672 
674  polynomial multiply(const polynomial& lhs, const polynomial& rhs);
675 
677  weight multiply(const weight& lhs, const weight& rhs);
678 
686  weight multiply(const weight& e, int min, int max = -2);
687 
694  automaton minimize(const automaton& aut,
695  const std::string& algo = "auto");
696 
698  automaton normalize(const automaton& aut);
699 
701  std::size_t num_components(const automaton& aut);
702 
705  std::size_t num_tapes(const context& ctx);
706 
708  automaton pair(const automaton& aut, bool keep_initials = false);
709 
711  automaton partial_identity(const automaton& aut);
712 
715 
717  automaton prefix(const automaton& aut);
718 
733  std::ostream& print(const automaton& aut, std::ostream& out = std::cout,
734  const std::string& format = "default");
735 
737  std::ostream& print(const context& c, std::ostream& out = std::cout,
738  const std::string& format = "default");
739 
741  std::ostream& print(const expansion& e, std::ostream& out = std::cout,
742  const std::string& format = "default");
743 
745  std::ostream& print(const expression& e, std::ostream& out = std::cout,
746  const std::string& format = "default");
747 
749  std::ostream& print(const label& l, std::ostream& out = std::cout,
750  const std::string& format = "default");
751 
753  std::ostream& print(const polynomial& p, std::ostream& out = std::cout,
754  const std::string& format = "default");
755 
757  std::ostream& print(const weight& w, std::ostream& out = std::cout,
758  const std::string& format = "default");
759 
762  automaton quotkbaseb(const context& ctx, unsigned divisor, unsigned base);
763 
765  void set_format(std::ostream& out, const std::string& format);
766 
768  std::string get_format(std::ostream& out);
769 
771  automaton project(const automaton& aut, unsigned tape);
772 
774  context project(const context& ctx, unsigned tape);
775 
777  expansion project(const expansion& xpn, unsigned tape);
778 
780  expression project(const expression& exp, unsigned tape);
781 
783  polynomial project(const polynomial& p, unsigned tape);
784 
786  label project(const label& p, unsigned tape);
787 
800  automaton proper(const automaton& aut,
802  bool prune = true, const std::string& algo = "auto");
803 
805  automaton push_weights(const automaton& aut);
806 
834  automaton random_automaton(const context& ctx,
835  unsigned num_states,
836  float density = 0.1,
837  unsigned num_initial = 1,
838  unsigned num_final = 1,
839  boost::optional<unsigned> max_labels = {},
840  float loop_chance = 0.0,
841  const std::string& weights = "");
842 
849  automaton random_automaton_deterministic(const context& ctx,
850  unsigned num_states);
851 
863  expression
864  random_expression(const context& ctx,
865  const std::string& param = "+, ., *=.2, w., .w, length=10",
866  identities ids = {});
867 
876  weight random_weight(const context& ctx, const std::string& param);
877 
879  automaton rdivide(const automaton& lhs, const automaton& rhs);
880 
882  expression rdivide(const expression& lhs, const expression& rhs);
883 
885  label rdivide(const label& lhs, const label& rhs);
886 
888  weight rdivide(const weight& lhs, const weight& rhs);
889 
897  automaton read_automaton(std::istream& is,
898  const std::string& format = "default",
899  bool strip = true,
900  const location& loc = location{});
901 
908  expression read_expression(const context& ctx, identities ids,
909  std::istream& is,
910  const std::string& format = "default",
911  const location& loc = location{});
912 
918  label read_label(const context& ctx, std::istream& is,
919  const std::string& format = "default");
920 
925  polynomial read_polynomial(const context& ctx, std::istream& is);
926 
931  weight read_weight(const context& ctx, std::istream& is);
932 
934  automaton realtime(const automaton& aut);
935 
937  automaton reduce(const automaton& aut);
938 
956  automaton rweight(const automaton& aut, const weight& w,
957  const std::string& algo = "auto");
958 
960  expansion rweight(const expansion& aut, const weight& w);
961 
963  expression rweight(const expression& exp, const weight& w);
964 
966  polynomial rweight(const polynomial& p, const weight& w);
967 
973  automaton scc(const automaton& aut, const std::string& algo = "auto");
974 
980  polynomial shortest(const automaton& aut,
981  boost::optional<unsigned> num = {},
982  boost::optional<unsigned> len = {});
983 
986  automaton shuffle(const automaton& lhs, const automaton& rhs);
987 
990  automaton shuffle(const std::vector<automaton>& as);
991 
994  expression shuffle(const expression& lhs, const expression& rhs);
995 
997  automaton sort(const automaton& a);
998 
1000  polynomial split(const expression& exp);
1001 
1003  polynomial split(const polynomial& p);
1004 
1006  automaton standard(const automaton& a);
1007 
1009  automaton standard(const expression& e);
1010 
1021  automaton star(const automaton& aut, const std::string& algo = "auto");
1022 
1024  unsigned star_height(const expression& rs);
1025 
1031 
1033  automaton strip(const automaton& a);
1034 
1036  automaton suffix(const automaton& aut);
1037 
1042  automaton subword(const automaton& aut);
1043 
1045  automaton synchronize(const automaton& aut);
1046 
1048  word synchronizing_word(const automaton& aut,
1049  const std::string& algo = "greedy");
1050 
1052  automaton thompson(const expression& e);
1053 
1069  automaton to_automaton(const expression& exp,
1070  const std::string& algo = "auto");
1071 
1075  expansion to_expansion(const expression& exp);
1076 
1082  expression to_expression(const automaton& aut,
1083  identities ids = {},
1084  const std::string& algo = "auto");
1085 
1087  expression to_expression(const context& ctx, identities ids,
1088  const label& l);
1089 
1101  expression to_expression(const context& ctx, identities ids,
1102  const letter_class_t& letters,
1103  bool accept = true);
1104 
1106  automaton transpose(automaton& aut);
1107 
1109  expression transpose(const expression& e);
1110 
1113 
1118  automaton trie(const polynomial& p);
1119 
1126  automaton trie(const context& ctx, std::istream& is,
1127  const std::string& format = "default");
1128 
1130  automaton trim(const automaton& aut);
1131 
1136  automaton tuple(const automaton& lhs, const automaton& rhs);
1137 
1141  automaton tuple(const std::vector<automaton>& as);
1142 
1144  context tuple(const context& lhs, const context& rhs);
1145 
1149  context tuple(const std::vector<context>& ctxs);
1150 
1152  expansion tuple(const std::vector<expansion>& rs);
1153 
1155  expression tuple(const expression& lhs, const expression& rhs);
1156 
1158  expression tuple(const std::vector<expression>& rs);
1159 
1161  polynomial tuple(const std::vector<polynomial>& ps);
1162 
1164  std::string type(const automaton& a);
1165 
1167  automaton u(const context& ctx, unsigned n);
1168 
1170  automaton universal(const automaton& aut);
1171 
1173  weight weight_one(const context& c);
1174 
1176  weight weight_series(const automaton& aut);
1177 
1179  weight weight_zero(const context& c);
1180 
1186  automaton zpc(const expression& exp, const std::string& algo = "auto");
1187 
1189  std::ostream& operator<<(std::ostream& o, const automaton& a);
1190 
1192  std::ostream& operator<<(std::ostream& o, const context& c);
1193 
1195  std::ostream& operator<<(std::ostream& o, const expansion& e);
1196 
1198  std::ostream& operator<<(std::ostream& o, const expression& r);
1199 
1201  std::ostream& operator<<(std::ostream& o, const label& l);
1202 
1204  std::ostream& operator<<(std::ostream& o, const polynomial& p);
1205 
1207  std::ostream& operator<<(std::ostream& o, const weight& w);
1208  }
1209 }
1210 
1211 #include <vcsn/dyn/algos.hxx>
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.
automaton zpc(const expression &exp, const std::string &algo="auto")
The ZPC automaton of exp.
automaton infiltrate(const automaton &lhs, const automaton &rhs)
The infiltration of automata lhs and rhs.
Definition: others.cc:56
automaton coaccessible(const automaton &aut)
The coaccessible subautomaton of aut.
Definition: accessible.hh:215
automaton star(const automaton &aut, const std::string &algo="auto")
Star of an automaton.
Definition: star.hh:124
bool is_synchronized_by(const automaton &aut, const word &word)
Whether the word synchronizes aut.
automaton u(const context &ctx, unsigned n)
The Brzozowski universal witness.
Definition: u.hh:68
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.
::vcsn::rat::identities identities
Sets of identities on expressions.
Definition: fwd.hh:17
label word
The type of a word.
Definition: types.hh:26
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.
Definition: read.cc:97
label make_word(const context &ctx, const std::string &s, const std::string &format="default")
Build a word from a string.
Definition: algos.hxx:142
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:32
std::string get_format(std::ostream &out)
Get the output format for out.
Definition: print.cc:171
automaton project(const automaton &aut, unsigned tape)
Keep a single tape from a multiple-tape automaton.
Definition: others.cc:113
bool is_accessible(const automaton &aut)
Whether aut is accessible.
Definition: accessible.hh:233
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
expression concatenate(const expression &lhs, const expression &rhs)
Concatenate two expressions.
bool is_costandard(const automaton &aut)
Whether is costandard (unique final state, with weight one, no outcoming transition).
Definition: standard.hh:63
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
std::ostream & operator<<(std::ostream &o, const automaton &a)
Output automaton a on o.
Definition: print.cc:178
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:30
automaton cominimize(const automaton &aut, const std::string &algo="auto")
The cominimized automaton.
Definition: minimize.hh:196
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
bool is_valid(const automaton &e)
Whether automaton is valid (epsilon-cycles converge).
Definition: is-valid.hh:150
Definition: a-star.hh:8
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 levenshtein(const context &ls)
The transducer representing the Levenshtein distance.
Definition: levenshtein.hh:63
return exp min
Definition: multiply.hh:361
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
automaton rdivide(const automaton &lhs, const automaton &rhs)
Right-division of two automata (lhs / rhs).
Definition: conjunction.hh:767
bool less_than(const automaton &lhs, const automaton &rhs)
Ordering between automata.
Definition: algos.hxx:40
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.
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 standard(const automaton &a)
A standardized a.
Definition: standard.hh:139
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
std::ostream & info(const automaton &aut, std::ostream &out=std::cout, unsigned details=2)
Output various facts about an automaton.
Definition: info.hh:136
context join(const context &lhs, const context &rhs)
The join between two contexts, i.e., their lowest common supertype.
value_impl< detail::expression_tag > expression
Definition: fwd.hh:31
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
bool is_eps_acyclic(const automaton &aut)
Whether has no cycle of spontaneous transitions.
Definition: is-acyclic.hh:143
automaton cerny(const context &ctx, unsigned num_states)
Produce a Černý automaton of num_states states.
Definition: cerny.hh:64
std::string configuration(const std::string &key)
Access a configuration value.
Definition: algos.hxx:25
weight weight_zero(const context &c)
The weight zero.
Definition: constant.hh:42
automaton component(const automaton &aut, unsigned num)
The automaton of a strongly connected component.
Definition: scc.hh:771
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
Looking upstream.
weight evaluate(const automaton &aut, const word &l)
Evaluate l on aut.
Definition: evaluate.hh:212
polynomial split(const expression &exp)
Break exp.
bool are_equal(const automaton &lhs, const automaton &rhs)
Whether are the same automaton.
Definition: algos.hxx:13
automaton synchronize(const automaton &aut)
Create a synchronized transducer from aut.
Definition: synchronize.hh:362
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 determinize(const automaton &aut, const std::string &algo="auto")
The determinized automaton.
Definition: determinize.hh:357
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:284
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
weightset_mixin< detail::r_impl > r
Definition: fwd.hh:54
bool is_coaccessible(const automaton &aut)
Whether aut is coaccessible.
Definition: accessible.hh:242
std::set< std::pair< std::string, std::string > > letter_class_t
A set of letter ranges.
Definition: fwd.hh:111
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
expression expression_one(const context &c, identities ids)
The expression for \\e.
Definition: constant.hh:15
std::string format(const Value &v, const std::string &format="default")
Definition: algos.hxx:31
value_impl< detail::weight_tag > weight
Definition: fwd.hh:34
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:86
automaton copy(const automaton &aut)
A copy of aut.
Definition: copy.hh:435
vcsn::rat::location location
Pairs of positions in a file/stream.
Definition: fwd.hh:36
automaton partial_identity(const automaton &aut)
Create a partial identity transducer from aut.
bool are_equivalent(const automaton &lhs, const automaton &rhs)
Whether compute the same series.
static identities ids(const driver &d)
Get the identities of the driver.
Definition: parse.cc:89
::vcsn::direction direction
Direction for proper on automata.
Definition: types.hh:13
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
unsigned star_height(const expression &rs)
Star height of an expression.
automaton to_automaton(const expression &exp, const std::string &algo="auto")
An automaton denoting the language of exp.
Definition: others.cc:176
void set_format(std::ostream &out, const std::string &format)
Specify the output format for out.
Definition: print.cc:164
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.
automaton conjugate(const automaton &aut)
The conjugate of aut.
Definition: conjugate.hh:59
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:240
value_impl< detail::polynomial_tag > polynomial
Definition: fwd.hh:33
bool is_useless(const automaton &aut)
Whether has no useful state.
Definition: accessible.hh:260
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.
automaton accessible(const automaton &aut)
The accessible subautomaton of aut.
Definition: accessible.hh:206
bool is_codeterministic(const automaton &aut)
Whether aut is codeterministic.
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.
int compare(const automaton &lhs, const automaton &rhs)
Three-way comparison between automata.
automaton conjunction(const automaton &lhs, const automaton &rhs, bool lazy=false)
The conjunction (aka synchronized product) of automata.
Definition: others.cc:24
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
expression random_expression(const context &ctx, const std::string &param="+, ., *=.2, w., .w, length=10", identities ids={})
A random expression.
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 prefix(const automaton &aut)
Create a prefix automaton from aut.
Definition: prefix.hh:84
polynomial read_polynomial(const context &ctx, std::istream &is)
Read a polynomial from a stream.
Definition: read.hh:59
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.
Definition: others.cc:69
automaton thompson(const expression &e)
The Thompson automaton of e.
expression expand(const expression &e)
Distribute product over addition recursively under the starred subexpressions and group the equal mon...
polynomial derivation(const expression &exp, const label &lbl, bool breaking=false)
Derive exp with respect to s.
expression star_normal_form(const expression &e)
A normalized form where star is applied only to proper expressions.
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).
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.
Definition: algos.hxx:90
#define LIBVCSN_API
Definition: export.hh:8
automaton codeterminize(const automaton &aut, const std::string &algo="auto")
The codeterminized automaton.
Definition: determinize.hh:435
expression make_expression(const context &ctx, const std::string &s, identities ids={}, const std::string &format="default")
Read an expression from a stream.
Definition: algos.hxx:71
polynomial shortest(const automaton &aut, boost::optional< unsigned > num={}, boost::optional< unsigned > len={})
The approximated behavior of an automaton.
Definition: shortest.hh:322
bool is_standard(const automaton &aut)
Whether is standard (unique initial state, with weight one, no incoming transition).
Definition: standard.hh:54
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
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
polynomial make_polynomial(const context &ctx, const std::string &s)
Build a polynomial from a string.
Definition: algos.hxx:108
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 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
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
weight make_weight(const context &ctx, const std::string &s)
Build a weight from a string.
Definition: algos.hxx:125
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
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 multiply(const automaton &lhs, const automaton &rhs, const std::string &algo="auto")
Multiply (concatenate) two automata.
Definition: multiply.hh:169
automaton delay_automaton(const automaton &a)
The automaton with the delay of each state.
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 random_automaton_deterministic(const context &ctx, unsigned num_states)
A random deterministic automaton.
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 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 are_isomorphic(const automaton &lhs, const automaton &rhs)
Whether there exists an isomorphism between the states of lhs and those of rhs.
bool is_deterministic(const automaton &aut)
Whether aut is deterministic.
automaton make_automaton(const std::string &data, const std::string &format="default", bool strip=true)
Read an automaton from a string.
Definition: algos.hxx:52
automaton trim(const automaton &aut)
The trim subautomaton of aut.
Definition: accessible.hh:224
automaton inductive(const expression &e, const std::string &algo="auto")
The inductive translation of e in an automaton.
automaton condense(const automaton &aut)
The condensation of aut such that each state is a strongly connected component.
Definition: scc.hh:832
weight read_weight(const context &ctx, std::istream &is)
Read a weight from a stream.
Definition: read.hh:89
bool is_complete(const automaton &aut)
Whether aut is complete.
Definition: is-complete.hh:52
bool is_synchronized(const automaton &aut)
Whether is synchronized.
automaton_editor * make_automaton_editor(const context &ctx)
Build an automaton editor from its context.
automaton eliminate_state(const automaton &aut, int s=-1)
The LAO automaton aut with state s removed.
Definition: to-automaton.hh:46
bool has_twins_property(const automaton &aut)
Whether the automaton has the twins property.
label read_label(const context &ctx, std::istream &is, const std::string &format="default")
Read a label from a stream.
Definition: read.cc:123
automaton read_automaton(std::istream &is, const std::string &format="default", bool strip=true, const location &loc=location{})
Read an automaton from a stream.
Definition: read.cc:72
bool has_bounded_lag(const automaton &aut)
Whether the transducer has bounded lag.