

module Uf1
	use array.Array
	use ref.Ref
	use ref.Refint
	use int.Int
	use list.List

	function ll (l: list 'a) : int

	let cons(x:'a) (l: list 'a): list 'a
	ensures { ll result = ll l + 1 }=
	Cons x l

	val test(u: list int) : unit
	ensures { ll u = 0 }

	let nil(_:unit) : list 'a
	ensures { ll result = 0 } = Nil

	let b [@bddinfer] [@infer](_:int): list int
	ensures { ll result = 4 } =
		let k = ref 0 in
		let _ = nil () in
		let _ = 5 in
		while (!k < 3 && !k >= 0)
		do
		variant { 10- !k }
		incr k;
		done;
		Nil

	let b2 [@bddinfer] [@infer:oct](_:int): list int
	ensures { ll result = 4 } =
		let k = ref 0 in
		let _ = nil () in
		let _ = 5 in
		while (!k < 3 && !k >= 0)
		do
		variant { 10- !k }
		incr k;
		done;
		Nil

	let b3 [@bddinfer] [@infer:box](_:int): list int
	ensures { ll result = 4 } =
		let k = ref 0 in
		let _ = nil () in
		let _ = 5 in
		while (!k < 3 && !k >= 0)
		do
		variant { 10- !k }
		incr k;
		done;
		Nil

end
