Vcsn  2.1
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 {
10  template <typename Aut>
11  bool
12  is_normalized(const Aut& a)
13  {
14  return is_standard(a) && is_costandard(a);
15  }
16 
18  template <typename Aut>
19  auto
20  normalize(const Aut& a)
21  -> decltype(copy(a))
22  {
23  return costandard(standard(a));
24  }
25 
26  namespace dyn
27  {
28  namespace detail
29  {
31  template <typename Aut>
32  bool
34  {
35  return is_normalized(aut->as<Aut>());
36  }
37 
39  template <typename Aut>
40  automaton
41  normalize(const automaton& aut)
42  {
43  const auto& a = aut->as<Aut>();
44  return make_automaton(::vcsn::normalize(a));
45  }
46  }
47  }
48 } // vcsn::
bool is_normalized(const automaton &aut)
Bridge.
Definition: normalize.hh:33
auto costandard(const Aut &aut) -> decltype(copy(aut))
Definition: standard.hh:126
auto normalize(const Aut &a) -> decltype(copy(a))
Normalize a automaton.
Definition: normalize.hh:20
bool is_costandard(const Aut &a)
Whether a is costandard.
Definition: standard.hh:40
automaton make_automaton(const Aut &aut)
Build a dyn::automaton.
Definition: automaton.hh:75
AutOut copy(const AutIn &input, KeepState keep_state, KeepTrans keep_trans)
A copy of input keeping only its states that are accepted by keep_state.
Definition: copy.hh:254
bool is_standard(const Aut &a)
Whether a is standard.
Definition: standard.hh:27
std::shared_ptr< detail::automaton_base > automaton
Definition: automaton.hh:69
automaton normalize(const automaton &aut)
Bridge.
Definition: normalize.hh:41
bool is_normalized(const Aut &a)
Whether a is standard and co-standard.
Definition: normalize.hh:12
auto standard(const Aut &aut) -> decltype(copy(aut))
Definition: standard.hh:116