1 #ifndef VCSN_CORE_RAT_RATEXPSET_HH
2 # define VCSN_CORE_RAT_RATEXPSET_HH
28 template <
typename Context>
40 using weight_t =
typename weightset_t::value_t;
48 # define DEFINE(Type) \
49 using Type ## _t = vcsn::rat::Type<context_t>
75 template <type_t Type>
77 template <type_t Type>
85 static std::string
sname();
87 std::string
vname(
bool full =
true)
const;
100 bool open(
bool o)
const;
117 return atom(labelset_t::special());
149 return weightset_t::is_idempotent();
182 template <
typename GenSet>
190 template <
typename Ctx2>
236 template <
typename... Args>
246 std::set<value_t>
convs(std::istream&)
const
248 raise(
vname(),
": ranges not implemented");
257 if (format ==
"latex")
272 context().print_set(o, format);
275 else if (format ==
"text")
278 raise(
"invalid format: ", format);
286 typename values_t::iterator i)
const;
301 std::true_type)
const;
304 std::false_type)
const;
313 template <type_t Type>
320 template <type_t Type>
329 template <
typename LabelSet_,
typename... Args>
333 template <
typename LabelSet_>
336 typename LabelSet_::letter_t>> chars,
338 std::false_type)
const;
349 template <
typename Ctx>
360 template <
typename Ctx>
371 template <
typename Ctx1,
typename Ctx2>
378 return {
vcsn::join(lhs.context(), rhs.context()),
379 vcsn::join(lhs.identities(), rhs.identities())};
385 template <
typename GenSet1,
typename Ctx2>
400 template <
typename Context>
411 template <
typename Context>
425 template <
typename Context>
439 template <
typename Context>
453 template <
typename Context>
469 template <
typename Context>
473 return {ctx, identities};
477 template <
typename Ctx1,
typename Ctx2>
483 return {
meet(a.context(),
b.context()),
484 meet(a.identities(),
b.identities())};
491 #endif // !VCSN_CORE_RAT_RATEXPSET_HH
static self_type make(std::istream &is)
Build from the description in is.
std::ostream & print_set(std::ostream &o, symbol format=symbol{"text"}) const
labelset_t_of< context_t > labelset_t
static auto atom(const label_t &v) -> value_t
Build a label.
typename node_t::values_t values_t
A list (vector) of ratexps.
An inner node with multiple children.
value_t concat_(value_t l, value_t r, std::true_type) const
If labelset is wordset.
The abstract parameterized, root for all rational expression types.
typename node_t::type_t type_t
Type tag for AST classes.
std::string vname(bool full=true) const
Dynamic description key.
static type join(const b &, const ratexpset< Context > &rhs)
ratexpset< Context > make_ratexpset(const Context &ctx, rat::identities identities)
Shorthand to ratexpset constructor.
decltype(join(std::declval< ValueSets >()...)) join_t
The type of the join of the ValueSets.
typename detail::labelset_t_of_impl< base_t< ValueSet >>::type labelset_t_of
value_t complement(value_t e) const
Add a complement operator.
value_t nontrivial_mul_series_(value_t l, value_t r) const
value_t insert_in_sum_series_(const sum_t &addends, value_t r) const
typename node_t::value_t value_t
A ratexp (a shared pointer to a tree).
static constexpr bool show_one()
When used as WeightSet.
bool is_unweighted_nonsum_(value_t v) const
#define DEFINE(Type)
Type of ratexps.
std::ostream & print(const value_t v, std::ostream &o, symbol format=symbol{"text"}) const
static bool less_than(value_t l, value_t r)
Whether l < r.
vcsn::rat::sum< context_t > sum_t
value_t merge_sum_series_(const sum_t &addends1, value_t aa2) const
static type join(const letterset< GenSet1 > &a, const ratexpset< Ctx2 > &b)
void require_weightset_commutativity() const
weight_t possibly_implicit_lweight_(value_t e) const
static type value(const type &ls)
void gather_(values_t &res, value_t v) const
Push v in res, applying associativity if possible.
static constexpr bool is_idempotent()
When used as WeightSet.
value_t mul_unweighted_nontrivial_products_(value_t a, value_t b) const
pair_automaton< Aut > pair(const Aut &aut, bool keep_initials=false)
boost::flyweight< std::string, boost::flyweights::no_tracking > symbol
An internalized string.
value_t lmul(const weight_t &w, value_t e) const
Left-multiplication by a weight.
typename context_t::labelset_ptr labelset_ptr
variadic_mul_mixin< detail::b_impl > b
static type join(const r &ws, const ratexpset< Context > &rs)
value_t mul_atoms_(const label_t &l, const label_t &r) const
bool open(bool o) const
Whether unknown letters should be added, or rejected.
typename weightset_t::value_t weight_t
typename context_t::weightset_ptr weightset_ptr
label_t_of< context_t > label_t
value_t nontrivial_mul_expressions_(value_t l, value_t r) const
static constexpr star_status_t star_status()
When used as WeightSet.
const weightset_ptr & weightset() const
Accessor to the weightset.
static value_t special()
When used as a LabelSet.
value_t star(value_t e) const
value_t transpose(value_t e) const
The transposed of this rational expression.
ratexpset< Context > self_type
static bool equals(value_t l, value_t r)
Whether l == r.
static constexpr bool has_one()
When used as WeightSet.
value_t letter_class(Args &&...chars) const
A ratexp matching one character amongst chars.
Trivial identities plus series identities.
value_t unwrap_possible_lweight_(value_t e) const
static type join(const ratexpset< Ctx1 > &lhs, const ratexpset< Ctx2 > &rhs)
typename detail::label_t_of_impl< base_t< ValueSet >>::type label_t_of
typename detail::weightset_t_of_impl< base_t< ValueSet >>::type weightset_t_of
ratexpset_impl(const context_t &ctx, identities_t identities)
Constructor.
std::set< value_t > convs(std::istream &) const
Read a range of ratexps.
static type join(const zmin &ws, const ratexpset< Context > &rs)
static type join(const q &ws, const ratexpset< Context > &rs)
auto meet(const ratexpset< Ctx1 > &a, const ratexpset< Ctx2 > &b) -> ratexpset< meet_t< Ctx1, Ctx2 >>
The meet of two ratexpsets.
type_t type_ignoring_lweight_(value_t e) const
value_t transposition(value_t e) const
Add a transposition operator.
std::istringstream is
The input stream: the specification to translate.
bool is_letter(value_t) const
When used as a LabelSet.
value_t mul_products_(value_t a, value_t b) const
static std::string sname()
Static description key.
rat::type_t type_t
The possible types of ratexps.
value_t concat(value_t l, value_t r) const
A structure that implements the computation of join(V1, V2).
value_t add_nonzero_series_(value_t l, value_t r) const
const context_t & context() const
Accessor to the context.
value_t shuffle(value_t l, value_t r) const
Provide a variadic mul on top of a binary mul(), and one().
value_t mul_expressions_(value_t l, value_t r) const
static constexpr bool is_commutative()
When used as WeightSet.
bool is_nonsum_(value_t v) const
const identities_t identities_
An inner node implementing a weight.
std::vector< value_t > values_t
value_t rmul(value_t e, const weight_t &w) const
Right-multiplication by a weight.
identities_t identities() const
Accessor to the identities set.
The root from which to derive the final node types.
value_t mul_series_(value_t l, value_t r) const
bool less_than_ignoring_weight_(value_t l, value_t r) const
value_t conjunction(value_t l, value_t r) const
static size_t hash(const value_t &l)
Hash l.
std::shared_ptr< const node_t > value_t
A ratexp usable with value semantics.
value_t remove_from_sum_series_(values_t addends, typename values_t::iterator i) const
static bool is_one(value_t v) ATTRIBUTE_PURE
When used as WeightSet.
value_t rdiv(value_t l, value_t r) const
static type value(const type &ls)
Implementation of labels are letters.
auto join(const ValueSet &vs) -> ValueSet
The join of a single valueset.
value_t letter_class_(const Args &&...chars, std::true_type) const
If labelset is oneset.
const labelset_ptr & labelset() const
Accessor to the labelset.
static type join(const z &ws, const ratexpset< Context > &rs)
identities
A ratexpset can implement several different sets of identities on expressions.
static constexpr bool is_ratexpset()
When used as WeightSet.
value_t mul(value_t l, value_t r) const
value_t mul_(value_t l, value_t r, bool series) const
value_t add(value_t l, value_t r) const
The smallest nullableset which includes LabelSet.
value_t conv(const letterset< GenSet > &ls, typename letterset< GenSet >::value_t v) const
value_t ldiv(value_t l, value_t r) const
static constexpr bool is_free()
When used as WeightSet.
variadic_mul_mixin< detail::r_impl > r
word_t word(label_t l) const
Make a `word' out of a ratexp.
static bool is_special(value_t v)
When used as a LabelSet.
weightset_t_of< context_t > weightset_t
bool is_zero(value_t v) const ATTRIBUTE_PURE
When used as WeightSet.