简体   繁体   English

Isabelle 在处理两个理论文件时“无法应用证明方法”

[英]Isabelle "Failed to apply proof method" when working with two theory files

I have theory file Test_Func.thy which I have copied in Isabelle src/HOL and which defines function add_123:我有理论文件 Test_Func.thy,我在 Isabelle src/HOL 中复制了它,它定义了 function add_123:

theory Test_Func
  imports Main
begin

fun add_123 :: "nat ⇒ nat ⇒ nat" where
"add_123 0 n = n" |
"add_123 (Suc m) n = Suc(add_123 m n)"

end

And then I have Test_1.thy file which have import and lemma:然后我有 Test_1.thy 文件,其中包含导入和引理:

theory Test_1
imports Main "HOL.Test_Func" 
begin
lemma add_02: "add_123 m 0 = m"
  apply(simp)
  done

end

The strange thing is that apply(simp) or apply(auto) fails with Failed to apply proof method .奇怪的是apply(simp)apply(auto)失败并显示Failed to apply proof method There is no error message about undefined function or unvisible function, but somehow such simple proof is not working when function definition and lemma about it is split into two files.没有关于未定义的 function 或不可见的 function 的错误消息,但是当 function 定义和引理分成两个文件时,这种简单的证明不起作用。

So - this question can have different problems and different solutions - maybe it is about my inexperience to import theory file or maybe I am confused about tactic choice and application.所以 - 这个问题可能有不同的问题和不同的解决方案 - 也许是因为我没有导入理论文件的经验,或者我对战术选择和应用感到困惑。

I am observing this in jEdit of Isabelle 2021, but in different setting I can see that the same thing happening in Isabelle 2020 as well.我在 Isabelle 2021 的 jEdit 中观察到这一点,但在不同的设置中,我可以看到 Isabelle 2020 也发生了同样的事情。

There is no need to put theory files into the Isabelle distribution (on the contrary, I'd better keep it intact to make sure your development can be used on other machines without touching Isabelle installation).不需要将理论文件放入 Isabelle 发行版中(相反,我最好保持原样,以确保您的开发可以在其他机器上使用而无需接触 Isabelle 安装)。

The issue with the failing proof lies in a different area: the definition of add_123 is inductive on the first argument and has no immediate rule how to handle the expression specified in lemma_02 .失败证明的问题在于不同的领域: add_123的定义对第一个参数是归纳的,并且没有直接规则如何处理lemma_02中指定的表达式。 (Eg, lemma add_01: "add_123 0 m = m" could be proved the way you used because it matches the first case specified in the definition.) (例如, lemma add_01: "add_123 0 m = m"可以证明您使用的方式,因为它匹配定义中指定的第一个案例。)

The solution is to use a proof by induction on the first argument:解决方案是对第一个参数使用归纳证明:

apply (induction m)
apply simp_all
done

or, in short by (induction m) simp_all .或者,简而言之by (induction m) simp_all

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM