Random OM
Random OM
Addition of random Module Stub
File: src/python-frontend/models/random.py
- Implemented a stub for the
randommodule. - Defined the
randint(a: int, b: int) -> intmethod usingnondet_int(). - Ensured that the generated value satisfies the constraint
a <= value <= busing__ESBMC_assume().
Integration with Python Converter
File: src/python-frontend/python_converter.cpp
- Modified the
model_fileslist to include therandommodule for operational modeling. - Ensured the
randommodule is loaded during conversion.
Type Utility Adjustments
File: src/python-frontend/type_utils.h
- Updated the
is_builtin_function()method to recognizerandintas a built-in function. - This ensures correct type handling and integration within ESBMC.
Rationale
The addition of the random operational model allows ESBMC to verify Python programs that use random.randint(), enabling more comprehensive verification of probabilistic behaviors.
Testing
- Verified functionality by running test cases that generate random numbers within a specified range.
- Confirmed that ESBMC correctly assumes constraints on the nondeterministic integer values.
Future Work
- Extend support for additional functions in the
randommodule (e.g.,random,uniform). - Improve constraint modeling to enhance verification efficiency.