src/HOL/Tools/BNF/bnf_comp.ML
changeset 59794 39442248a027
parent 59725 e5dc7e7744f0
child 59820 0e9a0a5f4424
equal deleted inserted replaced
59793:a46efc5510ea 59794:39442248a027
     6 Composition of bounded natural functors.
     6 Composition of bounded natural functors.
     7 *)
     7 *)
     8 
     8 
     9 signature BNF_COMP =
     9 signature BNF_COMP =
    10 sig
    10 sig
    11   val bnf_inline_threshold: int Config.T
    11   val inline_threshold: int Config.T
    12 
    12 
    13   val ID_bnf: BNF_Def.bnf
    13   val ID_bnf: BNF_Def.bnf
    14   val DEADID_bnf: BNF_Def.bnf
    14   val DEADID_bnf: BNF_Def.bnf
    15 
    15 
    16   type comp_cache
    16   type comp_cache
    74 open BNF_Def
    74 open BNF_Def
    75 open BNF_Util
    75 open BNF_Util
    76 open BNF_Tactics
    76 open BNF_Tactics
    77 open BNF_Comp_Tactics
    77 open BNF_Comp_Tactics
    78 
    78 
    79 val bnf_inline_threshold = Attrib.setup_config_int @{binding bnf_inline_threshold} (K 5);
    79 val inline_threshold = Attrib.setup_config_int @{binding bnf_inline_threshold} (K 5);
    80 
    80 
    81 val ID_bnf = the (bnf_of @{context} "BNF_Composition.ID");
    81 val ID_bnf = the (bnf_of @{context} "BNF_Composition.ID");
    82 val DEADID_bnf = the (bnf_of @{context} "BNF_Composition.DEADID");
    82 val DEADID_bnf = the (bnf_of @{context} "BNF_Composition.DEADID");
    83 
    83 
    84 type comp_cache = (bnf * (typ list * typ list)) Typtab.table;
    84 type comp_cache = (bnf * (typ list * typ list)) Typtab.table;
   754 val mk_abs = mk_abs_or_rep range_type;
   754 val mk_abs = mk_abs_or_rep range_type;
   755 val mk_rep = mk_abs_or_rep domain_type;
   755 val mk_rep = mk_abs_or_rep domain_type;
   756 
   756 
   757 fun maybe_typedef ctxt force_out_of_line (b, As, mx) set opt_morphs tac =
   757 fun maybe_typedef ctxt force_out_of_line (b, As, mx) set opt_morphs tac =
   758   let
   758   let
   759     val threshold = Config.get ctxt bnf_inline_threshold;
   759     val threshold = Config.get ctxt inline_threshold;
   760     val repT = HOLogic.dest_setT (fastype_of set);
   760     val repT = HOLogic.dest_setT (fastype_of set);
   761     val out_of_line = force_out_of_line orelse
   761     val out_of_line = force_out_of_line orelse
   762       (threshold >= 0 andalso Term.size_of_typ repT > threshold);
   762       (threshold >= 0 andalso Term.size_of_typ repT > threshold);
   763   in
   763   in
   764     if out_of_line then
   764     if out_of_line then