spot  2.3.3.dev
ltsmin.hh
1 // -*- coding: utf-8 -*-
2 // Copyright (C) 2011, 2013, 2014, 2015, 2016, 2017 Laboratoire de Recherche et
3 // Developpement de l'Epita (LRDE)
4 //
5 // This file is part of Spot, a model checking library.
6 //
7 // Spot is free software; you can redistribute it and/or modify it
8 // under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // Spot is distributed in the hope that it will be useful, but WITHOUT
13 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 // License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 
20 #pragma once
21 
22 #include <spot/ltsmin/spins_interface.hh>
23 #include <spot/ltsmin/spins_kripke.hh>
24 #include <spot/kripke/kripke.hh>
25 #include <spot/twacube/twacube.hh>
26 #include <spot/tl/apcollect.hh>
27 #include <tuple>
28 #include <spot/mc/intersect.hh>
29 
30 namespace spot
31 {
32  class SPOT_API ltsmin_model final
33  {
34  public:
35  ~ltsmin_model();
36 
37  // \brief Load an ltsmin model, either from divine or promela.
38  //
39  // The filename given can be either a *.pm/*.pml/*.prom promela
40  // source or a *.spins dynamic library compiled with "spins file".
41  // If a promela source is supplied, this function will call spins to
42  // update the *.spins library only if it is not newer.
43  //
44  // Similarly the divine models can be specified as *.dve source or
45  // *.dve or *.dve2C libraries.
46  //
47  static ltsmin_model load(const std::string& file);
48 
49  // \brief Generate a Kripke structure on-the-fly
50  //
51  // The dead parameter is used to control the behavior of the model
52  // on dead states (i.e. the final states of finite sequences).
53  // If DEAD is "false", it means we are not
54  // interested in finite sequences of the system, and dead state
55  // will have no successor. If DEAD is
56  // "true", we want to check finite sequences as well as infinite
57  // sequences, but do not need to distinguish them. In that case
58  // dead state will have a loop labeled by true. If DEAD is any
59  // other string, this is the name a property that should be true
60  // when looping on a dead state, and false otherwise.
61  //
62  // This function returns 0 on error.
63  //
64  // \a to_observe the list of atomic propositions that should be observed
65  // in the model
66  // \a dict the BDD dictionary to use
67  // \a dead an atomic proposition or constant to use for looping on
68  // dead states
69  // \a compress whether to compress the states. Use 0 to disable, 1
70  // to enable compression, 2 to enable a faster compression that only
71  // work if all variables are smaller than 2^28.
72  kripke_ptr kripke(const atomic_prop_set* to_observe,
73  bdd_dict_ptr dict,
74  formula dead = formula::tt(),
75  int compress = 0) const;
76 
77  // \brief The same as above but returns a kripkecube, i.e. a kripke
78  // that can be use in parallel. Moreover, it support more ellaborated
79  // atomic propositions such as "P.a == P.c"
80  ltsmin_kripkecube_ptr kripkecube(std::vector<std::string> to_observe,
81  formula dead = formula::tt(),
82  int compress = 0,
83  unsigned int nb_threads = 1) const;
84 
89  static std::tuple<bool, std::string, std::vector<istats>>
90  modelcheck(ltsmin_kripkecube_ptr sys,
91  spot::twacube_ptr twa, bool compute_ctrx = false);
92 
93  static void swarmed_dfs(ltsmin_kripkecube_ptr sys, std::string name);
94  static void swarmed_gp_dfs(ltsmin_kripkecube_ptr sys,
95  std::function<bool(unsigned, unsigned)> fitness,
96  std::string name);
97 
98  // \brief
99  static std::string
100  interpolate_csv(ltsmin_kripkecube_ptr sys,
101  std::function<bool(unsigned, unsigned)> fitness,
102  std::string algoname);
103 
105  int state_size() const;
107  const char* state_variable_name(int var) const;
109  int state_variable_type(int var) const;
111  int type_count() const;
113  const char* type_name(int type) const;
115  int type_value_count(int type);
117  const char* type_value_name(int type, int val);
118 
119  private:
120  ltsmin_model(std::shared_ptr<const spins_interface> iface) : iface(iface)
121  {
122  }
123  std::shared_ptr<const spins_interface> iface;
124  };
125 }
Definition: graph.hh:33
Definition: ltsmin.hh:32
Interface for a Kripke structure.
Definition: kripke.hh:157
static formula tt()
Return the true constant.
Definition: formula.hh:1368
A Transition-based ω-Automaton.
Definition: twa.hh:622
Definition: interpolate.hh:246
This class is a template representation of a Kripke structure. It is composed of two template paramet...
Definition: kripke.hh:37
Main class for temporal logic formula.
Definition: formula.hh:669
std::shared_ptr< spot::kripkecube< spot::cspins_state, spot::cspins_iterator > > ltsmin_kripkecube_ptr
shortcut to manipulate the kripke below
Definition: spins_kripke.hh:228
std::set< formula > atomic_prop_set
Set of atomic propositions.
Definition: apcollect.hh:36

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Tue Apr 18 2017 14:42:56 for spot by doxygen 1.8.13