I would like to find the maximum in a vector of natural numbers. Vector (i.e., ‘vec’), however, is a different type than Set or List. I thought about several ideas that did not work, like leveling or lifting the type of vec or the definition of a recursive function.
What solution do you suggest to get the maximum value in a vector?
(*
IMPORTS:
"~~/src/HOL/Algebra/Ring"
"~~/src/HOL/Library/Numeral_Type"
"~~/src/HOL/Library/Permutations"
"~~/src/HOL/Library/Polynomial"
"~~/src/HOL/Big_Operators"
vec (VECTOR) is from Finite_Cartesian_Product
degree is from Polynomial
Max is from Big_Operators
*)
(* The problem is that "Max" from Big_Operators is not working on vectors! *)
definition maxdeg:: "('a::zero poly)^'n ⇒ nat" where "maxdeg v = Max(χ i . degree(v$i))"