From 8771d8581ba7b7ac0b188d0f4a8e27dae3d3485c Mon Sep 17 00:00:00 2001 From: Burkhart Wolff Date: Tue, 1 Dec 2020 23:18:13 +0100 Subject: [PATCH 01/18] default class checking bug fixed; new attributes for default classes in ontological macros Definition* Theorem* Lemma* --- .../scholarly_paper/2020-iFM-CSP/paper.thy | 28 +++--- src/DOF/Isa_COL.thy | 2 +- src/DOF/Isa_DOF.thy | 10 +- .../scholarly_paper/scholarly_paper.thy | 99 +++++++++++++------ 4 files changed, 90 insertions(+), 49 deletions(-) diff --git a/examples/scholarly_paper/2020-iFM-CSP/paper.thy b/examples/scholarly_paper/2020-iFM-CSP/paper.thy index 3302e56..00018de 100644 --- a/examples/scholarly_paper/2020-iFM-CSP/paper.thy +++ b/examples/scholarly_paper/2020-iFM-CSP/paper.thy @@ -8,6 +8,9 @@ begin open_monitor*[this::article] declare[[strict_monitor_checking = false]] +declare[[ Definition_default_class="definition"]] +declare[[ Lemma_default_class="lemma"]] +declare[[ Theorem_default_class="theorem"]] setup \ DOF_lib.define_shortcut \<^binding>\csp\ "CSP" #> DOF_lib.define_shortcut \<^binding>\isabelle\ "Isabelle/HOL"\ @@ -528,15 +531,17 @@ To handle termination better, we added two new processes \CHAOS\<^sub>S\<^ %thus must be without it. \ -text*[X22::"definition"]\\RUN A \ \ X. \ x \ A \ X\ \ -text*[X32::"definition"]\\CHAOS A \ \ X. (STOP \ (\ x \ A \ X))\ \ -Definition*[X42::"definition"]\\CHAOS\<^sub>S\<^sub>K\<^sub>I\<^sub>P A \ \ X. (SKIP \ STOP \ (\ x \ A \ X))\\ +(*<*) (* a test ...*) +text*[X22 ::math_content ]\\RUN A \ \ X. \ x \ A \ X\ \<^vs>\-0.7cm\ \ +text*[X32::"definition", mcc=defn]\\CHAOS A \ \ X. (STOP \ (\ x \ A \ X)) \<^vs>\-0.7cm\\\ +Definition*[X42]\\CHAOS\<^sub>S\<^sub>K\<^sub>I\<^sub>P A \ \ X. (SKIP \ STOP \ (\ x \ A \ X))\ \<^vs>\-0.7cm\\ +Definition*[X52::"definition"]\\CHAOS\<^sub>S\<^sub>K\<^sub>I\<^sub>P A \ \ X. (SKIP \ STOP \ (\ x \ A \ X))\ \<^vs>\-0.7cm\\ -text\ The \RUN\-process defined @{definition X22} represents the process that accepts all +text\ The \RUN\-process defined @{math_content X22} represents the process that accepts all events, but never stops nor deadlocks. The \CHAOS\-process comes in two variants shown in -@{definition X32} and @{definition X42}: the process that non-deterministically stops or -accepts any offered event, whereas \CHAOS\<^sub>S\<^sub>K\<^sub>I\<^sub>P\ can additionally terminate.\ - +@{definition X32} and @{definition X42} @{definition X52}: the process that non-deterministically +stops or accepts any offered event, whereas \CHAOS\<^sub>S\<^sub>K\<^sub>I\<^sub>P\ can additionally terminate.\ +(*>*) Definition*[X2]\\RUN A \ \ X. \ x \ A \ X\ \<^vs>\-0.7cm\\ Definition*[X3]\\CHAOS A \ \ X. (STOP \ (\ x \ A \ X))\ \<^vs>\-0.7cm\\ @@ -605,8 +610,7 @@ In the literature, deadlock and lifelock are phenomena that are often handled separately. One contribution of our work is establish their precise relationship inside the Failure/Divergence Semantics of \<^csp>.\ -(* bizarre: Definition* does not work for this single case *) -text*[X10::"definition"]\ \deadlock\<^sub>-free P \ DF\<^sub>S\<^sub>K\<^sub>I\<^sub>P UNIV \\<^sub>\ P\ \<^vs>\-0.3cm\ \ +Definition*[X10]\ \deadlock\<^sub>-free P \ DF\<^sub>S\<^sub>K\<^sub>I\<^sub>P UNIV \\<^sub>\ P\ \<^vs>\-0.3cm\ \ text\\<^noindent> A process \P\ is deadlock-free if and only if after any trace \s\ without \\\, the union of \\\ and all events of \P\ can never be a refusal set associated to \s\, which means that \P\ cannot @@ -635,9 +639,9 @@ Theorem*[T2, short_name="''DF implies LF''"] \ \hspace{0.5cm} \deadlock_free P \ livelock_free P\ \<^vs>\-0.3cm\\ text\ -This is totally natural, at a first glance, but surprising as the proof of deadlock-freeness only requires -failure refinement \\\<^sub>\\ (see @{definition \X10\}) where divergence traces are mixed within the failures set. -Note that the existing tools in the literature normally detect these two phenomena +This is totally natural, at a first glance, but surprising as the proof of deadlock-freeness only +requires failure refinement \\\<^sub>\\ (see @{definition \X10\}) where divergence traces are mixed within +the failures set. Note that the existing tools in the literature normally detect these two phenomena separately, such as FDR for which checking livelock-freeness is very costly. In our framework, deadlock-freeness of a given system implies its livelock-freeness. However, if a system is not deadlock-free, diff --git a/src/DOF/Isa_COL.thy b/src/DOF/Isa_COL.thy index 35f26df..62b1e84 100755 --- a/src/DOF/Isa_COL.thy +++ b/src/DOF/Isa_COL.thy @@ -98,7 +98,7 @@ fun transform_cid thy NONE X = X in if DOF_core.is_subclass_global thy sub_cid_long cid_long then (SOME (sub_cid,pos)) else (* (SOME (sub_cid,pos)) *) - (* BUG : check reveals problem of Definition* misuse. *) + (* BUG : check reveals problem of Definition* misuse. *) error("class "^sub_cid_long^ " must be sub-class of "^cid_long) end diff --git a/src/DOF/Isa_DOF.thy b/src/DOF/Isa_DOF.thy index 210bfb8..5955683 100755 --- a/src/DOF/Isa_DOF.thy +++ b/src/DOF/Isa_DOF.thy @@ -909,8 +909,8 @@ fun ML_isa_check_docitem thy (term, req_ty, pos) = | _ => error("can not infer type for: "^ name) in if cid <> DOF_core.default_cid andalso not(DOF_core.is_subclass ctxt cid req_class) - then error("reference ontologically inconsistent: "^ - Position.here pos_decl) + then error("reference ontologically inconsistent: " + ^cid^" vs. "^req_class^ Position.here pos_decl) else () end else err ("faulty reference to docitem: "^name) pos @@ -1533,9 +1533,9 @@ fun check_and_mark ctxt cid_decl (str:{strict_checking: bool}) {inline=inline_re val markup = docref_markup false name id pos_decl; val _ = Context_Position.report ctxt pos markup; (* this sends a report for a ref application to the PIDE interface ... *) - val _ = if cid <> DOF_core.default_cid - andalso not(DOF_core.is_subclass ctxt cid cid_decl) - then error("reference ontologically inconsistent:" ^ Position.here pos_decl) + val _ = if not(DOF_core.is_subclass ctxt cid cid_decl) + then error("reference ontologically inconsistent: "^cid + ^" must be subclass of "^cid_decl^ Position.here pos_decl) else () in () end else if DOF_core.is_declared_oid_global name thy diff --git a/src/ontologies/scholarly_paper/scholarly_paper.thy b/src/ontologies/scholarly_paper/scholarly_paper.thy index 58e820a..27eba57 100755 --- a/src/ontologies/scholarly_paper/scholarly_paper.thy +++ b/src/ontologies/scholarly_paper/scholarly_paper.thy @@ -244,38 +244,79 @@ doc_class "math_example" = math_content + mcc :: "math_content_class" <= "expl" invariant d5 :: "\ \::math_example. mcc \ = expl" -subsection\Ontological Macros\ + +subsection\Ontological Macros \<^verbatim>\Definition*\ , \<^verbatim>\Lemma**\, \<^verbatim>\Theorem*\ ... \ + +text\These ontological macros allow notations are defined for the class + \<^typ>\math_content\ in order to allow for a variety of free-form formats; + in order to provide specific sub-classes, default options can be set + in order to support more succinct notations and avoid constructs + such as : + + \<^theory_text>\Definition*[l::"definition"]\...\\. + + Instead, the more convenient global declaration + \<^theory_text>\declare[[Definition_default_class="definition"]]\ + supports subsequent abbreviations: + + \<^theory_text>\Definition*[l]\...\\. +\ + +ML\ +val (Definition_default_class, Definition_default_class_setup) + = Attrib.config_string \<^binding>\Definition_default_class\ (K ""); +val (Lemma_default_class, Lemma_default_class_setup) + = Attrib.config_string \<^binding>\Lemma_default_class\ (K ""); +val (Theorem_default_class, Theorem_default_class_setup) + = Attrib.config_string \<^binding>\Theorem_default_class\ (K ""); + + +\ +setup\Definition_default_class_setup\ +setup\Lemma_default_class_setup\ +setup\Theorem_default_class_setup\ + ML\ local open ODL_Command_Parser in -(* *********************************************************************** *) -(* Ontological Macro Command Support *) -(* *********************************************************************** *) -(* {markdown = true} sets the parsing process such that in the text-core markdown elements are - accepted. *) +(* {markdown = true} sets the parsing process such that in the text-core + markdown elements are accepted. *) -val _ = - Outer_Syntax.command ("Definition*", @{here}) "Textual Definition" - (attributes -- Parse.opt_target -- Parse.document_source --| semi - >> (Toplevel.theory o (Onto_Macros.enriched_formal_statement_command - (SOME "math_content") (* should be (SOME "definition") *) - [("mcc","defn")] - {markdown = true} ))); + +val _ = let fun use_Definition_default thy = + let val ddc = Config.get_global thy Definition_default_class + in (SOME(((ddc = "") ? (K "math_content")) ddc)) end + in Outer_Syntax.command ("Definition*", @{here}) "Textual Definition" + (attributes -- Parse.opt_target -- Parse.document_source --| semi + >> (Toplevel.theory o (fn args => fn thy => + Onto_Macros.enriched_formal_statement_command + (use_Definition_default thy) + [("mcc","defn")] + {markdown = true} args thy))) + end; -val _ = - Outer_Syntax.command ("Lemma*", @{here}) "Textual Lemma Outline" - (attributes -- Parse.opt_target -- Parse.document_source --| semi - >> (Toplevel.theory o (Onto_Macros.enriched_formal_statement_command - (SOME "lemma") - [("mcc","lem")] - {markdown = true} ))); +val _ = let fun use_Lemma_default thy = + let val ddc = Config.get_global thy Definition_default_class + in (SOME(((ddc = "") ? (K "math_content")) ddc)) end + in Outer_Syntax.command ("Lemma*", @{here}) "Textual Lemma Outline" + (attributes -- Parse.opt_target -- Parse.document_source --| semi + >> (Toplevel.theory o (fn args => fn thy => + Onto_Macros.enriched_formal_statement_command + (use_Lemma_default thy) + [("mcc","lem")] + {markdown = true} args thy))) + end; -val _ = - Outer_Syntax.command ("Theorem*", @{here}) "Textual Theorem Outline" - (attributes -- Parse.opt_target -- Parse.document_source --| semi - >> (Toplevel.theory o (Onto_Macros.enriched_formal_statement_command - (SOME "theorem") - [("mcc","thm")] - {markdown = true} ))); +val _ = let fun use_Theorem_default thy = + let val ddc = Config.get_global thy Definition_default_class + in (SOME(((ddc = "") ? (K "math_content")) ddc)) end + in Outer_Syntax.command ("Theorem*", @{here}) "Textual Theorem Outline" + (attributes -- Parse.opt_target -- Parse.document_source --| semi + >> (Toplevel.theory o (fn args => fn thy => + Onto_Macros.enriched_formal_statement_command + (use_Theorem_default thy) + [("mcc","thm")] + {markdown = true} args thy))) + end; end \ @@ -442,10 +483,6 @@ fun check_group a = map (check_group_elem (check_level_hd (hd a))) (tl a) ; section\Miscelleous\ -ML\ -Parse.int -\ - subsection\Layout Trimming Commands\ setup\ DOF_lib.define_macro \<^binding>\hs\ "\\hspace{" "}" (K(K())) \ setup\ DOF_lib.define_macro \<^binding>\vs\ "\\vspace{" "}" (K(K())) \ From 0e64608a5852a9cc11216fd2c78413b99d353d64 Mon Sep 17 00:00:00 2001 From: Burkhart Wolff Date: Wed, 2 Dec 2020 09:32:48 +0100 Subject: [PATCH 02/18] enforcing shorter Definition* - style in examples (CC,CENELEC,...) --- .../Isabelle_DOF-Manual/00_Frontmatter.thy | 2 + .../TR_MyCommentedIsabelle.thy | 2 +- src/ontologies/CC_v3.1_R5/CC_terminology.thy | 199 +++++++++--------- .../CENELEC_50128/CENELEC_50128.thy | 112 +++++----- .../scholarly_paper/scholarly_paper.thy | 15 +- 5 files changed, 181 insertions(+), 149 deletions(-) diff --git a/examples/technical_report/Isabelle_DOF-Manual/00_Frontmatter.thy b/examples/technical_report/Isabelle_DOF-Manual/00_Frontmatter.thy index 18732d6..41a9812 100755 --- a/examples/technical_report/Isabelle_DOF-Manual/00_Frontmatter.thy +++ b/examples/technical_report/Isabelle_DOF-Manual/00_Frontmatter.thy @@ -16,6 +16,8 @@ theory "00_Frontmatter" imports "Isabelle_DOF.technical_report" begin +text\ \ \\\ + section\Document Local Setup.\ text\Some internal setup, introducing document specific abbreviations and macros.\ diff --git a/examples/technical_report/TR_my_commented_isabelle/TR_MyCommentedIsabelle.thy b/examples/technical_report/TR_my_commented_isabelle/TR_MyCommentedIsabelle.thy index 4666928..a6c05bc 100755 --- a/examples/technical_report/TR_my_commented_isabelle/TR_MyCommentedIsabelle.thy +++ b/examples/technical_report/TR_my_commented_isabelle/TR_MyCommentedIsabelle.thy @@ -702,7 +702,7 @@ proof - fix a :: nat subsection*[t233::technical]\ Theories and the Signature API\ text\ -\<^enum> \<^ML>\Sign.tsig_of : theory -> Type.tsig\ extraxts the type-signature of a theory +\<^enum> \<^ML>\Sign.tsig_of : theory -> Type.tsig\ extracts the type-signature of a theory \<^enum> \<^ML>\Sign.syn_of : theory -> Syntax.syntax\ extracts the constant-symbol signature \<^enum> \<^ML>\Sign.of_sort : theory -> typ * sort -> bool\ decides that a type belongs to a sort. \ diff --git a/src/ontologies/CC_v3.1_R5/CC_terminology.thy b/src/ontologies/CC_v3.1_R5/CC_terminology.thy index 4761974..fb6b8d4 100644 --- a/src/ontologies/CC_v3.1_R5/CC_terminology.thy +++ b/src/ontologies/CC_v3.1_R5/CC_terminology.thy @@ -10,7 +10,7 @@ begin text\We re-use the class @\typ math_content\, which provides also a framework for semi-formal terminology, which we re-use by this definition.\ -doc_class concept_definition = "definition" + +doc_class concept_definition = math_content + status :: status <= "semiformal" mcc :: math_content_class <= "terminology" tag :: string @@ -20,6 +20,9 @@ text\The \<^verbatim>\short_tag\, if set, is used in the pres type_synonym concept = concept_definition +declare[[ Definition_default_class="concept_definition"]] + + (*>>*) section \Terminology\ @@ -27,86 +30,86 @@ section \Terminology\ subsection \Terms and definitions common in the CC\ -Definition* [aas_def::concept, tag= "''adverse actions''"] +Definition* [aas_def, tag= "''adverse actions''"] \actions performed by a threat agent on an asset\ -declare_reference*[toe_def::concept] +declare_reference*[toe_def] -Definition* [assts_def::concept, tag="''assets''"] +Definition* [assts_def, tag="''assets''"] \entities that the owner of the @{docitem toe_def} presumably places value upon \ -Definition* [asgn_def::concept, tag="''assignment''"] +Definition* [asgn_def, tag="''assignment''"] \the specification of an identified parameter in a component (of the CC) or requirement.\ -declare_reference*[sfrs_def::concept] +declare_reference*[sfrs_def] -Definition* [assrc_def::concept, tag="''assurance''"] +Definition* [assrc_def, tag="''assurance''"] \grounds for confidence that a @{docitem toe_def} meets the @{docitem sfrs_def}\ -Definition* [attptl_def::concept, tag="''attack potential''"] +Definition* [attptl_def, tag="''attack potential''"] \measure of the effort to be expended in attacking a TOE, expressed in terms of an attacker's expertise, resources and motivation\ -Definition* [argmt_def::concept, tag= "''augmentation''"] +Definition* [argmt_def, tag= "''augmentation''"] \addition of one or more requirement(s) to a package\ -Definition* [authdata_def::concept, tag="''authentication data''"] +Definition* [authdata_def, tag="''authentication data''"] \information used to verify the claimed identity of a user\ -Definition* [authusr_def::concept, tag = "''authorised user''"] +Definition* [authusr_def, tag = "''authorised user''"] \@{docitem toe_def} user who may, in accordance with the @{docitem sfrs_def}, perform an operation\ -Definition* [bpp_def::concept, tag="''Base Protection Profile''"] +Definition* [bpp_def, tag="''Base Protection Profile''"] \Protection Profile used as a basis to build a Protection Profile Configuration\ -Definition* [cls_def::concept,tag="''class''"] +Definition* [cls_def,tag="''class''"] \set of CC families that share a common focus\ -Definition* [cohrnt_def::concept,tag="''coherent''"] +Definition* [cohrnt_def,tag="''coherent''"] \logically ordered and having discernible meaning For documentation, this addresses both the actual text and the structure of the document, in terms of whether it is understandable by its target audience.\ -Definition* [cmplt_def::concept, tag="''complete''"] +Definition* [cmplt_def, tag="''complete''"] \property where all necessary parts of an entity have been provided In terms of documentation, this means that all relevant information is covered in the documentation, at such a level of detail that no further explanation is required at that level of abstraction.\ -Definition* [compnt_def::concept, tag="''component''"] +Definition* [compnt_def, tag="''component''"] \smallest selectable set of elements on which requirements may be based\ -Definition*[cap_def::concept, tag="''composed assurance package''"] +Definition*[cap_def, tag="''composed assurance package''"] \assurance package consisting of requirements drawn from CC Part 3 (predominately from the ACO class), representing a point on the CC predefined composition assurance scale\ -Definition* [cfrm_def::concept,tag="''confirm''"] +Definition* [cfrm_def,tag="''confirm''"] \declare that something has been reviewed in detail with an independent determination of sufficiency The level of rigour required depends on the nature of the subject matter. This term is only applied to evaluator actions.\ -Definition* [cnnctvty_def::concept, tag="''connectivity''"] +Definition* [cnnctvty_def, tag="''connectivity''"] \property of the @{docitem toe_def} allowing interaction with IT entities external to the @{docitem toe_def} This includes exchange of data by wire or by wireless means, over any distance in any environment or configuration.\ -Definition* [cnstnt_def::concept, tag="''consistent''"] +Definition* [cnstnt_def, tag="''consistent''"] \relationship between two or more entities such that there are no apparent contradictions between these entities\ -Definition* [cnt_vrb_def::concept, tag="''counter, verb''"] +Definition* [cnt_vrb_def, tag="''counter, verb''"] \meet an attack where the impact of a particular threat is mitigated but not necessarily eradicated\ -declare_reference*[st_def::concept] -declare_reference*[pp_def::concept] +declare_reference*[st_def] +declare_reference*[pp_def] -Definition* [dmnst_conf_def::concept, tag="''demonstrable conformance''"] +Definition* [dmnst_conf_def, tag="''demonstrable conformance''"] \relation between an @{docitem st_def} and a @{docitem pp_def}, where the @{docitem st_def} provides a solution which solves the generic security problem in the PP @@ -116,19 +119,19 @@ also suitable for a @{docitem toe_def} type where several similar @{docitem pp_d allowing the ST author to claim conformance to these @{docitem pp_def}s simultaneously, thereby saving work.\ -Definition* [dmstrt_def::concept, tag="''demonstrate''"] +Definition* [dmstrt_def, tag="''demonstrate''"] \provide a conclusion gained by an analysis which is less rigorous than a “proof”\ -Definition* [dpndcy::concept, tag="''dependency''"] +Definition* [dpndcy, tag="''dependency''"] \relationship between components such that if a requirement based on the depending component is included in a @{docitem pp_def}, ST or package, a requirement based on the component that is depended upon must normally also be included in the @{docitem pp_def}, @{docitem st_def} or package\ -Definition* [dscrb_def::concept, tag="''describe''"] +Definition* [dscrb_def, tag="''describe''"] \provide specific details of an entity\ -Definition* [dtrmn_def::concept, tag="''determine''"] +Definition* [dtrmn_def, tag="''determine''"] \affirm a particular conclusion based on independent analysis with the objective of reaching a particular conclusion @@ -137,35 +140,35 @@ Definition* [dtrmn_def::concept, tag="''determine''"] terms “confirm” or “verify” which imply that an analysis has already been performed which needs to be reviewed\ -Definition* [devenv_def::concept, tag="''development environment''"] +Definition* [devenv_def, tag="''development environment''"] \environment in which the @{docitem toe_def} is developed\ -Definition* [elmnt_def::concept, tag="''element''"] +Definition* [elmnt_def, tag="''element''"] \indivisible statement of a security need\ -Definition* [ensr_def::concept, tag="''ensure''"] +Definition* [ensr_def, tag="''ensure''"] \guarantee a strong causal relationship between an action and its consequences When this term is preceded by the word “help” it indicates that the consequence is not fully certain, on the basis of that action alone.\ -Definition* [eval_def::concept, tag="''evaluation''"] +Definition* [eval_def, tag="''evaluation''"] \assessment of a @{docitem pp_def}, an @{docitem st_def} or a @{docitem toe_def}, against defined criteria.\ -Definition* [eal_def::concept, tag= "''evaluation assurance level''"] +Definition* [eal_def, tag= "''evaluation assurance level''"] \set of assurance requirements drawn from CC Part 3, representing a point on the CC predefined assurance scale, that form an assurance package\ -Definition* [eval_auth_def::concept, tag="''evaluation authority''"] +Definition* [eval_auth_def, tag="''evaluation authority''"] \body that sets the standards and monitors the quality of evaluations conducted by bodies within a specific community and implements the CC for that community by means of an evaluation scheme\ -Definition* [eval_schm_def::concept, tag="''evaluation scheme''"] +Definition* [eval_schm_def, tag="''evaluation scheme''"] \administrative and regulatory framework under which the CC is applied by an evaluation authority within a specific community\ -Definition* [exst_def::concept, tag="''exhaustive''"] +Definition* [exst_def, tag="''exhaustive''"] \characteristic of a methodical approach taken to perform an analysis or activity according to an unambiguous plan This term is used in the CC with respect to conducting an analysis or other @@ -175,31 +178,31 @@ analysis or activity according to an unambiguous plan, but that the plan that was followed is sufficient to ensure that all possible avenues have been exercised.\ -Definition* [expln_def::concept, tag="''explain''"] +Definition* [expln_def, tag="''explain''"] \ give argument accounting for the reason for taking a course of action This term differs from both “describe” and “demonstrate”. It is intended to answer the question “Why?” without actually attempting to argue that the course of action that was taken was necessarily optimal.\ -Definition* [extn_def::concept, tag= "''extension''"] +Definition* [extn_def, tag= "''extension''"] \addition to an ST or PP of functional requirements not contained in CC Part 2 and/or assurance requirements not contained in CC Part 3\ -Definition* [extnl_ent_def::concept, tag="''external entity''"] +Definition* [extnl_ent_def, tag="''external entity''"] \human or IT entity possibly interacting with the TOE from outside of the TOE boundary\ -Definition* [fmly_def::concept, tag="''family''"] +Definition* [fmly_def, tag="''family''"] \set of components that share a similar goal but differ in emphasis or rigour\ -Definition* [fml_def::concept, tag="''formal''"] +Definition* [fml_def, tag="''formal''"] \expressed in a restricted syntax language with defined semantics based on well-established mathematical concepts \ -Definition* [gudn_doc_def::concept, tag="''guidance documentation''"] +Definition* [gudn_doc_def, tag="''guidance documentation''"] \documentation that describes the delivery, preparation, operation, management and/or use of the TOE\ -Definition* [ident_def::concept, tag="''identity''"] +Definition* [ident_def, tag="''identity''"] \representation uniquely identifying entities (e.g. a user, a process or a disk) within the context of the TOE @@ -207,110 +210,110 @@ Definition* [ident_def::concept, tag="''identity''"] representation can be the full or abbreviated name or a (still unique) pseudonym.\ -Definition* [infml_def::concept, tag="''informal''"] +Definition* [infml_def, tag="''informal''"] \expressed in natural language\ -Definition* [intr_tsf_trans_def::concept, tag ="''inter TSF transfers''"] +Definition* [intr_tsf_trans_def, tag ="''inter TSF transfers''"] \communicating data between the TOE and the security functionality of other trusted IT products\ -Definition* [intl_com_chan_def::concept, tag ="''internal communication channel''"] +Definition* [intl_com_chan_def, tag ="''internal communication channel''"] \communication channel between separated parts of the TOE\ -Definition* [int_toe_trans::concept, tag="''internal TOE transfer''"] +Definition* [int_toe_trans, tag="''internal TOE transfer''"] \communicating data between separated parts of the TOE\ -Definition* [inter_consist_def::concept, tag="''internally consistent''"] +Definition* [inter_consist_def, tag="''internally consistent''"] \no apparent contradictions exist between any aspects of an entity In terms of documentation, this means that there can be no statements within the documentation that can be taken to contradict each other.\ -Definition* [iter_def::concept, tag="''iteration''"] +Definition* [iter_def, tag="''iteration''"] \use of the same component to express two or more distinct requirements\ -Definition* [jstfct_def::concept, tag="''justification''"] +Definition* [jstfct_def, tag="''justification''"] \analysis leading to a conclusion “Justification” is more rigorous than a demonstration. This term requires significant rigour in terms of very carefully and thoroughly explaining every step of a logical argument.\ -Definition* [objct_def::concept, tag="''object''"] +Definition* [objct_def, tag="''object''"] \passive entity in the TOE, that contains or receives information, and upon which subjects perform operations\ -Definition* [op_cc_cmpnt_def::concept, tag ="''operation (on a component of the CC)''"] +Definition* [op_cc_cmpnt_def, tag ="''operation (on a component of the CC)''"] \modification or repetition of a component Allowed operations on components are assignment, iteration, refinement and selection.\ -Definition* [op_obj_def::concept, tag= "''operation (on an object)''"] +Definition* [op_obj_def, tag= "''operation (on an object)''"] \specific type of action performed by a subject on an object\ -Definition* [op_env_def::concept, tag= "''operational environment''"] +Definition* [op_env_def, tag= "''operational environment''"] \environment in which the TOE is operated\ -Definition* [org_sec_po_def::concept, tag="''organisational security policy''"] +Definition* [org_sec_po_def, tag="''organisational security policy''"] \set of security rules, procedures, or guidelines for an organisation A policy may pertain to a specific operational environment.\ -Definition* [pckg_def::concept, tag="''package''"] +Definition* [pckg_def, tag="''package''"] \named set of either security functional or security assurance requirements An example of a package is “EAL 3”.\ -Definition* [pp_config_def::concept, tag="''Protection Profile Configuration''"] +Definition* [pp_config_def, tag="''Protection Profile Configuration''"] \Protection Profile composed of Base Protection Profiles and Protection Profile Module\ -Definition* [pp_eval_def::concept, tag="''Protection Profile evaluation''"] +Definition* [pp_eval_def, tag="''Protection Profile evaluation''"] \ assessment of a PP against defined criteria \ -Definition* [pp_def::concept, tag="''Protection Profile''"] +Definition* [pp_def, tag="''Protection Profile''"] \implementation-independent statement of security needs for a TOE type\ -Definition* [ppm_def::concept, tag="''Protection Profile Module''"] +Definition* [ppm_def, tag="''Protection Profile Module''"] \implementation-independent statement of security needs for a TOE type complementary to one or more Base Protection Profiles\ -declare_reference*[tsf_def::concept] +declare_reference*[tsf_def] -Definition* [prv_def::concept, tag="''prove''"] +Definition* [prv_def, tag="''prove''"] \show correspondence by formal analysis in its mathematical sense It is completely rigorous in all ways. Typically, “prove” is used when there is a desire to show correspondence between two @{docitem tsf_def} representations at a high level of rigour.\ -Definition* [ref_def::concept, tag="''refinement''"] +Definition* [ref_def, tag="''refinement''"] \addition of details to a component\ -Definition* [role_def::concept, tag="''role''"] +Definition* [role_def, tag="''role''"] \predefined set of rules establishing the allowed interactions between a user and the @{docitem toe_def}\ -declare_reference*[sfp_def::concept] +declare_reference*[sfp_def] -Definition* [scrt_def::concept, tag="''secret''"] +Definition* [scrt_def, tag="''secret''"] \information that must be known only to authorised users and/or the @{docitem tsf_def} in order to enforce a specific @{docitem sfp_def}\ -declare_reference*[sfr_def::concept] +declare_reference*[sfr_def] -Definition* [sec_st_def::concept, tag="''secure state''"] +Definition* [sec_st_def, tag="''secure state''"] \state in which the @{docitem tsf_def} data are consistent and the @{docitem tsf_def} continues correct enforcement of the @{docitem sfr_def}s\ -Definition* [sec_att_def::concept, tag="''security attribute''"] +Definition* [sec_att_def, tag="''security attribute''"] \property of subjects, users (including external IT products), objects, information, sessions and/or resources that is used in defining the @{docitem sfr_def}s and whose values are used in enforcing the @{docitem sfr_def}s\ -Definition* [sec_def::concept, tag="''security''"] +Definition* [sec_def, tag="''security''"] \function policy set of rules describing specific security behaviour enforced by the @{docitem tsf_def} and expressible as a set of @{docitem sfr_def}s\ -Definition* [sec_obj_def::concept, tag="''security objective''"] +Definition* [sec_obj_def, tag="''security objective''"] \statement of an intent to counter identified threats and/or satisfy identified organisation security policies and/or assumptions\ -Definition* [sec_prob_def::concept, tag ="''security problem''"] +Definition* [sec_prob_def, tag ="''security problem''"] \statement which in a formal manner defines the nature and scope of the security that the TOE is intended to address This statement consists of a combination of: \begin{itemize} @@ -319,23 +322,23 @@ the TOE is intended to address This statement consists of a combination of:  \item the assumptions that are upheld for the operational environment of the TOE. \end{itemize}\ -Definition* [sr_def::concept, tag="''security requirement''", short_tag="Some(''SR'')"] +Definition* [sr_def, tag="''security requirement''", short_tag="Some(''SR'')"] \requirement, stated in a standardised language, which is meant to contribute to achieving the security objectives for a TOE\ text \@{docitem toe_def}\ -Definition* [st::concept, tag="''Security Target''", short_tag="Some(''ST'')"] +Definition* [st, tag="''Security Target''", short_tag="Some(''ST'')"] \implementation-dependent statement of security needs for a specific i\
dentified @{docitem toe_def}\ -Definition* [slct_def::concept, tag="''selection''"] +Definition* [slct_def, tag="''selection''"] \specification of one or more items from a list in a component\ -Definition* [smfrml_def::concept, tag="''semiformal''"] +Definition* [smfrml_def, tag="''semiformal''"] \expressed in a restricted syntax language with defined semantics\ -Definition* [spcfy_def::concept, tag= "''specify''"] +Definition* [spcfy_def, tag= "''specify''"] \provide specific details about an entity in a rigorous and precise manner\ -Definition* [strct_conf_def::concept, tag="''strict conformance''"] +Definition* [strct_conf_def, tag="''strict conformance''"] \hierarchical relationship between a PP and an ST where all the requirements in the PP also exist in the ST @@ -344,36 +347,36 @@ Definition* [strct_conf_def::concept, tag="''strict conformance''"] be used for stringent requirements that are to be adhered to in a single manner. \ -Definition* [st_eval_def::concept, tag="''ST evaluation''"] +Definition* [st_eval_def, tag="''ST evaluation''"] \assessment of an ST against defined criteria\ -Definition* [subj_def::concept, tag="''subject''"] +Definition* [subj_def, tag="''subject''"] \active entity in the TOE that performs operations on objects\ -Definition* [toe::concept, tag= "''target of evaluation''"] +Definition* [toe, tag= "''target of evaluation''"] \set of software, firmware and/or hardware possibly accompanied by guidance\ -Definition* [thrt_agnt_def::concept, tag="''threat agent''"] +Definition* [thrt_agnt_def, tag="''threat agent''"] \entity that can adversely act on assets\ -Definition* [toe_eval_def::concept, tag="''TOE evaluation''"] +Definition* [toe_eval_def, tag="''TOE evaluation''"] \assessment of a TOE against defined criteria\ -Definition* [toe_res_def::concept, tag="''TOE resource''"] +Definition* [toe_res_def, tag="''TOE resource''"] \anything useable or consumable in the TOE\ -Definition* [toe_sf_def::concept, tag="''TOE security functionality''", short_tag= "Some(''TSF'')"] +Definition* [toe_sf_def, tag="''TOE security functionality''", short_tag= "Some(''TSF'')"] \combined functionality of all hardware, software, and firmware of a TOE that must be relied upon for the correct enforcement of the @{docitem sfr_def}s\ -Definition* [tr_vrb_def::concept, tag="''trace, verb''"] +Definition* [tr_vrb_def, tag="''trace, verb''"] \perform an informal correspondence analysis between two entities with only a minimal level of rigour\ -Definition* [trnsfs_out_toe_def::concept, tag="''transfers outside of the TOE''"] +Definition* [trnsfs_out_toe_def, tag="''transfers outside of the TOE''"] \TSF mediated communication of data to entities not under the control of the TSF\ -Definition* [transl_def::concept, tag= "''translation''"] +Definition* [transl_def, tag= "''translation''"] \ describes the process of describing security requirements in a standardised language. @@ -381,45 +384,45 @@ use of the term translation in this context is not literal and does not imply that every SFR expressed in standardised language can also be translated back to the security objectives.\ -Definition* [trst_chan_def::concept, tag="''trusted channel''"] +Definition* [trst_chan_def, tag="''trusted channel''"] \a means by which a TSF and another trusted IT product can communicate with necessary confidence\ -Definition* [trst_it_prod_def::concept, tag="''trusted IT product''"] +Definition* [trst_it_prod_def, tag="''trusted IT product''"] \IT product, other than the TOE, which has its security functional requirements administratively coordinated with the TOE and which is assumed to enforce its security functional requirements correctly An example of a trusted IT product would be one that has been separately evaluated.\ -Definition* [trst_path_def::concept, tag="''trusted path''"] +Definition* [trst_path_def, tag="''trusted path''"] \means by which a user and a TSF can communicate with the necessary confidence\ -Definition* [tsf_data_def::concept, tag="''TSF data''"] +Definition* [tsf_data_def, tag="''TSF data''"] \data for the operation of the TOE upon which the enforcement of the SFR relies\ -Definition* [tsf_intrfc_def::concept, tag="''TSF interface''"] +Definition* [tsf_intrfc_def, tag="''TSF interface''"] \means by which external entities (or subjects in the TOE but outside of the TSF) supply data to the TSF, receive data from the TSF and invoke services from the TSF\ -Definition* [usr_def::concept, tag="''user''"] \see external entity\ +Definition* [usr_def, tag="''user''"] \see external entity\ -Definition* [usr_datat_def::concept, tag="''user data''"] +Definition* [usr_datat_def, tag="''user data''"] \data for the user, that does not affect the operation of the TSF\ -Definition* [vrfy_def::concept, tag="''verify''"] +Definition* [vrfy_def, tag="''verify''"] \rigorously review in detail with an independent determination of sufficiency Also see “confirm”. This term has more rigorous connotations. The term “verify” is used in the context of evaluator actions where an independent effort is required of the evaluator.\ -Definition* [dev_def::concept, tag="''Developer''"] +Definition* [dev_def, tag="''Developer''"] \who respond to actual or perceived consumer security requirements in constructing a @{docitem toe_def}, reference this CC_Part_3 when interpreting statements of assurance requirements and determining assurance approaches of @{docitem toe}s.\ -Definition*[evalu_def::concept, tag="'' Evaluator''"] +Definition*[evalu_def, tag="'' Evaluator''"] \who use the assurance requirements defined in CC_Part_3 as mandatory statement of evaluation criteria when determining the assurance of @{docitem toe_def}s and when evaluating @{docitem pp_def}s and @{docitem st_def}s.\ diff --git a/src/ontologies/CENELEC_50128/CENELEC_50128.thy b/src/ontologies/CENELEC_50128/CENELEC_50128.thy index c31eafe..f4496ba 100755 --- a/src/ontologies/CENELEC_50128/CENELEC_50128.thy +++ b/src/ontologies/CENELEC_50128/CENELEC_50128.thy @@ -28,8 +28,20 @@ theory CENELEC_50128 imports "../technical_report/technical_report" begin +(* this is a hack and should go into an own ontology, providing thingsd like: + - Assumption* + - Hypothesis* + - Definition*. (Une redefinition de ce qui se passe dans tech-report, cible a semi-formal + “Definitions of terminology” \ ) + - Objective" + - Claim* + - Requirement* + +*) + + text\We re-use the class @\typ math_content\, which provides also a framework for -semi-formal terminology, which we re-use by this definition.\ +semi-formal "math-alike" terminology, which we re-use by this definition.\ doc_class semi_formal_content = math_content + status :: status <= "semiformal" @@ -39,27 +51,29 @@ type_synonym sfc = semi_formal_content (*>>*) +declare[[ Definition_default_class="semi_formal_content"]] + + text\ Excerpt of the BE EN 50128:2011, page 22. \ section\Terms and Definitions\ -typ "sfc" -Definition*[assessment::sfc,short_name="''assessment''"] +Definition*[assessment,short_name="''assessment''"] \process of analysis to determine whether software, which may include process, documentation, system, subsystem hardware and/or software components, meets the specified requirements and to form a judgement as to whether the software is fit for its intended purpose. Safety assessment is focused on but not limited to the safety properties of a system.\ -Definition*[assessor::sfc, short_name="''assessor''"] +Definition*[assessor, short_name="''assessor''"] \entity that carries out an assessment\ -Definition*[COTS::sfc, short_name="''commercial off-the-shelf software''"] +Definition*[COTS, short_name="''commercial off-the-shelf software''"] \software defined by market-driven need, commercially available and whose fitness for purpose has been demonstrated by a broad spectrum of commercial users\ -Definition*[component::sfc] +Definition*[component] \a constituent part of software which has well-defined interfaces and behaviour with respect to the software architecture and design and fulfils the following criteria: @@ -71,53 +85,53 @@ criteria: \ typ "sfc" -Definition*[CMGR::sfc, short_name="''configuration manager''"] +Definition*[CMGR, short_name="''configuration manager''"] \entity that is responsible for implementing and carrying out the processes for the configuration management of documents, software and related tools including \<^emph>\change management\\ -Definition*[customer::sfc] +Definition*[customer] \entity which purchases a railway control and protection system including the software\ -Definition*[designer::sfc] +Definition*[designer] \entity that analyses and transforms specified requirements into acceptable design solutions which have the required safety integrity level\ -Definition*[entity::sfc] +Definition*[entity] \person, group or organisation who fulfils a role as defined in this European Standard\ -declare_reference*[fault::sfc] -Definition*[error::sfc] +declare_reference*[fault] +Definition*[error] \defect, mistake or inaccuracy which could result in failure or in a deviation from the intended performance or behaviour (cf. @{semi_formal_content (unchecked) \fault\}))\ -Definition*[fault::sfc] +Definition*[fault] \defect, mistake or inaccuracy which could result in failure or in a deviation from the intended performance or behaviour (cf @{semi_formal_content \error\})\ -Definition*[failure::sfc] +Definition*[failure] \unacceptable difference between required and observed performance\ -Definition*[FT::sfc, short_name="''fault tolerance''"] +Definition*[FT, short_name="''fault tolerance''"] \built-in capability of a system to provide continued correct provision of service as specified, in the presence of a limited number of hardware or software faults\ -Definition*[firmware::sfc] +Definition*[firmware] \software stored in read-only memory or in semi-permanent storage such as flash memory, in a way that is functionally independent of applicative software\ -Definition*[GS::sfc,short_name="''generic software''"] +Definition*[GS,short_name="''generic software''"] \software which can be used for a variety of installations purely by the provision of application-specific data and/or algorithms\ -Definition*[implementer::sfc] +Definition*[implementer] \entity that transforms specified designs into their physical realisation\ -Definition*[integration::sfc] +Definition*[integration] \process of assembling software and/or hardware items, according to the architectural and design specification, and testing the integrated unit\ -Definition*[integrator::sfc] +Definition*[integrator] \entity that carries out software integration\ Definition*[PES :: sfc, short_name="''pre-existing software''"] @@ -127,52 +141,52 @@ off-the shelf) and open source software\ Definition*[OSS :: sfc, short_name="''open source software''"] \source code available to the general public with relaxed or non-existent copyright restrictions\ -Definition*[PLC::sfc, short_name="''programmable logic controller''"] +Definition*[PLC, short_name="''programmable logic controller''"] \solid-state control system which has a user programmable memory for storage of instructions to implement specific functions\ -Definition*[PM::sfc, short_name="''project management''"] +Definition*[PM, short_name="''project management''"] \administrative and/or technical conduct of a project, including safety aspects\ -Definition*[PGMGR::sfc, short_name="''project manager''"] +Definition*[PGMGR, short_name="''project manager''"] \entity that carries out project management\ -Definition*[reliability::sfc] +Definition*[reliability] \ability of an item to perform a required function under given conditions for a given period of time\ -Definition*[robustness::sfc] +Definition*[robustness] \ability of an item to detect and handle abnormal situations\ -Definition*[RMGR::sfc, short_name="''requirements manager''"] +Definition*[RMGR, short_name="''requirements manager''"] \entity that carries out requirements management\ -Definition*[RMGMT::sfc, short_name="''requirements management''"] +Definition*[RMGMT, short_name="''requirements management''"] \the process of eliciting, documenting, analysing, prioritising and agreeing on requirements and then controlling change and communicating to relevant stakeholders. It is a continuous process throughout a project\ -Definition*[risk::sfc] +Definition*[risk] \combination of the rate of occurrence of accidents and incidents resulting in harm (caused by a hazard) and the degree of severity of that harm\ -Definition*[safety::sfc] +Definition*[safety] \freedom from unacceptable levels of risk of harm to people\ -Definition*[SA::sfc, short_name="''safety authority''"] +Definition*[SA, short_name="''safety authority''"] \body responsible for certifying that safety related software or services comply with relevant statutory safety requirements\ -Definition*[SF::sfc, short_name="''safety function''"] +Definition*[SF, short_name="''safety function''"] \a function that implements a part or whole of a safety requirement\ -Definition*[SFRS::sfc, short_name= "''safety-related software''"] +Definition*[SFRS, short_name= "''safety-related software''"] \software which performs safety functions\ -Definition*[software::sfc] +Definition*[software] \intellectual creation comprising the programs, procedures, rules, data and any associated documentation pertaining to the operation of a system\ -Definition*[SB::sfc, short_name="''software baseline''"] +Definition*[SB, short_name="''software baseline''"] \complete and consistent set of source code, executable files, configuration files, installation scripts and documentation that are needed for a software release. Information about compilers, operating systems, preexisting software and dependent tools is stored as part of the @@ -183,7 +197,7 @@ released and assessed -Definition*[SWLC::sfc, short_name="''software life-cycle''"] +Definition*[SWLC, short_name="''software life-cycle''"] \those activities occurring during a period of time that starts when software is conceived and ends when the software is no longer available for use. The software life cycle typically includes a requirements phase, design phase,test phase, integration phase, @@ -191,35 +205,35 @@ deployment phase and a maintenance phase 3.1.35 software maintainability capability of the software to be modified; to correct faults, improve to a different environment \ -Definition*[SM::sfc, short_name="''software maintenance''"] +Definition*[SM, short_name="''software maintenance''"] \ action, or set of actions, carried out on software after deployment functionality performance or other attributes, or adapt it with the aim of enhancing or correcting its\ -Definition*[SOSIL::sfc, short_name="''software safety integrity level''"] +Definition*[SOSIL, short_name="''software safety integrity level''"] \classification number which determines the techniques and measures that have to be applied to software NOTE Safety-related software has been classified into five safety integrity levels, where 0 is the lowest and 4 the highest.\ -Definition*[supplier::sfc] +Definition*[supplier] \entity that designs and builds a railway control and protection system including the software or parts thereof\ -Definition*[SYSIL::sfc, short_name="''system safety integrity level''"] +Definition*[SYSIL, short_name="''system safety integrity level''"] \classification number which indicates the required degree of confidence that an integrated system comprising hardware and software will meet its specified safety requirements\ -Definition*[tester::sfc]\an entity that carries out testing\ +Definition*[tester]\an entity that carries out testing\ -Definition*[testing::sfc] +Definition*[testing] \process of executing software under controlled conditions as to ascertain its behaviour and performance compared to the corresponding requirements specification\ -Definition*[TCT1::sfc, short_name="''tool class T1''"] +Definition*[TCT1, short_name="''tool class T1''"] \generates no outputs which can directly or indirectly contribute to the executable code (including data) of the software NOTE 11 examples include: a text editor or a requirement or design support tool with no automatic code generation capabilities; configuration control tools.\ -Definition*[TCT2::sfc,short_name="''tool class T2''"] +Definition*[TCT2,short_name="''tool class T2''"] \supports the test or verification of the design or executable code, where errors in the tool can fail to reveal defects but cannot directly create errors in the executable software NOTE T2 examples include: a test harness generator; a test coverage measurement tool; a static @@ -227,35 +241,35 @@ analysis tool. reproduce defined versions and be the input for future releases a at upgrade in the maintenance phase \ -Definition*[TCT3::sfc, short_name="''tool class T3''"] +Definition*[TCT3, short_name="''tool class T3''"] \generates outputs which can directly or indirectly contribute to the executable code (including data) of the safety related system NOTE T3 examples include: a source code compiler, a data/algorithms compiler, a tool to change set-points during system operation; an optimising compiler where the relationship between the source code program and the generated object code is not obvious; a compiler that incorporates an executable run-time package into the executable code. \ -Definition*[traceability::sfc, short_name="''traceability''"] +Definition*[traceability, short_name="''traceability''"] \degree to which relationship can be established between two or more products of a development process, especially those having a predecessor/successor or master/subordinate relationship to one another\ -Definition*[validation::sfc, short_name="''validation''"] +Definition*[validation, short_name="''validation''"] \process of analysis followed by a judgment based on evidence to documentation, software or application) fits the user needs,in particular with respect to safety and quality and determine whether an item (e.g. process, with emphasis on the suitability of its operation in accordance to its purpose in its intended environment\ -Definition*[validator::sfc, short_name="''validator''"] +Definition*[validator, short_name="''validator''"] \entity that is responsible for the validation\ -Definition*[verification::sfc, short_name="''verification''"] +Definition*[verification, short_name="''verification''"] \process of examination followed by a judgment based on evidence that output items (process, documentation, software or application) of a specific development phase fulfils the requirements of that phase with respect to completeness, correctness and consistency. NOTE Verification is mostly based on document reviews (design, implementation, test documents etc.). \ -Definition*[verifier::sfc, short_name="''verifier''"] +Definition*[verifier, short_name="''verifier''"] \entity that is responsible for one or more verification activities\ diff --git a/src/ontologies/scholarly_paper/scholarly_paper.thy b/src/ontologies/scholarly_paper/scholarly_paper.thy index 27eba57..3299604 100755 --- a/src/ontologies/scholarly_paper/scholarly_paper.thy +++ b/src/ontologies/scholarly_paper/scholarly_paper.thy @@ -189,8 +189,21 @@ doc_class math_content = tc + invariant s2 :: "\ \::math_content. status \ = semiformal" type_synonym math_tc = math_content +text\The class \<^typ>\math_content\ is perhaps more adequaltely described as "math-alike content". +Sub-classes can englobe instances such as: +\<^item> terminological definitions such as: + \Definition*[assessor::sfc, short_name="''assessor''"]\entity that carries out an assessment\\ +\<^item> free-form mathematical definitions such as: + \Definition*[process_ordering, short_name="''process ordering''"]\ + We define \P \ Q \ \\<^sub>\ \ \\<^sub>\ \ \\<^sub>\ \, where \<^vs>\-0.2cm\ + 1) \<^vs>\-0.2cm\ \\\<^sub>\ = \ P \ \ Q \ + 2) ... + \\ +\<^item> semi-formal descriptions, which are free-form mathematical definitions on which finally + an attribute with a formal Isabelle definition is attached. + +\ -find_theorems name:"s1" name:"scholarly" (* type qualification is a work around *) From de5c0fc6e2a07f3d36c168cf07d099ccd9bae5d1 Mon Sep 17 00:00:00 2001 From: Burkhart Wolff Date: Tue, 22 Dec 2020 08:07:19 +0100 Subject: [PATCH 03/18] added Isar-syntax for define_shortcut* --- .../IsaDofApplications.thy | 12 ++--- .../scholarly_paper/2020-iFM-CSP/paper.thy | 8 +-- .../Isabelle_DOF-Manual/00_Frontmatter.thy | 21 ++++---- .../TR_MyCommentedIsabelle.thy | 4 +- src/DOF/Isa_COL.thy | 13 ++++- src/ontologies/Conceptual/Conceptual.thy | 6 +-- .../scholarly_paper/scholarly_paper.thy | 49 +++++-------------- 7 files changed, 51 insertions(+), 62 deletions(-) diff --git a/examples/scholarly_paper/2018-cicm-isabelle_dof-applications/IsaDofApplications.thy b/examples/scholarly_paper/2018-cicm-isabelle_dof-applications/IsaDofApplications.thy index 47abf77..6d235ea 100755 --- a/examples/scholarly_paper/2018-cicm-isabelle_dof-applications/IsaDofApplications.thy +++ b/examples/scholarly_paper/2018-cicm-isabelle_dof-applications/IsaDofApplications.thy @@ -19,13 +19,11 @@ begin open_monitor*[this::article] declare[[strict_monitor_checking=false]] -setup \ DOF_lib.define_shortcut \<^binding>\isadof\ "\\isadof" - #> DOF_lib.define_shortcut \<^binding>\LaTeX\ "\\LaTeX{}" - #> DOF_lib.define_shortcut \<^binding>\Protege\ "Prot{\\'e}g{\\'e}" - #> DOF_lib.define_shortcut \<^binding>\dots\ "\\ldots" - #> DOF_lib.define_shortcut \<^binding>\isabelle\ "Isabelle/HOL" - -\ +define_shortcut* isadof \ \\isadof\ + LaTeX \ \\LaTeX{}\ + dots \ \\ldots\ + isabelle \ \Isabelle/HOL\ + Protege \ \Prot{\'e}g{\'e}\ (* slanted text in contrast to italics *) setup\ DOF_lib.define_macro \<^binding>\slanted_text\ "\\textsl{" "}" (K(K()))\ diff --git a/examples/scholarly_paper/2020-iFM-CSP/paper.thy b/examples/scholarly_paper/2020-iFM-CSP/paper.thy index 00018de..c8cb060 100644 --- a/examples/scholarly_paper/2020-iFM-CSP/paper.thy +++ b/examples/scholarly_paper/2020-iFM-CSP/paper.thy @@ -12,17 +12,17 @@ declare[[ Definition_default_class="definition"]] declare[[ Lemma_default_class="lemma"]] declare[[ Theorem_default_class="theorem"]] -setup \ DOF_lib.define_shortcut \<^binding>\csp\ "CSP" - #> DOF_lib.define_shortcut \<^binding>\isabelle\ "Isabelle/HOL"\ +define_shortcut* csp \ \CSP\ + isabelle \ \Isabelle/HOL\ (*>*) title*[tit::title]\Philosophers may Dine - Definitively!\ - + author*[safouan,email="\safouan.taha@lri.fr\",affiliation="\LRI, CentraleSupelec\"]\Safouan Taha\ author*[bu,email= "\wolff@lri.fr\",affiliation = "\LRI, Université Paris-Saclay\"]\Burkhart Wolff\ author*[lina,email="\lina.ye@lri.fr\",affiliation="\LRI, Inria, LSV, CentraleSupelec\"]\Lina Ye\ - + abstract*[abs, keywordlist="[\Shallow Embedding\,\Process-Algebra\, \Concurrency\,\Computational Models\]"] \ The theory of Communicating Sequential Processes going back to Hoare and Roscoe is still today diff --git a/examples/technical_report/Isabelle_DOF-Manual/00_Frontmatter.thy b/examples/technical_report/Isabelle_DOF-Manual/00_Frontmatter.thy index 41a9812..2456605 100755 --- a/examples/technical_report/Isabelle_DOF-Manual/00_Frontmatter.thy +++ b/examples/technical_report/Isabelle_DOF-Manual/00_Frontmatter.thy @@ -16,20 +16,21 @@ theory "00_Frontmatter" imports "Isabelle_DOF.technical_report" begin -text\ \ \\\ section\Document Local Setup.\ text\Some internal setup, introducing document specific abbreviations and macros.\ -setup \DOF_lib.define_shortcut \<^binding>\dof\ "\\dof"\ -setup \DOF_lib.define_shortcut \<^binding>\isadof\ "\\isadof"\ -setup \ DOF_lib.define_shortcut \<^binding>\TeXLive\"\\TeXLive" - #> DOF_lib.define_shortcut \<^binding>\BibTeX\ "\\BibTeX{}" - #> DOF_lib.define_shortcut \<^binding>\LaTeX\ "\\LaTeX{}" - #> DOF_lib.define_shortcut \<^binding>\TeX\ "\\TeX{}" - #> DOF_lib.define_shortcut \<^binding>\pdf\ "PDF" - #> DOF_lib.define_shortcut \<^binding>\pdftex\ "\\pdftex{}" -\ + + +define_shortcut* dof \ \\dof\ + isadof \ \\isadof\ + +define_shortcut* TeXLive \ \\TeXLive\ + BibTeX \ \\BibTeX{}\ + LaTeX \ \\LaTeX{}\ + TeX \ \\TeX{}\ + pdf \ \PDF\ + pdftex \ \\pdftex{}\ text\Note that these setups assume that the associated \<^LaTeX> macros are defined, \<^eg>, in the document prelude. \ diff --git a/examples/technical_report/TR_my_commented_isabelle/TR_MyCommentedIsabelle.thy b/examples/technical_report/TR_my_commented_isabelle/TR_MyCommentedIsabelle.thy index a6c05bc..9b3a49d 100755 --- a/examples/technical_report/TR_my_commented_isabelle/TR_MyCommentedIsabelle.thy +++ b/examples/technical_report/TR_my_commented_isabelle/TR_MyCommentedIsabelle.thy @@ -14,9 +14,10 @@ (*<*) theory TR_MyCommentedIsabelle imports "Isabelle_DOF.technical_report" + begin -setup \ DOF_lib.define_shortcut \<^binding>\isabelle\ "Isabelle/HOL"\ +define_shortcut* isabelle \ \Isabelle/HOL\ open_monitor*[this::report] (*>*) @@ -2311,6 +2312,7 @@ for Unicode Character Denotations as well as many local hints for improvements.\ section*[bib::bibliography]\Bibliography\ + close_monitor*[this] check_doc_global diff --git a/src/DOF/Isa_COL.thy b/src/DOF/Isa_COL.thy index 62b1e84..baea21a 100755 --- a/src/DOF/Isa_COL.thy +++ b/src/DOF/Isa_COL.thy @@ -29,6 +29,7 @@ theory Isa_COL and "figure*" "side_by_side_figure*" :: document_body and "assert*" :: thy_decl + and "define_shortcut*" :: thy_decl begin @@ -413,6 +414,17 @@ fun enclose_env verbatim ctxt block_env body = end \ +ML\ +local +val parse_define_shortcut = Parse.binding -- + ((\<^keyword>\\\ || \<^keyword>\==\) |-- (Parse.alt_string || Parse.cartouche)) +val define_shortcuts = fold(uncurry DOF_lib.define_shortcut) +in +val _ = + Outer_Syntax.command \<^command_keyword>\define_shortcut*\ "define LaTeX shortcut" + (Scan.repeat1 parse_define_shortcut >> (Toplevel.theory o define_shortcuts)); +end +\ section\Tables\ (* TODO ! ! ! *) @@ -426,5 +438,4 @@ ML\@{term "side_by_side_figure"}; @{typ "doc_class rexp"}; DOF_core.SPY;\ - end diff --git a/src/ontologies/Conceptual/Conceptual.thy b/src/ontologies/Conceptual/Conceptual.thy index b02be6b..c00586f 100755 --- a/src/ontologies/Conceptual/Conceptual.thy +++ b/src/ontologies/Conceptual/Conceptual.thy @@ -62,7 +62,7 @@ doc_class F = doc_class G = C + - g :: "thm" <= "@{thm ''HOL.refl''}" + g :: "thm" <= "@{thm \HOL.refl\}" doc_class M = trace :: "(A + C + D + F) list" @@ -79,8 +79,8 @@ ML\ Thy_Header.get_keywords @{theory};(* this looks to be really theory gl section*[test::A]\Test and Validation\ text\Defining some document elements to be referenced in later on in another theory: \ text*[sdf]\ Lorem ipsum @{thm refl}\ -text*[ sdfg] \ Lorem ipsum @{thm refl}\ -text*[ xxxy ] \ Lorem ipsum @{docitem \sdfg\} rate @{thm refl}\ +text*[ sdfg :: F] \ Lorem ipsum @{thm refl}\ +text*[ xxxy ] \ Lorem ipsum @{F \sdfg\} rate @{thm refl}\ end diff --git a/src/ontologies/scholarly_paper/scholarly_paper.thy b/src/ontologies/scholarly_paper/scholarly_paper.thy index 3299604..8f04f55 100755 --- a/src/ontologies/scholarly_paper/scholarly_paper.thy +++ b/src/ontologies/scholarly_paper/scholarly_paper.thy @@ -470,46 +470,23 @@ setup\ let val cidS = ["scholarly_paper.introduction","scholarly_paper.tec in DOF_core.update_class_invariant "scholarly_paper.article" body end\ -(* some test code *) -ML\ -(* - -val trace = AttributeAccess.compute_trace_ML (Context.Proof @{context}) "this" @{here} @{here} -val groups = partition ( @{context}) cidS trace -val _::_::_::_:: _ ::_ ::_ ::a::_ = groups; -check; - -fun get_level_raw oid = AttributeAccess.compute_attr_access (Context.Proof @{context}) "level" oid @{here} @{here}; -fun get_level oid = dest_option (snd o HOLogic.dest_number) (get_level_raw (oid)); -fun check_level_hd a = case (get_level (snd a)) of - NONE => error("Invariant violation: leading section" ^ snd a ^ - " must have lowest level") - | SOME X => X -fun check_group_elem level_hd a = case (get_level (snd a)) of - NONE => true - | SOME y => if y > level_hd then true - else error("Invariant violation: subsequent section " ^ snd a ^ - " must have higher level."); -fun check_group a = map (check_group_elem (check_level_hd (hd a))) (tl a) ; -*) -\ section\Miscelleous\ -subsection\Layout Trimming Commands\ -setup\ DOF_lib.define_macro \<^binding>\hs\ "\\hspace{" "}" (K(K())) \ -setup\ DOF_lib.define_macro \<^binding>\vs\ "\\vspace{" "}" (K(K())) \ -setup\ DOF_lib.define_shortcut \<^binding>\clearpage\ "\\clearpage{}" \ - - subsection\Common Abbreviations\ -setup \ DOF_lib.define_shortcut \<^binding>\eg\ "\\eg" - (* Latin: „exempli gratia“ meaning „for example“. *) - #> DOF_lib.define_shortcut \<^binding>\ie\ "\\ie" - (* Latin: „id est“ meaning „that is to say“. *) - #> DOF_lib.define_shortcut \<^binding>\etc\ "\\etc"\ - - (* this is an alternative style for macro definitions equivalent to setup ... setup ...*) + +define_shortcut* eg \ \\eg\ (* Latin: „exempli gratia“ meaning „for example“. *) + ie \ \\ie\ (* Latin: „id est“ meaning „that is to say“. *) + etc \ \\etc\ (* Latin : et cetera *) + +subsection\Layout Trimming Commands\ + +setup\ DOF_lib.define_macro \<^binding>\hs\ "\\hspace{" "}" (K(K())) \ +setup\ DOF_lib.define_macro \<^binding>\vs\ "\\vspace{" "}" (K(K())) \ + +define_shortcut* clearpage \ \\clearpage{}\ + + end From 5593c22a36f99e1b8f744e25fdd3df631adb81a7 Mon Sep 17 00:00:00 2001 From: Burkhart Wolff Date: Tue, 22 Dec 2020 19:50:00 +0100 Subject: [PATCH 04/18] first version with macro syntax (no ML support) --- .../IsaDofApplications.thy | 3 +- .../scholarly_paper/2020-iFM-CSP/paper.thy | 50 +++++++++---------- .../Isabelle_DOF-Manual/00_Frontmatter.thy | 18 +++---- .../Isabelle_DOF-Manual/05_Implementation.thy | 2 +- src/DOF/Isa_COL.thy | 32 ++++++++---- .../scholarly_paper/scholarly_paper.thy | 7 ++- 6 files changed, 63 insertions(+), 49 deletions(-) diff --git a/examples/scholarly_paper/2018-cicm-isabelle_dof-applications/IsaDofApplications.thy b/examples/scholarly_paper/2018-cicm-isabelle_dof-applications/IsaDofApplications.thy index 6d235ea..9e5772d 100755 --- a/examples/scholarly_paper/2018-cicm-isabelle_dof-applications/IsaDofApplications.thy +++ b/examples/scholarly_paper/2018-cicm-isabelle_dof-applications/IsaDofApplications.thy @@ -26,8 +26,7 @@ define_shortcut* isadof \ \\isadof\ Protege \ \Prot{\'e}g{\'e}\ (* slanted text in contrast to italics *) -setup\ DOF_lib.define_macro \<^binding>\slanted_text\ "\\textsl{" "}" (K(K()))\ - +define_macro* slanted_text \ \\textsl{\ \}\ (*>*) diff --git a/examples/scholarly_paper/2020-iFM-CSP/paper.thy b/examples/scholarly_paper/2020-iFM-CSP/paper.thy index c8cb060..2d4e2d1 100644 --- a/examples/scholarly_paper/2020-iFM-CSP/paper.thy +++ b/examples/scholarly_paper/2020-iFM-CSP/paper.thy @@ -1,18 +1,18 @@ (*<*) theory "paper" - imports - "Isabelle_DOF.scholarly_paper" + imports "Isabelle_DOF.scholarly_paper" begin open_monitor*[this::article] -declare[[strict_monitor_checking = false]] -declare[[ Definition_default_class="definition"]] -declare[[ Lemma_default_class="lemma"]] -declare[[ Theorem_default_class="theorem"]] +declare[[ strict_monitor_checking = false]] +declare[[ Definition_default_class = "definition"]] +declare[[ Lemma_default_class = "lemma"]] +declare[[ Theorem_default_class = "theorem"]] define_shortcut* csp \ \CSP\ + holcsp \ \HOL-CSP\ isabelle \ \Isabelle/HOL\ (*>*) @@ -24,7 +24,7 @@ author*[bu,email= "\wolff@lri.fr\",affiliation = "\LRI, Unive author*[lina,email="\lina.ye@lri.fr\",affiliation="\LRI, Inria, LSV, CentraleSupelec\"]\Lina Ye\ abstract*[abs, keywordlist="[\Shallow Embedding\,\Process-Algebra\, - \Concurrency\,\Computational Models\]"] + \Concurrency\,\Computational Models\]"] \ The theory of Communicating Sequential Processes going back to Hoare and Roscoe is still today one of the reference theories for concurrent specification and computing. In 1997, a first formalization in \<^isabelle> of the denotational semantics of the Failure/Divergence Model of @@ -63,8 +63,8 @@ systems, such as the T9000 transansputer @{cite "Barret95"}. The theory of \<^csp> was first described in 1978 in a book by Tony Hoare @{cite "Hoare:1985:CSP:3921"}, but has since evolved substantially @{cite "BrookesHR84" and "brookes-roscoe85" and "roscoe:csp:1998"}. \<^csp> describes the most common communication and synchronization mechanisms -with one single language primitive: synchronous communication written \_\_\_\. \<^csp> semantics is described -by a fully abstract model of behaviour designed to be \<^emph>\compositional\: the denotational +with one single language primitive: synchronous communication written \_\_\_\. \<^csp> semantics is +described by a fully abstract model of behaviour designed to be \<^emph>\compositional\: the denotational semantics of a process \P\ encompasses all possible behaviours of this process in the context of all possible environments \P \S\ Env\ (where \S\ is the set of \atomic events\ both \P\ and \Env\ must synchronize). This design objective has the consequence that two kinds of choice have to @@ -248,7 +248,7 @@ Second, in the traditional literature, the semantic domain is implicitly describ over the three semantic functions \\\, \\\ and \\\. Informally, these are: - \<^item> the initial trace of a process must be empty; + \<^item> the initial trace of a process must be empty; \<^item> any allowed trace must be \front\<^sub>-tickFree\; \<^item> traces of a process are \<^emph>\prefix-closed\; \<^item> a process can refuse all subsets of a refusal set; @@ -272,10 +272,10 @@ Informally, these are: (\ s t. s \ \ P \ tickFree s \ front_tickFree t \ s@t \ \ P) \ (\ s X. s \ \ P \ (s,X) \ \ P) \ (\ s. s@[\] \ \ P \ s \ \ P)\} - \<^vs>\-0.1cm\ + Our objective is to encapsulate this wishlist into a type constructed as a conservative -theory extension in our theory HOL-\<^csp>. +theory extension in our theory \<^holcsp>. Therefore third, we define a pre-type for processes \\ process\<^sub>0\ by \ \

(\\<^sup>\\<^sup>* \ \

(\\<^sup>\)) \ \

(\\<^sup>\)\. Forth, we turn our wishlist of "axioms" above into the definition of a predicate \is_process P\ of type \\ process\<^sub>0 \ bool\ deciding if its conditions are fulfilled. Since \P\ is a pre-process, @@ -302,7 +302,7 @@ maintains \is_process\, \<^ie> this predicate remains invariant on For example, we define \_\_\ on the pre-process type as follows: \<^vs>\0.1cm\ - \<^item> \<^theory_text>\definition "P \ Q \ Abs_process(\ P \ \ Q , \ P \ \ Q)"\ + \<^item> \<^theory_text>\definition "P \ Q \ Abs_processxx(\ P \ \ Q , \ P \ \ Q)"\ \<^vs>\-0.2cm\ \<^noindent> where \\ = fst \ Rep_process\ and \\ = snd \ Rep_process\ and where \Rep_process\ and @@ -532,9 +532,9 @@ To handle termination better, we added two new processes \CHAOS\<^sub>S\<^ \ (*<*) (* a test ...*) -text*[X22 ::math_content ]\\RUN A \ \ X. \ x \ A \ X\ \<^vs>\-0.7cm\ \ -text*[X32::"definition", mcc=defn]\\CHAOS A \ \ X. (STOP \ (\ x \ A \ X)) \<^vs>\-0.7cm\\\ -Definition*[X42]\\CHAOS\<^sub>S\<^sub>K\<^sub>I\<^sub>P A \ \ X. (SKIP \ STOP \ (\ x \ A \ X))\ \<^vs>\-0.7cm\\ +text*[X22 ::math_content ]\\RUN A \ \ X. \ x \ A \ X\ \<^vs>\-0.7cm\\ +text*[X32::"definition", mcc=defn]\\CHAOS A \ \ X. (STOP \ (\ x \ A \ X))\ \<^vs>\-0.7cm\\ +Definition*[X42]\\CHAOS\<^sub>S\<^sub>K\<^sub>I\<^sub>P A \ \ X. (SKIP \ STOP \ (\ x \ A \ X))\ \<^vs>\-0.7cm\\ Definition*[X52::"definition"]\\CHAOS\<^sub>S\<^sub>K\<^sub>I\<^sub>P A \ \ X. (SKIP \ STOP \ (\ x \ A \ X))\ \<^vs>\-0.7cm\\ text\ The \RUN\-process defined @{math_content X22} represents the process that accepts all @@ -546,21 +546,19 @@ stops or accepts any offered event, whereas \CHAOS\<^sub>S\<^sub>K\<^sub>I Definition*[X2]\\RUN A \ \ X. \ x \ A \ X\ \<^vs>\-0.7cm\\ Definition*[X3]\\CHAOS A \ \ X. (STOP \ (\ x \ A \ X))\ \<^vs>\-0.7cm\\ Definition*[X4]\\CHAOS\<^sub>S\<^sub>K\<^sub>I\<^sub>P A \ \ X. (SKIP \ STOP \ (\ x \ A \ X))\\<^vs>\-0.7cm\\ -Definition*[X5]\\DF A \ \ X. (\ x \ A \ X)\ \<^vs>\-0.7cm\\ -Definition*[X6]\\DF\<^sub>S\<^sub>K\<^sub>I\<^sub>P A \ \ X. ((\ x \ A \ X) \ SKIP)\ \<^vs>\-0.7cm\ \ +Definition*[X5]\\DF A \ \ X. (\ x \ A \ X)\ \<^vs>\-0.7cm\\ +Definition*[X6]\\DF\<^sub>S\<^sub>K\<^sub>I\<^sub>P A \ \ X. ((\ x \ A \ X) \ SKIP)\ \<^vs>\-0.7cm\ \ -text\ \<^vs>\-0.3cm\ \<^noindent> -In the following, we denote \ \\

= {DF\<^sub>S\<^sub>K\<^sub>I\<^sub>P, DF, RUN, CHAOS, CHAOS\<^sub>S\<^sub>K\<^sub>I\<^sub>P}\. +text\ \<^vs>\-0.3cm\ \<^noindent> In the following, we denote \ \\

= {DF\<^sub>S\<^sub>K\<^sub>I\<^sub>P, DF, RUN, CHAOS, CHAOS\<^sub>S\<^sub>K\<^sub>I\<^sub>P}\. All five reference processes are divergence-free. %which was done by using a particular lemma \\ (\ x. f x) = \\<^sub>i\<^sub>\\<^sub>\ \ (f\<^sup>i \)\. - -\<^vs>\-0.2cm\ - @{cartouche [display,indent=8] \ D (\ UNIV) = {} where \ \ \\

and UNIV is the set of all events\} - -\<^vs>\-0.1cm\ +@{cartouche + [display,indent=8] \ D (\ UNIV) = {} where \ \ \\

and UNIV is the set of all events\ +} Regarding the failure refinement ordering, the set of failures \\ P\ for any process \P\ is a subset of \\ (CHAOS\<^sub>S\<^sub>K\<^sub>I\<^sub>P UNIV)\.% and the following lemma was proved: -% This proof is performed by induction, based on the failure projection of \STOP\ and that of internal choice. +% This proof is performed by induction, based on the failure projection of \STOP\ and that of +% internal choice. \<^vs>\-0.2cm\ @{cartouche [display, indent=25] \CHAOS\<^sub>S\<^sub>K\<^sub>I\<^sub>P UNIV \\<^sub>\ P\} diff --git a/examples/technical_report/Isabelle_DOF-Manual/00_Frontmatter.thy b/examples/technical_report/Isabelle_DOF-Manual/00_Frontmatter.thy index 2456605..db1d713 100755 --- a/examples/technical_report/Isabelle_DOF-Manual/00_Frontmatter.thy +++ b/examples/technical_report/Isabelle_DOF-Manual/00_Frontmatter.thy @@ -17,13 +17,11 @@ theory "00_Frontmatter" begin -section\Document Local Setup.\ -text\Some internal setup, introducing document specific abbreviations and macros.\ +section\Local Document Setup.\ +text\... introducing document specific abbreviations and macros.\ - - -define_shortcut* dof \ \\dof\ - isadof \ \\isadof\ +define_shortcut* dof \ \\dof\ + isadof \ \\isadof\ define_shortcut* TeXLive \ \\TeXLive\ BibTeX \ \\BibTeX{}\ @@ -32,11 +30,11 @@ define_shortcut* TeXLive \ \\TeXLive\ pdf \ \PDF\ pdftex \ \\pdftex{}\ -text\Note that these setups assume that the associated \<^LaTeX> macros are defined, \<^eg>, - in the document prelude. \ +text\Note that these setups assume that the associated \<^LaTeX> macros + are defined, \<^eg>, in the document prelude. \ -setup\ DOF_lib.define_macro \<^binding>\index\ "\\index{" "}" (K(K())) (*no checking, no reporting*) - #> DOF_lib.define_macro \<^binding>\bindex\ "\\bindex{" "}"(K(K()))\ +define_macro* index \ \\index{\ \}\ +define_macro* bindex \ \\bindex{\ \}\ ML\ diff --git a/examples/technical_report/Isabelle_DOF-Manual/05_Implementation.thy b/examples/technical_report/Isabelle_DOF-Manual/05_Implementation.thy index a918c59..4377317 100755 --- a/examples/technical_report/Isabelle_DOF-Manual/05_Implementation.thy +++ b/examples/technical_report/Isabelle_DOF-Manual/05_Implementation.thy @@ -22,7 +22,7 @@ chapter*[isadof_developers::text_section]\Extending \<^isadof>\ text\ In this chapter, we describe the basic implementation aspects of \<^isadof>, which is based on the following design-decisions: - \<^item> the entire \<^isadof> is a ``pure add-on,'' \ie, we deliberately resign on the possibility to + \<^item> the entire \<^isadof> is a ``pure add-on,'' \<^ie>, we deliberately resign on the possibility to modify Isabelle itself. \<^item> we made a small exception to this rule: the \<^isadof> package modifies in its installation about 10 lines in the \LaTeX-generator (\path{src/patches/thy_output.ML}). diff --git a/src/DOF/Isa_COL.thy b/src/DOF/Isa_COL.thy index baea21a..d43998a 100755 --- a/src/DOF/Isa_COL.thy +++ b/src/DOF/Isa_COL.thy @@ -29,7 +29,7 @@ theory Isa_COL and "figure*" "side_by_side_figure*" :: document_body and "assert*" :: thy_decl - and "define_shortcut*" :: thy_decl + and "define_shortcut*" "define_macro*":: thy_decl begin @@ -293,9 +293,9 @@ fun define_macro name s1 s2 reportNtest = local (* hide away really strange local construction *) fun enclose_body2 front body1 middle body2 post = - (if front = "" then [] else [Latex.string front]) @ body1 @ + (if front = "" then [] else [Latex.string front]) @ body1 @ (if middle = "" then [] else [Latex.string middle]) @ body2 @ - (if post = "" then [] else [Latex.string post]); + (if post = "" then [] else [Latex.string post]); in fun define_macro2 name front middle post reportNtest1 reportNtest2 = Thy_Output.antiquotation_raw_embedded name (Scan.lift ( Args.cartouche_input @@ -416,19 +416,33 @@ end ML\ local -val parse_define_shortcut = Parse.binding -- - ((\<^keyword>\\\ || \<^keyword>\==\) |-- (Parse.alt_string || Parse.cartouche)) +val parse_literal = Parse.alt_string || Parse.cartouche +val parse_define_shortcut = Parse.binding -- ((\<^keyword>\\\ || \<^keyword>\==\) |-- parse_literal) val define_shortcuts = fold(uncurry DOF_lib.define_shortcut) in -val _ = - Outer_Syntax.command \<^command_keyword>\define_shortcut*\ "define LaTeX shortcut" - (Scan.repeat1 parse_define_shortcut >> (Toplevel.theory o define_shortcuts)); +val _ = Outer_Syntax.command \<^command_keyword>\define_shortcut*\ "define LaTeX shortcut" + (Scan.repeat1 parse_define_shortcut >> (Toplevel.theory o define_shortcuts)); end \ +ML\ +val parse_literal = Parse.alt_string || Parse.cartouche +val parse_define_shortcut = (Parse.binding + -- ((\<^keyword>\\\ || \<^keyword>\==\) |-- parse_literal)) + -- parse_literal + -- (Scan.option (\<^keyword>\(\ |-- Parse.ML_source --|\<^keyword>\)\)) + +fun define_macro (X,NONE) = (uncurry(uncurry(uncurry DOF_lib.define_macro)))(X,K(K())); + + +val _ = Outer_Syntax.command \<^command_keyword>\define_macro*\ "define LaTeX shortcut" + (Scan.repeat1 parse_define_shortcut >> (Toplevel.theory o (fold define_macro))); + +\ + + section\Tables\ (* TODO ! ! ! *) - (* dito the future monitor: table - block *) diff --git a/src/ontologies/scholarly_paper/scholarly_paper.thy b/src/ontologies/scholarly_paper/scholarly_paper.thy index 8f04f55..59e3210 100755 --- a/src/ontologies/scholarly_paper/scholarly_paper.thy +++ b/src/ontologies/scholarly_paper/scholarly_paper.thy @@ -477,12 +477,17 @@ subsection\Common Abbreviations\ define_shortcut* eg \ \\eg\ (* Latin: „exempli gratia“ meaning „for example“. *) ie \ \\ie\ (* Latin: „id est“ meaning „that is to say“. *) - etc \ \\etc\ (* Latin : et cetera *) + etc \ \\etc\ (* Latin : „et cetera“ meaning „et cetera“ *) subsection\Layout Trimming Commands\ +define_macro* hs \ \\hspace{\ \}\ +define_macro* vs \ \\vspace{\ \}\ + +(* setup\ DOF_lib.define_macro \<^binding>\hs\ "\\hspace{" "}" (K(K())) \ setup\ DOF_lib.define_macro \<^binding>\vs\ "\\vspace{" "}" (K(K())) \ +*) define_shortcut* clearpage \ \\clearpage{}\ From 6899c4059e7da7d60c96bad33dd3f3868e6535ab Mon Sep 17 00:00:00 2001 From: Burkhart Wolff Date: Tue, 22 Dec 2020 20:37:15 +0100 Subject: [PATCH 05/18] improved macro syntax --- .../IsaDofApplications.thy | 2 +- .../Isabelle_DOF-Manual/00_Frontmatter.thy | 4 ++-- src/DOF/Isa_COL.thy | 10 ++++++++-- src/ontologies/scholarly_paper/scholarly_paper.thy | 13 +++++++------ 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/examples/scholarly_paper/2018-cicm-isabelle_dof-applications/IsaDofApplications.thy b/examples/scholarly_paper/2018-cicm-isabelle_dof-applications/IsaDofApplications.thy index 9e5772d..2cc4c55 100755 --- a/examples/scholarly_paper/2018-cicm-isabelle_dof-applications/IsaDofApplications.thy +++ b/examples/scholarly_paper/2018-cicm-isabelle_dof-applications/IsaDofApplications.thy @@ -26,7 +26,7 @@ define_shortcut* isadof \ \\isadof\ Protege \ \Prot{\'e}g{\'e}\ (* slanted text in contrast to italics *) -define_macro* slanted_text \ \\textsl{\ \}\ +define_macro* slanted_text \ \\textsl{\ _ \}\ (*>*) diff --git a/examples/technical_report/Isabelle_DOF-Manual/00_Frontmatter.thy b/examples/technical_report/Isabelle_DOF-Manual/00_Frontmatter.thy index db1d713..ca125b1 100755 --- a/examples/technical_report/Isabelle_DOF-Manual/00_Frontmatter.thy +++ b/examples/technical_report/Isabelle_DOF-Manual/00_Frontmatter.thy @@ -33,8 +33,8 @@ define_shortcut* TeXLive \ \\TeXLive\ text\Note that these setups assume that the associated \<^LaTeX> macros are defined, \<^eg>, in the document prelude. \ -define_macro* index \ \\index{\ \}\ -define_macro* bindex \ \\bindex{\ \}\ +define_macro* index \ \\index{\ _ \}\ +define_macro* bindex \ \\bindex{\ _ \}\ ML\ diff --git a/src/DOF/Isa_COL.thy b/src/DOF/Isa_COL.thy index d43998a..ad0ef05 100755 --- a/src/DOF/Isa_COL.thy +++ b/src/DOF/Isa_COL.thy @@ -429,15 +429,21 @@ ML\ val parse_literal = Parse.alt_string || Parse.cartouche val parse_define_shortcut = (Parse.binding -- ((\<^keyword>\\\ || \<^keyword>\==\) |-- parse_literal)) + --|Parse.underscore -- parse_literal -- (Scan.option (\<^keyword>\(\ |-- Parse.ML_source --|\<^keyword>\)\)) -fun define_macro (X,NONE) = (uncurry(uncurry(uncurry DOF_lib.define_macro)))(X,K(K())); - +fun define_macro (X,NONE) = (uncurry(uncurry(uncurry DOF_lib.define_macro)))(X,K(K())) + |define_macro (X,SOME(src:Input.source)) = + let val _ = () + in + (uncurry(uncurry(uncurry DOF_lib.define_macro)))(X,K(K())) + end; val _ = Outer_Syntax.command \<^command_keyword>\define_macro*\ "define LaTeX shortcut" (Scan.repeat1 parse_define_shortcut >> (Toplevel.theory o (fold define_macro))); +Parse.underscore; \ diff --git a/src/ontologies/scholarly_paper/scholarly_paper.thy b/src/ontologies/scholarly_paper/scholarly_paper.thy index 59e3210..535107d 100755 --- a/src/ontologies/scholarly_paper/scholarly_paper.thy +++ b/src/ontologies/scholarly_paper/scholarly_paper.thy @@ -481,13 +481,14 @@ define_shortcut* eg \ \\eg\ (* Latin: „exemp subsection\Layout Trimming Commands\ -define_macro* hs \ \\hspace{\ \}\ -define_macro* vs \ \\vspace{\ \}\ +define_macro* hs \ \\hspace{\ _ \}\ +define_macro* vs \ \\vspace{\ _ \}\ + +(* setup\ DOF_lib.define_macro \<^binding>\hs\ "\\hspace{" "}" (K(K())) \ *) +ML\ Parse.real \ + +setup\ DOF_lib.define_macro \<^binding>\vs2\ "\\vspace{" "}" (fn ctxt => fn src => ()) \ -(* -setup\ DOF_lib.define_macro \<^binding>\hs\ "\\hspace{" "}" (K(K())) \ -setup\ DOF_lib.define_macro \<^binding>\vs\ "\\vspace{" "}" (K(K())) \ -*) define_shortcut* clearpage \ \\clearpage{}\ From 005922ffda2a779121a47bf80d0274f5e177a80f Mon Sep 17 00:00:00 2001 From: Burkhart Wolff Date: Wed, 23 Dec 2020 09:41:26 +0100 Subject: [PATCH 06/18] built in syntactic checks for trimming macros --- .../Isabelle_DOF-Manual/00_Frontmatter.thy | 2 +- .../scholarly_paper/scholarly_paper.thy | 42 ++++++++++++++++--- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/examples/technical_report/Isabelle_DOF-Manual/00_Frontmatter.thy b/examples/technical_report/Isabelle_DOF-Manual/00_Frontmatter.thy index ca125b1..c6cb725 100755 --- a/examples/technical_report/Isabelle_DOF-Manual/00_Frontmatter.thy +++ b/examples/technical_report/Isabelle_DOF-Manual/00_Frontmatter.thy @@ -33,7 +33,7 @@ define_shortcut* TeXLive \ \\TeXLive\ text\Note that these setups assume that the associated \<^LaTeX> macros are defined, \<^eg>, in the document prelude. \ -define_macro* index \ \\index{\ _ \}\ +define_macro* index \ \\index{\ _ \}\ define_macro* bindex \ \\bindex{\ _ \}\ diff --git a/src/ontologies/scholarly_paper/scholarly_paper.thy b/src/ontologies/scholarly_paper/scholarly_paper.thy index 535107d..67ad50c 100755 --- a/src/ontologies/scholarly_paper/scholarly_paper.thy +++ b/src/ontologies/scholarly_paper/scholarly_paper.thy @@ -479,16 +479,46 @@ define_shortcut* eg \ \\eg\ (* Latin: „exemp ie \ \\ie\ (* Latin: „id est“ meaning „that is to say“. *) etc \ \\etc\ (* Latin : „et cetera“ meaning „et cetera“ *) -subsection\Layout Trimming Commands\ +subsection\Layout Trimming Commands (with syntactic checks)\ -define_macro* hs \ \\hspace{\ _ \}\ -define_macro* vs \ \\vspace{\ _ \}\ +ML\ +local -(* setup\ DOF_lib.define_macro \<^binding>\hs\ "\\hspace{" "}" (K(K())) \ *) -ML\ Parse.real \ +val scan_cm = Scan.ahead (Basic_Symbol_Pos.$$$ "c" |-- Basic_Symbol_Pos.$$$ "m" ) ; +val scan_pt = Scan.ahead (Basic_Symbol_Pos.$$$ "p" |-- Basic_Symbol_Pos.$$$ "t" ) ; -setup\ DOF_lib.define_macro \<^binding>\vs2\ "\\vspace{" "}" (fn ctxt => fn src => ()) \ +val scan_blank = Scan.repeat (Basic_Symbol_Pos.$$$ " " + || Basic_Symbol_Pos.$$$ "\t" + || Basic_Symbol_Pos.$$$ "\n"); +val scan_latex_measure = (scan_blank + |-- Scan.option (Basic_Symbol_Pos.$$$ "-") + |-- Symbol_Pos.scan_nat + |-- (Scan.option ((Basic_Symbol_Pos.$$$ ".") |-- Symbol_Pos.scan_nat)) + |-- scan_blank + |-- (scan_cm || scan_pt) + |-- scan_blank + ); +in + +fun check_latex_measure _ src = + let val _ = ((Scan.catch scan_latex_measure (Symbol_Pos.explode(Input.source_content src))) + handle Fail _ => error ("syntax error in LaTeX measure") ) + in () end +end + +\ + +ML\ (* test *) check_latex_measure @{context} (Input.string "-3.14 cm") \ + +define_macro* hs \ \\hspace{\ _ \}\ (check_latex_measure) +define_macro* vs \ \\vspace{\ _ \}\ (check_latex_measure) + + + +setup\ DOF_lib.define_macro \<^binding>\vs2\ "\\vspace{" "}" (check_latex_measure) \ + +text\ \<^vs2>\-3.14cm\\ define_shortcut* clearpage \ \\clearpage{}\ From 4c5fc4bc534cd531b28709b850c4dfd0c9e0d220 Mon Sep 17 00:00:00 2001 From: Burkhart Wolff Date: Wed, 23 Dec 2020 09:43:22 +0100 Subject: [PATCH 07/18] built in syntactic checks for trimming macros --- src/DOF/Isa_COL.thy | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/DOF/Isa_COL.thy b/src/DOF/Isa_COL.thy index ad0ef05..58b7963 100755 --- a/src/DOF/Isa_COL.thy +++ b/src/DOF/Isa_COL.thy @@ -427,23 +427,21 @@ end ML\ val parse_literal = Parse.alt_string || Parse.cartouche -val parse_define_shortcut = (Parse.binding - -- ((\<^keyword>\\\ || \<^keyword>\==\) |-- parse_literal)) +val parse_define_shortcut = Parse.binding + -- ((\<^keyword>\\\ || \<^keyword>\==\) |-- parse_literal) --|Parse.underscore -- parse_literal -- (Scan.option (\<^keyword>\(\ |-- Parse.ML_source --|\<^keyword>\)\)) fun define_macro (X,NONE) = (uncurry(uncurry(uncurry DOF_lib.define_macro)))(X,K(K())) |define_macro (X,SOME(src:Input.source)) = - let val _ = () - in - (uncurry(uncurry(uncurry DOF_lib.define_macro)))(X,K(K())) + let val check_code = K(K()) + in (uncurry(uncurry(uncurry DOF_lib.define_macro)))(X,check_code) end; val _ = Outer_Syntax.command \<^command_keyword>\define_macro*\ "define LaTeX shortcut" (Scan.repeat1 parse_define_shortcut >> (Toplevel.theory o (fold define_macro))); -Parse.underscore; \ From 4c5aacb39f221b5fdea305e2080e42ad80d97753 Mon Sep 17 00:00:00 2001 From: Burkhart Wolff Date: Wed, 23 Dec 2020 11:30:42 +0100 Subject: [PATCH 08/18] activated syntactic checks for trimming macros --- .../TR_MyCommentedIsabelle.thy | 47 +++++++++---------- src/DOF/Isa_COL.thy | 13 ++++- .../scholarly_paper/scholarly_paper.thy | 28 +++++------ 3 files changed, 48 insertions(+), 40 deletions(-) diff --git a/examples/technical_report/TR_my_commented_isabelle/TR_MyCommentedIsabelle.thy b/examples/technical_report/TR_my_commented_isabelle/TR_MyCommentedIsabelle.thy index 9b3a49d..4a87ce9 100755 --- a/examples/technical_report/TR_my_commented_isabelle/TR_MyCommentedIsabelle.thy +++ b/examples/technical_report/TR_my_commented_isabelle/TR_MyCommentedIsabelle.thy @@ -182,7 +182,7 @@ ML\ \ (*>*) -text\\<^vs>\-1,0cm\... which we will describe in more detail later. \ +text\\<^vs>\-1.0cm\... which we will describe in more detail later. \ text\In a way, anti-quotations implement a kind of literate specification style in text, models, code, proofs, etc., which become alltogether @@ -484,28 +484,28 @@ text\Note, furthermore, that there is a programming API for the HOL-instan operators of the HOL logic specific constructors and destructors:\ text*[T2::technical]\ -\<^enum> \<^ML>\HOLogic.boolT : typ\ \<^vs>\-0,2cm\ -\<^enum> \<^ML>\HOLogic.mk_Trueprop : term -> term\, the embedder of bool to prop fundamental for HOL \<^vs>\-0,2cm\ -\<^enum> \<^ML>\HOLogic.dest_Trueprop : term -> term\ \<^vs>\-0,2cm\ -\<^enum> \<^ML>\HOLogic.Trueprop_conv : conv -> conv\ \<^vs>\-0,2cm\ -\<^enum> \<^ML>\HOLogic.mk_setT : typ -> typ\, the ML level type constructor set \<^vs>\-0,2cm\ -\<^enum> \<^ML>\HOLogic.dest_setT : typ -> typ\, the ML level type destructor for set \<^vs>\-0,2cm\ -\<^enum> \<^ML>\HOLogic.Collect_const : typ -> term\ \<^vs>\-0,2cm\ -\<^enum> \<^ML>\HOLogic.mk_Collect : string * typ * term -> term\ \<^vs>\-0,2cm\ -\<^enum> \<^ML>\HOLogic.mk_mem : term * term -> term\ \<^vs>\-0,2cm\ -\<^enum> \<^ML>\HOLogic.dest_mem : term -> term * term\ \<^vs>\-0,2cm\ -\<^enum> \<^ML>\HOLogic.mk_set : typ -> term list -> term\ \<^vs>\-0,2cm\ -\<^enum> \<^ML>\HOLogic.conj_intr : Proof.context -> thm -> thm -> thm\, some HOL-level derived-inferences \<^vs>\-0,2cm\ -\<^enum> \<^ML>\HOLogic.conj_elim : Proof.context -> thm -> thm * thm\ \<^vs>\-0,2cm\ -\<^enum> \<^ML>\HOLogic.conj_elims : Proof.context -> thm -> thm list\ \<^vs>\-0,2cm\ -\<^enum> \<^ML>\HOLogic.conj : term\ , some ML level logical constructors \<^vs>\-0,2cm\ -\<^enum> \<^ML>\HOLogic.disj : term\ \<^vs>\-0,2cm\ -\<^enum> \<^ML>\HOLogic.imp : term\ \<^vs>\-0,2cm\ -\<^enum> \<^ML>\HOLogic.Not : term\ \<^vs>\-0,2cm\ -\<^enum> \<^ML>\HOLogic.mk_not : term -> term\ \<^vs>\-0,2cm\ -\<^enum> \<^ML>\HOLogic.mk_conj : term * term -> term\ \<^vs>\-0,2cm\ -\<^enum> \<^ML>\HOLogic.dest_conj : term -> term list\ \<^vs>\-0,2cm\ -\<^enum> \<^ML>\HOLogic.conjuncts : term -> term list\ \<^vs>\-0,2cm\ +\<^enum> \<^ML>\HOLogic.boolT : typ\ \<^vs>\-0.2cm\ +\<^enum> \<^ML>\HOLogic.mk_Trueprop : term -> term\, the embedder of bool to prop fundamental for HOL \<^vs>\-0.2cm\ +\<^enum> \<^ML>\HOLogic.dest_Trueprop : term -> term\ \<^vs>\-0.2cm\ +\<^enum> \<^ML>\HOLogic.Trueprop_conv : conv -> conv\ \<^vs>\-0.2cm\ +\<^enum> \<^ML>\HOLogic.mk_setT : typ -> typ\, the ML level type constructor set \<^vs>\-0.2cm\ +\<^enum> \<^ML>\HOLogic.dest_setT : typ -> typ\, the ML level type destructor for set \<^vs>\-0.2cm\ +\<^enum> \<^ML>\HOLogic.Collect_const : typ -> term\ \<^vs>\-0.2cm\ +\<^enum> \<^ML>\HOLogic.mk_Collect : string * typ * term -> term\ \<^vs>\-0.2cm\ +\<^enum> \<^ML>\HOLogic.mk_mem : term * term -> term\ \<^vs>\-0.2cm\ +\<^enum> \<^ML>\HOLogic.dest_mem : term -> term * term\ \<^vs>\-0.2cm\ +\<^enum> \<^ML>\HOLogic.mk_set : typ -> term list -> term\ \<^vs>\-0.2cm\ +\<^enum> \<^ML>\HOLogic.conj_intr : Proof.context -> thm -> thm -> thm\, some HOL-level derived-inferences \<^vs>\-0.2cm\ +\<^enum> \<^ML>\HOLogic.conj_elim : Proof.context -> thm -> thm * thm\ \<^vs>\-0.2cm\ +\<^enum> \<^ML>\HOLogic.conj_elims : Proof.context -> thm -> thm list\ \<^vs>\-0.2cm\ +\<^enum> \<^ML>\HOLogic.conj : term\ , some ML level logical constructors \<^vs>\-0.2cm\ +\<^enum> \<^ML>\HOLogic.disj : term\ \<^vs>\-0.2cm\ +\<^enum> \<^ML>\HOLogic.imp : term\ \<^vs>\-0.2cm\ +\<^enum> \<^ML>\HOLogic.Not : term\ \<^vs>\-0.2cm\ +\<^enum> \<^ML>\HOLogic.mk_not : term -> term\ \<^vs>\-0.2cm\ +\<^enum> \<^ML>\HOLogic.mk_conj : term * term -> term\ \<^vs>\-0.2cm\ +\<^enum> \<^ML>\HOLogic.dest_conj : term -> term list\ \<^vs>\-0.2cm\ +\<^enum> \<^ML>\HOLogic.conjuncts : term -> term list\ \<^vs>\-0.2cm\ \<^enum> ... \ @@ -2312,7 +2312,6 @@ for Unicode Character Denotations as well as many local hints for improvements.\ section*[bib::bibliography]\Bibliography\ - close_monitor*[this] check_doc_global diff --git a/src/DOF/Isa_COL.thy b/src/DOF/Isa_COL.thy index 58b7963..649f5d0 100755 --- a/src/DOF/Isa_COL.thy +++ b/src/DOF/Isa_COL.thy @@ -435,7 +435,8 @@ val parse_define_shortcut = Parse.binding fun define_macro (X,NONE) = (uncurry(uncurry(uncurry DOF_lib.define_macro)))(X,K(K())) |define_macro (X,SOME(src:Input.source)) = - let val check_code = K(K()) + let val check_code = K(K()) (* hack *) + val _ = warning "Checker code support Not Yet Implemented - use ML" in (uncurry(uncurry(uncurry DOF_lib.define_macro)))(X,check_code) end; @@ -444,6 +445,16 @@ val _ = Outer_Syntax.command \<^command_keyword>\define_macro*\ "d \ +ML\ML_Context.expression\ +(* +fun setup source = + ML_Context.expression (Input.pos_of source) + (ML_Lex.read "Theory.setup (" @ ML_Lex.read_source source @ ML_Lex.read ")") + |> Context.theory_map; +setup\\ + +*) + section\Tables\ (* TODO ! ! ! *) diff --git a/src/ontologies/scholarly_paper/scholarly_paper.thy b/src/ontologies/scholarly_paper/scholarly_paper.thy index 67ad50c..4a92f6e 100755 --- a/src/ontologies/scholarly_paper/scholarly_paper.thy +++ b/src/ontologies/scholarly_paper/scholarly_paper.thy @@ -469,7 +469,7 @@ setup\ let val cidS = ["scholarly_paper.introduction","scholarly_paper.tec true) in DOF_core.update_class_invariant "scholarly_paper.article" body end\ - +ML\ \ section\Miscelleous\ @@ -486,8 +486,7 @@ local val scan_cm = Scan.ahead (Basic_Symbol_Pos.$$$ "c" |-- Basic_Symbol_Pos.$$$ "m" ) ; val scan_pt = Scan.ahead (Basic_Symbol_Pos.$$$ "p" |-- Basic_Symbol_Pos.$$$ "t" ) ; - -val scan_blank = Scan.repeat (Basic_Symbol_Pos.$$$ " " +val scan_blank = Scan.repeat ( Basic_Symbol_Pos.$$$ " " || Basic_Symbol_Pos.$$$ "\t" || Basic_Symbol_Pos.$$$ "\n"); @@ -505,25 +504,24 @@ fun check_latex_measure _ src = let val _ = ((Scan.catch scan_latex_measure (Symbol_Pos.explode(Input.source_content src))) handle Fail _ => error ("syntax error in LaTeX measure") ) in () end -end - -\ - -ML\ (* test *) check_latex_measure @{context} (Input.string "-3.14 cm") \ - -define_macro* hs \ \\hspace{\ _ \}\ (check_latex_measure) -define_macro* vs \ \\vspace{\ _ \}\ (check_latex_measure) +end\ -setup\ DOF_lib.define_macro \<^binding>\vs2\ "\\vspace{" "}" (check_latex_measure) \ +setup\ DOF_lib.define_macro \<^binding>\vs\ "\\vspace{" "}" (check_latex_measure) \ +setup\ DOF_lib.define_macro \<^binding>\hs\ "\\hspace{" "}" (check_latex_measure) \ -text\ \<^vs2>\-3.14cm\\ +(*<*) + +text\Tests: \<^vs>\-0.14cm\\ +ML\ check_latex_measure @{context} (Input.string "-3.14 cm") \ +define_macro* vs2 \ \\vspace{\ _ \}\ (check_latex_measure) (* checkers NYI on Isar-level *) +define_macro* hs2 \ \\hspace{\ _ \}\ (* works fine without checker.*) + +(*>*) define_shortcut* clearpage \ \\clearpage{}\ - - end From 2f721d0f4b6006394a7a5211794abce92718a5c5 Mon Sep 17 00:00:00 2001 From: Burkhart Wolff Date: Thu, 24 Dec 2020 04:53:27 +0100 Subject: [PATCH 09/18] activated syntactic checks for trimming macros --- .../TR_my_commented_isabelle/TR_MyCommentedIsabelle.thy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/technical_report/TR_my_commented_isabelle/TR_MyCommentedIsabelle.thy b/examples/technical_report/TR_my_commented_isabelle/TR_MyCommentedIsabelle.thy index 4a87ce9..190f91e 100755 --- a/examples/technical_report/TR_my_commented_isabelle/TR_MyCommentedIsabelle.thy +++ b/examples/technical_report/TR_my_commented_isabelle/TR_MyCommentedIsabelle.thy @@ -2307,8 +2307,8 @@ text\ This interactive Isabelle Programming Cook-Book represents my curren \ (*<*) -paragraph\Many thanks to Frederic Tuong, who contributed some example such as the string cartouche -for Unicode Character Denotations as well as many local hints for improvements.\ +paragraph\Many thanks to Frederic Tuong, who contributed some example such as the string +cartouche for Unicode Character Denotations as well as many local hints for improvements.\ section*[bib::bibliography]\Bibliography\ From 04f0cc7f5c9626892819d243880fc5ab804ff731 Mon Sep 17 00:00:00 2001 From: Burkhart Wolff Date: Wed, 30 Dec 2020 12:47:54 +0100 Subject: [PATCH 10/18] Reorganization: Pushed Macro Core Mechanism into the DOF Core; adapted the RefMan accordingly. --- .../Isabelle_DOF-Manual/03_GuidedTour.thy | 1 + .../Isabelle_DOF-Manual/04_RefMan.thy | 76 ++++- src/DOF/Isa_COL.thy | 211 +------------- src/DOF/Isa_DOF.thy | 264 ++++++++++++++---- 4 files changed, 289 insertions(+), 263 deletions(-) diff --git a/examples/technical_report/Isabelle_DOF-Manual/03_GuidedTour.thy b/examples/technical_report/Isabelle_DOF-Manual/03_GuidedTour.thy index 050d219..79bae4a 100755 --- a/examples/technical_report/Isabelle_DOF-Manual/03_GuidedTour.thy +++ b/examples/technical_report/Isabelle_DOF-Manual/03_GuidedTour.thy @@ -445,6 +445,7 @@ doc_class "theorem" = math_content + mcc :: "math_content_class" <= "thm" ... \}\ + text\The class \<^verbatim>\technical\ regroups a number of text-elements that contain typical "technical content" in mathematical or engineering papers: code, definitions, theorems, lemmas, examples. From this class, the more stricter class of @{typ \math_content\} is derived, diff --git a/examples/technical_report/Isabelle_DOF-Manual/04_RefMan.thy b/examples/technical_report/Isabelle_DOF-Manual/04_RefMan.thy index eada145..ccb5ab8 100755 --- a/examples/technical_report/Isabelle_DOF-Manual/04_RefMan.thy +++ b/examples/technical_report/Isabelle_DOF-Manual/04_RefMan.thy @@ -18,35 +18,79 @@ theory "03_GuidedTour" "Isabelle_DOF.Isa_COL" begin + +declare_reference*[infrastructure::technical] + (*>*) -chapter*[isadof_ontologies::technical]\Developing Ontologies\ +chapter*[isadof_ontologies::technical]\Ontologies and their Development\ text\ - In this chapter, we explain the concepts for modeling new ontologies, developing a document + In this chapter, we explain the concepts of \<^isadof> in a more systematic way, and give + guidelines for modeling new ontologies, the concepts developing a document representation for them, as well as developing new document templates. -\ -section*[infrastructure::technical]\Overview and Technical Infrastructure\ -text\ \<^isadof> is embedded in the underlying generic document model of Isabelle as described in \<^introduction>\dof\. Recall that the document language can be extended dynamically, \<^ie>, new \user-defined\ can be introduced at run-time. This is similar to the definition of new functions in an interpreter. \<^isadof> as a system plugin is is a number of new command definitions in Isabelle's document model. - \<^isadof> consists consists basically of four components: - \<^item> an own \<^emph>\family of text-elements\ such as \<^boxed_theory_text>\title*\, \<^boxed_theory_text>\chapter*\ - \<^boxed_theory_text>\text*\, etc., which can be annotated with meta-information defined in the - underlying ontology definition and allow to build a \<^emph>\core\ document, - \<^item> the \<^emph>\ontology definition language\ (called ODL) which allow for the definitions - of document-classes and necessary auxiliary datatypes, + \<^isadof> consists consists basically of five components: + \<^item> the \<^emph>\DOF-core\, which provides an own \<^emph>\family of commands\ such as + \<^boxed_theory_text>\text*\, \<^boxed_theory_text>\declare_reference*\, + \<^boxed_theory_text>\update_instance*\, \<^boxed_theory_text>\open_monitor*\, etc. + They allow to annotate text-elements with meta-information defined in an + underlying ontology, + \<^item> the \<^emph>\DOF-core\ also provides the \<^emph>\ontology definition language\ (called ODL) + which allow for the definitions of document-classes and necessary auxiliary datatypes, + \<^item> the \<^isadof> library of ontologies providing ontological concepts as well + as supporting infrastructure, \<^item> an infrastructure for ontology-specific \<^emph>\layout definitions\, exploiting this meta-information, and \<^item> an infrastructure for generic \<^emph>\layout definitions\ for documents following, \<^eg>, the format guidelines of publishers or standardization bodies. + + Similarly to Isabelle, which is based on a core logic \<^theory>\Pure\ and then extended by libraries + to major systems like \<^verbatim>\HOL\ or \<^verbatim>\FOL\, \<^isadof> has a generic core infrastructure \<^dof> and then + presents itself to users via major library extensions, which add domain-specific + system-extensions. Consequently, ontologies in \<^isadof> are not just a sequence of descriptions in + \<^isadof>'s Ontology Definition Language (ODL). Rather, they are integrated documents themselves that + provide textual decriptions, abbreviations, macro-support and even ML-code. + Conceptually, the library of \<^isadof> is currently organized as follows + \<^footnote>\Note that the \<^emph>\technical\ organisation is slightly different and shown in + @{technical (unchecked) \infrastructure\}.\: +% +\begin{center} +\begin{minipage}{.9\textwidth} +\dirtree{% +.1 COL\DTcomment{The Common Ontology Library}. +.2 scholarly\_paper\DTcomment{Scientific Papers}. +.3 technical\_report\DTcomment{Extended Papers}. +.4 CENELEC\_50128\DTcomment{Papers according to CENELEC\_50128}. +.4 CC\_v3\_1\_R5\DTcomment{Papers according to Common Criteria}. +.4 \ldots. +} +\end{minipage} +\end{center} + +These libraries not only provide ontological concepts, but also syntactic sugar in Isabelle's +command language Isar that is of major importance for users (and may be felt as \<^isadof> key +features by many authors). In reality, +they are derived concepts from more generic ones; for example, the commands +\<^boxed_theory_text>\title*\, \<^boxed_theory_text>\section*\, \<^boxed_theory_text>\subsection*\, \<^etc>, +are in reality a kind of macros for \<^boxed_theory_text>\text*[