ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
python_set.h
Go to the documentation of this file.
1#pragma once
2
3#include <nlohmann/json.hpp>
4#include <util/irep/type.h>
5#include <util/irep/expr.h>
7
9
19{
20public:
21 python_set(python_converter &converter, const nlohmann::json &set_node)
22 : converter_(converter), set_value_(set_node)
23 {
24 }
25
30 exprt get();
31
37
44 exprt get_from_iterable(const exprt &iterable, const nlohmann::json &element);
45
54 const exprt &lhs,
55 const exprt &rhs,
56 const nlohmann::json &element);
57
66 const exprt &lhs,
67 const exprt &rhs,
68 const nlohmann::json &element);
69
78 const exprt &lhs,
79 const exprt &rhs,
80 const nlohmann::json &element);
81
87 exprt build_set_copy(const symbolt &self, const nlohmann::json &element);
88
98 const exprt &lhs,
99 const exprt &rhs,
100 const nlohmann::json &element);
101
116 const symbolt &self,
117 const exprt &other,
118 const nlohmann::json &element,
119 const std::string &method_name);
120
131 const exprt &self,
132 const exprt &other,
133 const nlohmann::json &element,
134 const std::string &method_name);
135
148 python_converter &converter,
149 const std::string &op,
150 exprt &lhs,
151 exprt &rhs,
152 const nlohmann::json &element);
153
154private:
159 symbolt &create_set_list();
160
167 static void emit_filtered_extend(
168 python_converter &converter,
169 const exprt &source_expr,
170 const exprt &ref_expr,
171 const symbolt &sink,
172 bool want_in_ref,
173 const nlohmann::json &element);
174
175 python_converter &converter_;
176 const nlohmann::json &set_value_;
177};
Definition expr.h:34
Main converter for transforming Python AST into ESBMC's intermediate representation.
Definition python_converter.h:76
python_set(python_converter &converter, const nlohmann::json &set_node)
Definition python_set.h:21
exprt get_empty_set()
Create an empty set.
Definition python_set.cpp:95
exprt build_set_copy(const symbolt &self, const nlohmann::json &element)
Build a fresh shallow copy of self as a new set.
Definition python_set.cpp:725
exprt build_set_intersection_call(const exprt &lhs, const exprt &rhs, const nlohmann::json &element)
Build set intersection operation (set1 & set2).
Definition python_set.cpp:603
exprt build_set_union_call(const exprt &lhs, const exprt &rhs, const nlohmann::json &element)
Build set union operation (set1 | set2).
Definition python_set.cpp:734
static exprt handle_operations(python_converter &converter, const std::string &op, exprt &lhs, exprt &rhs, const nlohmann::json &element)
Handle set operations (difference, intersection, union) Entry point for all set binary operations.
Definition python_set.cpp:1146
exprt build_set_method_call(const symbolt &self, const exprt &other, const nlohmann::json &element, const std::string &method_name)
Emit the IR for a binary set method (issubset / issuperset / isdisjoint / update / symmetric_differen...
Definition python_set.cpp:1107
exprt build_set_relation_call(const exprt &self, const exprt &other, const nlohmann::json &element, const std::string &method_name)
Emit the IR for issubset / issuperset / isdisjoint over two list-typed expressions and return the boo...
Definition python_set.cpp:991
exprt build_set_difference_call(const exprt &lhs, const exprt &rhs, const nlohmann::json &element)
Build set difference operation (set1 - set2).
Definition python_set.cpp:476
exprt get_from_iterable(const exprt &iterable, const nlohmann::json &element)
Create a set from an iterable (e.g., set(list) or set(str)).
Definition python_set.cpp:105
exprt build_set_symmetric_difference_call(const exprt &lhs, const exprt &rhs, const nlohmann::json &element)
Build set symmetric difference (set1 ^ set2): (lhs - rhs) ∪ (rhs - lhs), collected into a fresh set.
Definition python_set.cpp:1210
exprt get()
Create a set from a set literal.
Definition python_set.cpp:61
Definition symbol.h:12
@ other
Definition converter_compare.cpp:887