We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Found by @PascalDevenoge, the following program should verify but doesn't:
from typing import * from nagini_contracts.contracts import * Shape = Tuple[int, ...] class ndarray: @property def shape(self) -> Shape: ... @shape.setter def shape(self, new_shape: Shape) -> None: ... @Predicate @ContractOnly def array_pred(array: ndarray) -> bool: return True @Pure @ContractOnly def array_shape(array: ndarray) -> Shape: #type: ignore[return] Requires(Acc(array_pred(array), 1/2)) ... @ContractOnly def ones(shape: Shape) -> ndarray: #type: ignore[return] Requires(len(shape) > 0) Requires(Forall(shape, lambda l: l > 0)) Ensures(array_pred(Result())) Ensures(array_shape(Result()) == shape) # Ensures(shape == Old(shape)) ... shape = (2,) array1 = ones(shape) array2 = ones(shape) array1.shape = (3,) assert array_shape(array1) == shape assert array_shape(array2) == shape # assert array1.shape == shape assert array_shape(array1) == array_shape(array2)
The text was updated successfully, but these errors were encountered:
Fixed in #165
Sorry, something went wrong.
No branches or pull requests
Found by @PascalDevenoge, the following program should verify but doesn't:
The text was updated successfully, but these errors were encountered: