src/Pure/Isar/specification.ML
author wenzelm
Sat, 07 Oct 2006 01:31:18 +0200
changeset 20890 052bde912a51
parent 20784 eece9aaaf352
child 20914 3f065aa89792
permissions -rw-r--r--
moved pretty_consts to proof_display.ML; adapted to improved LocalTheory interfaces;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18620
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
     1
(*  Title:      Pure/Isar/specification.ML
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
     2
    ID:         $Id$
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
     3
    Author:     Makarius
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
     4
19664
e1dc01a48a52 added const_syntax(_i);
wenzelm
parents: 19585
diff changeset
     5
Common local_theory specifications --- with type-inference and
18810
6dc5416368e9 swapped Toplevel.theory_context;
wenzelm
parents: 18786
diff changeset
     6
toplevel polymorphism.
18620
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
     7
*)
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
     8
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
     9
signature SPECIFICATION =
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
    10
sig
20890
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
    11
  val quiet_mode: bool ref
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
    12
  val print_consts: local_theory -> (string * typ -> bool) -> (string * typ) list -> unit
18771
63efe00371af renamed axiomatize(_i) to axiomatization(_i);
wenzelm
parents: 18728
diff changeset
    13
  val read_specification: (string * string option * mixfix) list ->
18954
ab48b6ac9327 type local_theory;
wenzelm
parents: 18880
diff changeset
    14
    ((string * Attrib.src list) * string list) list -> local_theory ->
18771
63efe00371af renamed axiomatize(_i) to axiomatization(_i);
wenzelm
parents: 18728
diff changeset
    15
    (((string * typ) * mixfix) list * ((string * Attrib.src list) * term list) list) *
18954
ab48b6ac9327 type local_theory;
wenzelm
parents: 18880
diff changeset
    16
    local_theory
18771
63efe00371af renamed axiomatize(_i) to axiomatization(_i);
wenzelm
parents: 18728
diff changeset
    17
  val cert_specification: (string * typ option * mixfix) list ->
18954
ab48b6ac9327 type local_theory;
wenzelm
parents: 18880
diff changeset
    18
    ((string * Attrib.src list) * term list) list -> local_theory ->
18771
63efe00371af renamed axiomatize(_i) to axiomatization(_i);
wenzelm
parents: 18728
diff changeset
    19
    (((string * typ) * mixfix) list * ((string * Attrib.src list) * term list) list) *
18954
ab48b6ac9327 type local_theory;
wenzelm
parents: 18880
diff changeset
    20
    local_theory
ab48b6ac9327 type local_theory;
wenzelm
parents: 18880
diff changeset
    21
  val axiomatization: (string * string option * mixfix) list ->
ab48b6ac9327 type local_theory;
wenzelm
parents: 18880
diff changeset
    22
    ((bstring * Attrib.src list) * string list) list -> local_theory ->
ab48b6ac9327 type local_theory;
wenzelm
parents: 18880
diff changeset
    23
    (term list * (bstring * thm list) list) * local_theory
ab48b6ac9327 type local_theory;
wenzelm
parents: 18880
diff changeset
    24
  val axiomatization_i: (string * typ option * mixfix) list ->
ab48b6ac9327 type local_theory;
wenzelm
parents: 18880
diff changeset
    25
    ((bstring * Attrib.src list) * term list) list -> local_theory ->
ab48b6ac9327 type local_theory;
wenzelm
parents: 18880
diff changeset
    26
    (term list * (bstring * thm list) list) * local_theory
ab48b6ac9327 type local_theory;
wenzelm
parents: 18880
diff changeset
    27
  val definition:
18786
591a37d48794 added definition(_i);
wenzelm
parents: 18771
diff changeset
    28
    ((string * string option * mixfix) option * ((string * Attrib.src list) * string)) list ->
18954
ab48b6ac9327 type local_theory;
wenzelm
parents: 18880
diff changeset
    29
    local_theory -> (term * (bstring * thm)) list * local_theory
ab48b6ac9327 type local_theory;
wenzelm
parents: 18880
diff changeset
    30
  val definition_i:
18786
591a37d48794 added definition(_i);
wenzelm
parents: 18771
diff changeset
    31
    ((string * typ option * mixfix) option * ((string * Attrib.src list) * term)) list ->
18954
ab48b6ac9327 type local_theory;
wenzelm
parents: 18880
diff changeset
    32
    local_theory -> (term * (bstring * thm)) list * local_theory
20784
eece9aaaf352 Syntax.mode;
wenzelm
parents: 19664
diff changeset
    33
  val abbreviation: Syntax.mode -> ((string * string option * mixfix) option * string) list ->
19080
46ba991e27d5 added abbreviation(_i);
wenzelm
parents: 18954
diff changeset
    34
    local_theory -> local_theory
