doc-src/TutorialI/Misc/natsum.thy
author wenzelm
Tue, 25 Jul 2000 00:01:46 +0200
changeset 9433 ac20534ce4d1
parent 8745 13b32661dde4
child 9458 c613cd06d5cf
permissions -rw-r--r--
avoid referencing thy value; rename_numerals: use implicit theory context; eliminated some simpset_of Int.thy (why needed anyway?);

(*<*)
theory natsum = Main:;
(*>*)
text{*\noindent
In particular, there are \isa{case}-expressions, for example
*}

(*<*)term(*>*) "case n of 0 \\<Rightarrow> 0 | Suc m \\<Rightarrow> m";

text{*\noindent
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).;

(*<*)
end
(*>*)