Commit Graph

231 Commits

Author SHA1 Message Date
Nicolas Méric d2a6106be5 Fix the record generation in class implementation
- Fix the generation of the record associated with
  a class and used for the logic.
  The old implementation generated a new attribute
  for each attribute defined by a subclass,
  even the ones that were overriding ones of the superclass.
  The new implementation generates the attributes of the subclass
  which are not overriding ones.
  Warning:
  It implies that overridden attributes in a subclass are not
  new attributes added to the theory context.
  So the base name of an attribute will refer to the attribute
  of the last declared class where it is defined.
  If ones wants to refer to atttributes, one should use
  long names, even in the invariants of a subclass definition
  which overrides the attribute used in the invariant.
  For example,
  in ~~/src/ontologies/scholarly_paper/scholarly_paper.thy:

  doc_class technical = text_section +
     definition_list :: "string list" <=  "[]"
     status          :: status <= "description"
     formal_results  :: "thm list"
     invariant L1    :: "λσ::technical. the (level σ) > 0"

  type_synonym tc = technical (* technical content *)

  doc_class example  = text_section +
     referentiable   :: bool <= True
     status          :: status <= "description"
     short_name      :: string <= "''''"

  doc_class math_content = tc +
     referentiable :: bool <= True
     short_name    :: string <= "''''"
     status        :: status <= "semiformal"
     mcc           :: "math_content_class" <= "thm"
     invariant s1  :: "λ σ::math_content. ¬referentiable σ ⟶ short_name σ = ''''"
     invariant s2  :: "λ σ::math_content. technical.status σ = semiformal"

  The class math_content overrride the attribute status
  of the class technical, by using the type synonym tc,
  but the base name of this attribute refers
  to the attribute of the class example where it is last defined
  and not just overridden.
  So in the invariant s2 of the class math_content,
  we must use the long name of the attribute,
  i.e. the base name "status" with its qualifier which refers
  to the superclass where it is defined, the class technical.

  Type synonyms as qualifiers are not yet supported.
- Qualify classes that only override attributes of their superclass
  as vitual classes by adding a virtual attribute.
  This attribute is used to discriminate virtual classes and generate
  an adequate make function to initialize their associated record.
  The implementation uses an hidden attribute (the tag_attribute)
  to force the virtual class to be concrete or the logic
  by having a full new record definition associated with it.
  For example:

  doc_class W =
    a::"int" <= "1"

  doc_class X = W +
    a::"int" <= "2"

  The class X is tagged as a virtual class and
  the record make functions of the classes W and X are:

  W.make W_tag_attribute W_a
  X.make X_tag_attribute X_a X_tag_attribute

  So a record definition is added to the theory context for each class,
  even though a virtual class only overrides
  attributes of its superclass.
  This behavior allows us to support definitions of new default values
  for attributes in the subclass, as shown in the example.
- Factorize make name components
- Use Record name components instead of strings to refer to Record
  components
- Fix typos
2021-12-07 10:04:47 +01:00
Nicolas Méric 08c101c544 Implement built-ins referential equivalence
- Add a first implementation of a referential equivalence
  for the built-ins term annotations (TA)
- Some built-ins remain as unspecified constants:
  - the docitem TA offers a way to check the reference of
    class instances without checking the instances type.
    It must be avoided for certification
  - the termrepr TA is left as an unspecified constant for now.
    A major refactoring of code should be done to enable
    referential equivalence for termrepr, by changing the dependency
    between the Isa_DOF theory and the Assert theory.
    The assert_cmd function in Assert should use the value* command
    functions, which make the elaboration of the term
    referenced by the TA before passing it to the evaluator
- Update the Evaluation test theory to test the referential equivalence
  and expose some of  current implementation limitations
- Add a warning about the docitem TA in the TermAntiquotations theory
2021-11-09 08:55:02 +01:00
Nicolas Méric 6ac1445147 Change the implementation of the tag attribute
The philosophy is for the tag attribute to be unique
for each class.
So this commit updates the implementation of this attribute
to match the philosophy.
The previous implementation associated a tag attribute
with a class but also with each super-class of this class
up to the top (default) class "text".
Now a class with super-classes has only one tag attribute.
2021-11-08 10:44:29 +01:00
Nicolas Méric 664aede4c0 First draft of the value* command implementation
Add a command value*
- The value* command uses the same code as the value command
  and adds the possibility to evaluate
  Term Annotation Antiquotations (TA)
  with the help of the DOF_core.transduce_term_global function.
  The DOF_core.transduce_term_global function,
  in addition to the validation of a term
  (also called a second level type checking),
  is now able to make a so called elaboration:
  it will construct the term referenced by a TA before
  passing it to the evaluator.
