src/Pure/pure_thy.ML
author wenzelm
Thu Aug 15 16:02:47 2019 +0200 (9 months ago)
changeset 70533 031620901fcd
parent 70403 468cfd56ee03
child 71155 25b872d1d421
permissions -rw-r--r--
support for (fully reconstructed) proof terms in Scala;
proper cache_typs;
wenzelm@3987
     1
(*  Title:      Pure/pure_thy.ML
wenzelm@3987
     2
    Author:     Markus Wenzel, TU Muenchen
wenzelm@3987
     3
wenzelm@39557
     4
Pure theory syntax and further logical content.
wenzelm@3987
     5
*)
wenzelm@3987
     6
wenzelm@3987
     7
signature PURE_THY =
wenzelm@3987
     8
sig
wenzelm@26959
     9
  val old_appl_syntax: theory -> bool
wenzelm@26959
    10
  val old_appl_syntax_setup: theory -> theory
wenzelm@52160
    11
  val token_markers: string list
wenzelm@3987
    12
end;
wenzelm@3987
    13
wenzelm@39557
    14
structure Pure_Thy: PURE_THY =
wenzelm@3987
    15
struct
wenzelm@3987
    16
wenzelm@70388
    17
(* auxiliary *)
wenzelm@70388
    18
wenzelm@33384
    19
val typ = Simple_Syntax.read_typ;
wenzelm@33384
    20
val prop = Simple_Syntax.read_prop;
wenzelm@35429
    21
wenzelm@42290
    22
val tycon = Lexicon.mark_type;
wenzelm@42290
    23
val const = Lexicon.mark_const;
wenzelm@24243
    24
wenzelm@56234
    25
val qualify = Binding.qualify true Context.PureN;
wenzelm@56234
    26
wenzelm@62752
    27
fun mixfix (sy, ps, p) = Mixfix (Input.string sy, ps, p, Position.no_range);
wenzelm@62752
    28
fun infix_ (sy, p) = Infix (Input.string sy, p, Position.no_range);
wenzelm@62752
    29
fun infixr_ (sy, p) = Infixr (Input.string sy, p, Position.no_range);
wenzelm@62752
    30
fun binder (sy, p, q) = Binder (Input.string sy, p, q, Position.no_range);
wenzelm@62752
    31
wenzelm@70388
    32
fun add_deps_type c thy =
wenzelm@70388
    33
  let
wenzelm@70388
    34
    val n = Sign.arity_number thy c;
wenzelm@70388
    35
    val typargs = map (fn a => TFree (a, [])) (Name.invent Name.context Name.aT n);
wenzelm@70388
    36
  in thy |> Theory.add_deps_global "" ((Defs.Type, c), typargs) [] end
wenzelm@70388
    37
wenzelm@70388
    38
fun add_deps_const c thy =
wenzelm@70388
    39
  let
wenzelm@70388
    40
    val T = Logic.unvarifyT_global (Sign.the_const_type thy c);
wenzelm@70388
    41
    val typargs = Sign.const_typargs thy (c, T);
wenzelm@70388
    42
  in thy |> Theory.add_deps_global "" ((Defs.Const, c), typargs) [] end;
wenzelm@70388
    43
wenzelm@26959
    44
wenzelm@26959
    45
(* application syntax variants *)
wenzelm@26959
    46
wenzelm@26959
    47
val appl_syntax =
wenzelm@67721
    48
 [("_appl", typ "('b \<Rightarrow> 'a) \<Rightarrow> args \<Rightarrow> logic", mixfix ("(1_/(1'(_')))", [1000, 0], 1000)),
wenzelm@67721
    49
  ("_appl", typ "('b \<Rightarrow> 'a) \<Rightarrow> args \<Rightarrow> aprop", mixfix ("(1_/(1'(_')))", [1000, 0], 1000))];
wenzelm@26959
    50
wenzelm@26959
    51
