(* * Maximum element in a list *)
From Undecidability Require Export TM.Util.Prelim TM.Util.ArithPrelim.
(* ** Basic lemmas about upper bounds *)

(* We assume that [M] is an upper bound of [s] and [xs]. We also assume that [M] is either in xs, or every element of [x] is smaller than [s]. Then, if [M] is actually a strict upper bound of [xs], then [s] is also a strict upper bound of [xs]. *)
Lemma strict_greatest_upper_bound : forall (xs : list nat) (M s : nat),
(In M xs \/ (M = s /\ forall x, In x xs -> x <= s)) ->
(s <= M) ->
(forall x, In x xs -> x < M) ->
(forall x, In x xs -> x < s).