- For a term to be evaluated, it must not be contain
  the "undefined" constant whose evaluation always fails.
  (See the code generation documentation).
  Furthermore, the instance class generation is updated in such a way
  that each of its attributes is initialized with a free variable
  whose name shows to the final user that this attribute
  is not initialized.
  It implies that an instance class evaluation will be pass
  to the normalization by evaluation (nbe) evaluator by default
  if the final user does not specify a class instance entirely,
  i.e. by specifying each attribute of the instance.
  This choice is considered a decent compromise, considering
  the speed and trustworthiness of the nbe evaluator.
  (See the article
  A Compiled Implementation of Normalization by Evaluation from 2008)
- Update the ISA transformer tab to add a function
  which is used for the elaboration of the term referenced by the TA.to pass
- Add a first really basic draft of the implementation
  of the elaboration of the built-ins TA and of an instance class:
  - For the built-ins, the term referenced by the TA is returned
    as it is;
  - For an instance class, the value of the instance is returned.
- Make the tag attribute global by moving it to DOF_core structure
- Add a first draft for some evaluation tests
  and expose the limitations of the current implementation
  in Evaluation.thy
2021-11-08 10:38:11 +01:00
Burkhart Wolff c14cb31639 ... 2021-10-14 20:31:21 +02:00
Burkhart Wolff 9b08e92588 Experiments with the code generator for Isa_DOF class objects. 2021-10-08 16:00:57 +02:00
Burkhart Wolff 4420084d52 restructuring command-syntax doc_class 2021-09-29 14:21:13 +02:00
Burkhart Wolff f9027ef331 a section explaining the consequences of a doc-class and its shallow semantics in Isabelle records on different levels of representation 2021-07-18 17:34:52 +02:00
Achim D. Brucker cfbc3311cd Merge branch 'master' into class-term-antiquotation-implementation 2021-07-02 17:39:42 +02:00
Burkhart Wolff 9f9bc25618 no message 2021-07-01 16:25:31 +02:00
Burkhart Wolff 5aad659a85 some observations on invariant code generation 2021-07-01 13:12:18 +02:00
Nicolas Méric 2c01a7118b Add term* cmd and term antiquotations for classes
- Add a term antiquotation for document classes
  and add the term* command which mimics the classical term command
  and adds the possibility to use a term antiquotation
  which references document classes:
  one can use @{A ''A_instance''} to reference
  an instance of the class A in a term* command.
- Reuse and update the ML_isa_check_generic visitor pattern
  to add the function which checks the class instance of a class,
  used by the term antiquotation for document classes.
  Also, the update_isa functions now expect long name
  (See builtin term antiquotations setup)
- The merge of ISA_transformer_tab has been update to avoid conflicts.
  Indeed, the merge is ultra-critical: the transformer tabs were
  just extended by letting *the first* entry
  with the same long-name win.
  Since the range is a (call-back) function, a comparison on its content
  is impossible and some choice has to be made.
  An alternative may be to use Symtab.join
- As classes names as constants are already bound to
  "doc_class Regular_Exp.rexp" constants by add_doc_class_cmd function,
  we use a prefix "doc_class_" when adding
  document classes term antiquotations
