src/HOL/ex/Cartouche_Examples.thy
changeset 56499 7e0178c84994
parent 56304 40274e4f5ebf
child 56500 90f17a04567d
equal deleted inserted replaced
56498:6437c989a744 56499:7e0178c84994
     4 imports Main
     4 imports Main
     5 keywords
     5 keywords
     6   "cartouche" "term_cartouche" :: diag and
     6   "cartouche" "term_cartouche" :: diag and
     7   "text_cartouche" :: thy_decl
     7   "text_cartouche" :: thy_decl
     8 begin
     8 begin
       
     9 
       
    10 subsection {* Regular outer syntax *}
       
    11 
       
    12 text \<open>Text cartouches may be used in the outer syntax category "text",
       
    13   as alternative to the traditional "verbatim" tokens.  An example is
       
    14   this text block.\<close>  -- \<open>The same works for small side-comments.\<close>
       
    15 
       
    16 notepad
       
    17 begin
       
    18   txt \<open>Moreover, cartouches work as additional syntax in the
       
    19     "altstring" category, for literal fact references.  For example:\<close>
       
    20 
       
    21   fix x y :: 'a
       
    22   assume "x = y"
       
    23   note \<open>x = y\<close>
       
    24   have "x = y" by (rule \<open>x = y\<close>)
       
    25   from \<open>x = y\<close> have "x = y" .
       
    26 
       
    27   txt \<open>Of course, this can be nested inside formal comments and
       
    28     antiquotations, e.g. like this @{thm \<open>x = y\<close>} or this @{thm sym
       
    29     [OF \<open>x = y\<close>]}.\<close>
       
    30 end
       
    31 
     9 
    32 
    10 subsection {* Outer syntax: cartouche within command syntax *}
    33 subsection {* Outer syntax: cartouche within command syntax *}
    11 
    34 
    12 ML {*
    35 ML {*
    13   Outer_Syntax.improper_command @{command_spec "cartouche"} ""
    36   Outer_Syntax.improper_command @{command_spec "cartouche"} ""