Array Constrained by Both Size and Iterative Constraint

LRM 2012 18.5.8.1 :: " If an array is constrained by both size constraints and iterative constraints, the size constraints are
solved first and the iterative constraints next. "
[ Q1 ] By iterative Constraint does it mean Only foreach or foreach as well as Array Reduction Methods like sum()
[ Q2 ] Do the size constraint and iterative constraint Need to 2 separate Constraints

eg :

 
         
constraint SIZEE { b.size() inside { [ 1:MAX ] } ; }   
  
constraint ITERATIVE {
                          foreach ( b[k] )
                        (k < b.size - 1) -> b[k + 1] > b[k]; 
 
                      }  
      

Or can they be a Part of same Constraint

eg :



constraint ONE {  b.size() inside { [ 1:MAX ] } ; 
                           foreach ( b[k] )
                        (k < b.size - 1) -> b[k + 1] > b[k];
                }   
  
    

Here is an Example I was trying



module Array_Constrained_by_Both_size_constraint_AND_iterative_constraint;
  
parameter  MAX = 10  ;

class A ;


bit [3:0] b [];


constraint SIZEWA { b.size() inside { [ 1:MAX ] } ; }   
  
constraint ITERATIVE {
                          foreach ( b[k] )
                        (k < b.size - 1) -> b[k + 1] > b[k]; 
 
                      }  
                      
                   

endclass

A a1;

initial begin


a1 = new();


repeat ( 10 )
begin
  
  
if ( ! a1.randomize() )
  $display("ERROR");

foreach(a1.b[i])
$write(" b[%0d] == %0d ",i,a1.b[i]);
$display();

end

end

  
endmodule  



Now i got an ERROR all 10 Times , I assumed it might be due to older version of Simulator so I tried adding a Constraint ::



 constraint ORDERING { solve A::SIZEWA before A::ITERATIVE ;  }   // Error 


{Q3 ] Any other Way i can Modify the Code above ?

[Q4] When randomizing a Dynamic Array of Handles can the size Constraint solved before Iterative Constraint be taken advantage of ?



class Object;
   rand int id;
endclass
 
class Objects;
   rand Object lst[];
   
  constraint size_c { lst.size() inside {[1:5]};}

// Need to add Iterative Constraint 


Now the iterative constraint should be something like ::



      lst  = new[size]; // Will this Work in a Constraint ?
      foreach (lst[i]) begin // This Would Work but should Iterate after new[]
	 lst[i]     = new;
	 lst[i].id  = i;
                       end

In reply to Etrx91:

Your problem is simply you forgot to declare b as rand.

A1) Yes. See 18.5.8.1 foreach iterative constraints and 18.5.8.2 Array reduction iterative constraints.
A2) Does not matter.
A3) Declare b as rand.
A4) The constraint solver cannot construct an object. You have to do it before calling randomize() or in pre/post_randomize().