isabelle - Isabelle/HOL 中的灵活/模糊规则应用
问题描述
假设我有以下谓词P
和规则R
:
locale example =
fixes P :: "int ⇒ int ⇒ bool"
assumes R: "⋀a b c. a ≥ 2 ⟹ P (a*b) (a*c)"
我现在想将规则应用到来R
证明P 8 4
,但是直接规则应用当然会失败:
lemma (in example) "P 8 4"
proof (rule R) (* FAILS *)
相反,我必须在使用规则之前手动实例化等式:
lemma (in example) "P 8 4"
proof -
have "P (4*2) (4*1)"
by (rule R, simp)
thus "P 8 4"
by simp
qed
lemma (in example) "P 8 4"
using R[where a=2 and b=4 and c=2] by simp
下面的例子更好一点。它只需要具有 2 个参数的谓词的专用引理,并且需要手动指定顶级谓词名称:
lemma back_subst2: "⟦P x' y'; x' = x; y' = y⟧ ⟹ P x y"
by force
lemma (in example) "P 8 4"
proof (rule back_subst2[where P=P], rule R)
show "2 ≤ (2 :: int)" by simp
show "2*4 = (8::int)" by simp
show "2*2 = (4::int)" by simp
qed
我的问题:当参数没有完全要求的形式时,是否有更好的方法来应用规则?最后一个例子可以以某种方式改进吗?
解决方案
我现在已经编写了自己的方法fuzzy_rule
来执行此操作:
lemma (in example) "P 8 4"
proof (fuzzy_rule R)
show "2 ≤ (2 :: int)" by simp
show "2*4 = (8::int)" by simp
show "2*2 = (4::int)" by simp
qed
推荐阅读
- php - php file_get_contents('php://input') 返回 null
- pandas - 如何将 df1 和 df2 合并到 df3 中?
- amazon-web-services - 在 Amazon QuickSight 中将时间戳字段转换为日期字符串
- asp.net - 如何增加executionTimeout
- excel - 阵列不准确
- python - 不使用 numpy 计算协方差矩阵
- sql - 配置 SQL Sever 数据类型的最快方法是什么?
- python - 正则表达式问题python捕获组可以存在但并不总是存在
- python - 需要使用 JSON 信息加载或其他方法使用 Python 和 Selenium 进行循环处理
- excel - How to Pass a Worksheet variable to another sub