doc-src/TutorialI/Misc/Plus.thy
author Thomas Sewell <tsewell@nicta.com.au>
Mon, 28 Sep 2009 15:37:19 +1000
changeset 32757 4e97fc468a53
parent 27015 f8537d69f514
permissions -rw-r--r--
Avoid a possible variable name conflict in instantiating a theorem. Instantiating a theorem variable with new variables created a possible variable name conflict if a record was defined with a field named 'f', 'x' etc. Using variable indices of 1 avoids the problem.

(*<*)
theory Plus imports Main begin
(*>*)

text{*\noindent Define the following addition function *}

primrec add :: "nat \<Rightarrow> nat \<Rightarrow> nat" where
"add m 0 = m" |
"add m (Suc n) = add (Suc m) n"

text{*\noindent and prove*}
(*<*)
lemma [simp]: "!m. add m n = m+n"
apply(induct_tac n)
by(auto)
(*>*)
lemma "add m n = m+n"
(*<*)
by(simp)

end
(*>*)