- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

# is_ltl.hxx

    00001 // is_ltl.hxx: this file is part of the Vaucanson project.
    00002 //
    00003 // Vaucanson, a generic library for finite state machines.
    00004 //
    00005 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2010 The Vaucanson Group.
    00006 //
    00007 // This program is free software; you can redistribute it and/or
    00008 // modify it under the terms of the GNU General Public License
    00009 // as published by the Free Software Foundation; either version 2
    00010 // of the License, or (at your option) any later version.
    00011 //
    00012 // The complete GNU General Public Licence Notice can be found as the
    00013 // `COPYING' file in the root directory.
    00014 //
    00015 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
    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(// t must be an automaton ...
    00032             const AutomataBase<S>&,
    00033             // ... over a free monoid product.
    00034             const algebra::FreeMonoidProduct<A, B>&,
    00035             const T& t)
    00036   {
    00037     BENCH_TASK_SCOPED("is_ltl");
    00038
    00039     // Type helper.
    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       // We assume that an initial transition cannot be labeled by
    00048       // the empty series.  In other words, l.supp().size() >= 1.
    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() != 1) || ((*it).second.size() != 1))
    00061           return false;
    00062       }
    00063     }
    00064
    00065     for_all_const_final_states(f, t)
    00066     {
    00067       series_set_elt_t l = t.get_final(*f);
    00068       if (l.supp().size() > 1)
    00069         return false;
    00070       // We assume that an initial transition cannot be labeled by
    00071       // the empty series.  In other words, l.supp().size() >= 1.
    00072       assertion(l.supp().size() == 1);
    00073       monoid_elt_value_t m = *l.supp().begin();
    00074       if (m.first.size() > 0 || m.second.size() > 0)
    00075         return false;
    00076     }
    00077
    00078     return true;
    00079   }
    00080
    00081   /*---------------.
    00082   | is_ltl facades |
    00083   `---------------*/
    00084
    00085   template <typename S, typename A>
    00086   bool
    00087   is_ltl(const Element<S, A>& t)
    00088   {
    00089     return do_is_ltl(t.structure(),
    00090                      t.structure().series().monoid(), t);
    00091   }
    00092
    00093 } // ! vcsn
    00094
    00095 #endif // ! VCSN_ALGORITHMS_IS_LTL_HXX