20 template <Automaton Aut,
typename ExpSet,
typename Tag>
22 inductive(
const ExpSet&
rs,
const typename ExpSet::value_t&
r,
32 template <Automaton Aut,
typename ExpSet,
typename Tag>
34 :
public ExpSet::const_visitor
50 using super_t =
typename expressionset_t::const_visitor;
53 constexpr
static const char*
me() {
return "inductive"; }
65 return std::move(
res_);
67 catch (
const std::runtime_error& e)
69 raise(e,
" while computing inductive of: ",
to_string(
rs_, v));
77 return std::move(
res_);
80 using tuple_t =
typename super_t::tuple_t;
81 template <
bool = context_t::is_lat,
82 typename Dummy =
void>
92 return ::vcsn::inductive<automaton_t>(
rs,
98 template <
size_t... I>
112 template <
typename Dummy>
143 template <Automaton AutSet>
145 decltype(std::declval<AutSet>()
146 .
compose(std::declval<typename AutSet::value_t>(),
147 std::declval<typename AutSet::value_t>()));
150 template <
typename AutSet>
156 detail::static_if<has_compose_mem_fn<automatonset_t>{}>
157 ([
this](
const auto& e)
160 for (
const auto& c: e.tail())
166 raise(
"compose: context is not composable");
173 detail::static_if<labelset_t::is_letterized()>
174 ([
this](
const auto& e)
177 for (
const auto& c: e.tail())
183 raise(
"conjunction: labelset must be letterized: ",
191 detail::static_if<labelset_t::is_letterized()>
192 ([
this](
const auto& e)
195 for (
const auto& c: e.tail())
201 raise(
"infiltrate: labelset must be letterized: ",
209 detail::static_if<labelset_t::is_letterized()>
210 ([
this](
const auto& e)
213 for (
const auto& c: e.tail())
219 raise(
"ldivide: labelset must be letterized: ",
227 detail::static_if<labelset_t::is_letterized()>
228 ([
this](
const auto& e)
231 for (
const auto& c: e.tail())
237 raise(
"shuffle: labelset must be letterized: ",
246 for (
const auto& c: e.tail())
254 for (
const auto& c: e.tail())
266 detail::static_if<labelset_t::is_free()>
267 ([
this](
const auto& e)
273 raise(
"complement: labelset must be free: ",
302 template <Automaton Aut,
typename ExpSet,
typename Tag>
304 inductive(
const ExpSet& rs,
const typename ExpSet::value_t& r, Tag)
315 template <
typename ExpSet,
typename Tag>
317 const typename ExpSet::value_t& r)
320 return ::vcsn::inductive<automaton_t>(
rs,
r, Tag{});
324 template <
typename ExpSet,
typename String>
330 using expressionset_t = ExpSet;
331 using expression_t =
typename expressionset_t::value_t;
332 const auto& e = exp->
as<expressionset_t>();
335 =
auto(
const expressionset_t&,
const expression_t&) ->
automaton;
338 "inductive algorithm",
340 {
"auto",
"standard"},
342 {
"standard", inductive_tag_<ExpSet, standard_tag>},
345 return map[algo](e.valueset(), e.value());
context_t_of< expressionset_t > context_t
automaton inductive(const expression &exp, const std::string &algo)
Bridge.
automaton_t operator()(const expression_t &v)
VCSN_RAT_VISIT(transposition, e)
An inner node implementing a weight.
VCSN_RAT_VISIT(ldivide, e)
Aut inductive(const ExpSet &rs, const typename ExpSet::value_t &r, Tag={})
Build a inductive automaton from an expression.
std::shared_ptr< detail::mutable_automaton_impl< Context >> mutable_automaton
typename expressionset_t::value_t expression_t
VCSN_RAT_VISIT(compose, e)
auto complement(const value_t &e, std::true_type) const -> value_t
Add a complement operator: e{c}.
weightset_mixin< detail::r_impl > r
VCSN_RAT_VISIT(rweight, e)
VCSN_RAT_VISIT(complement, e)
auto rweight(const value_t &e, const weight_t &w) const -> value_t
Right-multiplication by a weight.
auto conjunction(const value_t &l, const value_t &r) const -> value_t
Build an conjunction product: l & r.
typename detail::labelset_t_of_impl< base_t< ValueSet >>::type labelset_t_of
auto tuple(Value &&...v) const -> value_t
Build a tuple: e | f | ....
VCSN_RAT_VISIT(infiltrate, e)
static auto mul(const value_t &l, const value_t &r) -> value_t
inductive_visitor(const expressionset_t &rs)
Build an automaton by induction from an expression.
VCSN_RAT_VISIT(lweight, e)
typename expressionset_t::const_visitor super_t
auto zero() const -> value_t
weight_t_of< context_t > weight_t
auto operator()(const tuple_t &v)
Entry point.
auto atom(const label_t &l) const -> value_t
auto shuffle(const value_t &l, const value_t &r) const -> value_t
Build a shuffle product: l : r.
auto tape_(const tuple_t &v)
One tape.
auto star(const value_t &e) const -> value_t
Add a star operator: e*.
static constexpr const char * me()
Name of this algorithm, for error messages.
labelset_t_of< context_t > labelset_t
typename detail::weight_t_of_impl< base_t< ValueSet >>::type weight_t_of
auto compose(const value_t &l, const value_t &r) const -> std::enable_if_t< are_composable< Ctx, Ctx >
Build a composition: l @ r.
auto one() const -> value_t
typename detail::state_t_of_impl< base_t< ValueSet >>::type state_t_of
#define BUILTIN_UNREACHABLE()
void visit(const tuple_t &v, std::true_type) override
state_t_of< automaton_t > state_t
auto transposition(const value_t &e) const -> value_t
Add a transposition operator.
void operator()(const tuple_t &)
automaton_t recurse(const expression_t &v)
An inner node with multiple children.
weightset_t_of< context_t > weightset_t
static auto add(const value_t &l, const value_t &r) -> value_t
auto infiltrate(const value_t &l, const value_t &r) const -> value_t
Build an infiltration product: l &: r.
typename detail::weightset_t_of_impl< base_t< ValueSet >>::type weightset_t_of
A mapping from strings to Values.
value_impl< detail::expression_tag > expression
automaton inductive_tag_(const ExpSet &rs, const typename ExpSet::value_t &r)
Helper function to facilitate dispatch below.
auto & as()
Extract wrapped typed automaton.
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.
VCSN_RAT_VISIT(shuffle, e)
typename detail::context_t_of_impl< base_t< ValueSet >>::type context_t_of
VCSN_RAT_VISIT(conjunction, e)
auto lweight(const weight_t &w, const value_t &e) const -> value_t
Left-multiplication by a weight.
auto tape_(const tuple_t &v, detail::index_sequence< I... >)
Sum of sizes for all tapes.
std::string to_string(identities i)
Wrapper around operator<<.
auto ldivide(const value_t &l, const value_t &r) const -> value_t
r`.
typename super_t::tuple_t tuple_t