author | haftmann |
Wed, 25 Nov 2009 11:16:57 +0100 | |
changeset 33959 | 2afc55e8ed27 |
parent 33384 | 1b5ba4e6a953 |
child 35115 | 446c5063e4fd |
permissions | -rw-r--r-- |
15469 | 1 |
(* Title: HOL/Library/OptionalSugar.thy |
2 |
Author: Gerwin Klain, Tobias Nipkow |
|
3 |
Copyright 2005 NICTA and TUM |
|
4 |
*) |
|
15476 | 5 |
(*<*) |
15469 | 6 |
theory OptionalSugar |
30663
0b6aff7451b2
Main is (Complex_Main) base entry point in library theories
haftmann
parents:
30503
diff
changeset
|
7 |
imports Complex_Main LaTeXsugar |
15469 | 8 |
begin |
9 |
||
30474 | 10 |
(* hiding set *) |
22835 | 11 |
translations |
30404
d03dd6301678
more robust treatment of (authentic) consts within translations;
wenzelm
parents:
29494
diff
changeset
|
12 |
"xs" <= "CONST set xs" |
22835 | 13 |
|
30474 | 14 |
(* hiding numeric conversions - embeddings only *) |
15 |
translations |
|
16 |
"n" <= "CONST of_nat n" |
|
17 |
"n" <= "CONST int n" |
|
18 |
"n" <= "real n" |
|
19 |
"n" <= "CONST real_of_nat n" |
|
20 |
"n" <= "CONST real_of_int n" |
|
30502 | 21 |
"n" <= "CONST of_real n" |
22 |
"n" <= "CONST complex_of_real n" |
|
30474 | 23 |
|
15469 | 24 |
(* append *) |
25 |
syntax (latex output) |
|
26 |
"appendL" :: "'a list \<Rightarrow> 'a list \<Rightarrow> 'a list" (infixl "\<^raw:\isacharat>" 65) |
|
27 |
translations |
|
28 |
"appendL xs ys" <= "xs @ ys" |
|
29 |
"appendL (appendL xs ys) zs" <= "appendL xs (appendL ys zs)" |
|
30 |
||
31 |
||
32891 | 32 |
(* deprecated, use thm with style instead, will be removed *) |
15469 | 33 |
(* aligning equations *) |
21210 | 34 |
notation (tab output) |
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21210
diff
changeset
|
35 |
"op =" ("(_) \<^raw:}\putisatab\isa{\ >=\<^raw:}\putisatab\isa{> (_)" [50,49] 50) and |
19674 | 36 |
"==" ("(_) \<^raw:}\putisatab\isa{\ >\<equiv>\<^raw:}\putisatab\isa{> (_)") |
15469 | 37 |
|
38 |
(* Let *) |
|
39 |
translations |
|
30404
d03dd6301678
more robust treatment of (authentic) consts within translations;
wenzelm
parents:
29494
diff
changeset
|
40 |
"_bind (p,DUMMY) e" <= "_bind p (CONST fst e)" |
d03dd6301678
more robust treatment of (authentic) consts within translations;
wenzelm
parents:
29494
diff
changeset
|
41 |
"_bind (DUMMY,p) e" <= "_bind p (CONST snd e)" |
15469 | 42 |
|
43 |
"_tuple_args x (_tuple_args y z)" == |
|
44 |
"_tuple_args x (_tuple_arg (_tuple y z))" |
|
45 |
||
30404
d03dd6301678
more robust treatment of (authentic) consts within translations;
wenzelm
parents:
29494
diff
changeset
|
46 |
"_bind (Some p) e" <= "_bind p (CONST the e)" |
d03dd6301678
more robust treatment of (authentic) consts within translations;
wenzelm
parents:
29494
diff
changeset
|
47 |
"_bind (p#DUMMY) e" <= "_bind p (CONST hd e)" |
d03dd6301678
more robust treatment of (authentic) consts within translations;
wenzelm
parents:
29494
diff
changeset
|
48 |
"_bind (DUMMY#p) e" <= "_bind p (CONST tl e)" |
15469 | 49 |
|
29494 | 50 |
(* type constraints with spacing *) |
51 |
setup {* |
|
52 |
let |
|
33384 | 53 |
val typ = Simple_Syntax.read_typ; |
29494 | 54 |
val typeT = Syntax.typeT; |
55 |
val spropT = Syntax.spropT; |
|
56 |
in |
|
57 |
Sign.del_modesyntax_i (Symbol.xsymbolsN, false) [ |
|
58 |
("_constrain", typ "logic => type => logic", Mixfix ("_\<Colon>_", [4, 0], 3)), |
|
59 |
("_constrain", [spropT, typeT] ---> spropT, Mixfix ("_\<Colon>_", [4, 0], 3))] |
|
60 |
#> Sign.add_modesyntax_i (Symbol.xsymbolsN, false) [ |
|
61 |
("_constrain", typ "logic => type => logic", Mixfix ("_ \<Colon> _", [4, 0], 3)), |
|
62 |
("_constrain", [spropT, typeT] ---> spropT, Mixfix ("_ \<Colon> _", [4, 0], 3))] |
|
63 |
end |
|
64 |
*} |
|
65 |
||
66 |
(* sorts as intersections *) |
|
67 |
setup {* |
|
68 |
let |
|
69 |
val sortT = Type ("sort", []); (*FIXME*) |
|
70 |
val classesT = Type ("classes", []); (*FIXME*) |
|
71 |
in |
|
72 |
Sign.add_modesyntax_i (Symbol.xsymbolsN, false) [ |
|
73 |
("_topsort", sortT, Mixfix ("\<top>", [], Syntax.max_pri)), |
|
74 |
("_sort", classesT --> sortT, Mixfix ("'(_')", [], Syntax.max_pri)), |
|
75 |
("_classes", Lexicon.idT --> classesT --> classesT, Mixfix ("_ \<inter> _", [], Syntax.max_pri)), |
|
76 |
("_classes", Lexicon.longidT --> classesT --> classesT, Mixfix ("_ \<inter> _", [], Syntax.max_pri)) |
|
77 |
] |
|
78 |
end |
|
79 |
*} |
|
15469 | 80 |
|
15476 | 81 |
end |
82 |
(*>*) |