Vcsn  2.4
Be Rational
is-proper.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <type_traits>
4 
5 #include <vcsn/core/automaton.hh> // transitions.
6 #include <vcsn/core/kind.hh>
7 #include <vcsn/ctx/traits.hh>
8 #include <vcsn/dyn/automaton.hh> // make_automaton
10 
11 namespace vcsn
12 {
13 
14  namespace detail
15  {
16  template <Automaton Aut>
17  std::enable_if_t<labelset_t_of<Aut>::has_one(), bool>
18  is_proper_(const Aut& aut)
19  {
20  for (auto t: transitions(aut))
21  if (aut->labelset()->is_one(aut->label_of(t)))
22  return false;
23  return true;
24  }
25 
26  template <Automaton Aut>
27  constexpr
28  std::enable_if_t<!labelset_t_of<Aut>::has_one(), bool>
29  is_proper_(const Aut&)
30  {
31  return true;
32  }
33  }
34 
42  template <Automaton Aut>
43  bool is_proper(const Aut& aut) ATTRIBUTE_CONST;
44 
45  template <Automaton Aut>
46  bool
47  is_proper(const Aut& aut)
48  {
49  return detail::is_proper_(aut);
50  }
51 
52  namespace dyn
53  {
54  namespace detail
55  {
57  template <Automaton Aut>
58  bool is_proper(const automaton& aut)
59  {
60  const auto& a = aut->as<Aut>();
61  return is_proper(a);
62  }
63  }
64  }
65 } // namespace vcsn
auto transitions(const Aut &aut) -> decltype(all_transitions(aut, is_special_t< Aut >
All the transition indexes between visible states.
Definition: automaton.hh:247
bool is_proper(const automaton &aut)
Bridge.
Definition: is-proper.hh:58
bool is_proper(const Aut &aut)
Test whether an automaton is proper.
Definition: is-proper.hh:47
Definition: a-star.hh:8
A dyn automaton.
Definition: automaton.hh:17
std::enable_if_t< labelset_t_of< Aut >::has_one(), bool > is_proper_(const Aut &aut)
Definition: is-proper.hh:18
auto & as()
Extract wrapped typed automaton.
Definition: automaton.hh:37