theory week07B_demo imports Main begin -- ------------------------------------------------- -- "More primrec and induction:" primrec lsum :: "nat list \ nat" where "lsum [] = 0" | "lsum (x#xs) = x + lsum xs" lemma "2 * lsum [0..iii"} or @{text"\"} *} lemma assumes A: "(\n. (\m. m < n \ P m) \ P n)" shows "P (n::nat)" proof (rule A) show "\m. m < n \ P m" proof (induct n) case 0 thus ?case by simp next case (Suc n) show ?case proof cases assume eq: "m = n" from Suc and A have "P n" by blast with eq show "P m" by simp next assume "m \ n" with Suc have "m < n" by arith thus "P m" by(rule Suc) qed qed qed end