src/Pure/variable.ML
changeset 59846 c7b7bca8592c
parent 59828 0e9baaf0e0bb
child 59883 12a89103cae6
equal deleted inserted replaced
59845:fafb4d12c307 59846:c7b7bca8592c
    36   val restore_body: Proof.context -> Proof.context -> Proof.context
    36   val restore_body: Proof.context -> Proof.context -> Proof.context
    37   val improper_fixes: Proof.context -> Proof.context
    37   val improper_fixes: Proof.context -> Proof.context
    38   val restore_proper_fixes: Proof.context -> Proof.context -> Proof.context
    38   val restore_proper_fixes: Proof.context -> Proof.context -> Proof.context
    39   val is_improper: Proof.context -> string -> bool
    39   val is_improper: Proof.context -> string -> bool
    40   val is_fixed: Proof.context -> string -> bool
    40   val is_fixed: Proof.context -> string -> bool
    41   val newly_fixed: Proof.context -> Proof.context -> string -> bool
    41   val is_newly_fixed: Proof.context -> Proof.context -> string -> bool
    42   val fixed_ord: Proof.context -> string * string -> order
    42   val fixed_ord: Proof.context -> string * string -> order
    43   val intern_fixed: Proof.context -> string -> string
    43   val intern_fixed: Proof.context -> string -> string
    44   val markup_fixed: Proof.context -> string -> Markup.T
    44   val markup_fixed: Proof.context -> string -> Markup.T
    45   val lookup_fixed: Proof.context -> string -> string option
    45   val lookup_fixed: Proof.context -> string -> string option
    46   val revert_fixed: Proof.context -> string -> string
    46   val revert_fixed: Proof.context -> string -> string
    47   val add_fixed_names: Proof.context -> term -> string list -> string list
    47   val add_fixed_names: Proof.context -> term -> string list -> string list
    48   val add_fixed: Proof.context -> term -> (string * typ) list -> (string * typ) list
    48   val add_fixed: Proof.context -> term -> (string * typ) list -> (string * typ) list
       
    49   val add_newly_fixed: Proof.context -> Proof.context ->
       
    50     term -> (string * typ) list -> (string * typ) list
    49   val add_free_names: Proof.context -> term -> string list -> string list
    51   val add_free_names: Proof.context -> term -> string list -> string list
    50   val add_frees: Proof.context -> term -> (string * typ) list -> (string * typ) list
    52   val add_frees: Proof.context -> term -> (string * typ) list -> (string * typ) list
    51   val add_fixes_binding: binding list -> Proof.context -> string list * Proof.context
    53   val add_fixes_binding: binding list -> Proof.context -> string list * Proof.context
    52   val add_fixes: string list -> Proof.context -> string list * Proof.context
    54   val add_fixes: string list -> Proof.context -> string list * Proof.context
    53   val add_fixes_direct: string list -> Proof.context -> Proof.context
    55   val add_fixes_direct: string list -> Proof.context -> Proof.context
   344 
   346 
   345 
   347 
   346 (* specialized name space *)
   348 (* specialized name space *)
   347 
   349 
   348 val is_fixed = Name_Space.defined_entry o fixes_space;
   350 val is_fixed = Name_Space.defined_entry o fixes_space;
   349 fun newly_fixed inner outer = is_fixed inner andf (not o is_fixed outer);
   351 fun is_newly_fixed inner outer = is_fixed inner andf (not o is_fixed outer);
   350 
   352 
   351 val fixed_ord = Name_Space.entry_ord o fixes_space;
   353 val fixed_ord = Name_Space.entry_ord o fixes_space;
   352 val intern_fixed = Name_Space.intern o fixes_space;
   354 val intern_fixed = Name_Space.intern o fixes_space;
   353 
   355 
   354 fun lookup_fixed ctxt x =
   356 fun lookup_fixed ctxt x =
   380 fun add_fixed_names ctxt =
   382 fun add_fixed_names ctxt =
   381   fold_aterms (fn Free (x, _) => is_fixed ctxt x ? insert (op =) x | _ => I);
   383   fold_aterms (fn Free (x, _) => is_fixed ctxt x ? insert (op =) x | _ => I);
   382 
   384 
   383 fun add_fixed ctxt =
   385 fun add_fixed ctxt =
   384   fold_aterms (fn Free (x, T) => is_fixed ctxt x ? insert (op =) (x, T) | _ => I);
   386   fold_aterms (fn Free (x, T) => is_fixed ctxt x ? insert (op =) (x, T) | _ => I);
       
   387 
       
   388 fun add_newly_fixed ctxt' ctxt =
       
   389   fold_aterms (fn Free (x, T) => is_newly_fixed ctxt' ctxt x ? insert (op =) (x, T) | _ => I);
   385 
   390 
   386 
   391 
   387 (* declarations *)
   392 (* declarations *)
   388 
   393 
   389 local
   394 local
   472 (** export -- generalize type/term variables (beware of closure sizes) **)
   477 (** export -- generalize type/term variables (beware of closure sizes) **)
   473 
   478 
   474 fun export_inst inner outer =
   479 fun export_inst inner outer =
   475   let
   480   let
   476     val declared_outer = is_declared outer;
   481     val declared_outer = is_declared outer;
   477     val still_fixed = not o newly_fixed inner outer;
   482     val still_fixed = not o is_newly_fixed inner outer;
   478 
   483 
   479     val gen_fixes =
   484     val gen_fixes =
   480       Name_Space.fold_table (fn (y, _) => not (is_fixed outer y) ? cons y)
   485       Name_Space.fold_table (fn (y, _) => not (is_fixed outer y) ? cons y)
   481         (fixes_of inner) [];
   486         (fixes_of inner) [];
   482 
   487