如何解决Isabelle lemma 可以用于陈述有关定义的事实吗?
我有伊莎贝尔的定义:
import pyautogui
import os
def apply_button_detector(self):
apply_button=pyautogui.locateOnScreen(os.path.join(ROOT_DIR,r'apply_button.png'),region=(1,300,500,700))
if apply_button is None:
raise AttributeError('no apply button')
# click on Apply button
apply_button_location=pyautogui.center(apply_button)
pyautogui.click(apply_button_location)
带输出
deFinition two_integer_max_case_def :: "nat ⇒ nat ⇒ nat" where
"two_integer_max_case_def a b = (case a > b of True ⇒ a | False ⇒ b)"
我可以从这个定义中获得价值:
consts
two_integer_max_case_def :: "nat ⇒ nat ⇒ nat
带输出:
value "two_integer_max_case_def 3 4"
因此,这是可识别且正确的表达/术语。但我试图使用这个定义来声明引理:
"4"
:: "nat"
不幸的是,这个引理不被接受(没有生成目标/子目标),而是给出了错误消息:
lemma spec_1:
assumes "a: nat" "b: nat" "a > b"
shows "two_integer_max_case_def a b = a"
我的引理有什么问题?我只是使用错误的相等操作(也许有一些微妙之处 - nat 实例与 nat 集的混淆)还是更普遍的问题?也许我不允许为(可能终止的)定义陈述定理/引理,我只能为已经完成终止证明的函数陈述引理(在函数声明时)?
是否可以更正(如果可以为定义声明引理)我的引理,以便它被接受并生成证明目标?
解决方法
您提出的引理没有本质上的错误,这里唯一的问题是如何声明 a
和 b
的类型。
表达式 a: nat
被解释为产生类型错误的 a ∈ nat
。您看到的错误消息指出 ∈
运算符的第二个参数 nat
的类型应该为 'a set
,但为 int => nat
。
为了在引理中声明变量的类型,您可以使用 fixes
关键字,如下所示。
lemma spec_1:
fixes a :: nat and b :: nat
assumes "a > b"
shows "two_integer_max_case_def a b = a"
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。