22 template <Automaton Aut,
typename ExpSet,
typename Tag>
24 inductive(
const ExpSet& rs,
const typename ExpSet::value_t&
r,
34 template <Automaton Aut,
typename ExpSet,
typename Tag>
36 :
public ExpSet::const_visitor
52 using super_t =
typename expressionset_t::const_visitor;
55 constexpr
static const char*
me() {
return "inductive"; }
67 return std::move(
res_);
69 catch (
const std::runtime_error& e)
71 raise(e,
" while computing inductive of: ",
to_string(
rs_, v));
81 return std::move(
res_);
83 catch (
const std::runtime_error& e)
85 raise(e,
" while computing inductive of: ",
to_string(
rs_, v));
89 using tuple_t =
typename super_t::tuple_t;
90 template <
bool = context_t::is_lat,
91 typename Dummy =
void>
101 return ::vcsn::inductive<automaton_t>(rs,
102 std::get<I>(v.sub()),
107 template <
size_t... I>
121 template <
typename Dummy>
157 template <Automaton AutSet>
159 decltype(std::declval<AutSet>()
160 .
compose(std::declval<typename AutSet::value_t>(),
161 std::declval<typename AutSet::value_t>()));
164 template <
typename AutSet>
170 detail::static_if<has_compose_mem_fn<automatonset_t>()
171 && num_tapes<context_t>() == 2>
172 ([
this](
const auto& e)
175 for (
const auto& c: e.tail())
181 raise(
"compose: context is not composable");
188 detail::static_if<labelset_t::is_letterized()>
189 ([
this](
const auto& e)
192 for (
const auto& c: e.tail())
198 raise(
"conjunction: labelset must be letterized: ",
206 detail::static_if<labelset_t::is_letterized()>
207 ([
this](
const auto& e)
210 for (
const auto& c: e.tail())
216 raise(
"infiltrate: labelset must be letterized: ",
224 detail::static_if<labelset_t::is_letterized()>
225 ([
this](
const auto& e)
228 for (
const auto& c: e.tail())
234 raise(
"ldivide: labelset must be letterized: ",
242 detail::static_if<labelset_t::is_letterized()>
243 ([
this](
const auto& e)
246 for (
const auto& c: e.tail())
252 raise(
"shuffle: labelset must be letterized: ",
261 for (
const auto& c: e.tail())
269 for (
const auto& c: e.tail())
281 detail::static_if<labelset_t::is_free()>
282 ([
this](
const auto& e)
288 raise(
"complement: labelset must be free: ",
317 template <Automaton Aut,
typename ExpSet,
typename Tag>
319 inductive(
const ExpSet& rs,
const typename ExpSet::value_t& r, Tag)
330 template <
typename ExpSet,
typename Tag>
332 const typename ExpSet::value_t& r)
335 return ::vcsn::inductive<automaton_t>(rs,
r, Tag{});
339 template <
typename ExpSet,
typename String>
353 "inductive algorithm",
355 {
"auto",
"standard"},
357 {
"standard", inductive_tag_<ExpSet, standard_tag>},
360 return map[algo](e.valueset(), e.value());
std::shared_ptr< detail::mutable_automaton_impl< Context > > mutable_automaton
typename super_t::tuple_t tuple_t
weight_t_of< context_t > weight_t
weightset_mixin< detail::r_impl > r
typename detail::weightset_t_of_impl< base_t< ValueSet > >::type weightset_t_of
auto conjunction(const value_t &l, const value_t &r) const -> value_t
Build an conjunction product: l & r.
automaton_t operator()(const expression_t &v)
static auto add(const value_t &l, const value_t &r) -> value_t
auto rweight(const value_t &e, const weight_t &w) const -> value_t
Right-multiplication by a weight.
typename detail::state_t_of_impl< base_t< ValueSet > >::type state_t_of
Aut inductive(const ExpSet &rs, const typename ExpSet::value_t &r, Tag={})
Build an automaton by induction from an expression.
auto shuffle(const value_t &l, const value_t &r) const -> value_t
Build a shuffle product: l : r.
An inner node with multiple children.
VCSN_RAT_VISIT(conjunction, e)
VCSN_RAT_VISIT(lweight, e)
auto one() const -> value_t
typename expressionset_t::value_t expression_t
An inner node to name the subexpression.
typename detail::context_t_of_impl< base_t< ValueSet > >::type context_t_of
auto tuple(Value &&... v) const -> value_t
Build a tuple: e | f | ....
auto infiltrate(const value_t &l, const value_t &r) const -> value_t
Build an infiltration product: l &: r.
auto ldivide(const value_t &l, const value_t &r) const -> value_t
r`.
typename detail::labelset_t_of_impl< base_t< ValueSet > >::type labelset_t_of
context_t_of< expressionset_t > context_t
inductive_visitor(const expressionset_t &rs)
auto compose(const value_t &l, const value_t &r) const -> std::enable_if_t< are_composable< Ctx, Ctx >
Build a composition: l @ r.
Build an automaton by induction from an expression.
VCSN_RAT_VISIT(shuffle, e)
labelset_t_of< context_t > labelset_t
automaton_t recurse(const expression_t &v)
VCSN_RAT_VISIT(rweight, e)
auto tape_(const tuple_t &v, detail::index_sequence< I... >)
Sum of sizes for all tapes.
VCSN_RAT_VISIT(infiltrate, e)
static constexpr const char * me()
Name of this algorithm, for error messages.
std::string to_string(identities i)
Wrapper around operator<<.
VCSN_RAT_VISIT(compose, e)
weightset_t_of< context_t > weightset_t
An inner node implementing a weight.
auto atom(const label_t &l) const -> value_t
VCSN_RAT_VISIT(transposition, e)
auto star(const value_t &e) const -> value_t
Add a star operator: e*.
auto complement(const value_t &e, std::true_type) const -> value_t
Add a complement operator: e{c}.
void visit(const tuple_t &v, std::true_type) override
auto operator()(const tuple_t &v)
Entry point.
typename expressionset_t::const_visitor super_t
A mapping from strings to Values.
static auto mul(const value_t &l, const value_t &r) -> value_t
auto tape_(const tuple_t &v)
One tape.
value_impl< detail::expression_tag > expression
VCSN_RAT_VISIT(complement, e)
automaton inductive_tag_(const ExpSet &rs, const typename ExpSet::value_t &r)
Helper function to facilitate dispatch below.
auto transposition(const value_t &e) const -> value_t
Add a transposition operator.
typename detail::weight_t_of_impl< base_t< ValueSet > >::type weight_t_of
#define BUILTIN_UNREACHABLE()
auto zero() const -> value_t
VCSN_RAT_VISIT(ldivide, e)
void operator()(const tuple_t &)
auto lweight(const weight_t &w, const value_t &e) const -> value_t
Left-multiplication by a weight.
decltype(std::declval< AutSet >() .compose(std::declval< typename AutSet::value_t >(), std::declval< typename AutSet::value_t >())) compose_mem_fn_t
The type of the AutSet::compose() member function.
state_t_of< automaton_t > state_t