Merge branch 'main' into test-rebase2
ci/woodpecker/push/build Pipeline failed Details

This commit is contained in:
Pierre Derathe 2023-02-20 12:20:07 +01:00
commit 244d70896f
13 changed files with 1091 additions and 1062 deletions

View File

@ -65,7 +65,7 @@ text\<open>
\<close> \<close>
(*<*) (*<*)
declare_reference*["fig:dependency"::text_section] declare_reference*["fig:dependency"::figure]
(*>*) (*>*)

View File

@ -350,8 +350,7 @@ is currently only available in the SML API's of the kernel.
| macro_command | macro_command
\<close> \<close>
\<^item> \<^isadof> \<open>change_status_command\<close> : \<^item> \<^isadof> \<open>change_status_command\<close> :
\<^rail>\<open> (@@{command "update_instance*"} '[' upd_meta_args ']') \<^rail>\<open> (@@{command "update_instance*"} '[' upd_meta_args ']')\<close>
| (@@{command "declare_reference*"} (obj_id ('::' class_id)))\<close>
\<^item> \<^isadof> \<open>inspection_command\<close> : \<^item> \<^isadof> \<open>inspection_command\<close> :
\<^rail>\<open> @@{command "print_doc_classes"} \<^rail>\<open> @@{command "print_doc_classes"}
| @@{command "print_doc_items"} | @@{command "print_doc_items"}
@ -1218,8 +1217,8 @@ text\<open>
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.update_class_eager_invariant\<close>, by using the \<^ML>\<open>DOF_core.add_opening_ml_invariant\<close>,
\<^ML>\<open>DOF_core.update_class_lazy_invariant\<close>, or \<^ML>\<open>DOF_core.update_class_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>\<open>sec:low_level_inv\<close> for an example). (See \<^technical>\<open>sec:low_level_inv\<close> for an example).
\<close> \<close>

View File

