doc-src/AxClass/generated/NatClass.tex
author chaieb
Wed, 19 May 2004 11:23:59 +0200
changeset 14758 af3b71a46a1c
parent 11964 828ea309dc21
child 17132 153fe83804c9
permissions -rw-r--r--
A new implementation for presburger arithmetic following the one suggested in technical report Chaieb Amine and Tobias Nipkow. It is generic an smaller. the tactic has also changed and allows the abstaction over fuction occurences whose type is nat or int.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9767
dc2ee9b2e065 updated;
wenzelm
parents: 9672
diff changeset
     1
%
dc2ee9b2e065 updated;
wenzelm
parents: 9672
diff changeset
     2
\begin{isabellebody}%
9921
7acefd99e748 updated;
wenzelm
parents: 9767
diff changeset
     3
\def\isabellecontext{NatClass}%
8906
wenzelm
parents: 8903
diff changeset
     4
%
10395
7ef380745743 updated;
wenzelm
parents: 10207
diff changeset
     5
\isamarkupheader{Defining natural numbers in FOL \label{sec:ex-natclass}%
7ef380745743 updated;
wenzelm
parents: 10207
diff changeset
     6
}
11964
828ea309dc21 updated;
wenzelm
parents: 11099
diff changeset
     7
\isamarkuptrue%
828ea309dc21 updated;
wenzelm
parents: 11099
diff changeset
     8
\isacommand{theory}\ NatClass\ {\isacharequal}\ FOL{\isacharcolon}\isamarkupfalse%
828ea309dc21 updated;
wenzelm
parents: 11099
diff changeset
     9
%
8906
wenzelm
parents: 8903
diff changeset
    10
\begin{isamarkuptext}%
wenzelm
parents: 8903
diff changeset
    11
\medskip\noindent Axiomatic type classes abstract over exactly one
wenzelm
parents: 8903
diff changeset
    12
 type argument. Thus, any \emph{axiomatic} theory extension where each
wenzelm
parents: 8903
diff changeset
    13
 axiom refers to at most one type variable, may be trivially turned
wenzelm
parents: 8903
diff changeset
    14
 into a \emph{definitional} one.
wenzelm
parents: 8903
diff changeset
    15
wenzelm
parents: 8903
diff changeset
    16
 We illustrate this with the natural numbers in
