![]() |
Vcsn
2.1
Be Rational
|
A typed expression set. More...
#include <expressionset.hh>
Classes | |
struct | as_tupleset_impl |
struct | as_tupleset_impl< detail::index_sequence< I...> > |
struct | tuple_of_label |
Turn a tuple of expressions that are labels into a multi-tape label. More... | |
Public Member Functions | |
expressionset_impl (const context_t &ctx, identities_t ids={}) | |
Constructor. More... | |
bool | open (bool o) const |
Whether unknown letters should be added, or rejected. More... | |
const context_t & | context () const |
Accessor to the context. More... | |
identities_t | identities () const |
Accessor to the identities set. More... | |
const labelset_ptr & | labelset () const |
Accessor to the labelset. More... | |
const weightset_ptr & | weightset () const |
Accessor to the weightset. More... | |
bool | is_letter (value_t) const |
When used as a LabelSet. More... | |
bool | is_zero (const value_t &v) const ATTRIBUTE_PURE |
When used as WeightSet. More... | |
template<typename GenSet > | |
value_t | conv (const letterset< GenSet > &ls, typename letterset< GenSet >::value_t v) const |
value_t | conv (b, typename b::value_t v) const |
value_t | conv (const z &ws, typename z::value_t v) const |
value_t | conv (const q &ws, typename q::value_t v) const |
value_t | conv (const r &ws, typename r::value_t v) const |
value_t | conv (const nmin &ws, typename nmin::value_t v) const |
value_t | conv (const zmin &ws, typename zmin::value_t v) const |
template<typename Ctx2 > | |
value_t | conv (const expressionset< Ctx2 > &ws, typename expressionset< Ctx2 >::value_t v) const |
value_t | zero () const |
value_t | add (const value_t &l, const value_t &r) const |
value_t | mul (const value_t &l, const value_t &r) const |
value_t | concat (const value_t &l, const value_t &r) const |
Similar to mul, but in the case of LAW, merge the labels. More... | |
value_t | conjunction (const value_t &l, const value_t &r) const |
value_t | infiltration (const value_t &l, const value_t &r) const |
value_t | shuffle (const value_t &l, const value_t &r) const |
template<typename... Value> | |
value_t | tuple (Value &&...v) const |
value_t | power (const value_t &e, unsigned n) const |
Add a power operator. More... | |
value_t | ldiv (const value_t &l, const value_t &r) const |
value_t | rdiv (const value_t &l, const value_t &r) const |
value_t | star (const value_t &e) const |
value_t | complement (const value_t &e) const |
Add a complement operator. More... | |
value_t | transposition (const value_t &e) const |
Add a transposition operator. More... | |
value_t | rmul (const value_t &e, const weight_t &w) const |
Right-multiplication by a weight. More... | |
value_t | lmul (const weight_t &w, const value_t &e) const |
Left-multiplication by a weight. More... | |
value_t | transpose (const value_t &e) const |
The transposed of this rational expression. More... | |
word_t | word (label_t l) const |
Make a `word' out of an expression. More... | |
template<typename... Args> | |
value_t | letter_class (Args &&...chars) const |
An expression matching one character amongst chars. More... | |
value_t | conv (std::istream &is, bool=true) const |
The next expression in a stream. More... | |
value_t | conv (const self_t &, const value_t &v) const |
Convert from ourself: identity. More... | |
std::ostream & | print (const value_t &v, std::ostream &o, format fmt={}) const |
std::ostream & | print_set (std::ostream &o, format fmt={}) const |
Format the description of this expressionset. More... | |
template<typename Ctx = context_t> | |
auto | as_tupleset () const -> enable_if_t< Ctx::is_lat, as_tupleset_t< Ctx >> |
If we are multitape, ourself as a tupleset. More... | |
template<typename expressionset_impl< Context >::type_t Type> | |
auto | gather_ (values_t &res, const value_t &v) const -> void |
template<typename expressionset_impl< Context >::type_t Type> | |
auto | gather_ (const value_t &l, const value_t &r) const -> values_t |
template<typename... Value> | |
auto | tuple (Value &&...v) const -> value_t |
template<typename GenSet > | |
auto | conv (const letterset< GenSet > &ls, typename letterset< GenSet >::value_t v) const -> value_t |
template<typename Ctx2 > | |
auto | conv (const expressionset< Ctx2 > &rs, typename expressionset< Ctx2 >::value_t r) const -> value_t |
template<typename... Args> | |
auto | letter_class (Args &&...args) const -> value_t |
template<typename LabelSet_ > | |
auto | letter_class_ (std::set< std::pair< typename LabelSet_::letter_t, typename LabelSet_::letter_t >> ccs, bool accept, std::false_type) const -> value_t |
template<typename LabelSet_ , typename... Args> | |
auto | letter_class_ (const Args &&..., std::true_type) const -> value_t |
Static Public Member Functions | |
static symbol | sname () |
Static description key. More... | |
static self_t | make (std::istream &is) |
Build from the description in is. More... | |
static value_t | special () |
When used as a LabelSet. More... | |
static bool | is_special (const value_t &v) |
When used as a LabelSet. More... | |
static bool | is_one (const value_t &v) ATTRIBUTE_PURE |
When used as WeightSet. More... | |
static constexpr bool | is_letterized () |
When used as a labelset. More... | |
static constexpr bool | is_commutative () |
When used as WeightSet. More... | |
static constexpr bool | is_idempotent () |
When used as WeightSet. More... | |
static constexpr bool | show_one () |
When used as WeightSet. More... | |
static constexpr bool | has_one () |
When used as WeightSet. More... | |
static constexpr bool | is_expressionset () |
When used as WeightSet. More... | |
static constexpr bool | is_free () |
When used as WeightSet. More... | |
static constexpr star_status_t | star_status () |
When used as WeightSet. More... | |
static size_t | size (const value_t &v) |
The size of v. More... | |
static bool | less (const value_t &l, const value_t &r) |
Whether l < r. More... | |
static bool | less_linear (const value_t &l, const value_t &r) |
Whether l < r, ignoring lweight. More... | |
static bool | equal (const value_t &l, const value_t &r) |
Whether l == r. More... | |
static size_t | hash (const value_t &v) |
Hash v. More... | |
static auto | atom (const label_t &v) -> value_t |
Build a label. More... | |
static value_t | one () |
template<typename Fun > | |
static void | convs (std::istream &, Fun) |
Read a range of expressions. More... | |
Private Member Functions | |
const self_t & | self () const |
Ourself, but after the application of weightset_mixin. More... | |
value_t | add_ (values_t &&vs) const |
From a list of values, build a sum, taking care of the empty and singleton cases. More... | |
value_t | add_linear_ (const sum_t &addends, const value_t &r) const |
value_t | add_linear_ (const sum_t &s1, const sum_t &s2) const |
value_t | add_linear_ (const value_t &l, const value_t &r) const |
The sum of two non-zero series. More... | |
template<type_t Type> | |
void | gather_ (values_t &res, const value_t &v) const |
Push v in res, applying associativity if possible. More... | |
template<type_t Type> | |
values_t | gather_ (const value_t &l, const value_t &r) const |
A list denoting the gathering of l and r, applying associativity if possible. More... | |
value_t | concat_ (const value_t &l, const value_t &r, std::true_type) const |
If labelset is wordset. More... | |
value_t | concat_ (const value_t &l, const value_t &r, std::false_type) const |
If labelset is not wordset. More... | |
template<typename LabelSet_ , typename... Args> | |
value_t | letter_class_ (const Args &&...chars, std::true_type) const |
If labelset is oneset. More... | |
template<typename LabelSet_ > | |
value_t | letter_class_ (std::set< std::pair< typename LabelSet_::letter_t, typename LabelSet_::letter_t >> chars, bool accept, std::false_type) const |
If labelset is not oneset. More... | |
Static Private Member Functions | |
static value_t | unwrap_possible_lweight_ (const value_t &e) |
If e is an lweight, then its child, otherwise e. More... | |
static type_t | type_ignoring_lweight_ (const value_t &e) |
The type of e, or the type of its child if e is a lweight. More... | |
static weight_t | possibly_implicit_lweight_ (const value_t &e) |
The weight of e if it's an lweight, otherwise the weight one(). More... | |
Private Attributes | |
context_t | ctx_ |
The context of the expressions. More... | |
const identities_t | ids_ |
The set of rewriting rules to apply. More... | |
A typed expression set.
Context | the LabelSet and WeightSet types. |
Definition at line 30 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::as_tupleset_t = typename as_tupleset_impl<typename labelset_t_of<Ctx>::indices_t::type>::type |
If we are multitape, our type as a tupleset.
Definition at line 315 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::atom_t = vcsn::rat:: atom <context_t> |
Definition at line 52 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::complement_t = vcsn::rat:: complement <context_t> |
Definition at line 53 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::conjunction_t = vcsn::rat:: conjunction <context_t> |
Definition at line 54 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::const_visitor = rat::const_visitor<context_t> |
Definition at line 43 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::context_t = Context |
Definition at line 34 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::focus_t = expressionset<detail::project_context<Tape, Ctx>> |
The type of the expressionset for the Tape-th tape.
Definition at line 294 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::identities_t = rat::identities |
Definition at line 42 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::infiltration_t = vcsn::rat:: infiltration <context_t> |
Definition at line 55 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::inner_t = vcsn::rat:: inner <context_t> |
Definition at line 56 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::kind_t = labels_are_expressions |
Definition at line 37 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::label_t = label_t_of<context_t> |
Definition at line 40 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::labelset_ptr = typename context_t::labelset_ptr |
Definition at line 38 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::labelset_t = labelset_t_of<context_t> |
Definition at line 35 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::ldiv_t = vcsn::rat:: ldiv <context_t> |
Definition at line 57 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::leaf_t = vcsn::rat:: leaf <context_t> |
Definition at line 58 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::letter_t = value_t |
Definition at line 85 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::lweight_t = vcsn::rat:: lweight <context_t> |
Definition at line 59 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::node_t = vcsn::rat:: node <context_t> |
Definition at line 60 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::one_t = vcsn::rat:: one <context_t> |
Definition at line 61 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::prod_t = vcsn::rat:: prod <context_t> |
Definition at line 62 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::rweight_t = vcsn::rat:: rweight <context_t> |
Definition at line 63 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::self_t = expressionset<Context> |
Definition at line 33 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::shuffle_t = vcsn::rat:: shuffle <context_t> |
Definition at line 64 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::star_t = vcsn::rat:: star <context_t> |
Definition at line 65 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::sum_t = vcsn::rat:: sum <context_t> |
Definition at line 66 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::transposition_t = vcsn::rat:: transposition <context_t> |
Definition at line 67 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::tuple_t = vcsn::rat:: tuple <context_t> |
Definition at line 68 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::type_t = typename node_t::type_t |
Type tag for AST classes.
Definition at line 75 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::unary_t = unary<Type, context_t> |
Definition at line 80 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::value_t = typename node_t::value_t |
An expression (a shared pointer to a tree).
Definition at line 73 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::values_t = typename node_t::values_t |
A list (vector) of expressions.
Definition at line 77 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::variadic_t = variadic<Type, context_t> |
Definition at line 82 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::weight_t = typename weightset_t::value_t |
Definition at line 41 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::weightset_ptr = typename context_t::weightset_ptr |
Definition at line 39 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::weightset_t = weightset_t_of<context_t> |
Definition at line 36 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::word_t = value_t |
Definition at line 84 of file expressionset.hh.
using vcsn::rat::expressionset_impl< Context >::zero_t = vcsn::rat:: zero <context_t> |
Definition at line 69 of file expressionset.hh.
vcsn::rat::expressionset_impl< Context >::expressionset_impl | ( | const context_t & | ctx, |
identities_t | ids = {} |
||
) |
Constructor.
ctx | the generator set for the labels, and the weight set. |
ids | the identities to guarantee |
Definition at line 30 of file expressionset.hxx.
References vcsn::rat::expressionset_impl< Context >::ids_, vcsn::rat::identities::is_distributive(), vcsn::require(), and vcsn::rat::expressionset_impl< Context >::weightset().
|
inline |
Definition at line 194 of file expressionset.hxx.
|
inlineprivate |
From a list of values, build a sum, taking care of the empty and singleton cases.
Definition at line 252 of file expressionset.hxx.
|
inlineprivate |
Definition at line 219 of file expressionset.hxx.
|
inlineprivate |
Definition at line 263 of file expressionset.hxx.
|
inlineprivate |
The sum of two non-zero series.
Definition at line 305 of file expressionset.hxx.
|
inline |
If we are multitape, ourself as a tupleset.
Definition at line 319 of file expressionset.hh.
|
inlinestatic |
Build a label.
Definition at line 138 of file expressionset.hxx.
Referenced by vcsn::rat::expressionset_impl< Context >::special().
|
inline |
Add a complement operator.
Definition at line 726 of file expressionset.hxx.
|
inline |
|
inlineprivate |
If labelset is wordset.
Definition at line 661 of file expressionset.hxx.
|
inlineprivate |
If labelset is not wordset.
Definition at line 654 of file expressionset.hxx.
|
inline |
Definition at line 419 of file expressionset.hxx.
|
inline |
Accessor to the context.
Definition at line 118 of file expressionset.hxx.
value_t vcsn::rat::expressionset_impl< Context >::conv | ( | const letterset< GenSet > & | ls, |
typename letterset< GenSet >::value_t | v | ||
) | const |
|
inline |
Definition at line 925 of file expressionset.hxx.
References vcsn::v.
|
inline |
Definition at line 931 of file expressionset.hxx.
References vcsn::conv(), and vcsn::v.
|
inline |
Definition at line 937 of file expressionset.hxx.
References vcsn::conv(), and vcsn::v.
|
inline |
Definition at line 943 of file expressionset.hxx.
References vcsn::conv(), and vcsn::v.
value_t vcsn::rat::expressionset_impl< Context >::conv | ( | const nmin & | ws, |
typename nmin::value_t | v | ||
) | const |
|
inline |
Definition at line 949 of file expressionset.hxx.
References vcsn::conv(), and vcsn::v.
value_t vcsn::rat::expressionset_impl< Context >::conv | ( | const expressionset< Ctx2 > & | ws, |
typename expressionset< Ctx2 >::value_t | v | ||
) | const |
|
inline |
The next expression in a stream.
Definition at line 967 of file expressionset.hxx.
References vcsn::dyn::detail::identities(), vcsn::dyn::make_context(), and vcsn::dyn::read_expression().
|
inline |
Convert from ourself: identity.
Definition at line 905 of file expressionset.hxx.
References vcsn::rat::copy(), vcsn::detail::rs, and vcsn::v.
|
inline |
Definition at line 918 of file expressionset.hxx.
References vcsn::conv(), and vcsn::v.
|
inline |
Definition at line 959 of file expressionset.hxx.
References vcsn::rat::copy(), and vcsn::detail::rs.
|
inlinestatic |
Read a range of expressions.
Definition at line 279 of file expressionset.hh.
References vcsn::rat::expressionset_impl< Context >::sname().
|
inlinestatic |
Whether l == r.
Definition at line 892 of file expressionset.hxx.
Referenced by vcsn::rat::expressionset_impl< Context >::is_special().
|
inline |
Definition at line 163 of file expressionset.hxx.
|
inline |
Definition at line 177 of file expressionset.hxx.
|
private |
Push v in res, applying associativity if possible.
Type | the kind of expressions on which to apply associativity. Must be one of the variadic types. |
|
private |
A list denoting the gathering of l and r, applying associativity if possible.
Type | the kind of expressions on which to apply associativity. Must be one of the variadic types. |
|
inlinestatic |
When used as WeightSet.
Definition at line 165 of file expressionset.hh.
|
inlinestatic |
Hash v.
Definition at line 898 of file expressionset.hxx.
References vcsn::hasher(), and vcsn::v.
|
inline |
Accessor to the identities set.
Definition at line 123 of file expressionset.hxx.
|
inline |
Definition at line 521 of file expressionset.hxx.
|
inlinestatic |
When used as WeightSet.
Definition at line 145 of file expressionset.hh.
|
inlinestatic |
When used as WeightSet.
Definition at line 171 of file expressionset.hh.
|
inlinestatic |
When used as WeightSet.
Definition at line 177 of file expressionset.hh.
|
inlinestatic |
When used as WeightSet.
Definition at line 151 of file expressionset.hh.
|
inline |
When used as a LabelSet.
Definition at line 127 of file expressionset.hh.
|
inlinestatic |
When used as a labelset.
Definition at line 139 of file expressionset.hh.
|
inlinestatic |
When used as WeightSet.
Definition at line 866 of file expressionset.hxx.
References vcsn::rat::one, and vcsn::v.
|
inlinestatic |
When used as a LabelSet.
Definition at line 121 of file expressionset.hh.
References vcsn::rat::expressionset_impl< Context >::equal(), and vcsn::rat::expressionset_impl< Context >::special().
|
inline |
When used as WeightSet.
Definition at line 860 of file expressionset.hxx.
References vcsn::v, and vcsn::rat::zero.
|
inline |
Accessor to the labelset.
Definition at line 128 of file expressionset.hxx.
|
inline |
Definition at line 468 of file expressionset.hxx.
|
inlinestatic |
Whether l < r.
Definition at line 878 of file expressionset.hxx.
|
inlinestatic |
Whether l < r, ignoring lweight.
Typically used for linear identities, where <2>a and <3>a are "equal" and should be merged into <5>a.
Definition at line 885 of file expressionset.hxx.
value_t vcsn::rat::expressionset_impl< Context >::letter_class | ( | Args &&... | chars | ) | const |
An expression matching one character amongst chars.
|
inline |
Definition at line 999 of file expressionset.hxx.
|
private |
If labelset is oneset.
|
private |
If labelset is not oneset.
|
inline |
Definition at line 1011 of file expressionset.hxx.
References vcsn::has(), vcsn::require(), and vcsn::rat::to_string().
|
inline |
Definition at line 1072 of file expressionset.hxx.
|
inline |
Left-multiplication by a weight.
Definition at line 778 of file expressionset.hxx.
|
inlinestatic |
Build from the description in is.
Definition at line 52 of file expressionset.hxx.
References vcsn::rat::ctx(), vcsn::eat(), vcsn::rat::ids(), and is.
|
inline |
Definition at line 357 of file expressionset.hxx.
|
inlinestatic |
Definition at line 153 of file expressionset.hxx.
|
inline |
Whether unknown letters should be added, or rejected.
o | whether to accept unknown letters |
Definition at line 112 of file expressionset.hxx.
|
inlinestaticprivate |
The weight of e if it's an lweight, otherwise the weight one().
static because used by less.
Definition at line 339 of file expressionset.hxx.
|
inline |
Add a power operator.
Definition at line 584 of file expressionset.hxx.
|
inline |
Definition at line 979 of file expressionset.hxx.
References vcsn::rat::make_printer(), vcsn::print(), and vcsn::v.
|
inline |
Format the description of this expressionset.
Definition at line 69 of file expressionset.hxx.
References vcsn::rat::identities::distributive, vcsn::dyn::detail::identities(), vcsn::rat::ids(), vcsn::format::latex, and vcsn::format::text.
|
inline |
Definition at line 493 of file expressionset.hxx.
|
inline |
Right-multiplication by a weight.
Definition at line 817 of file expressionset.hxx.
|
inlineprivate |
Ourself, but after the application of weightset_mixin.
FIXME: this is ugly. It is due to the fact that instead of the CRTP, we used a mixin approach to add features to expressionset as opposed to expressionset_impl. Except that here, we have an expression_impl, and we need the expression. So after all, maybe the CRTP is a better approach.
Cannot be a reference member, as we do support assignments, in which case the copied self would point to the original this.
Definition at line 336 of file expressionset.hh.
|
inlinestatic |
When used as WeightSet.
Definition at line 159 of file expressionset.hh.
|
inline |
Definition at line 551 of file expressionset.hxx.
|
inlinestatic |
|
inlinestatic |
Static description key.
Definition at line 45 of file expressionset.hxx.
References vcsn::sname().
Referenced by vcsn::rat::expressionset_impl< Context >::convs().
|
inlinestatic |
When used as a LabelSet.
Definition at line 115 of file expressionset.hh.
References vcsn::rat::expressionset_impl< Context >::atom().
Referenced by vcsn::rat::expressionset_impl< Context >::is_special().
|
inline |
Definition at line 707 of file expressionset.hxx.
|
inlinestatic |
When used as WeightSet.
Definition at line 183 of file expressionset.hh.
References vcsn::STARRABLE.
|
inline |
The transposed of this rational expression.
Definition at line 988 of file expressionset.hxx.
References vcsn::v.
|
inline |
Add a transposition operator.
Definition at line 749 of file expressionset.hxx.
value_t vcsn::rat::expressionset_impl< Context >::tuple | ( | Value &&... | v | ) | const |
auto vcsn::rat::expressionset_impl< Context >::tuple | ( | Value &&... | v | ) | const -> value_t |
Definition at line 502 of file expressionset.hxx.
|
inlinestaticprivate |
The type of e, or the type of its child if e is a lweight.
static because used by less.
Definition at line 333 of file expressionset.hxx.
|
inlinestaticprivate |
If e is an lweight, then its child, otherwise e.
static because used by less.
Definition at line 348 of file expressionset.hxx.
|
inline |
Accessor to the weightset.
Definition at line 133 of file expressionset.hxx.
Referenced by vcsn::rat::expressionset_impl< Context >::expressionset_impl().
|
inline |
Make a `word' out of an expression.
Definition at line 262 of file expressionset.hh.
|
inline |
Definition at line 147 of file expressionset.hxx.
|
private |
The context of the expressions.
Definition at line 437 of file expressionset.hh.
|
private |
The set of rewriting rules to apply.
Definition at line 439 of file expressionset.hh.
Referenced by vcsn::rat::expressionset_impl< Context >::expressionset_impl().