@ -46,40 +46,42 @@ text\<open>
A plugin in Isabelle starts with defining the local data and registering it in the framework. As A plugin in Isabelle starts with defining the local data and registering it in the framework. As
mentioned before, contexts are structures with independent cells/compartments having three mentioned before, contexts are structures with independent cells/compartments having three
primitives \<^boxed_sml>\<open>init\<close>, \<^boxed_sml>\<open>extend\<close> and \<^boxed_sml>\<open>merge\<close>. Technically this is done by primitives \<^boxed_sml>\<open>init\<close>, \<^boxed_sml>\<open>extend\<close> and \<^boxed_sml>\<open>merge\<close>. Technically this is done by
instantiating a functor \<^boxed_sml>\<open>Generic_Data\<close>, and the following fairly typical code-fragment instantiating a functor \<^boxed_sml>\<open>Theory_Data\<close>, and the following fairly typical code-fragment
is drawn from \<^isadof>: is drawn from \<^isadof>:
@{boxed_sml [display] @{boxed_sml [display]
\<open>structure Data = Generic_Data \<open>structure Onto_Classes = Theory_Data
( type T = docobj_tab * docclass_tab * ... (
val empty = (initial_docobj_tab, initial_docclass_tab, ...) type T = onto_class Name_Space.table;
fun merge((d1,c1,...),(d2,c2,...)) = (merge_docobj_tab (d1,d2,...), val empty : T = Name_Space.empty_table onto_classN;
merge_docclass_tab(c1,c2,...)) fun merge data : T = Name_Space.merge_tables data;
);\<close>} );\<close>}
where the table \<^boxed_sml>\<open>docobj_tab\<close> manages document class instances where the table \<^boxed_sml>\<open>Name_Space.table\<close> manages
and \<^boxed_sml>\<open>docclass_tab\<close> the environment for class definitions the environment for class definitions (\<^boxed_sml>\<open>onto_class\<close>), inducing the inheritance relation,
(inducing the inheritance relation). Other tables capture, \eg, using a \<^boxed_sml>\<open>Name_Space\<close> table. Other tables capture, \eg,
the class invariants, inner-syntax antiquotations. Operations follow the MVC-pattern, where the class instances, class invariants, inner-syntax antiquotations.
Operations follow the MVC-pattern, where
Isabelle/Isar provides the controller part. A typical model operation has the type: Isabelle/Isar provides the controller part. A typical model operation has the type:
@{boxed_sml [display] @{boxed_sml [display]
\<open>val opn :: <args_type> -> Context.generic -> Context.generic\<close>} \<open>val opn :: <args_type> -> theory -> theory\<close>}
representing a transformation on system contexts. For example, the operation of declaring a local representing a transformation on system contexts. For example, the operation of defining a class
reference in the context is presented as follows: in the context is presented as follows:
@{boxed_sml [display] @{boxed_sml [display]
\<open>fun declare_object_local oid ctxt = \<open>fun add_onto_class name onto_class thy =
let fun decl {tab,maxano} = {tab=Symtab.update_new(oid,NONE) tab, thy |> Onto_Classes.map
maxano=maxano} (Name_Space.define (Context.Theory thy) true (name, onto_class) #> #2);
in (Data.map(apfst decl)(ctxt) \<close>}
handle Symtab.DUP _ => This code fragment uses operations from the library structure \<^boxed_sml>\<open>Name_Space\<close>
error("multiple declaration of document reference")) that were used to update the appropriate table for document objects in
end\<close>} the plugin-local state.
where \<^boxed_sml>\<open>Data.map\<close> is the update function resulting from the instantiation of the A name space manages a collection of long names, together with a mapping
functor \<^boxed_sml>\<open>Generic_Data\<close>. This code fragment uses operations from a library structure between partially qualified external names and fully qualified internal names
\<^boxed_sml>\<open>Symtab\<close> that were used to update the appropriate table for document objects in (in both directions).
the plugin-local state. Possible exceptions to the update operation were mapped to a system-global It can also keep track of the declarations and updates position of objects,
error reporting function. and then allows a simple markup-generation.
Possible exceptions to the update operation are automatically triggered.
Finally, the view-aspects were handled by an API for parsing-combinators. The library structure Finally, the view-aspects were handled by an API for parsing-combinators. The library structure
\<^boxed_sml>\<open>Scan\<close> provides the operators: \<^boxed_sml>\<open>Scan\<close> provides the operators:
@ -120,7 +122,7 @@ val attributes =(Parse.$$$ "[" |-- (reference
new \emph{command}: new \emph{command}:
@{boxed_theory_text [display]\<open> @{boxed_theory_text [display]\<open>
declare_reference [lal::requirement, alpha="main", beta=42] declare_reference* [lal::requirement, alpha="main", beta=42]
\<close>} \<close>}
The construction also generates implicitly some markup information; for example, when hovering The construction also generates implicitly some markup information; for example, when hovering

View File

@ -30,7 +30,7 @@ theory Isa_COL
"figure*" "side_by_side_figure*" :: document_body "figure*" "side_by_side_figure*" :: document_body
begin begin
section\<open>Basic Text and Text-Structuring Elements\<close> section\<open>Basic Text and Text-Structuring Elements\<close>
text\<open> The attribute @{term "level"} in the subsequent enables doc-notation support section* etc. text\<open> The attribute @{term "level"} in the subsequent enables doc-notation support section* etc.
@ -92,8 +92,8 @@ local
fun transform_cid thy NONE X = X fun transform_cid thy NONE X = X
|transform_cid thy (SOME ncid) NONE = (SOME(ncid,@{here})) |transform_cid thy (SOME ncid) NONE = (SOME(ncid,@{here}))
|transform_cid thy (SOME cid) (SOME (sub_cid,pos)) = |transform_cid thy (SOME cid) (SOME (sub_cid,pos)) =
let val cid_long = DOF_core.read_cid_global thy cid let val cid_long = DOF_core.get_onto_class_name_global' cid thy
val sub_cid_long = DOF_core.read_cid_global thy sub_cid val sub_cid_long = DOF_core.get_onto_class_name_global' sub_cid thy
in if DOF_core.is_subclass_global thy sub_cid_long cid_long in if DOF_core.is_subclass_global thy sub_cid_long cid_long
then (SOME (sub_cid,pos)) then (SOME (sub_cid,pos))
else (* (SOME (sub_cid,pos)) *) else (* (SOME (sub_cid,pos)) *)
@ -146,7 +146,8 @@ datatype placement = pl_h | (*here*)
pl_ht | (*here -> top*) pl_ht | (*here -> top*)
pl_hb (*here -> bottom*) pl_hb (*here -> bottom*)
ML\<open>(Symtab.defined (#docclass_tab(DOF_core.get_data_global @{theory}))) "side_by_side_figure"\<close> ML\<open> "side_by_side_figure" |> Name_Space.declared (DOF_core.get_onto_classes \<^context>
|> Name_Space.space_of_table)\<close>
print_doc_classes print_doc_classes

File diff suppressed because it is too large Load Diff

View File

@ -157,10 +157,10 @@ which have the required safety integrity level.\<close>
Definition*[entity] Definition*[entity]
\<open>person, group or organisation who fulfils a role as defined in this European Standard.\<close> \<open>person, group or organisation who fulfils a role as defined in this European Standard.\<close>
declare_reference*[fault] declare_reference*[fault::cenelec_term]
Definition*[error] Definition*[error]
\<open>defect, mistake or inaccuracy which could result in failure or in a deviation \<open>defect, mistake or inaccuracy which could result in failure or in a deviation
from the intended performance or behaviour (cf. @{cenelec_term (unchecked) \<open>fault\<close>})).\<close> from the intended performance or behaviour (cf. @{cenelec_term (unchecked) \<open>fault\<close>}).\<close>
Definition*[fault] Definition*[fault]
\<open>defect, mistake or inaccuracy which could result in failure or in a deviation \<open>defect, mistake or inaccuracy which could result in failure or in a deviation
@ -1009,14 +1009,16 @@ ML\<open>
fun check_sil oid _ ctxt = fun check_sil oid _ ctxt =
let let
val ctxt' = Proof_Context.init_global(Context.theory_of ctxt) val ctxt' = Proof_Context.init_global(Context.theory_of ctxt)
val monitor_record_value = #value (the (DOF_core.get_object_local oid ctxt')) val DOF_core.Instance {value = monitor_record_value, ...} =
DOF_core.get_instance_global oid (Context.theory_of ctxt)
val Const _ $ _ $ monitor_sil $ _ = monitor_record_value val Const _ $ _ $ monitor_sil $ _ = monitor_record_value
val traces = AttributeAccess.compute_trace_ML ctxt oid NONE \<^here> val traces = AttributeAccess.compute_trace_ML ctxt oid NONE \<^here>
fun check_sil'' [] = true fun check_sil'' [] = true
| check_sil'' (x::xs) = | check_sil'' (x::xs) =
let let
val (_, doc_oid) = x val (_, doc_oid) = x
val doc_record_value = #value (the (DOF_core.get_object_local doc_oid ctxt')) val DOF_core.Instance {value = doc_record_value, ...} =
DOF_core.get_instance_global doc_oid (Context.theory_of ctxt)
val Const _ $ _ $ _ $ _ $ _ $ cenelec_document_ext = doc_record_value val Const _ $ _ $ _ $ _ $ _ $ cenelec_document_ext = doc_record_value
val Const _ $ _ $ _ $ doc_sil $ _ $ _ $ _ $ _ $ _ $ _ = cenelec_document_ext val Const _ $ _ $ _ $ doc_sil $ _ $ _ $ _ $ _ $ _ $ _ = cenelec_document_ext
in in
@ -1028,7 +1030,12 @@ fun check_sil oid _ ctxt =
in check_sil'' traces end in check_sil'' traces end
\<close> \<close>
setup\<open>DOF_core.update_class_invariant "CENELEC_50128.monitor_SIL0" check_sil\<close> setup\<open>
(fn thy =>
let val ctxt = Proof_Context.init_global thy
val binding = DOF_core.binding_from_onto_class_pos "monitor_SIL0" thy
in DOF_core.add_ml_invariant binding check_sil thy end)
\<close>
text\<open> text\<open>
A more generic example of check_sil which can be generalized: A more generic example of check_sil which can be generalized:
@ -1038,8 +1045,10 @@ ML\<open>
fun check_sil_slow oid _ ctxt = fun check_sil_slow oid _ ctxt =
let let
val ctxt' = Proof_Context.init_global(Context.theory_of ctxt) val ctxt' = Proof_Context.init_global(Context.theory_of ctxt)
val monitor_record_value = #value (the (DOF_core.get_object_local oid ctxt')) val DOF_core.Instance {value = monitor_record_value, ...} =
val monitor_cid = #cid (the (DOF_core.get_object_local oid ctxt')) DOF_core.get_instance_global oid (Context.theory_of ctxt)
val DOF_core.Instance {cid = monitor_cid, ...} =
DOF_core.get_instance_global oid (Context.theory_of ctxt)
val monitor_sil_typ = (Syntax.read_typ ctxt' monitor_cid) --> @{typ "sil"} val monitor_sil_typ = (Syntax.read_typ ctxt' monitor_cid) --> @{typ "sil"}
val monitor_sil = Value_Command.value ctxt' val monitor_sil = Value_Command.value ctxt'
(Const("CENELEC_50128.monitor_SIL.sil", monitor_sil_typ) $ monitor_record_value) (Const("CENELEC_50128.monitor_SIL.sil", monitor_sil_typ) $ monitor_record_value)
@ -1048,7 +1057,8 @@ fun check_sil_slow oid _ ctxt =
| check_sil' (x::xs) = | check_sil' (x::xs) =
let let
val (doc_cid, doc_oid) = x val (doc_cid, doc_oid) = x
val doc_record_value = #value (the (DOF_core.get_object_local doc_oid ctxt')) val DOF_core.Instance {value = doc_record_value, ...} =
DOF_core.get_instance_global doc_oid (Context.theory_of ctxt)
val doc_sil_typ = (Syntax.read_typ ctxt' doc_cid) --> @{typ "sil"} val doc_sil_typ = (Syntax.read_typ ctxt' doc_cid) --> @{typ "sil"}
val doc_sil = Value_Command.value ctxt' val doc_sil = Value_Command.value ctxt'
(Const ("CENELEC_50128.cenelec_document.sil", doc_sil_typ) $ doc_record_value) (Const ("CENELEC_50128.cenelec_document.sil", doc_sil_typ) $ doc_record_value)
@ -1061,7 +1071,12 @@ fun check_sil_slow oid _ ctxt =
in check_sil' traces end in check_sil' traces end
\<close> \<close>
(*setup\<open>DOF_core.update_class_invariant "CENELEC_50128.monitor_SIL0" check_sil_slow\<close>*) (*setup\<open>
(fn thy =>
let val ctxt = Proof_Context.init_global thy
val binding = DOF_core.binding_from_onto_class_pos "monitor_SIL0" thy
in DOF_core.add_ml_invariant binding check_sil_slow thy end)
\<close>*)
(* As traces of monitor instances (docitems) are updated each time an instance is declared (* As traces of monitor instances (docitems) are updated each time an instance is declared
(with text*, section*, etc.), invariants checking functions which check the full list of traces (with text*, section*, etc.), invariants checking functions which check the full list of traces
@ -1072,8 +1087,8 @@ ML\<open>
fun check_required_documents oid _ ctxt = fun check_required_documents oid _ ctxt =
let let
val ctxt' = Proof_Context.init_global(Context.theory_of ctxt) val ctxt' = Proof_Context.init_global(Context.theory_of ctxt)
val {monitor_tab,...} = DOF_core.get_data ctxt' val DOF_core.Monitor_Info {accepted_cids, ...} =
val {accepted_cids, ...} = the (Symtab.lookup monitor_tab oid) DOF_core.get_monitor_info_global oid (Context.theory_of ctxt)
val traces = AttributeAccess.compute_trace_ML ctxt oid NONE \<^here> val traces = AttributeAccess.compute_trace_ML ctxt oid NONE \<^here>
fun check_required_documents' [] = true fun check_required_documents' [] = true
| check_required_documents' (cid::cids) = | check_required_documents' (cid::cids) =
@ -1082,7 +1097,8 @@ fun check_required_documents oid _ ctxt =
else else
let let
val ctxt' = Proof_Context.init_global(Context.theory_of ctxt) val ctxt' = Proof_Context.init_global(Context.theory_of ctxt)
val monitor_record_value = #value (the (DOF_core.get_object_local oid ctxt')) val DOF_core.Instance {value = monitor_record_value, ...} =
DOF_core.get_instance_global oid (Context.theory_of ctxt)
val Const _ $ _ $ monitor_sil $ _ = monitor_record_value val Const _ $ _ $ monitor_sil $ _ = monitor_record_value
in error ("A " ^ cid ^ " cenelec document is required with " in error ("A " ^ cid ^ " cenelec document is required with "
^ Syntax.string_of_term ctxt' monitor_sil) ^ Syntax.string_of_term ctxt' monitor_sil)
@ -1090,7 +1106,12 @@ fun check_required_documents oid _ ctxt =
in check_required_documents' accepted_cids end in check_required_documents' accepted_cids end
\<close> \<close>
setup\<open>DOF_core.update_class_lazy_invariant "CENELEC_50128.monitor_SIL0" check_required_documents\<close> setup\<open>
fn thy =>
let val ctxt = Proof_Context.init_global thy
val binding = DOF_core.binding_from_onto_class_pos "monitor_SIL0" thy
in DOF_core.add_closing_ml_invariant binding check_required_documents thy end
\<close>
(* Test pattern matching for the records of the current CENELEC implementation classes, (* Test pattern matching for the records of the current CENELEC implementation classes,
and used by checking functions. and used by checking functions.
@ -1101,11 +1122,11 @@ text*[MonitorPatternMatchingTest::monitor_SIL0]\<open>\<close>
text*[CenelecClassPatternMatchingTest::SQAP, sil = "SIL0"]\<open>\<close> text*[CenelecClassPatternMatchingTest::SQAP, sil = "SIL0"]\<open>\<close>
ML\<open> ML\<open>
val thy = @{theory} val thy = @{theory}
val monitor_record_value = val DOF_core.Instance {value = monitor_record_value, ...} =
#value (the (DOF_core.get_object_global "MonitorPatternMatchingTest" thy)) DOF_core.get_instance_global "MonitorPatternMatchingTest" thy
val Const _ $ _ $ monitor_sil $ _ = monitor_record_value val Const _ $ _ $ monitor_sil $ _ = monitor_record_value
val doc_record_value = #value (the (DOF_core.get_object_global val DOF_core.Instance {value = doc_record_value, ...} =
"CenelecClassPatternMatchingTest" thy)) DOF_core.get_instance_global "CenelecClassPatternMatchingTest" thy
val Const _ $ _ $ _ $ _ $ _ $ cenelec_document_ext = doc_record_value val Const _ $ _ $ _ $ _ $ _ $ cenelec_document_ext = doc_record_value
val Const _ $ _ $ _ $ doc_sil $ _ $ _ $ _ $ _ $ _ $ _ = cenelec_document_ext val Const _ $ _ $ _ $ doc_sil $ _ $ _ $ _ $ _ $ _ $ _ = cenelec_document_ext
\<close> \<close>
@ -1254,10 +1275,10 @@ section\<open> META : Testing and Validation \<close>
text\<open>Test : @{semi_formal_content \<open>COTS\<close>}\<close> text\<open>Test : @{semi_formal_content \<open>COTS\<close>}\<close>
ML ML
\<open> DOF_core.read_cid_global @{theory} "requirement"; \<open> DOF_core.get_onto_class_name_global "requirement" @{theory};
DOF_core.read_cid_global @{theory} "SRAC"; DOF_core.get_onto_class_name_global "SRAC" @{theory};
DOF_core.is_defined_cid_global "SRAC" @{theory}; DOF_core.get_onto_class_global "SRAC" @{theory};
DOF_core.is_defined_cid_global "EC" @{theory}; \<close> DOF_core.get_onto_class_global "EC" @{theory}; \<close>
ML ML
\<open> DOF_core.is_subclass @{context} "CENELEC_50128.EC" "CENELEC_50128.EC"; \<open> DOF_core.is_subclass @{context} "CENELEC_50128.EC" "CENELEC_50128.EC";
@ -1266,15 +1287,16 @@ ML
DOF_core.is_subclass @{context} "CENELEC_50128.EC" "CENELEC_50128.test_requirement"; \<close> DOF_core.is_subclass @{context} "CENELEC_50128.EC" "CENELEC_50128.test_requirement"; \<close>
ML ML
\<open> val {docobj_tab={maxano, tab=ref_tab},docclass_tab=class_tab,...} = DOF_core.get_data @{context}; \<open> val ref_tab = DOF_core.get_instances \<^context>
Symtab.dest ref_tab; val docclass_tab = DOF_core.get_onto_classes @{context};
Symtab.dest class_tab; \<close> Name_Space.dest_table ref_tab;
Name_Space.dest_table docclass_tab; \<close>
ML ML
\<open> val internal_data_of_SRAC_definition = DOF_core.get_attributes_local "SRAC" @{context} \<close> \<open> val internal_data_of_SRAC_definition = DOF_core.get_attributes_local "SRAC" @{context} \<close>
ML ML
\<open> DOF_core.read_cid_global @{theory} "requirement"; \<open> DOF_core.get_onto_class_name_global "requirement" @{theory};
Syntax.parse_typ @{context} "requirement"; Syntax.parse_typ @{context} "requirement";
val Type(t,_) = Syntax.parse_typ @{context} "requirement" handle ERROR _ => dummyT; val Type(t,_) = Syntax.parse_typ @{context} "requirement" handle ERROR _ => dummyT;
Syntax.read_typ @{context} "hypothesis" handle _ => dummyT; Syntax.read_typ @{context} "hypothesis" handle _ => dummyT;

View File

@ -489,15 +489,15 @@ end
end end
\<close> \<close>
setup\<open>
setup\<open> let val cidS = ["scholarly_paper.introduction","scholarly_paper.technical", (fn thy =>
let val cidS = ["scholarly_paper.introduction","scholarly_paper.technical",
"scholarly_paper.example", "scholarly_paper.conclusion"]; "scholarly_paper.example", "scholarly_paper.conclusion"];
fun body moni_oid _ ctxt = (Scholarly_paper_trace_invariant.check fun body moni_oid _ ctxt = (Scholarly_paper_trace_invariant.check ctxt cidS moni_oid NONE; true)
ctxt cidS moni_oid NONE; val ctxt = Proof_Context.init_global thy
true) val binding = DOF_core.binding_from_onto_class_pos "article" thy
in DOF_core.update_class_invariant "scholarly_paper.article" body end\<close> in DOF_core.add_ml_invariant binding body thy end)
\<close>
ML\<open> \<close>
section\<open>Miscelleous\<close> section\<open>Miscelleous\<close>

View File

@ -64,7 +64,9 @@ doc_class result = technical +
ML\<open>fun check_invariant_invariant oid {is_monitor:bool} ctxt = ML\<open>
fn thy =>
let fun check_invariant_invariant oid {is_monitor:bool} ctxt =
let val kind_term = ISA_core.compute_attr_access ctxt "kind" oid NONE @{here} let val kind_term = ISA_core.compute_attr_access ctxt "kind" oid NONE @{here}
val property_termS = ISA_core.compute_attr_access ctxt "property" oid NONE @{here} val property_termS = ISA_core.compute_attr_access ctxt "property" oid NONE @{here}
val tS = HOLogic.dest_list property_termS val tS = HOLogic.dest_list property_termS
@ -73,9 +75,11 @@ ML\<open>fun check_invariant_invariant oid {is_monitor:bool} ctxt =
else error("class class invariant violation") else error("class class invariant violation")
| _ => false | _ => false
end end
val binding = DOF_core.binding_from_onto_class_pos "result" thy
in DOF_core.add_ml_invariant binding check_invariant_invariant thy end
\<close> \<close>
setup\<open>DOF_core.update_class_invariant "small_math.result" check_invariant_invariant\<close> (*setup\<open>DOF_core.add_ml_invariant "small_math.result" check_invariant_invariant\<close>*)
doc_class example = technical + doc_class example = technical +
@ -164,10 +168,15 @@ end
end end
\<close> \<close>
setup\<open> let val cidS = ["small_math.introduction","small_math.technical", "small_math.conclusion"]; setup\<open>
fn thy =>
let val cidS = ["small_math.introduction","small_math.technical", "small_math.conclusion"];
fun body moni_oid _ ctxt = (Small_Math_trace_invariant.check ctxt cidS moni_oid NONE; fun body moni_oid _ ctxt = (Small_Math_trace_invariant.check ctxt cidS moni_oid NONE;
true) true)
in DOF_core.update_class_invariant "small_math.article" body end\<close> val ctxt = Proof_Context.init_global thy
val binding = DOF_core.binding_from_onto_class_pos "article" thy
in DOF_core.add_ml_invariant binding body thy end
\<close>
end end

View File

@ -25,14 +25,15 @@ print_doc_items
(* this corresponds to low-level accesses : *) (* this corresponds to low-level accesses : *)
ML\<open> ML\<open>
val {docobj_tab={tab = docitem_tab, ...},docclass_tab, ISA_transformer_tab, monitor_tab,...} val docitem_tab = DOF_core.get_instances \<^context>
= DOF_core.get_data @{context}; val isa_transformer_tab = DOF_core.get_isa_transformers \<^context>
Symtab.dest docitem_tab; val docclass_tab = DOF_core.get_onto_classes @{context};
Symtab.dest docclass_tab; Name_Space.dest_table docitem_tab;
Name_Space.dest_table docclass_tab;
\<close> \<close>
ML\<open> ML\<open>
#value(the(the(Symtab.lookup docitem_tab "aaa"))) val (oid, DOF_core.Instance {value, ...}) =
Name_Space.check (Context.Proof \<^context>) (DOF_core.get_instances \<^context>) ("aaa", Position.none)
\<close> \<close>
find_theorems (60) name:"Conceptual.M." find_theorems (60) name:"Conceptual.M."
@ -175,17 +176,9 @@ section\<open>Simulation of a Monitor\<close>
declare[[free_class_in_monitor_checking]] declare[[free_class_in_monitor_checking]]
ML\<open>
val thy = \<^theory>
val long_cid = "Isa_COL.figure_group"
val t = DOF_core.get_doc_class_global long_cid thy
\<close>
open_monitor*[figs1::figure_group, open_monitor*[figs1::figure_group,
caption="''Sample ''"] caption="''Sample ''"]
ML\<open> ML\<open>val monitor_infos = DOF_core.get_monitor_infos \<^context>\<close>
val thy = \<^theory>
val {monitor_tab,...} = DOF_core.get_data_global thy
\<close>
text*[testFreeA::A]\<open>\<close> text*[testFreeA::A]\<open>\<close>
figure*[fig_A::figure, spawn_columns=False, figure*[fig_A::figure, spawn_columns=False,
relative_width="90", relative_width="90",
@ -198,20 +191,14 @@ figure*[fig_B::figure,
\<open> The B train \ldots \<close> \<open> The B train \ldots \<close>
open_monitor*[figs2::figure_group, open_monitor*[figs2::figure_group,
caption="''Sample ''"] caption="''Sample ''"]
ML\<open> ML\<open>val monitor_infos = DOF_core.get_monitor_infos \<^context>\<close>
val thy = \<^theory>
val {monitor_tab,...} = DOF_core.get_data_global thy
\<close>
figure*[fig_C::figure, spawn_columns=False, figure*[fig_C::figure, spawn_columns=False,
relative_width="90", relative_width="90",
src="''figures/A.png''"] src="''figures/A.png''"]
\<open> The C train \ldots \<close> \<open> The C train \ldots \<close>
open_monitor*[figs3::figure_group, open_monitor*[figs3::figure_group,
caption="''Sample ''"] caption="''Sample ''"]
ML\<open> ML\<open>val monitor_infos = DOF_core.get_monitor_infos \<^context>\<close>
val thy = \<^theory>
val {monitor_tab,...} = DOF_core.get_data_global thy
\<close>
figure*[fig_D::figure, figure*[fig_D::figure,
spawn_columns=False,relative_width="90", spawn_columns=False,relative_width="90",
@ -221,10 +208,7 @@ close_monitor*[figs3]
open_monitor*[figs4::figure_group, open_monitor*[figs4::figure_group,
caption="''Sample ''"] caption="''Sample ''"]
ML\<open> ML\<open>val monitor_infos = DOF_core.get_monitor_infos \<^context>\<close>
val thy = \<^theory>
val {monitor_tab,...} = DOF_core.get_data_global thy
\<close>
text*[testRejected1::figure_group, caption="''figures/A.png''"] text*[testRejected1::figure_group, caption="''figures/A.png''"]
\<open> The A train \ldots \<close> \<open> The A train \ldots \<close>

View File

@ -13,52 +13,52 @@ print_doc_classes
open_monitor*[SIL0Test::monitor_SIL0] open_monitor*[SIL0Test::monitor_SIL0]
text*[sqap_intance::SQAP, sil="SIL0", written_by="Some RQM", fst_check="Some VER", snd_check="Some VAL"]\<open>\<close> text*[sqap_instance::SQAP, sil="SIL0", written_by="Some RQM", fst_check="Some VER", snd_check="Some VAL"]\<open>\<close>
text*[sqavr_intance::SQAVR, sil= "SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[sqavr_instance::SQAVR, sil= "SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[scmp_intance::SCMP, sil="SIL0", written_by="Some CM", fst_check="Some VER", snd_check="Some VAL"]\<open>\<close> text*[scmp_instance::SCMP, sil="SIL0", written_by="Some CM", fst_check="Some VER", snd_check="Some VAL"]\<open>\<close>
text*[svp_intance::SVP, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[svp_instance::SVP, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[svap_intance::SVAP, sil="SIL0", written_by="Some VAL", fst_check="Some VER", snd_check="None"]\<open>\<close> text*[svap_instance::SVAP, sil="SIL0", written_by="Some VAL", fst_check="Some VER", snd_check="None"]\<open>\<close>
text*[swrs_intance::SWRS, sil="SIL0", written_by="Some RQM", fst_check="Some VER", snd_check="Some VAL"]\<open>\<close> text*[swrs_instance::SWRS, sil="SIL0", written_by="Some RQM", fst_check="Some VER", snd_check="Some VAL"]\<open>\<close>
text*[oswts_intance::OSWTS, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[oswts_instance::OSWTS, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swrvr_intance::SWRVR, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swrvr_instance::SWRVR, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swas_intance::SWAS, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swas_instance::SWAS, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swds_intance::SWDS, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swds_instance::SWDS, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swis_intance::SWIS, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swis_instance::SWIS, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swits_intance::SWITS, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swits_instance::SWITS, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swhits_intance::SWHITS, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swhits_instance::SWHITS, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swadvr_intance::SWADVR, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swadvr_instance::SWADVR, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swcds_intance::SWCDS, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swcds_instance::SWCDS, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swcts_intance::SWCTS, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swcts_instance::SWCTS, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swcdvr_intance::SWCDVR, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swcdvr_instance::SWCDVR, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swscd_intance::SWSCD, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swscd_instance::SWSCD, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swctr_intance::SWCTR, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swctr_instance::SWCTR, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swscvr_intance::SWSCVR, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swscvr_instance::SWSCVR, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[switr_intance::SWITR, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[switr_instance::SWITR, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swhaitr_intance::SWHAITR, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swhaitr_instance::SWHAITR, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swivr_intance::SWIVR, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swivr_instance::SWIVR, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[oswtr_intance::OSWTR, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[oswtr_instance::OSWTR, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swvalr_intance::SWVALR, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swvalr_instance::SWVALR, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[tvalr_intance::TVALR, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[tvalr_instance::TVALR, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swvrn_intance::SWVRN, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swvrn_instance::SWVRN, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[ars_intance::ARS, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[ars_instance::ARS, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[app_intance::APP, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[app_instance::APP, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[ats_intance::ATS, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[ats_instance::ATS, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[aad_intance::AAD, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[aad_instance::AAD, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[apvr_intance::APVR, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[apvr_instance::APVR, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[atr_intance::ATR, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[atr_instance::ATR, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[socoada_intance::SOCOADA, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[socoada_instance::SOCOADA, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[adavr_intance::ADAVR, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[adavr_instance::ADAVR, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swrdp_intance::SWRDP, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swrdp_instance::SWRDP, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swdm_intance::SWDM, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swdm_instance::SWDM, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swdrn_intance::SWDRN, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swdrn_instance::SWDRN, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swdr_intance::SWDR, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swdr_instance::SWDR, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swdvr_intance::SWDVR, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swdvr_instance::SWDVR, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swmp_intance::SWMP, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swmp_instance::SWMP, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swcr_intance::SWCR, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swcr_instance::SWCR, sil="SIL0", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swmr_intance::SWMR, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swmr_instance::SWMR, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swmvr_intance::SWMVR, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swmvr_instance::SWMVR, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swap_intance::SWAP, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swap_instance::SWAP, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
text*[swar_intance::SWAR, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close> text*[swar_instance::SWAR, sil="SIL0", nlvl="R", written_by="Some VER", fst_check="None", snd_check="Some VAL"]\<open>\<close>
close_monitor*[SIL0Test] close_monitor*[SIL0Test]

View File

@ -34,24 +34,30 @@ The implementor of an ontology must know what he does ...
\<close> \<close>
text\<open>Setting a sample invariant, which simply produces some side-effect:\<close> text\<open>Setting a sample invariant, which simply produces some side-effect:\<close>
setup\<open>DOF_core.update_class_invariant "Conceptual.A" (fn oid => setup\<open>
fn {is_monitor = b} => fn thy =>
fn ctxt => let val ctxt = Proof_Context.init_global thy
(writeln ("sample echo : "^oid); true))\<close> val binding = DOF_core.binding_from_onto_class_pos "A" thy
in DOF_core.add_ml_invariant binding (fn oid =>
fn {is_monitor = b} =>
fn ctxt =>
(writeln ("sample echo : "^oid); true)) thy end
\<close>
subsection*[b::A, x = "5"] \<open> Lorem ipsum dolor sit amet, ... \<close> subsection*[b::A, x = "5"] \<open> Lorem ipsum dolor sit amet, ... \<close>
text\<open>Setting a sample invariant, referring to attribute value "x":\<close> text\<open>Setting a sample invariant, referring to attribute value "x":\<close>
ML\<open>fun check_A_invariant oid {is_monitor:bool} ctxt = ML\<open>
fn thy =>
let fun check_A_invariant oid {is_monitor:bool} ctxt =
let val term = ISA_core.compute_attr_access ctxt "x" oid NONE @{here} let val term = ISA_core.compute_attr_access ctxt "x" oid NONE @{here}
val (@{typ "int"},x_value) = HOLogic.dest_number term val (@{typ "int"},x_value) = HOLogic.dest_number term
in if x_value > 5 then error("class A invariant violation") else true end in if x_value > 5 then error("class A invariant violation") else true end
val binding = DOF_core.binding_from_onto_class_pos "A" thy
in DOF_core.add_ml_invariant binding check_A_invariant thy end
\<close> \<close>
setup\<open>DOF_core.update_class_invariant "Conceptual.A" check_A_invariant\<close>
subsection*[d::A, x = "4"] \<open> Lorem ipsum dolor sit amet, ... \<close> subsection*[d::A, x = "4"] \<open> Lorem ipsum dolor sit amet, ... \<close>
@ -79,11 +85,13 @@ that instances of class C occur more often as those of class D; note that this i
to take sub-classing into account: to take sub-classing into account:
\<close> \<close>
ML\<open>fun check_M_invariant oid {is_monitor} ctxt = ML\<open>
fn thy =>
let fun check_M_invariant oid {is_monitor} ctxt =
let val term = ISA_core.compute_attr_access ctxt "trace" oid NONE @{here} let val term = ISA_core.compute_attr_access ctxt "trace" oid NONE @{here}
fun conv (\<^Const>\<open>Pair \<^typ>\<open>doc_class rexp\<close> \<^typ>\<open>string\<close>\<close> fun conv (\<^Const>\<open>Pair \<^typ>\<open>doc_class rexp\<close> \<^typ>\<open>string\<close>\<close>
$ (\<^Const>\<open>Atom \<^typ>\<open>doc_class\<close>\<close> $ (\<^Const>\<open>mk\<close> $ s)) $ S) = $ (\<^Const>\<open>Atom \<^typ>\<open>doc_class\<close>\<close> $ (\<^Const>\<open>mk\<close> $ s)) $ S) =
let val s' = DOF_core.read_cid (Context.proof_of ctxt) (HOLogic.dest_string s) let val s' = DOF_core.get_onto_class_name_global' (HOLogic.dest_string s) thy
in (s', HOLogic.dest_string S) end in (s', HOLogic.dest_string S) end
val string_pair_list = map conv (HOLogic.dest_list term) val string_pair_list = map conv (HOLogic.dest_list term)
val cid_list = map fst string_pair_list val cid_list = map fst string_pair_list
@ -93,10 +101,10 @@ ML\<open>fun check_M_invariant oid {is_monitor} ctxt =
val n = length (filter is_C cid_list) val n = length (filter is_C cid_list)
val m = length (filter is_D cid_list) val m = length (filter is_D cid_list)
in if m > n then error("class M invariant violation") else true end in if m > n then error("class M invariant violation") else true end
val binding = DOF_core.binding_from_onto_class_pos "M" thy
in DOF_core.add_ml_invariant binding check_M_invariant thy end
\<close> \<close>
setup\<open>DOF_core.update_class_invariant "Conceptual.M" check_M_invariant\<close>
section\<open>Example: Monitor Class Invariant\<close> section\<open>Example: Monitor Class Invariant\<close>
@ -122,7 +130,8 @@ ML\<open>val ctxt = @{context}
fun conv (Const(@{const_name "Pair"},_) $ Const(s,_) $ S) = (s, HOLogic.dest_string S) fun conv (Const(@{const_name "Pair"},_) $ Const(s,_) $ S) = (s, HOLogic.dest_string S)
fun conv' (\<^Const>\<open>Pair \<^typ>\<open>doc_class rexp\<close> \<^typ>\<open>string\<close>\<close> fun conv' (\<^Const>\<open>Pair \<^typ>\<open>doc_class rexp\<close> \<^typ>\<open>string\<close>\<close>
$ (\<^Const>\<open>Atom \<^typ>\<open>doc_class\<close>\<close> $ (\<^Const>\<open>mk\<close> $ s)) $ S) = $ (\<^Const>\<open>Atom \<^typ>\<open>doc_class\<close>\<close> $ (\<^Const>\<open>mk\<close> $ s)) $ S) =
let val s' = DOF_core.read_cid ctxt (HOLogic.dest_string s) let val s' = DOF_core.get_onto_class_name_global' (HOLogic.dest_string s)
(Proof_Context.theory_of ctxt)
in (s', HOLogic.dest_string S) end in (s', HOLogic.dest_string S) end
val string_pair_list = map conv' (HOLogic.dest_list term) val string_pair_list = map conv' (HOLogic.dest_list term)
\<close> \<close>

View File

@ -28,11 +28,14 @@ print_doc_classes
print_doc_items print_doc_items
(* this corresponds to low-level accesses : *) (* this corresponds to low-level accesses : *)
ML\<open> ML\<open>
val {docobj_tab={tab = docitem_tab, ...},docclass_tab, ISA_transformer_tab, monitor_tab,...} val docitem_tab = DOF_core.get_instances \<^context>;
= DOF_core.get_data @{context}; val isa_transformer_tab = DOF_core.get_isa_transformers \<^context>;
Symtab.dest docitem_tab; val docclass_tab = DOF_core.get_onto_classes \<^context>;
Symtab.dest docclass_tab;
Name_Space.dest_table docitem_tab;
Name_Space.dest_table isa_transformer_tab;
Name_Space.dest_table docclass_tab;
app; app;
\<close> \<close>
@ -80,7 +83,7 @@ fun gen_enriched_document_command2 name {body} cid_transform attr_transform mark
(* ... generating the level-attribute syntax *) (* ... generating the level-attribute syntax *)
in in
( Value_Command.Docitem_Parser.create_and_check_docitem ( Value_Command.Docitem_Parser.create_and_check_docitem
{is_monitor = false} {is_inline = false} {is_monitor = false} {is_inline = false} {define = true}
oid pos (cid_transform cid_pos) (attr_transform doc_attrs) oid pos (cid_transform cid_pos) (attr_transform doc_attrs)
#> (fn thy => (app (check_n_tex_text thy) toks_list; thy))) #> (fn thy => (app (check_n_tex_text thy) toks_list; thy)))
end; end;

View File

@ -41,9 +41,11 @@ ODL on a paradigmatical example.
text\<open>Voila the content of the Isabelle_DOF environment so far:\<close> text\<open>Voila the content of the Isabelle_DOF environment so far:\<close>
ML\<open> ML\<open>
val {docobj_tab={tab = x, ...},docclass_tab, ISA_transformer_tab,...} = DOF_core.get_data @{context}; val x = DOF_core.get_instances \<^context>
Symtab.dest ISA_transformer_tab; val isa_transformer_tab = DOF_core.get_isa_transformers \<^context>
val docclass_tab = DOF_core.get_onto_classes \<^context>;
Name_Space.dest_table isa_transformer_tab;
\<close> \<close>
text\<open>Some sample lemma:\<close> text\<open>Some sample lemma:\<close>
@ -91,11 +93,12 @@ update_instance*[xcv4::F, b+="{(@{docitem ''xcv3''},@{docitem ''xcv5''})}"]
text\<open>And here is the results of some ML-term antiquotations:\<close> text\<open>And here is the results of some ML-term antiquotations:\<close>
ML\<open> @{docitem_attribute b::xcv4} \<close> ML\<open> @{docitem_attribute b::xcv4} \<close>
ML\<open> @{docitem xcv4} \<close> ML\<open> @{docitem xcv4} \<close>
ML\<open> @{docitem_name xcv4} \<close>
ML\<open> @{trace_attribute aaa} \<close> ML\<open> @{trace_attribute aaa} \<close>
text\<open>Now we might need to reference a class instance in a term command and we would like text\<open>Now we might need to reference a class instance in a term command and we would like
Isabelle to check that this instance is indeed an instance of this class. Isabelle to check that this instance is indeed an instance of this class.
Here, we want to reference the instance @{docitem \<open>xcv4\<close>} previously defined. Here, we want to reference the instance @{docitem_name "xcv4"} previously defined.
We can use the term* command which extends the classic term command We can use the term* command which extends the classic term command
and does the appropriate checking.\<close> and does the appropriate checking.\<close>
term*\<open>@{F \<open>xcv4\<close>}\<close> term*\<open>@{F \<open>xcv4\<close>}\<close>