src/Pure/pure_thy.ML
author paulson <lp15@cam.ac.uk>
Sun, 20 May 2018 18:37:34 +0100
changeset 68239 0764ee22a4d1
parent 67721 5348bea4accd
child 70388 e31271559de8
permissions -rw-r--r--
tidy up of Derivative
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3987
22f5291012df Init 'theorems' data. The Pure theories.
wenzelm
parents:
diff changeset
     1
(*  Title:      Pure/pure_thy.ML
22f5291012df Init 'theorems' data. The Pure theories.
wenzelm
parents:
diff changeset
     2
    Author:     Markus Wenzel, TU Muenchen
22f5291012df Init 'theorems' data. The Pure theories.
wenzelm
parents:
diff changeset
     3
39557
fe5722fce758 renamed structure PureThy to Pure_Thy and moved most content to Global_Theory, to emphasize that this is global-only;
wenzelm
parents: 39507
diff changeset
     4
Pure theory syntax and further logical content.
3987
22f5291012df Init 'theorems' data. The Pure theories.
wenzelm
parents:
diff changeset
     5
*)
22f5291012df Init 'theorems' data. The Pure theories.
wenzelm
parents:
diff changeset
     6
22f5291012df Init 'theorems' data. The Pure theories.
wenzelm
parents:
diff changeset
     7
signature PURE_THY =
22f5291012df Init 'theorems' data. The Pure theories.
wenzelm
parents:
diff changeset
     8
sig
26959
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
     9
  val old_appl_syntax: theory -> bool
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    10
  val old_appl_syntax_setup: theory -> theory
52160
7746c9f1baf3 tuned signature;
wenzelm
parents: 52143
diff changeset
    11
  val token_markers: string list
3987
22f5291012df Init 'theorems' data. The Pure theories.
wenzelm
parents:
diff changeset
    12
end;
22f5291012df Init 'theorems' data. The Pure theories.
wenzelm
parents:
diff changeset
    13
39557
fe5722fce758 renamed structure PureThy to Pure_Thy and moved most content to Global_Theory, to emphasize that this is global-only;
wenzelm
parents: 39507
diff changeset
    14
structure Pure_Thy: PURE_THY =
3987
22f5291012df Init 'theorems' data. The Pure theories.
wenzelm
parents:
diff changeset
    15
struct
22f5291012df Init 'theorems' data. The Pure theories.
wenzelm
parents:
diff changeset
    16
33384
1b5ba4e6a953 modernized structure Simple_Syntax;
wenzelm
parents: 33365
diff changeset
    17
val typ = Simple_Syntax.read_typ;
1b5ba4e6a953 modernized structure Simple_Syntax;
wenzelm
parents: 33365
diff changeset
    18
val prop = Simple_Syntax.read_prop;
35429
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
    19
42290
b1f544c84040 discontinued special treatment of structure Lexicon;
wenzelm
parents: 42288
diff changeset
    20
val tycon = Lexicon.mark_type;
b1f544c84040 discontinued special treatment of structure Lexicon;
wenzelm
parents: 42288
diff changeset
    21
val const = Lexicon.mark_const;
24243
08db58fd6374 moved appl syntax to PureThy;
wenzelm
parents: 24137
diff changeset
    22
56234
59662ce44f02 produce qualified names more directly;
wenzelm
parents: 55108
diff changeset
    23
val qualify = Binding.qualify true Context.PureN;
59662ce44f02 produce qualified names more directly;
wenzelm
parents: 55108
diff changeset
    24
62752
d09d71223e7a more position information for type mixfix;
wenzelm
parents: 62529
diff changeset
    25
fun mixfix (sy, ps, p) = Mixfix (Input.string sy, ps, p, Position.no_range);
d09d71223e7a more position information for type mixfix;
wenzelm
parents: 62529
diff changeset
    26
fun infix_ (sy, p) = Infix (Input.string sy, p, Position.no_range);
d09d71223e7a more position information for type mixfix;
wenzelm
parents: 62529
diff changeset
    27
fun infixr_ (sy, p) = Infixr (Input.string sy, p, Position.no_range);
d09d71223e7a more position information for type mixfix;
wenzelm
parents: 62529
diff changeset
    28
