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
In many situations, reasoning about the bounds of Usize and Isize is very cumbersome (and sometimes, it leads to proof obligations that we don't know how to discharge), while reasoning about those bounds often doesn't really make sense.
For instance, the type Usize is often used to count the length of an array, a vector or a string, or the number of elements in a collection. If, say, we have a function which repeatedly adds elements in a vector, it can be hard (if not really possible) to properly state the precondition which will give us that the length of the vector will not overflow Usize.max. On the other hand, reasoning about this overflow often doesn't make sense: because of hardware limitations (that we don't model), it is likely that the Rust program will have run out of memory long before the length of the vector reaches Usize.max.
For this reason, we need to implement alternative definitions for Usize and Isize to model them as unbounded integers (this requires writing alternative definitions for Vec, Vec.len, Vec.push, etc.), as well as a way of switching (when calling Aeneas) between the bounded and the unbounded models.
In order to make the two versions of the definitions coexist in Lean, a possibility is maybe to use namespaces, and open the proper namespaces at the top of the generated files.
The text was updated successfully, but these errors were encountered:
In many situations, reasoning about the bounds of
Usize
andIsize
is very cumbersome (and sometimes, it leads to proof obligations that we don't know how to discharge), while reasoning about those bounds often doesn't really make sense.For instance, the type
Usize
is often used to count the length of an array, a vector or a string, or the number of elements in a collection. If, say, we have a function which repeatedly adds elements in a vector, it can be hard (if not really possible) to properly state the precondition which will give us that the length of the vector will not overflowUsize.max
. On the other hand, reasoning about this overflow often doesn't make sense: because of hardware limitations (that we don't model), it is likely that the Rust program will have run out of memory long before the length of the vector reachesUsize.max
.For this reason, we need to implement alternative definitions for
Usize
andIsize
to model them as unbounded integers (this requires writing alternative definitions forVec
,Vec.len
,Vec.push
, etc.), as well as a way of switching (when calling Aeneas) between the bounded and the unbounded models.In order to make the two versions of the definitions coexist in Lean, a possibility is maybe to use namespaces, and open the proper namespaces at the top of the generated files.
The text was updated successfully, but these errors were encountered: