From 3c6197e6ca8e71a642e067b69943ad853147cacd Mon Sep 17 00:00:00 2001 From: Burkhart Wolff Date: Sun, 25 Oct 2020 12:02:44 +0100 Subject: [PATCH] FINISHED MY PASS ON THE PROGRAMMING MANUAL. --- .../TR_MyCommentedIsabelle.thy | 380 +++++++++--------- 1 file changed, 181 insertions(+), 199 deletions(-) diff --git a/examples/technical_report/TR_my_commented_isabelle/TR_MyCommentedIsabelle.thy b/examples/technical_report/TR_my_commented_isabelle/TR_MyCommentedIsabelle.thy index 541eaff..abc5d5e 100755 --- a/examples/technical_report/TR_my_commented_isabelle/TR_MyCommentedIsabelle.thy +++ b/examples/technical_report/TR_my_commented_isabelle/TR_MyCommentedIsabelle.thy @@ -1816,71 +1816,71 @@ text\ Some more combinators \<^item>\<^ML>\Args.name_token: Token.T parser\ Common Isar Syntax -\<^item>\<^ML>\Args.colon: string parser \ -\<^item>\<^ML>\Args.query: string parser \ -\<^item>\<^ML>\Args.bang: string parser \ -\<^item>\<^ML>\Args.query_colon: string parser \ -\<^item>\<^ML>\Args.bang_colon: string parser \ +\<^item>\<^ML>\Args.colon: string parser\ +\<^item>\<^ML>\Args.query: string parser\ +\<^item>\<^ML>\Args.bang: string parser\ +\<^item>\<^ML>\Args.query_colon: string parser\ +\<^item>\<^ML>\Args.bang_colon: string parser\ \<^item>\<^ML>\Args.parens: 'a parser -> 'a parser\ \<^item>\<^ML>\Args.bracks: 'a parser -> 'a parser\ -\<^item>\<^ML>\Args.mode: string -> bool parser \ -\<^item>\<^ML>\Args.name: string parser \ +\<^item>\<^ML>\Args.mode: string -> bool parser\ +\<^item>\<^ML>\Args.name: string parser\ \<^item>\<^ML>\Args.name_position: (string * Position.T) parser\ -\<^item>\<^ML>\Args.cartouche_inner_syntax: string parser \ -\<^item>\<^ML>\Args.cartouche_input: Input.source parser \ -\<^item>\<^ML>\Args.text_token: Token.T parser \ +\<^item>\<^ML>\Args.cartouche_inner_syntax: string parser\ +\<^item>\<^ML>\Args.cartouche_input: Input.source parser\ +\<^item>\<^ML>\Args.text_token: Token.T parser \ Common Isar Syntax -\<^item>\<^ML>\Args.embedded_token: Token.T parser \ -\<^item>\<^ML>\Args.embedded_inner_syntax: string parser \ -\<^item>\<^ML>\Args.embedded_input: Input.source parser \ -\<^item>\<^ML>\Args.embedded: string parser \ +\<^item>\<^ML>\Args.embedded_token : Token.T parser\ +\<^item>\<^ML>\Args.embedded_inner_syntax: string parser\ +\<^item>\<^ML>\Args.embedded_input : Input.source parser\ +\<^item>\<^ML>\Args.embedded : string parser\ \<^item>\<^ML>\Args.embedded_position: (string * Position.T) parser\ -\<^item>\<^ML>\Args.text_input: Input.source parser \ -\<^item>\<^ML>\Args.text: string parser\ -\<^item>\<^ML>\Args.binding: Binding.binding parser\ +\<^item>\<^ML>\Args.text_input: Input.source parser\ +\<^item>\<^ML>\Args.text : string parser\ +\<^item>\<^ML>\Args.binding : Binding.binding parser\ Common Stuff related to Inner Syntax Parsing -\<^item>\<^ML>\Args.alt_name: string parser \ -\<^item>\<^ML>\Args.liberal_name: string parser \ -\<^item>\<^ML>\Args.var: indexname parser \ -\<^item>\<^ML>\Args.internal_source: Token.src parser \ -\<^item>\<^ML>\Args.internal_name: Token.name_value parser \ -\<^item>\<^ML>\Args.internal_typ: typ parser \ -\<^item>\<^ML>\Args.internal_term: term parser \ -\<^item>\<^ML>\Args.internal_fact: thm list parser \ +\<^item>\<^ML>\Args.alt_name: string parser\ +\<^item>\<^ML>\Args.liberal_name : string parser\ +\<^item>\<^ML>\Args.var: indexname parser\ +\<^item>\<^ML>\Args.internal_source: Token.src parser\ +\<^item>\<^ML>\Args.internal_name: Token.name_value parser\ +\<^item>\<^ML>\Args.internal_typ : typ parser\ +\<^item>\<^ML>\Args.internal_term: term parser\ +\<^item>\<^ML>\Args.internal_fact: thm list parser\ \<^item>\<^ML>\Args.internal_attribute: (morphism -> attribute) parser\ -\<^item>\<^ML>\Args.internal_declaration: declaration parser \ -\<^item>\<^ML>\Args.alt_name: string parser \ -\<^item>\<^ML>\Args.liberal_name: string parser \ +\<^item>\<^ML>\Args.internal_declaration: declaration parser\ +\<^item>\<^ML>\Args.alt_name : string parser\ +\<^item>\<^ML>\Args.liberal_name: string parser\ Common Isar Syntax -\<^item>\<^ML>\Args.named_source: (Token.T -> Token.src) -> Token.src parser \ -\<^item>\<^ML>\Args.named_typ: (string -> typ) -> typ parser \ -\<^item>\<^ML>\Args.named_term: (string -> term) -> term parser \ -\<^item>\<^ML>\Args.text_declaration: (Input.source -> declaration) -> declaration parser \ +\<^item>\<^ML>\Args.named_source: (Token.T -> Token.src) -> Token.src parser\ +\<^item>\<^ML>\Args.named_typ : (string -> typ) -> typ parser\ +\<^item>\<^ML>\Args.named_term : (string -> term) -> term parser\ +\<^item>\<^ML>\Args.text_declaration: (Input.source -> declaration) -> declaration parser\ \<^item>\<^ML>\Args.cartouche_declaration: (Input.source -> declaration) -> declaration parser\ -\<^item>\<^ML>\Args.typ_abbrev: typ context_parser \ -\<^item>\<^ML>\Args.typ: typ context_parser \ -\<^item>\<^ML>\Args.term: term context_parser \ -\<^item>\<^ML>\Args.term_pattern: term context_parser \ -\<^item>\<^ML>\Args.term_abbrev: term context_parser \ -\<^item>\<^ML>\Args.named_source: (Token.T -> Token.src) -> Token.src parser \ -\<^item>\<^ML>\Args.named_typ: (string -> typ) -> typ parser \ -\<^item>\<^ML>\Args.named_term: (string -> term) -> term parser \ -\<^item>\<^ML>\Args.text_declaration: (Input.source -> declaration) -> declaration parser \ +\<^item>\<^ML>\Args.typ_abbrev : typ context_parser\ +\<^item>\<^ML>\Args.typ: typ context_parser\ +\<^item>\<^ML>\Args.term: term context_parser\ +\<^item>\<^ML>\Args.term_pattern: term context_parser\ +\<^item>\<^ML>\Args.term_abbrev : term context_parser \ +\<^item>\<^ML>\Args.named_source: (Token.T -> Token.src) -> Token.src parser\ +\<^item>\<^ML>\Args.named_typ : (string -> typ) -> typ parser\ +\<^item>\<^ML>\Args.named_term: (string -> term) -> term parser\ +\<^item>\<^ML>\Args.text_declaration: (Input.source -> declaration) -> declaration parser\ \<^item>\<^ML>\Args.cartouche_declaration: (Input.source -> declaration) -> declaration parser\ Syntax for some major Pure commands in Isar -\<^item>\<^ML>\Args.prop: term context_parser \ +\<^item>\<^ML>\Args.prop: term context_parser\ \<^item>\<^ML>\Args.type_name: {proper: bool, strict: bool} -> string context_parser\ -\<^item>\<^ML>\Args.const: {proper: bool, strict: bool} -> string context_parser \ -\<^item>\<^ML>\Args.goal_spec: ((int -> tactic) -> tactic) context_parser \ -\<^item>\<^ML>\Args.context: Proof.context context_parser \ -\<^item>\<^ML>\Args.theory: theory context_parser \ +\<^item>\<^ML>\Args.const: {proper: bool, strict: bool} -> string context_parser\ +\<^item>\<^ML>\Args.goal_spec: ((int -> tactic) -> tactic) context_parser\ +\<^item>\<^ML>\Args.context: Proof.context context_parser\ +\<^item>\<^ML>\Args.theory: theory context_parser\ \ @@ -1949,7 +1949,8 @@ text\The heart of the parsers for mathematical notation, based on an Earle text\ Note that the naming underlies the following convention : there are: - \<^enum> "parser"s and type-"checker"s + \<^enum> "parser"s + \<^enum> type-"checker"s, which usually also englobe the markup generation for PIDE \<^enum> "reader"s which do both together with pretty-printing This is encapsulated the data structure @{ML_structure Syntax} --- @@ -1959,15 +1960,15 @@ text\ Note that the naming underlies the following convention : text\ Inner Syntax Parsing combinators for elementary Isabelle Lexems\ text\ -\<^item> \<^ML>\ Syntax.parse_sort : Proof.context -> string -> sort \ -\<^item> \<^ML>\ Syntax.parse_typ : Proof.context -> string -> typ \ -\<^item> \<^ML>\ Syntax.parse_term : Proof.context -> string -> term \ -\<^item> \<^ML>\ Syntax.parse_prop : Proof.context -> string -> term \ -\<^item> \<^ML>\ Syntax.check_term : Proof.context -> term -> term \ -\<^item> \<^ML>\ Syntax.check_props: Proof.context -> term list -> term list \ -\<^item> \<^ML>\ Syntax.uncheck_sort: Proof.context -> sort -> sort \ -\<^item> \<^ML>\ Syntax.uncheck_typs: Proof.context -> typ list -> typ list \ -\<^item> \<^ML>\ Syntax.uncheck_terms: Proof.context -> term list -> term list \ +\<^item> \<^ML>\ Syntax.parse_sort : Proof.context -> string -> sort\ +\<^item> \<^ML>\ Syntax.parse_typ : Proof.context -> string -> typ\ +\<^item> \<^ML>\ Syntax.parse_term : Proof.context -> string -> term\ +\<^item> \<^ML>\ Syntax.parse_prop : Proof.context -> string -> term\ +\<^item> \<^ML>\ Syntax.check_term : Proof.context -> term -> term\ +\<^item> \<^ML>\ Syntax.check_props: Proof.context -> term list -> term list\ +\<^item> \<^ML>\ Syntax.uncheck_sort: Proof.context -> sort -> sort\ +\<^item> \<^ML>\ Syntax.uncheck_typs: Proof.context -> typ list -> typ list\ +\<^item> \<^ML>\ Syntax.uncheck_terms: Proof.context -> term list -> term list\ \ text\In contrast to mere parsing, the following operators provide also type-checking @@ -1977,26 +1978,26 @@ text\In contrast to mere parsing, the following operators provide also typ \<^ML_type>\Proof.context\s.\ text\ -\<^item> \<^ML>\Syntax.read_sort: Proof.context -> string -> sort \ -\<^item> \<^ML>\Syntax.read_typ : Proof.context -> string -> typ \ -\<^item> \<^ML>\Syntax.read_term: Proof.context -> string -> term \ -\<^item> \<^ML>\Syntax.read_typs: Proof.context -> string list -> typ list \ -\<^item> \<^ML>\Syntax.read_sort_global: theory -> string -> sort \ -\<^item> \<^ML>\Syntax.read_typ_global: theory -> string -> typ \ -\<^item> \<^ML>\Syntax.read_term_global: theory -> string -> term \ -\<^item> \<^ML>\Syntax.read_prop_global: theory -> string -> term \ +\<^item> \<^ML>\Syntax.read_sort: Proof.context -> string -> sort\ +\<^item> \<^ML>\Syntax.read_typ : Proof.context -> string -> typ\ +\<^item> \<^ML>\Syntax.read_term: Proof.context -> string -> term\ +\<^item> \<^ML>\Syntax.read_typs: Proof.context -> string list -> typ list\ +\<^item> \<^ML>\Syntax.read_sort_global: theory -> string -> sort\ +\<^item> \<^ML>\Syntax.read_typ_global: theory -> string -> typ\ +\<^item> \<^ML>\Syntax.read_term_global: theory -> string -> term\ +\<^item> \<^ML>\Syntax.read_prop_global: theory -> string -> term\ \ text \The following operations are concerned with the conversion of pretty-prints -and, from there, the generation of (non-layouted) strings.\ -text\ -\<^item> \<^ML>\Syntax.pretty_term:Proof.context -> term -> Pretty.T \ -\<^item> \<^ML>\Syntax.pretty_typ:Proof.context -> typ -> Pretty.T \ -\<^item> \<^ML>\Syntax.pretty_sort:Proof.context -> sort -> Pretty.T \ -\<^item> \<^ML>\Syntax.pretty_classrel: Proof.context -> class list -> Pretty.T \ -\<^item> \<^ML>\Syntax.pretty_arity: Proof.context -> arity -> Pretty.T \ -\<^item> \<^ML>\Syntax.string_of_term: Proof.context -> term -> string \ -\<^item> \<^ML>\Syntax.string_of_typ: Proof.context -> typ -> string \ -\<^item> \<^ML>\Syntax.lookup_const : Syntax.syntax -> string -> string option \ +and, from there, the generation of (non-layouted) strings : + +\<^item> \<^ML>\Syntax.pretty_term:Proof.context -> term -> Pretty.T\ +\<^item> \<^ML>\Syntax.pretty_typ:Proof.context -> typ -> Pretty.T \ +\<^item> \<^ML>\Syntax.pretty_sort:Proof.context -> sort -> Pretty.T \ +\<^item> \<^ML>\Syntax.pretty_classrel: Proof.context -> class list -> Pretty.T\ +\<^item> \<^ML>\Syntax.pretty_arity: Proof.context -> arity -> Pretty.T\ +\<^item> \<^ML>\Syntax.string_of_term: Proof.context -> term -> string \ +\<^item> \<^ML>\Syntax.string_of_typ: Proof.context -> typ -> string \ +\<^item> \<^ML>\Syntax.lookup_const : Syntax.syntax -> string -> string option\ \ @@ -2036,144 +2037,126 @@ text\ subsection*[ex33::example] \Example\ ML\ -(* Recall the Arg-interface to the more high-level, more Isar-specific parsers: *) -Args.name : string parser ; -Args.const : {proper: bool, strict: bool} -> string context_parser; -Args.cartouche_input: Input.source parser; -Args.text_token : Token.T parser; + + (* here follows the definition of the attribute parser : *) + val Z = let val attribute = Parse.position Parse.name -- + Scan.optional (Parse.$$$ "=" |-- Parse.!!! Parse.name) ""; + in (Scan.optional(Parse.$$$ "," |-- (Parse.enum "," attribute))) end ; + + + (* Here is the code to register the above parsers as text antiquotations into the Isabelle + Framework: *) + Thy_Output.antiquotation_pretty_source \<^binding>\theory\ + (Scan.lift (Parse.position Args.embedded)); + + Thy_Output.antiquotation_raw \<^binding>\file\ + (Scan.lift (Parse.position Parse.path)) ; + +\ +text\where we have the registration of the action + \<^ML>\Scan.lift (Parse.position Args.cartouche_input)\ + to be bound to the \name\ as a whole is a system + transaction that, of course, has the type \<^ML_type>\theory -> theory\ : -(* here follows the definition of the attribute parser : *) -val Z = let val attribute = Parse.position Parse.name -- - Scan.optional (Parse.$$$ "=" |-- Parse.!!! Parse.name) ""; - in (Scan.optional(Parse.$$$ "," |-- (Parse.enum "," attribute))) end ; + @{ML [display] \ + (fn name => (Thy_Output.antiquotation_pretty_source + name + (Scan.lift (Parse.position Args.cartouche_input)))) + : binding -> + (Proof.context -> Input.source * Position.T -> Pretty.T) -> + theory -> theory + \} + \ - -(* Here is the code to register the above parsers as text antiquotations into the Isabelle - Framework: *) -Thy_Output.antiquotation_pretty_source \<^binding>\theory\ (Scan.lift (Parse.position Args.embedded)); - -Thy_Output.antiquotation_raw \<^binding>\file\ (Scan.lift (Parse.position Parse.path)) ; - - -(* where we have the registration of the action - - (Scan.lift (Parse.position Args.cartouche_input)))) - - to be bound to the - name - - as a whole is a system transaction that, of course, has the type - - theory -> theory : *) -(fn name => (Thy_Output.antiquotation_pretty_source name - (Scan.lift (Parse.position Args.cartouche_input)))) - : binding -> (Proof.context -> Input.source * Position.T -> Pretty.T) -> theory -> theory; -\ - - section \ Output: Very Low Level \ -text\ For re-directing the output channels, the structure @{ML_structure Output} may be relevant:\ +text\ For re-directing the output channels, the structure \<^ML_structure>\Output\ may be relevant: + \<^ML>\Output.output:string -> string\ is the structure for the "hooks" with the target devices. + \ -ML\ -Output.output; (* output is the structure for the "hooks" with the target devices. *) -Output.output "bla_1:"; -\ +ML\ Output.output "bla_1:" \ text\It provides a number of hooks that can be used for redirection hacks ...\ section \ Output: LaTeX \ text\The heart of the LaTeX generator is to be found in the structure \<^ML_structure>\Thy_Output\. - This is an own parsing and writing process, with the risc that a parsed file in the IDE parsing - process can not be parsed for the LaTeX Generator. The reason is twofold: +This is an own parsing and writing process, with the risc that a parsed file in the IDE parsing +process can not be parsed for the LaTeX Generator. The reason is twofold: + \<^enum> The LaTeX Generator makes a rough attempt to mimic the LayOut if the thy-file; thus, its spacing is relevant. \<^enum> there is a special bracket \(*<*)\ ... \(*>*)\ that allows to specify input that is checked by Isabelle, but excluded from the LaTeX generator (this is handled in an own sub-parser - called @{ML "Document_Source.improper"} where also other forms of comment parsers are provided. + called \<^ML>\Document_Source.improper\ where also other forms of comment parsers are provided. - Since Isabelle2018, an own AST is provided for the LaTeX syntax, analogously to - \<^ML_structure>\Pretty\. Key functions of this structure \<^ML_structure>\Latex\ are: +Since Isabelle2018, an own AST is provided for the LaTeX syntax, analogously to +\<^ML_structure>\Pretty\. Key functions of this structure \<^ML_structure>\Latex\ are: + +\<^item>\<^ML>\Latex.string: string -> Latex.text\ +\<^item>\<^ML>\Latex.text: string * Position.T -> Latex.text\ + +\<^item>\<^ML>\Latex.output_text: Latex.text list -> string\ +\<^item>\<^ML>\Latex.output_positions: Position.T -> Latex.text list -> string\ +\<^item>\<^ML>\Latex.output_name: string -> string\ +\<^item>\<^ML>\Latex.output_ascii: string -> string\ +\<^item>\<^ML>\Latex.output_symbols: Symbol.symbol list -> string\ + +\<^item>\<^ML>\Latex.begin_delim: string -> string\ +\<^item>\<^ML>\Latex.end_delim: string -> string\ +\<^item>\<^ML>\Latex.begin_tag: string -> string\ +\<^item>\<^ML>\Latex.end_tag: string -> string\ +\<^item>\<^ML>\Latex.environment_block: string -> Latex.text list -> Latex.text\ +\<^item>\<^ML>\Latex.environment: string -> string -> string\ + +\<^item>\<^ML>\Latex.block: Latex.text list -> Latex.text\ +\<^item>\<^ML>\Latex.enclose_body: string -> string -> Latex.text list -> Latex.text list\ +\<^item>\<^ML>\Latex.enclose_block: string -> string -> Latex.text list -> Latex.text\ \ -ML\ -local - open Latex - type dummy = text - - val _ = string: string -> text; - val _ = text: string * Position.T -> text - - val _ = output_text: text list -> string - val _ = output_positions: Position.T -> text list -> string - val _ = output_name: string -> string - val _ = output_ascii: string -> string - val _ = output_symbols: Symbol.symbol list -> string - - val _ = begin_delim: string -> string - val _ = end_delim: string -> string - val _ = begin_tag: string -> string - val _ = end_tag: string -> string - val _ = environment_block: string -> text list -> text - val _ = environment: string -> string -> string - - val _ = block: text list -> text - val _ = enclose_body: string -> string -> text list -> text list - val _ = enclose_block: string -> string -> text list -> text - -in val _ = () -end; - -Latex.output_ascii; -Latex.environment "isa" "bg"; -Latex.output_ascii "a_b:c'é"; -(* Note: *) -space_implode "sd &e sf dfg" ["qs","er","alpa"]; - -\ +ML\ Latex.output_ascii; + Latex.environment "isa" "bg"; + Latex.output_ascii "a_b:c'é"; + (* Note: *) + space_implode "sd &e sf dfg" ["qs","er","alpa"]; + \ text\Here is an abstract of the main interface to @{ML_structure Thy_Output}:\ -ML\ - Thy_Output.output_document: Proof.context -> {markdown: bool} -> Input.source -> Latex.text list; - Thy_Output.output_token: Proof.context -> Token.T -> Latex.text list; - Thy_Output.output_source: Proof.context -> string -> Latex.text list; - Thy_Output.present_thy: Options.T -> theory -> Thy_Output.segment list -> Latex.text list; +text\ +\<^item>\<^ML>\Thy_Output.output_document: Proof.context -> {markdown: bool} -> Input.source -> Latex.text list\ +\<^item>\<^ML>\Thy_Output.output_token: Proof.context -> Token.T -> Latex.text list\ +\<^item>\<^ML>\Thy_Output.output_source: Proof.context -> string -> Latex.text list\ +\<^item>\<^ML>\Thy_Output.present_thy: Options.T -> theory -> Thy_Output.segment list -> Latex.text list\ - Thy_Output.isabelle: Proof.context -> Latex.text list -> Latex.text; +\<^item>\<^ML>\Thy_Output.isabelle: Proof.context -> Latex.text list -> Latex.text\ +\<^item>\<^ML>\Thy_Output.isabelle_typewriter: Proof.context -> Latex.text list -> Latex.text\ +\<^item>\<^ML>\Thy_Output.typewriter: Proof.context -> string -> Latex.text\ +\<^item>\<^ML>\Thy_Output.verbatim: Proof.context -> string -> Latex.text\ +\<^item>\<^ML>\Thy_Output.source: Proof.context -> {embedded: bool} -> Token.src -> Latex.text\ +\<^item>\<^ML>\Thy_Output.pretty: Proof.context -> Pretty.T -> Latex.text\ +\<^item>\<^ML>\Thy_Output.pretty_source: Proof.context -> {embedded: bool} -> Token.src -> Pretty.T -> Latex.text\ +\<^item>\<^ML>\Thy_Output.pretty_items: Proof.context -> Pretty.T list -> Latex.text\ +\<^item>\<^ML>\Thy_Output.pretty_items_source: Proof.context -> {embedded: bool} -> Token.src -> Pretty.T list -> Latex.text\ - Thy_Output.isabelle_typewriter: Proof.context -> Latex.text list -> Latex.text; - - Thy_Output.typewriter: Proof.context -> string -> Latex.text; - - Thy_Output.verbatim: Proof.context -> string -> Latex.text; - - Thy_Output.source: Proof.context -> {embedded: bool} -> Token.src -> Latex.text; - - Thy_Output.pretty: Proof.context -> Pretty.T -> Latex.text; - Thy_Output.pretty_source: Proof.context -> {embedded: bool} -> Token.src -> Pretty.T -> Latex.text; - Thy_Output.pretty_items: Proof.context -> Pretty.T list -> Latex.text; - Thy_Output.pretty_items_source: Proof.context -> {embedded: bool} -> Token.src -> Pretty.T list -> Latex.text; -(* finally a number of antiquotation registries : *) - Thy_Output.antiquotation_pretty: - binding -> 'a context_parser -> (Proof.context -> 'a -> Pretty.T) -> theory -> theory; - Thy_Output.antiquotation_pretty_source: - binding -> 'a context_parser -> (Proof.context -> 'a -> Pretty.T) -> theory -> theory; - Thy_Output.antiquotation_raw: - binding -> 'a context_parser -> (Proof.context -> 'a -> Latex.text) -> theory -> theory; - Thy_Output.antiquotation_verbatim: - binding -> 'a context_parser -> (Proof.context -> 'a -> string) -> theory -> theory; +Finally a number of antiquotation registries : +\<^item>\<^ML>\Thy_Output.antiquotation_pretty: + binding -> 'a context_parser -> (Proof.context -> 'a -> Pretty.T) -> theory -> theory\ +\<^item>\<^ML>\Thy_Output.antiquotation_pretty_source: + binding -> 'a context_parser -> (Proof.context -> 'a -> Pretty.T) -> theory -> theory\ +\<^item>\<^ML>\Thy_Output.antiquotation_raw: + binding -> 'a context_parser -> (Proof.context -> 'a -> Latex.text) -> theory -> theory\ +\<^item>\<^ML>\Thy_Output.antiquotation_verbatim: + binding -> 'a context_parser -> (Proof.context -> 'a -> string) -> theory -> theory\ \ -datatype qsd = zef -text\ Thus, @{ML_structure Syntax_Phases} does the actual work of markup generation, including - markup generation and generation of reports. Look at the following snippet: \ -ML\ -(* + +text\ Thus, \<^ML_structure>\Syntax_Phases\ does the actual work of markup generation, including + markup generation and generation of reports. Look at the following snippet: +\ fun check_typs ctxt raw_tys = let val (sorting_report, tys) = Proof_Context.prepare_sortsT ctxt raw_tys; @@ -2183,11 +2166,11 @@ fun check_typs ctxt raw_tys = |> apply_typ_check ctxt |> Term_Sharing.typs (Proof_Context.theory_of ctxt) end; +\ -which is the real implementation behind Syntax.check_typ - -or: +which is the real implementation behind \<^ML>\Syntax.check_typ\ +\ fun check_terms ctxt raw_ts = let val (sorting_report, raw_ts') = Proof_Context.prepare_sorts ctxt raw_ts; @@ -2208,12 +2191,10 @@ fun check_terms ctxt raw_ts = if Context_Position.is_visible ctxt then Output.report (sorting_report @ typing_report) else (); in Term_Sharing.terms (Proof_Context.theory_of ctxt) ts' end; +\ -which is the real implementation behind Syntax.check_term - -As one can see, check-routines internally generate the markup. - -*) +which is the real implementation behind \<^ML>\Syntax.check_term\. As one can see, check-routines +internally generate the markup. \ @@ -2291,15 +2272,16 @@ fun parse_translation_cartouche binding l f_integer accu = \ text\The following registration of this cartouche for strings is fails because it has - already been done in the surrounding Isabelle/DOF environment... \ - (* + already been done in the surrounding Isabelle/DOF environment... + \<^verbatim>\ parse_translation \ [( @{syntax_const "_cartouche_string"} , parse_translation_cartouche \<^binding>\cartouche_type\ Cartouche_Grammar.default (K I) ())] \ - *) + \ +\ -(* test for this cartouche... *) +text\ Test for this cartouche... \ term "\A \ B\ = ''''" @@ -2310,9 +2292,9 @@ text\ This interactive Isabelle Programming Cook-Book represents my curren It differs from the reference manual in some places on purpose, since I believe that a lot of internal Isabelle API's need a more conceptual view on what is happening (even if this conceptual view is at times over-abstracting a little). - It is written in Isabelle/DOF and conceived as "living document" (a term that - I owe Simon Foster), i.e. as hypertext-heavy text making direct references to - the Isabelle API's which were checked whenever this document is re-visited in Isabelle/jEdit. + It is written in Isabelle/DOF and conceived as "living document" (a term that I owe to + Simon Foster), i.e. as hypertext-heavy text making direct references to the Isabelle API's + which were checked whenever this document is re-visited in Isabelle/jEdit. All hints and contributions of collegues and collaborators are greatly welcomed; all errors and the roughness of this presentation is entirely my fault.