reducform.hh 3.47 KB
Newer Older
1
// Copyright (C) 2004  Laboratoire d'Informatique de Paris 6 (LIP6),
martinez's avatar
martinez committed
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Spot; see the file COPYING.  If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.

#ifndef SPOT_LTLVISIT_REDUCFORM_HH
# define SPOT_LTLVISIT_REDUCFORM_HH

#include "ltlast/formula.hh"
#include "ltlast/visitor.hh"

namespace spot
{
  namespace ltl
  {
32
33
34
35
36
37
38
    enum option {Base,
		 Inf,
		 InfBase,
		 EventualUniversal,
		 EventualUniversalBase,
		 InfEventualUniversal,
		 BRI};
39
40
41
42
43
44
45
46
47
48
49
50

    /// \brief Reduce a formula \a f using Basic rewriting, implies
    /// relation, and class of eventuality and univerality formula.
    ///
    /// Put the formula in negative normal form with
    /// spot::ltl::negative_normal_form and then reduce it according
    /// to options:
    /// Base for spot::ltl::Basic_reduce_form,
    /// Inf for spot::ltl::reduce_inf_form,
    /// EventualUniversal for spot::ltl::reduce_eventuality_universality_form,
    /// BRI for spot::ltl::reduce_form.
    formula* reduce(const formula* f, option opt = BRI);
51
52

    /// Implement basic rewriting.
martinez's avatar
martinez committed
53
    formula* basic_reduce_form(const formula* f);
54

55
56
57
    /// Implement rewritings rules using implies relation,
    /// and class of eventuality and univerality formula.
    formula* reduce_form(const formula* f, option o = BRI);
martinez's avatar
martinez committed
58

59
60
    /// Detect easy case of implies.
    /// True if f1 < f2, false otherwise.
61
    bool inf_form(const formula* f1, const formula* f2);
62
63
64
    /// Detect easy case of implies.
    /// If n = 0, true if !f1 < f2, false otherwise.
    /// If n = 1, true if f1 < !f2, false otherwise.
65
66
    bool infneg_form(const formula* f1, const formula* f2, int n);

67
68
69
    /// \brief Check whether a formula is eventual.
    ///
    /// FIXME: Describe what eventual formulae are.  Cite paper.
martinez's avatar
martinez committed
70
    bool is_eventual(const formula* f);
71
72
73
74

    /// \brief Check whether a formula is universal.
    ///
    /// FIXME: Describe what universal formulae are.  Cite paper.
martinez's avatar
martinez committed
75
76
    bool is_universal(const formula* f);

77
    /// Length of a formula.
78
    int form_length(const formula* f);
79

80
    /// Type the first node of a formula.
martinez's avatar
martinez committed
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
    class node_type_form_visitor : public const_visitor
    {
    public:
      enum type { Atom, Const, Unop, Binop, Multop };
      node_type_form_visitor();
      virtual ~node_type_form_visitor(){};
      type result() const;
      void visit(const atomic_prop* ap);
      void visit(const constant* c);
      void visit(const unop* uo);
      void visit(const binop* bo);
      void visit(const multop* mo);
    protected:
      type result_;
    };
    node_type_form_visitor::type node_type(const formula* f);

98
    /// Whether a formula starts with GF.
99
    bool is_GF(const formula* f);
100
    /// Whether a formula starts with FG.
101
    bool is_FG(const formula* f);
martinez's avatar
martinez committed
102
103
104
105
  }
}

#endif //  SPOT_LTLVISIT_REDUCFORM_HH