doc-src/TutorialI/Misc/prime_def.thy
author wenzelm
Fri, 15 Sep 2000 20:35:17 +0200
changeset 10001 79b23dbb4b89
parent 9844 8016321c7de1
child 11456 7eb63f63e6c6
permissions -rw-r--r--
added;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8745
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
     1
(*<*)
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
     2
theory prime_def = Main:;
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
     3
consts prime :: "nat \\<Rightarrow> bool"
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
     4
(*>*)
9844
8016321c7de1 *** empty log message ***
nipkow
parents: 9792
diff changeset
     5
text{*
8016321c7de1 *** empty log message ***
nipkow
parents: 9792
diff changeset
     6
\begin{warn}
8016321c7de1 *** empty log message ***
nipkow
parents: 9792
diff changeset
     7
A common mistake when writing definitions is to introduce extra free
8016321c7de1 *** empty log message ***
nipkow
parents: 9792
diff changeset
     8
variables on the right-hand side as in the following fictitious definition:
8016321c7de1 *** empty log message ***
nipkow
parents: 9792
diff changeset
     9
@{term[display,quotes]"prime(p) == 1 < p & (m dvd p --> (m=1 | m=p))"}
9792
bbefb6ce5cb2 *** empty log message ***
nipkow
parents: 9458
diff changeset
    10
where @{text"dvd"} means ``divides''.
bbefb6ce5cb2 *** empty log message ***
nipkow
parents: 9458
diff changeset
    11
Isabelle rejects this ``definition'' because of the extra @{term"m"} on the
9458
c613cd06d5cf apply. -> by
nipkow
parents: 8745
diff changeset
    12
right-hand side, which would introduce an inconsistency (why?). What you
8745
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    13
should have written is
9844
8016321c7de1 *** empty log message ***
nipkow
parents: 9792
diff changeset
    14
@{term[display,quotes]"prime(p) == 1 < p & (!m. m dvd p --> (m=1 | m=p))"}
8016321c7de1 *** empty log message ***
nipkow
parents: 9792
diff changeset
    15
\end{warn}
8745
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    16
*}
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    17
(*<*)
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    18
end
13b32661dde4 I wonder which files i forgot.
nipkow
parents:
diff changeset
    19
(*>*)