
module Test
	use array.Array
	use ref.Ref
	use ref.Refint
	use int.Int

	let b [@bddinfer] [@infer](x:int): unit
	requires { x >= 1 }
	=
		let k = ref 0 in
		while (!k < x) do
		variant { x - !k }
		invariant { !k < 1 }
		incr k;
		()
		done; ()

	let b3 [@bddinfer] [@infer:box](x:int): unit
	requires { x >= 1 }
	=
		let k = ref 0 in
		while (!k < x) do
		variant { x - !k }
		invariant { !k < 1 }
		incr k;
		()
		done; ()

	let c [@bddinfer] [@infer](x:int): unit
	requires { x >= 2 }
	=
		let k = ref 0 in
		let j = ref 0 in
		while (!k < x) do
		variant { x - !k }
		invariant { !j < 4 }
		incr k;
		j := !j + 2;
		()
		done; ()

	let c2 [@bddinfer] [@infer:oct](x:int): unit
	requires { x >= 2 }
	=
		let k = ref 0 in
		let j = ref 0 in
		while (!k < x) do
		variant { x - !k }
		invariant { !j < 4 }
		incr k;
		j := !j + 2;
		()
		done; ()

	let c3 [@bddinfer] [@infer:box](x:int): unit
	requires { x >= 2 }
	=
		let k = ref 0 in
		let j = ref 0 in
		while (!k < x) do
		variant { x - !k }
		invariant { !j < 4 }
		incr k;
		j := !j + 2;
		()
		done; ()
end
