用多项式大小布尔表达式表达事实

发布于 2025-01-08 08:32:50 字数 113 浏览 6 评论 0原文

如果我有布尔变量 a_1, a_2, .. , a_n。如何使用多项式大小布尔表达式来表达设置为 true 的布尔变量数量大于某个 k 的事实? (指数很容易 - 只需编写 newton(n,k) 表达式即可)。

If I have boolean variables a_1, a_2, .. , a_n. How can I express the fact that number of boolean variables which are set to true is bigger than some k, using polynomial size boolean expression? (Exponential is easy - just write newton(n,k) expressions).

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

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

发布评论

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

评论(2

℉服软 2025-01-15 08:32:50

使用任何排序网络对布尔值进行排序。然后只需取第 (k+1) 位排序即可得到结果。

由于排序网络的每个元素代表一对逻辑运算,因此您可以将该网络解释为逻辑表达式。有了良好的排序网络,这将为您提供 O(N*log2(N)) 运算的表达式。

Sort your booleans with any sorting network. Then just take (k+1)'th sorted bit, which gives you the result.

Since each of the sorting network's elements represents a pair of logical operations, you can interpret this network as logical expression. With good sorting network, this will give you an expression with O(N*log2(N)) operations.

十雾 2025-01-15 08:32:50

令 t[i][j] 表示元素中的 a_1, .., a_i, j 被设置为 true。
现在我们可以清楚地看到

    t[i][j] => (t[i-1][j] or (t[i-1][j-1] and a_i). 

(因为 a_1, .., a_(i-1) 中已经设置了变量,或者设置了 a_i 并且 a_1, .. , a_(i-1) 中有 j-1 个变量。
这是多项式大小表达式(围绕 n*k 个变量 t[i][j],对于每个表达式,就像我上面写的那样)。然后,如果 t[n][k] 为真,我们就知道 n 个变量中至少 k 为真。

参考叶夫根尼的回答,
为了按排序顺序获取变量(首先是 true,然后是 false),我们查看序列
t[n][1]、t[n][2]、...t[n][n]。

let t[i][j] mean that out of elements a_1, .., a_i, j of them is set to true.
Now we can clearly see that

    t[i][j] => (t[i-1][j] or (t[i-1][j-1] and a_i). 

(as either variable was already set in a_1, .., a_(i-1) or a_i is set and there is j-1 variables in a_1, .. , a_(i-1).
This is polynomial size expression (around n*k variables t[i][j], for each one expression like the one I have written above). Then if t[n][k] is true, we get that our of n variables at least k is true.

Reffering to Evgeny answer,
To get the variables in the sorted order (first trues, then falses), we look at the sequence
t[n][1], t[n][2], .. t[n][n].

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