Section tryfind.
Variables (A E B : Type) (f : A -> E + B).
Fixpoint tryfind (err : E) (l : list A) :=
match l with
| nil => inl _ err
| a :: l' => match f a with
| inl err' => tryfind err' l'
| inr success as r => r
end
end.
End tryfind.
Definition max (n m : nat) := if leb n m then m else n.
Definition maxs (l : list nat) := fold_left (fun m n => max m n) l 0.
Definition elemb (n : nat) := existsb (fun m => beq_nat n m).
(*positive lemmas*)

Lemma Ppred_decrease n : (n<>1)%positive -> (nat_of_P (Ppred n)<nat_of_P n)%nat.