Open
Description
Proving the postcondition below seems to require expressing that f1
and f2
return true if and only if some element of a1
and a2
respectively are greater than zero.
pragma solidity ^0.5.0;
/// @notice invariant __verifier_eq(a1, a2)
contract A {
int[] a1;
int[] a2;
/// @notice postcondition r1 == r2
function g() public view returns (bool r1, bool r2) {
r1 = f1();
r2 = f2();
return (r1, r2);
}
function f1() public view returns (bool) {
for (uint i = 0 ; i < a1.length ; i++)
if (a1[i] > 0)
return true;
return false;
}
function f2() public view returns (bool) {
for (uint i = 0 ; i < a2.length ; i++)
if (a2[i] > 0)
return true;
return false;
}
}
As far as I can tell, solc-verify
currently has no way to express such things. Is there any hope that some day this kind of thing might be supported?