LydiaSyft
OneStepRealizability.h
1 #ifndef ONE_STEP_REALIZABILITY_HPP
2 #define ONE_STEP_REALIZABILITY_HPP
3 
4 #include <z3++.h>
5 #include <set>
6 #include <lydia/visitor.hpp>
7 #include <optional>
8 
9 #include "game/InputOutputPartition.h"
10 #include "VarMgr.h"
11 
12 
13 namespace Syft {
14 
20  class SmtOneStepRealizabilityVisitor : public whitemech::lydia::Visitor {
21  public:
22  InputOutputPartition partition;
23  const VarMgr& var_mgr;
24  z3::context& z3_context;
25  z3::solver& solver;
26  z3::expr result;
27  std::set<std::string> uncontrollableVars;
28  // dummy value for 'result' since z3::expr does not have a default constructor
29  explicit SmtOneStepRealizabilityVisitor(const InputOutputPartition &partition, const Syft::VarMgr& var_mgr, z3::context& z3_context, z3::solver& solver)
30  : partition{partition}, var_mgr{var_mgr}, z3_context{z3_context}, solver{solver}, result{z3_context.bool_val(true)} {}
32  void visit(const whitemech::lydia::LTLfTrue &) override;
33  void visit(const whitemech::lydia::LTLfFalse &) override;
34  void visit(const whitemech::lydia::LTLfAtom &) override;
35  void visit(const whitemech::lydia::LTLfNot &) override;
36  void visit(const whitemech::lydia::LTLfAnd &) override;
37  void visit(const whitemech::lydia::LTLfOr &) override;
38  void visit(const whitemech::lydia::LTLfNext &) override;
39  void visit(const whitemech::lydia::LTLfWeakNext &) override;
40  void visit(const whitemech::lydia::LTLfUntil &) override;
41  void visit(const whitemech::lydia::LTLfRelease &) override;
42  void visit(const whitemech::lydia::LTLfEventually &) override;
43  void visit(const whitemech::lydia::LTLfAlways &) override;
44 
45  z3::expr apply(const whitemech::lydia::LTLfFormula &f);
46  };
47 
48  std::optional<CUDD::BDD> one_step_realizable(const whitemech::lydia::LTLfFormula &f, const InputOutputPartition &partition, const Syft::VarMgr& var_mgr);
49 
50 }
51 
52 #endif //ONE_STEP_REALIZABILITY_HPP
A partition of variables into input and output variables.
Definition: InputOutputPartition.h:12
Implementation of the one-step realizability check using Z3.
Definition: OneStepRealizability.h:20
A dictionary that maps variable names to indices and vice versa.
Definition: VarMgr.h:15