Vcsn  2.4
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 <Automaton Aut>
11  bool
12  is_normalized(const Aut& a)
13  {
14  return is_standard(a) && is_costandard(a);
15  }
16 
18  template <Automaton 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 <Automaton Aut>
32  bool
34  {
35  return is_normalized(aut->as<Aut>());
36  }
37 
39  template <Automaton Aut>
40  automaton
41  normalize(const automaton& aut)
42  {
43  const auto& a = aut->as<Aut>();
45  }
46  }
47  }
48 } // vcsn::
bool is_normalized(const Aut &a)
Whether a is standard and co-standard.
Definition: normalize.hh:12
auto costandard(const Aut &aut) -> decltype(copy(aut))
Definition: standard.hh:125
auto standard(const Aut &aut)
Definition: standard.hh:116
Definition: a-star.hh:8
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:41
A dyn automaton.
Definition: automaton.hh:17
bool is_normalized(const automaton &aut)
Bridge.
Definition: normalize.hh:33
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
auto & as()
Extract wrapped typed automaton.
Definition: automaton.hh:37
automaton normalize(const automaton &aut)
Bridge.
Definition: normalize.hh:41