doc-src/TutorialI/Misc/natsum.thy
author nipkow
Fri, 01 Sep 2000 19:09:44 +0200
changeset 9792 bbefb6ce5cb2
parent 9541 d17c0b34d5c8
child 9834 109b11c4e77e
permissions -rw-r--r--
*** empty log message ***

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