8 ({\tt FOL} or~{\tt LK}). Try working some of the examples provided, |
8 ({\tt FOL} or~{\tt LK}). Try working some of the examples provided, |
9 and others from the literature. Set theory~({\tt ZF}) and |
9 and others from the literature. Set theory~({\tt ZF}) and |
10 Constructive Type Theory~({\tt CTT}) form a richer world for |
10 Constructive Type Theory~({\tt CTT}) form a richer world for |
11 mathematical reasoning and, again, many examples are in the |
11 mathematical reasoning and, again, many examples are in the |
12 literature. Higher-order logic~({\tt HOL}) is Isabelle's most |
12 literature. Higher-order logic~({\tt HOL}) is Isabelle's most |
13 elaborate logic. Its types and functions are identified with those of |
13 elaborate logic. Its types and functions are identified with those of |
14 the meta-logic. |
14 the meta-logic. |
15 |
15 |
16 Choose a logic that you already understand. Isabelle is a proof |
16 Choose a logic that you already understand. Isabelle is a proof |
17 tool, not a teaching tool; if you do not know how to do a particular proof |
17 tool, not a teaching tool; if you do not know how to do a particular proof |
18 on paper, then you certainly will not be able to do it on the machine. |
18 on paper, then you certainly will not be able to do it on the machine. |
365 All the declaration parts can be omitted or repeated and may appear in |
365 All the declaration parts can be omitted or repeated and may appear in |
366 any order, except that the {\ML} section must be last (after the {\tt |
366 any order, except that the {\ML} section must be last (after the {\tt |
367 end} keyword). In the simplest case, $T$ is just the union of |
367 end} keyword). In the simplest case, $T$ is just the union of |
368 $S@1$,~\ldots,~$S@n$. New theories always extend one or more other |
368 $S@1$,~\ldots,~$S@n$. New theories always extend one or more other |
369 theories, inheriting their types, constants, syntax, etc. The theory |
369 theories, inheriting their types, constants, syntax, etc. The theory |
370 \thydx{Pure} contains nothing but Isabelle's meta-logic. The variant |
370 \thydx{Pure} contains nothing but Isabelle's meta-logic. The variant |
371 \thydx{CPure} offers the more usual higher-order function application |
371 \thydx{CPure} offers the more usual higher-order function application |
372 syntax $t\,u@1\ldots\,u@n$ instead of $t(u@1,\ldots,u@n)$ in \Pure. |
372 syntax $t\,u@1\ldots\,u@n$ instead of $t(u@1,\ldots,u@n)$ in \Pure. |
373 |
373 |
374 Each theory definition must reside in a separate file, whose name is |
374 Each theory definition must reside in a separate file, whose name is |
375 the theory's with {\tt.thy} appended. Calling |
375 the theory's with {\tt.thy} appended. Calling |
382 |
382 |
383 Errors may arise during the translation to {\ML} (say, a misspelled |
383 Errors may arise during the translation to {\ML} (say, a misspelled |
384 keyword) or during creation of the new theory (say, a type error in a |
384 keyword) or during creation of the new theory (say, a type error in a |
385 rule). But if all goes well, {\tt use_thy} will finally read the file |
385 rule). But if all goes well, {\tt use_thy} will finally read the file |
386 {\it T}{\tt.ML} (if it exists). This file typically contains proofs |
386 {\it T}{\tt.ML} (if it exists). This file typically contains proofs |
387 that refer to the components of~$T$. The structure is automatically |
387 that refer to the components of~$T$. The structure is automatically |
388 opened, so its components may be referred to by unqualified names, |
388 opened, so its components may be referred to by unqualified names, |
389 e.g.\ just {\tt thy} instead of $T${\tt .thy}. |
389 e.g.\ just {\tt thy} instead of $T${\tt .thy}. |
390 |
390 |
391 \ttindexbold{use_thy} automatically loads a theory's parents before |
391 \ttindexbold{use_thy} automatically loads a theory's parents before |
392 loading the theory itself. When a theory file is modified, many |
392 loading the theory itself. When a theory file is modified, many |
427 enclosed in quotation marks. |
427 enclosed in quotation marks. |
428 |
428 |
429 \indexbold{definitions} The {\bf definition part} is similar, but with |
429 \indexbold{definitions} The {\bf definition part} is similar, but with |
430 the keyword {\tt defs} instead of {\tt rules}. {\bf Definitions} are |
430 the keyword {\tt defs} instead of {\tt rules}. {\bf Definitions} are |
431 rules of the form $s \equiv t$, and should serve only as |
431 rules of the form $s \equiv t$, and should serve only as |
432 abbreviations. The simplest form of a definition is $f \equiv t$, |
432 abbreviations. The simplest form of a definition is $f \equiv t$, |
433 where $f$ is a constant. Also allowed are $\eta$-equivalent forms of |
433 where $f$ is a constant. Also allowed are $\eta$-equivalent forms of |
434 this, where the arguments of~$f$ appear applied on the left-hand side |
434 this, where the arguments of~$f$ appear applied on the left-hand side |
435 of the equation instead of abstracted on the right-hand side. |
435 of the equation instead of abstracted on the right-hand side. |
436 |
436 |
437 Isabelle checks for common errors in definitions, such as extra |
437 Isabelle checks for common errors in definitions, such as extra |
438 variables on the right-hand side, but currently does not a complete |
438 variables on the right-hand side, but currently does not a complete |
439 test of well-formedness. Thus determined users can write |
439 test of well-formedness. Thus determined users can write |
440 non-conservative `definitions' by using mutual recursion, for example; |
440 non-conservative `definitions' by using mutual recursion, for example; |
441 the consequences of such actions are their responsibility. |
441 the consequences of such actions are their responsibility. |
442 |
442 |
443 \index{examples!of theories} This example theory extends first-order |
443 \index{examples!of theories} This example theory extends first-order |
444 logic by declaring and defining two constants, {\em nand} and {\em |
444 logic by declaring and defining two constants, {\em nand} and {\em |
459 xor :: [o,o] => o |
459 xor :: [o,o] => o |
460 "xor(P,Q) == P & ~Q | ~P & Q" |
460 "xor(P,Q) == P & ~Q | ~P & Q" |
461 end |
461 end |
462 \end{ttbox} |
462 \end{ttbox} |
463 {\tt constdefs} generates the names {\tt nand_def} and {\tt xor_def} |
463 {\tt constdefs} generates the names {\tt nand_def} and {\tt xor_def} |
464 automatically, which is why it is restricted to alphanumeric identifiers. In |
464 automatically, which is why it is restricted to alphanumeric identifiers. In |
465 general it has the form |
465 general it has the form |
466 \begin{ttbox} |
466 \begin{ttbox} |
467 constdefs \(id@1\) :: \(\tau@1\) |
467 constdefs \(id@1\) :: \(\tau@1\) |
468 "\(id@1 \equiv \dots\)" |
468 "\(id@1 \equiv \dots\)" |
469 \vdots |
469 \vdots |
477 on the right-hand side as in the following fictitious definition: |
477 on the right-hand side as in the following fictitious definition: |
478 \begin{ttbox} |
478 \begin{ttbox} |
479 defs prime_def "prime(p) == (m divides p) --> (m=1 | m=p)" |
479 defs prime_def "prime(p) == (m divides p) --> (m=1 | m=p)" |
480 \end{ttbox} |
480 \end{ttbox} |
481 Isabelle rejects this ``definition'' because of the extra {\tt m} on the |
481 Isabelle rejects this ``definition'' because of the extra {\tt m} on the |
482 right-hand side, which would introduce an inconsistency. What you should have |
482 right-hand side, which would introduce an inconsistency. What you should have |
483 written is |
483 written is |
484 \begin{ttbox} |
484 \begin{ttbox} |
485 defs prime_def "prime(p) == ALL m. (m divides p) --> (m=1 | m=p)" |
485 defs prime_def "prime(p) == ALL m. (m divides p) --> (m=1 | m=p)" |
486 \end{ttbox} |
486 \end{ttbox} |
487 \end{warn} |
487 \end{warn} |
620 automatically, just as in \ML. Hence you may write propositions like |
620 automatically, just as in \ML. Hence you may write propositions like |
621 \verb|op #(True) == op ~&(True)|, which asserts that the functions $\lambda |
621 \verb|op #(True) == op ~&(True)|, which asserts that the functions $\lambda |
622 Q.True \xor Q$ and $\lambda Q.True \nand Q$ are identical. |
622 Q.True \xor Q$ and $\lambda Q.True \nand Q$ are identical. |
623 |
623 |
624 \medskip Infix syntax and constant names may be also specified |
624 \medskip Infix syntax and constant names may be also specified |
625 independently. For example, consider this version of $\nand$: |
625 independently. For example, consider this version of $\nand$: |
626 \begin{ttbox} |
626 \begin{ttbox} |
627 consts nand :: [o,o] => o (infixl "~&" 35) |
627 consts nand :: [o,o] => o (infixl "~&" 35) |
628 \end{ttbox} |
628 \end{ttbox} |
629 |
629 |
630 \bigskip\index{mixfix declarations} |
630 \bigskip\index{mixfix declarations} |