fun binder (sy, p, q) = Binder (Input.string sy, p, q, Position.no_range);
d09d71223e7a more position information for type mixfix;
wenzelm
parents: 62529
diff changeset
    29
26959
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    30
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    31
(* application syntax variants *)
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    32
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    33
val appl_syntax =
67721
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
    34
 [("_appl", typ "('b \<Rightarrow> 'a) \<Rightarrow> args \<Rightarrow> logic", mixfix ("(1_/(1'(_')))", [1000, 0], 1000)),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
    35
  ("_appl", typ "('b \<Rightarrow> 'a) \<Rightarrow> args \<Rightarrow> aprop", mixfix ("(1_/(1'(_')))", [1000, 0], 1000))];
26959
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    36
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    37
val applC_syntax =
67721
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
    38
 [("",       typ "'a \<Rightarrow> cargs",                  Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
    39
  ("_cargs", typ "'a \<Rightarrow> cargs \<Rightarrow> cargs",         mixfix ("_/ _", [1000, 1000], 1000)),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
    40
  ("_applC", typ "('b \<Rightarrow> 'a) \<Rightarrow> cargs \<Rightarrow> logic", mixfix ("(1_/ _)", [1000, 1000], 999)),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
    41
  ("_applC", typ "('b \<Rightarrow> 'a) \<Rightarrow> cargs \<Rightarrow> aprop", mixfix ("(1_/ _)", [1000, 1000], 999))];
26959
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    42
37216
3165bc303f66 modernized some structure names, keeping a few legacy aliases;
wenzelm
parents: 36744
diff changeset
    43
structure Old_Appl_Syntax = Theory_Data
26959
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    44
(
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    45
  type T = bool;
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    46
  val empty = false;
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    47
  val extend = I;
33522
737589bb9bb8 adapted Theory_Data;
wenzelm
parents: 33384
diff changeset
    48
  fun merge (b1, b2) : T =
26959
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    49
    if b1 = b2 then b1
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    50
    else error "Cannot merge theories with different application syntax";
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    51
);
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    52
37216
3165bc303f66 modernized some structure names, keeping a few legacy aliases;
wenzelm
parents: 36744
diff changeset
    53
val old_appl_syntax = Old_Appl_Syntax.get;
26959
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    54
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    55
val old_appl_syntax_setup =
37216
3165bc303f66 modernized some structure names, keeping a few legacy aliases;
wenzelm
parents: 36744
diff changeset
    56
  Old_Appl_Syntax.put true #>
56240
938c6c7e10eb tuned signature;
wenzelm
parents: 56239
diff changeset
    57
  Sign.del_syntax Syntax.mode_default applC_syntax #>
938c6c7e10eb tuned signature;
wenzelm
parents: 56239
diff changeset
    58
  Sign.add_syntax Syntax.mode_default appl_syntax;
26959
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    59
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    60
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    61
(* main content *)
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    62
52160
7746c9f1baf3 tuned signature;
wenzelm
parents: 52143
diff changeset
    63
val token_markers =
7746c9f1baf3 tuned signature;
wenzelm
parents: 52143
diff changeset
    64
  ["_tfree", "_tvar", "_free", "_bound", "_loose", "_var", "_numeral", "_inner_string"];
7746c9f1baf3 tuned signature;
wenzelm
parents: 52143
diff changeset
    65
53171
a5e54d4d9081 added Theory.setup convenience;
wenzelm
parents: 52211
diff changeset
    66
val _ = Theory.setup
33365
4db1b31b246e set Pure theory name properly
haftmann
parents: 33167
diff changeset
    67
  (Sign.map_naming (Name_Space.set_theory_name Context.PureN) #>
37216
3165bc303f66 modernized some structure names, keeping a few legacy aliases;
wenzelm
parents: 36744
diff changeset
    68
   Old_Appl_Syntax.put false #>
42375
774df7c59508 report Name_Space.declare/define, relatively to context;
wenzelm
parents: 42297
diff changeset
    69
   Sign.add_types_global
64556
851ae0e7b09c more symbols;
wenzelm
parents: 63609
diff changeset
    70
   [(Binding.make ("fun", \<^here>), 2, NoSyn),
851ae0e7b09c more symbols;
wenzelm
parents: 63609
diff changeset
    71
    (Binding.make ("prop", \<^here>), 0, NoSyn),
851ae0e7b09c more symbols;
wenzelm
parents: 63609
diff changeset
    72
    (Binding.make ("itself", \<^here>), 1, NoSyn),
851ae0e7b09c more symbols;
wenzelm
parents: 63609
diff changeset
    73
    (Binding.make ("dummy", \<^here>), 0, NoSyn)]
61255
15865e0c5598 eliminated separate type Theory.dep: use typeargs uniformly for consts/types;
wenzelm
parents: 61246
diff changeset
    74
  #> Theory.add_deps_global "fun" ((Defs.Type, "fun"), [typ "'a", typ "'b"]) []
15865e0c5598 eliminated separate type Theory.dep: use typeargs uniformly for consts/types;
wenzelm
parents: 61246
diff changeset
    75
  #> Theory.add_deps_global "prop" ((Defs.Type, "prop"), []) []
15865e0c5598 eliminated separate type Theory.dep: use typeargs uniformly for consts/types;
wenzelm
parents: 61246
diff changeset
    76
  #> Theory.add_deps_global "itself" ((Defs.Type, "itself"), [typ "'a"]) []
15865e0c5598 eliminated separate type Theory.dep: use typeargs uniformly for consts/types;
wenzelm
parents: 61246
diff changeset
    77
  #> Theory.add_deps_global "dummy" ((Defs.Type, "dummy"), []) []
52160
7746c9f1baf3 tuned signature;
wenzelm
parents: 52143
diff changeset
    78
  #> Sign.add_nonterminals_global
64556
851ae0e7b09c more symbols;
wenzelm
parents: 63609
diff changeset
    79
    (map (fn name => Binding.make (name, \<^here>))
52160
7746c9f1baf3 tuned signature;
wenzelm
parents: 52143
diff changeset
    80
      (Lexicon.terminals @ ["logic", "type", "types", "sort", "classes",
7746c9f1baf3 tuned signature;
wenzelm
parents: 52143
diff changeset
    81
        "args", "cargs", "pttrn", "pttrns", "idt", "idts", "aprop", "asms",
58421
37cbbd8eb460 discontinued old "xnum" token category;
wenzelm
parents: 56436
diff changeset
    82
        "any", "prop'", "num_const", "float_const", "num_position",
37cbbd8eb460 discontinued old "xnum" token category;
wenzelm
parents: 56436
diff changeset
    83
        "float_position", "index", "struct", "tid_position",
55108
0b7a0c1fdf7e inner syntax token language allows regular quoted strings;
wenzelm
parents: 55033
diff changeset
    84
        "tvar_position", "id_position", "longid_position", "var_position",
0b7a0c1fdf7e inner syntax token language allows regular quoted strings;
wenzelm
parents: 55033
diff changeset
    85
        "str_position", "string_position", "cartouche_position", "type_name",
0b7a0c1fdf7e inner syntax token language allows regular quoted strings;
wenzelm
parents: 55033
diff changeset
    86
        "class_name"]))
56240
938c6c7e10eb tuned signature;
wenzelm
parents: 56239
diff changeset
    87
  #> Sign.add_syntax Syntax.mode_default (map (fn x => (x, typ "'a", NoSyn)) token_markers)
938c6c7e10eb tuned signature;
wenzelm
parents: 56239
diff changeset
    88
  #> Sign.add_syntax Syntax.mode_default
67721
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
    89
   [("",            typ "prop' \<Rightarrow> prop",               Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
    90
    ("",            typ "logic \<Rightarrow> any",                Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
    91
    ("",            typ "prop' \<Rightarrow> any",                Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
    92
    ("",            typ "logic \<Rightarrow> logic",              Mixfix.mixfix "'(_')"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
    93
    ("",            typ "prop' \<Rightarrow> prop'",              Mixfix.mixfix "'(_')"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
    94
    ("_constrain",  typ "logic \<Rightarrow> type \<Rightarrow> logic",      mixfix ("_::_", [4, 0], 3)),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
    95
    ("_constrain",  typ "prop' \<Rightarrow> type \<Rightarrow> prop'",      mixfix ("_::_", [4, 0], 3)),
52211
66bc827e37f8 explicit support for type annotations within printed syntax trees;
wenzelm
parents: 52161
diff changeset
    96
    ("_ignore_type", typ "'a",                         NoSyn),
67721
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
    97
    ("",            typ "tid_position \<Rightarrow> type",        Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
    98
    ("",            typ "tvar_position \<Rightarrow> type",       Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
    99
    ("",            typ "type_name \<Rightarrow> type",           Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   100
    ("_type_name",  typ "id \<Rightarrow> type_name",             Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   101
    ("_type_name",  typ "longid \<Rightarrow> type_name",         Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   102
    ("_ofsort",     typ "tid_position \<Rightarrow> sort \<Rightarrow> type", mixfix ("_::_", [1000, 0], 1000)),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   103
    ("_ofsort",     typ "tvar_position \<Rightarrow> sort \<Rightarrow> type", mixfix ("_::_", [1000, 0], 1000)),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   104
    ("_dummy_ofsort", typ "sort \<Rightarrow> type",              mixfix ("'_()::_", [0], 1000)),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   105
    ("",            typ "class_name \<Rightarrow> sort",          Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   106
    ("_class_name", typ "id \<Rightarrow> class_name",            Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   107
    ("_class_name", typ "longid \<Rightarrow> class_name",        Mixfix.mixfix "_"),
67718
17874d43d3b3 notation for dummy sort;
wenzelm
parents: 64556
diff changeset
   108
    ("_dummy_sort", typ "sort",                        Mixfix.mixfix "'_"),
62761
5c672b22dcc2 clarified simple mixfix;
wenzelm
parents: 62752
diff changeset
   109
    ("_topsort",    typ "sort",                        Mixfix.mixfix "{}"),
67721
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   110
    ("_sort",       typ "classes \<Rightarrow> sort",             Mixfix.mixfix "{_}"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   111
    ("",            typ "class_name \<Rightarrow> classes",       Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   112
    ("_classes",    typ "class_name \<Rightarrow> classes \<Rightarrow> classes", Mixfix.mixfix "_,_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   113
    ("_tapp",       typ "type \<Rightarrow> type_name \<Rightarrow> type",   mixfix ("_ _", [1000, 0], 1000)),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   114
    ("_tappl",      typ "type \<Rightarrow> types \<Rightarrow> type_name \<Rightarrow> type", Mixfix.mixfix "((1'(_,/ _')) _)"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   115
    ("",            typ "type \<Rightarrow> types",               Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   116
    ("_types",      typ "type \<Rightarrow> types \<Rightarrow> types",      Mixfix.mixfix "_,/ _"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   117
    ("\<^type>fun", typ "type \<Rightarrow> type \<Rightarrow> type",        mixfix ("(_/ \<Rightarrow> _)", [1, 0], 0)),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   118
    ("_bracket",    typ "types \<Rightarrow> type \<Rightarrow> type",       mixfix ("([_]/ \<Rightarrow> _)", [0, 0], 0)),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   119
    ("",            typ "type \<Rightarrow> type",                Mixfix.mixfix "'(_')"),
62761
5c672b22dcc2 clarified simple mixfix;
wenzelm
parents: 62752
diff changeset
   120
    ("\<^type>dummy", typ "type",                      Mixfix.mixfix "'_"),
42263
49b1b8d0782f type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents: 42245
diff changeset
   121
    ("_type_prop",  typ "'a",                          NoSyn),
67721
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   122
    ("_lambda",     typ "pttrns \<Rightarrow> 'a \<Rightarrow> logic",       mixfix ("(3\<lambda>_./ _)", [0, 3], 3)),
26436
dfd6947ab5c2 removed obsolete appl_syntax, applC_syntax;
wenzelm
parents: 26430
diff changeset
   123
    ("_abs",        typ "'a",                          NoSyn),
67721
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   124
    ("",            typ "'a \<Rightarrow> args",                  Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   125
    ("_args",       typ "'a \<Rightarrow> args \<Rightarrow> args",          Mixfix.mixfix "_,/ _"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   126
    ("",            typ "id_position \<Rightarrow> idt",          Mixfix.mixfix "_"),
62761
5c672b22dcc2 clarified simple mixfix;
wenzelm
parents: 62752
diff changeset
   127
    ("_idtdummy",   typ "idt",                         Mixfix.mixfix "'_"),
67721
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   128
    ("_idtyp",      typ "id_position \<Rightarrow> type \<Rightarrow> idt",  mixfix ("_::_", [], 0)),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   129
    ("_idtypdummy", typ "type \<Rightarrow> idt",                 mixfix ("'_()::_", [], 0)),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   130
    ("",            typ "idt \<Rightarrow> idt",                  Mixfix.mixfix "'(_')"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   131
    ("",            typ "idt \<Rightarrow> idts",                 Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   132
    ("_idts",       typ "idt \<Rightarrow> idts \<Rightarrow> idts",         mixfix ("_/ _", [1, 0], 0)),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   133
    ("",            typ "idt \<Rightarrow> pttrn",                Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   134
    ("",            typ "pttrn \<Rightarrow> pttrns",             Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   135
    ("_pttrns",     typ "pttrn \<Rightarrow> pttrns \<Rightarrow> pttrns",   mixfix ("_/ _", [1, 0], 0)),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   136
    ("",            typ "aprop \<Rightarrow> aprop",              Mixfix.mixfix "'(_')"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   137
    ("",            typ "id_position \<Rightarrow> aprop",        Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   138
    ("",            typ "longid_position \<Rightarrow> aprop",    Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   139
    ("",            typ "var_position \<Rightarrow> aprop",       Mixfix.mixfix "_"),
62761
5c672b22dcc2 clarified simple mixfix;
wenzelm
parents: 62752
diff changeset
   140
    ("_DDDOT",      typ "aprop",                       Mixfix.mixfix "\<dots>"),
67721
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   141
    ("_aprop",      typ "aprop \<Rightarrow> prop",               Mixfix.mixfix "PROP _"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   142
    ("_asm",        typ "prop \<Rightarrow> asms",                Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   143
    ("_asms",       typ "prop \<Rightarrow> asms \<Rightarrow> asms",        Mixfix.mixfix "_;/ _"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   144
    ("_bigimpl",    typ "asms \<Rightarrow> prop \<Rightarrow> prop",        mixfix ("((1\<lbrakk>_\<rbrakk>)/ \<Longrightarrow> _)", [0, 1], 1)),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   145
    ("_ofclass",    typ "type \<Rightarrow> logic \<Rightarrow> prop",       Mixfix.mixfix "(1OFCLASS/(1'(_,/ _')))"),
26436
dfd6947ab5c2 removed obsolete appl_syntax, applC_syntax;
wenzelm
parents: 26430
diff changeset
   146
    ("_mk_ofclass", typ "dummy",                       NoSyn),
67721
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   147
    ("_TYPE",       typ "type \<Rightarrow> logic",               Mixfix.mixfix "(1TYPE/(1'(_')))"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   148
    ("",            typ "id_position \<Rightarrow> logic",        Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   149
    ("",            typ "longid_position \<Rightarrow> logic",    Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   150
    ("",            typ "var_position \<Rightarrow> logic",       Mixfix.mixfix "_"),
62761
5c672b22dcc2 clarified simple mixfix;
wenzelm
parents: 62752
diff changeset
   151
    ("_DDDOT",      typ "logic",                       Mixfix.mixfix "\<dots>"),
42057
3eba96ff3d3e more selective strip_positions in case patterns -- reactivate translations based on "case _ of _" in HOL and special patterns in HOLCF;
wenzelm
parents: 42048
diff changeset
   152
    ("_strip_positions", typ "'a", NoSyn),
67721
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   153
    ("_position",   typ "num_token \<Rightarrow> num_position",   Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   154
    ("_position",   typ "float_token \<Rightarrow> float_position", Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   155
    ("_constify",   typ "num_position \<Rightarrow> num_const",   Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   156
    ("_constify",   typ "float_position \<Rightarrow> float_const", Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   157
    ("_index",      typ "logic \<Rightarrow> index",              Mixfix.mixfix "(\<open>unbreakable\<close>\<^bsub>_\<^esub>)"),
62761
5c672b22dcc2 clarified simple mixfix;
wenzelm
parents: 62752
diff changeset
   158
    ("_indexdefault", typ "index",                     Mixfix.mixfix ""),
5c672b22dcc2 clarified simple mixfix;
wenzelm
parents: 62752
diff changeset
   159
    ("_indexvar",   typ "index",                       Mixfix.mixfix "'\<index>"),
67721
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   160
    ("_struct",     typ "index \<Rightarrow> logic",              NoSyn),
35145
f132a4fd8679 moved generic update_name to Pure syntax -- not specific to HOL/record;
wenzelm
parents: 35130
diff changeset
   161
    ("_update_name", typ "idt",                        NoSyn),
42295
8fdbb3b10beb moved CONST syntax/translations to their proper place;
wenzelm
parents: 42294
diff changeset
   162
    ("_constrainAbs", typ "'a",                        NoSyn),
67721
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   163
    ("_position_sort", typ "tid \<Rightarrow> tid_position",      Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   164
    ("_position_sort", typ "tvar \<Rightarrow> tvar_position",    Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   165
    ("_position",   typ "id \<Rightarrow> id_position",           Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   166
    ("_position",   typ "longid \<Rightarrow> longid_position",   Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   167
    ("_position",   typ "var \<Rightarrow> var_position",         Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   168
    ("_position",   typ "str_token \<Rightarrow> str_position",   Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   169
    ("_position",   typ "string_token \<Rightarrow> string_position", Mixfix.mixfix "_"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   170
    ("_position",   typ "cartouche \<Rightarrow> cartouche_position", Mixfix.mixfix "_"),
42048
afd11ca8e018 support for encoded positions (for id_position, longid_position) as pseudo type-constraints -- still inactive;
wenzelm
parents: 39557
diff changeset
   171
    ("_type_constraint_", typ "'a",                    NoSyn),
67721
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   172
    ("_context_const", typ "id_position \<Rightarrow> logic",     Mixfix.mixfix "CONST _"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   173
    ("_context_const", typ "id_position \<Rightarrow> aprop",     Mixfix.mixfix "CONST _"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   174
    ("_context_const", typ "longid_position \<Rightarrow> logic", Mixfix.mixfix "CONST _"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   175
    ("_context_const", typ "longid_position \<Rightarrow> aprop", Mixfix.mixfix "CONST _"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   176
    ("_context_xconst", typ "id_position \<Rightarrow> logic",    Mixfix.mixfix "XCONST _"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   177
    ("_context_xconst", typ "id_position \<Rightarrow> aprop",    Mixfix.mixfix "XCONST _"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   178
    ("_context_xconst", typ "longid_position \<Rightarrow> logic", Mixfix.mixfix "XCONST _"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   179
    ("_context_xconst", typ "longid_position \<Rightarrow> aprop", Mixfix.mixfix "XCONST _"),
62761
5c672b22dcc2 clarified simple mixfix;
wenzelm
parents: 62752
diff changeset
   180
    (const "Pure.dummy_pattern", typ "aprop",          Mixfix.mixfix "'_"),
67721
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   181
    ("_sort_constraint", typ "type \<Rightarrow> prop",           Mixfix.mixfix "(1SORT'_CONSTRAINT/(1'(_')))"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   182
    (const "Pure.term", typ "logic \<Rightarrow> prop",           Mixfix.mixfix "TERM _"),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   183
    (const "Pure.conjunction", typ "prop \<Rightarrow> prop \<Rightarrow> prop", infixr_ ("&&&", 2))]
56240
938c6c7e10eb tuned signature;
wenzelm
parents: 56239
diff changeset
   184
  #> Sign.add_syntax Syntax.mode_default applC_syntax
61957
301833d9013a former "xsymbols" syntax is used by default, and ASCII replacement syntax with print mode "ASCII";
wenzelm
parents: 61256
diff changeset
   185
  #> Sign.add_syntax (Print_Mode.ASCII, true)
67721
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   186
   [(tycon "fun",         typ "type \<Rightarrow> type \<Rightarrow> type",   mixfix ("(_/ => _)", [1, 0], 0)),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   187
    ("_bracket",          typ "types \<Rightarrow> type \<Rightarrow> type",  mixfix ("([_]/ => _)", [0, 0], 0)),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   188
    ("_lambda",           typ "pttrns \<Rightarrow> 'a \<Rightarrow> logic",  mixfix ("(3%_./ _)", [0, 3], 3)),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   189
    (const "Pure.eq",     typ "'a \<Rightarrow> 'a \<Rightarrow> prop",       infix_ ("==", 2)),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   190
    (const "Pure.all_binder", typ "idts \<Rightarrow> prop \<Rightarrow> prop", mixfix ("(3!!_./ _)", [0, 0], 0)),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   191
    (const "Pure.imp",    typ "prop \<Rightarrow> prop \<Rightarrow> prop",   infixr_ ("==>", 1)),
62761
5c672b22dcc2 clarified simple mixfix;
wenzelm
parents: 62752
diff changeset
   192
    ("_DDDOT",            typ "aprop",                  Mixfix.mixfix "..."),
67721
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   193
    ("_bigimpl",          typ "asms \<Rightarrow> prop \<Rightarrow> prop",   mixfix ("((3[| _ |])/ ==> _)", [0, 1], 1)),
62761
5c672b22dcc2 clarified simple mixfix;
wenzelm
parents: 62752
diff changeset
   194
    ("_DDDOT",            typ "logic",                  Mixfix.mixfix "...")]
56240
938c6c7e10eb tuned signature;
wenzelm
parents: 56239
diff changeset
   195
  #> Sign.add_syntax ("", false)
67721
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   196
   [(const "Pure.prop", typ "prop \<Rightarrow> prop", mixfix ("_", [0], 0))]
56239
17df7145a871 tuned signature;
wenzelm
parents: 56234
diff changeset
   197
  #> Sign.add_consts
67721
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   198
   [(qualify (Binding.make ("eq", \<^here>)), typ "'a \<Rightarrow> 'a \<Rightarrow> prop", infix_ ("\<equiv>", 2)),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   199
    (qualify (Binding.make ("imp", \<^here>)), typ "prop \<Rightarrow> prop \<Rightarrow> prop", infixr_ ("\<Longrightarrow>", 1)),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   200
    (qualify (Binding.make ("all", \<^here>)), typ "('a \<Rightarrow> prop) \<Rightarrow> prop", binder ("\<And>", 0, 0)),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   201
    (qualify (Binding.make ("prop", \<^here>)), typ "prop \<Rightarrow> prop", NoSyn),
64556
851ae0e7b09c more symbols;
wenzelm
parents: 63609
diff changeset
   202
    (qualify (Binding.make ("type", \<^here>)), typ "'a itself", NoSyn),
851ae0e7b09c more symbols;
wenzelm
parents: 63609
diff changeset
   203
    (qualify (Binding.make ("dummy_pattern", \<^here>)), typ "'a", Mixfix.mixfix "'_")]
61256
9ce5de06cd3b tuned signature;
wenzelm
parents: 61255
diff changeset
   204
  #> Theory.add_deps_global "Pure.eq" ((Defs.Const, "Pure.eq"), [typ "'a"]) []
9ce5de06cd3b tuned signature;
wenzelm
parents: 61255
diff changeset
   205
  #> Theory.add_deps_global "Pure.imp" ((Defs.Const, "Pure.imp"), []) []
9ce5de06cd3b tuned signature;
wenzelm
parents: 61255
diff changeset
   206
  #> Theory.add_deps_global "Pure.all" ((Defs.Const, "Pure.all"), [typ "'a"]) []
9ce5de06cd3b tuned signature;
wenzelm
parents: 61255
diff changeset
   207
  #> Theory.add_deps_global "Pure.type" ((Defs.Const, "Pure.type"), [typ "'a"]) []
9ce5de06cd3b tuned signature;
wenzelm
parents: 61255
diff changeset
   208
  #> Theory.add_deps_global "Pure.dummy_pattern" ((Defs.Const, "Pure.dummy_pattern"), [typ "'a"]) []
52143
36ffe23b25f8 syntax translations always depend on context;
wenzelm
parents: 51612
diff changeset
   209
  #> Sign.parse_ast_translation Syntax_Trans.pure_parse_ast_translation
36ffe23b25f8 syntax translations always depend on context;
wenzelm
parents: 51612
diff changeset
   210
  #> Sign.parse_translation Syntax_Trans.pure_parse_translation
36ffe23b25f8 syntax translations always depend on context;
wenzelm
parents: 51612
diff changeset
   211
  #> Sign.print_ast_translation Syntax_Trans.pure_print_ast_translation
56239
17df7145a871 tuned signature;
wenzelm
parents: 56234
diff changeset
   212
  #> Sign.add_consts
67721
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   213
   [(qualify (Binding.make ("term", \<^here>)), typ "'a \<Rightarrow> prop", NoSyn),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   214
    (qualify (Binding.make ("sort_constraint", \<^here>)), typ "'a itself \<Rightarrow> prop", NoSyn),
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   215
    (qualify (Binding.make ("conjunction", \<^here>)), typ "prop \<Rightarrow> prop \<Rightarrow> prop", NoSyn)]
26430
8ddb2e7c5a1e eliminated theory ProtoPure;
wenzelm
parents: 26395
diff changeset
   216
  #> Sign.local_path
39557
fe5722fce758 renamed structure PureThy to Pure_Thy and moved most content to Global_Theory, to emphasize that this is global-only;
wenzelm
parents: 39507
diff changeset
   217
  #> (Global_Theory.add_defs false o map Thm.no_attributes)
64556
851ae0e7b09c more symbols;
wenzelm
parents: 63609
diff changeset
   218
   [(Binding.make ("prop_def", \<^here>),
67721
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   219
      prop "(CONST Pure.prop :: prop \<Rightarrow> prop) (A::prop) \<equiv> A::prop"),
64556
851ae0e7b09c more symbols;
wenzelm
parents: 63609
diff changeset
   220
    (Binding.make ("term_def", \<^here>),
67721
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   221
      prop "(CONST Pure.term :: 'a \<Rightarrow> prop) (x::'a) \<equiv> (\<And>A::prop. A \<Longrightarrow> A)"),
64556
851ae0e7b09c more symbols;
wenzelm
parents: 63609
diff changeset
   222
    (Binding.make ("sort_constraint_def", \<^here>),
67721
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   223
      prop "(CONST Pure.sort_constraint :: 'a itself \<Rightarrow> prop) (CONST Pure.type :: 'a itself) \<equiv>\
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   224
      \ (CONST Pure.term :: 'a itself \<Rightarrow> prop) (CONST Pure.type :: 'a itself)"),
64556
851ae0e7b09c more symbols;
wenzelm
parents: 63609
diff changeset
   225
    (Binding.make ("conjunction_def", \<^here>),
67721
5348bea4accd eliminated ASCII syntax from Pure bootstrap;
wenzelm
parents: 67718
diff changeset
   226
      prop "(A &&& B) \<equiv> (\<And>C::prop. (A \<Longrightarrow> B \<Longrightarrow> C) \<Longrightarrow> C)")] #> snd
42375
774df7c59508 report Name_Space.declare/define, relatively to context;
wenzelm
parents: 42297
diff changeset
   227
  #> fold (fn (a, prop) =>
64556
851ae0e7b09c more symbols;
wenzelm
parents: 63609
diff changeset
   228
      snd o Thm.add_axiom_global (Binding.make (a, \<^here>), prop)) Proofterm.equality_axms);
3987
22f5291012df Init 'theorems' data. The Pure theories.
wenzelm
parents:
diff changeset
   229
22f5291012df Init 'theorems' data. The Pure theories.
wenzelm
parents:
diff changeset
   230
end;