doc-src/TutorialI/Misc/natsum.thy
author wenzelm
Fri, 08 Sep 2000 12:13:21 +0200
changeset 9911 864c8faf3d9a
parent 9834 109b11c4e77e
child 10171 59d6633835fa
permissions -rw-r--r--
*** empty log message ***

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