4#include <nlohmann/json.hpp>
39 : converter_(converter), list_value_(list)
47 const nlohmann::json &call_node,
48 const std::string &input,
49 const std::string &separator,
51 bool from_right =
false);
55 const nlohmann::json &call_node,
56 const exprt &input_expr,
57 const std::string &separator,
59 bool from_right =
false);
88 const exprt &fill_value,
89 const typet &elem_type,
90 const exprt *index_base =
nullptr);
108 const nlohmann::json &element);
129 const nlohmann::json &element);
149 const nlohmann::json &element);
172 const nlohmann::json &slice_node,
173 const nlohmann::json &element);
186 const nlohmann::json &col_index_node,
187 const nlohmann::json &element);
203 const nlohmann::json &col_slice_node,
204 const nlohmann::json &element);
250 const nlohmann::json &value_node);
287 std::vector<strided_axis>
axes;
295 const typet &resolved_array_type,
296 const nlohmann::json &slice_node);
299 const typet &elem_type,
300 const nlohmann::json &slice_node)
const;
305 const char *unnamed_error)
const;
307 const nlohmann::json &arg,
310 const nlohmann::json &arg,
314 const nlohmann::json &arg,
319 const nlohmann::json &arg,
321 const std::vector<std::size_t> &new_shape);
323 const nlohmann::json &arg,
325 std::vector<strided_axis> &axes);
327 const std::string &lhs_id,
328 const std::vector<std::size_t> &new_shape);
330 const nlohmann::json &arg,
335 const nlohmann::json &arg,
339 const nlohmann::json &arg,
344 const std::vector<nlohmann::json> &idx_nodes,
345 bool allow_plain_array)
const;
348 const nlohmann::json &node,
352 const nlohmann::json &node,
356 const nlohmann::json &node,
360 const std::vector<nlohmann::json> &indices);
363 const typet &elem_type,
364 const std::vector<std::size_t> &shape)
const;
373 const std::vector<strided_axis> &axes,
374 bool readonly =
false);
382 const std::vector<strided_axis> &axes,
383 const std::vector<std::size_t> *out_shape =
nullptr);
390 std::optional<strided_view_desc>
396 const std::vector<exprt> &
index)
const;
401 const nlohmann::json &node,
403 const std::function<
void(
const exprt &)> &body);
408 const nlohmann::json &node,
410 const std::function<
void(
const exprt &)> &leaf);
418 const nlohmann::json &arg);
421 const nlohmann::json &arg);
442 const nlohmann::json &arg,
443 const std::vector<std::size_t> &new_shape);
447 const nlohmann::json &arg,
448 bool flatten =
false,
449 bool alias_if_contiguous =
false);
453 const nlohmann::json &node,
463 const std::vector<nlohmann::json> &idx_nodes,
464 bool allow_plain_array =
false);
472 std::optional<flat_array_shape_info>
480 const std::vector<std::size_t> &shape,
503 const nlohmann::json &index_node);
519 const std::vector<nlohmann::json> &idx_nodes,
520 const nlohmann::json &element);
538 const std::vector<nlohmann::json> &indices,
539 const nlohmann::json &element);
550 const exprt &list_expr,
551 const nlohmann::json &slice_node,
552 const nlohmann::json &value_node);
555 const exprt &list_expr,
556 const nlohmann::json &slice_node);
559 eq_float_type_id(
const std::string &lhs_id,
const std::string &rhs_id)
const;
565 const nlohmann::json &left_node,
566 const nlohmann::json &right_node,
591 const nlohmann::json &subscript,
592 const std::string &elem_id,
593 const typet &elem_type);
601 const typet &lhs_type,
602 const typet &rhs_type)
const;
612 const typet &lhs_type,
614 const typet &rhs_type)
const;
618 const nlohmann::json &op,
620 bool enable_float_path =
true);
625 const nlohmann::json &op,
630 const nlohmann::json &op,
631 const exprt &other_list);
637 const nlohmann::json &element);
642 const nlohmann::json *source_node,
643 const exprt &source_list);
647 const exprt &source_list,
648 size_t literal_elem_count);
652 const nlohmann::json ¶m_node,
653 const std::string ¶m_id,
654 const typet &annotated,
663 const nlohmann::json &slice_node)
const;
669 const nlohmann::json &slice_node)
const;
694 const nlohmann::json &element);
716 const nlohmann::json &op);
732 const exprt &pyobject_expr,
733 const typet &elem_type,
734 bool mixed_numeric =
false,
735 bool string_safe =
false);
770 const exprt &list_arg,
771 const std::string &list_id,
772 const std::string &func_name,
786 const nlohmann::json &range_args,
787 const nlohmann::json &element,
788 bool materialise_elements =
true);
798 const exprt &tuple_expr,
799 const nlohmann::json &element);
838 const nlohmann::json &op,
847 const nlohmann::json &op,
857 const nlohmann::json &op,
867 const nlohmann::json &op,
876 const nlohmann::json &op,
878 const std::string &func_id);
890 const nlohmann::json &op,
892 const std::string &method_name);
938 const nlohmann::json &list_node,
939 const typet &fallback)
const;
971 const std::vector<exprt> &generic_trailing_args)
const;
987 const nlohmann::json &ast_node,
988 const nlohmann::json &target,
989 const exprt &list_expr,
990 codet &target_block);
995 exprt check_unpack_length(
996 const exprt &list_expr,
1000 codet &target_block);
1002 typet unpack_elem_type(
1003 const std::string &list_id,
1005 const typet &fallback)
const;
1009 recorded_index_from_end(
const std::string &list_id,
size_t from_end)
const;
1011 void record_starred_elem_types(
1012 const std::string &list_id,
1013 const std::string &star_id,
1016 const typet &elem_type);
1019 void assign_unpack_target(
1020 const nlohmann::json &ast_node,
1021 const nlohmann::json &tgt_node,
1022 const std::string &list_id,
1025 codet &target_block);
1033 exprt snapshot_scalar_value(
const nlohmann::json &value_node);
1040 const nlohmann::json &element,
1042 const std::vector<exprt> &list_elems);
1044 exprt build_list_at_call(
1047 const nlohmann::json &element);
1049 exprt bind_list_element(
const exprt &list_at_call);
1052 get_list_element_info(
const nlohmann::json &op,
const exprt &elem);
1056 void reject_items_view_vs_tuple_set(
1059 const exprt &converted_lhs,
1060 const exprt &converted_rhs);
1064 exprt as_object_reference(
const nlohmann::json &op,
const exprt &elem);
1067 get_tagged_element_info(
const nlohmann::json &op,
const exprt &elem);
1072 get_lookup_key_info(
const nlohmann::json &op,
const exprt &
key);
1077 get_erased_key_info(
const nlohmann::json &op,
const exprt &
key);
1081 exprt tagged_float_type_id(
bool enable_float_path)
const;
1086 handle_range_slice(
const exprt &
array,
const nlohmann::json &slice_node);
1091 copy_dict_view_elem_types(
const exprt &
array,
const std::string &sliced_id);
1092 void copy_list_of_dict_view_elem_types(
1094 const std::string &sliced_id);
1098 std::optional<exprt> build_scalar_pointer_view(
1100 const typet &elem_type,
1114 std::optional<exprt> try_build_1d_pointer_view(
1116 const typet &elem_type,
1118 bool needs_null_term,
1119 long long literal_start,
1120 long long static_slice_len);
1122 std::optional<exprt> try_build_row_pointer_view(
1124 const nlohmann::json &slice_node);
1126 std::optional<exprt> try_build_nd_subarray_pointer_view(
1128 const nlohmann::json &slice_node);
1130 std::optional<exprt> try_build_chained_subarray_pointer_view();
1132 std::optional<exprt> try_build_pointer_array_index(
1134 const exprt &pos_expr,
1135 const nlohmann::json &slice_node);
1137 exprt build_numpy_array_index_access(
1139 const exprt &pos_expr,
1140 const nlohmann::json &slice_node);
1142 std::optional<exprt> try_build_column_pointer_view(
1144 const nlohmann::json &col_index_node);
1146 std::optional<exprt> try_build_numpy_view_subview(
1148 const nlohmann::json &slice_node);
1150 std::optional<exprt> try_copy_numpy_pointer_view_slice(
1152 const typet &elem_type,
1153 const nlohmann::json &slice_node,
1157 void emit_slice_zero_step_raise(
1158 const nlohmann::json &slice_node,
1159 bool literal_zero_step);
1161 exprt normalize_and_scale_index(
1165 const nlohmann::json &slice_node);
1167 exprt normalize_and_scale_index(
1169 const exprt &length,
1170 const exprt &stride,
1171 const nlohmann::json &slice_node);
1173 struct symbolic_slice_params
1182 symbolic_slice_params emit_symbolic_slice_params(
1183 const nlohmann::json &slice_node,
1184 const exprt &extent);
1193 exprt build_symbolic_step_slice(
1195 const nlohmann::json &slice_node);
1197 exprt guard_numpy_pointer_view_index(
1200 const nlohmann::json &slice_node);
1202 exprt guard_numpy_static_array_index(
1205 const nlohmann::json &slice_node);
1208 handle_index_access(
const exprt &
array,
const nlohmann::json &slice_node);
1209 exprt index_value(
const exprt &
index,
const nlohmann::json &slice_node);
1216 bool is_numpy_param_negative_index_target(
const exprt &
array)
const;
1226 void normalize_index_access_position(
1228 const nlohmann::json &slice_node,
1229 const nlohmann::json &list_node,
1231 size_t &
index)
const;
1241 std::optional<exprt> resolve_nested_list_element(
1243 const exprt &pos_expr,
1262 exprt resolve_fixed_axis_index(
1263 const nlohmann::json &idx_node,
1266 const nlohmann::json &element);
1270 const symbolt &get_str_slice_sym();
1272 exprt remove_function_calls_recursive(
exprt &e,
const nlohmann::json &node);
1288 void emit_list_copy(
1291 const nlohmann::json &element);
1300 static void set_list_symbolic_size(
1303 const exprt &size_expr,
1304 const nlohmann::json &element);
1319 static exprt handle_symbolic_range(
1321 const nlohmann::json &range_args,
1322 const nlohmann::json &element,
1323 bool materialise_elements);
1336 static exprt build_concrete_range(
1338 const nlohmann::json &range_args,
1339 const nlohmann::json &element,
1340 const std::optional<long long> &arg0,
1341 const std::optional<long long> &arg1,
1342 const std::optional<long long> &arg2);
1345 const nlohmann::json &list_value_;
The single owner of per-instance element-type tracking for the Python frontend: "which types does thi...
Definition element_type_registry.h:49
std::vector< entry > entries
Definition element_type_registry.h:54
Definition std_expr.h:1168
Main converter for transforming Python AST into ESBMC's intermediate representation.
Definition python_converter.h:76
std::optional< exprt > build_element_replacement(const exprt &lhs, const exprt &rhs, const nlohmann::json &op)
The __ESBMC_list_set_at call storing rhs into the list element lhs reads, when store_replaces_element...
Definition list_mutation.cpp:798
static exprt axis_stride(const strided_axis &axis)
Definition list_strided_consumers.cpp:25
exprt build_insert_list_call(const symbolt &list, const exprt &index, const nlohmann::json &op, const exprt &elem)
Definition list_mutation.cpp:647
bool strided_basic_view_declines(const exprt &array, const std::vector< nlohmann::json > &idx_nodes, bool allow_plain_array) const
Definition list_access.cpp:2264
std::optional< exprt > unnamed_nd_view_placeholder(const strided_view_desc &view, bool as_view, bool flat_result, const char *unnamed_error) const
Definition list_strided_consumers.cpp:336
exprt contains(const exprt &item, const exprt &list)
Definition list_query.cpp:769
exprt handle_comprehension(const nlohmann::json &element)
Convert generator expressions and list comprehensions to lists.
Definition list_comprehension.cpp:8
typet attribute_elem_type(const exprt &array) const
The element type that a program class in the object's MRO annotates the instance-attribute list array...
Definition list_access.cpp:4608
exprt emit_view_accumulator(const nlohmann::json &arg, const typet &type, const exprt &init)
Definition list_strided_consumers.cpp:129
exprt emit_view_copy_buffer(const nlohmann::json &arg, const strided_view_desc &view, const exprt &count)
Definition list_strided_consumers.cpp:373
void handle_list_var_unpacking(const nlohmann::json &ast_node, const nlohmann::json &target, const exprt &list_expr, codet &target_block)
Unpack a list variable into multiple targets, supporting starred expressions.
Definition list_comprehension.cpp:304
std::optional< exprt > build_contiguous_shaped_view(const exprt &array, const std::vector< std::size_t > &shape, std::size_t offset, bool readonly)
Pointer into array's own contiguous storage, offset elements in, that reads as an N-D array of shape;...
Definition list_access.cpp:2531
void guard_pop_index(const symbolt &list, const exprt &index, const locationt &location)
Inside a try body, raises a catchable IndexError ahead of a pop() whose list is empty or whose index ...
Definition list_mutation.cpp:1638
void emit_counted_loop(const nlohmann::json &node, const exprt &extent, const std::function< void(const exprt &)> &body)
idx = 0; while (idx < extent) { body(idx); idx++; }, with the body's statements emitted inside the lo...
Definition list_strided_consumers.cpp:69
exprt build_mixed_slice_tuple_select(const exprt &array, const std::vector< nlohmann::json > &idx_nodes, const nlohmann::json &element)
Lower an N-D mixed slice/index tuple subscript with one or more bounded slice axes and fixed-index ax...
Definition list_access.cpp:1383
std::optional< exprt > try_build_symbolic_view_list(const nlohmann::json &arg, bool nested)
A Python list of a run-time-extent view's elements (nested per axis when nested, flat otherwise).
Definition list_strided_consumers.cpp:291
size_t eq_float_type_id(const std::string &lhs_id, const std::string &rhs_id) const
The float element type_id that lets list_eq compare mixed int and float elements numerically (Python'...
Definition list_query.cpp:126
exprt copy_strided_view(const strided_view_desc &source, const exprt &offset, const std::vector< strided_axis > &axes, const std::vector< std::size_t > *out_shape=nullptr)
Independent array holding the elements a view with these axes reads, in row-major order.
Definition list_access.cpp:2184
exprt build_fancy_index(const exprt &array, const std::vector< nlohmann::json > &indices, const nlohmann::json &element)
Lower integer-array (fancy) indexing a[[0, 2]] to a bounded, unrolled sequence of element reads: each...
Definition list_access.cpp:1563
std::optional< exprt > try_reduce_symbolic_view(const std::string &function, const nlohmann::json &arg)
Definition list_strided_consumers.cpp:255
exprt get()
Definition list_construction.cpp:152
std::vector< strided_axis > tracked_view_axes(const std::string &view_id) const
Axes of the pointer view registered under view_id.
Definition list_access.cpp:2069
void require_stored_types(expr2tc &sizes_ok, std::size_t depth, const exprt &lhs_at, const typet &lhs_type, const exprt &rhs_at, const typet &rhs_type) const
Conjoins to sizes_ok that the slots lhs_at and rhs_at hold lhs_type and rhs_type, for compare()'s nes...
Definition list_query.cpp:97
bool try_build_fill_diagonal_mutation(const exprt &array, const nlohmann::json &value_node)
np.fill_diagonal(a, value): mutates a's main diagonal in place via converter_.add_instruction,...
Definition list_access.cpp:2963
exprt build_index_range_list_call(const symbolt &list, const nlohmann::json &op, const exprt &elem, const exprt &start, const exprt &end)
Build a list.index(x, start[, end]) call — position of the first element equal to x within the slice ...
Definition list_query.cpp:1081
exprt build_pop_list_call(const symbolt &list, const exprt &index, const nlohmann::json &element)
Build a list pop operation.
Definition list_mutation.cpp:1672
bool is_runtime_numpy_slice(const exprt &array, const typet &elem_type, const nlohmann::json &slice_node) const
Definition list_access.cpp:3410
shallow_push_call select_shallow_push(const exprt &src, const exprt &untagged_last_arg) const
Shallow-push entry point for a copy of src.
Definition list_mutation.cpp:1403
typet unrecorded_base_elem_type()
The element type a subscript's base declares when the type map has no record of the list: a name's an...
Definition list_access.cpp:4659
static exprt axis_extent(const strided_axis &axis)
Definition list_strided_consumers.cpp:19
exprt build_list_from_exprs(const std::vector< exprt > &elems)
Materialize a fresh list from already-evaluated element values.
Definition list_construction.cpp:237
std::vector< exprt > literal_elems_for_variable_list(const nlohmann::json *source_node, const exprt &source_list)
The declaring literal's elements for a variable-held list, or empty when the literal cannot be used.
Definition list_mutation.cpp:976
typet bare_list_param_elem_type(const nlohmann::json ¶m_node, const std::string ¶m_id, const typet &annotated, size_t index)
Element type recovered for a bare list parameter, or a nil type.
Definition list_access.cpp:4432
bool has_shared_payload(const typet &type) const
Whether a list slot holding type may share its payload with a copy of the list: list copies keep the ...
Definition list_mutation.cpp:417
static bool is_bool_mask_rows_type(const typet &type)
True if type is a result struct built by build_bool_mask_row_select_symbolic (identified by its tag- ...
Definition list_access.cpp:514
exprt index_bool_mask_rows(const exprt &array, const nlohmann::json &slice_node, const nlohmann::json &element)
Index b[i] into a boolean-mask row-selection result (see build_bool_mask_row_select_symbolic): normal...
Definition list_access.cpp:642
std::optional< exprt > alias_contiguous_ravel(const nlohmann::json &arg, const strided_view_desc &view)
Definition list_strided_consumers.cpp:355
exprt build_bool_mask_index(const exprt &array, const exprt &mask, const nlohmann::json &element)
Lower boolean-mask indexing a[mask] to a runtime loop that builds a fresh list holding the elements o...
Definition list_access.cpp:268
exprt build_column_select(const exprt &array, const nlohmann::json &col_index_node, const nlohmann::json &element)
Lower 2-D column selection a[:, j] to a bounded copy over every row of a fixed-shape 2-D array,...
Definition list_access.cpp:1169
bool literal_still_describes_list(const exprt &source_list, size_t literal_elem_count)
True when a list's declaring literal still describes its contents.
Definition list_mutation.cpp:1018
static exprt build_list_from_tuple(python_converter &converter, const exprt &tuple_expr, const nlohmann::json &element)
Materialise a tuple value into a fresh list, pushing each component in order.
Definition list_construction.cpp:375
typet tagged_elem_type_or(const exprt &array, bool constant_index, const nlohmann::json &list_node, const typet &fallback) const
The recorded element type when it is a tagged scalar and the index is not constant; otherwise the fal...
Definition list_access.cpp:4679
exprt list_repetition(const nlohmann::json &left_node, const nlohmann::json &right_node, const exprt &lhs, const exprt &rhs)
Definition list_mutation.cpp:1032
void emit_view_loops(const nlohmann::json &node, const strided_view_desc &view, const std::function< void(const exprt &)> &leaf)
Nested loops over every index of a view; leaf is called once, inside the innermost body,...
Definition list_strided_consumers.cpp:100
std::optional< strided_axis > runtime_slice_axis(const strided_axis &source, const nlohmann::json &node, exprt &offset)
Definition list_access.cpp:2283
exprt build_set_membership_call(const symbolt &set, const nlohmann::json &op, const exprt &elem, const std::string &method_name)
Emit a call to a set membership-mutating C model function.
Definition list_set_ops.cpp:5
exprt build_remove_list_call(const symbolt &list, const nlohmann::json &op, const exprt &elem)
Build a list remove operation (removes first matching element).
Definition list_mutation.cpp:1933
bool store_replaces_element(const typet &old_type, const typet &new_type) const
Whether storing a new_type value into an element read as old_type replaces the element rather than wr...
Definition list_mutation.cpp:762
std::optional< flat_array_shape_info > flat_shape_info_of(const exprt &array) const
Total element count and scalar element type of a fixed-shape array of any rank, or of a contiguous N-...
Definition list_access.cpp:3019
std::optional< exprt > try_build_ravel_pointer_view(const exprt &array)
np.ravel(a)/a.ravel(): a writable, contiguous strided pointer view into a's own buffer (ADR-NP-003 et...
Definition list_access.cpp:3061
void scale_split_axis_strides(const nlohmann::json &arg, const strided_axis &source, std::vector< strided_axis > &axes)
Definition list_strided_consumers.cpp:531
std::optional< exprt > try_build_flat_index_assignment_target(const exprt &array, const nlohmann::json &index_node)
a.flat[i] = x: builds a dereferenced-pointer lvalue into a's own buffer at flat index i (bounds-check...
Definition list_access.cpp:3307
python_list(python_converter &converter, const nlohmann::json &list)
Definition python_list.h:38
void record_element_store(const nlohmann::json &subscript, const std::string &elem_id, const typet &elem_type)
Records elem_type as the type of the element subscript stores to.
Definition list_mutation.cpp:397
exprt reduce_view_truth(bool is_any, const nlohmann::json &arg, const strided_view_desc &view)
Definition list_strided_consumers.cpp:147
std::optional< exprt > reduce_view_argextreme(const std::string &function, const nlohmann::json &arg)
sum / mean / min / max / any / all of a run-time-extent view, as loops.
Definition list_strided_consumers.cpp:202
std::optional< strided_view_desc > contiguous_view_desc(const exprt &array, const typet &elem_type, const std::vector< std::size_t > &shape) const
Definition list_access.cpp:2046
exprt allocate_constructed_object(const exprt &lhs)
Allocates the instance a constructor stores to lhs and returns the pointer to pass as self.
Definition list_mutation.cpp:460
exprt build_copy_list_call(const symbolt &list, const nlohmann::json &element)
Build a list copy operation.
Definition list_mutation.cpp:1753
shallow_push_call select_list_extend(const exprt &src, const exprt &untagged_elem_size) const
Definition list_mutation.cpp:1393
std::optional< exprt > build_trace_reduction(const exprt &array, long long k)
np.trace(a, offset=k): sum of the elements np.diagonal(a, k) would view, computed directly as a scala...
Definition list_access.cpp:2865
static view_contiguity classify_view_contiguity(const strided_view_desc &view)
Whether a view covers its storage densely in row-major order.
Definition list_strided_consumers.cpp:484
const element_type_registry::entries * recorded_elem_types(const exprt &array) const
The type map's record of array, or nullptr when it has none or is an annotated instance attribute.
Definition list_access.cpp:4643
exprt index(const exprt &array, const nlohmann::json &slice_node)
Definition list_access.cpp:252
exprt build_shallow_copy_call(const exprt &src_list, const nlohmann::json &element)
Emit a __ESBMC_list_copy_shallow call producing a shallow copy of src_list (Python copy semantics: sc...
Definition list_mutation.cpp:1826
exprt reduce_view_extreme(const std::string &function, const nlohmann::json &arg, const strided_view_desc &view, const exprt &count)
Definition list_strided_consumers.cpp:166
exprt get_empty_set()
Create an empty set.
exprt extract_pyobject_value(const exprt &pyobject_expr, const typet &elem_type, bool mixed_numeric=false, bool string_safe=false)
Extract and dereference value from a PyObject* expression.
Definition list_access.cpp:5586
bool has_tagged_elements(const exprt &list) const
Definition list_mutation.cpp:1377
exprt scalar_storage_pointer(const exprt &array, const typet &scalar_ptr_type) const
array's storage as a pointer to its scalar element type.
Definition list_access.cpp:3051
std::optional< exprt > try_build_strided_basic_view(const exprt &array, const std::vector< nlohmann::json > &idx_nodes, bool allow_plain_array=false)
v = a[i, :, 1:3, ...] over a rank-3+ array or any N-D view, with literal or run-time indices and slic...
Definition list_access.cpp:2364
void reject_unresolved_element_read(const exprt &array, const nlohmann::json &slice_node) const
Refuses a read that no single recorded element type answers (#8472).
Definition list_access.cpp:4475
bool index_strided_axis(const strided_axis &source, const nlohmann::json &node, exprt &offset)
Definition list_access.cpp:2336
exprt strided_index_offset(const strided_view_desc &src, const std::vector< nlohmann::json > &indices)
Definition list_access.cpp:2435
exprt emit_ll_temp(const nlohmann::json &node, const char *name, const exprt &value)
Signed 64-bit temporary holding value, assigned once here.
Definition list_access.cpp:2022
void handle_subscript_assign_none(const exprt &list_expr, const nlohmann::json &slice_node)
Definition list_access.cpp:4329
std::optional< exprt > try_reshape_symbolic_view(const nlohmann::json &arg, const std::vector< std::size_t > &new_shape)
reshape of a run-time-extent view to constant new_shape: an alias when it is contiguous,...
Definition list_strided_consumers.cpp:571
void emit_reshape_size_guard(const nlohmann::json &arg, const exprt &count, const std::vector< std::size_t > &new_shape)
Definition list_strided_consumers.cpp:507
std::optional< exprt > try_build_diagonal_pointer_view(const exprt &array, long long k)
np.diagonal(a[, offset=k])/a.diagonal([k]): a read-only strided pointer view into a's own buffer (ADR...
Definition list_access.cpp:2816
exprt build_bool_mask_row_select_symbolic(const exprt &array, const exprt &mask, const nlohmann::json &element)
Lower whole-row boolean-mask selection a[mask] on a 2-D array for a symbolic (non-literal) mask: the ...
Definition list_access.cpp:522
view_contiguity
Definition python_list.h:429
@ contiguous
Definition python_list.h:430
@ not_contiguous
Definition python_list.h:431
@ unknown
Definition python_list.h:432
std::optional< expr2tc > fast_elem_equality(exprt lhs_val, exprt rhs_val, const typet &lhs_type, const typet &rhs_type) const
Equality of two list elements read as lhs_type and rhs_type for compare()'s fast path,...
Definition list_query.cpp:56
std::vector< strided_axis > owned_copy_axes(const nlohmann::json &arg, const strided_view_desc &view, bool flatten, const exprt &count)
Definition list_strided_consumers.cpp:408
exprt view_element_count(const nlohmann::json &node, const strided_view_desc &view)
Definition list_strided_consumers.cpp:119
exprt build_concat_list_call(const exprt &lhs, const exprt &rhs, const nlohmann::json &element)
Definition list_mutation.cpp:947
std::optional< strided_view_desc > symbolic_view_operand(const nlohmann::json &arg)
The descriptor of the named view when its extents or strides are known only at run time; nullopt for ...
Definition list_strided_consumers.cpp:32
exprt build_index_list_call(const symbolt &list, const nlohmann::json &op, const exprt &elem)
Build a list.index(x) call — position of the first element equal to x.
Definition list_query.cpp:1015
exprt build_min_max_for_mixed_numeric(const exprt &list_arg, const std::string &list_id, const std::string &func_name, irep_idt comparison_op)
Build an inline min/max computation for a mixed int/float list.
Definition list_query.cpp:904
exprt build_tuple_copy_call(const exprt &src_list, const nlohmann::json &element)
tuple(x) of a list: a shallow copy marked as a tuple (#8777).
Definition list_mutation.cpp:1798
exprt build_bool_mask_row_select(const exprt &array, const exprt &mask, const nlohmann::json &element)
Lower whole-row boolean-mask selection a[mask] on a 2-D array.
Definition list_access.cpp:368
void retype_element_store(exprt &lhs, exprt &rhs)
Turn the store lhs = rhs into a replacement of the element record when the value cannot be written th...
Definition list_mutation.cpp:426
static exprt build_list_from_range(python_converter &converter, const nlohmann::json &range_args, const nlohmann::json &element, bool materialise_elements=true)
Create a list from a range() call.
Definition list_construction.cpp:313
exprt build_extend_list_call(const symbolt &list, const nlohmann::json &op, const exprt &other_list)
Definition list_mutation.cpp:1421
static exprt build_split_list(python_converter &converter, const nlohmann::json &call_node, const std::string &input, const std::string &separator, long long count, bool from_right=false)
Definition list_string_ops.cpp:5
void build_mark_tuple_call(const exprt &list)
Mark list as built by tuple(x) (#8777).
Definition list_mutation.cpp:1808
exprt build_push_list_call(const symbolt &list, const nlohmann::json &op, const exprt &elem, bool enable_float_path=true)
Definition list_mutation.cpp:520
exprt build_is_tuple_call(const exprt &list)
Whether list was built by tuple(x) (#8777).
Definition list_mutation.cpp:1818
exprt build_strided_column_select(const exprt &array, const nlohmann::json &col_slice_node, const nlohmann::json &element)
Lower a strided column slice a[:, start:stop:step] on a fixed-shape 2-D array: the literal slice boun...
Definition list_access.cpp:1251
typet attribute_elem_type_or_any(const exprt &array) const
The element type of array's attribute annotation, or Any without one.
Definition list_access.cpp:4653
std::optional< strided_axis > slice_strided_axis(const strided_axis &source, const nlohmann::json &node, exprt &offset)
Definition list_access.cpp:2310
void reshape_registered_copy(const std::string &lhs_id, const std::vector< std::size_t > &new_shape)
Definition list_strided_consumers.cpp:553
void reject_mixed_member_element_read(const exprt &array, const nlohmann::json &slice_node) const
Refuses an index other than a non-negative constant into a list attribute whose recorded elements hav...
Definition list_access.cpp:4511
typet infer_literal_element_type(const nlohmann::json &list_literal)
Infer the element type of a list literal AST node, accounting for the int->float promotion applied at...
Definition list_type_inference.cpp:291
exprt view_element(const strided_view_desc &view, const std::vector< exprt > &index) const
Element lvalue of a view at a signed 64-bit multi-index.
Definition list_strided_consumers.cpp:51
friend class python_dict_handler
Definition python_list.h:1027
bool mixes_list_and_other(const std::string &id) const
True when the recorded elements of id mix a list with another type.
Definition list_access.cpp:4458
exprt compare(const exprt &l1, const exprt &l2, const std::string &op)
Definition list_query.cpp:155
std::optional< strided_view_desc > describe_strided_view(const exprt &array)
Definition list_access.cpp:2100
BigInt uniform_elem_size(const std::string &list_id) const
The element byte width every recorded element of list_id shares, or 0 when there is no single answer.
Definition list_mutation.cpp:1340
std::optional< exprt > try_build_numpy_param_slice_view(const exprt &array, const typet &resolved_array_type, const nlohmann::json &slice_node)
Definition list_access.cpp:3390
exprt build_count_list_call(const symbolt &list, const nlohmann::json &op, const exprt &elem)
Build a list.count(x) call — number of elements equal to x.
Definition list_query.cpp:1007
list_eq_target select_list_eq(const exprt &l1, const exprt &l2, const symbolt &generic_func, const std::vector< exprt > &generic_trailing_args) const
Equality entry point for l1 == l2 and the arguments that follow the two list operands.
Definition list_query.cpp:37
exprt build_symbolic_fill_list(const exprt &size, const exprt &fill_value, const typet &elem_type, const exprt *index_base=nullptr)
Build a runtime PyListObject filled with fill_value repeated size times.
Definition list_construction.cpp:47
std::optional< exprt > try_build_strided_view_index(const nlohmann::json &element)
b[i][j], b[i, j] or x = b[i] over a registered N-D strided view.
Definition list_access.cpp:2458
exprt register_strided_view(const strided_view_desc &source, const exprt &offset, const std::vector< strided_axis > &axes, bool readonly=false)
base + offset as a registered view with these axes for the assignment target (offset is a size_type e...
Definition list_access.cpp:2140
std::optional< exprt > try_copy_symbolic_view(const nlohmann::json &arg, bool flatten=false, bool alias_if_contiguous=false)
np.copy / np.array / .copy of a run-time-extent view.
Definition list_strided_consumers.cpp:444
exprt build_count_index_list_call(const symbolt &list, const nlohmann::json &op, const exprt &elem, const std::string &func_id)
Shared implementation of build_count_list_call / build_index_list_call; func_id selects the c:@F@__ES...
Definition list_query.cpp:974
void handle_slice_assignment(const exprt &list_expr, const nlohmann::json &slice_node, const nlohmann::json &value_node)
Lower a list slice assignment l[lower:upper:step] = value to a __ESBMC_list_slice_assign model call.
Definition list_access.cpp:4069
Definition type_handler.h:113
int count
Definition cuda.h:51
Classes and definitions for non-stringy internal representation.
irep_container< expr2t > expr2tc
Definition irep2.h:431
static auto create_list(int size, T default_value)
Definition numpy_call_expr.cpp:4866
@ l1
Definition numpy_call_expr.cpp:2087
@ l2
Definition numpy_call_expr.cpp:2086
uint256_t key
Definition solidity_mapping.c:1
unsigned stack_budget_guardt< Tag >::depth
Definition stack_budget.h:72
Definition python_list.h:30
typet elem_type
Definition python_list.h:31
long long total_length
Definition python_list.h:32
Definition python_list.h:22
locationt location
Definition python_list.h:26
symbolt * elem_symbol
Definition python_list.h:24
exprt elem_size
Definition python_list.h:25
symbolt * elem_type_sym
Definition python_list.h:23
Definition python_list.h:958
std::vector< exprt > trailing_args
Definition python_list.h:960
const symbolt * func
Definition python_list.h:959
Definition python_list.h:942
const symbolt * func
Definition python_list.h:943
exprt last_arg
Definition python_list.h:944
One axis of a strided view, in elements: its extent and stride are constants unless the matching expr...
Definition python_list.h:269
long long stride
Definition python_list.h:272
exprt extent_expr
Definition python_list.h:271
long long extent
Definition python_list.h:270
bool symbolic() const
Definition python_list.h:275
exprt stride_expr
Definition python_list.h:273
A numpy array or view as a scalar base pointer plus its axes: the descriptor every N-D view is built ...
Definition python_list.h:284
typet elem_type
Definition python_list.h:286
exprt base
Definition python_list.h:285
std::vector< strided_axis > axes
Definition python_list.h:287
bool readonly
A view of a read-only view (broadcast_to, diagonal) is read-only.
Definition python_list.h:289