doc-src/TutorialI/Misc/prime_def.thy
author wenzelm
Tue, 12 Aug 2008 21:27:57 +0200
changeset 27839 0be8644c45eb
parent 16417 9bc16273c2d4
permissions -rw-r--r--
Symbol.source/OuterLex.source: more explicit do_recover argument; scan: pass position; removed obsolete prepare_command (now inlined in isar_syn.ML); renamed prepare_command_failsafe to prepare_command, reports tokens; load_thy: now based on ThyEdit operations, reports tokens and spans; tuned;

(*<*)
theory prime_def imports Main begin;
consts prime :: "nat \<Rightarrow> bool"
(*>*)
text{*
\begin{warn}
A common mistake when writing definitions is to introduce extra free
variables on the right-hand side.  Consider the following, flawed definition
(where @{text"dvd"} means ``divides''):
@{term[display,quotes]"prime(p) == 1 < p & (m dvd p --> (m=1 | m=p))"}
\par\noindent\hangindent=0pt
Isabelle rejects this ``definition'' because of the extra @{term"m"} on the
right-hand side, which would introduce an inconsistency (why?). 
The correct version is
@{term[display,quotes]"prime(p) == 1 < p & (!m. m dvd p --> (m=1 | m=p))"}
\end{warn}
*}
(*<*)
end
(*>*)