Use binding for instances name
ci/woodpecker/push/build Pipeline failed Details

This commit is contained in:
Nicolas Méric 2023-07-20 10:11:48 +02:00
parent b364880bfc
commit 9812bc0517
12 changed files with 130 additions and 121 deletions

View File

@ -635,20 +635,20 @@ text\<open> We present a selection of interaction scenarios @{example \<open>sc
and @{example \<open>cenelec_onto\<close>} with Isabelle/PIDE instrumented by \<^isadof>. \<close> and @{example \<open>cenelec_onto\<close>} with Isabelle/PIDE instrumented by \<^isadof>. \<close>
(*<*) (*<*)
declare_reference*["text-elements"::float] declare_reference*["text_elements"::float]
declare_reference*["hyperlinks"::float] declare_reference*["hyperlinks"::float]
(*>*) (*>*)
subsection*[scholar_pide::example]\<open> A Scholarly Paper \<close> subsection*[scholar_pide::example]\<open> A Scholarly Paper \<close>
text\<open> In @{float (unchecked) "text-elements"}~(a) text\<open> In @{float (unchecked) "text_elements"}~(a)
and @{float (unchecked) "text-elements"}~(b)we show how and @{float (unchecked) "text_elements"}~(b)we show how
hovering over links permits to explore its meta-information. hovering over links permits to explore its meta-information.
Clicking on a document class identifier permits to hyperlink into the corresponding Clicking on a document class identifier permits to hyperlink into the corresponding
class definition (@{float (unchecked) "hyperlinks"}~(a)); hovering over an attribute-definition class definition (@{float (unchecked) "hyperlinks"}~(a)); hovering over an attribute-definition
(which is qualified in order to disambiguate; @{float (unchecked) "hyperlinks"}~(b)). (which is qualified in order to disambiguate; @{float (unchecked) "hyperlinks"}~(b)).
\<close> \<close>
text*["text-elements"::float, text*["text_elements"::float,
main_caption="\<open>Exploring text elements.\<close>"] main_caption="\<open>Exploring text elements.\<close>"]
\<open> \<open>
@{fig_content (width=53, height=5, caption="Exploring a reference of a text element.") "figures/Dogfood-II-bgnd1.png" @{fig_content (width=53, height=5, caption="Exploring a reference of a text element.") "figures/Dogfood-II-bgnd1.png"

View File

@ -102,13 +102,13 @@ text\<open>
functioning of the system and for its integration into the system as a whole. In functioning of the system and for its integration into the system as a whole. In
particular, we need to make the following assumptions explicit: \<^vs>\<open>-0.3cm\<close>\<close> particular, we need to make the following assumptions explicit: \<^vs>\<open>-0.3cm\<close>\<close>
text*["perfect-wheel"::assumption] text*["perfect_wheel"::assumption]
\<open>\<^item> the wheel is perfectly circular with a given, constant radius. \<^vs>\<open>-0.3cm\<close>\<close> \<open>\<^item> the wheel is perfectly circular with a given, constant radius. \<^vs>\<open>-0.3cm\<close>\<close>
text*["no-slip"::assumption] text*["no_slip"::assumption]
\<open>\<^item> the slip between the trains wheel and the track negligible. \<^vs>\<open>-0.3cm\<close>\<close> \<open>\<^item> the slip between the trains wheel and the track negligible. \<^vs>\<open>-0.3cm\<close>\<close>
text*["constant-teeth-dist"::assumption] text*["constant_teeth_dist"::assumption]
\<open>\<^item> the distance between all teeth of a wheel is the same and constant, and \<^vs>\<open>-0.3cm\<close>\<close> \<open>\<^item> the distance between all teeth of a wheel is the same and constant, and \<^vs>\<open>-0.3cm\<close>\<close>
text*["constant-sampling-rate"::assumption] text*["constant_sampling_rate"::assumption]
\<open>\<^item> the sampling rate of positions is a given constant.\<close> \<open>\<^item> the sampling rate of positions is a given constant.\<close>
text\<open> text\<open>
@ -126,13 +126,13 @@ text\<open>
subsection\<open>Capturing ``System Architecture.''\<close> subsection\<open>Capturing ``System Architecture.''\<close>
figure*["three-phase"::figure,relative_width="70",file_src="''figures/three-phase-odo.pdf''"] figure*["three_phase"::figure,relative_width="70",file_src="''figures/three-phase-odo.pdf''"]
\<open>An odometer with three sensors \<open>C1\<close>, \<open>C2\<close>, and \<open>C3\<close>.\<close> \<open>An odometer with three sensors \<open>C1\<close>, \<open>C2\<close>, and \<open>C3\<close>.\<close>
text\<open> text\<open>
The requirements analysis also contains a document \<^doc_class>\<open>SYSAD\<close> The requirements analysis also contains a document \<^doc_class>\<open>SYSAD\<close>
(\<^typ>\<open>system_architecture_description\<close>) that contains technical drawing of the odometer, (\<^typ>\<open>system_architecture_description\<close>) that contains technical drawing of the odometer,
a timing diagram (see \<^figure>\<open>three-phase\<close>), and tables describing the encoding of the position a timing diagram (see \<^figure>\<open>three_phase\<close>), and tables describing the encoding of the position
for the possible signal transitions of the sensors \<open>C1\<close>, \<open>C2\<close>, and \<open>C3\<close>. for the possible signal transitions of the sensors \<open>C1\<close>, \<open>C2\<close>, and \<open>C3\<close>.
\<close> \<close>
@ -146,7 +146,7 @@ text\<open>
sub-system configuration. \<close> sub-system configuration. \<close>
(*<*) (*<*)
declare_reference*["df-numerics-encshaft"::figure] declare_reference*["df_numerics_encshaft"::figure]
(*>*) (*>*)
subsection\<open>Capturing ``Required Performances.''\<close> subsection\<open>Capturing ``Required Performances.''\<close>
text\<open> text\<open>
@ -160,9 +160,9 @@ text\<open>
The requirement analysis document describes the physical environment, the architecture The requirement analysis document describes the physical environment, the architecture
of the measuring device, and the required format and precision of the measurements of the odometry of the measuring device, and the required format and precision of the measurements of the odometry
function as represented (see @{figure (unchecked) "df-numerics-encshaft"}).\<close> function as represented (see @{figure (unchecked) "df_numerics_encshaft"}).\<close>
figure*["df-numerics-encshaft"::figure,relative_width="76",file_src="''figures/df-numerics-encshaft.png''"] figure*["df_numerics_encshaft"::figure,relative_width="76",file_src="''figures/df-numerics-encshaft.png''"]
\<open>Real distance vs. discrete distance vs. shaft-encoder sequence\<close> \<open>Real distance vs. discrete distance vs. shaft-encoder sequence\<close>
@ -215,7 +215,7 @@ text\<open>
concepts such as Cauchy Sequences, limits, differentiability, and a very substantial part of concepts such as Cauchy Sequences, limits, differentiability, and a very substantial part of
classical Calculus. \<open>SOME\<close> is the Hilbert choice operator from HOL; the definitions of the classical Calculus. \<open>SOME\<close> is the Hilbert choice operator from HOL; the definitions of the
model parameters admit all possible positive values as uninterpreted constants. Our model parameters admit all possible positive values as uninterpreted constants. Our
\<^assumption>\<open>perfect-wheel\<close> is translated into a calculation of the circumference of the \<^assumption>\<open>perfect_wheel\<close> is translated into a calculation of the circumference of the
wheel, while \<open>\<delta>s\<^sub>r\<^sub>e\<^sub>s\<close>, the resolution of the odometer, can be calculated wheel, while \<open>\<delta>s\<^sub>r\<^sub>e\<^sub>s\<close>, the resolution of the odometer, can be calculated
from the these parameters. HOL-Analysis permits to formalize the fundamental physical observables: from the these parameters. HOL-Analysis permits to formalize the fundamental physical observables:
\<close> \<close>

View File

@ -807,7 +807,7 @@ text\<open> They reflect the Pure logic depicted in a number of presentations s
Notated as logical inference rules, these operations were presented as follows: Notated as logical inference rules, these operations were presented as follows:
\<close> \<close>
text*["text-elements"::float, text*["text_elements"::float,
main_caption="\<open>Kernel Inference Rules.\<close>"] main_caption="\<open>Kernel Inference Rules.\<close>"]
\<open> \<open>
@{fig_content (width=48, caption="Pure Kernel Inference Rules I.") "figures/pure-inferences-I.pdf" @{fig_content (width=48, caption="Pure Kernel Inference Rules I.") "figures/pure-inferences-I.pdf"

View File

@ -390,11 +390,11 @@ text-latex\<open>
ML\<open> ML\<open>
fun gen_enriched_document_command3 name {body} cid_transform attr_transform markdown fun gen_enriched_document_command3 name {body} cid_transform attr_transform markdown
(((((oid,pos),cid_pos), doc_attrs) : ODL_Meta_Args_Parser.meta_args_t, ((((binding,cid_pos), doc_attrs) : ODL_Meta_Args_Parser.meta_args_t,
xstring_opt:(xstring * Position.T) option), xstring_opt:(xstring * Position.T) option),
toks:Input.source list) toks:Input.source list)
= gen_enriched_document_command2 name {body=body} cid_transform attr_transform markdown = gen_enriched_document_command2 name {body=body} cid_transform attr_transform markdown
(((((oid,pos),cid_pos), doc_attrs) : ODL_Meta_Args_Parser.meta_args_t, ((((binding,cid_pos), doc_attrs) : ODL_Meta_Args_Parser.meta_args_t,
xstring_opt:(xstring * Position.T) option), xstring_opt:(xstring * Position.T) option),
toks) \<comment> \<open>Hack : drop second and thrd args.\<close> toks) \<comment> \<open>Hack : drop second and thrd args.\<close>

View File

@ -382,11 +382,11 @@ text-latex\<open>
ML\<open> ML\<open>
fun gen_enriched_document_command3 name {body} cid_transform attr_transform markdown fun gen_enriched_document_command3 name {body} cid_transform attr_transform markdown
(((((oid,pos),cid_pos), doc_attrs) : ODL_Meta_Args_Parser.meta_args_t, ((((binding,cid_pos), doc_attrs) : ODL_Meta_Args_Parser.meta_args_t,
xstring_opt:(xstring * Position.T) option), xstring_opt:(xstring * Position.T) option),
toks:Input.source list) toks:Input.source list)
= gen_enriched_document_command2 name {body=body} cid_transform attr_transform markdown = gen_enriched_document_command2 name {body=body} cid_transform attr_transform markdown
(((((oid,pos),cid_pos), doc_attrs) : ODL_Meta_Args_Parser.meta_args_t, ((((binding,cid_pos), doc_attrs) : ODL_Meta_Args_Parser.meta_args_t,
xstring_opt:(xstring * Position.T) option), xstring_opt:(xstring * Position.T) option),
toks) \<comment> \<open>Hack : drop second and thrd args.\<close> toks) \<comment> \<open>Hack : drop second and thrd args.\<close>

View File

@ -38,7 +38,8 @@ fun gen_enriched_document_command2 name {body} cid_transform attr_transform mark
toks_list:Input.source list) toks_list:Input.source list)
: theory -> theory = : theory -> theory =
let val toplvl = Toplevel.theory_toplevel let val toplvl = Toplevel.theory_toplevel
val (((oid,pos),cid_pos), doc_attrs) = meta_args val ((binding,cid_pos), doc_attrs) = meta_args
val oid = Binding.name_of binding
val oid' = if meta_args = ODL_Meta_Args_Parser.empty_meta_args val oid' = if meta_args = ODL_Meta_Args_Parser.empty_meta_args
then "output" then "output"
else oid else oid
@ -74,7 +75,7 @@ fun gen_enriched_document_command2 name {body} cid_transform attr_transform mark
else else
Value_Command.Docitem_Parser.create_and_check_docitem Value_Command.Docitem_Parser.create_and_check_docitem
{is_monitor = false} {is_inline = false} {define = true} {is_monitor = false} {is_inline = false} {define = true}
oid pos (cid_transform cid_pos) (attr_transform doc_attrs)) binding (cid_transform cid_pos) (attr_transform doc_attrs))
(* ... generating the level-attribute syntax *) (* ... generating the level-attribute syntax *)
in handle_margs_opt #> (fn thy => (app (check_n_tex_text thy) toks_list; thy)) in handle_margs_opt #> (fn thy => (app (check_n_tex_text thy) toks_list; thy))
end; end;
@ -139,10 +140,10 @@ val _ =
>> (Toplevel.theory o update_instance_command)); >> (Toplevel.theory o update_instance_command));
val _ = val _ =
let fun create_and_check_docitem ((((oid, pos),cid_pos),doc_attrs),src) thy = let fun create_and_check_docitem (((binding,cid_pos),doc_attrs),src) thy =
(Value_Command.Docitem_Parser.create_and_check_docitem (Value_Command.Docitem_Parser.create_and_check_docitem
{is_monitor = false} {is_inline=true} {is_monitor = false} {is_inline=true}
{define = false} oid pos (cid_pos) (doc_attrs) thy) {define = false} binding (cid_pos) (doc_attrs) thy)
handle ERROR msg => (if error_match src msg handle ERROR msg => (if error_match src msg
then (writeln ("Correct error: "^msg^": reported.");thy) then (writeln ("Correct error: "^msg^": reported.");thy)
else error"Wrong error reported") else error"Wrong error reported")

