Vcsn  2.8
Be Rational
nullableset.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 #include <sstream>
5 
6 #include <boost/optional.hpp>
7 
8 #include <vcsn/alphabets/setalpha.hh> // intersect
9 #include <vcsn/core/kind.hh>
10 #include <vcsn/labelset/fwd.hh>
13 #include <vcsn/labelset/oneset.hh>
14 #include <vcsn/misc/escape.hh>
15 #include <vcsn/misc/functional.hh>
16 #include <vcsn/misc/raise.hh>
17 
18 namespace vcsn
19 {
20  namespace detail
21  {
28  template <typename LabelSet>
30  {
31  using labelset_t = LabelSet;
32  using value_t = std::pair<typename labelset_t::value_t, bool>;
33 
34  ATTRIBUTE_PURE
35  static constexpr value_t
36  one()
37  {
38  return value_t{labelset_t::special(), true};
39  }
40 
41  ATTRIBUTE_PURE
42  static constexpr value_t
44  {
45  return value_t{labelset_t::special(), false};
46  }
47 
48  template <typename Ls>
49  ATTRIBUTE_PURE
50  static std::enable_if_t<Ls::has_one(), bool>
51  is_one_(const value_t& l)
52  {
53  return std::get<1>(l) || Ls::is_one(get_value(l));
54  }
55 
56  template <typename Ls>
57  ATTRIBUTE_PURE
58  static std::enable_if_t<!Ls::has_one(), bool>
59  is_one_(const value_t& l)
60  {
61  return std::get<1>(l);
62  }
63 
64  ATTRIBUTE_PURE
65  static bool
66  is_one(const value_t& l)
67  {
68  return is_one_<labelset_t>(l);
69  }
70 
71  template <typename Value>
72  static Value
73  transpose(const labelset_t& ls, Value l)
74  {
75  // This is not robust enough: Value is word_t, then it's not
76  // valid to call is_one on it. Since I'm unsure of the future
77  // of nullableset, let's not waste time on this now.
78  if (is_one(l))
79  return l;
80  else
81  return {ls.transpose(get_value(l)), false};
82  }
83 
84  template <typename... Args>
85  static value_t
86  value(const labelset_t& ls, Args&&... args)
87  {
88  return {ls.value(std::forward<Args>(args)...), false};
89  }
90 
91  ATTRIBUTE_PURE
92  static typename labelset_t::value_t
94  {
95  return std::get<0>(v);
96  }
97 
98  static auto generators(const labelset_t& ls)
99  {
100  return ls.generators();
101  }
102 
103  static auto pregenerators(const labelset_t& ls)
104  {
105  return ls.pregenerators();
106  }
107  };
108 
115  template <typename GenSet>
116  struct nullable_helper<letterset<GenSet>>
117  {
118  using genset_t = GenSet;
120  using value_t = typename labelset_t::value_t;
121 
122  ATTRIBUTE_PURE
123  static constexpr value_t
125  {
126  return genset_t::special();
127  }
128 
129  ATTRIBUTE_PURE
130  static constexpr value_t
131  one()
132  {
133  return genset_t::one_letter();
134  }
135 
136  ATTRIBUTE_PURE
137  static bool
139  {
140  return l == one();
141  }
142 
143  template <typename Value>
144  static Value
145  transpose(const labelset_t& ls, const Value& l)
146  {
147  return ls.transpose(l);
148  }
149 
150  template <typename... Args>
151  static value_t
152  value(const labelset_t& ls, Args&&... args)
153  {
154  return ls.value(std::forward<Args>(args)...);
155  }
156 
157  ATTRIBUTE_PURE
158  static value_t
160  {
161  return v;
162  }
163 
164  static auto generators(const labelset_t& ls)
165  {
166  return ls.generators();
167  }
168 
169  static auto pregenerators(const labelset_t& ls)
170  {
171  return ls.genset()->pregenerators();
172  }
173  };
174  }
175 
177  template <typename LabelSet>
178  class nullableset
179  {
180  public:
181  using labelset_t = LabelSet;
182  using labelset_ptr = std::shared_ptr<const labelset_t>;
186 
187  using value_t = typename helper_t::value_t;
188  using letter_t = typename labelset_t::letter_t;
189  using word_t = typename labelset_t::word_t;
190 
191  private:
195 
196  public:
197  using genset_ptr = decltype(ls_->genset());
198  using genset_t = decltype(ls_->generators());
199 
200  public:
202  : ls_{ls}
203  {}
204 
205  nullableset(const labelset_t& ls = {})
206  : nullableset{std::make_shared<const labelset_t>(ls)}
207  {}
208 
210  {}
211 
212  static symbol sname()
213  {
214  static auto res = symbol{"nullableset<" + labelset_t::sname() + '>'};
215  return res;
216  }
217 
219  static nullableset make(std::istream& is)
220  {
221  // name: nullableset<lal_char(abc)>.
222  // ^^^^^^^^^^^^
223  // labelset
224  eat(is, "nullableset<");
225  auto ls = labelset_t::make(is);
226  eat(is, '>');
227  return {ls};
228  }
229 
233  bool open(bool o) const
234  {
235  return this->ls_->open(o);
236  }
237 
238  static constexpr bool
240  {
241  return true;
242  }
243 
244  static constexpr bool
246  {
247  return false;
248  }
249 
250  static constexpr bool
252  {
253  return labelset_t::is_letterized();
254  }
255 
256  static constexpr bool is_free()
257  {
258  return false;
259  }
260 
261  ATTRIBUTE_PURE
262  static constexpr value_t
263  one()
264  {
265  return helper_t::one();
266  }
267 
268  ATTRIBUTE_PURE
269  static bool
271  {
272  return helper_t::is_one(l);
273  }
274 
275  bool
277  {
278  return is_one(v) || ls_->is_valid(get_value(v));
279  }
280 
281  genset_ptr
282  genset() const
283  {
284  return ls_->genset();
285  }
286 
288  decltype(auto)
289  generators() const
290  {
291  return helper_t::generators(*ls_);
292  }
293 
295  decltype(auto)
297  {
298  return helper_t::pregenerators(*ls_);
299  }
300 
301  value_t
303  {
305  *this, ": conv: invalid label: ", to_string(*this, v));
306  return v;
307  }
308 
309  value_t
310  conv(oneset, typename oneset::value_t) const
311  {
312  return one();
313  }
314 
318  template <typename LabelSet_>
319  value_t
320  conv(const LabelSet_& ls, typename LabelSet_::value_t v) const
321  {
322  return value(ls_->conv(ls, v));
323  }
324 
325  const labelset_ptr labelset() const
326  {
327  return ls_;
328  }
329 
330  template <typename... Args>
331  value_t
332  value(Args&&... args) const
333  {
334  return helper_t::value(*ls_, std::forward<Args>(args)...);
335  }
336 
337  word_t
338  word(const value_t& l) const
339  {
340  if (is_one(l))
341  return make_wordset(*labelset()).one();
342  else
343  return ls_->word(get_value(l));
344  }
345 
347  auto static
349  -> decltype(labelset_t::letters_of(v))
350  {
351  return labelset_t::letters_of(v);
352  }
353 
356  auto
358  -> decltype(ls_->letters_of_padded(v, l))
359  {
360  return ls_->letters_of_padded(v, l);
361  }
362 
363  auto
365  -> decltype(this->letters_of_padded(this->word(v), l))
366  {
367  return letters_of_padded(word(v), l);
368  }
369 
371  static int compare(const value_t& l, const value_t& r)
372  {
373  if (auto res = int(is_one(r)) - int(is_one(l)))
374  return res;
375  else
376  return labelset_t::compare(get_value(l), get_value(r));
377  }
378 
380  static bool equal(const value_t& l, const value_t& r)
381  {
382  if (is_one(l))
383  return is_one(r);
384  else
385  return !is_one(r) && labelset_t::equal(get_value(l), get_value(r));
386  }
387 
389  static bool less(const value_t& l, const value_t& r)
390  {
391  if (is_one(r))
392  return false;
393  else if (is_one(l))
394  return true;
395  else
396  return labelset_t::less(get_value(l), get_value(r));
397  }
398 
400  value_t mul(const value_t& l, const value_t& r) const
401  {
402  if (is_one(r))
403  return l;
404  else if (is_one(l))
405  return r;
406  else
407  raise(*this, ": mul: invalid arguments: ",
408  to_string(*this, l), ", ", to_string(*this, r));
409  }
410 
412  value_t lgcd(const value_t& l, const value_t& r) const
413  {
414  if (equal(l, r))
415  return l;
416  else if (is_one(l) || is_one(r))
417  return one();
418  else
419  return value(ls_->lgcd(get_value(l), get_value(r)));
420  }
421 
423  value_t ldivide(const value_t& l, const value_t& r) const
424  {
425  if (auto res = maybe_ldivide(l, r))
426  return *res;
427  else
428  raise(*this, ": ldivide: invalid arguments: ",
429  to_string(*this, l), ", ", to_string(*this, r));
430  }
431 
432  boost::optional<value_t>
433  maybe_ldivide(const value_t& l, const value_t& r) const
434  {
435  if (equal(l, r))
436  return one();
437  else if (is_one(l))
438  return r;
439  else if (is_one(r))
440  return boost::none;
441  else if (auto res = ls_->maybe_ldivide(get_value(l), get_value(r)))
442  return value(*res);
443  else
444  return boost::none;
445  }
446 
448  value_t rdivide(const value_t& l, const value_t& r) const
449  {
450  if (auto res = maybe_rdivide(l, r))
451  return *res;
452  else
453  raise(*this, ": rdivide: invalid arguments: ",
454  to_string(*this, l), ", ", to_string(*this, r));
455  }
456 
457  boost::optional<value_t>
458  maybe_rdivide(const value_t& l, const value_t& r) const
459  {
460  if (equal(l, r))
461  return one();
462  else if (is_one(l))
463  return boost::none;
464  else if (is_one(r))
465  return l;
466  else if (auto res = ls_->maybe_rdivide(get_value(l), get_value(r)))
467  return value(*res);
468  else
469  return boost::none;
470  }
471 
472  static value_t
474  {
475  return helper_t::special();
476  }
477 
478  static bool
480  {
481  return !is_one(v) && labelset_t::is_special(get_value(v));
482  }
483 
484  static size_t size(const value_t& v)
485  {
486  return is_one(v) ? 0 : labelset_t::size(get_value(v));
487  }
488 
489  // FIXME: specialize for both implementation.
490  static size_t hash(const value_t& v)
491  {
492  // Do not use get_value when is_one. Let's hash one() as 0.
493  return is_one(v) ? 0 : labelset_t::hash(get_value(v));
494  }
495 
496  letter_t
497  get_letter(std::istream& i, bool quoted = true) const
498  {
499  return ls_->get_letter(i, quoted);
500  }
501 
503  value_t
504  conv(std::istream& i, bool quoted = true) const
505  {
506  // Check for '\e', otherwise pass it to the inner labelset.
507  if (i.good() && i.peek() == '\\')
508  {
509  i.ignore();
510  int c = i.peek();
511  if (c == 'e')
512  {
513  i.ignore();
514  return {};
515  }
516  else
517  i.unget();
518  }
519  return value(ls_->conv(i, quoted));
520  }
521 
531  template <typename Fun>
532  void convs(std::istream& i, Fun&& fun) const
533  {
534  ls_->convs(i,
535  [this,fun](const typename labelset_t::value_t& l)
536  {
537  fun(value(l));
538  });
539  }
540 
541  value_t conjunction(const value_t& l, const value_t& r) const
542  {
543  if (is_one(l) && is_one(r))
544  return l;
545  else if (!is_one(l) && !is_one(r))
546  return ls_->conjunction(get_value(l), get_value(r));
547  else
548  raise(*this,
549  ": conjunction: invalid operation (lhs and rhs are not equal): ",
550  to_string(*this, l), ", ", to_string(*this, r));
551  }
552 
554  std::ostream&
555  print(const value_t& l, std::ostream& o = std::cout,
556  format fmt = {}) const
557  {
558  if (is_one(l))
559  o << (fmt == format::latex ? "\\varepsilon"
560  : fmt == format::utf8 ? "ε"
561  : "\\e");
562  else
563  ls_->print(get_value(l), o, fmt);
564  return o;
565  }
566 
567  bool
568  is_letter(const value_t& v) const
569  {
570  return !is_one(v) && ls_->is_letter(get_value(v));
571  }
572 
574  template <typename Value>
575  Value
576  transpose(const Value& l) const
577  {
578  return helper_t::transpose(*ls_, l);
579  }
580 
582  std::ostream&
583  print_set(std::ostream& o, format fmt = {}) const
584  {
585  switch (fmt.kind())
586  {
587  case format::latex:
588  o << "(";
589  ls_->print_set(o, fmt);
590  o << ")^?";
591  break;
592 
593  case format::sname:
594  o << "nullableset<";
595  ls_->print_set(o, fmt);
596  o << '>';
597  break;
598 
599  case format::text:
600  case format::utf8:
601  ls_->print_set(o, fmt);
602  o << '?';
603  break;
604 
605  case format::raw:
606  assert(0);
607  break;
608  }
609 
610  return o;
611  }
612 
614  static typename labelset_t::value_t
615  get_value(const value_t& v)
616  {
617  assert(!is_one(v));
618  return helper_t::get_value(v);
619  }
620  };
621 
622  namespace detail
623  {
625  template <typename LabelSet>
626  struct letterized_traits<nullableset<LabelSet>>
627  {
628  using traits = letterized_traits<LabelSet>;
629  static constexpr bool is_letterized = traits::is_letterized;
630 
631  using labelset_t = typename traits::labelset_t;
632 
633  static labelset_t labelset(const nullableset<LabelSet>& ls)
634  {
635  return make_letterized(*ls.labelset());
636  }
637  };
638 
640  template <typename LabelSet>
641  struct nullableset_traits<nullableset<LabelSet>>
642  {
643  using type = nullableset<LabelSet>;
644  static type value(const nullableset<LabelSet>& ls)
645  {
646  return ls;
647  }
648  };
649 
650  template <typename LabelSet>
651  struct proper_traits<nullableset<LabelSet>>
652  {
653  using type = LabelSet;
654  static type value(const nullableset<LabelSet>& ls)
655  {
656  return *ls.labelset();
657  }
658  };
659 
661  template <typename LabelSet>
662  struct law_traits<nullableset<LabelSet>>
663  {
664  using type = law_t<LabelSet>;
665  static type value(const nullableset<LabelSet>& ls)
666  {
667  return make_wordset(*ls.labelset());
668  }
669  };
670 
671  /*-------.
672  | Join. |
673  `-------*/
674 
676  template <typename LS>
677  struct join_impl<oneset, LS,
678  std::enable_if_t<!LS::has_one()>>
679  {
680  using type = nullableset<LS>;
681  static type join(const oneset&, const LS& ls)
682  {
683  return {ls};
684  }
685  };
686 
688  template <typename LS>
689  struct join_impl<oneset, LS,
690  std::enable_if_t<LS::has_one()>>
691  {
692  using type = LS;
693  static type join(const oneset&, const LS& ls)
694  {
695  return ls;
696  }
697  };
698 
700  template <typename LS1, typename LS2>
701  struct join_impl<nullableset<LS1>, LS2>
702  {
703  using type = std::conditional_t<LS2::has_one(),
704  join_t<LS1, LS2>,
705  nullableset<join_t<LS1, LS2>>>;
706  static type join(const nullableset<LS1>& ls1, const LS2& ls2)
707  {
708  return {::vcsn::join(*ls1.labelset(), ls2)};
709  }
710  };
711 
716  template <typename LS1, typename LS2>
717  struct join_impl<nullableset<LS1>, nullableset<LS2>>
718  {
719  using type = nullableset<join_t<LS1, LS2>>;
720  static type join(const nullableset<LS1>& ls1,
721  const nullableset<LS2>& ls2)
722  {
723  return {::vcsn::join(*ls1.labelset(), *ls2.labelset())};
724  }
725  };
726  }
727 
728  /*-------.
729  | Meet. |
730  `-------*/
731 
732 #define DEFINE(Lhs, Rhs, Res) \
733  template <typename GenSet> \
734  Res \
735  meet(const Lhs& lhs, const Rhs& rhs) \
736  { \
737  return {set_intersection(*lhs.genset(), *rhs.genset())}; \
738  }
739 
741  DEFINE(nullableset<letterset<GenSet>>,
742  nullableset<letterset<GenSet>>, nullableset<letterset<GenSet>>);
743 
744  DEFINE(letterset<GenSet>,
745  nullableset<letterset<GenSet>>, nullableset<letterset<GenSet>>);
746 
747  DEFINE(nullableset<letterset<GenSet>>,
748  letterset<GenSet>, nullableset<letterset<GenSet>>);
749 
750  template <typename Lls, typename Rls>
751  nullableset<meet_t<Lls, Rls>>
752  meet(const nullableset<Lls>& lhs, const nullableset<Rls>& rhs)
753  {
754  return nullableset<meet_t<Lls, Rls>>{meet(*lhs.labelset(),
755  *rhs.labelset())};
756  }
757 
758 #undef DEFINE
759 
760 
761  /*----------------.
762  | random_label. |
763  `----------------*/
764 
766  template <typename LabelSet,
767  typename RandomGenerator = std::default_random_engine>
768  typename nullableset<LabelSet>::value_t
769  random_label(const nullableset<LabelSet>& ls,
770  RandomGenerator& gen = RandomGenerator())
771  {
772  // FIXME: the proportion should be controllable.
773  auto dis = std::bernoulli_distribution(0.5);
774  if (dis(gen) || ls.generators().empty())
775  return ls.one();
776  else
777  return ls.value(random_label(*ls.labelset(), gen));
778  }
779 }
genset_ptr genset() const
Definition: nullableset.hh:282
static symbol sname()
Definition: nullableset.hh:212
Aut transpose(const transpose_automaton< Aut > &aut)
The transpose of a transpose automaton is the original automaton.
Definition: transpose.hh:253
std::pair< typename labelset_t::value_t, bool > value_t
Definition: nullableset.hh:32
nullableset(const labelset_ptr &ls)
Definition: nullableset.hh:201
static Value transpose(const labelset_t &ls, const Value &l)
Definition: nullableset.hh:145
static auto generators(const labelset_t &ls)
Definition: nullableset.hh:164
Implementation of labels are ones: there is a single instance of label.
Definition: oneset.hh:19
Print as a parsable type string.
Definition: format.hh:26
value_t conjunction(const value_t &l, const value_t &r) const
Definition: nullableset.hh:541
static ATTRIBUTE_PURE constexpr value_t one()
Definition: nullableset.hh:263
value_t rdivide(const value_t &l, const value_t &r) const
Compute l / r.
Definition: nullableset.hh:448
weightset_mixin< detail::r_impl > r
Definition: fwd.hh:54
static ATTRIBUTE_PURE constexpr value_t one()
Definition: nullableset.hh:131
typename labelset_t::letter_t letter_t
Definition: nullableset.hh:188
bool is_valid(const Aut &aut)
Definition: is-valid.hh:139
Value transpose(const Value &l) const
Mirror label.
Definition: nullableset.hh:576
static ATTRIBUTE_PURE constexpr value_t special()
Definition: nullableset.hh:43
static ATTRIBUTE_PURE std::enable_if_t< Ls::has_one(), bool > is_one_(const value_t &l)
Definition: nullableset.hh:51
decltype(ls_->generators()) genset_t
Definition: nullableset.hh:198
static auto generators(const labelset_t &ls)
Definition: nullableset.hh:98
size_t size(const ExpSet &rs, const typename ExpSet::value_t &r)
value_t lgcd(const value_t &l, const value_t &r) const
The longest common prefix.
Definition: nullableset.hh:412
Implementation of labels are letters.
Definition: fwd.hh:10
static constexpr bool has_one()
Definition: nullableset.hh:239
value_t ldivide(const value_t &l, const value_t &r) const
Compute l \ r = l^{-1}r.
Definition: nullableset.hh:423
char eat(std::istream &is, char c)
Check lookahead character and advance.
Definition: stream.cc:147
value_t conv(oneset, typename oneset::value_t) const
Definition: nullableset.hh:310
nullableset(const labelset_t &ls={})
Definition: nullableset.hh:205
boost::optional< value_t > maybe_ldivide(const value_t &l, const value_t &r) const
Definition: nullableset.hh:433
bool value_t
Definition: oneset.hh:23
bool is_letter(const value_t &v) const
Definition: nullableset.hh:568
void convs(std::istream &i, Fun &&fun) const
Process a label class.
Definition: nullableset.hh:532
bool is_special(const Aut &aut, transition_t_of< Aut > t)
Whether this transition is from pre or to post.
Definition: automaton.hh:229
static constexpr bool is_letterized()
Definition: nullableset.hh:251
constant< type_t::one, Context > one
Definition: fwd.hh:121
static ATTRIBUTE_PURE labelset_t::value_t get_value(const value_t &v)
Definition: nullableset.hh:93
static auto pregenerators(const labelset_t &ls)
Definition: nullableset.hh:169
Add support for an empty word to a LabelSet that does not provide such special label to this end...
Definition: nullableset.hh:29
letter_t value_t
Definition: letterset.hh:33
auto generators() const
Definition: letterset.hh:81
boost::flyweight< std::string, boost::flyweights::no_tracking, boost::flyweights::intermodule_holder > symbol
An internalized string.
Definition: symbol.hh:21
static int compare(const value_t &l, const value_t &r)
Three way comparison between l and r.
Definition: nullableset.hh:371
static bool equal(const value_t &l, const value_t &r)
Whether l == r.
Definition: nullableset.hh:380
value_t value(Args &&... args) const
Value constructor.
Definition: letterset.hh:93
static ATTRIBUTE_PURE value_t get_value(const value_t &v)
Definition: nullableset.hh:159
static size_t size(const value_t &v)
Definition: nullableset.hh:484
static nullableset make(std::istream &is)
Build from the description in is.
Definition: nullableset.hh:219
Print as rich UTF-8 text, escaped.
Definition: format.hh:30
An input/output format for valuesets.
Definition: format.hh:13
static value_t special()
Definition: nullableset.hh:473
Provide a variadic mul on top of a binary mul(), and one().
Definition: fwd.hh:46
word_t word(const value_t &l) const
Definition: nullableset.hh:338
static constexpr bool is_free()
Definition: nullableset.hh:256
value_t mul(const value_t &l, const value_t &r) const
The concatenation.
Definition: nullableset.hh:400
typename helper_t::value_t value_t
Definition: nullableset.hh:187
static ATTRIBUTE_PURE bool is_one(const value_t &l)
Definition: nullableset.hh:66
bool is_valid(value_t v) const
Definition: nullableset.hh:276
Implementation of labels are nullables (letter or empty).
Definition: fwd.hh:14
static auto letters_of(const word_t &v) -> decltype(labelset_t::letters_of(v))
Prepare to iterate over the letters of v.
Definition: nullableset.hh:348
value_t conv(const LabelSet_ &ls, typename LabelSet_::value_t v) const
Conversion from another type: first by the wrapped labelset, and then by our wrappers (in case the wr...
Definition: nullableset.hh:320
std::ostream & print(const value_t &l, std::ostream &o=std::cout, format fmt={}) const
Print label to stream.
Definition: nullableset.hh:555
Definition: a-star.hh:8
const labelset_ptr labelset() const
Definition: nullableset.hh:325
static ATTRIBUTE_PURE bool is_one(value_t l)
Definition: nullableset.hh:138
labelset_ptr ls_
The wrapped LabelSet.
Definition: nullableset.hh:194
bool open(bool o) const
Whether unknown letters should be added, or rejected.
Definition: nullableset.hh:233
static ATTRIBUTE_PURE bool is_one(value_t l)
Definition: nullableset.hh:270
std::shared_ptr< const labelset_t > labelset_ptr
Definition: nullableset.hh:182
ATTRIBUTE_PURE auto transpose(Args &&... args) const -> decltype(this->genset() -> transpose(std::forward< Args >(args)...))
letter_t get_letter(std::istream &i, bool quoted=true) const
Definition: nullableset.hh:497
symbol sname()
Definition: name.hh:65
value_t conv(self_t, value_t v) const
Definition: nullableset.hh:302
static ATTRIBUTE_PURE constexpr value_t one()
Definition: nullableset.hh:36
auto letters_of_padded(value_t v, letter_t l) const -> decltype(this->letters_of_padded(this->word(v), l))
Definition: nullableset.hh:364
Print for LaTeX.
Definition: format.hh:22
static constexpr bool is_expressionset()
Definition: nullableset.hh:245
static value_t value(const labelset_t &ls, Args &&... args)
Definition: nullableset.hh:152
law_t< LabelSet > make_wordset(const LabelSet &ls)
The wordset of a labelset.
Definition: labelset.hh:259
static ATTRIBUTE_PURE constexpr value_t special()
Definition: nullableset.hh:124
typename labelset_t::word_t word_t
Definition: nullableset.hh:189
std::ostream & print_set(std::ostream &o, format fmt={}) const
Print labelset description.
Definition: nullableset.hh:583
decltype(ls_->genset()) genset_ptr
Definition: nullableset.hh:197
value_t value(Args &&... args) const
Definition: nullableset.hh:332
static size_t hash(const value_t &v)
Definition: nullableset.hh:490
boost::optional< value_t > maybe_rdivide(const value_t &l, const value_t &r) const
Definition: nullableset.hh:458
auto letters_of_padded(const word_t &v, letter_t l) const -> decltype(ls_->letters_of_padded(v, l))
Prepare to iterate over the letters of v.
Definition: nullableset.hh:357
std::string to_string(direction d)
Conversion to string.
Definition: direction.cc:7
static bool is_special(const value_t &v)
Definition: nullableset.hh:479
static bool less(const value_t &l, const value_t &r)
Whether l < r.
Definition: nullableset.hh:389
std::enable_if_t<!is_letterized_t< labelset_t_of< Aut > >{}, bool > is_letterized(const Aut &aut)
Definition: letterize.hh:161
static auto pregenerators(const labelset_t &ls)
Definition: nullableset.hh:103
static value_t value(const labelset_t &ls, Args &&... args)
Definition: nullableset.hh:86
#define VCSN_REQUIRE(Cond,...)
A macro similar to require.
Definition: raise.hh:98
int compare(const Lhs &lhs, const Rhs &rhs)
Comparison between lhs and rhs.
return res
Definition: multiply.hh:399
static ATTRIBUTE_PURE std::enable_if_t<!Ls::has_one(), bool > is_one_(const value_t &l)
Definition: nullableset.hh:59
value_t conv(std::istream &i, bool quoted=true) const
Read a label from a stream.
Definition: nullableset.hh:504
static Value transpose(const labelset_t &ls, Value l)
Definition: nullableset.hh:73