frama-c - 如何使用 Frama-C 证明这个 C is_power_of_2 函数?
问题描述
在上一个问题中,我寻求帮助编写 apredicate
以查找数字是否为 2 的幂。这是尝试证明以下 C 函数的前奏:
static inline bool
is_power_of_2 (unsigned long v)
{
return v && ((v & (v - 1)) == 0);
}
(这个“技巧”来自这里)。使用我尝试过的前一个谓词:
/*@
ensures positive_power_of_2 (v) <==> \result == \true;
*/
但我使用的各种 SMT 求解器(alt-ergo、z3、gappa、cvc4)似乎都无法证明这一点。
解决方案
推荐阅读
- node.js - TypeError: Cannot read property '__esModule' of undefined when /* webpackPrefetch: true */ when SSR with loadable-component and serverless
- c++ - 指针作为函数的参数
- oracle - 如何更改视图的数据类型
- android - 使用 Android 通知时服务启动错误
- c++ - 二分查找可以排序吗?
- android - 单击主页后阻止打开活动
- azure - 将事件网格订阅连接到单独的事件网格主题
- ag-grid - 如何对网格/矩阵/表格的两个标题进行列过滤(excel样式)
- c++ - 在 Visual Studio 2013 上使用 daffodil 编译时出错
- pandas - 列组合令人难以置信的慢 dask