Vcsn  2.0
Be Rational
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
normalize.hh
Go to the documentation of this file.
1 #ifndef VCSN_ALGOS_NORMALIZE_HH
2 # define VCSN_ALGOS_NORMALIZE_HH
3 
4 # include <vcsn/algos/standard.hh>
5 # include <vcsn/dyn/algos.hh>
6 # include <vcsn/dyn/automaton.hh>
7 
8 namespace vcsn
9 {
11  template <typename Aut>
12  bool
13  is_normalized(const Aut& a)
14  {
15  return is_standard(a) && is_costandard(a);
16  }
17 
19  template <typename Aut>
20  auto
21  normalize(const Aut& a)
22  -> decltype(copy(a))
23  {
24  return costandard(standard(a));
25  }
26 
27  namespace dyn
28  {
29  namespace detail
30  {
32  template <typename Aut>
33  bool
35  {
36  return is_normalized(aut->as<Aut>());
37  }
38 
40  (const automaton& aut) -> bool);
41 
43  template <typename Aut>
44  automaton
45  normalize(const automaton& aut)
46  {
47  const auto& a = aut->as<Aut>();
48  return make_automaton(::vcsn::normalize(a));
49  }
50 
52  (const automaton& aut) -> automaton);
53  }
54  }
55 } // vcsn::
56 
57 #endif // !VCSN_ALGOS_NORMALIZE_HH
REGISTER_DECLARE(accessible,(const automaton &) -> automaton)
std::shared_ptr< detail::automaton_base > automaton
Definition: automaton.hh:71
bool is_standard(const Aut &a)
Whether a is standard.
Definition: standard.hh:27
automaton make_automaton(const Aut &aut)
Build a dyn::automaton.
Definition: automaton.hh:77
auto costandard(const Aut &aut) -> decltype(copy(aut))
Definition: standard.hh:130
AutOut copy(const AutIn &input, Pred keep_state)
A copy of input keeping only its states that are accepted by keep_state.
Definition: copy.hh:171
bool is_normalized(const automaton &aut)
Bridge.
Definition: normalize.hh:34
auto standard(const Aut &aut) -> decltype(copy(aut))
Definition: standard.hh:120
bool is_costandard(const Aut &a)
Whether a is costandard.
Definition: standard.hh:40
auto normalize(const Aut &a) -> decltype(copy(a))
Normalize a automaton.
Definition: normalize.hh:21
automaton normalize(const automaton &aut)
Bridge.
Definition: normalize.hh:45
bool is_normalized(const Aut &a)
Whether a is standard and co-standard.
Definition: normalize.hh:13