added Isar-syntax for define_shortcut*
This commit is contained in:
parent
0e64608a58
commit
de5c0fc6e2
|
@ -19,13 +19,11 @@ begin
|
||||||
open_monitor*[this::article]
|
open_monitor*[this::article]
|
||||||
declare[[strict_monitor_checking=false]]
|
declare[[strict_monitor_checking=false]]
|
||||||
|
|
||||||
setup \<open> DOF_lib.define_shortcut \<^binding>\<open>isadof\<close> "\\isadof"
|
define_shortcut* isadof \<rightleftharpoons> \<open>\isadof\<close>
|
||||||
#> DOF_lib.define_shortcut \<^binding>\<open>LaTeX\<close> "\\LaTeX{}"
|
LaTeX \<rightleftharpoons> \<open>\LaTeX{}\<close>
|
||||||
#> DOF_lib.define_shortcut \<^binding>\<open>Protege\<close> "Prot{\\'e}g{\\'e}"
|
dots \<rightleftharpoons> \<open>\ldots\<close>
|
||||||
#> DOF_lib.define_shortcut \<^binding>\<open>dots\<close> "\\ldots"
|
isabelle \<rightleftharpoons> \<open>Isabelle/HOL\<close>
|
||||||
#> DOF_lib.define_shortcut \<^binding>\<open>isabelle\<close> "Isabelle/HOL"
|
Protege \<rightleftharpoons> \<open>Prot{\'e}g{\'e}\<close>
|
||||||
|
|
||||||
\<close>
|
|
||||||
|
|
||||||
(* slanted text in contrast to italics *)
|
(* slanted text in contrast to italics *)
|
||||||
setup\<open> DOF_lib.define_macro \<^binding>\<open>slanted_text\<close> "\\textsl{" "}" (K(K()))\<close>
|
setup\<open> DOF_lib.define_macro \<^binding>\<open>slanted_text\<close> "\\textsl{" "}" (K(K()))\<close>
|
||||||
|
|
|
@ -12,17 +12,17 @@ declare[[ Definition_default_class="definition"]]
|
||||||
declare[[ Lemma_default_class="lemma"]]
|
declare[[ Lemma_default_class="lemma"]]
|
||||||
declare[[ Theorem_default_class="theorem"]]
|
declare[[ Theorem_default_class="theorem"]]
|
||||||
|
|
||||||
setup \<open> DOF_lib.define_shortcut \<^binding>\<open>csp\<close> "CSP"
|
define_shortcut* csp \<rightleftharpoons> \<open>CSP\<close>
|
||||||
#> DOF_lib.define_shortcut \<^binding>\<open>isabelle\<close> "Isabelle/HOL"\<close>
|
isabelle \<rightleftharpoons> \<open>Isabelle/HOL\<close>
|
||||||
|
|
||||||
(*>*)
|
(*>*)
|
||||||
|
|
||||||
title*[tit::title]\<open>Philosophers may Dine - Definitively!\<close>
|
title*[tit::title]\<open>Philosophers may Dine - Definitively!\<close>
|
||||||
|
|
||||||
author*[safouan,email="\<open>safouan.taha@lri.fr\<close>",affiliation="\<open>LRI, CentraleSupelec\<close>"]\<open>Safouan Taha\<close>
|
author*[safouan,email="\<open>safouan.taha@lri.fr\<close>",affiliation="\<open>LRI, CentraleSupelec\<close>"]\<open>Safouan Taha\<close>
|
||||||
author*[bu,email= "\<open>wolff@lri.fr\<close>",affiliation = "\<open>LRI, Université Paris-Saclay\<close>"]\<open>Burkhart Wolff\<close>
|
author*[bu,email= "\<open>wolff@lri.fr\<close>",affiliation = "\<open>LRI, Université Paris-Saclay\<close>"]\<open>Burkhart Wolff\<close>
|
||||||
author*[lina,email="\<open>lina.ye@lri.fr\<close>",affiliation="\<open>LRI, Inria, LSV, CentraleSupelec\<close>"]\<open>Lina Ye\<close>
|
author*[lina,email="\<open>lina.ye@lri.fr\<close>",affiliation="\<open>LRI, Inria, LSV, CentraleSupelec\<close>"]\<open>Lina Ye\<close>
|
||||||
|
|
||||||
abstract*[abs, keywordlist="[\<open>Shallow Embedding\<close>,\<open>Process-Algebra\<close>,
|
abstract*[abs, keywordlist="[\<open>Shallow Embedding\<close>,\<open>Process-Algebra\<close>,
|
||||||
\<open>Concurrency\<close>,\<open>Computational Models\<close>]"]
|
\<open>Concurrency\<close>,\<open>Computational Models\<close>]"]
|
||||||
\<open> The theory of Communicating Sequential Processes going back to Hoare and Roscoe is still today
|
\<open> The theory of Communicating Sequential Processes going back to Hoare and Roscoe is still today
|
||||||
|
|
|
@ -16,20 +16,21 @@ theory "00_Frontmatter"
|
||||||
imports "Isabelle_DOF.technical_report"
|
imports "Isabelle_DOF.technical_report"
|
||||||
begin
|
begin
|
||||||
|
|
||||||
text\<open> \<open> \<tau>\<close>\<close>
|
|
||||||
|
|
||||||
section\<open>Document Local Setup.\<close>
|
section\<open>Document Local Setup.\<close>
|
||||||
text\<open>Some internal setup, introducing document specific abbreviations and macros.\<close>
|
text\<open>Some internal setup, introducing document specific abbreviations and macros.\<close>
|
||||||
|
|
||||||
setup \<open>DOF_lib.define_shortcut \<^binding>\<open>dof\<close> "\\dof"\<close>
|
|
||||||
setup \<open>DOF_lib.define_shortcut \<^binding>\<open>isadof\<close> "\\isadof"\<close>
|
|
||||||
setup \<open> DOF_lib.define_shortcut \<^binding>\<open>TeXLive\<close>"\\TeXLive"
|
define_shortcut* dof \<rightleftharpoons> \<open>\dof\<close>
|
||||||
#> DOF_lib.define_shortcut \<^binding>\<open>BibTeX\<close> "\\BibTeX{}"
|
isadof \<rightleftharpoons> \<open>\isadof\<close>
|
||||||
#> DOF_lib.define_shortcut \<^binding>\<open>LaTeX\<close> "\\LaTeX{}"
|
|
||||||
#> DOF_lib.define_shortcut \<^binding>\<open>TeX\<close> "\\TeX{}"
|
define_shortcut* TeXLive \<rightleftharpoons> \<open>\TeXLive\<close>
|
||||||
#> DOF_lib.define_shortcut \<^binding>\<open>pdf\<close> "PDF"
|
BibTeX \<rightleftharpoons> \<open>\BibTeX{}\<close>
|
||||||
#> DOF_lib.define_shortcut \<^binding>\<open>pdftex\<close> "\\pdftex{}"
|
LaTeX \<rightleftharpoons> \<open>\LaTeX{}\<close>
|
||||||
\<close>
|
TeX \<rightleftharpoons> \<open>\TeX{}\<close>
|
||||||
|
pdf \<rightleftharpoons> \<open>PDF\<close>
|
||||||
|
pdftex \<rightleftharpoons> \<open>\pdftex{}\<close>
|
||||||
|
|
||||||
text\<open>Note that these setups assume that the associated \<^LaTeX> macros are defined, \<^eg>,
|
text\<open>Note that these setups assume that the associated \<^LaTeX> macros are defined, \<^eg>,
|
||||||
in the document prelude. \<close>
|
in the document prelude. \<close>
|
||||||
|
|
|
@ -14,9 +14,10 @@
|
||||||
(*<*)
|
(*<*)
|
||||||
theory TR_MyCommentedIsabelle
|
theory TR_MyCommentedIsabelle
|
||||||
imports "Isabelle_DOF.technical_report"
|
imports "Isabelle_DOF.technical_report"
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
|
||||||
setup \<open> DOF_lib.define_shortcut \<^binding>\<open>isabelle\<close> "Isabelle/HOL"\<close>
|
define_shortcut* isabelle \<rightleftharpoons> \<open>Isabelle/HOL\<close>
|
||||||
|
|
||||||
open_monitor*[this::report]
|
open_monitor*[this::report]
|
||||||
(*>*)
|
(*>*)
|
||||||
|
@ -2311,6 +2312,7 @@ for Unicode Character Denotations as well as many local hints for improvements.\
|
||||||
|
|
||||||
section*[bib::bibliography]\<open>Bibliography\<close>
|
section*[bib::bibliography]\<open>Bibliography\<close>
|
||||||
|
|
||||||
|
|
||||||
close_monitor*[this]
|
close_monitor*[this]
|
||||||
check_doc_global
|
check_doc_global
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ theory Isa_COL
|
||||||
and "figure*" "side_by_side_figure*" :: document_body
|
and "figure*" "side_by_side_figure*" :: document_body
|
||||||
and "assert*" :: thy_decl
|
and "assert*" :: thy_decl
|
||||||
|
|
||||||
|
and "define_shortcut*" :: thy_decl
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
|
||||||
|
@ -413,6 +414,17 @@ fun enclose_env verbatim ctxt block_env body =
|
||||||
end
|
end
|
||||||
\<close>
|
\<close>
|
||||||
|
|
||||||
|
ML\<open>
|
||||||
|
local
|
||||||
|
val parse_define_shortcut = Parse.binding --
|
||||||
|
((\<^keyword>\<open>\<rightleftharpoons>\<close> || \<^keyword>\<open>==\<close>) |-- (Parse.alt_string || Parse.cartouche))
|
||||||
|
val define_shortcuts = fold(uncurry DOF_lib.define_shortcut)
|
||||||
|
in
|
||||||
|
val _ =
|
||||||
|
Outer_Syntax.command \<^command_keyword>\<open>define_shortcut*\<close> "define LaTeX shortcut"
|
||||||
|
(Scan.repeat1 parse_define_shortcut >> (Toplevel.theory o define_shortcuts));
|
||||||
|
end
|
||||||
|
\<close>
|
||||||
|
|
||||||
section\<open>Tables\<close>
|
section\<open>Tables\<close>
|
||||||
(* TODO ! ! ! *)
|
(* TODO ! ! ! *)
|
||||||
|
@ -426,5 +438,4 @@ ML\<open>@{term "side_by_side_figure"};
|
||||||
@{typ "doc_class rexp"};
|
@{typ "doc_class rexp"};
|
||||||
DOF_core.SPY;\<close>
|
DOF_core.SPY;\<close>
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -62,7 +62,7 @@ doc_class F =
|
||||||
|
|
||||||
|
|
||||||
doc_class G = C +
|
doc_class G = C +
|
||||||
g :: "thm" <= "@{thm ''HOL.refl''}"
|
g :: "thm" <= "@{thm \<open>HOL.refl\<close>}"
|
||||||
|
|
||||||
doc_class M =
|
doc_class M =
|
||||||
trace :: "(A + C + D + F) list"
|
trace :: "(A + C + D + F) list"
|
||||||
|
@ -79,8 +79,8 @@ ML\<open> Thy_Header.get_keywords @{theory};(* this looks to be really theory gl
|
||||||
section*[test::A]\<open>Test and Validation\<close>
|
section*[test::A]\<open>Test and Validation\<close>
|
||||||
text\<open>Defining some document elements to be referenced in later on in another theory: \<close>
|
text\<open>Defining some document elements to be referenced in later on in another theory: \<close>
|
||||||
text*[sdf]\<open> Lorem ipsum @{thm refl}\<close>
|
text*[sdf]\<open> Lorem ipsum @{thm refl}\<close>
|
||||||
text*[ sdfg] \<open> Lorem ipsum @{thm refl}\<close>
|
text*[ sdfg :: F] \<open> Lorem ipsum @{thm refl}\<close>
|
||||||
text*[ xxxy ] \<open> Lorem ipsum @{docitem \<open>sdfg\<close>} rate @{thm refl}\<close>
|
text*[ xxxy ] \<open> Lorem ipsum @{F \<open>sdfg\<close>} rate @{thm refl}\<close>
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -470,46 +470,23 @@ setup\<open> let val cidS = ["scholarly_paper.introduction","scholarly_paper.tec
|
||||||
in DOF_core.update_class_invariant "scholarly_paper.article" body end\<close>
|
in DOF_core.update_class_invariant "scholarly_paper.article" body end\<close>
|
||||||
|
|
||||||
|
|
||||||
(* some test code *)
|
|
||||||
ML\<open>
|
|
||||||
(*
|
|
||||||
|
|
||||||
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) ;
|
|
||||||
*)
|
|
||||||
\<close>
|
|
||||||
|
|
||||||
section\<open>Miscelleous\<close>
|
section\<open>Miscelleous\<close>
|
||||||
|
|
||||||
subsection\<open>Layout Trimming Commands\<close>
|
|
||||||
setup\<open> DOF_lib.define_macro \<^binding>\<open>hs\<close> "\\hspace{" "}" (K(K())) \<close>
|
|
||||||
setup\<open> DOF_lib.define_macro \<^binding>\<open>vs\<close> "\\vspace{" "}" (K(K())) \<close>
|
|
||||||
setup\<open> DOF_lib.define_shortcut \<^binding>\<open>clearpage\<close> "\\clearpage{}" \<close>
|
|
||||||
|
|
||||||
|
|
||||||
subsection\<open>Common Abbreviations\<close>
|
subsection\<open>Common Abbreviations\<close>
|
||||||
setup \<open> DOF_lib.define_shortcut \<^binding>\<open>eg\<close> "\\eg"
|
|
||||||
(* Latin: „exempli gratia“ meaning „for example“. *)
|
define_shortcut* eg \<rightleftharpoons> \<open>\eg\<close> (* Latin: „exempli gratia“ meaning „for example“. *)
|
||||||
#> DOF_lib.define_shortcut \<^binding>\<open>ie\<close> "\\ie"
|
ie \<rightleftharpoons> \<open>\ie\<close> (* Latin: „id est“ meaning „that is to say“. *)
|
||||||
(* Latin: „id est“ meaning „that is to say“. *)
|
etc \<rightleftharpoons> \<open>\etc\<close> (* Latin : et cetera *)
|
||||||
#> DOF_lib.define_shortcut \<^binding>\<open>etc\<close> "\\etc"\<close>
|
|
||||||
|
subsection\<open>Layout Trimming Commands\<close>
|
||||||
(* this is an alternative style for macro definitions equivalent to setup ... setup ...*)
|
|
||||||
|
setup\<open> DOF_lib.define_macro \<^binding>\<open>hs\<close> "\\hspace{" "}" (K(K())) \<close>
|
||||||
|
setup\<open> DOF_lib.define_macro \<^binding>\<open>vs\<close> "\\vspace{" "}" (K(K())) \<close>
|
||||||
|
|
||||||
|
define_shortcut* clearpage \<rightleftharpoons> \<open>\clearpage{}\<close>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue