-
Notifications
You must be signed in to change notification settings - Fork 273
introduce __CPROVER_map type #7096
New issue
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
base: develop
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #7096 +/- ##
===========================================
+ Coverage 77.85% 77.86% +0.01%
===========================================
Files 1574 1576 +2
Lines 181245 181541 +296
===========================================
+ Hits 141109 141358 +249
- Misses 40136 40183 +47
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Could we please include some documentation of this, especially as there also is an intent to deprecate existing functionality? |
Also, could we please have some tests? |
Hi, some questions regarding the feature:
Thanks |
5b58406
to
f718eb4
Compare
Using a lambda.
It's a function, so
DECL only. These do not have an in-memory representation.
No. But you can have maps of maps.
It's the existing Ackermann reduction. |
82f715e
to
48e4eb8
Compare
regression/cbmc/map-type/basic1.desc
Outdated
CORE | ||
basic1.c | ||
|
||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somewhat random place for comment: I'd also like to see a failing test.
@@ -2534,6 +2534,7 @@ void c_typecheck_baset::typecheck_side_effect_function_call( | |||
function_application_exprt function_application(f_op, expr.arguments()); | |||
|
|||
function_application.add_source_location() = expr.source_location(); | |||
function_application.type() = mathematical_function_type.codomain(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this a bug? Did we not bump into this before?
{ | ||
const mathematical_function_typet &function_type = | ||
to_mathematical_function_type(src); | ||
std::string dest = CPROVER_PREFIX "map("; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really the only case of a mathematical function?
regression/cbmc/map-type/basic1.c
Outdated
my_map = __CPROVER_lambda | ||
{ | ||
int i; | ||
i == 1 ? 10 : 20 | ||
}; | ||
|
||
__CPROVER_assert(my_map(1) == 10, "(1)"); | ||
__CPROVER_assert(my_map(2) == 20, "(2)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Can one also use assumptions to have values in a map?
- Is there any (other) way to incrementally populate a map?
This introduces C syntax for a type __CPROVER_map(domain, codomain) where domain is a list of types and codomain is a type. The type is internal, for modeling purposes within our own library only, and hence not added to user-facing documentation. It replaces arrays with size __CPROVER_infinity, which are now deprecated.
This introduces C syntax for a type
__CPROVER_map(
domain,
codomain)
where domain is a list of types and codomain is a type. The type is
internal, for modeling purposes. It replaces arrays with size
__CPROVER_constant_infinity_uint
, which are now deprecated.