From 3895ba550c8d6a2e36c38a3a3701ae92f2b66508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20M=C3=A9ric?= Date: Mon, 14 Mar 2022 17:08:59 +0100 Subject: [PATCH] Import of DOF manual changes from /2021-ITP-PMTI --- .../Isabelle_DOF-Manual/01_Introduction.thy | 9 ++- .../Isabelle_DOF-Manual/02_Background.thy | 60 +++++++++++++------ .../Isabelle_DOF-Manual/04_RefMan.thy | 57 +++++++++++++++--- .../Isabelle_DOF-Manual/document/preamble.tex | 12 ++-- 4 files changed, 104 insertions(+), 34 deletions(-) diff --git a/examples/technical_report/Isabelle_DOF-Manual/01_Introduction.thy b/examples/technical_report/Isabelle_DOF-Manual/01_Introduction.thy index 7acdcf5e..6988d674 100755 --- a/examples/technical_report/Isabelle_DOF-Manual/01_Introduction.thy +++ b/examples/technical_report/Isabelle_DOF-Manual/01_Introduction.thy @@ -119,10 +119,17 @@ text\ G.~Sala{\"u}n, editors, \<^emph>\Software Engineering and Formal Methods (SEFM)\, number 11724 in Lecture Notes in Computer Science. Springer-Verlag, Heidelberg, 2019. \href{https://doi.org/10.1007/978-3-030-30446-1_15}{10.1007/978-3-030-30446-1\_15}. - \end{quote} A \<^BibTeX>-entry is available at: \<^url>\https://www.brucker.ch/bibliography/abstract/brucker.ea-isabelledof-2019\. + \<^item> for an application of \<^isadof> in the context of certifications: + \begin{quote}\small + A.~D. Brucker and B.~Wolff. + Using Ontologies in Formal Developments Targeting Certification. + In W. Ahrendt and S. Tarifa, editors. \<^emph>\Integrated Formal Methods (IFM)\, number 11918. + Lecture Notes in Computer Science. Springer-Verlag, Heidelberg, 2019. + \href{https://doi.org/10.1007/978-3-030-34968-4\_4}. + \end{quote} \ subsubsection\Availability\ text\ diff --git a/examples/technical_report/Isabelle_DOF-Manual/02_Background.thy b/examples/technical_report/Isabelle_DOF-Manual/02_Background.thy index 820b9715..fce573bc 100755 --- a/examples/technical_report/Isabelle_DOF-Manual/02_Background.thy +++ b/examples/technical_report/Isabelle_DOF-Manual/02_Background.thy @@ -43,11 +43,11 @@ The current system framework offers moreover the following features: \<^item> an extensible front-end language Isabelle/Isar, and, \<^item> last but not least, an LCF style, generic theorem prover kernel as the most prominent and deeply integrated system component. - - +\ +text\ The Isabelle system architecture shown in @{docitem \architecture\} comes with many layers, with Standard ML (SML) at the bottom layer as implementation language. The architecture actually -foresees a \<^emph>\Nano-Kernel\ (our terminology) which resides in the SML structure\<^boxed_sml>\Context\. +foresees a \<^emph>\Nano-Kernel\ (our terminology) which resides in the SML structure \<^boxed_sml>\Context\. This structure provides a kind of container called \<^emph>\context\ providing an identity, an ancestor-list as well as typed, user-defined state for components (plugins) such as \<^isadof>. On top of the latter, the LCF-Kernel, tactics, automated proof procedures as well as specific @@ -70,13 +70,20 @@ declare_reference*["fig:dependency"::text_section] text\ - We assume a hierarchical document model\<^index>\document model\, \<^ie>, an \<^emph>\integrated\ document - consist of a hierarchy \<^emph>\sub-documents\ (files) that can depend acyclically on each other. + The Isabelle Framework is based on a \<^emph>\document-centric view\ bindex>\document-centric view\ of + a document, treating the input in its integrality as set of (user-programmable) \<^emph>\document element\ + that may mutually depend and link to each other; A \<^emph>\document\ in our sense is what is configured in a set of + \<^verbatim>\ROOT\- and \<^verbatim>\ROOTS\-files. + + Isabelle assumes a hierarchical document model\<^index>\document model\, \<^ie>, an \<^emph>\integrated\ document + consist of a hierarchy \<^emph>\sub-documents\ (files); dependencies are restricted to be + acyclic at this level. Sub-documents can have different document types in order to capture documentations consisting of documentation, models, proofs, code of various forms and other technical artifacts. We call the main sub-document type, for historical reasons, \<^emph>\theory\-files. A theory file\<^bindex>\theory!file\ consists of a \<^emph>\header\\<^bindex>\header\, a \<^emph>\context definition\\<^index>\context\, and a body - consisting of a sequence of \<^emph>\command\s (see @{figure (unchecked) "fig:dependency"}). Even + consisting of a sequence of document elements called + \<^emph>\command\s (see @{figure (unchecked) "fig:dependency"}). Even the header consists of a sequence of commands used for introductory text elements not depending on any context. The context-definition contains an \<^boxed_theory_text>\import\ and a \<^boxed_theory_text>\keyword\ section, for example: @@ -96,30 +103,43 @@ text\ A text-element \<^index>\text-element\ may look like th @{boxed_theory_text [display]\ text\ According to the \<^emph>\reflexivity\ axiom @{thm refl}, we obtain in \ for @{term "fac 5"} the result @{value "fac 5"}.\\} -so it is a command \<^theory_text>\text\ followed by an argument (here in \\ ... \\ paranthesis) which +... so it is a command \<^theory_text>\text\ followed by an argument (here in \\ ... \\ paranthesis) which contains characters and and a special notation for semantic macros \<^bindex>\semantic macros\ (here \<^theory_text>\@{term "fac 5"}).\ \ -text\ - We distinguish fundamentally two different syntactic levels: - \<^item> the \<^emph>\outer-syntax\\<^bindex>\syntax!outer\\<^index>\outer syntax|see {syntax, outer}\ (\<^ie>, the - syntax for commands) is processed by a lexer-library and parser combinators built on top, and - \<^item> the \<^emph>\inner-syntax\\<^bindex>\syntax!inner\\<^index>\inner syntax|see {syntax, inner}\ (\<^ie>, the - syntax for \\\-terms in HOL) with its own parametric polymorphism type checking. +text\While we concentrate in this manual on \<^theory_text>\text\-document elements --- this is the main +use of \<^dof> in its current stage --- it is important to note that there are actually three +families of ``ontology aware'' document elements with analogous +syntax to standard ones. The difference is a bracket with meta-data of the form: +@{theory_text [display,indent=5, margin=70] +\ +text*[label::classid, attr\<^sub>1=E\<^sub>1, ... attr\<^sub>n=E\<^sub>n]\ some semi-formal text \ +ML*[label::classid, attr\<^sub>1=E\<^sub>1, ... attr\<^sub>n=E\<^sub>n]\ some SML code \ +value*[label::classid, attr\<^sub>1=E\<^sub>1, ... attr\<^sub>n=E\<^sub>n]\ some annotated \-term \ +\} +Depending on the family, we will speak about \<^emph>\(formal) text-contexts\,\<^index>\formal text-contexts\ +\<^emph>\(ML) code-contexts\\<^index>\code-contexts\ and \<^emph>\term-contexts\\<^index>\term-contexts\ if we refer +to sub-elements inside the \\...\\ cartouches of these command families. Note that the Isabelle +framework allows for nesting cartouches that permits to support to switch into a different +context. In general, this has also the effect that the evaluation of antiquotations changes. +\<^footnote>\In the literature, this concept has been referred to \Cascade-Syntax\ and was used in the +Centaur-system and is existing in some limited form in some Emacs-implementations these days. \ +\ +text\ On the semantic level, we assume a validation process for an integrated document, where the semantics of a command is a transformation \\ \ \\ for some system state \\\. - This document model can be instantiated with outer-syntax commands for common - text elements, \<^eg>, \<^theory_text>\section\...\\ or \<^theory_text>\text\...\\. - Thus, users can add informal text to a sub-document using a text command: + This document model can be instantiated depending on the text-code-, or term-contexts. + For common text elements, \<^eg>, \<^theory_text>\section\...\\ or \<^theory_text>\text\...\\, + users can add informal text to a sub-document using a text command: @{boxed_theory_text [display] \text\This is a description.\\ } This will type-set the corresponding text in, for example, a PDF document. However, this translation is not necessarily one-to-one: text elements can be enriched by formal, \<^ie>, machine-checked content via \<^emph>\semantic macros\, called antiquotations\<^bindex>\antiquotation\: @{boxed_theory_text [display] - \text\ According to the \<^emph>\reflexivity\ axiom @{thm refl}, we obtain in \ - for @{term "fac 5"} the result @{value "fac 5"}.\\ + \text\ According to the \<^emph>\reflexivity\ axiom @{thm "refl"}, we obtain in \ + for @{term \fac 5\} the result @{value \fac 5\}.\\ } which is represented in the final document (\<^eg>, a PDF) by: @{boxed_pdf [display] @@ -137,10 +157,12 @@ for $\operatorname{fac} \text{\textrm{5}}$ the result $\text{\textrm{120}}$.\ + + figure*["fig:dependency"::figure,relative_width="70",src="''figures/document-hierarchy''"] \A Theory-Graph in the Document Model. \ -section*[bgrnd21::introduction]\Implementability of the Required Document Model\ +section*[bgrnd21::introduction]\Implementability of the Document Model in other ITP's\ text\ Batch-mode checkers for \<^dof> can be implemented in all systems of the LCF-style prover family, \<^ie>, systems with a type-checked \term\, and abstract \thm\-type for theorems diff --git a/examples/technical_report/Isabelle_DOF-Manual/04_RefMan.thy b/examples/technical_report/Isabelle_DOF-Manual/04_RefMan.thy index 7787c2ae..eba7ccee 100755 --- a/examples/technical_report/Isabelle_DOF-Manual/04_RefMan.thy +++ b/examples/technical_report/Isabelle_DOF-Manual/04_RefMan.thy @@ -100,7 +100,8 @@ text\ to instances, and class-invariants. Some concepts like advanced type-checking, referencing to formal entities of Isabelle, and monitors are due to its specific application in the Isabelle context. Conceptually, ontologies specified in ODL consist of: - \<^item> \<^emph>\document classes\ (\<^boxed_theory_text>\doc_class\) that describe concepts; + \<^item> \<^emph>\document classes\ (\<^boxed_theory_text>\doc_class\) \<^index>\doc\_class\ that describe concepts; + the keyword (\<^boxed_theory_text>\onto_class\) \<^index>\onto\_class\ is accpted equally; \<^item> an optional document base class expressing single inheritance class extensions; \<^item> \<^emph>\attributes\ specific to document classes, where @@ -233,7 +234,7 @@ A document class\<^bindex>\document class\ can be defined using the \<^item> \doc_class_specification\:\<^index>\doc\_class\_specification@\doc_class_specification\\ We call document classes with an \accepts_clause\ \<^emph>\monitor classes\ or \<^emph>\monitors\ for short. - \<^rail>\ @@{command "doc_class"} class_id '=' (class_id '+')? (attribute_decl+) \ + \<^rail>\ (@@{command "doc_class"}| @@{command "onto_class"}) class_id '=' (class_id '+')? (attribute_decl+) \ (invariant_decl *) (accepts_clause rejects_clause?)?\ \<^item> \attribute_decl\:\<^index>\attribute\_decl@\attribute_decl\\ @@ -319,12 +320,17 @@ supported on the Isabelle/Isar level. Note that some more advanced functionality is currently only available in the SML API's of the kernel. \<^item> \meta_args\ : - \<^rail>\obj_id ('::' class_id) ((',' attribute '=' term) *) \ + \<^rail>\obj_id ('::' class_id) ((',' attribute '=' HOL_term) *) \ \<^item> \upd_meta_args\ : - \<^rail>\ (obj_id ('::' class_id) ((',' attribute ('=' | '+=') term) * ))\ + \<^rail>\ (obj_id ('::' class_id) ((',' attribute ('=' | '+=') HOL_term) * ))\ \<^item> \annotated_text_element\ : -\<^rail>\ - ( @@{command "text*"}'[' meta_args ']' '\' text '\' | +\<^rail>\ + ( ( @@{command "text*"} '[' meta_args ']' '\' formal_text '\' + | @@{command "ML*"} '[' meta_args ']' '\' SML_code '\' + | @@{command "term*"} '[' meta_args ']' '\' HOL_term '\' + | @@{command "value*"}'[' meta_args ']' '\' HOL_term '\' + ) + | ( @@{command "open_monitor*"} | @@{command "close_monitor*"} | @@{command "declare_reference*"} @@ -350,10 +356,14 @@ text\Recall that with the exception of \<^theory_text>\text* \ layout (such as \<^LaTeX>); these commands have to be wrapped into \<^verbatim>\(*<*) ... (*>*)\ brackets if this is undesired. \ -subsection\Ontologic Text-Elements and their Management\ -text\ \<^theory_text>\text*[oid::cid, ...] \ \ text \ \ \ is the core-command of \<^isadof>: it permits to create +subsection\Ontologic Text-Contexts and their Management\ +text\ With respect to the family of text elements, + \<^theory_text>\text*[oid::cid, ...] \ \ text \ \ \ is the core-command of \<^isadof>: it permits to create an object of meta-data belonging to the class \<^theory_text>\cid\. This is viewed as the \<^emph>\definition\ of -an instance of a document class. This instance object is attached to the text-element +an instance of a document class. The class invariants were checked for all attribute values +at creation time if not specified otherwise. Unspecified attributed values were represented +by fresh free variables. +This instance object is attached to the text-element and makes it thus "trackable" for \<^isadof>, \<^ie>, it can be referenced via the \<^theory_text>\oid\, its attributes can be set by defaults in the class-definitions, or set at creation time, or modified at any point after creation via \<^theory_text>\update_instance*[oid, ...]\. The \<^theory_text>\class_id\ is syntactically optional; @@ -374,6 +384,35 @@ The precise presentation is decided in the \<^emph>\layout definitions\\ @{cid (unchecked) \oid\} \. \ +subsection\Ontologic Code-Contexts and their Management\ + +text\The \<^theory_text>\ML*[oid::cid, ...] \ \ SML-code \ \\-document elements proceed similarly : +a referentiable meta-object of class \<^theory_text>\cid\ is created, initialized with the optional + attributes and bound to \<^theory_text>\oid\. The SML-code is type-checked and executed +in the context of the SML toplevel of the Isabelle system as in the corresponding +\<^theory_text>\ML\ \ SML-code \ \\-command. +\ + +subsection\Ontologic Term-Contexts and their Management\ +text\The major commands providing term-contexts are +\<^theory_text>\term*[oid::cid, ...] \ \ HOL-term \ \\ and +\<^theory_text>\value*[oid::cid, ...] \ \ HOL-term \ \\\<^footnote>\Note that the meta-argument list is optional.\. +Wrt. to creation, track-ability and checking they are analogous to the ontological text and +code-commands. However the argument terms may contain term-antiquotations stemming from an +ontology definition. Both term-contexts ware type-checked and \<^emph>\validated\ against +the global context (so: in the term \@{A \oid\}\, \oid\ is indeed a string which refers +to a meta-object belonging to the document class \A\, for example). +The term-context in the \value*\-command is additionally expanded (\<^eg> replaced) by a term +denoting the meta-object. This expansion happens \<^emph>\before\ evaluation of the term, thus permitting +executable HOL-functions to interact with meta-objects. + +Note unspecified attribute values were represented by free fresh variables which constrains \<^dof> +to choose either to the normalisation-by-evaluation strategy \<^theory_text>\nbe\ or to a proof attempt via +the \<^theory_text>\auto\. A failure of these strategies will be reported and regarded as non-validation +of this meta-object. The latter leads to a failure of the entire command. + +\ + (*<*) declare_reference*["sec:advanced"::technical] (*>*) diff --git a/examples/technical_report/Isabelle_DOF-Manual/document/preamble.tex b/examples/technical_report/Isabelle_DOF-Manual/document/preamble.tex index e507c1a8..01960819 100755 --- a/examples/technical_report/Isabelle_DOF-Manual/document/preamble.tex +++ b/examples/technical_report/Isabelle_DOF-Manual/document/preamble.tex @@ -41,8 +41,8 @@ \pagestyle{headings} \uppertitleback{ -Copyright \copyright{} 2019--2021 University of Exeter, UK\\ -\phantom{Copyright \copyright{}} 2018--2021 Universit\'e Paris-Saclay, France\\ +Copyright \copyright{} 2019--2022 University of Exeter, UK\\ +\phantom{Copyright \copyright{}} 2018--2022 Universit\'e Paris-Saclay, France\\ \phantom{Copyright \copyright{}} 2018--2019 The University of Sheffield, UK\\ \smallskip @@ -77,11 +77,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \lowertitleback{% This manual describes \isadof version \isadofversion. The latest official -release is \isadoflatestversion{} (\href{https://doi.org/\isadoflatestdoi}{doi:\isadoflatestdoi}). The DOI \href{https://doi.org/\isadofgenericdoi}{\isadofgenericdoi} will allways point to the latest release. The latest development version as well as official releases are available at +release is \isadoflatestversion{} (\href{https://doi.org/\isadoflatestdoi}{doi:\isadoflatestdoi}). +The DOI \href{https://doi.org/\isadofgenericdoi}{\isadofgenericdoi} will allways point to the latest +release. The latest development version as well as official releases are available at \url{\dofurl}. \paragraph*{Contributors.} We would like to thank the following contributors to \isadof -(in alphabetical order): Idir Ait-Sadoune, Paolo Crisafulli, Chantal Keller, and Nicolas M{\'e}ric. +(in alphabetical order): Idir Ait-Sadoune, Paolo Crisafulli, and Nicolas M{\'e}ric. \paragraph*{Acknowledgments.} This work has been partially supported by IRT SystemX, Paris-Saclay, France, and therefore granted with public funds of the Program ``Investissements d'Avenir.'' @@ -107,7 +109,7 @@ France, and therefore granted with public funds of the Program ``Investissements \hfill \begin{minipage}{8cm} \raggedleft\normalsize - Laboratoire en Recherche en Informatique (LRI)\\ + Laboratoire des Methodes Formelles (LMF)\\ Universit\'e Paris-Saclay\\ 91405 Orsay Cedex\\ France