LydiaSyft
OneStepUnrealizability.h
1 #ifndef ONE_STEP_UNREALIZABILITY_HPP
2 #define ONE_STEP_UNREALIZABILITY_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 "Player.h"
11 #include "VarMgr.h"
12 
13 namespace Syft {
14 
20  class SmtOneStepUnrealizabilityVisitor : 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  Syft::Player starting_player;
28  // dummy value for 'result' since z3::expr does not have a default constructor
29  explicit SmtOneStepUnrealizabilityVisitor(const InputOutputPartition &partition, const Syft::VarMgr& var_mgr, z3::context& z3_context, z3::solver& solver, Syft::Player starting_player)
30  : partition{partition}, var_mgr{var_mgr}, z3_context{z3_context}, solver{solver}, result{z3_context.bool_val(true)}, starting_player{starting_player} {}
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  bool one_step_unrealizable(const whitemech::lydia::LTLfFormula &f, const InputOutputPartition &partition, const Syft::VarMgr& var_mgr, Syft::Player starting_player);
49 
50 }
51 
52 #endif //ONE_STEP_UNREALIZABILITY_HPP
A partition of variables into input and output variables.
Definition: InputOutputPartition.h:12
Implementation of the one-step unrealizability check using Z3.
Definition: OneStepUnrealizability.h:20
A dictionary that maps variable names to indices and vice versa.
Definition: VarMgr.h:15