wenzelm
parents: 8903
diff changeset
    17
 Isabelle/FOL.\footnote{See also
wenzelm
parents: 8903
diff changeset
    18
 \url{http://isabelle.in.tum.de/library/FOL/ex/NatClass.html}}%
wenzelm
parents: 8903
diff changeset
    19
\end{isamarkuptext}%
11964
828ea309dc21 updated;
wenzelm
parents: 11099
diff changeset
    20
\isamarkuptrue%
8890
9a44d8d98731 snapshot of new Isar'ized version;
wenzelm
parents:
diff changeset
    21
\isacommand{consts}\isanewline
10140
ba9297b71897 major cleanup -- improved typesetting;
wenzelm
parents: 9921
diff changeset
    22
\ \ zero\ {\isacharcolon}{\isacharcolon}\ {\isacharprime}a\ \ \ \ {\isacharparenleft}{\isachardoublequote}{\isasymzero}{\isachardoublequote}{\isacharparenright}\isanewline
9672
2c208c98f541 updated;
wenzelm
parents: 9665
diff changeset
    23
\ \ Suc\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}{\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a{\isachardoublequote}\isanewline
2c208c98f541 updated;
wenzelm
parents: 9665
diff changeset
    24
\ \ rec\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}{\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a\ {\isasymRightarrow}\ {\isacharparenleft}{\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a{\isacharparenright}\ {\isasymRightarrow}\ {\isacharprime}a{\isachardoublequote}\isanewline
8890
9a44d8d98731 snapshot of new Isar'ized version;
wenzelm
parents:
diff changeset
    25
\isanewline
11964
828ea309dc21 updated;
wenzelm
parents: 11099
diff changeset
    26
\isamarkupfalse%
11099
b301d1f72552 \<subseteq>;
wenzelm
parents: 10395
diff changeset
    27
\isacommand{axclass}\ nat\ {\isasymsubseteq}\ {\isachardoublequote}term{\isachardoublequote}\isanewline
10140
ba9297b71897 major cleanup -- improved typesetting;
wenzelm
parents: 9921
diff changeset
    28
\ \ induct{\isacharcolon}\ {\isachardoublequote}P{\isacharparenleft}{\isasymzero}{\isacharparenright}\ {\isasymLongrightarrow}\ {\isacharparenleft}{\isasymAnd}x{\isachardot}\ P{\isacharparenleft}x{\isacharparenright}\ {\isasymLongrightarrow}\ P{\isacharparenleft}Suc{\isacharparenleft}x{\isacharparenright}{\isacharparenright}{\isacharparenright}\ {\isasymLongrightarrow}\ P{\isacharparenleft}n{\isacharparenright}{\isachardoublequote}\isanewline
9672
2c208c98f541 updated;
wenzelm
parents: 9665
diff changeset
    29
\ \ Suc{\isacharunderscore}inject{\isacharcolon}\ {\isachardoublequote}Suc{\isacharparenleft}m{\isacharparenright}\ {\isacharequal}\ Suc{\isacharparenleft}n{\isacharparenright}\ {\isasymLongrightarrow}\ m\ {\isacharequal}\ n{\isachardoublequote}\isanewline
10207
c7c64cd26fc9 updated;
wenzelm
parents: 10140
diff changeset
    30
\ \ Suc{\isacharunderscore}neq{\isacharunderscore}{\isadigit{0}}{\isacharcolon}\ {\isachardoublequote}Suc{\isacharparenleft}m{\isacharparenright}\ {\isacharequal}\ {\isasymzero}\ {\isasymLongrightarrow}\ R{\isachardoublequote}\isanewline
c7c64cd26fc9 updated;
wenzelm
parents: 10140
diff changeset
    31
\ \ rec{\isacharunderscore}{\isadigit{0}}{\isacharcolon}\ {\isachardoublequote}rec{\isacharparenleft}{\isasymzero}{\isacharcomma}\ a{\isacharcomma}\ f{\isacharparenright}\ {\isacharequal}\ a{\isachardoublequote}\isanewline
10140
ba9297b71897 major cleanup -- improved typesetting;
wenzelm
parents: 9921
diff changeset
    32
\ \ rec{\isacharunderscore}Suc{\isacharcolon}\ {\isachardoublequote}rec{\isacharparenleft}Suc{\isacharparenleft}m{\isacharparenright}{\isacharcomma}\ a{\isacharcomma}\ f{\isacharparenright}\ {\isacharequal}\ f{\isacharparenleft}m{\isacharcomma}\ rec{\isacharparenleft}m{\isacharcomma}\ a{\isacharcomma}\ f{\isacharparenright}{\isacharparenright}{\isachardoublequote}\isanewline
8890
9a44d8d98731 snapshot of new Isar'ized version;
wenzelm
parents:
diff changeset
    33
\isanewline
11964
828ea309dc21 updated;
wenzelm
parents: 11099
diff changeset
    34
\isamarkupfalse%
8890
9a44d8d98731 snapshot of new Isar'ized version;
wenzelm
parents:
diff changeset
    35
\isacommand{constdefs}\isanewline
10207
c7c64cd26fc9 updated;
wenzelm
parents: 10140
diff changeset
    36
\ \ add\ {\isacharcolon}{\isacharcolon}\ {\isachardoublequote}{\isacharprime}a{\isacharcolon}{\isacharcolon}nat\ {\isasymRightarrow}\ {\isacharprime}a\ {\isasymRightarrow}\ {\isacharprime}a{\isachardoublequote}\ \ \ \ {\isacharparenleft}\isakeyword{infixl}\ {\isachardoublequote}{\isacharplus}{\isachardoublequote}\ {\isadigit{6}}{\isadigit{0}}{\isacharparenright}\isanewline
11964
828ea309dc21 updated;
wenzelm
parents: 11099
diff changeset
    37
\ \ {\isachardoublequote}m\ {\isacharplus}\ n\ {\isasymequiv}\ rec{\isacharparenleft}m{\isacharcomma}\ n{\isacharcomma}\ {\isasymlambda}x\ y{\isachardot}\ Suc{\isacharparenleft}y{\isacharparenright}{\isacharparenright}{\isachardoublequote}\isamarkupfalse%
828ea309dc21 updated;
wenzelm
parents: 11099
diff changeset
    38
%
8906
wenzelm
parents: 8903
diff changeset
    39
\begin{isamarkuptext}%
10140
ba9297b71897 major cleanup -- improved typesetting;
wenzelm
parents: 9921
diff changeset
    40
This is an abstract version of the plain \isa{Nat} theory in
8906
wenzelm
parents: 8903
diff changeset
    41
 FOL.\footnote{See
8907
wenzelm
parents: 8906
diff changeset
    42
 \url{http://isabelle.in.tum.de/library/FOL/ex/Nat.html}} Basically,
10140
ba9297b71897 major cleanup -- improved typesetting;
wenzelm
parents: 9921
diff changeset
    43
 we have just replaced all occurrences of type \isa{nat} by \isa{{\isacharprime}a} and used the natural number axioms to define class \isa{nat}.
ba9297b71897 major cleanup -- improved typesetting;
wenzelm
parents: 9921
diff changeset
    44
 There is only a minor snag, that the original recursion operator
ba9297b71897 major cleanup -- improved typesetting;
wenzelm
parents: 9921
diff changeset
    45
 \isa{rec} had to be made monomorphic.
8906
wenzelm
parents: 8903
diff changeset
    46
10140
ba9297b71897 major cleanup -- improved typesetting;
wenzelm
parents: 9921
diff changeset
    47
 Thus class \isa{nat} contains exactly those types \isa{{\isasymtau}} that
ba9297b71897 major cleanup -- improved typesetting;
wenzelm
parents: 9921
diff changeset
    48
 are isomorphic to ``the'' natural numbers (with signature \isa{{\isasymzero}}, \isa{Suc}, \isa{rec}).
8906
wenzelm
parents: 8903
diff changeset
    49
wenzelm
parents: 8903
diff changeset
    50
 \medskip What we have done here can be also viewed as \emph{type
wenzelm
parents: 8903
diff changeset
    51
 specification}.  Of course, it still remains open if there is some
wenzelm
parents: 8903
diff changeset
    52
 type at all that meets the class axioms.  Now a very nice property of
8907
wenzelm
parents: 8906
diff changeset
    53
 axiomatic type classes is that abstract reasoning is always possible
8906
wenzelm
parents: 8903
diff changeset
    54
 --- independent of satisfiability.  The meta-logic won't break, even
8907
wenzelm
parents: 8906
diff changeset
    55
 if some classes (or general sorts) turns out to be empty later ---
wenzelm
parents: 8906
diff changeset
    56
 ``inconsistent'' class definitions may be useless, but do not cause
wenzelm
parents: 8906
diff changeset
    57
 any harm.
8906
wenzelm
parents: 8903
diff changeset
    58
wenzelm
parents: 8903
diff changeset
    59
 Theorems of the abstract natural numbers may be derived in the same
wenzelm
parents: 8903
diff changeset
    60
 way as for the concrete version.  The original proof scripts may be
8907
wenzelm
parents: 8906
diff changeset
    61
 re-used with some trivial changes only (mostly adding some type
8906
wenzelm
parents: 8903
diff changeset
    62
 constraints).%
wenzelm
parents: 8903
diff changeset
    63
\end{isamarkuptext}%
11964
828ea309dc21 updated;
wenzelm
parents: 11099
diff changeset
    64
\isamarkuptrue%
828ea309dc21 updated;
wenzelm
parents: 11099
diff changeset
    65
\isacommand{end}\isamarkupfalse%
828ea309dc21 updated;
wenzelm
parents: 11099
diff changeset
    66
\end{isabellebody}%
9145
9f7b8de5bfaf updated;
wenzelm
parents: 8907
diff changeset
    67
%%% Local Variables:
9f7b8de5bfaf updated;
wenzelm
parents: 8907
diff changeset
    68
%%% mode: latex
9f7b8de5bfaf updated;
wenzelm
parents: 8907
diff changeset
    69
%%% TeX-master: "root"
9f7b8de5bfaf updated;
wenzelm
parents: 8907
diff changeset
    70
%%% End: