src/HOL/SPARK/Manual/document/loop_invariant.adb
author bulwahn
Sun, 05 Feb 2012 08:24:38 +0100
changeset 46417 1a68fcb80b62
parent 45044 2fae15f8984d
permissions -rw-r--r--
beautifying definitions of check_all and adding instance for finite_4

package body Loop_Invariant
is

   procedure Proc1 (A : in Natural; B : in Word32; C : out Word32)
   is
   begin
      C := 0;
      for I in Natural range 1 .. A
        --# assert Word32 (I - 1) * B = C;
      loop
         C := C + B;
      end loop;
   end Proc1;

   procedure Proc2 (A : in Natural; B : in Word32; C : out Word32)
   is
   begin
      C := 0;
      for I in Natural range 1 .. A
        --# assert Word32 (I - 1) * B = C;
      loop
         C := C + B;
        --# assert Word32 (I) * B = C;
      end loop;
   end Proc2;

end Loop_Invariant;