src/Pure/pure_thy.ML
author wenzelm
Thu, 06 Mar 2014 19:55:08 +0100
changeset 55960 beef468837b1
parent 55108 0b7a0c1fdf7e
child 56234 59662ce44f02
permissions -rw-r--r--
proper position for decode_pos, which is relevant for completion;
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
26959
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    23
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    24
(* application syntax variants *)
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    25
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    26
val appl_syntax =
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    27
 [("_appl", typ "('b => 'a) => args => logic", Mixfix ("(1_/(1'(_')))", [1000, 0], 1000)),
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    28
  ("_appl", typ "('b => 'a) => args => aprop", Mixfix ("(1_/(1'(_')))", [1000, 0], 1000))];
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    29
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    30
val applC_syntax =
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    31
 [("",       typ "'a => cargs",                  Delimfix "_"),
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    32
  ("_cargs", typ "'a => cargs => cargs",         Mixfix ("_/ _", [1000, 1000], 1000)),
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    33
  ("_applC", typ "('b => 'a) => cargs => logic", Mixfix ("(1_/ _)", [1000, 1000], 999)),
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    34
  ("_applC", typ "('b => 'a) => cargs => aprop", Mixfix ("(1_/ _)", [1000, 1000], 999))];
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    35
37216
3165bc303f66 modernized some structure names, keeping a few legacy aliases;
wenzelm
parents: 36744
diff changeset
    36
