doc-src/TutorialI/Misc/natsum.thy
author wenzelm
Mon, 23 Oct 2000 11:14:00 +0200
changeset 10289 475ea668c67d
parent 10171 59d6633835fa
child 10538 d1bf9ca9008d
permissions -rw-r--r--
tuned deps;

(*<*)
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);
apply(auto);
done

(*<*)
end
(*>*)