src/HOL/SPARK/Examples/Sqrt/Sqrt.adb
author wenzelm
Sat, 23 May 2015 17:19:37 +0200
changeset 60299 5ae2a2e74c93
parent 41561 d1318f3c86ba
permissions -rw-r--r--
clarified NEWS: document_files are officially required since Isabelle2014, but the absence was tolerated as legacy feature;

package body Sqrt is

   function Isqrt(N: Natural) return Natural
   is
     R: Natural;
   begin
      R := 0;
      loop
         --# assert R * R <= N;
         exit when N - R * R < 2 * R + 1;
         R := R + 1;
      end loop;
      return R;
   end Isqrt;

end Sqrt;