module Incr

	use int.Int
	use int.MinMax
	use ref.Ref
	use ref.Refint

	let incr1[@infer](x:int) : int
	  ensures { result = max x 0 }
	= let i = ref 0 in
	  while !i < x do
	    variant { x - !i }
	    incr i;
	  done;
	  !i

	let incr3[@infer:box](x:int) : int
	  ensures { result = max x 0 }
	= let i = ref 0 in
	  while !i < x do
	    variant { x - !i }
	    incr i;
	  done;
	  !i

end
