Elements of Array should have a difference greater than 1

Hi All,
There exist 2 arrays :: array1 of size 5 and array2 of size 100.
Intention is to write a constraint such that all 5 elements of array1 exist within array2 such that they don’t occupy consecutive indexes in array2.

I am trying a solution using a helper array of size 5 whose elements are valid indexes in array2 with the constraint that elements of the helper array are not consecutive values.

The constraint for the helper array is that no elements have a difference of 1.
Eg: helper_array1 = '{ 0 , 5 , 1 , 10 , 7 } would be illegal as index 0 and 2 have elements with a difference of 1
I tried using array reduction or() ::

 class C;
    
    rand bit[3:0] val[];
    
    constraint SIZE { val.size() == 5 ; }
    
    constraint VAL { 
                       foreach(val[i])
                     {
                       val.or() with ( (item.index != i ) ? (  ( item > val[i] ) ? int'( item - val[i] ) : int'( val[i] - item )  ) : 0 ) > 1 ;
                     }  
                   }
                         
    constraint UNIQ { unique { val } ; }                         
  endclass  
  
  C c1 = new();
      
  initial begin
    repeat(10) begin 
      if( c1.randomize() )
        $display("Success with %0p",c1);  
    end  
  end  

However I do see indexes with elements having a difference of 1, any suggestions where I am falling short ?

I think you want a nested foreach

constraint SIZE { val.size() == 5 ; }

constraint VAL { foreach(val[i]) foreach (val[j])
                    i !=j -> (val[i] > val[j] ? val[i] - val[j] : val[j] - val[i])  > 1
                   }

You would no longer need the UNIQ constraint.

Thanks Dave.
I realized that in my or() reduction method would term val = '{ 0 , 5 , 1 , 10 , 7 } as one of the possible output ( although it was illegal as per intention ).
This was due to

// For Index 0 iteration ::
32'(5-0) | 32'(1-0) | 32'(10-0) | 32'(7-0) == 32'd5 | 32'd1 | 32'd10 | 32'd7 == 
32'b0101 | 32'b0001 |32'b1010 | 32'b0111 == 32'b1111 which is greater than 1