(* * Maximum element in a list *)
From Undecidability Require Export TM.Util.Prelim TM.Util.ArithPrelim.
(* ** Basic lemmas about upper bounds *)
(* ** Tail Recursive Definition *)
(* Compute the maximum of a list and a start-value tail-recursively *)
Fixpoint max_list_rec (s : nat) (xs : list nat) { struct xs } : nat :=
match xs with
| nil => s
| x :: xs' => max_list_rec (max x s) xs'
end.

(* This, is [max_list_rec s xs] is a strict upper bound, so is [s] *)
Corollary max_list_rec_gt xs s :
(forall y : nat, y el xs -> y < max_list_rec s xs) ->
forall y : nat, y el xs -> y < s.