isabelle - 在 Isabelle/ML 中编写可变模式
问题描述
我正在研究翻译方法:
apply(rewrite in "_ / ⌑" some_theorem)
进入ML,我想出了以下内容:
apply(tactic ‹
let
val pat = [
Rewrite.In,
Rewrite.Term (@{const divide(real)} $ Var (("c", 0), \<^typ>‹real›) $
Rewrite.mk_hole 1 (\<^typ>‹real›), []),
Rewrite.In
]
val to = NONE
in
CCONVERSION (Rewrite.rewrite_conv @{context} (pat, to) @{thms juanito_def}) 1
end
›)
在这里我是说“请与商中术语的任何子项进行模式匹配”。您可能会看到问题的先前编辑以查看有趣的模式。
使用图书馆的一些有趣的结论是
- at :允许选择要在其中进行模式匹配的子项
- in :允许指定一个术语的所有子术语
- 术语将与结果模式进行模式匹配。
不明白
您能否解释一下以下策略的作用?
lemma
assumes "Q (λb :: int. P (λa. a + b) (λa. a + b))"
shows "Q (λb :: int. P (λa. a + b) (λa. b + a))"
apply (tactic ‹
let
val (x, ctxt) = yield_singleton Variable.add_fixes "x" \<^context>
val pat = [
Rewrite.Concl,
Rewrite.In,
Rewrite.Term (Free ("Q", (\<^typ>‹int› --> TVar (("'b",0), [])) --> \<^typ>‹bool›)
$ Abs ("x", \<^typ>‹int›, Rewrite.mk_hole 1 (\<^typ>‹int› --> TVar (("'b",0), [])) $ Bound 0), [(x, \<^typ>‹int›)]),
Rewrite.In,
Rewrite.Term (@{const plus(int)} $ Free (x, \<^typ>‹int›) $ Var (("c", 0), \<^typ>‹int›), [])
]
val to = NONE
in CCONVERSION (Rewrite.rewrite_conv ctxt (pat, to) @{thms add.commute}) 1 end
›)
apply (fact assms)
done
第一个 Rewrite.Term 和变量的修复对我来说有点模糊。
解决方案
推荐阅读
- python - python-find 检测字符串中的路径文件
- python - .env 在 Django 中没有被检测到
- html - 在html中使用时如何在bootstrap 4中更改img-thumbnail的白色
- python - Pandas - 块之间有重叠的块 read_csv
- php - MonoLogger 9 级深度中止标准化
- java - 如何使用 firebase 导出 javafx-maven 项目
- node.js - 快速网关中请求的资源上存在返回 No Access-Control-Allow-Origin' 标头的 CORS 策略
- python - 在 Pandas 中重塑数据框的有效解决方案
- node.js - Instanbul/Nyc 只接收一些文件
- c++ - 无法编译 C++/SFML DLL。怎么修?