diff --git a/Isabelle_DOF-Unit-Tests/Concept_OntoReferencing.thy b/Isabelle_DOF-Unit-Tests/Concept_OntoReferencing.thy index b3907f3..3351d4b 100644 --- a/Isabelle_DOF-Unit-Tests/Concept_OntoReferencing.thy +++ b/Isabelle_DOF-Unit-Tests/Concept_OntoReferencing.thy @@ -84,12 +84,12 @@ text*[d::D, a1 = "X3"] \ ... phasellus amet id massa nunc, pede suscipit r text\Not only text-elements are "ontology-aware", proofs and code can this be too !\ \ \Referencing from and to a ML-code context:\ -(*<*) + ML*[c4::C, z = "Some @{A \a1\}"]\ fun fac x = if x = 0 then 1 else x * (fac(x-1)) val v = \<^value_>\A.x (the (z @{C \c4\}))\ |> HOLogic.dest_number |> snd |> fac \ -(*>*) + definition*[a2::A, x=5, level="Some 1"] xx' where "xx' \ A.x @{A \a1\}" if "A.x @{A \a1\} = 5" lemma*[e5::E] testtest : "xx + A.x @{A \a1\} = yy + A.x @{A \a1\} \ xx = yy" by simp @@ -141,20 +141,13 @@ close_monitor*[struct] text\And the trace of the monitor is:\ ML\val trace = @{trace_attribute struct}\ -ML\@{assert} (trace = - [("Conceptual.A", "a0"), ("Conceptual.A", "a"), ("Conceptual.A", "ab"), - ("Conceptual.A", "ac"), ("Conceptual.C", "c1"), ("Conceptual.A", "a1"), - ("Conceptual.C", "c1"), ("Conceptual.D", "d"), ("Conceptual.C", "c4"), - ("Conceptual.A", "a2"), ("Conceptual.E", "e5"), ("Conceptual.E", "e6"), - ("Conceptual.E", "e6"), ("Conceptual.C", "c2"), ("Conceptual.F", "f")]) \ -(* BUG : DECLARATIONS SHOULD NOT BE TRACED, JUST DEFINITIONS. ML\@{assert} (trace = [("Conceptual.A", "a0"), ("Conceptual.A", "a"), ("Conceptual.A", "ab"), ("Conceptual.A", "ac"), ("Conceptual.A", "a1"), ("Conceptual.C", "c1"), ("Conceptual.D", "d"), ("Conceptual.C", "c4"), ("Conceptual.A", "a2"), ("Conceptual.E", "e5"), ("Conceptual.E", "e6"), ("Conceptual.C", "c2"), ("Conceptual.F", "f")]) \ -*) + text\Note that the monitor \<^typ>\M\ of the ontology \<^theory>\Isabelle_DOF-Ontologies.Conceptual\ does not observe the common entities of \<^theory>\Isabelle_DOF.Isa_COL\, but just those defined in the diff --git a/Isabelle_DOF-Unit-Tests/TestKit.thy b/Isabelle_DOF-Unit-Tests/TestKit.thy index c35a0c6..985b1a3 100644 --- a/Isabelle_DOF-Unit-Tests/TestKit.thy +++ b/Isabelle_DOF-Unit-Tests/TestKit.thy @@ -59,9 +59,8 @@ fun gen_enriched_document_command2 name {body} cid_transform attr_transform mark val file = {path = Path.make [oid' ^ "_snippet.tex"], pos = @{here}, content = Bytes.string strg} - - val _ = Generated_Files.write_file (Path.make ["latex_test"]) - file + val dir = Path.append (Resources.master_directory thy) (Path.make ["latex_test"]) + val _ = Generated_Files.write_file dir file val _ = writeln (strg) in () end \ \important observation: thy is not modified. This implies that several text block can be diff --git a/Isabelle_DOF/latex/styles/DOF-core.sty b/Isabelle_DOF/latex/styles/DOF-core.sty index c7b53ca..0d6f061 100644 --- a/Isabelle_DOF/latex/styles/DOF-core.sty +++ b/Isabelle_DOF/latex/styles/DOF-core.sty @@ -165,3 +165,7 @@ \author{No Author Given} \input{ontologies} \IfFileExists{preamble.tex}{\input{preamble.tex}}{}% + +% notation +\newcommand{\isactrltermUNDERSCORE}{\isakeywordcontrol{term{\isacharunderscore}}} +\newcommand{\isactrlvalueUNDERSCORE}{\isakeywordcontrol{value{\isacharunderscore}}} \ No newline at end of file diff --git a/Isabelle_DOF/thys/Isa_DOF.thy b/Isabelle_DOF/thys/Isa_DOF.thy index 6265150..7f02484 100644 --- a/Isabelle_DOF/thys/Isa_DOF.thy +++ b/Isabelle_DOF/thys/Isa_DOF.thy @@ -699,6 +699,13 @@ fun get_value_local oid ctxt = let val Instance v = get_instance_global oid (Proof_Context.theory_of ctxt) in v |> #value end +fun get_defined_global oid thy = let val Instance d = get_instance_global oid thy + in d |> #defined end + +fun get_defined_local oid ctxt = + let val Instance d = get_instance_global oid (Proof_Context.theory_of ctxt) + in d |> #defined end + (* missing : setting terms to ground (no type-schema vars, no schema vars. )*) fun binding_from_pos get_objects get_object_name name thy = @@ -1621,7 +1628,10 @@ fun register_oid_cid_in_open_monitors oid pos cid_pos thy = (Name_Space.dest_table (DOF_core.get_monitor_infos (Proof_Context.init_global thy))) fun conv_attrs (((lhs, pos), opn), rhs) = (markup2string lhs,pos,opn, Syntax.read_term_global thy rhs) - val trace_attr = [((("trace", @{here}), "+="), "[("^cid_long^", ''"^oid^"'')]")] + val defined = DOF_core.get_defined_global oid thy + val trace_attr = if defined + then [((("trace", @{here}), "+="), "[("^cid_long^", ''"^oid^"'')]")] + else [] val assns' = map conv_attrs trace_attr fun cid_of oid = let val DOF_core.Instance params = DOF_core.get_instance_global oid thy in #cid params end @@ -1631,8 +1641,12 @@ fun register_oid_cid_in_open_monitors oid pos cid_pos thy = fun def_trans_value oid = (#1 o (calc_update_term {mk_elaboration=true} thy (cid_of oid) assns')) #> value ctxt - val _ = if null enabled_monitors then () else writeln "registrating in monitors ..." - val _ = app (fn (n, _) => writeln(oid^" : "^cid_long^" ==> "^n)) enabled_monitors; + val _ = if null enabled_monitors + then () + else if defined + then (tracing "registrating in monitors ..." ; + app (fn (n, _) => tracing (oid^" : "^cid_long^" ==> "^n)) enabled_monitors) + else () (* check that any transition is possible: *) fun class_inv_checks thy = enabled_monitors