24 the art of mixing \LaTeX\ text and Isabelle theories and never want to |
24 the art of mixing \LaTeX\ text and Isabelle theories and never want to |
25 typeset a theorem by hand anymore because they have experienced the |
25 typeset a theorem by hand anymore because they have experienced the |
26 bliss of writing \verb!@!\verb!{thm[display]setsum_cartesian_product[no_vars]}! |
26 bliss of writing \verb!@!\verb!{thm[display]setsum_cartesian_product[no_vars]}! |
27 and seeing Isabelle typeset it for them: |
27 and seeing Isabelle typeset it for them: |
28 \begin{isabelle}% |
28 \begin{isabelle}% |
29 {\isacharparenleft}{\isasymSum}x{\isasymin}A{\isachardot}\ {\isasymSum}y{\isasymin}B{\isachardot}\ f\ x\ y{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}{\isasymSum}{\isacharparenleft}x{\isacharcomma}\ y{\isacharparenright}{\isasymin}A\ {\isasymtimes}\ B{\isachardot}\ f\ x\ y{\isacharparenright}% |
29 {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C53756D3E}{\isasymSum}}x{\isaliteral{5C3C696E3E}{\isasymin}}A{\isaliteral{2E}{\isachardot}}\ {\isaliteral{5C3C53756D3E}{\isasymSum}}y{\isaliteral{5C3C696E3E}{\isasymin}}B{\isaliteral{2E}{\isachardot}}\ f\ x\ y{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C53756D3E}{\isasymSum}}{\isaliteral{28}{\isacharparenleft}}x{\isaliteral{2C}{\isacharcomma}}\ y{\isaliteral{29}{\isacharparenright}}{\isaliteral{5C3C696E3E}{\isasymin}}A\ {\isaliteral{5C3C74696D65733E}{\isasymtimes}}\ B{\isaliteral{2E}{\isachardot}}\ f\ x\ y{\isaliteral{29}{\isacharparenright}}% |
30 \end{isabelle} |
30 \end{isabelle} |
31 No typos, no omissions, no sweat. |
31 No typos, no omissions, no sweat. |
32 If you have not experienced that joy, read Chapter 4, \emph{Presenting |
32 If you have not experienced that joy, read Chapter 4, \emph{Presenting |
33 Theories}, \cite{LNCS2283} first. |
33 Theories}, \cite{LNCS2283} first. |
34 |
34 |
37 you may be tempted to think that all readers of the stunning ps or pdf |
37 you may be tempted to think that all readers of the stunning ps or pdf |
38 documents you can now produce at the drop of a hat will be struck with |
38 documents you can now produce at the drop of a hat will be struck with |
39 awe at the beauty unfolding in front of their eyes. Until one day you |
39 awe at the beauty unfolding in front of their eyes. Until one day you |
40 come across that very critical of readers known as the ``common referee''. |
40 come across that very critical of readers known as the ``common referee''. |
41 He has the nasty habit of refusing to understand unfamiliar notation |
41 He has the nasty habit of refusing to understand unfamiliar notation |
42 like Isabelle's infamous \isa{{\isasymlbrakk}\ {\isasymrbrakk}\ {\isasymLongrightarrow}} no matter how many times you |
42 like Isabelle's infamous \isa{{\isaliteral{5C3C6C6272616B6B3E}{\isasymlbrakk}}\ {\isaliteral{5C3C726272616B6B3E}{\isasymrbrakk}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}} no matter how many times you |
43 explain it in your paper. Even worse, he thinks that using \isa{{\isasymlbrakk}\ {\isasymrbrakk}} for anything other than denotational semantics is a cardinal sin |
43 explain it in your paper. Even worse, he thinks that using \isa{{\isaliteral{5C3C6C6272616B6B3E}{\isasymlbrakk}}\ {\isaliteral{5C3C726272616B6B3E}{\isasymrbrakk}}} for anything other than denotational semantics is a cardinal sin |
44 that must be punished by instant rejection. |
44 that must be punished by instant rejection. |
45 |
45 |
46 |
46 |
47 This document shows you how to make Isabelle and \LaTeX\ cooperate to |
47 This document shows you how to make Isabelle and \LaTeX\ cooperate to |
48 produce ordinary looking mathematics that hides the fact that it was |
48 produce ordinary looking mathematics that hides the fact that it was |
55 |
55 |
56 \item Should you need additional \LaTeX\ packages (the text will tell |
56 \item Should you need additional \LaTeX\ packages (the text will tell |
57 you so), you include them at the beginning of your \LaTeX\ document, |
57 you so), you include them at the beginning of your \LaTeX\ document, |
58 typically in \texttt{root.tex}. For a start, you should |
58 typically in \texttt{root.tex}. For a start, you should |
59 \verb!\usepackage{amssymb}! --- otherwise typesetting |
59 \verb!\usepackage{amssymb}! --- otherwise typesetting |
60 \isa{{\isachardoublequote}{\isasymnot}{\isacharparenleft}{\isasymexists}x{\isachardot}\ P\ x{\isacharparenright}{\isachardoublequote}} will fail because the AMS symbol |
60 \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6E6F743E}{\isasymnot}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C6578697374733E}{\isasymexists}}x{\isaliteral{2E}{\isachardot}}\ P\ x{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} will fail because the AMS symbol |
61 \isa{{\isasymnexists}} is missing. |
61 \isa{{\isaliteral{5C3C6E6578697374733E}{\isasymnexists}}} is missing. |
62 \end{itemize}% |
62 \end{itemize}% |
63 \end{isamarkuptext}% |
63 \end{isamarkuptext}% |
64 \isamarkuptrue% |
64 \isamarkuptrue% |
65 % |
65 % |
66 \isamarkupsection{HOL syntax% |
66 \isamarkupsection{HOL syntax% |
70 \isamarkupsubsection{Logic% |
70 \isamarkupsubsection{Logic% |
71 } |
71 } |
72 \isamarkuptrue% |
72 \isamarkuptrue% |
73 % |
73 % |
74 \begin{isamarkuptext}% |
74 \begin{isamarkuptext}% |
75 The formula \isa{{\isachardoublequote}{\isasymnot}{\isacharparenleft}{\isasymexists}x{\isachardot}\ P\ x{\isacharparenright}{\isachardoublequote}} is typeset as \isa{{\isasymnexists}x{\isachardot}\ P\ x}. |
75 The formula \isa{{\isaliteral{22}{\isachardoublequote}}{\isaliteral{5C3C6E6F743E}{\isasymnot}}{\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C6578697374733E}{\isasymexists}}x{\isaliteral{2E}{\isachardot}}\ P\ x{\isaliteral{29}{\isacharparenright}}{\isaliteral{22}{\isachardoublequote}}} is typeset as \isa{{\isaliteral{5C3C6E6578697374733E}{\isasymnexists}}x{\isaliteral{2E}{\isachardot}}\ P\ x}. |
76 |
76 |
77 The predefined constructs \isa{if}, \isa{let} and |
77 The predefined constructs \isa{if}, \isa{let} and |
78 \isa{case} are set in sans serif font to distinguish them from |
78 \isa{case} are set in sans serif font to distinguish them from |
79 other functions. This improves readability: |
79 other functions. This improves readability: |
80 \begin{itemize} |
80 \begin{itemize} |
81 \item \isa{\textsf{if}\ b\ \textsf{then}\ e\isactrlisub {\isadigit{1}}\ \textsf{else}\ e\isactrlisub {\isadigit{2}}} instead of \isa{if\ b\ then\ e\isactrlisub {\isadigit{1}}\ else\ e\isactrlisub {\isadigit{2}}}. |
81 \item \isa{\textsf{if}\ b\ \textsf{then}\ e\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ \textsf{else}\ e\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{2}}} instead of \isa{if\ b\ then\ e\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ else\ e\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{2}}}. |
82 \item \isa{\textsf{let}\ x\ {\isacharequal}\ e\isactrlisub {\isadigit{1}}\ \textsf{in}\ e\isactrlisub {\isadigit{2}}} instead of \isa{let\ x\ {\isacharequal}\ e\isactrlisub {\isadigit{1}}\ in\ e\isactrlisub {\isadigit{2}}}. |
82 \item \isa{\textsf{let}\ x\ {\isaliteral{3D}{\isacharequal}}\ e\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ \textsf{in}\ e\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{2}}} instead of \isa{let\ x\ {\isaliteral{3D}{\isacharequal}}\ e\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ in\ e\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{2}}}. |
83 \item \isa{\textsf{case}\ x\ \textsf{of}\ True\ {\isasymRightarrow}\ e\isactrlisub {\isadigit{1}}\ {\isacharbar}\ False\ {\isasymRightarrow}\ e\isactrlisub {\isadigit{2}}} instead of\\ |
83 \item \isa{\textsf{case}\ x\ \textsf{of}\ True\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ e\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ {\isaliteral{7C}{\isacharbar}}\ False\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ e\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{2}}} instead of\\ |
84 \isa{case\ x\ of\ True\ {\isasymRightarrow}\ e\isactrlisub {\isadigit{1}}\ {\isacharbar}\ False\ {\isasymRightarrow}\ e\isactrlisub {\isadigit{2}}}. |
84 \isa{case\ x\ of\ True\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ e\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ {\isaliteral{7C}{\isacharbar}}\ False\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ e\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{2}}}. |
85 \end{itemize}% |
85 \end{itemize}% |
86 \end{isamarkuptext}% |
86 \end{isamarkuptext}% |
87 \isamarkuptrue% |
87 \isamarkuptrue% |
88 % |
88 % |
89 \isamarkupsubsection{Sets% |
89 \isamarkupsubsection{Sets% |
92 % |
92 % |
93 \begin{isamarkuptext}% |
93 \begin{isamarkuptext}% |
94 Although set syntax in HOL is already close to |
94 Although set syntax in HOL is already close to |
95 standard, we provide a few further improvements: |
95 standard, we provide a few further improvements: |
96 \begin{itemize} |
96 \begin{itemize} |
97 \item \isa{{\isacharbraceleft}x\ {\isacharbar}\ P{\isacharbraceright}} instead of \isa{{\isacharbraceleft}x{\isachardot}\ P{\isacharbraceright}}. |
97 \item \isa{{\isaliteral{7B}{\isacharbraceleft}}x\ {\isaliteral{7C}{\isacharbar}}\ P{\isaliteral{7D}{\isacharbraceright}}} instead of \isa{{\isaliteral{7B}{\isacharbraceleft}}x{\isaliteral{2E}{\isachardot}}\ P{\isaliteral{7D}{\isacharbraceright}}}. |
98 \item \isa{{\isasymemptyset}} instead of \isa{{\isacharbraceleft}{\isacharbraceright}}, where |
98 \item \isa{{\isaliteral{5C3C656D7074797365743E}{\isasymemptyset}}} instead of \isa{{\isaliteral{7B}{\isacharbraceleft}}{\isaliteral{7D}{\isacharbraceright}}}, where |
99 \isa{{\isasymemptyset}} is also input syntax. |
99 \isa{{\isaliteral{5C3C656D7074797365743E}{\isasymemptyset}}} is also input syntax. |
100 \item \isa{{\isacharbraceleft}a{\isacharcomma}\ b{\isacharcomma}\ c{\isacharbraceright}\ {\isasymunion}\ M} instead of \isa{insert\ a\ {\isacharparenleft}insert\ b\ {\isacharparenleft}insert\ c\ M{\isacharparenright}{\isacharparenright}}. |
100 \item \isa{{\isaliteral{7B}{\isacharbraceleft}}a{\isaliteral{2C}{\isacharcomma}}\ b{\isaliteral{2C}{\isacharcomma}}\ c{\isaliteral{7D}{\isacharbraceright}}\ {\isaliteral{5C3C756E696F6E3E}{\isasymunion}}\ M} instead of \isa{insert\ a\ {\isaliteral{28}{\isacharparenleft}}insert\ b\ {\isaliteral{28}{\isacharparenleft}}insert\ c\ M{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}}. |
101 \end{itemize}% |
101 \end{itemize}% |
102 \end{isamarkuptext}% |
102 \end{isamarkuptext}% |
103 \isamarkuptrue% |
103 \isamarkuptrue% |
104 % |
104 % |
105 \isamarkupsubsection{Lists% |
105 \isamarkupsubsection{Lists% |
107 \isamarkuptrue% |
107 \isamarkuptrue% |
108 % |
108 % |
109 \begin{isamarkuptext}% |
109 \begin{isamarkuptext}% |
110 If lists are used heavily, the following notations increase readability: |
110 If lists are used heavily, the following notations increase readability: |
111 \begin{itemize} |
111 \begin{itemize} |
112 \item \isa{x{\isasymcdot}xs} instead of \isa{x\ {\isacharhash}\ xs}, |
112 \item \isa{x{\isaliteral{5C3C63646F743E}{\isasymcdot}}xs} instead of \isa{x\ {\isaliteral{23}{\isacharhash}}\ xs}, |
113 where \isa{x{\isasymcdot}xs} is also input syntax. |
113 where \isa{x{\isaliteral{5C3C63646F743E}{\isasymcdot}}xs} is also input syntax. |
114 If you prefer more space around the $\cdot$ you have to redefine |
114 If you prefer more space around the $\cdot$ you have to redefine |
115 \verb!\isasymcdot! in \LaTeX: |
115 \verb!\isasymcdot! in \LaTeX: |
116 \verb!\renewcommand{\isasymcdot}{\isamath{\,\cdot\,}}! |
116 \verb!\renewcommand{\isasymcdot}{\isamath{\,\cdot\,}}! |
117 |
117 |
118 \item \isa{{\isacharbar}xs{\isacharbar}} instead of \isa{length\ xs}. |
118 \item \isa{{\isaliteral{7C}{\isacharbar}}xs{\isaliteral{7C}{\isacharbar}}} instead of \isa{length\ xs}. |
119 \item \isa{xs\ensuremath{_{[\mathit{n}]}}} instead of \isa{nth\ xs\ n}, |
119 \item \isa{xs\ensuremath{_{[\mathit{n}]}}} instead of \isa{nth\ xs\ n}, |
120 the $n$th element of \isa{xs}. |
120 the $n$th element of \isa{xs}. |
121 |
121 |
122 \item Human readers are good at converting automatically from lists to |
122 \item Human readers are good at converting automatically from lists to |
123 sets. Hence \texttt{OptionalSugar} contains syntax for suppressing the |
123 sets. Hence \texttt{OptionalSugar} contains syntax for suppressing the |
124 conversion function \isa{set}: for example, \isa{{\isachardoublequote}x\ {\isasymin}\ set\ xs{\isachardoublequote}} |
124 conversion function \isa{set}: for example, \isa{{\isaliteral{22}{\isachardoublequote}}x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ set\ xs{\isaliteral{22}{\isachardoublequote}}} |
125 becomes \isa{x\ {\isasymin}\ xs}. |
125 becomes \isa{x\ {\isaliteral{5C3C696E3E}{\isasymin}}\ xs}. |
126 |
126 |
127 \item The \isa{{\isacharat}} operation associates implicitly to the right, |
127 \item The \isa{{\isaliteral{40}{\isacharat}}} operation associates implicitly to the right, |
128 which leads to unpleasant line breaks if the term is too long for one |
128 which leads to unpleasant line breaks if the term is too long for one |
129 line. To avoid this, \texttt{OptionalSugar} contains syntax to group |
129 line. To avoid this, \texttt{OptionalSugar} contains syntax to group |
130 \isa{{\isacharat}}-terms to the left before printing, which leads to better |
130 \isa{{\isaliteral{40}{\isacharat}}}-terms to the left before printing, which leads to better |
131 line breaking behaviour: |
131 line breaking behaviour: |
132 \begin{isabelle}% |
132 \begin{isabelle}% |
133 term\isactrlisub {\isadigit{0}}\ \isacharat\ term\isactrlisub {\isadigit{1}}\ \isacharat\ term\isactrlisub {\isadigit{2}}\ \isacharat\ term\isactrlisub {\isadigit{3}}\ \isacharat\ term\isactrlisub {\isadigit{4}}\ \isacharat\ term\isactrlisub {\isadigit{5}}\ \isacharat\ term\isactrlisub {\isadigit{6}}\ \isacharat\ term\isactrlisub {\isadigit{7}}\ \isacharat\ term\isactrlisub {\isadigit{8}}\ \isacharat\ term\isactrlisub {\isadigit{9}}\ \isacharat\ term\isactrlisub {\isadigit{1}}\isactrlisub {\isadigit{0}}% |
133 term\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{0}}\ \isacharat\ term\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\ \isacharat\ term\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{2}}\ \isacharat\ term\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{3}}\ \isacharat\ term\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{4}}\ \isacharat\ term\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{5}}\ \isacharat\ term\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{6}}\ \isacharat\ term\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{7}}\ \isacharat\ term\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{8}}\ \isacharat\ term\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{9}}\ \isacharat\ term\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{0}}% |
134 \end{isabelle} |
134 \end{isabelle} |
135 |
135 |
136 \end{itemize}% |
136 \end{itemize}% |
137 \end{isamarkuptext}% |
137 \end{isamarkuptext}% |
138 \isamarkuptrue% |
138 \isamarkuptrue% |
143 % |
143 % |
144 \begin{isamarkuptext}% |
144 \begin{isamarkuptext}% |
145 Coercions between numeric types are alien to mathematicians who |
145 Coercions between numeric types are alien to mathematicians who |
146 consider, for example, \isa{nat} as a subset of \isa{int}. |
146 consider, for example, \isa{nat} as a subset of \isa{int}. |
147 \texttt{OptionalSugar} contains syntax for suppressing numeric coercions such |
147 \texttt{OptionalSugar} contains syntax for suppressing numeric coercions such |
148 as \isa{int} \isa{{\isacharcolon}{\isacharcolon}} \isa{nat\ {\isasymRightarrow}\ int}. For example, |
148 as \isa{int} \isa{{\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}} \isa{nat\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ int}. For example, |
149 \isa{{\isachardoublequote}int\ {\isadigit{5}}{\isachardoublequote}} is printed as \isa{{\isadigit{5}}}. Embeddings of types |
149 \isa{{\isaliteral{22}{\isachardoublequote}}int\ {\isadigit{5}}{\isaliteral{22}{\isachardoublequote}}} is printed as \isa{{\isadigit{5}}}. Embeddings of types |
150 \isa{nat}, \isa{int}, \isa{real} are covered; non-injective coercions such |
150 \isa{nat}, \isa{int}, \isa{real} are covered; non-injective coercions such |
151 as \isa{nat} \isa{{\isacharcolon}{\isacharcolon}} \isa{int\ {\isasymRightarrow}\ nat} are not and should not be |
151 as \isa{nat} \isa{{\isaliteral{3A}{\isacharcolon}}{\isaliteral{3A}{\isacharcolon}}} \isa{int\ {\isaliteral{5C3C52696768746172726F773E}{\isasymRightarrow}}\ nat} are not and should not be |
152 hidden.% |
152 hidden.% |
153 \end{isamarkuptext}% |
153 \end{isamarkuptext}% |
154 \isamarkuptrue% |
154 \isamarkuptrue% |
155 % |
155 % |
156 \isamarkupsection{Printing theorems% |
156 \isamarkupsection{Printing theorems% |
162 \isamarkuptrue% |
162 \isamarkuptrue% |
163 % |
163 % |
164 \begin{isamarkuptext}% |
164 \begin{isamarkuptext}% |
165 If you print anything, especially theorems, containing |
165 If you print anything, especially theorems, containing |
166 schematic variables they are prefixed with a question mark: |
166 schematic variables they are prefixed with a question mark: |
167 \verb!@!\verb!{thm conjI}! results in \isa{{\isasymlbrakk}{\isacharquery}P{\isacharsemicolon}\ {\isacharquery}Q{\isasymrbrakk}\ {\isasymLongrightarrow}\ {\isacharquery}P\ {\isasymand}\ {\isacharquery}Q}. Most of the time |
167 \verb!@!\verb!{thm conjI}! results in \isa{{\isaliteral{5C3C6C6272616B6B3E}{\isasymlbrakk}}{\isaliteral{3F}{\isacharquery}}P{\isaliteral{3B}{\isacharsemicolon}}\ {\isaliteral{3F}{\isacharquery}}Q{\isaliteral{5C3C726272616B6B3E}{\isasymrbrakk}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ {\isaliteral{3F}{\isacharquery}}P\ {\isaliteral{5C3C616E643E}{\isasymand}}\ {\isaliteral{3F}{\isacharquery}}Q}. Most of the time |
168 you would rather not see the question marks. There is an attribute |
168 you would rather not see the question marks. There is an attribute |
169 \verb!no_vars! that you can attach to the theorem that turns its |
169 \verb!no_vars! that you can attach to the theorem that turns its |
170 schematic into ordinary free variables: \verb!@!\verb!{thm conjI[no_vars]}! |
170 schematic into ordinary free variables: \verb!@!\verb!{thm conjI[no_vars]}! |
171 results in \isa{{\isasymlbrakk}P{\isacharsemicolon}\ Q{\isasymrbrakk}\ {\isasymLongrightarrow}\ P\ {\isasymand}\ Q}. |
171 results in \isa{{\isaliteral{5C3C6C6272616B6B3E}{\isasymlbrakk}}P{\isaliteral{3B}{\isacharsemicolon}}\ Q{\isaliteral{5C3C726272616B6B3E}{\isasymrbrakk}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ P\ {\isaliteral{5C3C616E643E}{\isasymand}}\ Q}. |
172 |
172 |
173 This \verb!no_vars! business can become a bit tedious. |
173 This \verb!no_vars! business can become a bit tedious. |
174 If you would rather never see question marks, simply put |
174 If you would rather never see question marks, simply put |
175 \begin{quote} |
175 \begin{quote} |
176 \verb|show_question_marks_default := false|\verb!;! |
176 \verb|show_question_marks_default := false|\verb!;! |
178 at the beginning of your file \texttt{ROOT.ML}. |
178 at the beginning of your file \texttt{ROOT.ML}. |
179 The rest of this document is produced with this flag set to \texttt{false}. |
179 The rest of this document is produced with this flag set to \texttt{false}. |
180 |
180 |
181 Hint: Setting \verb!show_question_marks_default! to \texttt{false} only |
181 Hint: Setting \verb!show_question_marks_default! to \texttt{false} only |
182 suppresses question marks; variables that end in digits, |
182 suppresses question marks; variables that end in digits, |
183 e.g. \isa{x{\isadigit{1}}}, are still printed with a trailing \isa{{\isachardot}{\isadigit{0}}}, |
183 e.g. \isa{x{\isadigit{1}}}, are still printed with a trailing \isa{{\isaliteral{2E}{\isachardot}}{\isadigit{0}}}, |
184 e.g. \isa{x{\isadigit{1}}{\isachardot}{\isadigit{0}}}, their internal index. This can be avoided by |
184 e.g. \isa{x{\isadigit{1}}{\isaliteral{2E}{\isachardot}}{\isadigit{0}}}, their internal index. This can be avoided by |
185 turning the last digit into a subscript: write \verb!x\<^isub>1! and |
185 turning the last digit into a subscript: write \verb!x\<^isub>1! and |
186 obtain the much nicer \isa{x\isactrlisub {\isadigit{1}}}.% |
186 obtain the much nicer \isa{x\isaliteral{5C3C5E697375623E}{}\isactrlisub {\isadigit{1}}}.% |
187 \end{isamarkuptext}% |
187 \end{isamarkuptext}% |
188 \isamarkuptrue% |
188 \isamarkuptrue% |
189 % |
189 % |
190 \isamarkupsubsection{Qualified names% |
190 \isamarkupsubsection{Qualified names% |
191 } |
191 } |
192 \isamarkuptrue% |
192 \isamarkuptrue% |
193 % |
193 % |
194 \begin{isamarkuptext}% |
194 \begin{isamarkuptext}% |
195 If there are multiple declarations of the same name, Isabelle prints |
195 If there are multiple declarations of the same name, Isabelle prints |
196 the qualified name, for example \isa{T{\isachardot}length}, where \isa{T} is the |
196 the qualified name, for example \isa{T{\isaliteral{2E}{\isachardot}}length}, where \isa{T} is the |
197 theory it is defined in, to distinguish it from the predefined \isa{{\isachardoublequote}List{\isachardot}length{\isachardoublequote}}. In case there is no danger of confusion, you can insist on |
197 theory it is defined in, to distinguish it from the predefined \isa{{\isaliteral{22}{\isachardoublequote}}List{\isaliteral{2E}{\isachardot}}length{\isaliteral{22}{\isachardoublequote}}}. In case there is no danger of confusion, you can insist on |
198 short names (no qualifiers) by setting \verb!short_names!, typically |
198 short names (no qualifiers) by setting \verb!short_names!, typically |
199 in \texttt{ROOT.ML}: |
199 in \texttt{ROOT.ML}: |
200 \begin{quote} |
200 \begin{quote} |
201 \verb|short_names := true|\verb!;! |
201 \verb|short_names := true|\verb!;! |
202 \end{quote}% |
202 \end{quote}% |
209 % |
209 % |
210 \begin{isamarkuptext}% |
210 \begin{isamarkuptext}% |
211 It sometimes happens that you want to change the name of a |
211 It sometimes happens that you want to change the name of a |
212 variable in a theorem before printing it. This can easily be achieved |
212 variable in a theorem before printing it. This can easily be achieved |
213 with the help of Isabelle's instantiation attribute \texttt{where}: |
213 with the help of Isabelle's instantiation attribute \texttt{where}: |
214 \isa{{\isasymlbrakk}{\isasymphi}{\isacharsemicolon}\ {\isasympsi}{\isasymrbrakk}\ {\isasymLongrightarrow}\ {\isasymphi}\ {\isasymand}\ {\isasympsi}} is the result of |
214 \isa{{\isaliteral{5C3C6C6272616B6B3E}{\isasymlbrakk}}{\isaliteral{5C3C7068693E}{\isasymphi}}{\isaliteral{3B}{\isacharsemicolon}}\ {\isaliteral{5C3C7073693E}{\isasympsi}}{\isaliteral{5C3C726272616B6B3E}{\isasymrbrakk}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ {\isaliteral{5C3C7068693E}{\isasymphi}}\ {\isaliteral{5C3C616E643E}{\isasymand}}\ {\isaliteral{5C3C7073693E}{\isasympsi}}} is the result of |
215 \begin{quote} |
215 \begin{quote} |
216 \verb!@!\verb!{thm conjI[where P = \<phi> and Q = \<psi>]}! |
216 \verb!@!\verb!{thm conjI[where P = \<phi> and Q = \<psi>]}! |
217 \end{quote} |
217 \end{quote} |
218 To support the ``\_''-notation for irrelevant variables |
218 To support the ``\_''-notation for irrelevant variables |
219 the constant \texttt{DUMMY} has been introduced: |
219 the constant \texttt{DUMMY} has been introduced: |
220 \isa{fst\ {\isacharparenleft}a{\isacharcomma}\ \_{\isacharparenright}\ {\isacharequal}\ a} is produced by |
220 \isa{fst\ {\isaliteral{28}{\isacharparenleft}}a{\isaliteral{2C}{\isacharcomma}}\ \_{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ a} is produced by |
221 \begin{quote} |
221 \begin{quote} |
222 \verb!@!\verb!{thm fst_conv[where b = DUMMY]}! |
222 \verb!@!\verb!{thm fst_conv[where b = DUMMY]}! |
223 \end{quote} |
223 \end{quote} |
224 Variables that are bound by quantifiers or lambdas cannot be renamed |
224 Variables that are bound by quantifiers or lambdas cannot be renamed |
225 like this. Instead, the attribute \texttt{rename\_abs} does the |
225 like this. Instead, the attribute \texttt{rename\_abs} does the |
226 job. It expects a list of names or underscores, similar to the |
226 job. It expects a list of names or underscores, similar to the |
227 \texttt{of} attribute: |
227 \texttt{of} attribute: |
228 \begin{quote} |
228 \begin{quote} |
229 \verb!@!\verb!{thm split_paired_All[rename_abs _ l r]}! |
229 \verb!@!\verb!{thm split_paired_All[rename_abs _ l r]}! |
230 \end{quote} |
230 \end{quote} |
231 produces \isa{{\isacharparenleft}{\isasymforall}x{\isachardot}\ P\ x{\isacharparenright}\ {\isacharequal}\ {\isacharparenleft}{\isasymforall}l\ r{\isachardot}\ P\ {\isacharparenleft}l{\isacharcomma}\ r{\isacharparenright}{\isacharparenright}}.% |
231 produces \isa{{\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C666F72616C6C3E}{\isasymforall}}x{\isaliteral{2E}{\isachardot}}\ P\ x{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ {\isaliteral{28}{\isacharparenleft}}{\isaliteral{5C3C666F72616C6C3E}{\isasymforall}}l\ r{\isaliteral{2E}{\isachardot}}\ P\ {\isaliteral{28}{\isacharparenleft}}l{\isaliteral{2C}{\isacharcomma}}\ r{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}}.% |
232 \end{isamarkuptext}% |
232 \end{isamarkuptext}% |
233 \isamarkuptrue% |
233 \isamarkuptrue% |
234 % |
234 % |
235 \isamarkupsubsection{Inference rules% |
235 \isamarkupsubsection{Inference rules% |
236 } |
236 } |
240 To print theorems as inference rules you need to include Didier |
240 To print theorems as inference rules you need to include Didier |
241 R\'emy's \texttt{mathpartir} package~\cite{mathpartir} |
241 R\'emy's \texttt{mathpartir} package~\cite{mathpartir} |
242 for typesetting inference rules in your \LaTeX\ file. |
242 for typesetting inference rules in your \LaTeX\ file. |
243 |
243 |
244 Writing \verb!@!\verb!{thm[mode=Rule] conjI}! produces |
244 Writing \verb!@!\verb!{thm[mode=Rule] conjI}! produces |
245 \isa{\mbox{}\inferrule{\mbox{P}\\\ \mbox{Q}}{\mbox{P\ {\isasymand}\ Q}}}, even in the middle of a sentence. |
245 \isa{\mbox{}\inferrule{\mbox{P}\\\ \mbox{Q}}{\mbox{P\ {\isaliteral{5C3C616E643E}{\isasymand}}\ Q}}}, even in the middle of a sentence. |
246 If you prefer your inference rule on a separate line, maybe with a name, |
246 If you prefer your inference rule on a separate line, maybe with a name, |
247 \begin{center} |
247 \begin{center} |
248 \isa{\mbox{}\inferrule{\mbox{P}\\\ \mbox{Q}}{\mbox{P\ {\isasymand}\ Q}}} {\sc conjI} |
248 \isa{\mbox{}\inferrule{\mbox{P}\\\ \mbox{Q}}{\mbox{P\ {\isaliteral{5C3C616E643E}{\isasymand}}\ Q}}} {\sc conjI} |
249 \end{center} |
249 \end{center} |
250 is produced by |
250 is produced by |
251 \begin{quote} |
251 \begin{quote} |
252 \verb!\begin{center}!\\ |
252 \verb!\begin{center}!\\ |
253 \verb!@!\verb!{thm[mode=Rule] conjI} {\sc conjI}!\\ |
253 \verb!@!\verb!{thm[mode=Rule] conjI} {\sc conjI}!\\ |
266 \verb!@!\verb!{thm[mode=Rule] disjE} {\sc disjI$_2$}!\\ |
266 \verb!@!\verb!{thm[mode=Rule] disjE} {\sc disjI$_2$}!\\ |
267 \verb!\end{center}! |
267 \verb!\end{center}! |
268 \end{quote} |
268 \end{quote} |
269 yields |
269 yields |
270 \begin{center}\small |
270 \begin{center}\small |
271 \isa{\mbox{}\inferrule{\mbox{P}\\\ \mbox{Q}}{\mbox{P\ {\isasymand}\ Q}}} {\sc conjI} \\[1ex] |
271 \isa{\mbox{}\inferrule{\mbox{P}\\\ \mbox{Q}}{\mbox{P\ {\isaliteral{5C3C616E643E}{\isasymand}}\ Q}}} {\sc conjI} \\[1ex] |
272 \isa{\mbox{}\inferrule{\mbox{P}}{\mbox{P\ {\isasymor}\ Q}}} {\sc disjI$_1$} \qquad |
272 \isa{\mbox{}\inferrule{\mbox{P}}{\mbox{P\ {\isaliteral{5C3C6F723E}{\isasymor}}\ Q}}} {\sc disjI$_1$} \qquad |
273 \isa{\mbox{}\inferrule{\mbox{Q}}{\mbox{P\ {\isasymor}\ Q}}} {\sc disjI$_2$} |
273 \isa{\mbox{}\inferrule{\mbox{Q}}{\mbox{P\ {\isaliteral{5C3C6F723E}{\isasymor}}\ Q}}} {\sc disjI$_2$} |
274 \end{center} |
274 \end{center} |
275 |
275 |
276 The \texttt{mathpartir} package copes well if there are too many |
276 The \texttt{mathpartir} package copes well if there are too many |
277 premises for one line: |
277 premises for one line: |
278 \begin{center} |
278 \begin{center} |
279 \isa{\mbox{}\inferrule{\mbox{A\ {\isasymlongrightarrow}\ B}\\\ \mbox{B\ {\isasymlongrightarrow}\ C}\\\ \mbox{C\ {\isasymlongrightarrow}\ D}\\\ \mbox{D\ {\isasymlongrightarrow}\ E}\\\ \mbox{E\ {\isasymlongrightarrow}\ F}\\\ \mbox{F\ {\isasymlongrightarrow}\ G}\\\ \mbox{G\ {\isasymlongrightarrow}\ H}\\\ \mbox{H\ {\isasymlongrightarrow}\ I}\\\ \mbox{I\ {\isasymlongrightarrow}\ J}\\\ \mbox{J\ {\isasymlongrightarrow}\ K}}{\mbox{A\ {\isasymlongrightarrow}\ K}}} |
279 \isa{\mbox{}\inferrule{\mbox{A\ {\isaliteral{5C3C6C6F6E6772696768746172726F773E}{\isasymlongrightarrow}}\ B}\\\ \mbox{B\ {\isaliteral{5C3C6C6F6E6772696768746172726F773E}{\isasymlongrightarrow}}\ C}\\\ \mbox{C\ {\isaliteral{5C3C6C6F6E6772696768746172726F773E}{\isasymlongrightarrow}}\ D}\\\ \mbox{D\ {\isaliteral{5C3C6C6F6E6772696768746172726F773E}{\isasymlongrightarrow}}\ E}\\\ \mbox{E\ {\isaliteral{5C3C6C6F6E6772696768746172726F773E}{\isasymlongrightarrow}}\ F}\\\ \mbox{F\ {\isaliteral{5C3C6C6F6E6772696768746172726F773E}{\isasymlongrightarrow}}\ G}\\\ \mbox{G\ {\isaliteral{5C3C6C6F6E6772696768746172726F773E}{\isasymlongrightarrow}}\ H}\\\ \mbox{H\ {\isaliteral{5C3C6C6F6E6772696768746172726F773E}{\isasymlongrightarrow}}\ I}\\\ \mbox{I\ {\isaliteral{5C3C6C6F6E6772696768746172726F773E}{\isasymlongrightarrow}}\ J}\\\ \mbox{J\ {\isaliteral{5C3C6C6F6E6772696768746172726F773E}{\isasymlongrightarrow}}\ K}}{\mbox{A\ {\isaliteral{5C3C6C6F6E6772696768746172726F773E}{\isasymlongrightarrow}}\ K}}} |
280 \end{center} |
280 \end{center} |
281 |
281 |
282 Limitations: 1. Premises and conclusion must each not be longer than |
282 Limitations: 1. Premises and conclusion must each not be longer than |
283 the line. 2. Premises that are \isa{{\isasymLongrightarrow}}-implications are again |
283 the line. 2. Premises that are \isa{{\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}}-implications are again |
284 displayed with a horizontal line, which looks at least unusual. |
284 displayed with a horizontal line, which looks at least unusual. |
285 |
285 |
286 |
286 |
287 In case you print theorems without premises no rule will be printed by the |
287 In case you print theorems without premises no rule will be printed by the |
288 \texttt{Rule} print mode. However, you can use \texttt{Axiom} instead: |
288 \texttt{Rule} print mode. However, you can use \texttt{Axiom} instead: |
303 \isamarkuptrue% |
303 \isamarkuptrue% |
304 % |
304 % |
305 \begin{isamarkuptext}% |
305 \begin{isamarkuptext}% |
306 When displaying theorems with the \texttt{display} option, e.g. |
306 When displaying theorems with the \texttt{display} option, e.g. |
307 \verb!@!\verb!{thm[display] refl}! \begin{isabelle}% |
307 \verb!@!\verb!{thm[display] refl}! \begin{isabelle}% |
308 t\ {\isacharequal}\ t% |
308 t\ {\isaliteral{3D}{\isacharequal}}\ t% |
309 \end{isabelle} the theorem is |
309 \end{isabelle} the theorem is |
310 set in small font. It uses the \LaTeX-macro \verb!\isastyle!, |
310 set in small font. It uses the \LaTeX-macro \verb!\isastyle!, |
311 which is also the style that regular theory text is set in, e.g.% |
311 which is also the style that regular theory text is set in, e.g.% |
312 \end{isamarkuptext}% |
312 \end{isamarkuptext}% |
313 \isamarkuptrue% |
313 \isamarkuptrue% |
314 \isacommand{lemma}\isamarkupfalse% |
314 \isacommand{lemma}\isamarkupfalse% |
315 \ {\isachardoublequoteopen}t\ {\isacharequal}\ t{\isachardoublequoteclose}% |
315 \ {\isaliteral{22}{\isachardoublequoteopen}}t\ {\isaliteral{3D}{\isacharequal}}\ t{\isaliteral{22}{\isachardoublequoteclose}}% |
316 \isadelimproof |
316 \isadelimproof |
317 % |
317 % |
318 \endisadelimproof |
318 \endisadelimproof |
319 % |
319 % |
320 \isatagproof |
320 \isatagproof |
340 |
340 |
341 The advantage of the display option is that you can display a whole |
341 The advantage of the display option is that you can display a whole |
342 list of theorems in one go. For example, |
342 list of theorems in one go. For example, |
343 \verb!@!\verb!{thm[display] foldl.simps}! |
343 \verb!@!\verb!{thm[display] foldl.simps}! |
344 generates \begin{isabelle}% |
344 generates \begin{isabelle}% |
345 foldl\ f\ a\ {\isacharbrackleft}{\isacharbrackright}\ {\isacharequal}\ a\isasep\isanewline% |
345 foldl\ f\ a\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{5D}{\isacharbrackright}}\ {\isaliteral{3D}{\isacharequal}}\ a\isasep\isanewline% |
346 foldl\ f\ a\ {\isacharparenleft}x{\isasymcdot}xs{\isacharparenright}\ {\isacharequal}\ foldl\ f\ {\isacharparenleft}f\ a\ x{\isacharparenright}\ xs% |
346 foldl\ f\ a\ {\isaliteral{28}{\isacharparenleft}}x{\isaliteral{5C3C63646F743E}{\isasymcdot}}xs{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ foldl\ f\ {\isaliteral{28}{\isacharparenleft}}f\ a\ x{\isaliteral{29}{\isacharparenright}}\ xs% |
347 \end{isabelle}% |
347 \end{isabelle}% |
348 \end{isamarkuptext}% |
348 \end{isamarkuptext}% |
349 \isamarkuptrue% |
349 \isamarkuptrue% |
350 % |
350 % |
351 \isamarkupsubsection{If-then% |
351 \isamarkupsubsection{If-then% |
355 \begin{isamarkuptext}% |
355 \begin{isamarkuptext}% |
356 If you prefer a fake ``natural language'' style you can produce |
356 If you prefer a fake ``natural language'' style you can produce |
357 the body of |
357 the body of |
358 \newtheorem{theorem}{Theorem} |
358 \newtheorem{theorem}{Theorem} |
359 \begin{theorem} |
359 \begin{theorem} |
360 \isa{{\normalsize{}If\,}\ \mbox{i\ {\isasymle}\ j}\ {\normalsize \,and\,}\ \mbox{j\ {\isasymle}\ k}\ {\normalsize \,then\,}\ i\ {\isasymle}\ k{\isachardot}} |
360 \isa{{\normalsize{}If\,}\ \mbox{i\ {\isaliteral{5C3C6C653E}{\isasymle}}\ j}\ {\normalsize \,and\,}\ \mbox{j\ {\isaliteral{5C3C6C653E}{\isasymle}}\ k}\ {\normalsize \,then\,}\ i\ {\isaliteral{5C3C6C653E}{\isasymle}}\ k{\isaliteral{2E}{\isachardot}}} |
361 \end{theorem} |
361 \end{theorem} |
362 by typing |
362 by typing |
363 \begin{quote} |
363 \begin{quote} |
364 \verb!@!\verb!{thm[mode=IfThen] le_trans}! |
364 \verb!@!\verb!{thm[mode=IfThen] le_trans}! |
365 \end{quote} |
365 \end{quote} |
366 |
366 |
367 In order to prevent odd line breaks, the premises are put into boxes. |
367 In order to prevent odd line breaks, the premises are put into boxes. |
368 At times this is too drastic: |
368 At times this is too drastic: |
369 \begin{theorem} |
369 \begin{theorem} |
370 \isa{{\normalsize{}If\,}\ \mbox{longpremise}\ {\normalsize \,and\,}\ \mbox{longerpremise}\ {\normalsize \,and\,}\ \mbox{P\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ x{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}}\ {\normalsize \,and\,}\ \mbox{longestpremise}\ {\normalsize \,then\,}\ conclusion{\isachardot}} |
370 \isa{{\normalsize{}If\,}\ \mbox{longpremise}\ {\normalsize \,and\,}\ \mbox{longerpremise}\ {\normalsize \,and\,}\ \mbox{P\ {\isaliteral{28}{\isacharparenleft}}f\ {\isaliteral{28}{\isacharparenleft}}f\ {\isaliteral{28}{\isacharparenleft}}f\ {\isaliteral{28}{\isacharparenleft}}f\ {\isaliteral{28}{\isacharparenleft}}f\ {\isaliteral{28}{\isacharparenleft}}f\ {\isaliteral{28}{\isacharparenleft}}f\ {\isaliteral{28}{\isacharparenleft}}f\ {\isaliteral{28}{\isacharparenleft}}f\ x{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}}\ {\normalsize \,and\,}\ \mbox{longestpremise}\ {\normalsize \,then\,}\ conclusion{\isaliteral{2E}{\isachardot}}} |
371 \end{theorem} |
371 \end{theorem} |
372 In which case you should use \texttt{IfThenNoBox} instead of |
372 In which case you should use \texttt{IfThenNoBox} instead of |
373 \texttt{IfThen}: |
373 \texttt{IfThen}: |
374 \begin{theorem} |
374 \begin{theorem} |
375 \isa{{\normalsize{}If\,}\ longpremise\ {\normalsize \,and\,}\ longerpremise\ {\normalsize \,and\,}\ P\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ {\isacharparenleft}f\ x{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}{\isacharparenright}\ {\normalsize \,and\,}\ longestpremise\ {\normalsize \,then\,}\ conclusion{\isachardot}} |
375 \isa{{\normalsize{}If\,}\ longpremise\ {\normalsize \,and\,}\ longerpremise\ {\normalsize \,and\,}\ P\ {\isaliteral{28}{\isacharparenleft}}f\ {\isaliteral{28}{\isacharparenleft}}f\ {\isaliteral{28}{\isacharparenleft}}f\ {\isaliteral{28}{\isacharparenleft}}f\ {\isaliteral{28}{\isacharparenleft}}f\ {\isaliteral{28}{\isacharparenleft}}f\ {\isaliteral{28}{\isacharparenleft}}f\ {\isaliteral{28}{\isacharparenleft}}f\ {\isaliteral{28}{\isacharparenleft}}f\ x{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}{\isaliteral{29}{\isacharparenright}}\ {\normalsize \,and\,}\ longestpremise\ {\normalsize \,then\,}\ conclusion{\isaliteral{2E}{\isachardot}}} |
376 \end{theorem}% |
376 \end{theorem}% |
377 \end{isamarkuptext}% |
377 \end{isamarkuptext}% |
378 \isamarkuptrue% |
378 \isamarkuptrue% |
379 % |
379 % |
380 \isamarkupsubsection{Doing it yourself\label{sec:yourself}% |
380 \isamarkupsubsection{Doing it yourself\label{sec:yourself}% |
390 prints premise 1 of $thm$. |
390 prints premise 1 of $thm$. |
391 \item \verb!@!\verb!{thm (concl)! $thm$\verb!}! |
391 \item \verb!@!\verb!{thm (concl)! $thm$\verb!}! |
392 prints the conclusion of $thm$. |
392 prints the conclusion of $thm$. |
393 \end{itemize} |
393 \end{itemize} |
394 For example, ``from \isa{Q} and |
394 For example, ``from \isa{Q} and |
395 \isa{P} we conclude \isa{P\ {\isasymand}\ Q}'' |
395 \isa{P} we conclude \isa{P\ {\isaliteral{5C3C616E643E}{\isasymand}}\ Q}'' |
396 is produced by |
396 is produced by |
397 \begin{quote} |
397 \begin{quote} |
398 \verb!from !\verb!@!\verb!{thm (prem 2) conjI}! \verb!and !\verb!@!\verb!{thm (prem 1) conjI}!\\ |
398 \verb!from !\verb!@!\verb!{thm (prem 2) conjI}! \verb!and !\verb!@!\verb!{thm (prem 1) conjI}!\\ |
399 \verb!we conclude !\verb!@!\verb!{thm (concl) conjI}! |
399 \verb!we conclude !\verb!@!\verb!{thm (concl) conjI}! |
400 \end{quote} |
400 \end{quote} |
416 etc.\ are printed as patterns. \texttt{OptionalSugar} provides the |
416 etc.\ are printed as patterns. \texttt{OptionalSugar} provides the |
417 following: |
417 following: |
418 |
418 |
419 \begin{center} |
419 \begin{center} |
420 \begin{tabular}{l@ {~~produced by~~}l} |
420 \begin{tabular}{l@ {~~produced by~~}l} |
421 \isa{\textsf{let}\ {\isacharparenleft}x{\isacharcomma}\ \_{\isacharparenright}\ {\isacharequal}\ p\ \textsf{in}\ t} & \verb!@!\verb!{term "let x = fst p in t"}!\\ |
421 \isa{\textsf{let}\ {\isaliteral{28}{\isacharparenleft}}x{\isaliteral{2C}{\isacharcomma}}\ \_{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ p\ \textsf{in}\ t} & \verb!@!\verb!{term "let x = fst p in t"}!\\ |
422 \isa{\textsf{let}\ {\isacharparenleft}\_{\isacharcomma}\ x{\isacharparenright}\ {\isacharequal}\ p\ \textsf{in}\ t} & \verb!@!\verb!{term "let x = snd p in t"}!\\ |
422 \isa{\textsf{let}\ {\isaliteral{28}{\isacharparenleft}}\_{\isaliteral{2C}{\isacharcomma}}\ x{\isaliteral{29}{\isacharparenright}}\ {\isaliteral{3D}{\isacharequal}}\ p\ \textsf{in}\ t} & \verb!@!\verb!{term "let x = snd p in t"}!\\ |
423 \isa{\textsf{let}\ x{\isasymcdot}\_\ {\isacharequal}\ xs\ \textsf{in}\ t} & \verb!@!\verb!{term "let x = hd xs in t"}!\\ |
423 \isa{\textsf{let}\ x{\isaliteral{5C3C63646F743E}{\isasymcdot}}\_\ {\isaliteral{3D}{\isacharequal}}\ xs\ \textsf{in}\ t} & \verb!@!\verb!{term "let x = hd xs in t"}!\\ |
424 \isa{\textsf{let}\ \_{\isasymcdot}x\ {\isacharequal}\ xs\ \textsf{in}\ t} & \verb!@!\verb!{term "let x = tl xs in t"}!\\ |
424 \isa{\textsf{let}\ \_{\isaliteral{5C3C63646F743E}{\isasymcdot}}x\ {\isaliteral{3D}{\isacharequal}}\ xs\ \textsf{in}\ t} & \verb!@!\verb!{term "let x = tl xs in t"}!\\ |
425 \isa{\textsf{let}\ Some\ x\ {\isacharequal}\ y\ \textsf{in}\ t} & \verb!@!\verb!{term "let x = the y in t"}!\\ |
425 \isa{\textsf{let}\ Some\ x\ {\isaliteral{3D}{\isacharequal}}\ y\ \textsf{in}\ t} & \verb!@!\verb!{term "let x = the y in t"}!\\ |
426 \end{tabular} |
426 \end{tabular} |
427 \end{center}% |
427 \end{center}% |
428 \end{isamarkuptext}% |
428 \end{isamarkuptext}% |
429 \isamarkuptrue% |
429 \isamarkuptrue% |
430 % |
430 % |
503 \isamarkuptrue% |
503 \isamarkuptrue% |
504 % |
504 % |
505 \begin{isamarkuptext}% |
505 \begin{isamarkuptext}% |
506 The \verb!thm! antiquotation works nicely for single theorems, but |
506 The \verb!thm! antiquotation works nicely for single theorems, but |
507 sets of equations as used in definitions are more difficult to |
507 sets of equations as used in definitions are more difficult to |
508 typeset nicely: people tend to prefer aligned \isa{{\isacharequal}} signs. |
508 typeset nicely: people tend to prefer aligned \isa{{\isaliteral{3D}{\isacharequal}}} signs. |
509 |
509 |
510 To deal with such cases where it is desirable to dive into the structure |
510 To deal with such cases where it is desirable to dive into the structure |
511 of terms and theorems, Isabelle offers antiquotations featuring |
511 of terms and theorems, Isabelle offers antiquotations featuring |
512 ``styles'': |
512 ``styles'': |
513 |
513 |
522 A ``style'' is a transformation of a term. There are predefined |
522 A ``style'' is a transformation of a term. There are predefined |
523 styles, namely \verb!lhs! and \verb!rhs!, \verb!prem! with one argument, and \verb!concl!. |
523 styles, namely \verb!lhs! and \verb!rhs!, \verb!prem! with one argument, and \verb!concl!. |
524 For example, |
524 For example, |
525 the output |
525 the output |
526 \begin{center} |
526 \begin{center} |
527 \begin{tabular}{l@ {~~\isa{{\isacharequal}}~~}l} |
527 \begin{tabular}{l@ {~~\isa{{\isaliteral{3D}{\isacharequal}}}~~}l} |
528 \isa{foldl\ f\ a\ {\isacharbrackleft}{\isacharbrackright}} & \isa{a}\\ |
528 \isa{foldl\ f\ a\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{5D}{\isacharbrackright}}} & \isa{a}\\ |
529 \isa{foldl\ f\ a\ {\isacharparenleft}x{\isasymcdot}xs{\isacharparenright}} & \isa{foldl\ f\ {\isacharparenleft}f\ a\ x{\isacharparenright}\ xs} |
529 \isa{foldl\ f\ a\ {\isaliteral{28}{\isacharparenleft}}x{\isaliteral{5C3C63646F743E}{\isasymcdot}}xs{\isaliteral{29}{\isacharparenright}}} & \isa{foldl\ f\ {\isaliteral{28}{\isacharparenleft}}f\ a\ x{\isaliteral{29}{\isacharparenright}}\ xs} |
530 \end{tabular} |
530 \end{tabular} |
531 \end{center} |
531 \end{center} |
532 is produced by the following code: |
532 is produced by the following code: |
533 \begin{quote} |
533 \begin{quote} |
534 \verb!\begin{center}!\\ |
534 \verb!\begin{center}!\\ |
541 Note the space between \verb!@! and \verb!{! in the tabular argument. |
541 Note the space between \verb!@! and \verb!{! in the tabular argument. |
542 It prevents Isabelle from interpreting \verb!@ {~~...~~}! |
542 It prevents Isabelle from interpreting \verb!@ {~~...~~}! |
543 as an antiquotation. The styles \verb!lhs! and \verb!rhs! |
543 as an antiquotation. The styles \verb!lhs! and \verb!rhs! |
544 extract the left hand side (or right hand side respectively) from the |
544 extract the left hand side (or right hand side respectively) from the |
545 conclusion of propositions consisting of a binary operator |
545 conclusion of propositions consisting of a binary operator |
546 (e.~g.~\isa{{\isacharequal}}, \isa{{\isasymequiv}}, \isa{{\isacharless}}). |
546 (e.~g.~\isa{{\isaliteral{3D}{\isacharequal}}}, \isa{{\isaliteral{5C3C65717569763E}{\isasymequiv}}}, \isa{{\isaliteral{3C}{\isacharless}}}). |
547 |
547 |
548 Likewise, \verb!concl! may be used as a style to show just the |
548 Likewise, \verb!concl! may be used as a style to show just the |
549 conclusion of a proposition. For example, take \verb!hd_Cons_tl!: |
549 conclusion of a proposition. For example, take \verb!hd_Cons_tl!: |
550 \begin{center} |
550 \begin{center} |
551 \isa{xs\ {\isasymnoteq}\ {\isacharbrackleft}{\isacharbrackright}\ {\isasymLongrightarrow}\ hd\ xs{\isasymcdot}tl\ xs\ {\isacharequal}\ xs} |
551 \isa{xs\ {\isaliteral{5C3C6E6F7465713E}{\isasymnoteq}}\ {\isaliteral{5B}{\isacharbrackleft}}{\isaliteral{5D}{\isacharbrackright}}\ {\isaliteral{5C3C4C6F6E6772696768746172726F773E}{\isasymLongrightarrow}}\ hd\ xs{\isaliteral{5C3C63646F743E}{\isasymcdot}}tl\ xs\ {\isaliteral{3D}{\isacharequal}}\ xs} |
552 \end{center} |
552 \end{center} |
553 To print just the conclusion, |
553 To print just the conclusion, |
554 \begin{center} |
554 \begin{center} |
555 \isa{hd\ xs{\isasymcdot}tl\ xs\ {\isacharequal}\ xs} |
555 \isa{hd\ xs{\isaliteral{5C3C63646F743E}{\isasymcdot}}tl\ xs\ {\isaliteral{3D}{\isacharequal}}\ xs} |
556 \end{center} |
556 \end{center} |
557 type |
557 type |
558 \begin{quote} |
558 \begin{quote} |
559 \verb!\begin{center}!\\ |
559 \verb!\begin{center}!\\ |
560 \verb!@!\verb!{thm (concl) hd_Cons_tl}!\\ |
560 \verb!@!\verb!{thm (concl) hd_Cons_tl}!\\ |