src/HOL/SPARK/Manual/document/Simple_Gcd.adb
author haftmann
Thu, 19 Jun 2025 17:15:40 +0200
changeset 82734 89347c0cc6a3
parent 45044 2fae15f8984d
permissions -rw-r--r--
treat map_filter similar to list_all, list_ex, list_ex1

package body Simple_Greatest_Common_Divisor
is

   procedure G_C_D (M, N : in Natural; G : out Natural)
   is
      C, D, R : Natural;
   begin
      C := M; D := N;
      while D /= 0
        --# assert Gcd (C, D) = Gcd (M, N);
      loop
         R := C mod D;
         C := D; D := R;
      end loop;
      G := C;
   end G_C_D;

end Simple_Greatest_Common_Divisor;