26 template <Automaton Aut1, Automaton Aut2>
36 {b->pre(), res->pre()},
37 {b->post(), res->post()},
40 for (
auto s: b->states())
41 m.emplace(s, b->is_initial(s) ? initial : res->new_state());
45 if (b->dst_of(t) == b->post())
46 res->add_transition(m[b->src_of(t)], m[b->dst_of(t)],
48 res->weightset()->conv(*b->weightset(),
52 else if (b->src_of(t) != b->pre())
53 res->new_transition(m[b->src_of(t)], m[b->dst_of(t)],
55 res->weightset()->conv(*b->weightset(),
60 template <Automaton Aut1, Automaton Aut2>
69 template <Automaton Aut1, Automaton Aut2>
73 constexpr
bool bb = (std::is_same<weightset_t_of<Aut1>,
b>::value
74 && std::is_same<weightset_t_of<Aut2>,
b>::value);
75 return detail::static_if<bb>(
76 [] (
const auto& lhs,
const auto& rhs)
79 = detail::make_product_automaton<false>(
join_automata(lhs, rhs),
84 [] (
const auto& lhs,
const auto& rhs)
93 template <Automaton Aut1, Automaton Aut2>
106 template <Automaton Aut1, Automaton Aut2,
typename Tag = general_tag>
108 add(
const Aut1& lhs,
const Aut2& rhs, Tag tag = {})
122 template <Automaton Lhs, Automaton Rhs,
typename String>
126 const auto& l = lhs->
as<Lhs>();
127 const auto&
r = rhs->
as<Rhs>();
144 template <
typename ValueSet>
145 typename ValueSet::value_t
147 const typename ValueSet::value_t& lhs,
148 const typename ValueSet::value_t& rhs)
150 return vs.add(lhs, rhs);
163 template <
typename ExpansionSetLhs,
typename ExpansionSetRhs>
167 auto join_elts = join<ExpansionSetLhs, ExpansionSetRhs>(lhs, rhs);
168 return {std::get<0>(join_elts),
170 std::get<1>(join_elts), std::get<2>(join_elts))};
184 template <
typename ExpSetLhs,
typename ExpSetRhs>
188 auto join_elts = join<ExpSetLhs, ExpSetRhs>(lhs, rhs);
189 return {std::get<0>(join_elts),
191 std::get<1>(join_elts), std::get<2>(join_elts))};
206 template <
typename PolynomialSetLhs,
typename PolynomialSetRhs>
210 auto join_elts = join<PolynomialSetLhs, PolynomialSetRhs>(lhs, rhs);
211 return {std::get<0>(join_elts),
212 add(std::get<0>(join_elts),
213 std::get<1>(join_elts), std::get<2>(join_elts))};
228 template <
typename WeightSetLhs,
typename WeightSetRhs>
232 auto join_elts = join<WeightSetLhs, WeightSetRhs>(lhs, rhs);
233 return {std::get<0>(join_elts),
234 add(std::get<0>(join_elts),
235 std::get<1>(join_elts), std::get<2>(join_elts))};
value_impl< detail::expansion_tag > expansion
expansion add_expansion(const expansion &lhs, const expansion &rhs)
Bridge (add).
expression add_expression(const expression &lhs, const expression &rhs)
Bridge (add).
Container::value_type front(const Container &container)
The first member of this Container.
void copy_into(const AutIn &in, AutOut &out, KeepState keep_state, KeepTrans keep_trans)
Copy selected states and transitions of an automaton.
Tag for operations on all automata.
Tag for operations on standard automata.
value_impl< detail::weight_tag > weight
Aut1 & add_here(Aut1 &res, const Aut2 &b, standard_tag)
Merge transitions of b into those of res.
auto determinize(const Aut &a, Tag={}, bool_constant< Lazy >={})
weightset_mixin< detail::r_impl > r
void require(Bool b, Args &&...args)
If b is not verified, raise an error with args as message.
Provide a variadic mul on top of a binary mul(), and one().
auto add(const Aut1 &lhs, const Aut2 &rhs, deterministic_tag)
auto initial_transitions(const Aut &aut) -> decltype(aut->all_out(aut->pre()))
Indexes of transitions to (visible) initial states.
polynomial add_polynomial(const polynomial &lhs, const polynomial &rhs)
Bridge (add).
auto join_automata(Auts &&...auts) -> decltype(pass(auts->null_state()...), make_mutable_automaton(join(auts->context()...)))
An automaton whose type is the join between those of auts.
Tag for operations on deterministic automata.
typename detail::state_t_of_impl< base_t< ValueSet >>::type state_t_of
bool is_standard(const Aut &a)
Whether a is standard.
automaton add(const automaton &lhs, const automaton &rhs, const std::string &algo="auto")
Sum of two automata.
value_impl< detail::expression_tag > expression
auto & as()
Extract wrapped typed automaton.
auto dispatch_tags(std::string algo, Operation op, Aut &&...auts)
Dispatch an operation between automata depending on their nature.
value_impl< detail::polynomial_tag > polynomial
automaton add(const automaton &lhs, const automaton &rhs, const std::string &algo)
Bridge.
auto all_transitions(const Aut &aut)
All the transition indexes between all states (including pre and post).
weight add_weight(const weight &lhs, const weight &rhs)
Bridge (add).