src/Pure/Isar/proof_context.ML
changeset 42359 6ca5407863ed
parent 42358 b47d41d9f4b5
child 42360 da8817d01e7c
equal deleted inserted replaced
42358:b47d41d9f4b5 42359:6ca5407863ed
    35   val the_const_constraint: Proof.context -> string -> typ
    35   val the_const_constraint: Proof.context -> string -> typ
    36   val set_syntax_mode: Syntax.mode -> Proof.context -> Proof.context
    36   val set_syntax_mode: Syntax.mode -> Proof.context -> Proof.context
    37   val restore_syntax_mode: Proof.context -> Proof.context -> Proof.context
    37   val restore_syntax_mode: Proof.context -> Proof.context -> Proof.context
    38   val facts_of: Proof.context -> Facts.T
    38   val facts_of: Proof.context -> Facts.T
    39   val cases_of: Proof.context -> (string * (Rule_Cases.T * bool)) list
    39   val cases_of: Proof.context -> (string * (Rule_Cases.T * bool)) list
       
    40   val class_space: Proof.context -> Name_Space.T
       
    41   val type_space: Proof.context -> Name_Space.T
       
    42   val const_space: Proof.context -> Name_Space.T
       
    43   val intern_class: Proof.context -> xstring -> string
       
    44   val intern_type: Proof.context -> xstring -> string
       
    45   val intern_const: Proof.context -> xstring -> string
       
    46   val extern_class: Proof.context -> string -> xstring
       
    47   val extern_type: Proof.context -> string -> xstring
       
    48   val extern_const: Proof.context -> string -> xstring
    40   val transfer_syntax: theory -> Proof.context -> Proof.context
    49   val transfer_syntax: theory -> Proof.context -> Proof.context
    41   val transfer: theory -> Proof.context -> Proof.context
    50   val transfer: theory -> Proof.context -> Proof.context
    42   val background_theory: (theory -> theory) -> Proof.context -> Proof.context
    51   val background_theory: (theory -> theory) -> Proof.context -> Proof.context
    43   val background_theory_result: (theory -> 'a * theory) -> Proof.context -> 'a * Proof.context
    52   val background_theory_result: (theory -> 'a * theory) -> Proof.context -> 'a * Proof.context
    44   val extern_fact: Proof.context -> string -> xstring
    53   val extern_fact: Proof.context -> string -> xstring
   267 
   276 
   268 val facts_of = #facts o rep_context;
   277 val facts_of = #facts o rep_context;
   269 val cases_of = #cases o rep_context;
   278 val cases_of = #cases o rep_context;
   270 
   279 
   271 
   280 
       
   281 (* name spaces *)
       
   282 
       
   283 val class_space = Type.class_space o tsig_of;
       
   284 val type_space = Type.type_space o tsig_of;
       
   285 val const_space = Consts.space_of o consts_of;
       
   286 
       
   287 val intern_class = Name_Space.intern o class_space;
       
   288 val intern_type = Name_Space.intern o type_space;
       
   289 val intern_const = Name_Space.intern o const_space;
       
   290 
       
   291 fun extern_class ctxt = Name_Space.extern ctxt (class_space ctxt);
       
   292 fun extern_type ctxt = Name_Space.extern ctxt (type_space ctxt);
       
   293 fun extern_const ctxt = Name_Space.extern ctxt (const_space ctxt);
       
   294 
       
   295 
   272 (* theory transfer *)
   296 (* theory transfer *)
   273 
   297 
   274 fun transfer_syntax thy ctxt = ctxt |>
   298 fun transfer_syntax thy ctxt = ctxt |>
   275   map_syntax (Local_Syntax.rebuild thy) |>
   299   map_syntax (Local_Syntax.rebuild thy) |>
   276   map_tsig (fn tsig as (local_tsig, global_tsig) =>
   300   map_tsig (fn tsig as (local_tsig, global_tsig) =>
   349   let val arity = (prep_tycon ctxt t, map (prep_sort ctxt) Ss, prep_sort ctxt S)
   373   let val arity = (prep_tycon ctxt t, map (prep_sort ctxt) Ss, prep_sort ctxt S)
   350   in Type.add_arity (Syntax.pp ctxt) arity (tsig_of ctxt); arity end;
   374   in Type.add_arity (Syntax.pp ctxt) arity (tsig_of ctxt); arity end;
   351 
   375 
   352 in
   376 in
   353 
   377 
   354 val read_arity = prep_arity (Type.intern_type o tsig_of) Syntax.read_sort;
   378 val read_arity = prep_arity intern_type Syntax.read_sort;
   355 val cert_arity = prep_arity (K I) (Type.cert_sort o tsig_of);
   379 val cert_arity = prep_arity (K I) (Type.cert_sort o tsig_of);
   356 
   380 
   357 end;
   381 end;
   358 
   382 
   359 
   383 
   450     if Lexicon.is_tid c then
   474     if Lexicon.is_tid c then
   451      (Context_Position.report ctxt pos Markup.tfree;
   475      (Context_Position.report ctxt pos Markup.tfree;
   452       TFree (c, default_sort ctxt (c, ~1)))
   476       TFree (c, default_sort ctxt (c, ~1)))
   453     else
   477     else
   454       let
   478       let
   455         val d = Type.intern_type tsig c;
   479         val d = intern_type ctxt c;
   456         val decl = Type.the_decl tsig d;
   480         val decl = Type.the_decl tsig d;
   457         val _ = Context_Position.report ctxt pos (Markup.tycon d);
   481         val _ = Context_Position.report ctxt pos (Markup.tycon d);
   458         fun err () = error ("Bad type name: " ^ quote d);
   482         fun err () = error ("Bad type name: " ^ quote d);
   459         val args =
   483         val args =
   460           (case decl of
   484           (case decl of