View File

@ -429,11 +429,11 @@ fun convert_src_from_margs ctxt (X, (((str,_),value)::R)) =
fun float_command (name, pos) descr cid = fun float_command (name, pos) descr cid =
let fun set_default_class NONE = SOME(cid,pos) let fun set_default_class NONE = SOME(cid,pos)
|set_default_class (SOME X) = SOME X |set_default_class (SOME X) = SOME X
fun create_instance ((((oid, pos),cid_pos), doc_attrs) : ODL_Meta_Args_Parser.meta_args_t) = fun create_instance (((binding,cid_pos), doc_attrs) : ODL_Meta_Args_Parser.meta_args_t) =
Value_Command.Docitem_Parser.create_and_check_docitem Value_Command.Docitem_Parser.create_and_check_docitem
{is_monitor = false} {is_monitor = false}
{is_inline = true} {is_inline = true}
{define = true} oid pos (set_default_class cid_pos) doc_attrs {define = true} binding (set_default_class cid_pos) doc_attrs
fun generate_fig_ltx_ctxt ctxt cap_src oid body = fun generate_fig_ltx_ctxt ctxt cap_src oid body =
Latex.macro0 "centering" Latex.macro0 "centering"
@ body @ body
@ -441,25 +441,31 @@ fun float_command (name, pos) descr cid =
@ Latex.macro "label" (DOF_core.get_instance_name_global oid (Proof_Context.theory_of ctxt) @ Latex.macro "label" (DOF_core.get_instance_name_global oid (Proof_Context.theory_of ctxt)
|> DOF_core.output_name |> DOF_core.output_name
|> Latex.string) |> Latex.string)
fun parse_and_tex (margs as (((oid, _),_), _), cap_src) ctxt = fun parse_and_tex (margs as ((binding,_), _), cap_src) ctxt =
(convert_src_from_margs ctxt margs) let val oid = Binding.name_of binding
|> pair (upd_caption (K Input.empty) #> convert_meta_args ctxt margs) in
|> fig_content ctxt (convert_src_from_margs ctxt margs)
|> generate_fig_ltx_ctxt ctxt cap_src oid |> pair (upd_caption (K Input.empty) #> convert_meta_args ctxt margs)
|> (Latex.environment ("figure") ) |> fig_content ctxt
|> generate_fig_ltx_ctxt ctxt cap_src oid
|> (Latex.environment ("figure") )
end
in Monitor_Command_Parser.onto_macro_cmd_command (name, pos) descr create_instance parse_and_tex in Monitor_Command_Parser.onto_macro_cmd_command (name, pos) descr create_instance parse_and_tex
end end
fun listing_command (name, pos) descr cid = fun listing_command (name, pos) descr cid =
let fun set_default_class NONE = SOME(cid,pos) let fun set_default_class NONE = SOME(cid,pos)
|set_default_class (SOME X) = SOME X |set_default_class (SOME X) = SOME X
fun create_instance ((((oid, pos),cid_pos), doc_attrs) : ODL_Meta_Args_Parser.meta_args_t) = fun create_instance (((binding,cid_pos), doc_attrs) : ODL_Meta_Args_Parser.meta_args_t) =
Value_Command.Docitem_Parser.create_and_check_docitem Value_Command.Docitem_Parser.create_and_check_docitem
{is_monitor = false} {is_monitor = false}
{is_inline = true} {is_inline = true}
{define = true} oid pos (set_default_class cid_pos) doc_attrs {define = true} binding (set_default_class cid_pos) doc_attrs
fun parse_and_tex (margs as (((_, pos),_), _), _) _ = fun parse_and_tex (margs as ((binding,_), _), _) _ =
ISA_core.err ("Not yet implemented.\n Please use text*[oid::listing]\<open>\<close> instead.") pos let val pos = Binding.pos_of binding
in
ISA_core.err ("Not yet implemented.\n Please use text*[oid::listing]\<open>\<close> instead.") pos
end
in Monitor_Command_Parser.onto_macro_cmd_command (name, pos) descr create_instance parse_and_tex in Monitor_Command_Parser.onto_macro_cmd_command (name, pos) descr create_instance parse_and_tex
end end
@ -858,11 +864,11 @@ fun convert_meta_args ctxt (X, (((str,_),value) :: R)) =
fun frame_command (name, pos) descr cid = fun frame_command (name, pos) descr cid =
let fun set_default_class NONE = SOME(cid,pos) let fun set_default_class NONE = SOME(cid,pos)
|set_default_class (SOME X) = SOME X |set_default_class (SOME X) = SOME X
fun create_instance ((((oid, pos),cid_pos), doc_attrs) : ODL_Meta_Args_Parser.meta_args_t) = fun create_instance (((binding,cid_pos), doc_attrs) : ODL_Meta_Args_Parser.meta_args_t) =
Value_Command.Docitem_Parser.create_and_check_docitem Value_Command.Docitem_Parser.create_and_check_docitem
{is_monitor = false} {is_monitor = false}
{is_inline = true} {is_inline = true}
{define = true} oid pos (set_default_class cid_pos) doc_attrs {define = true} binding (set_default_class cid_pos) doc_attrs
fun titles_src ctxt frametitle framesubtitle src = fun titles_src ctxt frametitle framesubtitle src =
Latex.string "{" Latex.string "{"
@ Document_Output.output_document ctxt {markdown = false} frametitle @ Document_Output.output_document ctxt {markdown = false} frametitle

View File

@ -747,11 +747,10 @@ fun define_doc_class_global (params', binding) parent fields rexp reject_Atoms i
, rejectS, reg_exps, invs')) , rejectS, reg_exps, invs'))
end end
fun define_object_global {define = define} ((oid, pos), instance) thy = fun define_object_global {define = define} (binding, instance) thy =
let let
val binding = if Long_Name.is_qualified oid val oid = Binding.name_of binding
then Binding.make (Long_Name.base_name oid, pos) val pos = Binding.pos_of binding
else Binding.make (oid, pos)
val _ = if oid = undefined_instance val _ = if oid = undefined_instance
then error (oid ^ ": This name is reserved by the implementation" ^ Position.here pos) then error (oid ^ ": This name is reserved by the implementation" ^ Position.here pos)
else () else ()
@ -1411,11 +1410,10 @@ ML\<open>
structure ODL_Meta_Args_Parser = structure ODL_Meta_Args_Parser =
struct struct
type meta_args_t = ((string * Position.T) * type meta_args_t = (binding * (string * Position.T) option)
(string * Position.T) option) * ((string * Position.T) * string) list
* ((string * Position.T) * string) list
val empty_meta_args = ((("", Position.none), NONE), []) val empty_meta_args = ((Binding.empty, NONE), [])
val is_improper = not o (Token.is_proper orf Token.is_begin_ignore orf Token.is_end_ignore); val is_improper = not o (Token.is_proper orf Token.is_begin_ignore orf Token.is_end_ignore);
val improper = Scan.many is_improper; (* parses white-space and comments *) val improper = Scan.many is_improper; (* parses white-space and comments *)
@ -1435,7 +1433,7 @@ val attribute_upd : (((string * Position.T) * string) * string) parser =
: (((string * Position.T) * string) * string) parser; : (((string * Position.T) * string) * string) parser;
val reference = val reference =
Parse.position Parse.name Parse.binding
--| improper --| improper
-- Scan.option (Parse.$$$ "::" -- Scan.option (Parse.$$$ "::"
-- improper -- improper
@ -1553,7 +1551,7 @@ fun cid_2_cidType cid_long thy =
in fold (fn x => fn y => Type(ty_name x,[y])) (fathers cid_long) \<^Type>\<open>unit\<close> in fold (fn x => fn y => Type(ty_name x,[y])) (fathers cid_long) \<^Type>\<open>unit\<close>
end end
fun create_default_object thy oid class_name typ = fun create_default_object thy binding class_name typ =
let let
val purified_class_name = String.translate (fn #"." => "_" | x => String.implode [x]) class_name val purified_class_name = String.translate (fn #"." => "_" | x => String.implode [x]) class_name
fun attr_to_s (binding, _, _) = purified_class_name ^ "_" fun attr_to_s (binding, _, _) = purified_class_name ^ "_"
@ -1583,11 +1581,8 @@ fun create_default_object thy oid class_name typ =
val term = test_class |> cons (Long_Name.qualify class_name makeN) |> space_implode Symbol.space val term = test_class |> cons (Long_Name.qualify class_name makeN) |> space_implode Symbol.space
val ctxt = Proof_Context.init_global thy val ctxt = Proof_Context.init_global thy
val term' = term |> Syntax.parse_term ctxt |> DOF_core.elaborate_term' ctxt val term' = term |> Syntax.parse_term ctxt |> DOF_core.elaborate_term' ctxt
(* rename oid to be compatible with binding naming policy *) val parsed_prop = Const (\<^const_name>\<open>Pure.eq\<close>, dummyT) $ Free (Binding.name_of binding, dummyT) $ term'
val clean_oid = translate_string (fn ":" => "_" | "-" => "_" | c => c); val raw_vars = [(binding, SOME typ, NoSyn)]
val oid' = clean_oid oid
val parsed_prop = Const (\<^const_name>\<open>Pure.eq\<close>, dummyT) $ Free (oid', dummyT) $ term'
val raw_vars = [(Binding.name oid', SOME typ, NoSyn)]
val (_, vars_ctxt) = DOF_core.prep_decls Proof_Context.cert_var raw_vars ctxt val (_, vars_ctxt) = DOF_core.prep_decls Proof_Context.cert_var raw_vars ctxt
val concl = Syntax.check_prop vars_ctxt parsed_prop val concl = Syntax.check_prop vars_ctxt parsed_prop
in Logic.dest_equals concl |> snd end in Logic.dest_equals concl |> snd end
@ -1685,8 +1680,9 @@ fun msg_intro get n oid cid = ("accepts clause " ^ Int.toString n
^ get (" not enabled for", " rejected") ^ get (" not enabled for", " rejected")
^ " doc_class: " ^ cid) ^ " doc_class: " ^ cid)
fun register_oid_cid_in_open_monitors oid _ (name, pos') thy = fun register_oid_cid_in_open_monitors binding (name, pos') thy =
let let
val oid = Binding.name_of binding
val cid_long= name val cid_long= name
fun is_enabled (n, monitor_info) = fun is_enabled (n, monitor_info) =
if exists (DOF_core.is_subclass_global thy cid_long) if exists (DOF_core.is_subclass_global thy cid_long)
@ -1784,8 +1780,9 @@ fun register_oid_cid_in_open_monitors oid _ (name, pos') thy =
DOF_core.Monitor_Info.map (fold update_info delta_autoS) DOF_core.Monitor_Info.map (fold update_info delta_autoS)
end end
fun check_invariants thy (oid, _) = fun check_invariants thy binding =
let let
val oid = Binding.name_of binding
val docitem_value = DOF_core.value_of oid thy val docitem_value = DOF_core.value_of oid thy
val name = DOF_core.cid_of oid thy val name = DOF_core.cid_of oid thy
|> DOF_core.get_onto_class_cid thy |> (fst o fst) |> DOF_core.get_onto_class_cid thy |> (fst o fst)
@ -1866,8 +1863,9 @@ fun check_invariants thy (oid, _) =
in thy end in thy end
fun create_and_check_docitem is_monitor {is_inline=is_inline} {define=define} oid pos cid_pos doc_attrs thy = fun create_and_check_docitem is_monitor {is_inline=is_inline} {define=define} binding cid_pos doc_attrs thy =
let let
val oid = Binding.name_of binding
val (((name, args_cid), typ), pos') = check_classref is_monitor cid_pos thy val (((name, args_cid), typ), pos') = check_classref is_monitor cid_pos thy
val cid_pos' = (name, pos') val cid_pos' = (name, pos')
val cid_long = fst cid_pos' val cid_long = fst cid_pos'
@ -1888,7 +1886,7 @@ fun create_and_check_docitem is_monitor {is_inline=is_inline} {define=define} oi
else let else let
fun conv_attrs ((lhs, pos), rhs) = (YXML.content_of lhs,pos,"=", Syntax.parse_term (Proof_Context.init_global thy) rhs) fun conv_attrs ((lhs, pos), rhs) = (YXML.content_of lhs,pos,"=", Syntax.parse_term (Proof_Context.init_global thy) rhs)
val assns' = map conv_attrs doc_attrs val assns' = map conv_attrs doc_attrs
val defaults_init = create_default_object thy oid cid_long typ val defaults_init = create_default_object thy binding cid_long typ
fun conv (na, _(*ty*), parsed_term) =(Binding.name_of na, Binding.pos_of na, "=", parsed_term); fun conv (na, _(*ty*), parsed_term) =(Binding.name_of na, Binding.pos_of na, "=", parsed_term);
val S = map conv (DOF_core.get_attribute_defaults cid_long thy); val S = map conv (DOF_core.get_attribute_defaults cid_long thy);
val (defaults, _(*ty*), _) = calc_update_term {mk_elaboration=false} val (defaults, _(*ty*), _) = calc_update_term {mk_elaboration=false}
@ -1902,12 +1900,12 @@ fun create_and_check_docitem is_monitor {is_inline=is_inline} {define=define} oi
in (input_term, value_term') end in (input_term, value_term') end
else (\<^term>\<open>()\<close>, value_term') end else (\<^term>\<open>()\<close>, value_term') end
in thy |> DOF_core.define_object_global in thy |> DOF_core.define_object_global
{define = define} ((oid, pos), DOF_core.make_instance {define = define} (binding, DOF_core.make_instance
(false, fst value_terms, (false, fst value_terms,
(snd value_terms) (snd value_terms)
|> value (Proof_Context.init_global thy), |> value (Proof_Context.init_global thy),
is_inline, args_cid, vcid)) is_inline, args_cid, vcid))
|> register_oid_cid_in_open_monitors oid pos (name, pos') |> register_oid_cid_in_open_monitors binding (name, pos')
|> (fn thy => |> (fn thy =>
if (* declare_reference* without arguments is not checked against invariants *) if (* declare_reference* without arguments is not checked against invariants *)
thy |> DOF_core.defined_of oid |> not thy |> DOF_core.defined_of oid |> not
@ -1925,18 +1923,18 @@ fun create_and_check_docitem is_monitor {is_inline=is_inline} {define=define} oi
ex: text*[sdf]\<open> Lorem ipsum @{thm refl}\<close> *) ex: text*[sdf]\<open> Lorem ipsum @{thm refl}\<close> *)
|> (fn thy => if default_cid then thy |> (fn thy => if default_cid then thy
else if Config.get_global thy DOF_core.invariants_checking else if Config.get_global thy DOF_core.invariants_checking
then check_invariants thy (oid, pos) else thy)) then check_invariants thy binding else thy))
end end
end (* structure Docitem_Parser *) end (* structure Docitem_Parser *)
fun meta_args_exec (meta_args as (((oid, pos), cid_pos), doc_attrs) : ODL_Meta_Args_Parser.meta_args_t) thy = fun meta_args_exec (meta_args as ((binding, cid_pos), doc_attrs) : ODL_Meta_Args_Parser.meta_args_t) thy =
thy |> (if meta_args = ODL_Meta_Args_Parser.empty_meta_args thy |> (if meta_args = ODL_Meta_Args_Parser.empty_meta_args
then (K thy) then (K thy)
else Docitem_Parser.create_and_check_docitem else Docitem_Parser.create_and_check_docitem
{is_monitor = false} {is_inline = true} {define = true} {is_monitor = false} {is_inline = true} {define = true}
oid pos (I cid_pos) (I doc_attrs)) binding (I cid_pos) (I doc_attrs))
fun value_cmd {assert=assert} meta_args_opt raw_name modes raw_t pos thy = fun value_cmd {assert=assert} meta_args_opt raw_name modes raw_t pos thy =
let let
@ -2082,16 +2080,17 @@ end; (* structure Value_Command *)
structure Monitor_Command_Parser = structure Monitor_Command_Parser =
struct struct
fun update_instance_command (((oid, pos), cid_pos), fun update_instance_command ((binding, cid_pos),
doc_attrs: (((string*Position.T)*string)*string)list) thy doc_attrs: (((string*Position.T)*string)*string)list) thy
: theory = : theory =
let val cid = let val DOF_core.Instance {cid,...} = let val oid = Binding.name_of binding
val cid = let val DOF_core.Instance {cid,...} =
DOF_core.get_instance_global oid thy DOF_core.get_instance_global oid thy
val ctxt = Proof_Context.init_global thy val ctxt = Proof_Context.init_global thy
val instances = DOF_core.get_instances ctxt val instances = DOF_core.get_instances ctxt
val markup = DOF_core.get_instance_name_global oid thy val markup = DOF_core.get_instance_name_global oid thy
|> Name_Space.markup (Name_Space.space_of_table instances) |> Name_Space.markup (Name_Space.space_of_table instances)
val _ = Context_Position.report ctxt pos markup; val _ = Context_Position.report ctxt (Binding.pos_of binding) markup;
in cid end in cid end
val default_cid = cid = DOF_core.default_cid val default_cid = cid = DOF_core.default_cid
val (((name, cid'), typ), pos') = Value_Command.Docitem_Parser.check_classref {is_monitor = false} val (((name, cid'), typ), pos') = Value_Command.Docitem_Parser.check_classref {is_monitor = false}
@ -2127,7 +2126,7 @@ fun update_instance_command (((oid, pos), cid_pos),
ex: text*[sdf]\<open> Lorem ipsum @{thm refl}\<close> *) ex: text*[sdf]\<open> Lorem ipsum @{thm refl}\<close> *)
|> (fn thy => if default_cid then thy |> (fn thy => if default_cid then thy
else if Config.get_global thy DOF_core.invariants_checking else if Config.get_global thy DOF_core.invariants_checking
then Value_Command.Docitem_Parser.check_invariants thy (oid, pos) then Value_Command.Docitem_Parser.check_invariants thy binding
else thy) else thy)
end end
@ -2136,39 +2135,41 @@ fun update_instance_command (((oid, pos), cid_pos),
them out into the COL -- bu *) them out into the COL -- bu *)
fun open_monitor_command ((((oid, pos), raw_parent_pos), doc_attrs) : ODL_Meta_Args_Parser.meta_args_t) thy = fun open_monitor_command (((binding, raw_parent_pos), doc_attrs) : ODL_Meta_Args_Parser.meta_args_t) thy =
let fun o_m_c oid pos params_cid_pos doc_attrs thy = let fun o_m_c binding params_cid_pos doc_attrs thy =
Value_Command.Docitem_Parser.create_and_check_docitem Value_Command.Docitem_Parser.create_and_check_docitem
{is_monitor=true} (* this is a monitor *) {is_monitor=true} (* this is a monitor *)
{is_inline=false} (* monitors are always inline *) {is_inline=false} (* monitors are always inline *)
{define=true} {define=true}
oid pos params_cid_pos doc_attrs thy binding params_cid_pos doc_attrs thy
fun compute_enabled_set cid thy = fun compute_enabled_set cid thy =
let let
val DOF_core.Onto_Class X = DOF_core.get_onto_class_global' cid thy val DOF_core.Onto_Class X = DOF_core.get_onto_class_global' cid thy
val ralph = RegExpInterface.alphabet (#rejectS X) val ralph = RegExpInterface.alphabet (#rejectS X)
val aalph = RegExpInterface.alphabet (#rex X) val aalph = RegExpInterface.alphabet (#rex X)
in (aalph, ralph, map (RegExpInterface.rexp_term2da thy aalph)(#rex X)) end in (aalph, ralph, map (RegExpInterface.rexp_term2da thy aalph)(#rex X)) end
fun create_monitor_entry oid thy = fun create_monitor_entry thy =
let val cid = case raw_parent_pos of let val cid = case raw_parent_pos of
NONE => ISA_core.err ("You must specified a monitor class.") pos NONE => ISA_core.err ("You must specified a monitor class.") (Binding.pos_of binding)
| SOME (raw_parent, _) => | SOME (raw_parent, _) =>
DOF_core.markup2string raw_parent DOF_core.markup2string raw_parent
|> DOF_core.get_onto_class_cid thy |> (fst o fst) |> DOF_core.get_onto_class_cid thy |> (fst o fst)
val (accS, rejectS, aS) = compute_enabled_set cid thy val (accS, rejectS, aS) = compute_enabled_set cid thy
in DOF_core.add_monitor_info (Binding.make (oid, pos)) in DOF_core.add_monitor_info binding
(DOF_core.make_monitor_info (accS, rejectS, aS)) thy (DOF_core.make_monitor_info (accS, rejectS, aS)) thy
end end
in in
thy thy
|> o_m_c oid pos raw_parent_pos doc_attrs |> o_m_c binding raw_parent_pos doc_attrs
|> create_monitor_entry oid |> create_monitor_entry
end; end;
fun close_monitor_command (args as (((oid, pos), cid_pos), fun close_monitor_command (args as ((binding, cid_pos),
_: (((string*Position.T)*string)*string)list)) thy = _: (((string*Position.T)*string)*string)list)) thy =
let fun check_if_final aS = let val i = (find_index (not o RegExpInterface.final) aS) + 1 let val oid = Binding.name_of binding
val pos = Binding.pos_of binding
fun check_if_final aS = let val i = (find_index (not o RegExpInterface.final) aS) + 1
in if i >= 1 in if i >= 1
then then
Value_Command.Docitem_Parser.msg thy Value_Command.Docitem_Parser.msg thy
@ -2192,17 +2193,18 @@ fun close_monitor_command (args as (((oid, pos), cid_pos),
|> update_instance_command args |> update_instance_command args
|> tap (DOF_core.check_ml_invs cid_long oid {is_monitor=true}) |> tap (DOF_core.check_ml_invs cid_long oid {is_monitor=true})
|> (fn thy => if Config.get_global thy DOF_core.invariants_checking |> (fn thy => if Config.get_global thy DOF_core.invariants_checking
then Value_Command.Docitem_Parser.check_invariants thy (oid, pos) then Value_Command.Docitem_Parser.check_invariants thy binding
else thy) else thy)
|> delete_monitor_entry |> delete_monitor_entry
end end
fun meta_args_2_latex thy sem_attrs transform_attr fun meta_args_2_latex thy sem_attrs transform_attr
((((lab, pos), cid_opt), attr_list) : ODL_Meta_Args_Parser.meta_args_t) = (((binding, cid_opt), attr_list) : ODL_Meta_Args_Parser.meta_args_t) =
(* for the moment naive, i.e. without textual normalization of (* for the moment naive, i.e. without textual normalization of
attribute names and adapted term printing *) attribute names and adapted term printing *)
let val l = DOF_core.get_instance_name_global lab thy |> DOF_core.output_name let val lab = Binding.name_of binding
val l = DOF_core.get_instance_name_global lab thy |> DOF_core.output_name
|> enclose "{" "}" |> enclose "{" "}"
|> prefix "label = " |> prefix "label = "
val ((cid_long, _), _) = case cid_opt of val ((cid_long, _), _) = case cid_opt of
@ -2272,7 +2274,7 @@ fun meta_args_2_latex thy sem_attrs transform_attr
then (name, DOF_core.output_name value') then (name, DOF_core.output_name value')
else ISA_core.err ("Bad name of semantic attribute" else ISA_core.err ("Bad name of semantic attribute"
^ name ^ ": " ^ value ^ name ^ ": " ^ value
^ ". Name must be ASCII") pos ^ ". Name must be ASCII") (Binding.pos_of binding)
else (name, value') end) else (name, value') end)
in update_sem_std_attrs attrs attrs'' end in update_sem_std_attrs attrs attrs'' end
val updated_sem_std_attrs = update_sem_std_attrs sem_attrs transformed_args val updated_sem_std_attrs = update_sem_std_attrs sem_attrs transformed_args
@ -2289,14 +2291,14 @@ fun meta_args_2_latex thy sem_attrs transform_attr
(* level-attribute information management *) (* level-attribute information management *)
fun gen_enriched_document_cmd {inline} cid_transform attr_transform fun gen_enriched_document_cmd {inline} cid_transform attr_transform
((((oid, pos),cid_pos), doc_attrs) : ODL_Meta_Args_Parser.meta_args_t) : theory -> theory = (((binding,cid_pos), doc_attrs) : ODL_Meta_Args_Parser.meta_args_t) : theory -> theory =
Value_Command.Docitem_Parser.create_and_check_docitem {is_monitor = false} {is_inline = inline} Value_Command.Docitem_Parser.create_and_check_docitem {is_monitor = false} {is_inline = inline}
{define = true} oid pos (cid_transform cid_pos) (attr_transform doc_attrs); {define = true} binding (cid_transform cid_pos) (attr_transform doc_attrs);
fun gen_enriched_document_cmd' {inline} cid_transform attr_transform fun gen_enriched_document_cmd' {inline} cid_transform attr_transform
((((oid, pos),cid_pos), doc_attrs) : ODL_Meta_Args_Parser.meta_args_t) : theory -> theory = (((binding,cid_pos), doc_attrs) : ODL_Meta_Args_Parser.meta_args_t) : theory -> theory =
Value_Command.Docitem_Parser.create_and_check_docitem {is_monitor = false} {is_inline = inline} Value_Command.Docitem_Parser.create_and_check_docitem {is_monitor = false} {is_inline = inline}
{define = false} oid pos (cid_transform cid_pos) (attr_transform doc_attrs); {define = false} binding (cid_transform cid_pos) (attr_transform doc_attrs);
(* markup reports and document output *) (* markup reports and document output *)
@ -2512,12 +2514,12 @@ ML\<open>
structure ML_star_Command = structure ML_star_Command =
struct struct
fun meta_args_exec (meta_args as (((oid, pos),cid_pos), doc_attrs) : ODL_Meta_Args_Parser.meta_args_t) ctxt = fun meta_args_exec (meta_args as ((binding,cid_pos), doc_attrs) : ODL_Meta_Args_Parser.meta_args_t) ctxt =
ctxt |> (if meta_args = ODL_Meta_Args_Parser.empty_meta_args ctxt |> (if meta_args = ODL_Meta_Args_Parser.empty_meta_args
then (K ctxt) then (K ctxt)
else Context.map_theory (Value_Command.Docitem_Parser.create_and_check_docitem else Context.map_theory (Value_Command.Docitem_Parser.create_and_check_docitem
{is_monitor = false} {is_inline = true} {is_monitor = false} {is_inline = true}
{define = true} oid pos (I cid_pos) (I doc_attrs))) {define = true} binding (I cid_pos) (I doc_attrs)))
val attributes_opt = Scan.option ODL_Meta_Args_Parser.attributes val attributes_opt = Scan.option ODL_Meta_Args_Parser.attributes

View File

@ -208,13 +208,13 @@ text\<open>
in many features over-accomplishes the required features of \<^dof>. in many features over-accomplishes the required features of \<^dof>.
\<close> \<close>
figure*["fig:dof-ide",relative_width="95",file_src="''figures/cicm2018-combined.png''"]\<open> figure*["fig_dof_ide",relative_width="95",file_src="''figures/cicm2018-combined.png''"]\<open>
The \<^isadof> IDE (left) and the corresponding PDF (right), showing the first page The \<^isadof> IDE (left) and the corresponding PDF (right), showing the first page
of~@{cite "brucker.ea:isabelle-ontologies:2018"}.\<close> of~@{cite "brucker.ea:isabelle-ontologies:2018"}.\<close>
text\<open> text\<open>
We call the present implementation of \<^dof> on the Isabelle platform \<^isadof> . We call the present implementation of \<^dof> on the Isabelle platform \<^isadof> .
@{figure "fig:dof-ide"} shows a screen-shot of an introductory paper on @{figure "fig_dof_ide"} shows a screen-shot of an introductory paper on
\<^isadof>~@{cite "brucker.ea:isabelle-ontologies:2018"}: the \<^isadof> PIDE can be seen on the left, \<^isadof>~@{cite "brucker.ea:isabelle-ontologies:2018"}: the \<^isadof> PIDE can be seen on the left,
while the generated presentation in PDF is shown on the right. while the generated presentation in PDF is shown on the right.

View File

@ -477,7 +477,7 @@ on the level of generated \<^verbatim>\<open>.aux\<close>-files, which are not n
error-message and compiling it with a consistent bibtex usually makes disappear this behavior. error-message and compiling it with a consistent bibtex usually makes disappear this behavior.
\<close> \<close>
subsection*["using-term-aq"::technical, main_author = "Some @{author ''bu''}"] subsection*["using_term_aq"::technical, main_author = "Some @{author ''bu''}"]
\<open>Using Term-Antiquotations\<close> \<open>Using Term-Antiquotations\<close>
text\<open>The present version of \<^isadof> is the first version that supports the novel feature of text\<open>The present version of \<^isadof> is the first version that supports the novel feature of
@ -577,11 +577,11 @@ term antiquotations:
\<close> \<close>
(*<*) (*<*)
declare_reference*["subsec:onto-term-ctxt"::technical] declare_reference*["subsec_onto_term_ctxt"::technical]
(*>*) (*>*)
text\<open>They are text-contexts equivalents to the \<^theory_text>\<open>term*\<close> and \<^theory_text>\<open>value*\<close> commands text\<open>They are text-contexts equivalents to the \<^theory_text>\<open>term*\<close> and \<^theory_text>\<open>value*\<close> commands
for term-contexts introduced in @{technical (unchecked) \<open>subsec:onto-term-ctxt\<close>}\<close> for term-contexts introduced in @{technical (unchecked) \<open>subsec_onto_term_ctxt\<close>}\<close>
subsection\<open>A Technical Report with Tight Checking\<close> subsection\<open>A Technical Report with Tight Checking\<close>
text\<open>An example of tight checking is a small programming manual to document programming trick text\<open>An example of tight checking is a small programming manual to document programming trick

View File

@ -164,7 +164,7 @@ text\<open>
to and between ontological concepts. to and between ontological concepts.
\<close> \<close>
subsection*["odl-manual0"::technical]\<open>Some Isabelle/HOL Specification Constructs Revisited\<close> subsection*["odl_manual0"::technical]\<open>Some Isabelle/HOL Specification Constructs Revisited\<close>
text\<open> text\<open>
As ODL is an extension of Isabelle/HOL, document class definitions can therefore be arbitrarily As ODL is an extension of Isabelle/HOL, document class definitions can therefore be arbitrarily
mixed with standard HOL specification constructs. To make this manual self-contained, we present mixed with standard HOL specification constructs. To make this manual self-contained, we present
@ -231,7 +231,7 @@ corresponding type-name \<^boxed_theory_text>\<open>0.foo\<close> is not. For th
definition of a \<^boxed_theory_text>\<open>doc_class\<close> reject problematic lexical overlaps.\<close> definition of a \<^boxed_theory_text>\<open>doc_class\<close> reject problematic lexical overlaps.\<close>
subsection*["odl-manual1"::technical]\<open>Defining Document Classes\<close> subsection*["odl_manual1"::technical]\<open>Defining Document Classes\<close>
text\<open> text\<open>
A document class\<^bindex>\<open>document class\<close> can be defined using the @{command "doc_class"} keyword: A document class\<^bindex>\<open>document class\<close> can be defined using the @{command "doc_class"} keyword:
\<^item> \<open>class_id\<close>:\<^bindex>\<open>class\_id@\<open>class_id\<close>\<close> a type-\<open>name\<close> that has been introduced \<^item> \<open>class_id\<close>:\<^bindex>\<open>class\_id@\<open>class_id\<close>\<close> a type-\<open>name\<close> that has been introduced
@ -350,7 +350,7 @@ layout; these commands have to be wrapped into
text\<open> text\<open>
\<^item> \<open>obj_id\<close>:\<^index>\<open>obj\_id@\<open>obj_id\<close>\<close> (or \<^emph>\<open>oid\<close>\<^index>\<open>oid!oid@\<open>see obj_id\<close>\<close> for short) a \<^emph>\<open>name\<close> \<^item> \<open>obj_id\<close>:\<^index>\<open>obj\_id@\<open>obj_id\<close>\<close> (or \<^emph>\<open>oid\<close>\<^index>\<open>oid!oid@\<open>see obj_id\<close>\<close> for short) a \<^emph>\<open>name\<close>
as specified in @{technical \<open>odl-manual0\<close>}. as specified in @{technical \<open>odl_manual0\<close>}.
\<^item> \<open>meta_args\<close> : \<^item> \<open>meta_args\<close> :
\<^rail>\<open>obj_id ('::' class_id) ((',' attribute '=' HOL_term) *) \<close> \<^rail>\<open>obj_id ('::' class_id) ((',' attribute '=' HOL_term) *) \<close>
\<^item> \<^emph>\<open>evaluator\<close>: from @{cite "wenzel:isabelle-isar:2020"}, evaluation is tried first using ML, \<^item> \<^emph>\<open>evaluator\<close>: from @{cite "wenzel:isabelle-isar:2020"}, evaluation is tried first using ML,
@ -465,10 +465,10 @@ text*[b::B'_test']\<open>\<close>
term*\<open>@{B'_test' \<open>b\<close>}\<close> term*\<open>@{B'_test' \<open>b\<close>}\<close>
declare_reference*["text-elements-expls"::technical] declare_reference*["text_elements_expls"::technical]
(*>*) (*>*)
subsection*["subsec:onto-term-ctxt"::technical]\<open>Ontological Term-Contexts and their Management\<close> subsection*["subsec_onto_term_ctxt"::technical]\<open>Ontological Term-Contexts and their Management\<close>
text\<open> text\<open>
\<^item> \<open>annotated_term_element\<close> \<^item> \<open>annotated_term_element\<close>
\<^rail>\<open> \<^rail>\<open>
@ -503,9 +503,9 @@ for example). With the exception of the @{command "term*"}-command, the term-ant
This expansion happens \<^emph>\<open>before\<close> evaluation of the term, thus permitting This expansion happens \<^emph>\<open>before\<close> evaluation of the term, thus permitting
executable HOL-functions to interact with meta-objects. executable HOL-functions to interact with meta-objects.
The @{command "assert*"}-command allows for logical statements to be checked in the global context The @{command "assert*"}-command allows for logical statements to be checked in the global context
(see @{technical (unchecked) \<open>text-elements-expls\<close>}). (see @{technical (unchecked) \<open>text_elements_expls\<close>}).
% TODO: % TODO:
% Section reference @{docitem (unchecked) \<open>text-elements-expls\<close>} has not the right number % Section reference @{docitem (unchecked) \<open>text_elements_expls\<close>} has not the right number
This is particularly useful to explore formal definitions wrt. their border cases. This is particularly useful to explore formal definitions wrt. their border cases.
For @{command "assert*"}, the evaluation of the term can be disabled For @{command "assert*"}, the evaluation of the term can be disabled
with the \<^boxed_theory_text>\<open>disable_assert_evaluation\<close> theory attribute: with the \<^boxed_theory_text>\<open>disable_assert_evaluation\<close> theory attribute:
@ -558,7 +558,7 @@ of this meta-object. The latter leads to a failure of the entire command.
\<close> \<close>
(*<*) (*<*)
declare_reference*["sec:advanced"::technical] declare_reference*["sec_advanced"::technical]
(*>*) (*>*)
subsection\<open>Status and Query Commands\<close> subsection\<open>Status and Query Commands\<close>
@ -586,7 +586,7 @@ text\<open>
The raw term will be available in the \<open>input_term\<close> field of \<^theory_text>\<open>print_doc_items\<close> output and, The raw term will be available in the \<open>input_term\<close> field of \<^theory_text>\<open>print_doc_items\<close> output and,
\<^item> \<^theory_text>\<open>check_doc_global\<close> checks if all declared object references have been \<^item> \<^theory_text>\<open>check_doc_global\<close> checks if all declared object references have been
defined, all monitors are in a final state, and checks the final invariant defined, all monitors are in a final state, and checks the final invariant
on all objects (cf. @{technical (unchecked) \<open>sec:advanced\<close>}) on all objects (cf. @{technical (unchecked) \<open>sec_advanced\<close>})
\<close> \<close>
subsection\<open>Macros\<close> subsection\<open>Macros\<close>
@ -738,7 +738,7 @@ text\<open>The command syntax follows the implicit convention to add a ``*''
to distinguish them from the (similar) standard Isabelle text-commands to distinguish them from the (similar) standard Isabelle text-commands
which are not ontology-aware.\<close> which are not ontology-aware.\<close>
subsection*["text-elements"::technical]\<open>The Ontology \<^verbatim>\<open>scholarly_paper\<close>\<close> subsection*["text_elements"::technical]\<open>The Ontology \<^verbatim>\<open>scholarly_paper\<close>\<close>
(*<*) (*<*)
ML\<open>val toLaTeX = String.translate (fn c => if c = #"_" then "\\_" else String.implode[c])\<close> ML\<open>val toLaTeX = String.translate (fn c => if c = #"_" then "\\_" else String.implode[c])\<close>
ML\<open>writeln (DOF_core.print_doc_class_tree ML\<open>writeln (DOF_core.print_doc_class_tree
@ -821,9 +821,9 @@ or
\<open>text*[\<dots>::example, main_author = "Some(@{author \<open>bu\<close>})"] \<open> \<dots> \<close>\<close>} \<open>text*[\<dots>::example, main_author = "Some(@{author \<open>bu\<close>})"] \<open> \<dots> \<close>\<close>}
where \<^boxed_theory_text>\<open>"''bu''"\<close> is a string presentation of the reference to the author where \<^boxed_theory_text>\<open>"''bu''"\<close> is a string presentation of the reference to the author
text element (see below in @{docitem (unchecked) \<open>text-elements-expls\<close>}). text element (see below in @{docitem (unchecked) \<open>text_elements_expls\<close>}).
% TODO: % TODO:
% Section reference @{docitem (unchecked) \<open>text-elements-expls\<close>} has not the right number % Section reference @{docitem (unchecked) \<open>text_elements_expls\<close>} has not the right number
\<close> \<close>
text\<open>Some of these concepts were supported as command-abbreviations leading to the extension text\<open>Some of these concepts were supported as command-abbreviations leading to the extension
@ -866,7 +866,7 @@ of Isabelle is its ability to handle both, and to establish links between both w
Therefore, the formal assertion command has been integrated to capture some form of formal content.\<close> Therefore, the formal assertion command has been integrated to capture some form of formal content.\<close>
subsubsection*["text-elements-expls"::example]\<open>Examples\<close> subsubsection*["text_elements_expls"::example]\<open>Examples\<close>
text\<open> text\<open>
While the default user interface for class definitions via the While the default user interface for class definitions via the
@ -1018,9 +1018,9 @@ schemata:
section*["sec:advanced"::technical]\<open>Advanced ODL Concepts\<close> section*["sec_advanced"::technical]\<open>Advanced ODL Concepts\<close>
subsection*["sec:example"::technical]\<open>Example\<close> subsection*["sec_example"::technical]\<open>Example\<close>
text\<open>We assume in this section the following local ontology: text\<open>We assume in this section the following local ontology:
@{boxed_theory_text [display]\<open> @{boxed_theory_text [display]\<open>
@ -1089,11 +1089,11 @@ text\<open>
\<close> \<close>
(*<*) (*<*)
declare_reference*["sec:monitors"::technical] declare_reference*["sec_monitors"::technical]
declare_reference*["sec:low_level_inv"::technical] declare_reference*["sec_low_level_inv"::technical]
(*>*) (*>*)
subsection*["sec:class_inv"::technical]\<open>ODL Class Invariants\<close> subsection*["sec_class_inv"::technical]\<open>ODL Class Invariants\<close>
text\<open> text\<open>
Ontological classes as described so far are too liberal in many situations. Ontological classes as described so far are too liberal in many situations.
@ -1144,7 +1144,7 @@ text\<open>
Hence, the \<^boxed_theory_text>\<open>inv1\<close> invariant is checked Hence, the \<^boxed_theory_text>\<open>inv1\<close> invariant is checked
when the instance \<^boxed_theory_text>\<open>testinv2\<close> is defined. when the instance \<^boxed_theory_text>\<open>testinv2\<close> is defined.
Now let's add some invariants to our example in \<^technical>\<open>sec:example\<close>. Now let's add some invariants to our example in \<^technical>\<open>sec_example\<close>.
For example, one For example, one
would like to express that any instance of a \<^boxed_theory_text>\<open>result\<close> class finally has would like to express that any instance of a \<^boxed_theory_text>\<open>result\<close> class finally has
a non-empty property list, if its \<^boxed_theory_text>\<open>kind\<close> is \<^boxed_theory_text>\<open>proof\<close>, or that a non-empty property list, if its \<^boxed_theory_text>\<open>kind\<close> is \<^boxed_theory_text>\<open>proof\<close>, or that
@ -1178,22 +1178,22 @@ text\<open>
declare[[invariants_checking_with_tactics = true]]\<close>} declare[[invariants_checking_with_tactics = true]]\<close>}
There are still some limitations with this high-level syntax. There are still some limitations with this high-level syntax.
For now, the high-level syntax does not support the checking of For now, the high-level syntax does not support the checking of
specific monitor behaviors (see @{technical (unchecked) "sec:monitors"}). specific monitor behaviors (see @{technical (unchecked) "sec_monitors"}).
For example, one would like to delay a final error message till the For example, one would like to delay a final error message till the
closing of a monitor. closing of a monitor.
For this use-case you can use low-level class invariants For this use-case you can use low-level class invariants
(see @{technical (unchecked) "sec:low_level_inv"}). (see @{technical (unchecked) "sec_low_level_inv"}).
Also, for now, term-antiquotations can not be used in an invariant formula. Also, for now, term-antiquotations can not be used in an invariant formula.
\<close> \<close>
subsection*["sec:low_level_inv"::technical]\<open>ODL Low-level Class Invariants\<close> subsection*["sec_low_level_inv"::technical]\<open>ODL Low-level Class Invariants\<close>
text\<open> text\<open>
If one want to go over the limitations of the actual high-level syntax of the invariant, If one want to go over the limitations of the actual high-level syntax of the invariant,
one can define a function using SML. one can define a function using SML.
A formulation, in SML, of the class-invariant \<^boxed_theory_text>\<open>has_property\<close> A formulation, in SML, of the class-invariant \<^boxed_theory_text>\<open>has_property\<close>
in \<^technical>\<open>sec:class_inv\<close>, defined in the supposedly \<open>Low_Level_Syntax_Invariants\<close> theory in \<^technical>\<open>sec_class_inv\<close>, defined in the supposedly \<open>Low_Level_Syntax_Invariants\<close> theory
(note the long name of the class), (note the long name of the class),
is straight-forward: is straight-forward:
@ -1222,7 +1222,7 @@ val _ = Theory.setup (DOF_core.make_ml_invariant (check_result_inv, cid_long)
\<^boxed_theory_text>\<open>oid\<close> is bound to a variable here and can therefore not be statically expanded. \<^boxed_theory_text>\<open>oid\<close> is bound to a variable here and can therefore not be statically expanded.
\<close> \<close>
subsection*["sec:monitors"::technical]\<open>ODL Monitors\<close> subsection*["sec_monitors"::technical]\<open>ODL Monitors\<close>
text\<open> text\<open>
We call a document class with an \<open>accepts_clause\<close> a \<^emph>\<open>monitor\<close>.\<^bindex>\<open>monitor\<close> Syntactically, an We call a document class with an \<open>accepts_clause\<close> a \<^emph>\<open>monitor\<close>.\<^bindex>\<open>monitor\<close> Syntactically, an
\<open>accepts_clause\<close>\<^index>\<open>accepts\_clause@\<open>accepts_clause\<close>\<close> contains a regular expression over class identifiers. \<open>accepts_clause\<close>\<^index>\<open>accepts\_clause@\<open>accepts_clause\<close>\<close> contains a regular expression over class identifiers.
@ -1291,18 +1291,18 @@ text\<open>
sections. sections.
For now, the high-level syntax of invariants does not support the checking of For now, the high-level syntax of invariants does not support the checking of
specific monitor behaviors like the one just described and you must use specific monitor behaviors like the one just described and you must use
the low-level class invariants (see @{technical "sec:low_level_inv"}). the low-level class invariants (see @{technical "sec_low_level_inv"}).
Low-level invariants checking can be set up to be triggered Low-level invariants checking can be set up to be triggered
when opening a monitor, when closing a monitor, or both when opening a monitor, when closing a monitor, or both
by using the \<^ML>\<open>DOF_core.add_opening_ml_invariant\<close>, by using the \<^ML>\<open>DOF_core.add_opening_ml_invariant\<close>,
\<^ML>\<open>DOF_core.add_closing_ml_invariant\<close>, or \<^ML>\<open>DOF_core.add_ml_invariant\<close> commands \<^ML>\<open>DOF_core.add_closing_ml_invariant\<close>, or \<^ML>\<open>DOF_core.add_ml_invariant\<close> commands
respectively, to add the invariants to the theory context respectively, to add the invariants to the theory context
(See @{technical "sec:low_level_inv"} for an example). (See @{technical "sec_low_level_inv"} for an example).
\<close> \<close>
subsection*["sec:queries_on_instances"::technical]\<open>Queries On Instances\<close> subsection*["sec_queries_on_instances"::technical]\<open>Queries On Instances\<close>
text\<open> text\<open>
Any class definition generates term antiquotations checking a class instance or Any class definition generates term antiquotations checking a class instance or
@ -1414,7 +1414,7 @@ text\<open>
\<close> \<close>
section*["document-templates"::technical]\<open>Defining Document Templates\<close> section*["document_templates"::technical]\<open>Defining Document Templates\<close>
subsection\<open>The Core Template\<close> subsection\<open>The Core Template\<close>
text\<open> text\<open>

View File

@ -188,7 +188,7 @@ text\<open>
section\<open>Programming Class Invariants\<close> section\<open>Programming Class Invariants\<close>
text\<open> text\<open>
See \<^technical>\<open>sec:low_level_inv\<close>. See \<^technical>\<open>sec_low_level_inv\<close>.
\<close> \<close>
section\<open>Implementing Monitors\<close> section\<open>Implementing Monitors\<close>
@ -203,7 +203,7 @@ text\<open>
val next : automaton -> env -> cid -> automaton\<close>} val next : automaton -> env -> cid -> automaton\<close>}
where \<^boxed_sml>\<open>env\<close> is basically a map between internal automaton states and class-id's where \<^boxed_sml>\<open>env\<close> is basically a map between internal automaton states and class-id's
(\<^boxed_sml>\<open>cid\<close>'s). An automaton is said to be \<^emph>\<open>enabled\<close> for a class-id, (\<^boxed_sml>\<open>cid\<close>'s). An automaton is said to be \<^emph>\<open>enabled\<close> for a class-id,
iff it either occurs in its accept-set or its reject-set (see @{docitem "sec:monitors"}). During iff it either occurs in its accept-set or its reject-set (see @{docitem "sec_monitors"}). During
top-down document validation, whenever a text-element is encountered, it is checked if a monitor top-down document validation, whenever a text-element is encountered, it is checked if a monitor
is \emph{enabled} for this class; in this case, the \<^boxed_sml>\<open>next\<close>-operation is executed. The is \emph{enabled} for this class; in this case, the \<^boxed_sml>\<open>next\<close>-operation is executed. The
transformed automaton recognizing the suffix is stored in \<^boxed_sml>\<open>docobj_tab\<close> if transformed automaton recognizing the suffix is stored in \<^boxed_sml>\<open>docobj_tab\<close> if
@ -228,7 +228,7 @@ text\<open>
\expandafter\providekeycommand\csname isaDof.#1\endcsname}%\<close>} \expandafter\providekeycommand\csname isaDof.#1\endcsname}%\<close>}
The \<^LaTeX>-generator of \<^isadof> maps each \<^boxed_theory_text>\<open>doc_item\<close> to an \<^LaTeX>-environment (recall The \<^LaTeX>-generator of \<^isadof> maps each \<^boxed_theory_text>\<open>doc_item\<close> to an \<^LaTeX>-environment (recall
@{docitem "text-elements"}). As generic \<^boxed_theory_text>\<open>doc_item\<close>s are derived from the text element, @{docitem "text_elements"}). As generic \<^boxed_theory_text>\<open>doc_item\<close>s are derived from the text element,
the environment \inlineltx|isamarkuptext*| builds the core of \<^isadof>'s \<^LaTeX> implementation. the environment \inlineltx|isamarkuptext*| builds the core of \<^isadof>'s \<^LaTeX> implementation.
\<close> \<close>