简体   繁体   中英

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:

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:

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 . 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.

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.

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).

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 . (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.)

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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