Isabelle: maximum value in a vector

試著忘記壹切 提交于 2019-12-04 11:49:39

The maximum operator Max has type 'a set => 'a, i.e., retrieves the maximum element from a (finite) set. Vectors (type (a, b) vec) are essentially functions from indices to entries with abstraction written as χ i. _ and application as v $ _.

You now want to get the maximum value in the range of a vector. With the above in mind, you can use the range function and spell out the function application on vectors:

 maxdeg v = Max (range (%j. (χ i. degree (v $ i)) $ j))

This can be simplified to

 maxdeg v = Max (range (%i. degree (v $ i)))

If you just want the maximum entry of a vector without mapping degree over vector first, the following works (where op $ v is the eta-contraction of %j. v $ j):

 maxvec v = Max (range (op $ v))
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!