Vcsn  2.2
Be Rational
is-functional.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vcsn/algos/compose.hh>
5 #include <vcsn/dyn/automaton.hh>
6 #include <vcsn/dyn/fwd.hh>
7 
8 namespace vcsn
9 {
10  /*---------------.
11  | is-functional. |
12  `---------------*/
13 
16  template <Automaton Aut>
17  bool is_functional(const Aut& aut)
18  {
19  // Compose aut and its invert.
20  auto c = make_compose_automaton<false, 0, 0>(aut, aut);
21  c->compose();
22  return is_partial_identity(c);
23  }
24 
25  namespace dyn
26  {
27  namespace detail
28  {
30  template <Automaton Aut>
31  bool is_functional(const automaton& aut)
32  {
33  return is_functional(aut->as<Aut>());
34  }
35  }
36  }
37 }
Definition: a-star.hh:8
bool is_functional(const Aut &aut)
Whether aut is functional.
bool is_partial_identity(const Aut &aut)
Whether transducer aut is equivalent to a partial identity function on all successful paths...
bool is_functional(const automaton &aut)
Bridge.
std::shared_ptr< detail::automaton_base > automaton
Definition: automaton.hh:69