--  A loop over a subtype with a static predicate takes the values that satisfy it, in order
--  (RM 5.5(9/4); ACATS C550001): it took every value of the range, and over a subtype of
--  Integer that holds one value it did not end. So does a quantifier (RM 4.5.8).
with Ada.Text_IO;
procedure Main is
   subtype Small is Integer range 0 .. 20;
   subtype Odd is Small with Static_Predicate => Odd in 1 | 3 | 5 | 7 | 9;
   subtype Zero is Integer with Static_Predicate => Zero = 0;
   subtype None is Odd range 20 .. 20;
   type Color is (White, Red, Orange, Yellow, Green, Blue, Black);
   subtype Rainbow is Color with Static_Predicate => Rainbow in Red .. Blue and Rainbow /= Yellow;
   type Score_Base is mod 2**6;
   subtype Single is Score_Base range 1 .. 4;
   subtype Double is Score_Base with Static_Predicate => Double in 2 | 4 | 6 | 8;
   subtype Score is Score_Base with Static_Predicate => Score in Single | Double | 50;
begin
   for I in Odd loop
      Ada.Text_IO.Put (Integer'Image (I));
   end loop;
   Ada.Text_IO.New_Line;
   for I in reverse Odd loop
      Ada.Text_IO.Put (Integer'Image (I));
   end loop;
   Ada.Text_IO.New_Line;
   for I in Zero loop
      Ada.Text_IO.Put (Integer'Image (I));
   end loop;
   for I in None loop
      Ada.Text_IO.Put (Integer'Image (I));
   end loop;
   Ada.Text_IO.New_Line;
   for C in reverse Rainbow loop
      Ada.Text_IO.Put (" " & Color'Image (C));
   end loop;
   Ada.Text_IO.New_Line;
   for S in Score loop
      Ada.Text_IO.Put (Score_Base'Image (S));
   end loop;
   Ada.Text_IO.New_Line;
   Ada.Text_IO.Put_Line (Boolean'Image ((for all I in Odd => I mod 2 = 1)));
end Main;
