You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is an issue when comparing results in the equivalence script for certain functions. Functions that return: pointer, array, etc. There is no way to know how the results and equivalence should be checked. Moreover, there are no configurable options on how equivalence should be checked. This issue proposes the implementation of special functions that ESBMC-AI can detect that configure the verification process, these functions start with __ESBMCAI_ and are used by ESBMC-AI, so they aren't invoked by the rest of the source code.
The functions can be included in the source code for configuration reasons, but can be excluded from compilation by ignoring all functions beginning with __ESBMCAI_. The following functions are proposed:
int __ESBMCAI_EQ_X
Overrides the equality logic that ESBMC (the backend) will use. The function starts with __ESBMCAI_EQ_ indicating it is an ESBMC-AI special function for equality checking. The get_from_index names the function that this special function will act as the equality operation for. The parameters for the function should match the return data type of the function.
int__ESBMCAI_EQ_get_from_index(structLinkedList*a, structLinkedList*b)
{
// Do comparison here and return bool result.return0;
}
The function that __ESBMCAI_EQ_get_from_index will act as the equality operator for:
This allows for any type of function with any data type to be tested.
__ESBMCAI_CFG_X_
Allows for the configuration of properties of function X. Configurable properties:
int __ESBMCAI_CFG_MINVALUE_X_Y: Configures ESBMC AI to not supply a value less than what the function returns when supplying __VERIFIER_nondet_Z to parameter Y of function X.
int __ESBMCAI_CFG_MAXVALUE_X_Y: Configures ESBMC AI to not supply a value greater than what the function returns when supplying __VERIFIER_nondet_Z to parameter Y of function X.
Example:
// Configures ESBMC-AI __VERIFIER_nondet_int() > 10 for input parameter index in function get_from_indexint__ESBMCAI_CFG_MINVALUE_get_from_index_index() {
return10;
}
Z __ESBMCAI_SETVALUE_X_Y(Z Y)
When function X is being checked for partial equivalence, will call function __ESBMCAI_SETVALUE_X_Y for parameter Y. The parameter to the function will be Z Y where Z is the datatype of the parameter Y in question. The return value of __ESBMCAI_SETVALUE_X_Y will be used as a parameter.
We need to supply rules to that function because the index and the LinkedList provided need to coincide with each other. We can configure both values to relate like so:
Root parameter:
structLinkedList*__ESBMCAI_SETVALUE_get_from_index_root(structLinkedList*root) {
// Logic for constructing a good LinkedListreturnroot;
}
Index parameter:
intindex__ESBMCAI_SETVALUE_get_from_index_index(intindex) {
// Logic for constructing a good indexreturnindex;
}
How can we ensure communication between each method? As they don't have means of communicating, this is where the built-in seed function will come into place.
int__ESBMCAI_SEED();
Returns a random seed that for each parameter of the function will be consistent. So same value when called inside __ESBMCAI_SETVALUE_get_from_index_root and __ESBMCAI_SETVALUE_get_from_index_index, this can be used to synchronize behavior.
Tasks
Implement a method in ClangAST to get list of return statements in a function. Inputs: Function declaration.
Implement exclusion logic for automatically excluding functions that begin with “__ESBMCAI_CFG_”.
Implement function parsing during source code parsing phase that will build a list of configuration functions detected. Create object FunctionConfigurator that can return configuration overrides found in source code for each function.
Implement overriding logic during function equivalence script building step.
The text was updated successfully, but these errors were encountered:
There is an issue when comparing results in the equivalence script for certain functions. Functions that return: pointer, array, etc. There is no way to know how the results and equivalence should be checked. Moreover, there are no configurable options on how equivalence should be checked. This issue proposes the implementation of special functions that ESBMC-AI can detect that configure the verification process, these functions start with
__ESBMCAI_
and are used by ESBMC-AI, so they aren't invoked by the rest of the source code.The functions can be included in the source code for configuration reasons, but can be excluded from compilation by ignoring all functions beginning with
__ESBMCAI_
. The following functions are proposed:int __ESBMCAI_EQ_X
Overrides the equality logic that ESBMC (the backend) will use. The function starts with
__ESBMCAI_EQ_
indicating it is an ESBMC-AI special function for equality checking. Theget_from_index
names the function that this special function will act as the equality operation for. The parameters for the function should match the return data type of the function.The function that
__ESBMCAI_EQ_get_from_index
will act as the equality operator for:In the function equivalence script, if a valid function is detected, then the comparison will be changed from:
To:
This allows for any type of function with any data type to be tested.
__ESBMCAI_CFG_X_
Allows for the configuration of properties of function X. Configurable properties:
int __ESBMCAI_CFG_MINVALUE_X_Y
: Configures ESBMC AI to not supply a value less than what the function returns when supplying__VERIFIER_nondet_Z
to parameter Y of function X.int __ESBMCAI_CFG_MAXVALUE_X_Y
: Configures ESBMC AI to not supply a value greater than what the function returns when supplying__VERIFIER_nondet_Z
to parameter Y of function X.Example:
Z __ESBMCAI_SETVALUE_X_Y(Z Y)
When function X is being checked for partial equivalence, will call function
__ESBMCAI_SETVALUE_X_Y
for parameterY
. The parameter to the function will beZ Y
whereZ
is the datatype of the parameterY
in question. The return value of__ESBMCAI_SETVALUE_X_Y
will be used as a parameter.Example, we have a function to be optimized:
We need to supply rules to that function because the index and the
LinkedList
provided need to coincide with each other. We can configure both values to relate like so:Root parameter:
Index parameter:
How can we ensure communication between each method? As they don't have means of communicating, this is where the built-in seed function will come into place.
Returns a random seed that for each parameter of the function will be consistent. So same value when called inside
__ESBMCAI_SETVALUE_get_from_index_root
and__ESBMCAI_SETVALUE_get_from_index_index
, this can be used to synchronize behavior.Tasks
FunctionConfigurator
that can return configuration overrides found in source code for each function.The text was updated successfully, but these errors were encountered: