File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -325,6 +325,17 @@ impl<T> FracGhost<T> {
325325 self . r. validate( )
326326 }
327327
328+ /// Allowed values for a token's quantity when there is another token.
329+ pub proof fn bounded_with( tracked & mut self , tracked other: & Self )
330+ requires
331+ self . id( ) == other. id( ) ,
332+ ensures
333+ 0.0 real < ( old( self ) . frac( ) + other. frac( ) ) <= 1.0 real,
334+ * old( self ) == * final( self ) ,
335+ {
336+ self . r. validate_2( & other. r) ;
337+ }
338+
328339 /// Obtain an arbitrary resource with no information about it.
329340 /// Useful if you need a well-typed placeholder.
330341 pub proof fn dummy( ) -> ( tracked result: Self ) {
Original file line number Diff line number Diff line change @@ -245,6 +245,19 @@ impl<T> Frac<T> {
245245 let ( x, _) = self . r. validate( ) ;
246246 }
247247
248+ /// Allowed values for a token's quantity when there is another token.
249+ pub proof fn bounded_with( tracked & mut self , tracked other: & Self )
250+ requires
251+ self . id( ) == other. id( ) ,
252+ ensures
253+ 0.0 real < ( old( self ) . frac( ) + other. frac( ) ) <= 1.0 real,
254+ * old( self ) == * final( self ) ,
255+ {
256+ use_type_invariant( & * self ) ;
257+ use_type_invariant( other) ;
258+ self . r. validate_with_shared( & other. r) ;
259+ }
260+
248261 /// Obtain shared access to the underlying resource.
249262 pub proof fn borrow( tracked & self ) -> ( tracked ret: & T )
250263 ensures
You can’t perform that action at this time.
0 commit comments