@@ -276,10 +276,12 @@ private Expression ArrowSubtypeConstraint(IToken tok, BoundVar id, Function memb
276276 // forall x0,x1,x2 :: f.requires(x0,x1,x2)
277277 var bvs = new List < BoundVar > ( ) ;
278278 var args = new List < Expression > ( ) ;
279+ var bounds = new List < ComprehensionExpr . BoundedPool > ( ) ;
279280 for ( int i = 0 ; i < tps . Count - 1 ; i ++ ) {
280281 var bv = new BoundVar ( tok , "x" + i , new UserDefinedType ( tps [ i ] ) ) ;
281282 bvs . Add ( bv ) ;
282283 args . Add ( new IdentifierExpr ( tok , bv ) ) ;
284+ bounds . Add ( new ComprehensionExpr . SpecialAllocIndependenceAllocatedBoundedPool ( ) ) ;
283285 }
284286 var fn = new MemberSelectExpr ( tok , f , member . Name ) {
285287 Member = member ,
@@ -294,8 +296,7 @@ private Expression ArrowSubtypeConstraint(IToken tok, BoundVar id, Function memb
294296 body = Expression . CreateEq ( body , emptySet , member . ResultType ) ;
295297 }
296298 if ( tps . Count > 1 ) {
297- body = new ForallExpr ( tok , bvs , null , body , null ) ;
298- body . Type = Type . Bool ; // resolve here
299+ body = new ForallExpr ( tok , bvs , null , body , null ) { Type = Type . Bool , Bounds = bounds } ;
299300 }
300301 return body ;
301302 }
@@ -9693,6 +9694,7 @@ public enum PoolVirtues { None = 0, Finite = 1, Enumerable = 2, IndependentOfAll
96939694 ///
96949695 /// 0: AllocFreeBoundedPool
96959696 /// 0: ExplicitAllocatedBoundedPool
9697+ /// 0: SpecialAllocIndependenceAllocatedBoundedPool
96969698 ///
96979699 /// 1: WiggleWaggleBound
96989700 ///
@@ -9744,6 +9746,12 @@ public static List<VT> MissingBounds<VT>(List<VT> vars, List<BoundedPool> bounds
97449746 }
97459747 return missing ;
97469748 }
9749+ public static List < bool > HasBounds ( List < BoundedPool > bounds , PoolVirtues requiredVirtues = PoolVirtues . None ) {
9750+ Contract . Requires ( bounds != null ) ;
9751+ Contract . Ensures ( Contract . Result < List < bool > > ( ) != null ) ;
9752+ Contract . Ensures ( Contract . Result < List < bool > > ( ) . Count == bounds . Count ) ;
9753+ return bounds . ConvertAll ( bound => bound != null && ( bound . Virtues & requiredVirtues ) == requiredVirtues ) ;
9754+ }
97479755 static List < BoundedPool > CombineIntegerBounds ( List < BoundedPool > bounds ) {
97489756 var lowerBounds = new List < IntBoundedPool > ( ) ;
97499757 var upperBounds = new List < IntBoundedPool > ( ) ;
@@ -9816,6 +9824,13 @@ public ExplicitAllocatedBoundedPool() {
98169824 public override PoolVirtues Virtues => PoolVirtues . Finite | PoolVirtues . IndependentOfAlloc_or_ExplicitAlloc ;
98179825 public override int Preference ( ) => 0 ;
98189826 }
9827+ public class SpecialAllocIndependenceAllocatedBoundedPool : BoundedPool
9828+ {
9829+ public SpecialAllocIndependenceAllocatedBoundedPool ( ) {
9830+ }
9831+ public override PoolVirtues Virtues => PoolVirtues . IndependentOfAlloc_or_ExplicitAlloc ;
9832+ public override int Preference ( ) => 0 ;
9833+ }
98199834 public class IntBoundedPool : BoundedPool
98209835 {
98219836 public readonly Expression LowerBound ;
0 commit comments