11208
|
1 |
%
|
|
2 |
\begin{isabellebody}%
|
|
3 |
\def\isabellecontext{Translations}%
|
11866
|
4 |
\isamarkupfalse%
|
11208
|
5 |
%
|
|
6 |
\isamarkupsubsection{Syntax Translations%
|
|
7 |
}
|
11866
|
8 |
\isamarkuptrue%
|
11208
|
9 |
%
|
|
10 |
\begin{isamarkuptext}%
|
|
11 |
\label{sec:def-translations}
|
11456
|
12 |
\index{syntax translations|(}%
|
|
13 |
\index{translations@\isacommand {translations} (command)|(}
|
|
14 |
Isabelle offers an additional definitional facility,
|
11428
|
15 |
\textbf{syntax translations}.
|
11211
|
16 |
They resemble macros: upon parsing, the defined concept is immediately
|
11456
|
17 |
replaced by its definition. This effect is reversed upon printing. For example,
|
11208
|
18 |
the symbol \isa{{\isasymnoteq}} is defined via a syntax translation:%
|
|
19 |
\end{isamarkuptext}%
|
11866
|
20 |
\isamarkuptrue%
|
|
21 |
\isacommand{translations}\ {\isachardoublequote}x\ {\isasymnoteq}\ y{\isachardoublequote}\ {\isasymrightleftharpoons}\ {\isachardoublequote}{\isasymnot}{\isacharparenleft}x\ {\isacharequal}\ y{\isacharparenright}{\isachardoublequote}\isamarkupfalse%
|
|
22 |
%
|
11208
|
23 |
\begin{isamarkuptext}%
|
11456
|
24 |
\index{$IsaEqTrans@\isasymrightleftharpoons}
|
11208
|
25 |
\noindent
|
|
26 |
Internally, \isa{{\isasymnoteq}} never appears.
|
|
27 |
|
|
28 |
In addition to \isa{{\isasymrightleftharpoons}} there are
|
11456
|
29 |
\isa{{\isasymrightharpoonup}}\index{$IsaEqTrans1@\isasymrightharpoonup}
|
|
30 |
and \isa{{\isasymleftharpoondown}}\index{$IsaEqTrans2@\isasymleftharpoondown}
|
11211
|
31 |
for uni-directional translations, which only affect
|
11456
|
32 |
parsing or printing. This tutorial will not cover the details of
|
|
33 |
translations. We have mentioned the concept merely because it
|
|
34 |
crops up occasionally; a number of HOL's built-in constructs are defined
|
11211
|
35 |
via translations. Translations are preferable to definitions when the new
|
|
36 |
concept is a trivial variation on an existing one. For example, we
|
|
37 |
don't need to derive new theorems about \isa{{\isasymnoteq}}, since existing theorems
|
|
38 |
about \isa{{\isacharequal}} still apply.%
|
11456
|
39 |
\index{syntax translations|)}%
|
|
40 |
\index{translations@\isacommand {translations} (command)|)}%
|
11208
|
41 |
\end{isamarkuptext}%
|
11866
|
42 |
\isamarkuptrue%
|
|
43 |
\isamarkupfalse%
|
11208
|
44 |
\end{isabellebody}%
|
|
45 |
%%% Local Variables:
|
|
46 |
%%% mode: latex
|
|
47 |
%%% TeX-master: "root"
|
|
48 |
%%% End:
|