00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 #ifndef VCSN_ALGORITHMS_IS_LTL_HXX
00018 # define VCSN_ALGORITHMS_IS_LTL_HXX
00019 
00020 # include <vaucanson/algorithms/is_ltl.hh>
00021 
00022 # include <vaucanson/misc/usual_macros.hh>
00023 
00024 # include <vaucanson/automata/concept/automata_base.hh>
00025 # include <vaucanson/algebra/concept/freemonoid_product.hh>
00026 
00027 namespace vcsn
00028 {
00029   template<typename S, typename A, typename B, typename T>
00030   bool
00031   do_is_ltl(
00032             const AutomataBase<S>&,
00033             
00034             const algebra::FreeMonoidProduct<A, B>&,
00035             const T& t)
00036   {
00037     BENCH_TASK_SCOPED("is_ltl");
00038 
00039     
00040     AUTOMATON_TYPES(T);
00041 
00042     for_all_const_initial_states(i, t)
00043     {
00044       series_set_elt_t l = t.get_initial(*i);
00045       if (l.supp().size() > 1)
00046         return false;
00047       
00048       
00049       assertion(l.supp().size() == 1);
00050       monoid_elt_value_t m = *l.supp().begin();
00051       if (m.first.size() > 0 || m.second.size() > 0)
00052         return false;
00053     }
00054 
00055     for_all_const_transitions(e, t)
00056     {
00057       series_set_elt_t label = t.series_of(*e);
00058       for_all_const_(series_set_elt_t::support_t, it, label.supp())
00059       {
00060         if (!(((*it).first.size() == ((*it).second.size())) &&
00061               ((*it).second.size() == 1)))
00062           return false;
00063       }
00064     }
00065 
00066     for_all_const_final_states(f, t)
00067     {
00068       series_set_elt_t l = t.get_final(*f);
00069       if (l.supp().size() > 1)
00070         return false;
00071       
00072       
00073       assertion(l.supp().size() == 1);
00074       monoid_elt_value_t m = *l.supp().begin();
00075       if (m.first.size() > 0 || m.second.size() > 0)
00076         return false;
00077     }
00078 
00079     return true;
00080   }
00081 
00082   
00083 
00084 
00085 
00086   template <typename S, typename A>
00087   bool
00088   is_ltl(const Element<S, A>& t)
00089   {
00090     return do_is_ltl(t.structure(),
00091                      t.structure().series().monoid(), t);
00092   }
00093 
00094 } 
00095 
00096 #endif // ! VCSN_ALGORITHMS_IS_LTL_HXX