isabelle - 语言环境:使用单元实例化时 Codegen 失败(code_pred:“战术失败”)
问题描述
我正在尝试code_pred
用于在语言环境中定义的归纳谓词。我遇到了这封电子邮件,其中显示了如何做到这一点:
locale l = fixes x :: 'a assumes "x = x"
inductive (in l) is_x where "is_x x"
global_interpretation i: l "0 :: nat" defines i_is_x = "i.is_x" by unfold_locales simp
declare i.is_x.intros[code_pred_intro]
code_pred i_is_x by(rule i.is_x.cases)
但是,当我将 更改global_interpretation
为使用() :: unit
而不是 时0 :: nat
,将code_pred
失败并显示以下消息:
Tactic failed
The error(s) above occurred for the goal statement⌂:
i_is_x_i x = Predicate.bind (Predicate.single x) (λx. case x of () ⇒ Predicate.single ())
我尝试手动进行证明,但在某些时候我得到了同样的错误。
有谁知道如何解决这个问题?
解决方案
我不完全理解这里发生了什么,但是代码生成器已经在内部使用了 unit 并且策略(对应于before single intro rule
)在您的示例中失败了。
错误不是来自证明,而是来自done
零件内部完成的证明。所以改变证明并不会改变问题(你甚至会很抱歉地看到)。
一种可能的解决方法:使用与单元同构的类型:
datatype myunit = MyUnit
locale l = fixes x :: 'a assumes "x = x"
inductive (in l) is_x where "is_x x"
definition X where ‹X = ()›
global_interpretation i: l "MyUnit :: myunit" defines i_is_x = "i.is_x" by unfold_locales simp
declare i.is_x.intros[code_pred_intro]
code_pred i_is_x
by (rule i.is_x.cases)
推荐阅读
- java - 使用 windows 从无限 DataStream 中过滤重复项
- java - 从未使用私有字段“serialVersionUID”:intelliJ
- python - 基于另一个掩码张量/图像提取图像的一部分
- git - 将本地分支推送到 master
- javascript - 为什么我的 Tailwind CSS 切换按钮在深色模式下不可见?
- python - ruamel.yaml.representer.RepresenterError:无法表示对象:{'value':}
- android - Okhttp websocket 在服务器重新启动时立即重新连接
- c# - 如何在 DataTable 中搜索值列表?
- r - 如何从 R 中具有字符向量的命名列表中生成包含具有重复整数的向量的命名列表?
- flutter - 后台接收数据时如何将数据保存在Hive数据库中?