20784
eece9aaaf352 Syntax.mode;
wenzelm
parents: 19664
diff changeset
    35
  val abbreviation_i: Syntax.mode -> ((string * typ option * mixfix) option * term) list ->
19080
46ba991e27d5 added abbreviation(_i);
wenzelm
parents: 18954
diff changeset
    36
    local_theory -> local_theory
20784
eece9aaaf352 Syntax.mode;
wenzelm
parents: 19664
diff changeset
    37
  val const_syntax: Syntax.mode -> (xstring * mixfix) list -> local_theory -> local_theory
eece9aaaf352 Syntax.mode;
wenzelm
parents: 19664
diff changeset
    38
  val const_syntax_i: Syntax.mode -> (string * mixfix) list -> local_theory -> local_theory
18620
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
    39
end;
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
    40
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
    41
structure Specification: SPECIFICATION =
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
    42
struct
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
    43
20890
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
    44
(* diagnostics *)
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
    45
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
    46
val quiet_mode = ref false;
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
    47
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
    48
fun print_consts _ _ [] = ()
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
    49
  | print_consts ctxt pred cs =
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
    50
      if ! quiet_mode then () else Pretty.writeln (ProofDisplay.pretty_consts ctxt pred cs);
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
    51
19664
e1dc01a48a52 added const_syntax(_i);
wenzelm
parents: 19585
diff changeset
    52
18620
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
    53
(* prepare specification *)
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
    54
18828
26b80ed2259b added axiomatization_loc, definition_loc;
wenzelm
parents: 18810
diff changeset
    55
fun prep_specification prep_vars prep_propp prep_att raw_vars raw_specs ctxt =
18620
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
    56
  let
18670
c3f445b92aff uniform handling of fixes;
wenzelm
parents: 18640
diff changeset
    57
    val thy = ProofContext.theory_of ctxt;
18620
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
    58
18670
c3f445b92aff uniform handling of fixes;
wenzelm
parents: 18640
diff changeset
    59
    val (vars, vars_ctxt) = ctxt |> prep_vars raw_vars;
c3f445b92aff uniform handling of fixes;
wenzelm
parents: 18640
diff changeset
    60
    val (xs, params_ctxt) = vars_ctxt |> ProofContext.add_fixes_i vars;
c3f445b92aff uniform handling of fixes;
wenzelm
parents: 18640
diff changeset
    61
    val ((specs, vs), specs_ctxt) =
19585
70a1ce3b23ae removed 'concl is' patterns;
wenzelm
parents: 19544
diff changeset
    62
      prep_propp (params_ctxt, map (map (rpair []) o snd) raw_specs)
18620
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
    63
      |> swap |>> map (map fst)
18771
63efe00371af renamed axiomatize(_i) to axiomatization(_i);
wenzelm
parents: 18728
diff changeset
    64
      ||>> fold_map ProofContext.inferred_param xs;
18620
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
    65
18771
63efe00371af renamed axiomatize(_i) to axiomatization(_i);
wenzelm
parents: 18728
diff changeset
    66
    val params = vs ~~ map #3 vars;
18620
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
    67
    val names = map (fst o fst) raw_specs;
18670
c3f445b92aff uniform handling of fixes;
wenzelm
parents: 18640
diff changeset
    68
    val atts = map (map (prep_att thy) o snd o fst) raw_specs;
18620
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
    69
  in ((params, (names ~~ atts) ~~ specs), specs_ctxt) end;
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
    70
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
    71
fun read_specification x =
18771
63efe00371af renamed axiomatize(_i) to axiomatization(_i);
wenzelm
parents: 18728
diff changeset
    72
  prep_specification ProofContext.read_vars ProofContext.read_propp Attrib.intern_src x;
18620
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
    73
fun cert_specification x =
18670
c3f445b92aff uniform handling of fixes;
wenzelm
parents: 18640
diff changeset
    74
  prep_specification ProofContext.cert_vars ProofContext.cert_propp (K I) x;
18620
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
    75
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
    76
18771
63efe00371af renamed axiomatize(_i) to axiomatization(_i);
wenzelm
parents: 18728
diff changeset
    77
(* axiomatization *)
18620
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
    78
20890
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
    79
fun gen_axioms prep raw_vars raw_specs lthy =
18620
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
    80
  let
20890
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
    81
    val (vars, specs) = fst (prep raw_vars raw_specs lthy);
18828
26b80ed2259b added axiomatization_loc, definition_loc;
wenzelm
parents: 18810
diff changeset
    82
    val cs = map fst vars;
18880
b8a1c3cdf739 axiomatization: retrict parameters to occurrences in specs;
wenzelm
parents: 18828
diff changeset
    83
    val spec_frees = member (op =) (fold (fold Term.add_frees o snd) specs []);
