Vcsn  2.8
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  context compose(const context& lhs, const context& rhs);
161 
163  expansion compose(const expansion& lhs, const expansion& rhs);
164 
166  expression compose(const expression& lhs, const expression& rhs);
167 
169  label compose(const label& lhs, const label& rhs);
170 
172  polynomial compose(const polynomial& lhs, const polynomial& rhs);
173 
177  expression concatenate(const expression& lhs, const expression& rhs);
178 
181  automaton condense(const automaton& aut);
182 
189  automaton conjunction(const automaton& lhs, const automaton& rhs,
190  bool lazy = false);
191 
197  automaton conjunction(const std::vector<automaton>& as,
198  bool lazy = false);
199 
201  automaton conjunction(const automaton& aut, unsigned n);
202 
204  expansion conjunction(const expansion& lhs, const expansion& rhs);
205 
207  expression conjunction(const expression& lhs, const expression& rhs);
208 
210  polynomial conjunction(const polynomial& lhs, const polynomial& rhs);
211 
213  automaton conjugate(const automaton& aut);
214 
216  std::string configuration(const std::string& key);
217 
219  weight constant_term(const expression& e);
220 
222  context context_of(const automaton& a);
223 
225  context context_of(const expansion& r);
226 
228  context context_of(const expression& r);
229 
231  context context_of(const polynomial& r);
232 
234  automaton copy(const automaton& aut);
235 
237  automaton copy(const automaton& aut, const context& ctx);
238 
240  expression copy(const expression& exp,
241  const context& ctx, identities ids);
242 
244  automaton costandard(const automaton& a);
245 
250  automaton cotrie(const polynomial& p);
251 
259  automaton cotrie(const context& ctx, std::istream& is,
260  const std::string& format = "default");
261 
263  automaton de_bruijn(const context& ctx, unsigned n);
264 
266  automaton delay_automaton(const automaton& a);
267 
269  expansion denormalize(const expansion& x);
270 
277  polynomial derivation(const expression& exp, const label& lbl,
278  bool breaking = false);
279 
289  automaton derived_term(const expression& exp,
290  const std::string& algo = "auto");
291 
301  automaton determinize(const automaton& aut,
302  const std::string& algo = "auto");
303 
305  expansion determinize(const expansion& x);
306 
313  automaton difference(const automaton& lhs, const automaton& rhs);
314 
316  expression difference(const expression& lhs, const expression& rhs);
317 
320  automaton divkbaseb(const context& ctx, unsigned divisor, unsigned base);
321 
323  automaton double_ring(const context& ctx, unsigned n,
324  const std::vector<unsigned>& f);
325 
327  automaton eliminate_state(const automaton& aut,
328  int s = -1);
329 
331  weight evaluate(const automaton& aut, const word& l);
332 
334  weight evaluate(const automaton& aut, const polynomial& p);
335 
338  expression expand(const expression& e);
339 
341  expression expression_one(const context& c, identities ids);
342 
344  expression expression_zero(const context& c, identities ids);
345 
347  automaton factor(const automaton& aut);
348 
350  automaton filter(const automaton& aut, const std::vector<unsigned>& ss);
351 
353  automaton focus(const automaton& aut, unsigned tape);
354 
356  bool has_twins_property(const automaton& aut);
357 
359  bool has_lightening_cycle(const automaton& aut);
360 
362  bool has_bounded_lag(const automaton& aut);
363 
365  identities identities_of(const expression& exp);
366 
374  automaton inductive(const expression& e, const std::string& algo = "auto");
375 
378  automaton infiltrate(const automaton& lhs, const automaton& rhs);
379 
382  automaton infiltrate(const std::vector<automaton>& as);
383 
386  expression infiltrate(const expression& lhs, const expression& rhs);
387 
389  polynomial infiltrate(const polynomial& lhs, const polynomial& rhs);
390 
397  std::ostream& info(const automaton& aut, std::ostream& out = std::cout,
398  unsigned details = 2);
399 
401  std::ostream& info(const expression& exp, std::ostream& out = std::cout);
402 
413  automaton insplit(const automaton& aut, bool lazy = false);
414 
416  bool is_accessible(const automaton& aut);
417 
421  bool is_ambiguous(const automaton& aut);
422 
424  bool is_coaccessible(const automaton& aut);
425 
429  bool is_codeterministic(const automaton& aut);
430 
434  bool is_complete(const automaton& aut);
435 
438  bool is_costandard(const automaton& aut);
439 
441  bool is_cycle_ambiguous(const automaton& aut);
442 
445  bool is_deterministic(const automaton& aut);
446 
448  bool is_empty(const automaton& aut);
449 
451  bool is_eps_acyclic(const automaton& aut);
452 
456  bool is_functional(const automaton& aut);
457 
459  bool is_letterized(const automaton& aut);
460 
464  bool is_partial_identity(const automaton& aut);
465 
467  bool is_normal(const expansion& x);
468 
471  bool is_normalized(const automaton& aut);
472 
474  bool is_out_sorted(const automaton& aut);
475 
477  bool is_proper(const automaton& aut);
478 
480  bool is_realtime(const automaton& aut);
481 
484  bool is_standard(const automaton& aut);
485 
487  bool is_synchronized(const automaton& aut);
488 
490  bool is_synchronized_by(const automaton& aut, const word& word);
491 
493  bool is_synchronizing(const automaton& aut);
494 
496  bool is_trim(const automaton& aut);
497 
499  bool is_useless(const automaton& aut);
500 
502  bool is_valid(const automaton& e);
503 
506  bool is_valid(const expression& e);
507 
509  context join(const context& lhs, const context& rhs);
510 
512  automaton ladybird(const context& ctx, unsigned n);
513 
515  automaton ldivide(const automaton& lhs, const automaton& rhs);
516 
518  expansion ldivide(const expansion& lhs, const expansion& rhs);
519 
521  expression ldivide(const expression& lhs, const expression& rhs);
522 
524  label ldivide(const label& lhs, const label& rhs);
525 
527  polynomial ldivide(const polynomial& lhs, const polynomial& rhs);
528 
530  weight ldivide(const weight& lhs, const weight& rhs);
531 
533  polynomial lgcd(const polynomial& lhs, const polynomial& rhs);
534 
546  automaton lweight(const weight& w, const automaton& aut,
547  const std::string& algo = "auto");
548 
550  expansion lweight(const weight& w, const expansion& exp);
551 
553  expression lweight(const weight& w, const expression& exp);
554 
556  polynomial lweight(const weight& w, const polynomial& p);
557 
559  bool less_than(const automaton& lhs, const automaton& rhs);
560 
562  bool less_than(const expression& lhs, const expression& rhs);
563 
565  automaton letterize(const automaton& aut);
566 
568  automaton levenshtein(const context& ls);
569 
578  automaton lift(const automaton& aut,
579  const std::vector<unsigned>& tapes = {},
580  identities ids = {});
581 
583  expression lift(const expression& e);
584 
590  polynomial lightest(const automaton& aut, unsigned num = 1,
591  const std::string& algo = "auto");
592 
594  automaton lightest_automaton(const automaton& aut,
595  unsigned num = 1,
596  const std::string& algo = "auto");
597 
603  automaton make_automaton(const std::string& data,
604  const std::string& format = "default",
605  bool strip = true);
606 
608  automaton_editor* make_automaton_editor(const context& ctx);
609 
611  context make_context(const std::string& name);
612 
618  expression make_expression(const context& ctx,
619  const std::string& s, identities ids = {},
620  const std::string& format = "default");
621 
623  label make_label(const context& ctx, const std::string& s,
624  const std::string& format = "default");
625 
627  polynomial make_polynomial(const context& ctx, const std::string& s);
628 
630  weight make_weight(const context& ctx, const std::string& s);
631 
633  context make_word_context(const context& ctx);
634 
636  label make_word(const context& ctx, const std::string& s,
637  const std::string& format = "default");
638 
650  automaton multiply(const automaton& lhs, const automaton& rhs,
651  const std::string& algo = "auto");
652 
667  automaton multiply(const automaton& aut, int min, int max = -2,
668  const std::string& algo = "auto");
669 
671  expression multiply(const expression& lhs, const expression& rhs);
672 
680  expression multiply(const expression& e, int min, int max = -2);
681 
683  label multiply(const label& lhs, const label& rhs);
684 
689  label multiply(const label& l, int num);
690 
692  polynomial multiply(const polynomial& lhs, const polynomial& rhs);
693 
695  weight multiply(const weight& lhs, const weight& rhs);
696 
704  weight multiply(const weight& e, int min, int max = -2);
705 
712  automaton minimize(const automaton& aut,
713  const std::string& algo = "auto");
714 
716  expression name(const expression& exp, const std::string& name);
717 
719  automaton normalize(const automaton& aut);
720 
722  expansion normalize(const expansion& x);
723 
725  std::size_t num_components(const automaton& aut);
726 
729  std::size_t num_tapes(const context& ctx);
730 
732  automaton pair(const automaton& aut, bool keep_initials = false);
733 
735  automaton partial_identity(const automaton& aut);
736 
739 
741  automaton prefix(const automaton& aut);
742 
757  std::ostream& print(const automaton& aut, std::ostream& out = std::cout,
758  const std::string& format = "default");
759 
761  std::ostream& print(const context& c, std::ostream& out = std::cout,
762  const std::string& format = "default");
763 
765  std::ostream& print(const expansion& e, std::ostream& out = std::cout,
766  const std::string& format = "default");
767 
769  std::ostream& print(const expression& e, std::ostream& out = std::cout,
770  const std::string& format = "default");
771 
773  std::ostream& print(const label& l, std::ostream& out = std::cout,
774  const std::string& format = "default");
775 
777  std::ostream& print(const polynomial& p, std::ostream& out = std::cout,
778  const std::string& format = "default");
779 
781  std::ostream& print(const weight& w, std::ostream& out = std::cout,
782  const std::string& format = "default");
783 
786  automaton quotkbaseb(const context& ctx, unsigned divisor, unsigned base);
787 
789  void set_format(std::ostream& out, const std::string& format);
790 
792  std::string get_format(std::ostream& out);
793 
795  automaton project(const automaton& aut, unsigned tape);
796 
798  context project(const context& ctx, unsigned tape);
799 
801  expansion project(const expansion& xpn, unsigned tape);
802 
804  expression project(const expression& exp, unsigned tape);
805 
807  polynomial project(const polynomial& p, unsigned tape);
808 
810  label project(const label& p, unsigned tape);
811 
824  automaton proper(const automaton& aut,
826  bool prune = true, const std::string& algo = "auto");
827 
829  automaton push_weights(const automaton& aut);
830 
858  automaton random_automaton(const context& ctx,
859  unsigned num_states,
860  float density = 0.1,
861  unsigned num_initial = 1,
862  unsigned num_final = 1,
863  boost::optional<unsigned> max_labels = {},
864  float loop_chance = 0.0,
865  const std::string& weights = "");
866 
873  automaton random_automaton_deterministic(const context& ctx,
874  unsigned num_states);
875 
887  expression
888  random_expression(const context& ctx,
889  const std::string& param = "+, ., *=.2, w., .w, length=10",
890  identities ids = {});
891 
900  weight random_weight(const context& ctx, const std::string& param);
901 
903  automaton rdivide(const automaton& lhs, const automaton& rhs);
904 
906  expression rdivide(const expression& lhs, const expression& rhs);
907 
909  label rdivide(const label& lhs, const label& rhs);
910 
912  weight rdivide(const weight& lhs, const weight& rhs);
913 
922  automaton read_automaton(std::istream& is,
923  const std::string& format = "default",
924  bool strip = true,
925  const location& loc = location{});
926 
934  expression read_expression(const context& ctx, identities ids,
935  std::istream& is,
936  const std::string& format = "default",
937  const location& loc = location{});
938 
944  label read_label(const context& ctx, std::istream& is,
945  const std::string& format = "default");
946 
951  polynomial read_polynomial(const context& ctx, std::istream& is);
952 
957  weight read_weight(const context& ctx, std::istream& is);
958 
960  automaton realtime(const automaton& aut);
961 
963  automaton reduce(const automaton& aut);
964 
982  automaton rweight(const automaton& aut, const weight& w,
983  const std::string& algo = "auto");
984 
986  expansion rweight(const expansion& aut, const weight& w);
987 
989  expression rweight(const expression& exp, const weight& w);
990 
992  polynomial rweight(const polynomial& p, const weight& w);
993 
999  automaton scc(const automaton& aut, const std::string& algo = "auto");
1000 
1006  polynomial shortest(const automaton& aut,
1007  boost::optional<unsigned> num = {},
1008  boost::optional<unsigned> len = {});
1009 
1012  automaton shuffle(const automaton& lhs, const automaton& rhs);
1013 
1016  automaton shuffle(const std::vector<automaton>& as);
1017 
1020  expression shuffle(const expression& lhs, const expression& rhs);
1021 
1023  polynomial shuffle(const polynomial& lhs, const polynomial& rhs);
1024 
1026  automaton sort(const automaton& a);
1027 
1029  polynomial split(const expression& exp);
1030 
1032  polynomial split(const polynomial& p);
1033 
1035  automaton standard(const automaton& a);
1036 
1038  automaton standard(const expression& e);
1039 
1050  automaton star(const automaton& aut, const std::string& algo = "auto");
1051 
1053  unsigned star_height(const expression& rs);
1054 
1060 
1062  automaton strip(const automaton& a);
1063 
1065  automaton suffix(const automaton& aut);
1066 
1071  automaton subword(const automaton& aut);
1072 
1074  automaton synchronize(const automaton& aut);
1075 
1077  word synchronizing_word(const automaton& aut,
1078  const std::string& algo = "greedy");
1079 
1081  automaton thompson(const expression& e);
1082 
1098  automaton to_automaton(const expression& exp,
1099  const std::string& algo = "auto");
1100 
1104  expansion to_expansion(const expression& exp);
1105 
1111  expression to_expression(const automaton& aut,
1112  identities ids = {},
1113  const std::string& algo = "auto");
1114 
1116  expression to_expression(const expansion& exp);
1117 
1119  expression to_expression(const context& ctx, identities ids,
1120  const label& l);
1121 
1133  expression to_expression(const context& ctx, identities ids,
1134  const letter_class_t& letters,
1135  bool accept = true);
1136 
1138  automaton transpose(automaton& aut);
1139 
1141  expression transpose(const expression& e);
1142 
1145 
1150  automaton trie(const polynomial& p);
1151 
1158  automaton trie(const context& ctx, std::istream& is,
1159  const std::string& format = "default");
1160 
1162  automaton trim(const automaton& aut);
1163 
1168  automaton tuple(const automaton& lhs, const automaton& rhs);
1169 
1173  automaton tuple(const std::vector<automaton>& as);
1174 
1176  context tuple(const context& lhs, const context& rhs);
1177 
1181  context tuple(const std::vector<context>& ctxs);
1182 
1184  expansion tuple(const std::vector<expansion>& rs);
1185 
1187  expression tuple(const expression& lhs, const expression& rhs);
1188 
1190  expression tuple(const std::vector<expression>& rs);
1191 
1193  polynomial tuple(const std::vector<polynomial>& ps);
1194 
1196  std::string type(const automaton& a);
1197 
1199  automaton u(const context& ctx, unsigned n);
1200 
1202  automaton universal(const automaton& aut);
1203 
1205  weight weight_one(const context& c);
1206 
1208  weight weight_series(const automaton& aut);
1209 
1211  weight weight_zero(const context& c);
1212 
1218  automaton zpc(const expression& exp, const std::string& algo = "auto");
1219 
1221  std::ostream& operator<<(std::ostream& o, const automaton& a);
1222 
1224  std::ostream& operator<<(std::ostream& o, const context& c);
1225 
1227  std::ostream& operator<<(std::ostream& o, const expansion& e);
1228 
1230  std::ostream& operator<<(std::ostream& o, const expression& r);
1231 
1233  std::ostream& operator<<(std::ostream& o, const label& l);
1234 
1236  std::ostream& operator<<(std::ostream& o, const polynomial& p);
1237 
1239  std::ostream& operator<<(std::ostream& o, const weight& w);
1240  }
1241 }
1242 
1243 #include <vcsn/dyn/algos.hxx>
value_impl< detail::expansion_tag > expansion
Definition: fwd.hh:30
expansion to_expansion(const expression &exp)
First order development of a exp.
expression expression_one(const context &c, identities ids)
The expression for \\e.
Definition: constant.hh:15
automaton conjugate(const automaton &aut)
The conjugate of aut.
Definition: conjugate.hh:59
automaton eliminate_state(const automaton &aut, int s=-1)
The LAO automaton aut with state s removed.
Definition: to-automaton.hh:46
bool is_normalized(const automaton &aut)
Whether is normalized (in the Thompson sense), i.e., standard and co-standard.
Definition: normalize.hh:37
std::string configuration(const std::string &key)
Access a configuration value.
Definition: algos.hxx:25
automaton filter(const automaton &aut, const std::vector< unsigned > &ss)
The subautomaton based on aut, with only states in ss visible.
Definition: filter.hh:346
label read_label(const context &ctx, std::istream &is, const std::string &format="default")
Read a label from a stream.
Definition: read.cc:126
automaton tuple(const automaton &lhs, const automaton &rhs)
Build a two-tape automaton from two automata.
Definition: others.cc:218
polynomial make_polynomial(const context &ctx, const std::string &s)
Build a polynomial from a string.
Definition: algos.hxx:108
weightset_mixin< detail::r_impl > r
Definition: fwd.hh:54
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
polynomial lgcd(const polynomial &lhs, const polynomial &rhs)
Left greatest common divisor of two polynomials (lhs \ rhs).
polynomial split(const expression &exp)
Break exp.
automaton project(const automaton &aut, unsigned tape)
Keep a single tape from a multiple-tape automaton.
Definition: others.cc:112
bool are_equal(const automaton &lhs, const automaton &rhs)
Whether are the same automaton.
Definition: algos.hxx:13
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...
Definition: scc.hh:708
automaton derived_term(const expression &exp, const std::string &algo="auto")
The derived-term automaton of exp.
automaton make_automaton(const std::string &data, const std::string &format="default", bool strip=true)
Read an automaton from a string.
Definition: algos.hxx:52
bool is_useless(const automaton &aut)
Whether has no useful state.
Definition: accessible.hh:264
automaton complement(const automaton &aut)
The complement of aut.
Definition: complement.hh:63
automaton normalize(const automaton &aut)
Normalize automaton aut.
Definition: normalize.hh:45
weight random_weight(const context &ctx, const std::string &param)
A random weight.
automaton cominimize(const automaton &aut, const std::string &algo="auto")
The cominimized automaton.
Definition: minimize.hh:196
bool less_than(const automaton &lhs, const automaton &rhs)
Ordering between automata.
Definition: algos.hxx:40
context make_word_context(const context &ctx)
The context for words.
expansion denormalize(const expansion &x)
Denormalize expansion x.
automaton sort(const automaton &a)
A copy of a with normalized state numbers.
Definition: sort.hh:176
bool is_partial_identity(const automaton &aut)
Whether aut realizes a partial identity.
automaton compose(const automaton &lhs, const automaton &rhs, bool lazy=false)
The composition of transducers lhs and rhs.
Definition: compose.hh:499
automaton push_weights(const automaton &aut)
The weight pushing automaton of aut.
Definition: push-weights.hh:71
expression to_expression(const automaton &aut, identities ids={}, const std::string &algo="auto")
An expression denoting the language of aut.
automaton infiltrate(const automaton &lhs, const automaton &rhs)
The infiltration of automata lhs and rhs.
Definition: others.cc:55
context make_context(const std::string &name)
Build a context from its name.
Definition: others.cc:96
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
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
::vcsn::direction direction
Direction for proper on automata.
Definition: types.hh:13
bool is_standard(const automaton &aut)
Whether is standard (unique initial state, with weight one, no incoming transition).
Definition: standard.hh:54
#define LIBVCSN_API
Definition: export.hh:8
return exp min
Definition: multiply.hh:362
automaton realtime(const automaton &aut)
Create the realtime automaton (letterized and proper).
Definition: letterize.hh:231
weight weight_one(const context &c)
The weight one.
Definition: constant.hh:33
automaton focus(const automaton &aut, unsigned tape)
Focus on a specific tape of a tupleset automaton.
Definition: others.cc:43
expression star_normal_form(const expression &e)
A normalized form where star is applied only to proper expressions.
expression read_expression(const context &ctx, identities ids, std::istream &is, const std::string &format="default", const location &loc=location{})
Read an expression from a stream.
Definition: read.cc:100
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:73
bool is_realtime(const automaton &aut)
Whether has no spontaneous transition, and is letterized.
Definition: letterize.hh:259
automaton universal(const automaton &aut)
The universal automaton of aut.
Definition: universal.hh:148
automaton suffix(const automaton &aut)
Create a suffix automaton from aut.
Definition: prefix.hh:44
expression transposition(const expression &r)
Add the transposition operator to r.
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
automaton trie(const polynomial &p)
A trie-like automaton (single initial state, multiple final states) to accept p.
Definition: trie.hh:242
std::string get_format(std::ostream &out)
Get the output format for out.
Definition: print.cc:171
value_impl< detail::polynomial_tag > polynomial
Definition: fwd.hh:33
bool is_trim(const automaton &aut)
Whether has no useless state.
Definition: accessible.hh:255
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.
Definition: weight.hh:351
bool is_cycle_ambiguous(const automaton &aut)
Whether the automaton is cycle-ambiguous.
weight read_weight(const context &ctx, std::istream &is)
Read a weight from a stream.
Definition: read.hh:89
automaton insplit(const automaton &aut, bool lazy=false)
Split automaton on the incoming transition.
Definition: insplit.hh:284
automaton cotrie(const polynomial &p)
A reversed trie-like automaton (multiple initial states, single final state) automaton to accept p...
Definition: trie.hh:251
bool is_coaccessible(const automaton &aut)
Whether aut is coaccessible.
Definition: accessible.hh:246
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.
Definition: others.cc:175
std::size_t num_tapes(const context &ctx)
The number of input tapes.
Definition: num-tapes.hh:35
bool has_lightening_cycle(const automaton &aut)
Whether the automaton has a cycle with lightening weight.
expression expand(const expression &e)
Distribute product over addition recursively under the starred subexpressions and group the equal mon...
bool has_bounded_lag(const automaton &aut)
Whether the transducer has bounded lag.
vcsn::rat::location location
Pairs of positions in a file/stream.
Definition: fwd.hh:36
bool is_normal(const expansion &x)
Whether has no polynomial for the empty word.
bool is_synchronizing(const automaton &aut)
Whether is synchronizing.
label make_label(const context &ctx, const std::string &s, const std::string &format="default")
Build a label from a string.
Definition: algos.hxx:90
automaton condense(const automaton &aut)
The condensation of aut such that each state is a strongly connected component.
Definition: scc.hh:836
automaton rdivide(const automaton &lhs, const automaton &rhs)
Right-division of two automata (lhs / rhs).
Definition: conjunction.hh:766
std::size_t num_components(const automaton &aut)
The number of strongly connected components.
Definition: scc.hh:739
bool is_functional(const automaton &aut)
Whether aut is functional.
void set_format(std::ostream &out, const std::string &format)
Specify the output format for out.
Definition: print.cc:164
bool is_synchronized(const automaton &aut)
Whether is synchronized.
automaton quotkbaseb(const context &ctx, unsigned divisor, unsigned base)
A transducer that computes the quotient of the division of a word n by k in base b iff k|n...
Definition: quotkbaseb.hh:76
automaton standard(const automaton &a)
A standardized a.
Definition: standard.hh:139
bool is_ambiguous(const automaton &aut)
Whether aut is ambiguous.
weight weight_zero(const context &c)
The weight zero.
Definition: constant.hh:42
automaton conjunction(const automaton &lhs, const automaton &rhs, bool lazy=false)
The conjunction (aka synchronized product) of automata.
Definition: others.cc:23
label word
The type of a word.
Definition: types.hh:26
word synchronizing_word(const automaton &aut, const std::string &algo="greedy")
A synchronizing word, or raise if there is none.
expression random_expression(const context &ctx, const std::string &param="+, ., *=.2, w., .w, length=10", identities ids={})
A random expression.
automaton trim(const automaton &aut)
The trim subautomaton of aut.
Definition: accessible.hh:228
expression concatenate(const expression &lhs, const expression &rhs)
Concatenate two expressions.
polynomial shortest(const automaton &aut, boost::optional< unsigned > num={}, boost::optional< unsigned > len={})
The approximated behavior of an automaton.
Definition: shortest.hh:321
std::ostream & operator<<(std::ostream &o, const automaton &a)
Output automaton a on o.
Definition: print.cc:178
weight weight_series(const automaton &aut)
Compute weight of the series.
automaton delay_automaton(const automaton &a)
The automaton with the delay of each state.
automaton lift(const automaton &aut, const std::vector< unsigned > &tapes={}, identities ids={})
Lift some tapes of the transducer, or turn an automaton into a spontaneous automaton.
Definition: others.cc:68
Definition: a-star.hh:8
automaton minimize(const automaton &aut, const std::string &algo="auto")
The minimized automaton.
Definition: minimize.hh:158
bool is_eps_acyclic(const automaton &aut)
Whether has no cycle of spontaneous transitions.
Definition: is-acyclic.hh:143
automaton thompson(const expression &e)
The Thompson automaton of e.
automaton factor(const automaton &aut)
Create a factor automaton from aut.
Definition: prefix.hh:121
automaton component(const automaton &aut, unsigned num)
The automaton of a strongly connected component.
Definition: scc.hh:775
context context_of(const automaton &a)
The context of this automaton.
Definition: make-context.hh:62
bool is_accessible(const automaton &aut)
Whether aut is accessible.
Definition: accessible.hh:237
std::string type(const automaton &a)
The implementation type of a.
Definition: others.cc:238
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
std::set< std::pair< std::string, std::string > > letter_class_t
A set of letter ranges.
Definition: fwd.hh:111
identities identities_of(const expression &exp)
The identities of expression exp.
automaton transpose(automaton &aut)
Transpose aut.
Definition: transpose.hh:273
automaton star(const automaton &aut, const std::string &algo="auto")
Star of an automaton.
Definition: star.hh:124
automaton shuffle(const automaton &lhs, const automaton &rhs)
The shuffle product of automata lhs and rhs.
Definition: others.cc:163
bool is_complete(const automaton &aut)
Whether aut is complete.
Definition: is-complete.hh:52
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.
automaton complete(const automaton &aut)
A completed copy of aut.
Definition: complete.hh:80
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
automaton ladybird(const context &ctx, unsigned n)
The ladybird automaton with n states.
Definition: ladybird.hh:54
automaton zpc(const expression &exp, const std::string &algo="auto")
The ZPC automaton of exp.
automaton difference(const automaton &lhs, const automaton &rhs)
An automaton whose behavior is that of lhs on words not accepted by rhs.
automaton partial_identity(const automaton &aut)
Create a partial identity transducer from aut.
weight make_weight(const context &ctx, const std::string &s)
Build a weight from a string.
Definition: algos.hxx:125
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
automaton multiply(const automaton &lhs, const automaton &rhs, const std::string &algo="auto")
Multiply (concatenate) two automata.
Definition: multiply.hh:169
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 has_twins_property(const automaton &aut)
Whether the automaton has the twins property.
automaton costandard(const automaton &a)
A co-standardized a.
Definition: standard.hh:148
polynomial derivation(const expression &exp, const label &lbl, bool breaking=false)
Derive exp with respect to s.
bool are_isomorphic(const automaton &lhs, const automaton &rhs)
Whether there exists an isomorphism between the states of lhs and those of rhs.
label make_word(const context &ctx, const std::string &s, const std::string &format="default")
Build a word from a string.
Definition: algos.hxx:142
bool is_proper(const automaton &aut)
Whether has no spontaneous transition.
Definition: is-proper.hh:58
value_impl< detail::label_tag > label
Definition: fwd.hh:32
automaton pair(const automaton &aut, bool keep_initials=false)
Build the pair automaton of the given automaton.
Definition: pair.hh:264
value_impl< detail::expression_tag > expression
Definition: fwd.hh:31
automaton coaccessible(const automaton &aut)
The coaccessible subautomaton of aut.
Definition: accessible.hh:219
automaton reduce(const automaton &aut)
Reduce aut.
Definition: reduce.hh:621
Looking upstream.
bool is_valid(const automaton &e)
Whether automaton is valid (epsilon-cycles converge).
Definition: is-valid.hh:150
unsigned star_height(const expression &rs)
Star height of an expression.
automaton u(const context &ctx, unsigned n)
The Brzozowski universal witness.
Definition: u.hh:68
automaton random_automaton_deterministic(const context &ctx, unsigned num_states)
A random deterministic automaton.
std::string format(const Value &v, const std::string &format="default")
Definition: algos.hxx:31
static identities ids(const driver &d)
Get the identities of the driver.
Definition: parse.cc:91
::vcsn::rat::identities identities
Sets of identities on expressions.
Definition: fwd.hh:17
automaton letterize(const automaton &aut)
The automaton with letter transitions instead of words.
Definition: letterize.hh:146
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
weight evaluate(const automaton &aut, const word &l)
Evaluate l on aut.
Definition: evaluate.hh:223
automaton synchronize(const automaton &aut)
Create a synchronized transducer from aut.
Definition: synchronize.hh:362
expression name(const expression &exp, const std::string &name)
Name an expression.
std::ostream & info(const automaton &aut, std::ostream &out=std::cout, unsigned details=2)
Output various facts about an automaton.
Definition: info.hh:136
automaton de_bruijn(const context &ctx, unsigned n)
A simple NFA for (a+b)*a(a+b)^n.
Definition: de-bruijn.hh:57
automaton inductive(const expression &e, const std::string &algo="auto")
The inductive translation of e in an automaton.
bool is_letterized(const automaton &aut)
Whether aut is letterized.
Definition: letterize.hh:201
automaton determinize(const automaton &aut, const std::string &algo="auto")
The determinized automaton.
Definition: determinize.hh:357
automaton codeterminize(const automaton &aut, const std::string &algo="auto")
The codeterminized automaton.
Definition: determinize.hh:435
bool is_costandard(const automaton &aut)
Whether is costandard (unique final state, with weight one, no outcoming transition).
Definition: standard.hh:63
automaton random_automaton(const context &ctx, unsigned num_states, float density=0.1, unsigned num_initial=1, unsigned num_final=1, boost::optional< unsigned > max_labels={}, float loop_chance=0.0, const std::string &weights="")
A random automaton.
bool is_synchronized_by(const automaton &aut, const word &word)
Whether the word synchronizes aut.
automaton_editor * make_automaton_editor(const context &ctx)
Build an automaton editor from its context.
automaton subword(const automaton &aut)
Create a subword automaton from aut.
Definition: prefix.hh:174
automaton accessible(const automaton &aut)
The accessible subautomaton of aut.
Definition: accessible.hh:210
bool is_out_sorted(const automaton &aut)
Whether the outgoing transitions of each state have increasing labels.
Definition: sort.hh:75
word ambiguous_word(const automaton &aut)
An ambiguous word, or raise if there is none.
automaton ldivide(const automaton &lhs, const automaton &rhs)
Left-division of two automata (lhs \ rhs).
Definition: conjunction.hh:731
int compare(const automaton &lhs, const automaton &rhs)
Three-way comparison between automata.
value_impl< detail::weight_tag > weight
Definition: fwd.hh:34
automaton cerny(const context &ctx, unsigned num_states)
Produce a Černý automaton of num_states states.
Definition: cerny.hh:64
expression expression_zero(const context &c, identities ids)
The expression for \\z.
Definition: constant.hh:24
context join(const context &lhs, const context &rhs)
The join between two contexts, i.e., their lowest common supertype.
automaton add(const automaton &lhs, const automaton &rhs, const std::string &algo="auto")
Sum of two automata.
Definition: add.hh:124
bool is_empty(const automaton &aut)
Whether has no state.
Definition: accessible.hh:273
polynomial read_polynomial(const context &ctx, std::istream &is)
Read a polynomial from a stream.
Definition: read.hh:59
auto out(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions leaving state s.
Definition: automaton.hh:86