doc-src/TutorialI/Misc/natsum.thy
author wenzelm
Sat, 02 Sep 2000 22:19:03 +0200
changeset 9812 87ba969d069c
parent 9792 bbefb6ce5cb2
child 9834 109b11c4e77e
permissions -rw-r--r--
updated;

(*<*)
theory natsum = Main:;
(*>*)
text{*\noindent
In particular, there are @{text"case"}-expressions, for example
\begin{quote}
@{term[display]"case n of 0 => 0 | Suc m => m"}
\end{quote}
primitive recursion, for example
*}

consts sum :: "nat \\<Rightarrow> nat";
primrec "sum 0 = 0"
        "sum (Suc n) = Suc n + sum n";

text{*\noindent
and induction, for example
*}

lemma "sum n + sum n = n*(Suc n)";
apply(induct_tac n);
by(auto);

(*<*)
end
(*>*)