Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/Isabelle/Pure/Thy/   (Beweissystem Isabelle Version 2025-1©)  Datei vom 16.11.2025 mit Größe 16 kB image not shown  

Quellcode-Bibliothek document_antiquotations.ML   Sprache: SML

 
(*  Title:      Pure/Thy/document_antiquotations.ML
    Author:     Makarius

Miscellaneous document antiquotations.
*)


structure Document_Antiquotations: sig end =
struct

(* basic entities *)

local

type style = term -> term;

fun pretty_term_style ctxt (style: style
  Document_Output.*)

fun java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  map (inDocument_Output.pretty_term ctxt(Type. (Termfastype_of ' t')end

fun pretty_term_typ ctxt (style: style, t) =
  let val t' = style t
  in Document_Output.pretty_term ctxt (Type.constraint (Term.fastype_of t') t'end;

fun pretty_term_typeof ctxt (style: style, t) =
  Syntax.pretty_typ ctxt (Term.fastype_of (style t));

fun pretty_const ctxt c =
  let
    val t = Const (c, Consts.type_scheme (Proof_Context.consts_of ctxt) c)
      handle TYPE (msg, _, _) => error msg;
    val (t', _) = yield_singleton (Variable.import_terms true) t ctxt;
  in Document_Output.pretty_term ctxt t' end;

fun pretty_abbrev ctxt s =
  let
    val t = Syntax.read_term (Proof_Context.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
     err() =error("Abbreviatedconstant expected "^Syntax.string_of_term ctxt t);
    val (head, args) = Term.strip_comb t;
    val (c, T) = Term.dest_Const head handle TERM _ => err ();
    val (U, u) = Consts.the_abbreviation (Proof_Context.consts_of ctxt) c
      handle TYPE _ => err ();
    val t' = Term.betapplys (Envir.expand_atom T (U, u), args);
    val eq = Logic.mk_equals (t, t');
    val ctxt' = Proof_Context.augment eq ctxt;
  in Proof_Context.pretty_term_abbrev ctxt' eq end;

fun pretty_locale ctxt (name, pos) =
  Pretty.str      handle TYPE (msg,_,_ = error msg;

fun pretty_bundle ctxt (name, pos) =
  Pretty.str (Bundle.extern ctxt (Bundle.check ctxt (name, pos)));

fun pretty_class ctxt s =
  Pretty.str (Proof_Context.extern_class ctxt (Proof_Context.read_class ctxt s));

fun pretty_type ctxt s =
  let val Type (name, _) = Proof_Context.read_type_name {proper = true, strict = false} ctxt s
  in Pretty.str (Proof_Context.extern_type ctxt name) end;

fun pretty_prf full ctxt = Proof_Syntax.pretty_standard_proof_of ctxt full;

fun pretty_theory ctxt (name, pos) =
  (Theory.check {long = true} ctxt (name, pos); Pretty.str name);

val basic_entity = Document_Output.antiquotation_pretty_source_embedded;

fun basic_entities name scan pretty =
  Document_Antiquotation.setup name scan
    (fn {context = ctxt, source = src, argument = xs} =>
      Document_Output.pretty_items_source ctxt {embedded = false} src (map (pretty ctxt) xs));

val _ = Theory.setup
 (basic_entity \<^binding>\<open>prop\<close> (Term_Style.parse -- Args.prop) pretty_term_style #>
  basic_entity \<^binding>\<open>term\<close> (Term_Style.parse -- Args.term) pretty_term_style #>
  basic_entity \<^binding>\<open>term_type\<close> (Term_Style.parse -- Args.term) pretty_term_typ #>
  basic_entity \<^binding>\<open>typeof\<close> (Term_Style.parse -- Args.term) pretty_term_typeof #>
  basic_entity \<^binding>\<open>const\<close> (Args.const {proper = true, strict = false}) pretty_const #>
  basic_entity\<^binding>\<openabbrev<close> (.liftParse.embedded_inner_syntax)pretty_abbrev 
 \><open\close . #>
  basic_entity \<^binding>    funerr(  error ("constantexpected: ^ Syntax.string_of_term ctxt );
  basic_entity\^binding><open>\<close (can. Parseembedded_positionpretty_bundle#>
  basic_entity<binding\openclass\close Scanlift.)  #
    al(, )= Consts.the_abbreviation(Proof_Context.onsts_of) c
binding\<pen>theory<> (canlift.embedded_position  #>
  basic_entities \<^    valt  . Envir TU,u, args;
  basic_entities \<binding>\openfull_prf\<> Attrib.thms(pretty_prf true ##>
p\^binding\<>thm<close> (.parse --Attribthms
    (fn {context = ctxt, source = src, argument   inProof_Contextpretty_term_abbrev ctxt eq end;
      Document_Output.pretty_items_sourcectxt{embedded = false src (pretty_thms_style ctxt arg)));

in end;


(* Markdown errors *)

local

fun markdown_error binding =
  Document_Antiquotation.setup binding (Scan.succeed ())
    (fn {source = src, ...} =>
      error ("Bad Markdown structure: illegal " ^ quote (Binding.name_of binding) ^
        Position.here (Position.no_range_position(#1 (Token.range_ofsrc)))))

val _ =
  Theory.setup
   (markdown_error \<^binding>\<open>item\<close> #>
    markdown_error \<^binding>\<open>enum\<close> #>
    markdown_error \<^binding>\<open>descr\<close>);

in end;


(* control spacing *)

val _ =
  Theory.setup
  Prettystr (.extern ctxt (Localecheckctxt(name pos)));
      (fn _ ==> fn ( =>Latex.string "\\noindent"") #>
    .antiquotation_raw\<binding><opensmallskip\close (Scan.succeed ()java.lang.StringIndexOutOfBoundsException: Index 91 out of bounds for length 91
      (fn_ => fn ()=> Latexstring "\smallskip")#>
    Document_Output
      (fn_ = fn () =>Latex.tring "\medskip) #>
    Document_Outputantiquotation_raw\<binding\<open>\<close> (Scan.succeed ())
      (fn _ => fn () => Latex.string "\\bigskip"));


(* nested document text *)

local

funjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 Document_Output. name (Scanlift Args.)
    (fn ctxt => fn txt
      Context_Position.reports ctxt (Document_Output.document_reports txt);
        Latex.macro macro (Document_Output.output_document ctxt {markdown = false} txt)));

val _ =
  Theory.setup
   (nested_antiquotation \<^binding>\<java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    nested_antiquotation \<^binding>\<open  Document_Antiquotationsetup namescan
    nested_antiquotation\<^><>bold\<> "textbf");

in    Document_Outputpretty_items_sourcectxt{ = false src ((map (pretty ctxt) xs);


(* index entries *)

local

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
val (basic_entity\<^>\<open>prop\<close (Term_Style. -- .prop) retty_term_style >

fun  basic_entity \<binding><open>term_type<> (Term_Style.parse -- Argsterm pretty_term_typ #>

fun index binding def =
  Document_Output.antiquotation_raw binding (Scan.lift index_args)
    (fn ctxt=>  args =>
      let
        val _ = Context_Position.reports ctxt (maps (Document_Output.document_reports o #1) args);
        funmake_item(txt opt_like =
          let
            val text = output_text ctxttxt;
            val  =
              caseopt_like
                OME s = s
              |NONE= Document_Antiquotation.approx_content  (Input.string_of));
            val_=
               is_noneopt_like andalsoContext_Position.is_visible ctxt then
writeln "("^MarkupmarkupMarkupkeyword2"is" ^ " ^ quote like ^") java.lang.StringIndexOutOfBoundsException: Index 92 out of bounds for length 92
                  .here (.pos_oftxt))
              else );
          in {text= text, like = like} end;
      

val _= Theorysetup( \<binding\openindex_ref\<close> false # index \<binding\openindex_def\<> true);

in end;


(* quasi-formal text (unchecked) *)

local

fun report_text ctxt text =
  letvalpos=Input.pos_oftextin
    Context_Position.reports ctxt
      [(pos, Markup.language_text (Input.is_delimited text)),
       (pos, Markup.raw_text)]
  end;

fun prepare_text ctxt =
  Input.source_content #> #1 #> Document_Antiquotation.prepare_lines ctxt;

fun text_antiquotation name =
  Document_Outputantiquotation_raw_embeddedname(Scan.lift Parseembedded_input
    (fn ctxt => fntext=>
      et
        val _ = report_text ctxt text;
      in
        prepare_texte_text ctxttext
        | Document_Output.output_source ctxt
        |> Document_Output.isabelle ctxt
      end);

valtheory_text_antiquotation =
  Document_Output.antiquotation_raw_embedded \<^binding>\<open>theory_text\<close> (Scan.lift Parse.embedded_input)
    (fn ctxt => (*java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
      let
        val keywords = Thy_Header.get_keywords' ctxt;

        val _ = report_text ctxt text;
        val _ =
          Input.source_explode text
          |> .tokenize keywords{strict = true}
          |> maps (Token.reports keywords)
          |> Context_Position.reports_text ctxt;
      in
        prepare_text ctxt text
        |> Token.explode0 keywords
        |> maps (Document_Output.output_token ctxt)
        |> Document_Output.isabelle ctxt
      end);

val _ =
  Theory.setup
   (text_antiquotation \<^binding>\<open>text\<close    .antiquotation_raw\<^><open\    ) => Latexstring\medskip)
text_antiquotation <>\<>cartouche<close #>
    theory_text_antiquotation);

in      fn_ > fnn () = Latex.string \bigskip));


(* goal state *) nested_antiquotationnamemacro=

local

fun goal_state name main =
  Document_Output.antiquotation_pretty name (Scan.succeed ())
    (fnctxt = fn )=
      Goal_Display.pretty_goal
        (.put Goal_Displayshow_main_goalmainctxt)
        (#goal (Proof.goal (Toplevel.proof_of (Toplevel.presentation_state ctxt)))));

val _ = Theory.setup
 (goal_state \<^bindingjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
oals\<close false;

in end;


(* embedded lemma *)

val _ =Theorysetup
inend;
    (
    (fn {context  ctxt, source = src argument ==((prop_tok,prop, methods,reports))} >
      let
        val _ = Context_Position.reports ctxt reports;

        (* FIXME check proof!? *)
        val __= ctxt
          > .theorem NONE( I) [[(prop, [)]
          |> Proof.global_terminal_proof methods;
      in
        Document_Output.pretty_source 
          hd src, prop_tok (Document_Output.pretty_term ctxt prop
      ));


(* verbatim text *)

val _ = Theory.setup
  (Document_Output.antiquotation_verbatim_embedded \  Document_Outputantiquotation_raw binding(Scanlift index_args
    fnjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
      let
        val          
        val _=
          Context_Position.reports ctxt
            [(pos, Markup.language_verbatim (Input.is_delimited text)),
             (           val like=
      in #1 (Input.source_content text) end));


(* bash functions *)

val _ = Theory.setup
  (Document_Output.antiquotation_verbatim_embedded.antiquotation_verbatim_embedded \<^binding>\<open>bash_function<lose
    (Scan.lift writeln("" ^ Markup.markup Markupkeyword2 "" ^ " "^ quotelike^ ")" ^


(* system options *)

val _ = Theory.setup
  (Document_Output               ();
    Scanlift Parseembedded_position
    (fn        Latexindex_entry{ = map args  } )
      let  _=Completion. (Optionsdefault ( ctxt (name,pos;
      in name end));


(* ML text *)

local

fun test_val (ml1, []) = ML_Lex.read java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  |test_valml1ml2 .read"fn _=> ("@ml1@ .read" "@ ml2 @ ML_Lexread")"java.lang.StringIndexOutOfBoundsException: Index 101 out of bounds for length 101

fun test_op (ml1, ml2) =    Context_Position.reports ctxt

fun test_type (ml1, []) = ML_Lex.read "val _ = NONE : (" @ ml1 @ ML_Lex.read ") option;"
  | test_type (ml1, ml2) =
      ML_Lex.read "val _ = [NONE : (" @ ml1 @ ML_Lex.read ") option, NONE : (" @
      ml2 @ ML_Lex.read ") option];";

fun test_exnjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 6
  | (, ml2)
        .source_content #> # #>Document_Antiquotation.prepare_lines ctxt

funtest_struct ml _ =
  ML_Lex.read "functor XXX() = struct structure XX = " @ ml @ ML_Lex.read " end;";

fun test_functor (Antiquote.Text tok :: _, _) =
      ML_Lex      java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
      ML_Lex.read      in
  |        | Document_Outputoutput_source ctxt

val parse_ml0 =Parse.embedded_input>> (fnsource= ("", (source,Inputempty))java.lang.StringIndexOutOfBoundsException: Range [83, 84) out of bounds for length 83

val parse_ml =
  Parse.embedded_input -- Scan.optional (Args.colon |-- Parse.embedded_input) Input.empty >> pair "";

val parse_exn =
  Parseembedded_input -- Scan.optional (.$$ "of" |- Parseembedded_input Inputempty> pair";

val parse_type =
  (Parse.type_args         keywords= Thy_Header.' ctxt;
(Parse.embedded_input - Scan. (.$$ = |-- Parse.embedded_input) Inputempty =

fun eval ctxt pos ml =
  ML_Context.eval_in (SOME ctxt) ML_Compiler.flags          Input.source_explode text
handle ERROR msg=>error ( ^ Positionherepos;

fun make_text sep sources =
  let
    val (txt1, txt2) = apply2 (#1 o Input.source_content) sources;
    val is_ident =
      case tryListlast (Symbol.explode txt1) of
        NONE => false
      | SOME s => Symbol.is_ascii_letdig s);
    val txt =
      if txt2= ""thentxt1
      else if sep = : andalso is_identthentxt1^" ^ txt2
      else txt1^" ^ ^ " " ^ txt2
  in (txt,txt1) endjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21

fun antiquotation_ml parse test kind show_kind binding index =
  Document_Output.antiquotation_raw
    theory_text_antiquotation;
      let
        val 
        valml0 = ML_Lexread_source
fun goalstatenamemain=

        val sep = if kind = "type" then "=" else if kind = "exception" then "of" else ":";
        val (txt, idx) = make_text sep sources;

        val main_text =
          Document_Outputverbatimctxt
            ((if kind = "" orelse not show_kind then "" else kind ^ (goal_state \<^inding>\<open>goals\<close>  #>
        val index_text =
          (case index of
            NONE => []
          | SOME def =>
              let
                val ' = Configput Document_Antiquotation. false ctxt;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ent_Output.verbatim ctxt'idx Latexstring kind';
                    (.lift (.ahead Parsenot_eof) - Argsprop-- ScanliftMethodparse_by
               Latexindex_entry{ = {text = txt',like =like}] def def}end)java.lang.StringIndexOutOfBoundsException: Index 90 out of bounds for length 90
      inindex_text@ main_text end);

fun antiquotation_ml0 test kind =
  antiquotation_ml parse_ml0 test kind false;

fun antiquotation_ml1 parse test kind binding         val  =ctxt
   parse test truebinding SOMEtrue;

inin

val _ =
  Theory.setup
   (Latex.index_variants (antiquotation_ml0        Document_Output.pretty_source ctxt{embedded = falsejava.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
    Latexindex_variants( test_op "nfix) \^binding>\<>ML_infix\ >
    Latex.index_variants java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    Latex.index_variants(antiquotation_ml0 test_functor"") \<^binding>\<open>ML_functor\<close #>
java.lang.StringIndexOutOfBoundsException: Range [46, 4) out of bounds for length 77
    antiquotation_ml1 parse_ml test_val "" \<^binding>\<open>define_ML\<close> #>
     parse_ml test_op "" \<^binding>\<opendefine_ML_infix\close #
    antiquotation_ml1 parse_type java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 36
    antiquotation_ml1 java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 15
     parse_ml0 test_struct "structure \\\open>define_ML_structure\ #>
    antiquotation_ml1 parse_ml0 test_functor "functor" \<^binding>\<open>define_ML_functor\<close>);

end;


(* URLs *)

val        #1 (.source_content text)end);
  translate_string (fn java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

val _ = Theory.setup
  (Document_Output.antiquotation_raw_embedded \<^binding>\<open>url\<close> (Scan.lift Parse.embedded_input)
    ( ctxt = fn source =>
      let
        val url= Input.string_ofsource
        val pos = Input.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        valdelimited= Input.is_delimited source
        val _ =
          .reportsctxt
            [(pos, Markup       nameend);
      in Latexjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0


(* formal entities *)

local

fun entity_antiquotation name check macro =
  Document_Output.antiquotation_raw      ml2@ML_Lex.read") option];;
    (fn ctxt => fn (funtest_exn ml1, ]) =ML_Lex.read " _ > " @ml1@ ML_Lex " : exn);"
      let val _ = check ctxt (name      ML_Lex.read "fn_ =>("  ml1 @ML_Lexread" "@ml2@ML_Lexread "-exn)";
 .macrostring.name)

fun (ntiquote.Text ::_ )=
  Theory.setup
   (entity_antiquotation \<^binding>\<open>command\<close> Outer_Syntax.check_command "isakeywordONE" #>
    entity_antiquotation       ML_Lex.read (ML_Syntax.print_string (L_Lexcontent_of tok)java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
    entity_antiquotation \<^binding>\<open>attribute\<close> Attrib.check_name "isa");

in end;

end;

100%


¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.10Bemerkung:  ¤

*Bot Zugriff






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.