doc-src/LaTeXsugar/Sugar/document/Sugar.tex
changeset 17125 e6a82d1a1829
parent 16396 d9d2a0cadd5e
child 17134 ae56354155e4
equal deleted inserted replaced
17124:19ea4a0f4ec9 17125:e6a82d1a1829
     1 %
     1 %
     2 \begin{isabellebody}%
     2 \begin{isabellebody}%
     3 \def\isabellecontext{Sugar}%
     3 \def\isabellecontext{Sugar}%
     4 \isamarkupfalse%
     4 %
       
     5 \isadelimtheory
       
     6 %
       
     7 \endisadelimtheory
       
     8 %
       
     9 \isatagtheory
       
    10 %
       
    11 \endisatagtheory
       
    12 {\isafoldtheory}%
       
    13 %
       
    14 \isadelimtheory
       
    15 %
       
    16 \endisadelimtheory
       
    17 \isamarkuptrue%
     5 %
    18 %
     6 \isamarkupsection{Introduction%
    19 \isamarkupsection{Introduction%
     7 }
    20 }
     8 \isamarkuptrue%
    21 \isamarkuptrue%
     9 %
    22 %
   148 marks; variables that end in digits, e.g. \isa{x{\isadigit{1}}}, are still
   161 marks; variables that end in digits, e.g. \isa{x{\isadigit{1}}}, are still
   149 printed with a trailing \isa{{\isachardot}{\isadigit{0}}}, e.g. \isa{x{\isadigit{1}}{\isachardot}{\isadigit{0}}}, their
   162 printed with a trailing \isa{{\isachardot}{\isadigit{0}}}, e.g. \isa{x{\isadigit{1}}{\isachardot}{\isadigit{0}}}, their
   150 internal index. This can be avoided by turning the last digit into a
   163 internal index. This can be avoided by turning the last digit into a
   151 subscript: write \verb!x\<^isub>1! and obtain the much nicer \isa{x\isactrlisub {\isadigit{1}}}.%
   164 subscript: write \verb!x\<^isub>1! and obtain the much nicer \isa{x\isactrlisub {\isadigit{1}}}.%
   152 \end{isamarkuptext}%
   165 \end{isamarkuptext}%
   153 \isamarkuptrue%
   166 %
   154 \isamarkupfalse%
   167 \isadelimML
       
   168 %
       
   169 \endisadelimML
       
   170 %
       
   171 \isatagML
       
   172 %
       
   173 \endisatagML
       
   174 {\isafoldML}%
       
   175 %
       
   176 \isadelimML
       
   177 %
       
   178 \endisadelimML
       
   179 \isamarkuptrue%
   155 %
   180 %
   156 \isamarkupsubsection{Variable names%
   181 \isamarkupsubsection{Variable names%
   157 }
   182 }
   158 \isamarkuptrue%
   183 \isamarkuptrue%
   159 %
   184 %
   327 
   352 
   328   It is usually easiest to put them in figures like the one in Fig.\
   353   It is usually easiest to put them in figures like the one in Fig.\
   329   \ref{fig:proof}. This was achieved with the \isakeyword{text\_raw}
   354   \ref{fig:proof}. This was achieved with the \isakeyword{text\_raw}
   330   command:%
   355   command:%
   331 \end{isamarkuptext}%
   356 \end{isamarkuptext}%
   332 \isamarkuptrue%
       
   333 %
   357 %
   334 \begin{figure}
   358 \begin{figure}
   335   \begin{center}\begin{minipage}{0.6\textwidth}  
   359   \begin{center}\begin{minipage}{0.6\textwidth}  
   336   \isastyle\isamarkuptrue
   360   \isastyle\isamarkuptrue
       
   361 \isamarkupfalse%
   337 \isacommand{lemma}\ True\isanewline
   362 \isacommand{lemma}\ True\isanewline
       
   363 %
       
   364 \isadelimproof
       
   365 %
       
   366 \endisadelimproof
       
   367 %
       
   368 \isatagproof
   338 \isamarkupfalse%
   369 \isamarkupfalse%
   339 \isacommand{proof}\ {\isacharminus}\isanewline
   370 \isacommand{proof}\ {\isacharminus}\isanewline
   340 \ \ %
   371 \ \ %
   341 \isamarkupcmt{pretty trivial%
   372 \isamarkupcmt{pretty trivial%
   342 }
   373 }
   343 \isanewline
   374 \isanewline
   344 \ \ \isamarkupfalse%
   375 \ \ \isamarkupfalse%
   345 \isacommand{show}\ True\ \isamarkupfalse%
   376 \isacommand{show}\ True\ \isamarkupfalse%
   346 \isacommand{by}\ force\isanewline
   377 \isacommand{by}\ force\isanewline
   347 \isamarkupfalse%
   378 \isamarkupfalse%
   348 \isacommand{qed}\isamarkupfalse%
   379 \isacommand{qed}%
       
   380 \endisatagproof
       
   381 {\isafoldproof}%
       
   382 %
       
   383 \isadelimproof
       
   384 %
       
   385 \endisadelimproof
   349 %
   386 %
   350 \end{minipage}\end{center}
   387 \end{minipage}\end{center}
   351   \caption{Example proof in a figure.}\label{fig:proof}
   388   \caption{Example proof in a figure.}\label{fig:proof}
   352   \end{figure}
   389   \end{figure}
       
   390 \isamarkuptrue%
   353 %
   391 %
   354 \begin{isamarkuptext}%
   392 \begin{isamarkuptext}%
   355 \begin{quote}
   393 \begin{quote}
   356 \small
   394 \small
   357 \verb!text_raw {!\verb!*!\\
   395 \verb!text_raw {!\verb!*!\\
   418   (e.~g.~\isa{{\isacharequal}}, \isa{{\isasymequiv}}, \isa{{\isacharless}}).
   456   (e.~g.~\isa{{\isacharequal}}, \isa{{\isasymequiv}}, \isa{{\isacharless}}).
   419 
   457 
   420   Likewise, \verb!concl! may be used as a style to show just the
   458   Likewise, \verb!concl! may be used as a style to show just the
   421   conclusion of a proposition. For example, take \verb!hd_Cons_tl!:
   459   conclusion of a proposition. For example, take \verb!hd_Cons_tl!:
   422   \begin{center}
   460   \begin{center}
   423     \isa{xs\ {\isasymnoteq}\ {\isacharbrackleft}{\isacharbrackright}\ {\isasymLongrightarrow}\ hd\ xs{\isasymcdot}tl\ xs\ {\isacharequal}\ xs}
   461     \isa{{\isacharparenleft}xs{\isasymColon}{\isacharprime}a\ list{\isacharparenright}\ {\isasymnoteq}\ {\isacharbrackleft}{\isacharbrackright}\ {\isasymLongrightarrow}\ hd\ xs{\isasymcdot}tl\ xs\ {\isacharequal}\ xs}
   424   \end{center}
   462   \end{center}
   425   To print just the conclusion,
   463   To print just the conclusion,
   426   \begin{center}
   464   \begin{center}
   427     \isa{hd\ xs{\isasymcdot}tl\ xs\ {\isacharequal}\ xs}
   465     \isa{hd\ {\isacharparenleft}xs{\isasymColon}{\isacharprime}a\ list{\isacharparenright}{\isasymcdot}tl\ xs\ {\isacharequal}\ xs}
   428   \end{center}
   466   \end{center}
   429   type
   467   type
   430   \begin{quote}
   468   \begin{quote}
   431     \verb!\begin{center}!\\
   469     \verb!\begin{center}!\\
   432     \verb!@!\verb!{thm_style concl hd_Cons_tl}!\\
   470     \verb!@!\verb!{thm_style [show_types] concl hd_Cons_tl}!\\
   433     \verb!\end{center}!
   471     \verb!\end{center}!
   434   \end{quote}
   472   \end{quote}
       
   473 
       
   474   Be aware that any options must be placed \emph{before}
       
   475   the name of the style, as in this example.
   435 
   476 
   436   Further use cases can be found in \S\ref{sec:yourself}.
   477   Further use cases can be found in \S\ref{sec:yourself}.
   437 
   478 
   438   If you are not afraid of ML, you may also define your own styles.
   479   If you are not afraid of ML, you may also define your own styles.
   439   A style is implemented by an ML function of type
   480   A style is implemented by an ML function of type
   440   \verb!Proof.context -> term -> term!.
   481   \verb!Proof.context -> term -> term!.
   441   Have a look at the following example:%
   482   Have a look at the following example:%
   442 \end{isamarkuptext}%
   483 \end{isamarkuptext}%
   443 \isamarkuptrue%
   484 %
   444 \isamarkupfalse%
   485 \isadelimML
       
   486 %
       
   487 \endisadelimML
       
   488 %
       
   489 \isatagML
       
   490 %
       
   491 \endisatagML
       
   492 {\isafoldML}%
       
   493 %
       
   494 \isadelimML
       
   495 %
       
   496 \endisadelimML
       
   497 \isamarkuptrue%
   445 %
   498 %
   446 \begin{isamarkuptext}%
   499 \begin{isamarkuptext}%
   447 \begin{quote}
   500 \begin{quote}
   448     \verb!setup {!\verb!*!\\
   501     \verb!setup {!\verb!*!\\
   449     \verb!let!\\
   502     \verb!let!\\
   462   ML global namespace. Each style receives the current proof context
   515   ML global namespace. Each style receives the current proof context
   463   as first argument; this is helpful in situations where the
   516   as first argument; this is helpful in situations where the
   464   style has some object-logic specific behaviour for example.
   517   style has some object-logic specific behaviour for example.
   465 
   518 
   466   The mapping from identifier name to the style function
   519   The mapping from identifier name to the style function
   467   is done by the \isa{TermStyle{\isachardot}add{\isacharunderscore}style} expression which expects the desired
   520   is done by the \verb|TermStyle.add_style| expression which expects the desired
   468   style name and the style function as arguments.
   521   style name and the style function as arguments.
   469   
   522   
   470   After this \verb!setup!,
   523   After this \verb!setup!,
   471   there will be a new style available named \verb!my_concl!, thus allowing
   524   there will be a new style available named \verb!my_concl!, thus allowing
   472   antiquoations like \verb!@!\verb!{thm_style my_concl hd_Cons_tl}!
   525   antiquoations like \verb!@!\verb!{thm_style my_concl hd_Cons_tl}!
   473   yielding \isa{hd\ xs{\isasymcdot}tl\ xs\ {\isacharequal}\ xs}.%
   526   yielding \isa{hd\ xs{\isasymcdot}tl\ xs\ {\isacharequal}\ xs}.%
   474 \end{isamarkuptext}%
   527 \end{isamarkuptext}%
   475 \isamarkuptrue%
   528 %
   476 \isamarkupfalse%
   529 \isadelimtheory
       
   530 %
       
   531 \endisadelimtheory
       
   532 %
       
   533 \isatagtheory
       
   534 %
       
   535 \endisatagtheory
       
   536 {\isafoldtheory}%
       
   537 %
       
   538 \isadelimtheory
       
   539 %
       
   540 \endisadelimtheory
   477 \end{isabellebody}%
   541 \end{isabellebody}%
   478 %%% Local Variables:
   542 %%% Local Variables:
   479 %%% mode: latex
   543 %%% mode: latex
   480 %%% TeX-master: "root"
   544 %%% TeX-master: "root"
   481 %%% End:
   545 %%% End: