Awali
Another Weighted Automata library
is_of_finite_image.hh
Go to the documentation of this file.
1 // This file is part of Awali.
2 // Copyright 2016-2022 Sylvain Lombardy, Victor Marsault, Jacques Sakarovitch
3 //
4 // Awali is a free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef AWALI_ALGOS_FINITE_IMAGE_HH
18 #define AWALI_ALGOS_FINITE_IMAGE_HH
19 
23 #include <awali/sttc/misc/add_epsilon_trans.hh> // is_epsilon
24 
25 namespace awali {
26  namespace sttc {
38  template<unsigned I, typename Tdc>
39  bool is_of_finite_image(const Tdc& tdc) {
40  using labelset_t = labelset_t_of<Tdc>;
41  using Ilabelset_t = typename labelset_t::template valueset_t<I>;
42  auto ptdc = proper(tdc);
43  for(auto tr : ptdc->transitions()) {
44  if(!is_epsilon<Ilabelset_t>(std::get<I>(ptdc->label_of(tr))))
45  ptdc->del_transition(tr);
46  }
47  return is_acyclic(ptdc);
48  }
49  }
50 }//end of ns awali::stc
51 
52 #endif
auto proper(const Aut &aut, direction_t dir=BACKWARD, bool prune=true, bool keep_history=true) -> decltype(copy(aut))
Eliminate spontaneous transitions.
Definition: proper.hh:444
typename internal::labelset_t_of_impl< internal::base_t< ValueSet > >::type labelset_t_of
Helper to retrieve the type of the labelset of a value set.
Definition: traits.hh:76
ATTRIBUTE_CONST bool is_acyclic(const Aut &aut)
Definition: is_acyclic.hh:98
bool is_of_finite_image(const Tdc &tdc)
Check whether the image of every word is finite.
Definition: is_of_finite_image.hh:39
Main namespace of Awali.
Definition: ato.hh:22