val applC_syntax =
wenzelm@67721
    52
 [("",       typ "'a \<Rightarrow> cargs",                  Mixfix.mixfix "_"),
wenzelm@67721
    53
  ("_cargs", typ "'a \<Rightarrow> cargs \<Rightarrow> cargs",         mixfix ("_/ _", [1000, 1000], 1000)),
wenzelm@67721
    54
  ("_applC", typ "('b \<Rightarrow> 'a) \<Rightarrow> cargs \<Rightarrow> logic", mixfix ("(1_/ _)", [1000, 1000], 999)),
wenzelm@67721
    55
  ("_applC", typ "('b \<Rightarrow> 'a) \<Rightarrow> cargs \<Rightarrow> aprop", mixfix ("(1_/ _)", [1000, 1000], 999))];
wenzelm@26959
    56
wenzelm@37216
    57
structure Old_Appl_Syntax = Theory_Data
wenzelm@26959
    58
(
wenzelm@26959
    59
  type T = bool;
wenzelm@26959
    60
  val empty = false;
wenzelm@26959
    61
  val extend = I;
wenzelm@33522
    62
  fun merge (b1, b2) : T =
wenzelm@26959
    63
    if b1 = b2 then b1
wenzelm@26959
    64
    else error "Cannot merge theories with different application syntax";
wenzelm@26959
    65
);
wenzelm@26959
    66
wenzelm@37216
    67
val old_appl_syntax = Old_Appl_Syntax.get;
wenzelm@26959
    68
wenzelm@26959
    69
val old_appl_syntax_setup =
wenzelm@37216
    70
  Old_Appl_Syntax.put true #>
wenzelm@56240
    71
  Sign.del_syntax Syntax.mode_default applC_syntax #>
wenzelm@56240
    72
  Sign.add_syntax Syntax.mode_default appl_syntax;
wenzelm@26959
    73
wenzelm@26959
    74
wenzelm@26959
    75
(* main content *)
wenzelm@26959
    76
wenzelm@52160
    77
val token_markers =
wenzelm@52160
    78
  ["_tfree", "_tvar", "_free", "_bound", "_loose", "_var", "_numeral", "_inner_string"];
wenzelm@52160
    79
wenzelm@53171
    80
