doc-src/TutorialI/Misc/prime_def.thy
author Walther Neuper <neuper@ist.tugraz.at>
Thu, 12 Aug 2010 15:03:34 +0200
branchisac-from-Isabelle2009-2
changeset 37913 20e3616b2d9c
parent 16417 9bc16273c2d4
permissions -rw-r--r--
prepare reactivation of isac-update-Isa09-2
nipkow@8745
     1
(*<*)
haftmann@16417
     2
theory prime_def imports Main begin;
paulson@11457
     3
consts prime :: "nat \<Rightarrow> bool"
nipkow@8745
     4
(*>*)
nipkow@9844
     5
text{*
nipkow@9844
     6
\begin{warn}
nipkow@9844
     7
A common mistake when writing definitions is to introduce extra free
paulson@11456
     8
variables on the right-hand side.  Consider the following, flawed definition
paulson@11456
     9
(where @{text"dvd"} means ``divides''):
nipkow@9844
    10
@{term[display,quotes]"prime(p) == 1 < p & (m dvd p --> (m=1 | m=p))"}
paulson@11457
    11
\par\noindent\hangindent=0pt
nipkow@9792
    12
Isabelle rejects this ``definition'' because of the extra @{term"m"} on the
paulson@11456
    13
right-hand side, which would introduce an inconsistency (why?). 
paulson@11456
    14
The correct version is
nipkow@9844
    15
@{term[display,quotes]"prime(p) == 1 < p & (!m. m dvd p --> (m=1 | m=p))"}
nipkow@9844
    16
\end{warn}
nipkow@8745
    17
*}
nipkow@8745
    18
(*<*)
nipkow@8745
    19
end
nipkow@8745
    20
(*>*)