Vector 伊莎贝尔:向量中的最大值

Vector 伊莎贝尔:向量中的最大值,vector,max,isabelle,Vector,Max,Isabelle,我想找出自然数向量的最大值。然而,Vector(即“vec”)与Set或List是不同的类型。我想到了一些不起作用的想法,比如调整或提升vec的类型或递归函数的定义 你建议用什么方法来获得向量的最大值 (* IMPORTS: "~~/src/HOL/Algebra/Ring" "~~/src/HOL/Library/Numeral_Type" "~~/src/HOL/Library/Permutations" "~~/src/HOL/Library/Polynomial" "

我想找出自然数向量的最大值。然而,Vector(即“vec”)与Set或List是不同的类型。我想到了一些不起作用的想法,比如调整或提升vec的类型或递归函数的定义

你建议用什么方法来获得向量的最大值

(*
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))"

最大运算符
Max
具有类型
'a set=>'a
,即从(有限)集合检索最大元素。向量(类型
(a,b)vec
)本质上是从索引到条目的函数,抽象写为
χi_和应用程序为
v$\ucode>

现在需要获得向量范围内的最大值。记住以上内容,您可以使用
范围
函数,并在向量上详细说明函数应用:

 maxdeg v = Max (range (%j. (χ i. degree (v $ i)) $ j))
这可以简化为

 maxdeg v = Max (range (%i. degree (v $ i)))
如果您只需要向量的最大输入,而不首先映射向量上的度,则以下操作有效(其中
op$v
%j.v$j
的eta收缩):

 maxvec v = Max (range (op $ v))