val _ = Theory.setup
haftmann@33365
    81
  (Sign.map_naming (Name_Space.set_theory_name Context.PureN) #>
wenzelm@37216
    82
   Old_Appl_Syntax.put false #>
wenzelm@42375
    83
   Sign.add_types_global
wenzelm@64556
    84
   [(Binding.make ("fun", \<^here>), 2, NoSyn),
wenzelm@64556
    85
    (Binding.make ("prop", \<^here>), 0, NoSyn),
wenzelm@64556
    86
    (Binding.make ("itself", \<^here>), 1, NoSyn),
wenzelm@70388
    87
    (Binding.make ("dummy", \<^here>), 0, NoSyn),
wenzelm@70388
    88
    (qualify (Binding.make ("proof", \<^here>)), 0, NoSyn)]
wenzelm@70388
    89
  #> add_deps_type "fun"
wenzelm@70388
    90
  #> add_deps_type "prop"
wenzelm@70388
    91
  #> add_deps_type "itself"
wenzelm@70388
    92
  #> add_deps_type "dummy"
wenzelm@70388
    93
  #> add_deps_type "Pure.proof"
wenzelm@52160
    94
  #> Sign.add_nonterminals_global
wenzelm@64556
    95
    (map (fn name => Binding.make (name, \<^here>))
wenzelm@52160
    96
      (Lexicon.terminals @ ["logic", "type", "types", "sort", "classes",
wenzelm@52160
    97
        "args", "cargs", "pttrn", "pttrns", "idt", "idts", "aprop", "asms",
wenzelm@58421
    98
        "any", "prop'", "num_const", "float_const", "num_position",
wenzelm@58421
    99
        "float_position", "index", "struct", "tid_position",
wenzelm@55108
   100
        "tvar_position", "id_position", "longid_position", "var_position",
wenzelm@55108
   101
        "str_position", "string_position", "cartouche_position", "type_name",
wenzelm@55108
   102
        "class_name"]))
wenzelm@56240
   103
  #> Sign.add_syntax Syntax.mode_default (map (fn x => (x, typ "'a", NoSyn)) token_markers)
wenzelm@56240
   104
  #> Sign.add_syntax Syntax.mode_default
wenzelm@67721
   105
   [("",            typ "prop' \<Rightarrow> prop",               Mixfix.mixfix "_"),
wenzelm@67721
   106
    ("",            typ "logic \<Rightarrow> any",                Mixfix.mixfix "_"),
wenzelm@67721
   107
    ("",            typ "prop' \<Rightarrow> any",                Mixfix.mixfix "_"),
wenzelm@67721
   108
    ("",            typ "logic \<Rightarrow> logic",              Mixfix.mixfix "'(_')"),
wenzelm@67721
   109
    ("",            typ "prop' \<Rightarrow> prop'",              Mixfix.mixfix "'(_')"),
wenzelm@67721
   110
    ("_constrain",  typ "logic \<Rightarrow> type \<Rightarrow> logic",      mixfix ("_::_", [4, 0], 3)),
wenzelm@67721
   111
    ("_constrain",  typ "prop' \<Rightarrow> type \<Rightarrow> prop'",      mixfix ("_::_", [4, 0], 3)),
wenzelm@52211
   112
    ("_ignore_type", typ "'a",                         NoSyn),
wenzelm@67721
   113
    ("",            typ "tid_position \<Rightarrow> type",        Mixfix.mixfix "_"),
wenzelm@67721
   114
    ("",            typ "tvar_position \<Rightarrow> type",       Mixfix.mixfix "_"),
wenzelm@67721
   115
    ("",            typ "type_name \<Rightarrow> type",           Mixfix.mixfix "_"),
wenzelm@67721
   116
    ("_type_name",  typ "id \<Rightarrow> type_name",             Mixfix.mixfix "_"),
wenzelm@67721
   117
    ("_type_name",  typ "longid \<Rightarrow> type_name",         Mixfix.mixfix "_"),
wenzelm@67721
   118
    ("_ofsort",     typ "tid_position \<Rightarrow> sort \<Rightarrow> type", mixfix ("_::_", [1000, 0], 1000)),
wenzelm@67721
   119
    ("_ofsort",     typ "tvar_position \<Rightarrow> sort \<Rightarrow> type", mixfix ("_::_", [1000, 0], 1000)),
wenzelm@67721
   120
    ("_dummy_ofsort", typ "sort \<Rightarrow> type",              mixfix ("'_()::_", [0], 1000)),
wenzelm@67721
   121
    ("",            typ "class_name \<Rightarrow> sort",          Mixfix.mixfix "_"),
wenzelm@67721
   122
    ("_class_name", typ "id \<Rightarrow> class_name",            Mixfix.mixfix "_"),
wenzelm@67721
   123
    ("_class_name", typ "longid \<Rightarrow> class_name",        Mixfix.mixfix "_"),
wenzelm@67718
   124
    ("_dummy_sort", typ "sort",                        Mixfix.mixfix "'_"),
wenzelm@62761
   125
    ("_topsort",    typ "sort",                        Mixfix.mixfix "{}"),
wenzelm@67721
   126
    ("_sort",       typ "classes \<Rightarrow> sort",             Mixfix.mixfix "{_}"),
wenzelm@67721
   127
    ("",            typ "class_name \<Rightarrow> classes",       Mixfix.mixfix "_"),
wenzelm@67721
   128
    ("_classes",    typ "class_name \<Rightarrow> classes \<Rightarrow> classes", Mixfix.mixfix "_,_"),
wenzelm@67721
   129
    ("_tapp",       typ "type \<Rightarrow> type_name \<Rightarrow> type",   mixfix ("_ _", [1000, 0], 1000)),
wenzelm@67721
   130
    ("_tappl",      typ "type \<Rightarrow> types \<Rightarrow> type_name \<Rightarrow> type", Mixfix.mixfix "((1'(_,/ _')) _)"),
wenzelm@67721
   131
    ("",            typ "type \<Rightarrow> types",               Mixfix.mixfix "_"),
wenzelm@67721
   132
    ("_types",      typ "type \<Rightarrow> types \<Rightarrow> types",      Mixfix.mixfix "_,/ _"),
wenzelm@67721
   133
    ("\<^type>fun", typ "type \<Rightarrow> type \<Rightarrow> type",        mixfix ("(_/ \<Rightarrow> _)", [1, 0], 0)),
wenzelm@67721
   134
    ("_bracket",    typ "types \<Rightarrow> type \<Rightarrow> type",       mixfix ("([_]/ \<Rightarrow> _)", [0, 0], 0)),
wenzelm@67721
   135
    ("",            typ "type \<Rightarrow> type",                Mixfix.mixfix "'(_')"),
wenzelm@62761
   136
    ("\<^type>dummy", typ "type",                      Mixfix.mixfix "'_"),
wenzelm@42263
   137
    ("_type_prop",  typ "'a",                          NoSyn),
wenzelm@67721
   138
    ("_lambda",     typ "pttrns \<Rightarrow> 'a \<Rightarrow> logic",       mixfix ("(3\<lambda>_./ _)", [0, 3], 3)),
wenzelm@26436
   139
    ("_abs",        typ "'a",                          NoSyn),
wenzelm@67721
   140
    ("",            typ "'a \<Rightarrow> args",                  Mixfix.mixfix "_"),
wenzelm@67721
   141
    ("_args",       typ "'a \<Rightarrow> args \<Rightarrow> args",          Mixfix.mixfix "_,/ _"),
wenzelm@67721
   142
    ("",            typ "id_position \<Rightarrow> idt",          Mixfix.mixfix "_"),
wenzelm@62761
   143
    ("_idtdummy",   typ "idt",                         Mixfix.mixfix "'_"),
wenzelm@67721
   144
    ("_idtyp",      typ "id_position \<Rightarrow> type \<Rightarrow> idt",  mixfix ("_::_", [], 0)),
wenzelm@67721
   145
    ("_idtypdummy", typ "type \<Rightarrow> idt",                 mixfix ("'_()::_", [], 0)),
wenzelm@67721
   146
    ("",            typ "idt \<Rightarrow> idt",                  Mixfix.mixfix "'(_')"),
wenzelm@67721
   147
    ("",            typ "idt \<Rightarrow> idts",                 Mixfix.mixfix "_"),
wenzelm@67721
   148
    ("_idts",       typ "idt \<Rightarrow> idts \<Rightarrow> idts",         mixfix ("_/ _", [1, 0], 0)),
wenzelm@67721
   149
    ("",            typ "idt \<Rightarrow> pttrn",                Mixfix.mixfix "_"),
wenzelm@67721
   150
    ("",            typ "pttrn \<Rightarrow> pttrns",             Mixfix.mixfix "_"),
wenzelm@67721
   151
    ("_pttrns",     typ "pttrn \<Rightarrow> pttrns \<Rightarrow> pttrns",   mixfix ("_/ _", [1, 0], 0)),
wenzelm@67721
   152
    ("",            typ "aprop \<Rightarrow> aprop",              Mixfix.mixfix "'(_')"),
wenzelm@67721
   153
    ("",            typ "id_position \<Rightarrow> aprop",        Mixfix.mixfix "_"),
wenzelm@67721
   154
    ("",            typ "longid_position \<Rightarrow> aprop",    Mixfix.mixfix "_"),
wenzelm@67721
   155
    ("",            typ "var_position \<Rightarrow> aprop",       Mixfix.mixfix "_"),
wenzelm@62761
   156
    ("_DDDOT",      typ "aprop",                       Mixfix.mixfix "\<dots>"),
wenzelm@67721
   157
    ("_aprop",      typ "aprop \<Rightarrow> prop",               Mixfix.mixfix "PROP _"),
wenzelm@67721
   158
    ("_asm",        typ "prop \<Rightarrow> asms",                Mixfix.mixfix "_"),
wenzelm@67721
   159
    ("_asms",       typ "prop \<Rightarrow> asms \<Rightarrow> asms",        Mixfix.mixfix "_;/ _"),
wenzelm@67721
   160
    ("_bigimpl",    typ "asms \<Rightarrow> prop \<Rightarrow> prop",        mixfix ("((1\<lbrakk>_\<rbrakk>)/ \<Longrightarrow> _)", [0, 1], 1)),
wenzelm@67721
   161
    ("_ofclass",    typ "type \<Rightarrow> logic \<Rightarrow> prop",       Mixfix.mixfix "(1OFCLASS/(1'(_,/ _')))"),
wenzelm@26436
   162
    ("_mk_ofclass", typ "dummy",                       NoSyn),
wenzelm@67721
   163
    ("_TYPE",       typ "type \<Rightarrow> logic",               Mixfix.mixfix "(1TYPE/(1'(_')))"),
wenzelm@67721
   164
    ("",            typ "id_position \<Rightarrow> logic",        Mixfix.mixfix "_"),
wenzelm@67721
   165
    ("",            typ "longid_position \<Rightarrow> logic",    Mixfix.mixfix "_"),
wenzelm@67721
   166
    ("",            typ "var_position \<Rightarrow> logic",       Mixfix.mixfix "_"),
wenzelm@62761
   167
    ("_DDDOT",      typ "logic",                       Mixfix.mixfix "\<dots>"),
wenzelm@42057
   168
    ("_strip_positions", typ "'a", NoSyn),
wenzelm@67721
   169
    ("_position",   typ "num_token \<Rightarrow> num_position",   Mixfix.mixfix "_"),
wenzelm@67721
   170
    ("_position",   typ "float_token \<Rightarrow> float_position", Mixfix.mixfix "_"),
wenzelm@67721
   171
    ("_constify",   typ "num_position \<Rightarrow> num_const",   Mixfix.mixfix "_"),
wenzelm@67721
   172
    ("_constify",   typ "float_position \<Rightarrow> float_const", Mixfix.mixfix "_"),
wenzelm@67721
   173
    ("_index",      typ "logic \<Rightarrow> index",              Mixfix.mixfix "(\<open>unbreakable\<close>\<^bsub>_\<^esub>)"),
wenzelm@62761
   174
    ("_indexdefault", typ "index",                     Mixfix.mixfix ""),
wenzelm@62761
   175
    ("_indexvar",   typ "index",                       Mixfix.mixfix "'\<index>"),
wenzelm@67721
   176
    ("_struct",     typ "index \<Rightarrow> logic",              NoSyn),
wenzelm@35145
   177
    ("_update_name", typ "idt",                        NoSyn),
wenzelm@42295
   178
    ("_constrainAbs", typ "'a",                        NoSyn),
wenzelm@67721
   179
    ("_position_sort", typ "tid \<Rightarrow> tid_position",      Mixfix.mixfix "_"),
wenzelm@67721
   180
    ("_position_sort", typ "tvar \<Rightarrow> tvar_position",    Mixfix.mixfix "_"),
wenzelm@67721
   181
    ("_position",   typ "id \<Rightarrow> id_position",           Mixfix.mixfix "_"),
wenzelm@67721
   182
    ("_position",   typ "longid \<Rightarrow> longid_position",   Mixfix.mixfix "_"),
wenzelm@67721
   183
    ("_position",   typ "var \<Rightarrow> var_position",         Mixfix.mixfix "_"),
wenzelm@67721
   184
    ("_position",   typ "str_token \<Rightarrow> str_position",   Mixfix.mixfix "_"),
wenzelm@67721
   185
    ("_position",   typ "string_token \<Rightarrow> string_position", Mixfix.mixfix "_"),
wenzelm@67721
   186
    ("_position",   typ "cartouche \<Rightarrow> cartouche_position", Mixfix.mixfix "_"),
wenzelm@42048
   187
    ("_type_constraint_", typ "'a",                    NoSyn),
wenzelm@67721
   188
    ("_context_const", typ "id_position \<Rightarrow> logic",     Mixfix.mixfix "CONST _"),
wenzelm@67721
   189
    ("_context_const", typ "id_position \<Rightarrow> aprop",     Mixfix.mixfix "CONST _"),
wenzelm@67721
   190
    ("_context_const", typ "longid_position \<Rightarrow> logic", Mixfix.mixfix "CONST _"),
wenzelm@67721
   191
    ("_context_const", typ "longid_position \<Rightarrow> aprop", Mixfix.mixfix "CONST _"),
wenzelm@67721
   192
    ("_context_xconst", typ "id_position \<Rightarrow> logic",    Mixfix.mixfix "XCONST _"),
wenzelm@67721
   193
    ("_context_xconst", typ "id_position \<Rightarrow> aprop",    Mixfix.mixfix "XCONST _"),
wenzelm@67721
   194
    ("_context_xconst", typ "longid_position \<Rightarrow> logic", Mixfix.mixfix "XCONST _"),
wenzelm@67721
   195
    ("_context_xconst", typ "longid_position \<Rightarrow> aprop", Mixfix.mixfix "XCONST _"),
wenzelm@62761
   196
    (const "Pure.dummy_pattern", typ "aprop",          Mixfix.mixfix "'_"),
wenzelm@67721
   197
    ("_sort_constraint", typ "type \<Rightarrow> prop",           Mixfix.mixfix "(1SORT'_CONSTRAINT/(1'(_')))"),
wenzelm@67721
   198
    (const "Pure.term", typ "logic \<Rightarrow> prop",           Mixfix.mixfix "TERM _"),
wenzelm@67721
   199
    (const "Pure.conjunction", typ "prop \<Rightarrow> prop \<Rightarrow> prop", infixr_ ("&&&", 2))]
wenzelm@56240
   200
  #> Sign.add_syntax Syntax.mode_default applC_syntax
wenzelm@61957
   201
  #> Sign.add_syntax (Print_Mode.ASCII, true)
wenzelm@67721
   202
   [(tycon "fun",         typ "type \<Rightarrow> type \<Rightarrow> type",   mixfix ("(_/ => _)", [1, 0], 0)),
wenzelm@67721
   203
    ("_bracket",          typ "types \<Rightarrow> type \<Rightarrow> type",  mixfix ("([_]/ => _)", [0, 0], 0)),
wenzelm@67721
   204
    ("_lambda",           typ "pttrns \<Rightarrow> 'a \<Rightarrow> logic",  mixfix ("(3%_./ _)", [0, 3], 3)),
wenzelm@67721
   205
    (const "Pure.eq",     typ "'a \<Rightarrow> 'a \<Rightarrow> prop",       infix_ ("==", 2)),
wenzelm@67721
   206
    (const "Pure.all_binder", typ "idts \<Rightarrow> prop \<Rightarrow> prop", mixfix ("(3!!_./ _)", [0, 0], 0)),
wenzelm@67721
   207
    (const "Pure.imp",    typ "prop \<Rightarrow> prop \<Rightarrow> prop",   infixr_ ("==>", 1)),
wenzelm@62761
   208
    ("_DDDOT",            typ "aprop",                  Mixfix.mixfix "..."),
wenzelm@67721
   209
    ("_bigimpl",          typ "asms \<Rightarrow> prop \<Rightarrow> prop",   mixfix ("((3[| _ |])/ ==> _)", [0, 1], 1)),
wenzelm@62761
   210
    ("_DDDOT",            typ "logic",                  Mixfix.mixfix "...")]
wenzelm@56240
   211
  #> Sign.add_syntax ("", false)
wenzelm@67721
   212
   [(const "Pure.prop", typ "prop \<Rightarrow> prop", mixfix ("_", [0], 0))]
wenzelm@56239
   213
  #> Sign.add_consts
wenzelm@67721
   214
   [(qualify (Binding.make ("eq", \<^here>)), typ "'a \<Rightarrow> 'a \<Rightarrow> prop", infix_ ("\<equiv>", 2)),
wenzelm@67721
   215
    (qualify (Binding.make ("imp", \<^here>)), typ "prop \<Rightarrow> prop \<Rightarrow> prop", infixr_ ("\<Longrightarrow>", 1)),
wenzelm@67721
   216
    (qualify (Binding.make ("all", \<^here>)), typ "('a \<Rightarrow> prop) \<Rightarrow> prop", binder ("\<And>", 0, 0)),
wenzelm@67721
   217
    (qualify (Binding.make ("prop", \<^here>)), typ "prop \<Rightarrow> prop", NoSyn),
wenzelm@64556
   218
    (qualify (Binding.make ("type", \<^here>)), typ "'a itself", NoSyn),
wenzelm@70388
   219
    (qualify (Binding.make ("dummy_pattern", \<^here>)), typ "'a", Mixfix.mixfix "'_"),
wenzelm@70388
   220
    (qualify (Binding.make ("Appt", \<^here>)), typ "Pure.proof \<Rightarrow> 'a \<Rightarrow> Pure.proof", NoSyn),
wenzelm@70388
   221
    (qualify (Binding.make ("AppP", \<^here>)), typ "Pure.proof \<Rightarrow> Pure.proof \<Rightarrow> Pure.proof", NoSyn),
wenzelm@70388
   222
    (qualify (Binding.make ("Abst", \<^here>)), typ "('a \<Rightarrow> Pure.proof) \<Rightarrow> Pure.proof", NoSyn),
wenzelm@70388
   223
    (qualify (Binding.make ("AbsP", \<^here>)), typ "prop \<Rightarrow> (Pure.proof \<Rightarrow> Pure.proof) \<Rightarrow> Pure.proof", NoSyn),
wenzelm@70388
   224
    (qualify (Binding.make ("Hyp", \<^here>)), typ "prop \<Rightarrow> Pure.proof", NoSyn),
wenzelm@70388
   225
    (qualify (Binding.make ("Oracle", \<^here>)), typ "prop \<Rightarrow> Pure.proof", NoSyn),
wenzelm@70388
   226
    (qualify (Binding.make ("OfClass", \<^here>)), typ "('a itself \<Rightarrow> prop) \<Rightarrow> Pure.proof", NoSyn),
wenzelm@70403
   227
    (qualify (Binding.make ("MinProof", \<^here>)), typ "Pure.proof", NoSyn)]
wenzelm@70388
   228
  #> add_deps_const "Pure.eq"
wenzelm@70388
   229
  #> add_deps_const "Pure.imp"
wenzelm@70388
   230
  #> add_deps_const "Pure.all"
wenzelm@70388
   231
  #> add_deps_const "Pure.type"
wenzelm@70388
   232
  #> add_deps_const "Pure.dummy_pattern"
wenzelm@52143
   233
  #> Sign.parse_ast_translation Syntax_Trans.pure_parse_ast_translation
wenzelm@52143
   234
  #> Sign.parse_translation Syntax_Trans.pure_parse_translation
wenzelm@52143
   235
  #> Sign.print_ast_translation Syntax_Trans.pure_print_ast_translation
wenzelm@56239
   236
  #> Sign.add_consts
wenzelm@67721
   237
   [(qualify (Binding.make ("term", \<^here>)), typ "'a \<Rightarrow> prop", NoSyn),
wenzelm@67721
   238
    (qualify (Binding.make ("sort_constraint", \<^here>)), typ "'a itself \<Rightarrow> prop", NoSyn),
wenzelm@67721
   239
    (qualify (Binding.make ("conjunction", \<^here>)), typ "prop \<Rightarrow> prop \<Rightarrow> prop", NoSyn)]
wenzelm@26430
   240
  #> Sign.local_path
wenzelm@39557
   241
  #> (Global_Theory.add_defs false o map Thm.no_attributes)
wenzelm@64556
   242
   [(Binding.make ("prop_def", \<^here>),
wenzelm@67721
   243
      prop "(CONST Pure.prop :: prop \<Rightarrow> prop) (A::prop) \<equiv> A::prop"),
wenzelm@64556
   244
    (Binding.make ("term_def", \<^here>),
wenzelm@67721
   245
      prop "(CONST Pure.term :: 'a \<Rightarrow> prop) (x::'a) \<equiv> (\<And>A::prop. A \<Longrightarrow> A)"),
wenzelm@64556
   246
    (Binding.make ("sort_constraint_def", \<^here>),
wenzelm@67721
   247
      prop "(CONST Pure.sort_constraint :: 'a itself \<Rightarrow> prop) (CONST Pure.type :: 'a itself) \<equiv>\
wenzelm@67721
   248
      \ (CONST Pure.term :: 'a itself \<Rightarrow> prop) (CONST Pure.type :: 'a itself)"),
wenzelm@64556
   249
    (Binding.make ("conjunction_def", \<^here>),
wenzelm@67721
   250
      prop "(A &&& B) \<equiv> (\<And>C::prop. (A \<Longrightarrow> B \<Longrightarrow> C) \<Longrightarrow> C)")] #> snd
wenzelm@42375
   251
  #> fold (fn (a, prop) =>
wenzelm@64556
   252
      snd o Thm.add_axiom_global (Binding.make (a, \<^here>), prop)) Proofterm.equality_axms);
wenzelm@3987
   253
wenzelm@3987
   254
end;