diff --git a/Isabelle_DOF-Example-Extra/scholarly_paper/2020-iFM-CSP/paper.thy b/Isabelle_DOF-Example-Extra/scholarly_paper/2020-iFM-CSP/paper.thy index 229c48ab..d6c56ffd 100644 --- a/Isabelle_DOF-Example-Extra/scholarly_paper/2020-iFM-CSP/paper.thy +++ b/Isabelle_DOF-Example-Extra/scholarly_paper/2020-iFM-CSP/paper.thy @@ -356,7 +356,7 @@ is based on the concept \<^emph>\refusals after\ a trace \s\< Definition*[process_ordering, level= "Some 2", short_name="''process ordering''"]\ We define \P \ Q \ \\<^sub>\ \ \\<^sub>\ \ \\<^sub>\ \, where -\<^enum> \\\<^sub>\ = \ P \ \ Q \ +\<^enum> \\\<^sub>\ = \ P \ \ Q \ \<^enum> \\\<^sub>\ = s \ \ P \ \ P s = \ Q s\ \<^enum> \\\<^sub>\ = Mins(\ P) \ \ Q \ \ diff --git a/Isabelle_DOF-Unit-Tests/AssnsLemmaThmEtc.thy b/Isabelle_DOF-Unit-Tests/AssnsLemmaThmEtc.thy index 8152ac54..1b593074 100644 --- a/Isabelle_DOF-Unit-Tests/AssnsLemmaThmEtc.thy +++ b/Isabelle_DOF-Unit-Tests/AssnsLemmaThmEtc.thy @@ -39,14 +39,19 @@ text\For now, as the term annotation is not bound to a meta logic which wi in the assertion. \ -ML\ -@{term "[@{term \True \ True \}]"}; (* with isa-check *) -\ +ML\ @{term "[@{term \True \ True \}]"}; (* with isa-check *) \ -Definition*[ertert]\dfgdfg\ -Theorem*[dgdfgddfg]\dfgdfg\ +Definition*[e1]\dfgdfg\ -lemma "All (\x. X \ Y \ True)" oops +definition*[e1bis] e :: int where "e = 1" + +Theorem*[e2]\dfgdfg\ + +theorem*[e2bis] f : "e = 1+0" unfolding e_def by simp + +Lemma*[e3]\ \ + +lemma*[dfgd] q: "All (\x. X \ Y \ True)" oops text\An example for the ontology specification character of the short-cuts such as diff --git a/Isabelle_DOF/ontologies/scholarly_paper/scholarly_paper.thy b/Isabelle_DOF/ontologies/scholarly_paper/scholarly_paper.thy index 7358e878..3a0b68ce 100644 --- a/Isabelle_DOF/ontologies/scholarly_paper/scholarly_paper.thy +++ b/Isabelle_DOF/ontologies/scholarly_paper/scholarly_paper.thy @@ -15,11 +15,11 @@ chapter\An example ontology for scientific, MINT-oriented papers.\ theory scholarly_paper imports "Isabelle_DOF.Isa_COL" - keywords "author*" "abstract*" :: document_body - and "Definition*" "Lemma*" "Theorem*" :: document_body - and "Premise*" "Corollary*" "Consequence*" :: document_body - and "Assumption*" "Hypothesis*" "Assertion*" :: document_body - and "Proof*" "Example*" :: document_body + keywords "author*" "abstract*" :: document_body + and "Proposition*" "Definition*" "Lemma*" "Theorem*" :: document_body + and "Premise*" "Corollary*" "Consequence*" :: document_body + and "Assumption*" "Hypothesis*" "Assertion*" :: document_body + and "Proof*" "Example*" :: document_body begin define_ontology "DOF-scholarly_paper.sty" "Writing academic publications." @@ -159,6 +159,19 @@ doc_class example = text_section + short_name :: string <= "''''" invariant L\<^sub>e\<^sub>x\<^sub>a :: "(level \) \ None \ the (level \) > 0" +text\The intended use for the \doc_class\es \<^verbatim>\math_motivation\ (or \<^verbatim>\math_mtv\ for short), + \<^verbatim>\math_explanation\ (or \<^verbatim>\math_exp\ for short) and + \<^verbatim>\math_example\ (or \<^verbatim>\math_ex\ for short) + are \<^emph>\informal\ descriptions of semi-formal definitions (by inheritance). + Math-Examples can be made referentiable triggering explicit, numbered presentations.\ +doc_class math_motivation = tc + + referentiable :: bool <= False +type_synonym math_mtv = math_motivation + +doc_class math_explanation = tc + + referentiable :: bool <= False +type_synonym math_exp = math_explanation + subsection\Freeform Mathematical Content\ @@ -197,7 +210,7 @@ doc_class math_content = tc + referentiable :: bool <= True short_name :: string <= "''''" status :: status <= "semiformal" - mcc :: "math_content_class" <= "thm" + mcc :: "math_content_class" <= "theom" invariant s1 :: "\referentiable \ \ short_name \ = ''''" invariant s2 :: "technical.status \ = semiformal" type_synonym math_tc = math_content @@ -213,94 +226,106 @@ Sub-classes can englobe instances such as: 2) ... \\ \<^item> semi-formal descriptions, which are free-form mathematical definitions on which finally - an attribute with a formal Isabelle definition is attached. - -\ - - -(* type qualification is a work around *) - -text\The intended use for the \doc_class\es \<^verbatim>\math_motivation\ (or \<^verbatim>\math_mtv\ for short), - \<^verbatim>\math_explanation\ (or \<^verbatim>\math_exp\ for short) and - \<^verbatim>\math_example\ (or \<^verbatim>\math_ex\ for short) - are \<^emph>\informal\ descriptions of semi-formal definitions (by inheritance). - Math-Examples can be made referentiable triggering explicit, numbered presentations.\ -doc_class math_motivation = tc + - referentiable :: bool <= False -type_synonym math_mtv = math_motivation - -doc_class math_explanation = tc + - referentiable :: bool <= False -type_synonym math_exp = math_explanation - - -text\The intended use for the \doc_class\ \<^verbatim>\math_semiformal_statement\ (or \<^verbatim>\math_sfs\ for short) - are semi-formal mathematical content (definition, lemma, etc.). They are referentiable entities. - They are NOT formal, i.e. Isabelle-checked formal content, but can be in close link to these.\ -doc_class math_semiformal = math_content + - referentiable :: bool <= True -type_synonym math_sfc = math_semiformal + an attribute with a formal Isabelle definition is attached. \ text\Instances of the Free-form Content are Definition, Lemma, Assumption, Hypothesis, etc. The key class definitions are inspired by the AMS style, to which some target LaTeX's compile.\ -(* Future : same syntaxx as command macros ... so: Definition ... *) +text\A proposition (or: "sentence") is a central concept in philosophy of language and related +fields, often characterized as the primary bearer of truth or falsity. Propositions are also often +characterized as being the kind of thing that declarative sentences denote. \ +doc_class "proposition" = math_content + + referentiable :: bool <= True + mcc :: "math_content_class" <= "prpo" + invariant d0 :: "mcc \ = prpo" (* can not be changed anymore. *) + +text\A definition is used to give a precise meaning to a new term, by describing a +condition which unambiguously qualifies what a mathematical term is and is not. Definitions and +axioms form the basis on which all of modern mathematics is to be constructed.\ doc_class "definition" = math_content + referentiable :: bool <= True mcc :: "math_content_class" <= "defn" invariant d1 :: "mcc \ = defn" (* can not be changed anymore. *) +doc_class "axiom" = math_content + + referentiable :: bool <= True + mcc :: "math_content_class" <= "axm" + invariant d2 :: "mcc \ = axm" (* can not be changed anymore. *) + +text\A lemma (plural lemmas or lemmata) is a generally minor, proven proposition which is used as +a stepping stone to a larger result. For that reason, it is also known as a "helping theorem" or an +"auxiliary theorem". In many cases, a lemma derives its importance from the theorem it aims to prove.\ doc_class "lemma" = math_content + referentiable :: bool <= "True" mcc :: "math_content_class" <= "lemm" - invariant d2 :: "mcc \ = lemm" + invariant d3 :: "mcc \ = lemm" doc_class "theorem" = math_content + referentiable :: bool <= True mcc :: "math_content_class" <= "theom" - invariant d3 :: "mcc \ = theom" + invariant d4 :: "mcc \ = theom" +text\A corollary is a theorem of less importance which can be readily deduced from a previous, +more notable lemma or theorem. A corollary could, for instance, be a proposition which is incidentally +proved while proving another proposition.\ doc_class "corollary" = math_content + referentiable :: bool <= "True" mcc :: "math_content_class" <= "corr" - invariant d4 :: "mcc \ = corr" + invariant d5 :: "mcc \ = corr" + +text\A premise or premiss[a] is a proposition — a true or false declarative statement— + used in an argument to prove the truth of another proposition called the conclusion.\ doc_class "premise" = math_content + referentiable :: bool <= "True" mcc :: "math_content_class" <= "prms" - invariant d5 :: "mcc \ = prms" + invariant d6 :: "mcc \ = prms" +text\A consequence describes the relationship between statements that hold true when one statement +logically follows from one or more statements. A valid logical argument is one in which the +conclusion is entailed by the premises, because the conclusion is the consequence of the premises. +The philosophical analysis of logical consequence involves the questions: In what sense does a +conclusion follow from its premises?\ doc_class "consequence" = math_content + referentiable :: bool <= "True" mcc :: "math_content_class" <= "cons" - invariant d6 :: "mcc \ = cons" - -doc_class "assumption" = math_content + - referentiable :: bool <= "True" - mcc :: "math_content_class" <= "assm" - invariant d7 :: "mcc \ = assm" - -doc_class "hypothesis" = math_content + - referentiable :: bool <= "True" - mcc :: "math_content_class" <= "hypth" - invariant d8 :: "mcc \ = hypth" + invariant d7 :: "mcc \ = cons" +text\An assertion is a statement that asserts that a certain premise is true.\ doc_class "assertion" = math_content + referentiable :: bool <= "True" mcc :: "math_content_class" <= "assn" - invariant d9 :: "mcc \ = assn" + invariant d8 :: "mcc \ = assn" + +text\An assumption is an explicit or a tacit proposition about the world or a background belief +relating to an proposition.\ +doc_class "assumption" = math_content + + referentiable :: bool <= "True" + mcc :: "math_content_class" <= "assm" + invariant d9 :: "mcc \ = assm" + +text\ A working hypothesis is a provisionally accepted hypothesis proposed for further research + in a process beginning with an educated guess or thought. + + A different meaning of the term hypothesis is used in formal logic, to denote the antecedent of a + proposition; thus in the proposition "If \P\, then \Q\", \P\ denotes the hypothesis (or antecedent); + \Q\ can be called a consequent. \P\ is the assumption in a (possibly counterfactual) What If question.\ +doc_class "hypothesis" = math_content + + referentiable :: bool <= "True" + mcc :: "math_content_class" <= "hypth" + invariant d10 :: "mcc \ = hypth" doc_class "math_proof" = math_content + referentiable :: bool <= "True" mcc :: "math_content_class" <= "mprf" - invariant d10 :: "mcc \ = mprf" + invariant d11 :: "mcc \ = mprf" doc_class "math_example"= math_content + referentiable :: bool <= "True" mcc :: "math_content_class" <= "mexl" - invariant d11 :: "mcc \ = mexl" + invariant d12 :: "mcc \ = mexl" @@ -324,72 +349,99 @@ text\These ontological macros allow notations are defined for the class that are not necessarily in the same inheritance hierarchy: for example: \<^item> mathematical definition vs terminological definition \<^item> mathematical example vs. technical example. + \<^item> mathematical proof vs. some structured argument + \<^item> mathematical hypothesis vs. philosophical/metaphysical assumption + \<^item> ... + +By setting the default classes, it is possible to reuse these syntactic support and give them +different interpretations in an underlying ontological class-tree. \ ML\ -val s = [\<^const_name>\defn\,\<^const_name>\axm\, \<^const_name>\theom\, \<^const_name>\lemm\, \<^const_name>\corr\, \<^const_name>\prpo\, - \<^const_name>\rulE\,\<^const_name>\assn\, \<^const_name>\hypth\, \<^const_name>\assm\, \<^const_name>\prms\, \<^const_name>\cons\, - \<^const_name>\mprf\,\<^const_name>\mexl\, \<^const_name>\rmrk\, \<^const_name>\notn\, \<^const_name>\tmgy\]; +val s = [\<^const_name>\defn\, \<^const_name>\axm\, \<^const_name>\theom\, + \<^const_name>\lemm\, \<^const_name>\corr\, \<^const_name>\prpo\, + \<^const_name>\rulE\, \<^const_name>\assn\, \<^const_name>\hypth\, + \<^const_name>\assm\, \<^const_name>\prms\, \<^const_name>\cons\, + \<^const_name>\mprf\, \<^const_name>\mexl\, \<^const_name>\rmrk\, + \<^const_name>\notn\, \<^const_name>\tmgy\]; -val (Definition_default_class, Example_default_class_setup) - = Attrib.config_string \<^binding>\Example_default_class\ (K ""); +val (Proposition_default_class, Proposition_default_class_setup) + = Attrib.config_string \<^binding>\Proposition_default_class\ (K ""); val (Definition_default_class, Definition_default_class_setup) = Attrib.config_string \<^binding>\Definition_default_class\ (K ""); +val (Axiom_default_class, Axiom_default_class_setup) + = Attrib.config_string \<^binding>\Axiom_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 ""); - +val (Corollary_default_class, Corollary_default_class_setup) + = Attrib.config_string \<^binding>\Corollary_default_class\ (K ""); +val (Assumption_default_class, Assumption_default_class_setup) + = Attrib.config_string \<^binding>\Assumption_default_class\ (K ""); +val (Assertion_default_class, Assertion_default_class_setup) + = Attrib.config_string \<^binding>\Assertion_default_class\ (K ""); +val (Consequence_default_class, Consequence_default_class_setup) + = Attrib.config_string \<^binding>\Consequence_default_class\ (K ""); +val (Proof_default_class, Proof_default_class_setup) + = Attrib.config_string \<^binding>\Proof_default_class\ (K ""); +val (Example_default_class, Example_default_class_setup) + = Attrib.config_string \<^binding>\Example_default_class\ (K ""); +val (Remark_default_class, Remark_default_class_setup) + = Attrib.config_string \<^binding>\Remark_default_class\ (K ""); +val (Notation_default_class, Notation_default_class_setup) + = Attrib.config_string \<^binding>\Notation_default_class\ (K ""); \ -setup\Example_default_class_setup\ -setup\Definition_default_class_setup\ -setup\Lemma_default_class_setup\ -setup\Theorem_default_class_setup\ -ML\ local open ODL_Meta_Args_Parser in +setup\ Proposition_default_class_setup + #> Definition_default_class_setup + #> Axiom_default_class_setup + #> Lemma_default_class_setup + #> Theorem_default_class_setup + #> Corollary_default_class_setup + #> Assertion_default_class_setup + #> Assumption_default_class_setup + #> Consequence_default_class_setup + #> Proof_default_class_setup + #> Remark_default_class_setup + #> Example_default_class_setup\ -val _ = - Monitor_Command_Parser.document_command \<^command_keyword>\Definition*\ "Freeform Definition" - {markdown = true, body = true} +ML\ +local open ODL_Meta_Args_Parser in + +local +fun doc_cmd kwd txt flag key = + Monitor_Command_Parser.document_command kwd txt {markdown = true, body = true} (fn meta_args => fn thy => let - val ddc = Config.get_global thy Definition_default_class - val use_Definition_default = SOME(((ddc = "") ? (K "math_content")) ddc) + val ddc = Config.get_global thy flag + val default = SOME(((ddc = "") ? (K \<^const_name>\math_content\)) ddc) in - Onto_Macros.enriched_formal_statement_command - use_Definition_default [("mcc","defn")] meta_args thy - end); + Onto_Macros.enriched_formal_statement_command default [("mcc",key)] meta_args thy + end) -val _ = - Monitor_Command_Parser.document_command \<^command_keyword>\Lemma*\ "Freeform Lemma Description" - {markdown = true, body = true} - (fn meta_args => fn thy => - let - val ddc = Config.get_global thy Lemma_default_class - val use_Lemma_default = SOME(((ddc = "") ? (K "math_content")) ddc) - in - Onto_Macros.enriched_formal_statement_command - use_Lemma_default [("mcc","lemm")] meta_args thy - end); +in -val _ = - Monitor_Command_Parser.document_command \<^command_keyword>\Theorem*\ "Freeform Theorem" - {markdown = true, body = true} - (fn meta_args => fn thy => - let - val ddc = Config.get_global thy Theorem_default_class - val use_Theorem_default = SOME(((ddc = "") ? (K "math_content")) ddc) - in - Onto_Macros.enriched_formal_statement_command - use_Theorem_default [("mcc","theom")] meta_args thy - end); +val _ = doc_cmd \<^command_keyword>\Definition*\ "Freeform Definition" + Definition_default_class \<^const_name>\defn\; + +val _ = doc_cmd \<^command_keyword>\Lemma*\ "Freeform Lemma Description" + Lemma_default_class \<^const_name>\lemm\; + +val _ = doc_cmd \<^command_keyword>\Theorem*\ "Freeform Theorem" + Theorem_default_class \<^const_name>\theom\; (* cut and paste to make it runnable, but nonsensical : *) val _ = + Monitor_Command_Parser.document_command \<^command_keyword>\Proposition*\ "Freeform Proposition" + {markdown = true, body = true} + (fn meta_args => fn thy => thy); + +val _ = Monitor_Command_Parser.document_command \<^command_keyword>\Premise*\ "Freeform Premise" {markdown = true, body = true} (fn meta_args => fn thy => thy); @@ -428,7 +480,7 @@ val _ = Monitor_Command_Parser.document_command \<^command_keyword>\Example*\ "Freeform Example" {markdown = true, body = true} (fn meta_args => fn thy => thy); - +end end \ @@ -446,21 +498,12 @@ type_synonym math_fc = math_formal -subsubsection*[ex_ass::example]\Example\ -text\Assertions allow for logical statements to be checked in the global context). \ +subsubsection*[ex_ass::example]\Logical Assertions\ + +text\Logical assertions allow for logical statements to be checked in the global context). \ + assert*[ass1::assertion, short_name = "\This is an assertion\"] \(3::int) < 4\ -subsection\Example Statements\ - -text\ \<^verbatim>\examples\ are currently considered \<^verbatim>\technical\. Is a main category to be refined - via inheritance. \ - -doc_class tech_example = tc + - referentiable :: bool <= True - tag :: "string" <= "''''" - - - subsection\Content in Engineering/Tech Papers \ text\This section is currently experimental and not supported by the documentation @@ -471,6 +514,7 @@ doc_class engineering_content = tc + status :: status type_synonym eng_content = engineering_content + doc_class "experiment" = eng_content + tag :: "string" <= "''''" @@ -480,11 +524,27 @@ doc_class "evaluation" = eng_content + doc_class "data" = eng_content + tag :: "string" <= "''''" +doc_class tech_definition = eng_content + + referentiable :: bool <= True + tag :: "string" <= "''''" + +doc_class tech_code = eng_content + + referentiable :: bool <= True + tag :: "string" <= "''''" + +doc_class tech_example = eng_content + + referentiable :: bool <= True + tag :: "string" <= "''''" + + + subsection\Some Summary\ print_doc_classes print_doc_class_template "definition" (* just a sample *) +print_doc_class_template "lemma" (* just a sample *) +print_doc_class_template "theorem" (* just a sample *) subsection\Structuring Enforcement in Engineering/Math Papers \