Theory Parser_Check
theory Parser_Check
imports Main
keywords "parser_check" :: thy_decl
begin
section ‹A test command: evaluation with cached code›
text ‹⬚‹parser_check ‹t⇩1› … ‹t⇩n›› (also separated by ⬚‹and›) evaluates
each closed boolean term ‹t⇩i› in the ML compiler, as ‹by eval› would, and fails
at the first that is not ‹True›; for an equation it shows the value of the
left-hand side. It proves nothing: it replaces ⬚‹lemma … by eval› where the
lemma is not used afterwards.
The first check that mentions a constant compiles the constant's whole program
into an ML structure of the theory and registers its datatypes for the
evaluation target, as ⬚‹code_reflect› does. A check takes the compiled
constants out of its term as arguments, generates code only for what is left,
and applies it to the compiled values. So the tables of a parser are computed
once per theory chain, not once per check, and the code preprocessor sees only
the small term. A constant with sort constraints is not compiled (its code
takes dictionaries) and costs what it costs under ‹by eval›.›
ML_file ‹parser_check.ML›
end