如何使用理解或LAMBDA功能获得集合中的最小长度元素

发布于 2025-01-25 18:28:09 字数 262 浏览 4 评论 0原文

出于某种目的,我想在('列表集)中获取最小的元素,将整个设置作为最终状态。

但是我不知道如何实现此功能和证明。

definition initState :: "v list set\<Rightarrow> 'v list set" where 
"initState vset = {x. x\<in>vset \<and> length x \<le> 1}"

此代码是错误的。

For some purpose, I want to get the smallest length of element in ('a list set) as the InitalState, and the whole set as the FinalState.

But I don't know how to achieve this function and proof.

definition initState :: "v list set\<Rightarrow> 'v list set" where 
"initState vset = {x. x\<in>vset \<and> length x \<le> 1}"

This code is wrong.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ま昔日黯然 2025-02-01 18:28:09

首先,找出最小的长度。

定义“ Minlenvset®最小值(长度`vset)”

如果您的设置可以是无限的,则使用INF而不是最大。

挑选一个最小长度元素

然后使用描述( @或eps)定义

。描述可能很棘手。

First, find out what the smallest length is.

definition "minlen vset ≡ Min (length ` vset)"

Use Inf instead of Max if your set can be infinite.

Then pick out a minimum-length element using a description (@ or Eps)

definition "initState vset ≡ @x. x∈vset ∧ length x = minlen vset"

I suspect there may be a better way to define your state space, however: descriptions can be tricky to work with.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文