Require Export Undecidability.Shared.Libs.PSL.Base Lia.
From Undecidability.L Require Export MoreList.
(* * Preliminaries *)
Instance le_preorder : PreOrder le.
Instance S_le_proper : Proper (le ==> le) S.
Instance plus_le_proper : Proper (le ==> le ==> le) plus.
Instance mult_le_proper : Proper (le ==> le ==> le) mult.
Instance pow_le_proper : Proper (le ==> eq ==> le) Nat.pow.
Instance max_le_proper : Proper (le ==> le ==> le) max.
repeat intro. repeat eapply Nat.max_case_strong;lia.
Qed.
Instance min_le_proper : Proper (le ==> le ==> le) min.
repeat intro. repeat eapply Nat.min_case_strong;lia.
Qed.
Instance Nat_log2_le_Proper : Proper (le ==> le) Nat.log2.
Instance Pos_to_nat_le_Proper : Proper (Pos.le ==> le) Pos.to_nat.
Instance Pos_add_le_Proper : Proper (Pos.le ==> Pos.le ==>Pos.le) Pos.add.
Definition maxP (P:nat -> Prop) m := P m /\ (forall m', P m' -> m' <= m).

Lemma sumn_le_bound l c :
(forall n, n el l -> n <= c) -> sumn l <= length l * c.