doc-src/IsarRef/Thy/Document_Preparation.thy
changeset 32891 d403b99287ff
parent 30397 b6212ae21656
child 32892 9742f6130f10
equal deleted inserted replaced
32890:77df12652210 32891:d403b99287ff
   143     @{antiquotation_def "term"} & : & @{text antiquotation} \\
   143     @{antiquotation_def "term"} & : & @{text antiquotation} \\
   144     @{antiquotation_def const} & : & @{text antiquotation} \\
   144     @{antiquotation_def const} & : & @{text antiquotation} \\
   145     @{antiquotation_def abbrev} & : & @{text antiquotation} \\
   145     @{antiquotation_def abbrev} & : & @{text antiquotation} \\
   146     @{antiquotation_def typeof} & : & @{text antiquotation} \\
   146     @{antiquotation_def typeof} & : & @{text antiquotation} \\
   147     @{antiquotation_def typ} & : & @{text antiquotation} \\
   147     @{antiquotation_def typ} & : & @{text antiquotation} \\
   148     @{antiquotation_def thm_style} & : & @{text antiquotation} \\
       
   149     @{antiquotation_def term_style} & : & @{text antiquotation} \\
       
   150     @{antiquotation_def "text"} & : & @{text antiquotation} \\
   148     @{antiquotation_def "text"} & : & @{text antiquotation} \\
   151     @{antiquotation_def goals} & : & @{text antiquotation} \\
   149     @{antiquotation_def goals} & : & @{text antiquotation} \\
   152     @{antiquotation_def subgoals} & : & @{text antiquotation} \\
   150     @{antiquotation_def subgoals} & : & @{text antiquotation} \\
   153     @{antiquotation_def prf} & : & @{text antiquotation} \\
   151     @{antiquotation_def prf} & : & @{text antiquotation} \\
   154     @{antiquotation_def full_prf} & : & @{text antiquotation} \\
   152     @{antiquotation_def full_prf} & : & @{text antiquotation} \\
   180     atsign lbrace antiquotation rbrace
   178     atsign lbrace antiquotation rbrace
   181     ;
   179     ;
   182 
   180 
   183     antiquotation:
   181     antiquotation:
   184       'theory' options name |
   182       'theory' options name |
   185       'thm' options thmrefs |
   183       'thm' options styles thmrefs |
   186       'lemma' options prop 'by' method |
   184       'lemma' options prop 'by' method |
   187       'prop' options prop |
   185       'prop' options styles prop |
   188       'term' options term |
   186       'term' options styles term |
   189       'const' options term |
   187       'const' options term |
   190       'abbrev' options term |
   188       'abbrev' options term |
   191       'typeof' options term |
   189       'typeof' options term |
   192       'typ' options type |
   190       'typ' options type |
   193       'thm\_style' options name thmref |
       
   194       'term\_style' options name term |
       
   195       'text' options name |
   191       'text' options name |
   196       'goals' options |
   192       'goals' options |
   197       'subgoals' options |
   193       'subgoals' options |
   198       'prf' options thmrefs |
   194       'prf' options thmrefs |
   199       'full\_prf' options thmrefs |
   195       'full\_prf' options thmrefs |
   203     ;
   199     ;
   204     options: '[' (option * ',') ']'
   200     options: '[' (option * ',') ']'
   205     ;
   201     ;
   206     option: name | name '=' name
   202     option: name | name '=' name
   207     ;
   203     ;
       
   204     styles: '(' (style * ',') ')'
       
   205     ;
       
   206     style: (name *)
       
   207     ;
   208   \end{rail}
   208   \end{rail}
   209 
   209 
   210   Note that the syntax of antiquotations may \emph{not} include source
   210   Note that the syntax of antiquotations may \emph{not} include source
   211   comments @{verbatim "(*"}~@{text "\<dots>"}~@{verbatim "*)"} nor verbatim
   211   comments @{verbatim "(*"}~@{text "\<dots>"}~@{verbatim "*)"} nor verbatim
   212   text @{verbatim "{"}@{verbatim "*"}~@{text "\<dots>"}~@{verbatim
   212   text @{verbatim "{"}@{verbatim "*"}~@{text "\<dots>"}~@{verbatim
   239   \item @{text "@{typeof t}"} prints the type of a well-typed term
   239   \item @{text "@{typeof t}"} prints the type of a well-typed term
   240   @{text "t"}.
   240   @{text "t"}.
   241 
   241 
   242   \item @{text "@{typ \<tau>}"} prints a well-formed type @{text "\<tau>"}.
   242   \item @{text "@{typ \<tau>}"} prints a well-formed type @{text "\<tau>"}.
   243   
   243   
   244   \item @{text "@{thm_style s a}"} prints theorem @{text a},
       
   245   previously applying a style @{text s} to it (see below).
       
   246   
       
   247   \item @{text "@{term_style s t}"} prints a well-typed term @{text t}
       
   248   after applying a style @{text s} to it (see below).
       
   249 
       
   250   \item @{text "@{text s}"} prints uninterpreted source text @{text
   244   \item @{text "@{text s}"} prints uninterpreted source text @{text
   251   s}.  This is particularly useful to print portions of text according
   245   s}.  This is particularly useful to print portions of text according
   252   to the Isabelle document style, without demanding well-formedness,
   246   to the Isabelle document style, without demanding well-formedness,
   253   e.g.\ small pieces of terms that should not be parsed or
   247   e.g.\ small pieces of terms that should not be parsed or
   254   type-checked yet.
   248   type-checked yet.
   283 *}
   277 *}
   284 
   278 
   285 
   279 
   286 subsubsection {* Styled antiquotations *}
   280 subsubsection {* Styled antiquotations *}
   287 
   281 
   288 text {* Some antiquotations like @{text thm_style} and @{text
   282 text {* The antiquotations @{text thm}, @{text prop} and @{text
   289   term_style} admit an extra \emph{style} specification to modify the
   283   term} admit an extra \emph{style} specification to modify the
   290   printed result.  The following standard styles are available:
   284   printed result.  A style is specified by a name with a possibly
       
   285   empty number of arguments;  multiple styles can be sequenced with
       
   286   commas.  The following standard styles are available:
   291 
   287 
   292   \begin{description}
   288   \begin{description}
   293   
   289   
   294   \item @{text lhs} extracts the first argument of any application
   290   \item @{text lhs} extracts the first argument of any application
   295   form with at least two arguments --- typically meta-level or
   291   form with at least two arguments --- typically meta-level or
   299   argument.
   295   argument.
   300   
   296   
   301   \item @{text "concl"} extracts the conclusion @{text C} from a rule
   297   \item @{text "concl"} extracts the conclusion @{text C} from a rule
   302   in Horn-clause normal form @{text "A\<^sub>1 \<Longrightarrow> \<dots> A\<^sub>n \<Longrightarrow> C"}.
   298   in Horn-clause normal form @{text "A\<^sub>1 \<Longrightarrow> \<dots> A\<^sub>n \<Longrightarrow> C"}.
   303   
   299   
   304   \item @{text "prem1"}, \dots, @{text "prem9"} extract premise number
   300   \item @{text "prem"} @{text n} extract premise number
   305   @{text "1, \<dots>, 9"}, respectively, from from a rule in Horn-clause
   301   @{text "n"} from from a rule in Horn-clause
   306   normal form @{text "A\<^sub>1 \<Longrightarrow> \<dots> A\<^sub>n \<Longrightarrow> C"}
   302   normal form @{text "A\<^sub>1 \<Longrightarrow> \<dots> A\<^sub>n \<Longrightarrow> C"}
   307 
   303 
   308   \end{description}
   304   \end{description}
   309 *}
   305 *}
   310 
   306