structure Old_Appl_Syntax = Theory_Data
26959
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    37
(
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    38
  type T = bool;
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    39
  val empty = false;
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    40
  val extend = I;
33522
737589bb9bb8 adapted Theory_Data;
wenzelm
parents: 33384
diff changeset
    41
  fun merge (b1, b2) : T =
26959
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    42
    if b1 = b2 then b1
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    43
    else error "Cannot merge theories with different application syntax";
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
37216
3165bc303f66 modernized some structure names, keeping a few legacy aliases;
wenzelm
parents: 36744
diff changeset
    46
val old_appl_syntax = Old_Appl_Syntax.get;
26959
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    47
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    48
val old_appl_syntax_setup =
37216
3165bc303f66 modernized some structure names, keeping a few legacy aliases;
wenzelm
parents: 36744
diff changeset
    49
  Old_Appl_Syntax.put true #>
26959
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    50
  Sign.del_modesyntax_i Syntax.mode_default applC_syntax #>
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    51
  Sign.add_syntax_i appl_syntax;
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    52
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    53
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    54
(* main content *)
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
    55
52160
7746c9f1baf3 tuned signature;
wenzelm
parents: 52143
diff changeset
    56
val token_markers =
7746c9f1baf3 tuned signature;
wenzelm
parents: 52143
diff changeset
    57
  ["_tfree", "_tvar", "_free", "_bound", "_loose", "_var", "_numeral", "_inner_string"];
7746c9f1baf3 tuned signature;
wenzelm
parents: 52143
diff changeset
    58
53171
a5e54d4d9081 added Theory.setup convenience;
wenzelm
parents: 52211
diff changeset
    59
val _ = Theory.setup
33365
4db1b31b246e set Pure theory name properly
haftmann
parents: 33167
diff changeset
    60
  (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
    61
   Old_Appl_Syntax.put false #>
42375
774df7c59508 report Name_Space.declare/define, relatively to context;
wenzelm
parents: 42297
diff changeset
    62
   Sign.add_types_global
30344
10a67c5ddddb more uniform handling of binding in targets and derived elements;
wenzelm
parents: 30337
diff changeset
    63
   [(Binding.name "fun", 2, NoSyn),
10a67c5ddddb more uniform handling of binding in targets and derived elements;
wenzelm
parents: 30337
diff changeset
    64
    (Binding.name "prop", 0, NoSyn),
10a67c5ddddb more uniform handling of binding in targets and derived elements;
wenzelm
parents: 30337
diff changeset
    65
    (Binding.name "itself", 1, NoSyn),
10a67c5ddddb more uniform handling of binding in targets and derived elements;
wenzelm
parents: 30337
diff changeset
    66
    (Binding.name "dummy", 0, NoSyn)]
52160
7746c9f1baf3 tuned signature;
wenzelm
parents: 52143
diff changeset
    67
  #> Sign.add_nonterminals_global
7746c9f1baf3 tuned signature;
wenzelm
parents: 52143
diff changeset
    68
    (map Binding.name
7746c9f1baf3 tuned signature;
wenzelm
parents: 52143
diff changeset
    69
      (Lexicon.terminals @ ["logic", "type", "types", "sort", "classes",
7746c9f1baf3 tuned signature;
wenzelm
parents: 52143
diff changeset
    70
        "args", "cargs", "pttrn", "pttrns", "idt", "idts", "aprop", "asms",
7746c9f1baf3 tuned signature;
wenzelm
parents: 52143
diff changeset
    71
        "any", "prop'", "num_const", "float_const", "xnum_const", "num_position",
7746c9f1baf3 tuned signature;
wenzelm
parents: 52143
diff changeset
    72
        "float_position", "xnum_position", "index", "struct", "tid_position",
55108
0b7a0c1fdf7e inner syntax token language allows regular quoted strings;
wenzelm
parents: 55033
diff changeset
    73
        "tvar_position", "id_position", "longid_position", "var_position",
0b7a0c1fdf7e inner syntax token language allows regular quoted strings;
wenzelm
parents: 55033
diff changeset
    74
        "str_position", "string_position", "cartouche_position", "type_name",
0b7a0c1fdf7e inner syntax token language allows regular quoted strings;
wenzelm
parents: 55033
diff changeset
    75
        "class_name"]))
52160
7746c9f1baf3 tuned signature;
wenzelm
parents: 52143
diff changeset
    76
  #> Sign.add_syntax_i (map (fn x => (x, typ "'a", NoSyn)) token_markers)
26430
8ddb2e7c5a1e eliminated theory ProtoPure;
wenzelm
parents: 26395
diff changeset
    77
  #> Sign.add_syntax_i
42294
0f4372a2d2e4 simplified Pure syntax bootstrap;
wenzelm
parents: 42293
diff changeset
    78
   [("",            typ "prop' => prop",               Delimfix "_"),
0f4372a2d2e4 simplified Pure syntax bootstrap;
wenzelm
parents: 42293
diff changeset
    79
    ("",            typ "logic => any",                Delimfix "_"),
0f4372a2d2e4 simplified Pure syntax bootstrap;
wenzelm
parents: 42293
diff changeset
    80
    ("",            typ "prop' => any",                Delimfix "_"),
0f4372a2d2e4 simplified Pure syntax bootstrap;
wenzelm
parents: 42293
diff changeset
    81
    ("",            typ "logic => logic",              Delimfix "'(_')"),
0f4372a2d2e4 simplified Pure syntax bootstrap;
wenzelm
parents: 42293
diff changeset
    82
    ("",            typ "prop' => prop'",              Delimfix "'(_')"),
0f4372a2d2e4 simplified Pure syntax bootstrap;
wenzelm
parents: 42293
diff changeset
    83
    ("_constrain",  typ "logic => type => logic",      Mixfix ("_::_", [4, 0], 3)),
0f4372a2d2e4 simplified Pure syntax bootstrap;
wenzelm
parents: 42293
diff changeset
    84
    ("_constrain",  typ "prop' => type => prop'",      Mixfix ("_::_", [4, 0], 3)),
52211
66bc827e37f8 explicit support for type annotations within printed syntax trees;
wenzelm
parents: 52161
diff changeset
    85
    ("_ignore_type", typ "'a",                         NoSyn),
49674
dbadb4d03cbc report sort assignment of visible type variables;
wenzelm
parents: 46483
diff changeset
    86
    ("",            typ "tid_position => type",        Delimfix "_"),
dbadb4d03cbc report sort assignment of visible type variables;
wenzelm
parents: 46483
diff changeset
    87
    ("",            typ "tvar_position => type",       Delimfix "_"),
42263
49b1b8d0782f type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents: 42245
diff changeset
    88
    ("",            typ "type_name => type",           Delimfix "_"),
49b1b8d0782f type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents: 42245
diff changeset
    89
    ("_type_name",  typ "id => type_name",             Delimfix "_"),
49b1b8d0782f type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents: 42245
diff changeset
    90
    ("_type_name",  typ "longid => type_name",         Delimfix "_"),
49685
4341e4d86872 allow position constraints to coexist with 0 or 1 sort constraints;
wenzelm
parents: 49674
diff changeset
    91
    ("_ofsort",     typ "tid_position => sort => type", Mixfix ("_::_", [1000, 0], 1000)),
4341e4d86872 allow position constraints to coexist with 0 or 1 sort constraints;
wenzelm
parents: 49674
diff changeset
    92
    ("_ofsort",     typ "tvar_position => sort => type", Mixfix ("_::_", [1000, 0], 1000)),
42297
140f283266b7 discontinued Syntax.max_pri, which is not really a symbolic parameter;
wenzelm
parents: 42296
diff changeset
    93
    ("_dummy_ofsort", typ "sort => type",              Mixfix ("'_()::_", [0], 1000)),
42263
49b1b8d0782f type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents: 42245
diff changeset
    94
    ("",            typ "class_name => sort",          Delimfix "_"),
49b1b8d0782f type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents: 42245
diff changeset
    95
    ("_class_name", typ "id => class_name",            Delimfix "_"),
49b1b8d0782f type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents: 42245
diff changeset
    96
    ("_class_name", typ "longid => class_name",        Delimfix "_"),
49b1b8d0782f type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents: 42245
diff changeset
    97
    ("_topsort",    typ "sort",                        Delimfix "{}"),
49b1b8d0782f type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents: 42245
diff changeset
    98
    ("_sort",       typ "classes => sort",             Delimfix "{_}"),
49b1b8d0782f type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents: 42245
diff changeset
    99
    ("",            typ "class_name => classes",       Delimfix "_"),
49b1b8d0782f type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents: 42245
diff changeset
   100
    ("_classes",    typ "class_name => classes => classes", Delimfix "_,_"),
42297
140f283266b7 discontinued Syntax.max_pri, which is not really a symbolic parameter;
wenzelm
parents: 42296
diff changeset
   101
    ("_tapp",       typ "type => type_name => type",   Mixfix ("_ _", [1000, 0], 1000)),
42263
49b1b8d0782f type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents: 42245
diff changeset
   102
    ("_tappl",      typ "type => types => type_name => type", Delimfix "((1'(_,/ _')) _)"),
49b1b8d0782f type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents: 42245
diff changeset
   103
    ("",            typ "type => types",               Delimfix "_"),
49b1b8d0782f type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents: 42245
diff changeset
   104
    ("_types",      typ "type => types => types",      Delimfix "_,/ _"),
49b1b8d0782f type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents: 42245
diff changeset
   105
    ("\\<^type>fun", typ "type => type => type",       Mixfix ("(_/ => _)", [1, 0], 0)),
49b1b8d0782f type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents: 42245
diff changeset
   106
    ("_bracket",    typ "types => type => type",       Mixfix ("([_]/ => _)", [0, 0], 0)),
49b1b8d0782f type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents: 42245
diff changeset
   107
    ("",            typ "type => type",                Delimfix "'(_')"),
49b1b8d0782f type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents: 42245
diff changeset
   108
    ("\\<^type>dummy", typ "type",                     Delimfix "'_"),
49b1b8d0782f type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents: 42245
diff changeset
   109
    ("_type_prop",  typ "'a",                          NoSyn),
49b1b8d0782f type syntax as regular mixfix specification (type_ext for bootstrapping has been obsolete for many years);
wenzelm
parents: 42245
diff changeset
   110
    ("_lambda",     typ "pttrns => 'a => logic",       Mixfix ("(3%_./ _)", [0, 3], 3)),
26436
dfd6947ab5c2 removed obsolete appl_syntax, applC_syntax;
wenzelm
parents: 26430
diff changeset
   111
    ("_abs",        typ "'a",                          NoSyn),
dfd6947ab5c2 removed obsolete appl_syntax, applC_syntax;
wenzelm
parents: 26430
diff changeset
   112
    ("",            typ "'a => args",                  Delimfix "_"),
dfd6947ab5c2 removed obsolete appl_syntax, applC_syntax;
wenzelm
parents: 26430
diff changeset
   113
    ("_args",       typ "'a => args => args",          Delimfix "_,/ _"),
42048
afd11ca8e018 support for encoded positions (for id_position, longid_position) as pseudo type-constraints -- still inactive;
wenzelm
parents: 39557
diff changeset
   114
    ("",            typ "id_position => idt",          Delimfix "_"),
26436
dfd6947ab5c2 removed obsolete appl_syntax, applC_syntax;
wenzelm
parents: 26430
diff changeset
   115
    ("_idtdummy",   typ "idt",                         Delimfix "'_"),
42048
afd11ca8e018 support for encoded positions (for id_position, longid_position) as pseudo type-constraints -- still inactive;
wenzelm
parents: 39557
diff changeset
   116
    ("_idtyp",      typ "id_position => type => idt",  Mixfix ("_::_", [], 0)),
26436
dfd6947ab5c2 removed obsolete appl_syntax, applC_syntax;
wenzelm
parents: 26430
diff changeset
   117
    ("_idtypdummy", typ "type => idt",                 Mixfix ("'_()::_", [], 0)),
dfd6947ab5c2 removed obsolete appl_syntax, applC_syntax;
wenzelm
parents: 26430
diff changeset
   118
    ("",            typ "idt => idt",                  Delimfix "'(_')"),
dfd6947ab5c2 removed obsolete appl_syntax, applC_syntax;
wenzelm
parents: 26430
diff changeset
   119
    ("",            typ "idt => idts",                 Delimfix "_"),
dfd6947ab5c2 removed obsolete appl_syntax, applC_syntax;
wenzelm
parents: 26430
diff changeset
   120
    ("_idts",       typ "idt => idts => idts",         Mixfix ("_/ _", [1, 0], 0)),
dfd6947ab5c2 removed obsolete appl_syntax, applC_syntax;
wenzelm
parents: 26430
diff changeset
   121
    ("",            typ "idt => pttrn",                Delimfix "_"),
dfd6947ab5c2 removed obsolete appl_syntax, applC_syntax;
wenzelm
parents: 26430
diff changeset
   122
    ("",            typ "pttrn => pttrns",             Delimfix "_"),
dfd6947ab5c2 removed obsolete appl_syntax, applC_syntax;
wenzelm
parents: 26430
diff changeset
   123
    ("_pttrns",     typ "pttrn => pttrns => pttrns",   Mixfix ("_/ _", [1, 0], 0)),
28856
5e009a80fe6d Pure syntax: more coherent treatment of aprop, permanent TERM and &&&;
wenzelm
parents: 28841
diff changeset
   124
    ("",            typ "aprop => aprop",              Delimfix "'(_')"),
42048
afd11ca8e018 support for encoded positions (for id_position, longid_position) as pseudo type-constraints -- still inactive;
wenzelm
parents: 39557
diff changeset
   125
    ("",            typ "id_position => aprop",        Delimfix "_"),
afd11ca8e018 support for encoded positions (for id_position, longid_position) as pseudo type-constraints -- still inactive;
wenzelm
parents: 39557
diff changeset
   126
    ("",            typ "longid_position => aprop",    Delimfix "_"),
51612
6a1e40f9dd55 added var_position in analogy to longid_position, for typing reports on input;
wenzelm
parents: 50636
diff changeset
   127
    ("",            typ "var_position => aprop",       Delimfix "_"),
26436
dfd6947ab5c2 removed obsolete appl_syntax, applC_syntax;
wenzelm
parents: 26430
diff changeset
   128
    ("_DDDOT",      typ "aprop",                       Delimfix "..."),
dfd6947ab5c2 removed obsolete appl_syntax, applC_syntax;
wenzelm
parents: 26430
diff changeset
   129
    ("_aprop",      typ "aprop => prop",               Delimfix "PROP _"),
dfd6947ab5c2 removed obsolete appl_syntax, applC_syntax;
wenzelm
parents: 26430
diff changeset
   130
    ("_asm",        typ "prop => asms",                Delimfix "_"),
dfd6947ab5c2 removed obsolete appl_syntax, applC_syntax;
wenzelm
parents: 26430
diff changeset
   131
    ("_asms",       typ "prop => asms => asms",        Delimfix "_;/ _"),
dfd6947ab5c2 removed obsolete appl_syntax, applC_syntax;
wenzelm
parents: 26430
diff changeset
   132
    ("_bigimpl",    typ "asms => prop => prop",        Mixfix ("((3[| _ |])/ ==> _)", [0, 1], 1)),
dfd6947ab5c2 removed obsolete appl_syntax, applC_syntax;
wenzelm
parents: 26430
diff changeset
   133
    ("_ofclass",    typ "type => logic => prop",       Delimfix "(1OFCLASS/(1'(_,/ _')))"),
dfd6947ab5c2 removed obsolete appl_syntax, applC_syntax;
wenzelm
parents: 26430
diff changeset
   134
    ("_mk_ofclass", typ "dummy",                       NoSyn),
dfd6947ab5c2 removed obsolete appl_syntax, applC_syntax;
wenzelm
parents: 26430
diff changeset
   135
    ("_TYPE",       typ "type => logic",               Delimfix "(1TYPE/(1'(_')))"),
42048
afd11ca8e018 support for encoded positions (for id_position, longid_position) as pseudo type-constraints -- still inactive;
wenzelm
parents: 39557
diff changeset
   136
    ("",            typ "id_position => logic",        Delimfix "_"),
afd11ca8e018 support for encoded positions (for id_position, longid_position) as pseudo type-constraints -- still inactive;
wenzelm
parents: 39557
diff changeset
   137
    ("",            typ "longid_position => logic",    Delimfix "_"),
51612
6a1e40f9dd55 added var_position in analogy to longid_position, for typing reports on input;
wenzelm
parents: 50636
diff changeset
   138
    ("",            typ "var_position => logic",       Delimfix "_"),
26436
dfd6947ab5c2 removed obsolete appl_syntax, applC_syntax;
wenzelm
parents: 26430
diff changeset
   139
    ("_DDDOT",      typ "logic",                       Delimfix "..."),
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
   140
    ("_strip_positions", typ "'a", NoSyn),
46236
ae79f2978a67 position constraints for numerals enable PIDE markup;
wenzelm
parents: 45703
diff changeset
   141
    ("_position",   typ "num_token => num_position",   Delimfix "_"),
ae79f2978a67 position constraints for numerals enable PIDE markup;
wenzelm
parents: 45703
diff changeset
   142
    ("_position",   typ "float_token => float_position", Delimfix "_"),
ae79f2978a67 position constraints for numerals enable PIDE markup;
wenzelm
parents: 45703
diff changeset
   143
    ("_position",   typ "xnum_token => xnum_position", Delimfix "_"),
ae79f2978a67 position constraints for numerals enable PIDE markup;
wenzelm
parents: 45703
diff changeset
   144
    ("_constify",   typ "num_position => num_const",   Delimfix "_"),
ae79f2978a67 position constraints for numerals enable PIDE markup;
wenzelm
parents: 45703
diff changeset
   145
    ("_constify",   typ "float_position => float_const", Delimfix "_"),
ae79f2978a67 position constraints for numerals enable PIDE markup;
wenzelm
parents: 45703
diff changeset
   146
    ("_constify",   typ "xnum_position => xnum_const", Delimfix "_"),
26436
dfd6947ab5c2 removed obsolete appl_syntax, applC_syntax;
wenzelm
parents: 26430
diff changeset
   147
    ("_index",      typ "logic => index",              Delimfix "(00\\<^bsub>_\\<^esub>)"),
dfd6947ab5c2 removed obsolete appl_syntax, applC_syntax;
wenzelm
parents: 26430
diff changeset
   148
    ("_indexdefault", typ "index",                     Delimfix ""),
dfd6947ab5c2 removed obsolete appl_syntax, applC_syntax;
wenzelm
parents: 26430
diff changeset
   149
    ("_indexvar",   typ "index",                       Delimfix "'\\<index>"),
dfd6947ab5c2 removed obsolete appl_syntax, applC_syntax;
wenzelm
parents: 26430
diff changeset
   150
    ("_struct",     typ "index => logic",              Mixfix ("\\<struct>_", [1000], 1000)),
35145
f132a4fd8679 moved generic update_name to Pure syntax -- not specific to HOL/record;
wenzelm
parents: 35130
diff changeset
   151
    ("_update_name", typ "idt",                        NoSyn),
42295
8fdbb3b10beb moved CONST syntax/translations to their proper place;
wenzelm
parents: 42294
diff changeset
   152
    ("_constrainAbs", typ "'a",                        NoSyn),
49674
dbadb4d03cbc report sort assignment of visible type variables;
wenzelm
parents: 46483
diff changeset
   153
    ("_position_sort", typ "tid => tid_position",      Delimfix "_"),
dbadb4d03cbc report sort assignment of visible type variables;
wenzelm
parents: 46483
diff changeset
   154
    ("_position_sort", typ "tvar => tvar_position",    Delimfix "_"),
42410
16bc5564535f less bulky "_position", for improved readability of parse trees;
wenzelm
parents: 42375
diff changeset
   155
    ("_position",   typ "id => id_position",           Delimfix "_"),
16bc5564535f less bulky "_position", for improved readability of parse trees;
wenzelm
parents: 42375
diff changeset
   156
    ("_position",   typ "longid => longid_position",   Delimfix "_"),
51612
6a1e40f9dd55 added var_position in analogy to longid_position, for typing reports on input;
wenzelm
parents: 50636
diff changeset
   157
    ("_position",   typ "var => var_position",         Delimfix "_"),
46483
10a9c31a22b4 renamed "xstr" to "str_token";
wenzelm
parents: 46236
diff changeset
   158
    ("_position",   typ "str_token => str_position",   Delimfix "_"),
55108
0b7a0c1fdf7e inner syntax token language allows regular quoted strings;
wenzelm
parents: 55033
diff changeset
   159
    ("_position",   typ "string_token => string_position", Delimfix "_"),
55033
8e8243975860 support for nested text cartouches;
wenzelm
parents: 53171
diff changeset
   160
    ("_position",   typ "cartouche => cartouche_position", Delimfix "_"),
42048
afd11ca8e018 support for encoded positions (for id_position, longid_position) as pseudo type-constraints -- still inactive;
wenzelm
parents: 39557
diff changeset
   161
    ("_type_constraint_", typ "'a",                    NoSyn),
42296
dcc08f2a8671 CONST syntax with positions;
wenzelm
parents: 42295
diff changeset
   162
    ("_context_const", typ "id_position => logic",     Delimfix "CONST _"),
dcc08f2a8671 CONST syntax with positions;
wenzelm
parents: 42295
diff changeset
   163
    ("_context_const", typ "id_position => aprop",     Delimfix "CONST _"),
dcc08f2a8671 CONST syntax with positions;
wenzelm
parents: 42295
diff changeset
   164
    ("_context_const", typ "longid_position => logic", Delimfix "CONST _"),
dcc08f2a8671 CONST syntax with positions;
wenzelm
parents: 42295
diff changeset
   165
    ("_context_const", typ "longid_position => aprop", Delimfix "CONST _"),
dcc08f2a8671 CONST syntax with positions;
wenzelm
parents: 42295
diff changeset
   166
    ("_context_xconst", typ "id_position => logic",    Delimfix "XCONST _"),
dcc08f2a8671 CONST syntax with positions;
wenzelm
parents: 42295
diff changeset
   167
    ("_context_xconst", typ "id_position => aprop",    Delimfix "XCONST _"),
dcc08f2a8671 CONST syntax with positions;
wenzelm
parents: 42295
diff changeset
   168
    ("_context_xconst", typ "longid_position => logic", Delimfix "XCONST _"),
dcc08f2a8671 CONST syntax with positions;
wenzelm
parents: 42295
diff changeset
   169
    ("_context_xconst", typ "longid_position => aprop", Delimfix "XCONST _"),
35255
2cb27605301f authentic syntax for *all* term constants;
wenzelm
parents: 35145
diff changeset
   170
    (const "==>",   typ "prop => prop => prop",        Delimfix "op ==>"),
52161
wenzelm
parents: 52160
diff changeset
   171
    (const "dummy_pattern", typ "aprop",               Delimfix "'_"),
28856
5e009a80fe6d Pure syntax: more coherent treatment of aprop, permanent TERM and &&&;
wenzelm
parents: 28841
diff changeset
   172
    ("_sort_constraint", typ "type => prop",           Delimfix "(1SORT'_CONSTRAINT/(1'(_')))"),
35255
2cb27605301f authentic syntax for *all* term constants;
wenzelm
parents: 35145
diff changeset
   173
    (const "Pure.term", typ "logic => prop",           Delimfix "TERM _"),
2cb27605301f authentic syntax for *all* term constants;
wenzelm
parents: 35145
diff changeset
   174
    (const "Pure.conjunction", typ "prop => prop => prop", Infixr ("&&&", 2))]
26959
f8f2df3e4d83 theory Pure provides regular application syntax by default;
wenzelm
parents: 26693
diff changeset
   175
  #> Sign.add_syntax_i applC_syntax
26430
8ddb2e7c5a1e eliminated theory ProtoPure;
wenzelm
parents: 26395
diff changeset
   176
  #> Sign.add_modesyntax_i (Symbol.xsymbolsN, true)
35429
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
   177
   [(tycon "fun",         typ "type => type => type",   Mixfix ("(_/ \\<Rightarrow> _)", [1, 0], 0)),
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
   178
    ("_bracket",          typ "types => type => type",  Mixfix ("([_]/ \\<Rightarrow> _)", [0, 0], 0)),
49685
4341e4d86872 allow position constraints to coexist with 0 or 1 sort constraints;
wenzelm
parents: 49674
diff changeset
   179
    ("_ofsort",           typ "tid_position => sort => type", Mixfix ("_\\<Colon>_", [1000, 0], 1000)),
35429
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
   180
    ("_constrain",        typ "logic => type => logic", Mixfix ("_\\<Colon>_", [4, 0], 3)),
42293
6cca0343ea48 renamed sprop "prop#" to "prop'" -- proper identifier;
wenzelm
parents: 42290
diff changeset
   181
    ("_constrain",        typ "prop' => type => prop'", Mixfix ("_\\<Colon>_", [4, 0], 3)),
42048
afd11ca8e018 support for encoded positions (for id_position, longid_position) as pseudo type-constraints -- still inactive;
wenzelm
parents: 39557
diff changeset
   182
    ("_idtyp",            typ "id_position => type => idt", Mixfix ("_\\<Colon>_", [], 0)),
35429
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
   183
    ("_idtypdummy",       typ "type => idt",            Mixfix ("'_()\\<Colon>_", [], 0)),
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
   184
    ("_lambda",           typ "pttrns => 'a => logic",  Mixfix ("(3\\<lambda>_./ _)", [0, 3], 3)),
50636
07f47142378e uniform notation for == and \<equiv> (cf. 3e3c2af5e8a5);
wenzelm
parents: 50603
diff changeset
   185
    (const "==",          typ "'a => 'a => prop",       Infix ("\\<equiv>", 2)),
35429
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
   186
    (const "all_binder",  typ "idts => prop => prop",   Mixfix ("(3\\<And>_./ _)", [0, 0], 0)),
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
   187
    (const "==>",         typ "prop => prop => prop",   Infixr ("\\<Longrightarrow>", 1)),
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
   188
    ("_DDDOT",            typ "aprop",                  Delimfix "\\<dots>"),
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
   189
    ("_bigimpl",          typ "asms => prop => prop",   Mixfix ("((1\\<lbrakk>_\\<rbrakk>)/ \\<Longrightarrow> _)", [0, 1], 1)),
afa8cf9e63d8 authentic syntax for classes and type constructors;
wenzelm
parents: 35262
diff changeset
   190
    ("_DDDOT",            typ "logic",                  Delimfix "\\<dots>")]
26430
8ddb2e7c5a1e eliminated theory ProtoPure;
wenzelm
parents: 26395
diff changeset
   191
  #> Sign.add_modesyntax_i ("", false)
35255
2cb27605301f authentic syntax for *all* term constants;
wenzelm
parents: 35145
diff changeset
   192
   [(const "prop", typ "prop => prop", Mixfix ("_", [0], 0))]
26430
8ddb2e7c5a1e eliminated theory ProtoPure;
wenzelm
parents: 26395
diff changeset
   193
  #> Sign.add_modesyntax_i ("HTML", false)
24243
08db58fd6374 moved appl syntax to PureThy;
wenzelm
parents: 24137
diff changeset
   194
   [("_lambda", typ "pttrns => 'a => logic", Mixfix ("(3\\<lambda>_./ _)", [0, 3], 3))]
26430
8ddb2e7c5a1e eliminated theory ProtoPure;
wenzelm
parents: 26395
diff changeset
   195
  #> Sign.add_consts_i
50603
3e3c2af5e8a5 removed odd associativity of ==
nipkow
parents: 49685
diff changeset
   196
   [(Binding.name "==", typ "'a => 'a => prop", Infix ("==", 2)),
30344
10a67c5ddddb more uniform handling of binding in targets and derived elements;
wenzelm
parents: 30337
diff changeset
   197
    (Binding.name "==>", typ "prop => prop => prop", Mixfix ("(_/ ==> _)", [2, 1], 1)),
10a67c5ddddb more uniform handling of binding in targets and derived elements;
wenzelm
parents: 30337
diff changeset
   198
    (Binding.name "all", typ "('a => prop) => prop", Binder ("!!", 0, 0)),
10a67c5ddddb more uniform handling of binding in targets and derived elements;
wenzelm
parents: 30337
diff changeset
   199
    (Binding.name "prop", typ "prop => prop", NoSyn),
10a67c5ddddb more uniform handling of binding in targets and derived elements;
wenzelm
parents: 30337
diff changeset
   200
    (Binding.name "TYPE", typ "'a itself", NoSyn),
52161
wenzelm
parents: 52160
diff changeset
   201
    (Binding.name "dummy_pattern", typ "'a", Delimfix "'_")]
42375
774df7c59508 report Name_Space.declare/define, relatively to context;
wenzelm
parents: 42297
diff changeset
   202
  #> Theory.add_deps_global "==" ("==", typ "'a => 'a => prop") []
774df7c59508 report Name_Space.declare/define, relatively to context;
wenzelm
parents: 42297
diff changeset
   203
  #> Theory.add_deps_global "==>" ("==>", typ "prop => prop => prop") []
774df7c59508 report Name_Space.declare/define, relatively to context;
wenzelm
parents: 42297
diff changeset
   204
  #> Theory.add_deps_global "all" ("all", typ "('a => prop) => prop") []
774df7c59508 report Name_Space.declare/define, relatively to context;
wenzelm
parents: 42297
diff changeset
   205
  #> Theory.add_deps_global "TYPE" ("TYPE", typ "'a itself") []
52161
wenzelm
parents: 52160
diff changeset
   206
  #> Theory.add_deps_global "dummy_pattern" ("dummy_pattern", typ "'a") []
52143
36ffe23b25f8 syntax translations always depend on context;
wenzelm
parents: 51612
diff changeset
   207
  #> Sign.parse_ast_translation Syntax_Trans.pure_parse_ast_translation
36ffe23b25f8 syntax translations always depend on context;
wenzelm
parents: 51612
diff changeset
   208
  #> Sign.parse_translation Syntax_Trans.pure_parse_translation
36ffe23b25f8 syntax translations always depend on context;
wenzelm
parents: 51612
diff changeset
   209
  #> Sign.print_ast_translation Syntax_Trans.pure_print_ast_translation
26430
8ddb2e7c5a1e eliminated theory ProtoPure;
wenzelm
parents: 26395
diff changeset
   210
  #> Sign.local_path
8ddb2e7c5a1e eliminated theory ProtoPure;
wenzelm
parents: 26395
diff changeset
   211
  #> Sign.add_consts_i
30344
10a67c5ddddb more uniform handling of binding in targets and derived elements;
wenzelm
parents: 30337
diff changeset
   212
   [(Binding.name "term", typ "'a => prop", NoSyn),
10a67c5ddddb more uniform handling of binding in targets and derived elements;
wenzelm
parents: 30337
diff changeset
   213
    (Binding.name "sort_constraint", typ "'a itself => prop", NoSyn),
10a67c5ddddb more uniform handling of binding in targets and derived elements;
wenzelm
parents: 30337
diff changeset
   214
    (Binding.name "conjunction", typ "prop => prop => prop", NoSyn)]
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
   215
  #> (Global_Theory.add_defs false o map Thm.no_attributes)
29579
cb520b766e00 binding replaces bstring
haftmann
parents: 29433
diff changeset
   216
   [(Binding.name "prop_def", prop "(CONST prop :: prop => prop) (A::prop) == A::prop"),
cb520b766e00 binding replaces bstring
haftmann
parents: 29433
diff changeset
   217
    (Binding.name "term_def", prop "(CONST Pure.term :: 'a => prop) (x::'a) == (!!A::prop. A ==> A)"),
cb520b766e00 binding replaces bstring
haftmann
parents: 29433
diff changeset
   218
    (Binding.name "sort_constraint_def",
28622
1a0b845855ac added const sort_constraint with syntax SORT_CONSTRAINT -- logically vacous;
wenzelm
parents: 28076
diff changeset
   219
      prop "(CONST Pure.sort_constraint :: 'a itself => prop) (CONST TYPE :: 'a itself) ==\
1a0b845855ac added const sort_constraint with syntax SORT_CONSTRAINT -- logically vacous;
wenzelm
parents: 28076
diff changeset
   220
      \ (CONST Pure.term :: 'a itself => prop) (CONST TYPE :: 'a itself)"),
29579
cb520b766e00 binding replaces bstring
haftmann
parents: 29433
diff changeset
   221
    (Binding.name "conjunction_def", prop "(A &&& B) == (!!C::prop. (A ==> B ==> C) ==> C)")] #> snd
28622
1a0b845855ac added const sort_constraint with syntax SORT_CONSTRAINT -- logically vacous;
wenzelm
parents: 28076
diff changeset
   222
  #> Sign.hide_const false "Pure.term"
1a0b845855ac added const sort_constraint with syntax SORT_CONSTRAINT -- logically vacous;
wenzelm
parents: 28076
diff changeset
   223
  #> Sign.hide_const false "Pure.sort_constraint"
26666
433b165b0a8c added intern_fact, check_fact, hide_fact;
wenzelm
parents: 26655
diff changeset
   224
  #> Sign.hide_const false "Pure.conjunction"
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
   225
  #> Global_Theory.add_thmss [((Binding.name "nothing", []), [])] #> snd
42375
774df7c59508 report Name_Space.declare/define, relatively to context;
wenzelm
parents: 42297
diff changeset
   226
  #> fold (fn (a, prop) =>
53171
a5e54d4d9081 added Theory.setup convenience;
wenzelm
parents: 52211
diff changeset
   227
      snd o Thm.add_axiom_global (Binding.name a, prop)) Proofterm.equality_axms);
3987
22f5291012df Init 'theorems' data. The Pure theories.
wenzelm
parents:
diff changeset
   228
22f5291012df Init 'theorems' data. The Pure theories.
wenzelm
parents:
diff changeset
   229
end;