2021-06-01 17:32:45 +02:00
Burkhart Wolff f8801a1121 basically table_inline. 2021-05-13 14:37:27 +02:00
Burkhart Wolff d7b625ae04 little debug. 2021-04-21 20:27:23 +02:00
Burkhart Wolff 3b21df199b addded docitem ML antiquotation. (Kleine Fingeruebung). 2021-04-21 20:24:06 +02:00
Achim D. Brucker 0b6ef076b0 Initial support for svjour3-class from Springer. 2021-04-06 12:15:13 +01:00
Achim D. Brucker 46875b0560 Fixed version number. 2021-03-11 00:03:37 +00:00
Achim D. Brucker 06dddeacf5 Porting to Isabelle 2021. 2021-03-10 22:04:09 +00:00
Achim D. Brucker 676b0304a8 Print abstract title/name and removed table of contents. 2021-01-14 05:24:10 +00:00
Achim D. Brucker c03b54584c Fixed package name. 2021-01-13 12:12:18 +00:00
Achim D. Brucker 1c57e9b08b Fixed package name. 2021-01-12 23:46:47 +00:00
Achim D. Brucker be09cb7d89 Fixed file permissions. 2021-01-10 06:56:28 +00:00
Achim D. Brucker 88504abf33 Added wrapper for amssymb to support amssymb-like commands for both pdflatex and luatex. 2021-01-10 06:56:05 +00:00
Burkhart Wolff d86e708154 a first imprfect solution for the assert* problem; 4th chapter roughly completed. 2021-01-03 14:07:21 +01:00
Burkhart Wolff aee1d33709 renaming ISA's; new shortcuts; more content in the RefMan. 2021-01-02 15:57:28 +01:00
Burkhart Wolff 396ef1d477 More content in 4, better tree printing. 2021-01-01 21:23:21 +01:00
Burkhart Wolff 242bb536bc Reorganization Chap 4. <4.3.2 2020-12-30 23:07:19 +01:00
Burkhart Wolff 04f0cc7f5c Reorganization: Pushed Macro Core Mechanism into the DOF Core; adapted the RefMan accordingly. 2020-12-30 12:47:54 +01:00
Burkhart Wolff 4c5aacb39f activated syntactic checks for trimming macros 2020-12-23 11:30:42 +01:00
Burkhart Wolff 4c5fc4bc53 built in syntactic checks for trimming macros 2020-12-23 09:43:22 +01:00
Burkhart Wolff 005922ffda built in syntactic checks for trimming macros 2020-12-23 09:41:26 +01:00
Burkhart Wolff 6899c4059e improved macro syntax 2020-12-22 20:37:15 +01:00
Burkhart Wolff 5593c22a36 first version with macro syntax (no ML support) 2020-12-22 19:50:00 +01:00
Burkhart Wolff de5c0fc6e2 added Isar-syntax for define_shortcut* 2020-12-22 08:07:19 +01:00
Burkhart Wolff 0e64608a58 enforcing shorter Definition* - style in examples (CC,CENELEC,...) 2020-12-02 09:32:48 +01:00
Burkhart Wolff 8771d8581b default class checking bug fixed; new attributes for default classes in ontological macros Definition* Theorem* Lemma* 2020-12-01 23:18:13 +01:00
Achim D. Brucker c11e68e3ea Bug fix: Definition environment. 2020-12-01 07:46:20 +00:00
Burkhart Wolff efeee1e863 Eliminated deprecated abstract class residuals; lifted Definition* to math_content. 2020-11-10 13:07:54 +01:00
Burkhart Wolff 2ecb62a80e added Lemma*, Theorem* and Definition* support. Bug: referencing does not work. 2020-11-04 15:55:43 +01:00
Burkhart Wolff 4ad06ce39a deactivated class check. 2020-11-04 14:25:14 +01:00
Burkhart Wolff da0f3e63f1 more steps to reform document macro mechanism 2020-11-04 13:13:24 +01:00
Achim D. Brucker 1ad81aff35 Added support for explicit abstract* command. 2020-11-03 21:47:05 +00:00
Achim D. Brucker 1129a0ed3e Added support for explicit author* command. 2020-11-03 21:43:55 +00:00
Burkhart Wolff bad7dfc2ef new set of macros : author* and abstract* --- not working yet 2020-11-03 19:00:33 +01:00
Burkhart Wolff fe8f63690d macro-arrangement ... 2020-11-02 18:30:40 +01:00
Burkhart Wolff e59ac46299 removed SI --- went to AFP 2020-11-02 14:32:41 +01:00
Burkhart Wolff aa1fed2440 sdf 2020-11-02 14:12:27 +01:00
Burkhart Wolff abd32a802d First Pass of Chap 4 - Added invariant syntax description, more semantic content 2020-10-26 12:27:33 +01:00
Achim D. Brucker a175871474 Improved definition of \ie and \eg. 2020-10-06 04:45:14 +01:00
Burkhart Wolff d655effcf8 pushup. 2020-09-22 16:47:05 +02:00