--  Reductions over a matrix's components, with a filter; the sum's bounds proved from the
--  count of components so far (T32a)
with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
   subtype Small is Integer range -100 .. 100;
   type Matrix is array (Positive range <>, Positive range <>) of Small;
   function Largest (M : Matrix) return Integer is (M'Reduce (Integer'Max, Integer'First));
   function Any_Negative (M : Matrix) return Boolean is ([for E of M => E < 0]'Reduce ("or", False));
   function Small_Sum (M : Matrix) return Integer
   is ([for E of M => E]'Reduce ("+", 0))
     with Pre => M'Length (1) <= 10 and M'Length (2) <= 10;
   P : constant Matrix := ((1, 7, 3), (4, -5, 6));
begin
   Put_Line (Integer'Image (Largest (P)) & Boolean'Image (Any_Negative (P)) & Integer'Image (Small_Sum (P)));
   Put_Line (Integer'Image ([for E of P when E > 2 => E * 10]'Reduce ("+", 0)));
end Main;
