doc-src/TutorialI/tutorial.sty
author paulson
Tue, 17 Jul 2001 13:46:21 +0200
changeset 11428 332347b9b942
parent 11422 a3487304489a
child 11456 7eb63f63e6c6
permissions -rw-r--r--
tidying the index
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11403
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
     1
% tutorial.sty : Isabelle Tutorial Page Layout
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
     2
%
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
     3
\typeout{Document Style tutorial. Released 9 July 2001}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
     4
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
     5
\hyphenation{Isa-belle man-u-script man-u-scripts ap-pen-dix mut-u-al-ly}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
     6
\hyphenation{data-type data-types co-data-type co-data-types }
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
     7
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
     8
%usage: \iflabelundefined{LABEL}{if not defined}{if defined}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
     9
\newcommand{\iflabelundefined}[1]{\@ifundefined{r@#1}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    10
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    11
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    12
%%%INDEXING  use isa-index to process the index
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    13
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    14
\newcommand\seealso[2]{\emph{see also} #1}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    15
\usepackage{makeidx}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    16
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    17
%index, putting page numbers of definitions in boldface
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    18
\def\bold#1{\textbf{#1}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    19
\newcommand\fnote[1]{#1n}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    20
\newcommand\indexbold[1]{\index{#1|bold}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    21
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    22
% The alternative to \protect\isa in the indexing macros is
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    23
% \noexpand\noexpand \noexpand\isa
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    24
% need TWO levels of \noexpand to delay the expansion of \isa:
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    25
%  the \noexpand\noexpand will leave one \noexpand, to be given to the
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    26
%  (still unexpanded) \isa token.  See TeX by Topic, page 122.
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    27
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    28
%%%% for indexing constants, symbols, theorems, ...
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    29
\newcommand\cdx[1]{\isa{#1}\index{#1@\protect\isa{#1} (constant)}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    30
\newcommand\sdx[1]{\isa{#1}\index{#1@\protect\isa{#1} (symbol)}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    31
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    32
\newcommand\tdx[1]{\isa{#1}\index{#1@\protect\isa{#1} (theorem)}}
11422
a3487304489a fixed bad error in tdxbold; also removed default indexing in \\rulename
paulson
parents: 11403
diff changeset
    33
\newcommand\tdxbold[1]{\isa{#1}\index{#1@\protect\isa{#1} (theorem)|bold}}
11403
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    34
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    35
\newcommand\cldx[1]{\isa{#1}\index{#1@\protect\isa{#1} (class)}}
11428
332347b9b942 tidying the index
paulson
parents: 11422
diff changeset
    36
\newcommand\tydx[1]{\textit{#1}\index{#1@\protect\isa{#1} (type)}}
11403
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    37
\newcommand\thydx[1]{\isa{#1}\index{#1@\protect\isa{#1} (theory)}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    38
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    39
\newcommand\attrdx[1]{\isa{#1}\index{#1@\protect\isa{#1} (attribute)}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    40
\newcommand\commdx[1]{\isacommand{#1}\index{#1@\protect\isacommand{#1}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    41
(command)}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    42
\newcommand\methdx[1]{\isa{#1}\index{#1@\protect\isa{#1} (method)}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    43
\newcommand\tooldx[1]{\isa{#1}\index{#1@\protect\isa{#1} (tool)}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    44
\newcommand\settdx[1]{\isa{#1}\index{#1@\protect\isa{#1} (setting)}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    45
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    46
%set argument in \bf font and index in ROMAN font (for definitions in text!)
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    47
\newcommand\bfindex[1]{{\bf#1}\index{#1|bold}\@}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    48
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    49
\newcommand\rmindex[1]{{#1}\index{#1}\@}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    50
\newcommand\ttindex[1]{\texttt{#1}\index{#1@\texttt{#1}}\@}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    51
\newcommand\ttindexbold[1]{\texttt{#1}\index{#1@\texttt{#1}|bold}\@}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    52
11422
a3487304489a fixed bad error in tdxbold; also removed default indexing in \\rulename
paulson
parents: 11403
diff changeset
    53
\newcommand{\indexboldpos}[2]{#1\index{#2@#1|bold}\@}
a3487304489a fixed bad error in tdxbold; also removed default indexing in \\rulename
paulson
parents: 11403
diff changeset
    54
\newcommand{\ttindexboldpos}[2]{\texttt{#1}\index{#2@\texttt{#1}|bold}\@}
11403
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    55
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    56
%\newtheorem{theorem}{Theorem}[section]
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    57
\newtheorem{Exercise}{Exercise}[section]
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    58
\newenvironment{exercise}{\begin{Exercise}\rm}{\end{Exercise}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    59
\newcommand{\ttlbr}{\texttt{[|}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    60
\newcommand{\ttrbr}{\texttt{|]}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    61
\newcommand{\ttor}{\texttt{|}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    62
\newcommand{\ttall}{\texttt{!}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    63
\newcommand{\ttuniquex}{\texttt{?!}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    64
\newcommand{\ttEXU}{\texttt{EX!}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    65
\newcommand{\ttAnd}{\texttt{!!}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    66
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    67
\newcommand{\isasymimp}{\isasymlongrightarrow}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    68
\newcommand{\isasymImp}{\isasymLongrightarrow}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    69
\newcommand{\isasymFun}{\isasymRightarrow}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    70
\newcommand{\isasymuniqex}{\isamath{\exists!\,}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    71
\renewcommand{\S}{Sect.\ts}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    72
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    73
\renewenvironment{isamarkuptxt}{\begin{isamarkuptext}}{\end{isamarkuptext}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    74
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    75
\newif\ifremarks
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    76
\newcommand{\REMARK}[1]{\ifremarks\marginpar{\raggedright\footnotesize#1}\fi}
11422
a3487304489a fixed bad error in tdxbold; also removed default indexing in \\rulename
paulson
parents: 11403
diff changeset
    77
11403
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    78
%names of Isabelle rules
11422
a3487304489a fixed bad error in tdxbold; also removed default indexing in \\rulename
paulson
parents: 11403
diff changeset
    79
\newcommand{\rulename}[1]{\hfill(#1)}
a3487304489a fixed bad error in tdxbold; also removed default indexing in \\rulename
paulson
parents: 11403
diff changeset
    80
\newcommand{\rulenamedx}[1]{\hfill(#1\index{#1@\protect\isa{#1} (theorem)|bold})}
11403
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    81
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    82
%%%% meta-logical connectives
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    83
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    84
\let\Forall=\bigwedge
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    85
\let\Imp=\Longrightarrow
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    86
\let\To=\Rightarrow
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    87
\newcommand{\Var}[1]{{?\!#1}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    88
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    89
%%% underscores as ordinary characters, not for subscripting
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    90
%%  use @ or \sb for subscripting; use \at for @
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    91
%%  only works in \tt font
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    92
%%  must not make _ an active char; would make \ttindex fail!
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    93
\gdef\underscoreoff{\catcode`\@=8\catcode`\_=\other}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    94
\gdef\underscoreon{\catcode`\_=8\makeatother}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    95
\chardef\other=12
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    96
\chardef\at=`\@
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    97
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    98
% alternative underscore
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
    99
\def\_{\leavevmode\kern.06em\vbox{\hrule height.2ex width.3em}\hskip0.1em}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   100
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   101
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   102
%%%% ``WARNING'' environment
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   103
\def\dbend{\vtop to 0pt{\vss\hbox{\Huge\bf!}\vss}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   104
\newenvironment{warn}{\medskip\medbreak\begingroup \clubpenalty=10000 
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   105
         \small %%WAS\baselineskip=0.9\baselineskip
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   106
         \noindent \hangindent\parindent \hangafter=-2 
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   107
         \hbox to0pt{\hskip-\hangindent\dbend\hfill}\ignorespaces}%
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   108
        {\par\endgroup\medbreak}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   109
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   110
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   111
%%%% Standard logical symbols
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   112
\let\turn=\vdash
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   113
\let\conj=\wedge
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   114
\let\disj=\vee
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   115
\let\imp=\rightarrow
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   116
\let\bimp=\leftrightarrow
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   117
\newcommand\all[1]{\forall#1.}  %quantification
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   118
\newcommand\ex[1]{\exists#1.}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   119
\newcommand{\pair}[1]{\langle#1\rangle}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   120
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   121
\newcommand{\lparr}{\mathopen{(\!|}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   122
\newcommand{\rparr}{\mathclose{|\!)}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   123
\newcommand{\fs}{\mathpunct{,\,}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   124
\newcommand{\ty}{\mathrel{::}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   125
\newcommand{\asn}{\mathrel{:=}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   126
\newcommand{\more}{\ldots}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   127
\newcommand{\record}[1]{\lparr #1 \rparr}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   128
\newcommand{\dtt}{\mathord.}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   129
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   130
\newcommand\lbrakk{\mathopen{[\![}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   131
\newcommand\rbrakk{\mathclose{]\!]}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   132
\newcommand\List[1]{\lbrakk#1\rbrakk}  %was \obj
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   133
\newcommand\vpile[1]{\begin{array}{c}#1\end{array}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   134
\newenvironment{matharray}[1]{\[\begin{array}{#1}}{\end{array}\]}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   135
\newcommand{\Text}[1]{\mbox{#1}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   136
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   137
\DeclareMathSymbol{\dshsym}{\mathalpha}{letters}{"2D}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   138
\newcommand{\dsh}{\mathit{\dshsym}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   139
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   140
\let\int=\cap
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   141
\let\un=\cup
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   142
\let\inter=\bigcap
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   143
\let\union=\bigcup
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   144
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   145
\def\ML{{\sc ml}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   146
\def\AST{{\sc ast}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   147
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   148
%macros to change the treatment of symbols
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   149
\def\relsemicolon{\mathcode`\;="303B}   %treat ; like a relation
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   150
\def\binperiod{\mathcode`\.="213A}   %treat . like a binary operator
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   151
\def\binvert{\mathcode`\|="226A}     %treat | like a binary operator
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   152
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   153
%redefinition of \sloppy and \fussy to use \emergencystretch
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   154
\def\sloppy{\tolerance2000 \hfuzz.5pt \vfuzz.5pt \emergencystretch=15pt}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   155
\def\fussy{\tolerance200 \hfuzz.1pt \vfuzz.1pt \emergencystretch=0pt}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   156
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   157
%non-bf version of description
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   158
\def\descrlabel#1{\hspace\labelsep #1}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   159
\def\descr{\list{}{\labelwidth\z@ \itemindent-\leftmargin\let\makelabel\descrlabel}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   160
\let\enddescr\endlist
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   161
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   162
% The mathcodes for the letters A, ..., Z, a, ..., z are changed to
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   163
% generate text italic rather than math italic by default. This makes
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   164
% multi-letter identifiers look better. The mathcode for character c
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   165
% is set to |"7000| (variable family) + |"400| (text italic) + |c|.
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   166
%
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   167
\DeclareSymbolFont{italics}{\encodingdefault}{\rmdefault}{m}{it}%
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   168
\def\@setmcodes#1#2#3{{\count0=#1 \count1=#3
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   169
        \loop \global\mathcode\count0=\count1 \ifnum \count0<#2
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   170
        \advance\count0 by1 \advance\count1 by1 \repeat}}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   171
\@setmcodes{`A}{`Z}{"7\hexnumber@\symitalics41}
b3b95a228d37 new macro file for the tutorial
paulson
parents:
diff changeset
   172
\@setmcodes{`a}{`z}{"7\hexnumber@\symitalics61}