Vcsn  2.8
Be Rational
normalize.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vcsn/algos/standard.hh>
4 #include <vcsn/dyn/algos.hh>
5 #include <vcsn/dyn/automaton.hh>
6 
7 namespace vcsn
8 {
9  /*------------.
10  | Automata. |
11  `------------*/
12 
14  template <Automaton Aut>
15  bool
16  is_normalized(const Aut& a)
17  {
18  return is_standard(a) && is_costandard(a);
19  }
20 
22  template <Automaton Aut>
23  auto
24  normalize(const Aut& a)
25  -> decltype(copy(a))
26  {
27  return costandard(standard(a));
28  }
29 
30  namespace dyn
31  {
32  namespace detail
33  {
35  template <Automaton Aut>
36  bool
38  {
39  return is_normalized(aut->as<Aut>());
40  }
41 
43  template <Automaton Aut>
44  automaton
45  normalize(const automaton& aut)
46  {
47  const auto& a = aut->as<Aut>();
49  }
50  }
51  }
52 } // vcsn::
A dyn automaton.
Definition: automaton.hh:17
bool is_normalized(const automaton &aut)
Bridge.
Definition: normalize.hh:37
bool is_standard(const Aut &a)
Whether a is standard.
Definition: standard.hh:28
auto copy(const AutIn &input, KeepState keep_state, KeepTrans keep_trans) -> decltype(keep_state(input->null_state()), keep_trans(input->null_transition()), make_fresh_automaton< AutIn, AutOut >(input))
A copy of input keeping only its states that are accepted by keep_state, and transitions accepted by ...
Definition: copy.hh:322
Definition: a-star.hh:8
auto costandard(const Aut &aut) -> decltype(copy(aut))
Definition: standard.hh:125
auto & as()
Extract wrapped typed automaton.
Definition: automaton.hh:37
auto standard(const Aut &aut)
Definition: standard.hh:116
bool is_costandard(const Aut &a)
Whether a is costandard.
Definition: standard.hh:41
bool is_normalized(const Aut &a)
Whether a is standard and co-standard.
Definition: normalize.hh:16
ExpansionSet::value_t normalize(const ExpansionSet &xs, typename ExpansionSet::value_t x)
Normalize an expansion.
automaton normalize(const automaton &aut)
Bridge.
Definition: normalize.hh:45