18786
591a37d48794 added definition(_i);
wenzelm
parents: 18771
diff changeset
    84
20890
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
    85
    val ((consts, axioms), lthy') = lthy
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
    86
      |> LocalTheory.consts spec_frees vars
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
    87
      ||>> LocalTheory.axioms specs;
18786
591a37d48794 added definition(_i);
wenzelm
parents: 18771
diff changeset
    88
20890
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
    89
    (* FIXME generic target!? *)
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
    90
    val hs = map (Term.head_of o #2 o Logic.dest_equals o Thm.prop_of o #2) consts;
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
    91
    val lthy'' = lthy' |> LocalTheory.theory (Theory.add_finals_i false hs);
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
    92
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
    93
    val _ = print_consts lthy' spec_frees cs;
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
    94
  in ((map #1 consts, axioms), lthy'') end;
18786
591a37d48794 added definition(_i);
wenzelm
parents: 18771
diff changeset
    95
18954
ab48b6ac9327 type local_theory;
wenzelm
parents: 18880
diff changeset
    96
val axiomatization = gen_axioms read_specification;
ab48b6ac9327 type local_theory;
wenzelm
parents: 18880
diff changeset
    97
val axiomatization_i = gen_axioms cert_specification;
18620
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
    98
18786
591a37d48794 added definition(_i);
wenzelm
parents: 18771
diff changeset
    99
591a37d48794 added definition(_i);
wenzelm
parents: 18771
diff changeset
   100
(* definition *)
591a37d48794 added definition(_i);
wenzelm
parents: 18771
diff changeset
   101
20890
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   102
fun gen_defs prep args lthy =
18786
591a37d48794 added definition(_i);
wenzelm
parents: 18771
diff changeset
   103
  let
20890
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   104
    fun define (raw_var, (raw_a, raw_prop)) lthy1 =
18786
591a37d48794 added definition(_i);
wenzelm
parents: 18771
diff changeset
   105
      let
20890
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   106
        val (vars, [((raw_name, atts), [prop])]) =
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   107
          fst (prep (the_list raw_var) [(raw_a, [raw_prop])] lthy1);
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   108
        val (((x, T), rhs), prove) = LocalDefs.derived_def lthy1 true prop;
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   109
        val name = Thm.def_name_optional x raw_name;
18786
591a37d48794 added definition(_i);
wenzelm
parents: 18771
diff changeset
   110
        val mx = (case vars of [] => NoSyn | [((x', _), mx)] =>
591a37d48794 added definition(_i);
wenzelm
parents: 18771
diff changeset
   111
          if x = x' then mx
591a37d48794 added definition(_i);
wenzelm
parents: 18771
diff changeset
   112
          else error ("Head of definition " ^ quote x ^ " differs from declaration " ^ quote x'));
20890
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   113
        val ((lhs, (_, th)), lthy2) = lthy1
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   114
(*          |> LocalTheory.def ((x, mx), ((name ^ "_raw", []), rhs));  FIXME *)
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   115
          |> LocalTheory.def ((x, mx), ((name, []), rhs));
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   116
        val ((b, [th']), lthy3) = lthy2
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   117
          |> LocalTheory.note ((name, atts), [prove lthy2 lhs th]);
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   118
      in (((x, T), (lhs, (b, th'))), LocalTheory.reinit lthy3) end;
18786
591a37d48794 added definition(_i);
wenzelm
parents: 18771
diff changeset
   119
20890
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   120
    val ((cs, defs), lthy') = lthy |> fold_map define args |>> split_list;
18880
b8a1c3cdf739 axiomatization: retrict parameters to occurrences in specs;
wenzelm
parents: 18828
diff changeset
   121
    val def_frees = member (op =) (fold (Term.add_frees o fst) defs []);
20890
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   122
    val _ = print_consts lthy' def_frees cs;
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   123
  in (defs, lthy') end;
18786
591a37d48794 added definition(_i);
wenzelm
parents: 18771
diff changeset
   124
18954
ab48b6ac9327 type local_theory;
wenzelm
parents: 18880
diff changeset
   125
val definition = gen_defs read_specification;
ab48b6ac9327 type local_theory;
wenzelm
parents: 18880
diff changeset
   126
val definition_i = gen_defs cert_specification;
18786
591a37d48794 added definition(_i);
wenzelm
parents: 18771
diff changeset
   127
19080
46ba991e27d5 added abbreviation(_i);
wenzelm
parents: 18954
diff changeset
   128
46ba991e27d5 added abbreviation(_i);
wenzelm
parents: 18954
diff changeset
   129
(* abbreviation *)
46ba991e27d5 added abbreviation(_i);
wenzelm
parents: 18954
diff changeset
   130
20890
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   131
fun gen_abbrevs prep mode args lthy =
19080
46ba991e27d5 added abbreviation(_i);
wenzelm
parents: 18954
diff changeset
   132
  let
20890
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   133
    fun abbrev (raw_var, raw_prop) lthy1 =
19080
46ba991e27d5 added abbreviation(_i);
wenzelm
parents: 18954
diff changeset
   134
      let
19372
3ff5f1777743 abbreviation(_i): do not expand abbreviations, do not use derived_def;
wenzelm
parents: 19080
diff changeset
   135
        val ((vars, [(_, [prop])]), _) =
3ff5f1777743 abbreviation(_i): do not expand abbreviations, do not use derived_def;
wenzelm
parents: 19080
diff changeset
   136
          prep (the_list raw_var) [(("", []), [raw_prop])]
20890
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   137
            (lthy1 |> ProofContext.expand_abbrevs false);
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   138
        val ((x, T), rhs) = LocalDefs.abs_def (#2 (LocalDefs.cert_def lthy1 prop));
19080
46ba991e27d5 added abbreviation(_i);
wenzelm
parents: 18954
diff changeset
   139
        val mx = (case vars of [] => NoSyn | [((x', _), mx)] =>
46ba991e27d5 added abbreviation(_i);
wenzelm
parents: 18954
diff changeset
   140
          if x = x' then mx
46ba991e27d5 added abbreviation(_i);
wenzelm
parents: 18954
diff changeset
   141
          else error ("Head of abbreviation " ^ quote x ^ " differs from declaration " ^ quote x'));
46ba991e27d5 added abbreviation(_i);
wenzelm
parents: 18954
diff changeset
   142
      in
20890
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   143
        lthy1
19664
e1dc01a48a52 added const_syntax(_i);
wenzelm
parents: 19585
diff changeset
   144
        |> LocalTheory.abbrevs mode [((x, mx), rhs)]
19080
46ba991e27d5 added abbreviation(_i);
wenzelm
parents: 18954
diff changeset
   145
        |> pair (x, T)
46ba991e27d5 added abbreviation(_i);
wenzelm
parents: 18954
diff changeset
   146
      end;
46ba991e27d5 added abbreviation(_i);
wenzelm
parents: 18954
diff changeset
   147
20890
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   148
    val (cs, lthy1) = lthy
19544
e3a39dae2004 abbreviation: observe local syntax mode;
wenzelm
parents: 19372
diff changeset
   149
      |> ProofContext.set_syntax_mode mode
e3a39dae2004 abbreviation: observe local syntax mode;
wenzelm
parents: 19372
diff changeset
   150
      |> fold_map abbrev args
20890
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   151
      ||> ProofContext.restore_syntax_mode lthy;
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   152
    val _ = print_consts lthy1 (K false) cs;
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   153
  in lthy1 end;
19080
46ba991e27d5 added abbreviation(_i);
wenzelm
parents: 18954
diff changeset
   154
46ba991e27d5 added abbreviation(_i);
wenzelm
parents: 18954
diff changeset
   155
val abbreviation = gen_abbrevs read_specification;
46ba991e27d5 added abbreviation(_i);
wenzelm
parents: 18954
diff changeset
   156
val abbreviation_i = gen_abbrevs cert_specification;
46ba991e27d5 added abbreviation(_i);
wenzelm
parents: 18954
diff changeset
   157
19664
e1dc01a48a52 added const_syntax(_i);
wenzelm
parents: 19585
diff changeset
   158
e1dc01a48a52 added const_syntax(_i);
wenzelm
parents: 19585
diff changeset
   159
(* const syntax *)
e1dc01a48a52 added const_syntax(_i);
wenzelm
parents: 19585
diff changeset
   160
20890
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   161
fun gen_syntax intern_const mode raw_args lthy =
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   162
  let val args = raw_args |> map (apfst (intern_const (ProofContext.consts_of lthy)))
052bde912a51 moved pretty_consts to proof_display.ML;
wenzelm
parents: 20784
diff changeset
   163
  in lthy |> LocalTheory.const_syntax mode args end;
19664
e1dc01a48a52 added const_syntax(_i);
wenzelm
parents: 19585
diff changeset
   164
e1dc01a48a52 added const_syntax(_i);
wenzelm
parents: 19585
diff changeset
   165
val const_syntax = gen_syntax Consts.intern;
e1dc01a48a52 added const_syntax(_i);
wenzelm
parents: 19585
diff changeset
   166
val const_syntax_i = gen_syntax (K I);
e1dc01a48a52 added const_syntax(_i);
wenzelm
parents: 19585
diff changeset
   167
18620
fc8b5f275359 Theory specifications --- with type-inference, but no internal polymorphism.
wenzelm
parents:
diff changeset
   168
end;