author | haftmann |
Fri, 06 Feb 2015 08:47:48 +0100 | |
changeset 59485 | 792272e6ee6b |
parent 56977 | a33fe940a557 |
child 60500 | 903bb1495239 |
permissions | -rw-r--r-- |
15469 | 1 |
(* Title: HOL/Library/LaTeXsugar.thy |
55077 | 2 |
Author: Gerwin Klein, Tobias Nipkow, Norbert Schirmer |
15469 | 3 |
Copyright 2005 NICTA and TUM |
4 |
*) |
|
5 |
||
6 |
(*<*) |
|
7 |
theory LaTeXsugar |
|
30663
0b6aff7451b2
Main is (Complex_Main) base entry point in library theories
haftmann
parents:
30304
diff
changeset
|
8 |
imports Main |
15469 | 9 |
begin |
10 |
||
11 |
(* LOGIC *) |
|
21210 | 12 |
notation (latex output) |
19674 | 13 |
If ("(\<^raw:\textsf{>if\<^raw:}> (_)/ \<^raw:\textsf{>then\<^raw:}> (_)/ \<^raw:\textsf{>else\<^raw:}> (_))" 10) |
14 |
||
15469 | 15 |
syntax (latex output) |
16 |
||
17 |
"_Let" :: "[letbinds, 'a] => 'a" |
|
18 |
("(\<^raw:\textsf{>let\<^raw:}> (_)/ \<^raw:\textsf{>in\<^raw:}> (_))" 10) |
|
19 |
||
20 |
"_case_syntax":: "['a, cases_syn] => 'b" |
|
21 |
("(\<^raw:\textsf{>case\<^raw:}> _ \<^raw:\textsf{>of\<^raw:}>/ _)" 10) |
|
22 |
||
16110 | 23 |
(* should become standard syntax once x-symbols supports it *) |
24 |
syntax (latex) |
|
25 |
nexists :: "('a => bool) => bool" (binder "\<nexists>" 10) |
|
26 |
translations |
|
27 |
"\<nexists>x. P" <= "\<not>(\<exists>x. P)" |
|
28 |
||
15469 | 29 |
(* SETS *) |
30 |
||
31 |
(* empty set *) |
|
27688 | 32 |
notation (latex) |
30304
d8e4cd2ac2a1
set operations Int, Un, INTER, UNION, Inter, Union, empty, UNIV are now proper qualified constants with authentic syntax
haftmann
parents:
29493
diff
changeset
|
33 |
"Set.empty" ("\<emptyset>") |
15469 | 34 |
|
35 |
(* insert *) |
|
36 |
translations |
|
31462 | 37 |
"{x} \<union> A" <= "CONST insert x A" |
15690 | 38 |
"{x,y}" <= "{x} \<union> {y}" |
15469 | 39 |
"{x,y} \<union> A" <= "{x} \<union> ({y} \<union> A)" |
27688 | 40 |
"{x}" <= "{x} \<union> \<emptyset>" |
15469 | 41 |
|
42 |
(* set comprehension *) |
|
43 |
syntax (latex output) |
|
44 |
"_Collect" :: "pttrn => bool => 'a set" ("(1{_ | _})") |
|
41757 | 45 |
"_CollectIn" :: "pttrn => 'a set => bool => 'a set" ("(1{_ \<in> _ | _})") |
15469 | 46 |
translations |
47 |
"_Collect p P" <= "{p. P}" |
|
15690 | 48 |
"_Collect p P" <= "{p|xs. P}" |
41757 | 49 |
"_CollectIn p A P" <= "{p : A. P}" |
15469 | 50 |
|
56977 | 51 |
(* card *) |
52 |
notation (latex output) |
|
53 |
card ("|_|") |
|
54 |
||
15469 | 55 |
(* LISTS *) |
56 |
||
57 |
(* Cons *) |
|
21210 | 58 |
notation (latex) |
56977 | 59 |
Cons ("_ \<cdot>/ _" [66,65] 65) |
15469 | 60 |
|
61 |
(* length *) |
|
21210 | 62 |
notation (latex output) |
19674 | 63 |
length ("|_|") |
15469 | 64 |
|
65 |
(* nth *) |
|
21210 | 66 |
notation (latex output) |
19674 | 67 |
nth ("_\<^raw:\ensuremath{_{[\mathit{>_\<^raw:}]}}>" [1000,0] 1000) |
15469 | 68 |
|
69 |
(* DUMMY *) |
|
70 |
consts DUMMY :: 'a ("\<^raw:\_>") |
|
71 |
||
72 |
(* THEOREMS *) |
|
35251
e244adbbc28f
modernized notation -- to make it work for authentic syntax;
wenzelm
parents:
31462
diff
changeset
|
73 |
notation (Rule output) |
56245 | 74 |
Pure.imp ("\<^raw:\mbox{}\inferrule{\mbox{>_\<^raw:}}>\<^raw:{\mbox{>_\<^raw:}}>") |
35251
e244adbbc28f
modernized notation -- to make it work for authentic syntax;
wenzelm
parents:
31462
diff
changeset
|
75 |
|
15469 | 76 |
syntax (Rule output) |
77 |
"_bigimpl" :: "asms \<Rightarrow> prop \<Rightarrow> prop" |
|
78 |
("\<^raw:\mbox{}\inferrule{>_\<^raw:}>\<^raw:{\mbox{>_\<^raw:}}>") |
|
79 |
||
80 |
"_asms" :: "prop \<Rightarrow> asms \<Rightarrow> asms" |
|
81 |
("\<^raw:\mbox{>_\<^raw:}\\>/ _") |
|
82 |
||
83 |
"_asm" :: "prop \<Rightarrow> asms" ("\<^raw:\mbox{>_\<^raw:}>") |
|
84 |
||
35251
e244adbbc28f
modernized notation -- to make it work for authentic syntax;
wenzelm
parents:
31462
diff
changeset
|
85 |
notation (Axiom output) |
e244adbbc28f
modernized notation -- to make it work for authentic syntax;
wenzelm
parents:
31462
diff
changeset
|
86 |
"Trueprop" ("\<^raw:\mbox{}\inferrule{\mbox{}}{\mbox{>_\<^raw:}}>") |
22328
cc403d881873
added print-mode Axiom to print theorems without premises with a rule on top.
schirmer
parents:
21210
diff
changeset
|
87 |
|
35251
e244adbbc28f
modernized notation -- to make it work for authentic syntax;
wenzelm
parents:
31462
diff
changeset
|
88 |
notation (IfThen output) |
56245 | 89 |
Pure.imp ("\<^raw:{\normalsize{}>If\<^raw:\,}> _/ \<^raw:{\normalsize \,>then\<^raw:\,}>/ _.") |
15469 | 90 |
syntax (IfThen output) |
91 |
"_bigimpl" :: "asms \<Rightarrow> prop \<Rightarrow> prop" |
|
25467 | 92 |
("\<^raw:{\normalsize{}>If\<^raw:\,}> _ /\<^raw:{\normalsize \,>then\<^raw:\,}>/ _.") |
93 |
"_asms" :: "prop \<Rightarrow> asms \<Rightarrow> asms" ("\<^raw:\mbox{>_\<^raw:}> /\<^raw:{\normalsize \,>and\<^raw:\,}>/ _") |
|
15469 | 94 |
"_asm" :: "prop \<Rightarrow> asms" ("\<^raw:\mbox{>_\<^raw:}>") |
95 |
||
35251
e244adbbc28f
modernized notation -- to make it work for authentic syntax;
wenzelm
parents:
31462
diff
changeset
|
96 |
notation (IfThenNoBox output) |
56245 | 97 |
Pure.imp ("\<^raw:{\normalsize{}>If\<^raw:\,}> _/ \<^raw:{\normalsize \,>then\<^raw:\,}>/ _.") |
15469 | 98 |
syntax (IfThenNoBox output) |
99 |
"_bigimpl" :: "asms \<Rightarrow> prop \<Rightarrow> prop" |
|
25467 | 100 |
("\<^raw:{\normalsize{}>If\<^raw:\,}> _ /\<^raw:{\normalsize \,>then\<^raw:\,}>/ _.") |
101 |
"_asms" :: "prop \<Rightarrow> asms \<Rightarrow> asms" ("_ /\<^raw:{\normalsize \,>and\<^raw:\,}>/ _") |
|
15469 | 102 |
"_asm" :: "prop \<Rightarrow> asms" ("_") |
103 |
||
49628 | 104 |
setup{* |
105 |
let |
|
106 |
fun pretty ctxt c = |
|
56002 | 107 |
let val tc = Proof_Context.read_const {proper = true, strict = false} ctxt c |
49628 | 108 |
in Pretty.block [Thy_Output.pretty_term ctxt tc, Pretty.str " ::", |
109 |
Pretty.brk 1, Syntax.pretty_typ ctxt (fastype_of tc)] |
|
110 |
end |
|
111 |
in |
|
112 |
Thy_Output.antiquotation @{binding "const_typ"} |
|
55111 | 113 |
(Scan.lift Args.name_inner_syntax) |
49628 | 114 |
(fn {source = src, context = ctxt, ...} => fn arg => |
115 |
Thy_Output.output ctxt |
|
116 |
(Thy_Output.maybe_pretty_source pretty ctxt src [arg])) |
|
117 |
end; |
|
118 |
*} |
|
119 |
||
15469 | 120 |
end |
55077 | 121 |
(*>*) |