src/HOL/Tools/Nitpick/nitpick_scope.ML
author blanchet
Mon Mar 03 22:33:22 2014 +0100 (2014-03-03)
changeset 55888 cac1add157e8
parent 55628 8103021024c1
child 55889 6bfbec3dff62
permissions -rw-r--r--
removed nonstandard models from Nitpick
     1 (*  Title:      HOL/Tools/Nitpick/nitpick_scope.ML
     2     Author:     Jasmin Blanchette, TU Muenchen
     3     Copyright   2008, 2009, 2010
     4 
     5 Scope enumerator for Nitpick.
     6 *)
     7 
     8 signature NITPICK_SCOPE =
     9 sig
    10   type styp = Nitpick_Util.styp
    11   type hol_context = Nitpick_HOL.hol_context
    12 
    13   type constr_spec =
    14     {const: styp,
    15      delta: int,
    16      epsilon: int,
    17      exclusive: bool,
    18      explicit_max: int,
    19      total: bool}
    20 
    21   type datatype_spec =
    22     {typ: typ,
    23      card: int,
    24      co: bool,
    25      self_rec: bool,
    26      complete: bool * bool,
    27      concrete: bool * bool,
    28      deep: bool,
    29      constrs: constr_spec list}
    30 
    31   type scope =
    32     {hol_ctxt: hol_context,
    33      binarize: bool,
    34      card_assigns: (typ * int) list,
    35      bits: int,
    36      bisim_depth: int,
    37      datatypes: datatype_spec list,
    38      ofs: int Typtab.table}
    39 
    40   val is_asymmetric_nondatatype : typ -> bool
    41   val datatype_spec : datatype_spec list -> typ -> datatype_spec option
    42   val constr_spec : datatype_spec list -> styp -> constr_spec
    43   val is_complete_type : datatype_spec list -> bool -> typ -> bool
    44   val is_concrete_type : datatype_spec list -> bool -> typ -> bool
    45   val is_exact_type : datatype_spec list -> bool -> typ -> bool
    46   val offset_of_type : int Typtab.table -> typ -> int
    47   val spec_of_type : scope -> typ -> int * int
    48   val pretties_for_scope : scope -> bool -> Pretty.T list
    49   val multiline_string_for_scope : scope -> string
    50   val scopes_equivalent : scope * scope -> bool
    51   val scope_less_eq : scope -> scope -> bool
    52   val is_self_recursive_constr_type : typ -> bool
    53   val all_scopes :
    54     hol_context -> bool -> (typ option * int list) list
    55     -> (styp option * int list) list -> (styp option * int list) list
    56     -> int list -> int list -> typ list -> typ list -> typ list -> typ list
    57     -> int * scope list
    58 end;
    59 
    60 structure Nitpick_Scope : NITPICK_SCOPE =
    61 struct
    62 
    63 open Nitpick_Util
    64 open Nitpick_HOL
    65 
    66 type constr_spec =
    67   {const: styp,
    68    delta: int,
    69    epsilon: int,
    70    exclusive: bool,
    71    explicit_max: int,
    72    total: bool}
    73 
    74 type datatype_spec =
    75   {typ: typ,
    76    card: int,
    77    co: bool,
    78    self_rec: bool,
    79    complete: bool * bool,
    80    concrete: bool * bool,
    81    deep: bool,
    82    constrs: constr_spec list}
    83 
    84 type scope =
    85   {hol_ctxt: hol_context,
    86    binarize: bool,
    87    card_assigns: (typ * int) list,
    88    bits: int,
    89    bisim_depth: int,
    90    datatypes: datatype_spec list,
    91    ofs: int Typtab.table}
    92 
    93 datatype row_kind = Card of typ | Max of styp
    94 
    95 type row = row_kind * int list
    96 type block = row list
    97 
    98 val is_asymmetric_nondatatype =
    99   is_iterator_type orf is_integer_type orf is_bit_type
   100 
   101 fun datatype_spec (dtypes : datatype_spec list) T =
   102   List.find (curry (op =) T o #typ) dtypes
   103 
   104 fun constr_spec [] x = raise TERM ("Nitpick_Scope.constr_spec", [Const x])
   105   | constr_spec ({constrs, ...} :: dtypes : datatype_spec list) (x as (s, T)) =
   106     case List.find (curry (op =) (s, body_type T) o (apsnd body_type o #const))
   107                    constrs of
   108       SOME c => c
   109     | NONE => constr_spec dtypes x
   110 
   111 fun is_complete_type dtypes facto (Type (@{type_name fun}, [T1, T2])) =
   112     is_concrete_type dtypes facto T1 andalso is_complete_type dtypes facto T2
   113   | is_complete_type dtypes facto (Type (@{type_name prod}, Ts)) =
   114     forall (is_complete_type dtypes facto) Ts
   115   | is_complete_type dtypes facto (Type (@{type_name set}, [T'])) =
   116     is_concrete_type dtypes facto T'
   117   | is_complete_type dtypes facto T =
   118     not (is_integer_like_type T) andalso not (is_bit_type T) andalso
   119     fun_from_pair (#complete (the (datatype_spec dtypes T))) facto
   120     handle Option.Option => true
   121 and is_concrete_type dtypes facto (Type (@{type_name fun}, [T1, T2])) =
   122     is_complete_type dtypes facto T1 andalso is_concrete_type dtypes facto T2
   123   | is_concrete_type dtypes facto (Type (@{type_name prod}, Ts)) =
   124     forall (is_concrete_type dtypes facto) Ts
   125   | is_concrete_type dtypes facto (Type (@{type_name set}, [T'])) =
   126     is_complete_type dtypes facto T'
   127   | is_concrete_type dtypes facto T =
   128     fun_from_pair (#concrete (the (datatype_spec dtypes T))) facto
   129     handle Option.Option => true
   130 and is_exact_type dtypes facto =
   131   is_complete_type dtypes facto andf is_concrete_type dtypes facto
   132 
   133 fun offset_of_type ofs T =
   134   case Typtab.lookup ofs T of
   135     SOME j0 => j0
   136   | NONE => Typtab.lookup ofs dummyT |> the_default 0
   137 
   138 fun spec_of_type ({card_assigns, ofs, ...} : scope) T =
   139   (card_of_type card_assigns T
   140    handle TYPE ("Nitpick_HOL.card_of_type", _, _) => ~1, offset_of_type ofs T)
   141 
   142 fun quintuple_for_scope code_type code_term code_string
   143         ({hol_ctxt = {ctxt, ...}, card_assigns, bits, bisim_depth,
   144          datatypes, ...} : scope) =
   145   let
   146     val boring_Ts = [@{typ unsigned_bit}, @{typ signed_bit},
   147                      @{typ bisim_iterator}]
   148     val (iter_assigns, card_assigns) =
   149       card_assigns |> filter_out (member (op =) boring_Ts o fst)
   150                    |> List.partition (is_fp_iterator_type o fst)
   151     val (secondary_card_assigns, primary_card_assigns) =
   152       card_assigns
   153       |> List.partition ((is_integer_type orf is_datatype ctxt) o fst)
   154     val cards =
   155       map (fn (T, k) =>
   156               [code_type ctxt T, code_string (" = " ^ string_of_int k)])
   157     fun maxes () =
   158       maps (map_filter
   159                 (fn {const, explicit_max, ...} =>
   160                     if explicit_max < 0 then
   161                       NONE
   162                     else
   163                       SOME [code_term ctxt (Const const),
   164                             code_string (" = " ^ string_of_int explicit_max)])
   165                  o #constrs) datatypes
   166     fun iters () =
   167       map (fn (T, k) =>
   168               [code_term ctxt (Const (const_for_iterator_type T)),
   169                code_string (" = " ^ string_of_int (k - 1))]) iter_assigns
   170     fun miscs () =
   171       (if bits = 0 then []
   172        else [code_string ("bits = " ^ string_of_int bits)]) @
   173       (if bisim_depth < 0 andalso forall (not o #co) datatypes then []
   174        else [code_string ("bisim_depth = " ^ signed_string_of_int bisim_depth)])
   175   in
   176     (cards primary_card_assigns, cards secondary_card_assigns,
   177      maxes (), iters (), miscs ())
   178   end
   179 
   180 fun pretties_for_scope scope verbose =
   181   let
   182     fun standard_blocks s = map (Pretty.block o cons (Pretty.str (s ^ " ")))
   183     val (primary_cards, secondary_cards, maxes, iters, miscs) =
   184       quintuple_for_scope (pretty_maybe_quote oo pretty_for_type)
   185                           (pretty_maybe_quote oo Syntax.pretty_term)
   186                           Pretty.str scope
   187   in
   188     standard_blocks "card" primary_cards @
   189     (if verbose then
   190        standard_blocks "card" secondary_cards @
   191        standard_blocks "max" maxes @
   192        standard_blocks "iter" iters @
   193        miscs
   194      else
   195        [])
   196     |> pretty_serial_commas "and"
   197   end
   198 
   199 fun multiline_string_for_scope scope =
   200   let
   201     val (primary_cards, secondary_cards, maxes, iters, miscs) =
   202       quintuple_for_scope Syntax.string_of_typ Syntax.string_of_term I scope
   203     val cards = primary_cards @ secondary_cards
   204   in
   205     case (if null cards then [] else ["card: " ^ commas (map implode cards)]) @
   206          (if null maxes then [] else ["max: " ^ commas (map implode maxes)]) @
   207          (if null iters then [] else ["iter: " ^ commas (map implode iters)]) @
   208          miscs of
   209       [] => "empty"
   210     | lines => cat_lines lines
   211   end
   212 
   213 fun scopes_equivalent (s1 : scope, s2 : scope) =
   214   #datatypes s1 = #datatypes s2 andalso #card_assigns s1 = #card_assigns s2
   215 fun scope_less_eq (s1 : scope) (s2 : scope) =
   216   (s1, s2) |> pairself (map snd o #card_assigns) |> op ~~ |> forall (op <=)
   217 
   218 fun rank_of_row (_, ks) = length ks
   219 fun rank_of_block block = fold Integer.max (map rank_of_row block) 1
   220 fun project_row _ (y, []) = (y, [1]) (* desperate measure *)
   221   | project_row column (y, ks) = (y, [nth ks (Int.min (column, length ks - 1))])
   222 fun project_block (column, block) = map (project_row column) block
   223 
   224 fun lookup_ints_assign eq assigns key =
   225   case triple_lookup eq assigns key of
   226     SOME ks => ks
   227   | NONE => raise ARG ("Nitpick_Scope.lookup_ints_assign", "")
   228 fun lookup_type_ints_assign thy assigns T =
   229   map (Integer.max 1) (lookup_ints_assign (type_match thy) assigns T)
   230   handle ARG ("Nitpick_Scope.lookup_ints_assign", _) =>
   231          raise TYPE ("Nitpick_Scope.lookup_type_ints_assign", [T], [])
   232 fun lookup_const_ints_assign thy assigns x =
   233   lookup_ints_assign (const_match thy) assigns x
   234   handle ARG ("Nitpick_Scope.lookup_ints_assign", _) =>
   235          raise TERM ("Nitpick_Scope.lookup_const_ints_assign", [Const x])
   236 
   237 fun row_for_constr thy maxes_assigns constr =
   238   SOME (Max constr, lookup_const_ints_assign thy maxes_assigns constr)
   239   handle TERM ("lookup_const_ints_assign", _) => NONE
   240 
   241 val max_bits = 31 (* Kodkod limit *)
   242 
   243 fun block_for_type (hol_ctxt as {thy, ...}) binarize cards_assigns maxes_assigns
   244                    iters_assigns bitss bisim_depths T =
   245   case T of
   246     @{typ unsigned_bit} =>
   247     [(Card T, map (Integer.min max_bits o Integer.max 1) bitss)]
   248   | @{typ signed_bit} =>
   249     [(Card T, map (Integer.add 1 o Integer.min max_bits o Integer.max 1) bitss)]
   250   | @{typ "unsigned_bit word"} =>
   251     [(Card T, lookup_type_ints_assign thy cards_assigns nat_T)]
   252   | @{typ "signed_bit word"} =>
   253     [(Card T, lookup_type_ints_assign thy cards_assigns int_T)]
   254   | @{typ bisim_iterator} =>
   255     [(Card T, map (Integer.add 1 o Integer.max 0) bisim_depths)]
   256   | _ =>
   257     if is_fp_iterator_type T then
   258       [(Card T, map (Integer.add 1 o Integer.max 0)
   259                     (lookup_const_ints_assign thy iters_assigns
   260                                               (const_for_iterator_type T)))]
   261     else
   262       (Card T, lookup_type_ints_assign thy cards_assigns T) ::
   263       (case binarized_and_boxed_datatype_constrs hol_ctxt binarize T of
   264          [_] => []
   265        | constrs => map_filter (row_for_constr thy maxes_assigns) constrs)
   266 
   267 fun blocks_for_types hol_ctxt binarize cards_assigns maxes_assigns iters_assigns
   268                      bitss bisim_depths mono_Ts nonmono_Ts =
   269   let
   270     val block_for = block_for_type hol_ctxt binarize cards_assigns maxes_assigns
   271                                    iters_assigns bitss bisim_depths
   272     val mono_block = maps block_for mono_Ts
   273     val nonmono_blocks = map block_for nonmono_Ts
   274   in mono_block :: nonmono_blocks end
   275 
   276 val sync_threshold = 5
   277 val linearity = 5
   278 
   279 val all_combinations_ordered_smartly =
   280   let
   281     fun cost [] = 0
   282       | cost [k] = k
   283       | cost (k :: ks) =
   284         if k < sync_threshold andalso forall (curry (op =) k) ks then
   285           k - sync_threshold
   286         else
   287           k :: ks |> map (fn k => (k + linearity) * (k + linearity))
   288                   |> Integer.sum
   289   in
   290     all_combinations #> map (`cost) #> sort (int_ord o pairself fst) #> map snd
   291   end
   292 
   293 fun is_self_recursive_constr_type T =
   294   exists (exists_subtype (curry (op =) (body_type T))) (binder_types T)
   295 
   296 fun constr_max maxes x = the_default ~1 (AList.lookup (op =) maxes x)
   297 
   298 type scope_desc = (typ * int) list * (styp * int) list
   299 
   300 fun is_surely_inconsistent_card_assign hol_ctxt binarize
   301                                        (card_assigns, max_assigns) (T, k) =
   302   case binarized_and_boxed_datatype_constrs hol_ctxt binarize T of
   303     [] => false
   304   | xs =>
   305     let
   306       val dom_cards =
   307         map (Integer.prod o map (bounded_card_of_type k ~1 card_assigns)
   308              o binder_types o snd) xs
   309       val maxes = map (constr_max max_assigns) xs
   310       fun effective_max card ~1 = card
   311         | effective_max card max = Int.min (card, max)
   312       val max = map2 effective_max dom_cards maxes |> Integer.sum
   313     in max < k end
   314 fun is_surely_inconsistent_scope_description hol_ctxt binarize seen rest
   315                                              max_assigns =
   316   exists (is_surely_inconsistent_card_assign hol_ctxt binarize
   317                                              (seen @ rest, max_assigns)) seen
   318 
   319 fun repair_card_assigns hol_ctxt binarize (card_assigns, max_assigns) =
   320   let
   321     fun aux seen [] = SOME seen
   322       | aux _ ((_, 0) :: _) = NONE
   323       | aux seen ((T, k) :: rest) =
   324         (if is_surely_inconsistent_scope_description hol_ctxt binarize
   325                 ((T, k) :: seen) rest max_assigns then
   326            raise SAME ()
   327          else
   328            case aux ((T, k) :: seen) rest of
   329              SOME assigns => SOME assigns
   330            | NONE => raise SAME ())
   331         handle SAME () => aux seen ((T, k - 1) :: rest)
   332   in aux [] (rev card_assigns) end
   333 
   334 fun repair_iterator_assign ctxt assigns (T as Type (_, Ts), k) =
   335     (T, if T = @{typ bisim_iterator} then
   336           let
   337             val co_cards = map snd (filter (is_codatatype ctxt o fst) assigns)
   338           in Int.min (k, Integer.sum co_cards) end
   339         else if is_fp_iterator_type T then
   340           case Ts of
   341             [] => 1
   342           | _ => bounded_card_of_type k ~1 assigns (foldr1 HOLogic.mk_prodT Ts)
   343         else
   344           k)
   345   | repair_iterator_assign _ _ assign = assign
   346 
   347 fun add_row_to_scope_descriptor (kind, ks) (card_assigns, max_assigns) =
   348   case kind of
   349     Card T => ((T, the_single ks) :: card_assigns, max_assigns)
   350   | Max x => (card_assigns, (x, the_single ks) :: max_assigns)
   351 fun scope_descriptor_from_block block =
   352   fold_rev add_row_to_scope_descriptor block ([], [])
   353 fun scope_descriptor_from_combination (hol_ctxt as {ctxt, ...}) binarize blocks
   354                                       columns =
   355   let
   356     val (card_assigns, max_assigns) =
   357       maps project_block (columns ~~ blocks) |> scope_descriptor_from_block
   358   in
   359     (card_assigns, max_assigns)
   360     |> repair_card_assigns hol_ctxt binarize
   361     |> Option.map
   362            (fn card_assigns =>
   363                (map (repair_iterator_assign ctxt card_assigns) card_assigns,
   364                 max_assigns))
   365   end
   366 
   367 fun offset_table_for_card_assigns dtypes assigns =
   368   let
   369     fun aux next _ [] = Typtab.update_new (dummyT, next)
   370       | aux next reusable ((T, k) :: assigns) =
   371         if k = 1 orelse is_asymmetric_nondatatype T then
   372           aux next reusable assigns
   373         else if length (these (Option.map #constrs (datatype_spec dtypes T)))
   374                 > 1 then
   375           Typtab.update_new (T, next) #> aux (next + k) reusable assigns
   376         else
   377           case AList.lookup (op =) reusable k of
   378             SOME j0 => Typtab.update_new (T, j0) #> aux next reusable assigns
   379           | NONE => Typtab.update_new (T, next)
   380                     #> aux (next + k) ((k, next) :: reusable) assigns
   381   in Typtab.empty |> aux 0 [] assigns end
   382 
   383 fun domain_card max card_assigns =
   384   Integer.prod o map (bounded_card_of_type max max card_assigns) o binder_types
   385 
   386 fun add_constr_spec (card_assigns, max_assigns) acyclic card sum_dom_cards
   387                     num_self_recs num_non_self_recs (self_rec, x as (_, T))
   388                     constrs =
   389   let
   390     val max = constr_max max_assigns x
   391     fun next_delta () = if null constrs then 0 else #epsilon (hd constrs)
   392     val {delta, epsilon, exclusive, total} =
   393       if max = 0 then
   394         let val delta = next_delta () in
   395           {delta = delta, epsilon = delta, exclusive = true, total = false}
   396         end
   397       else if num_self_recs > 0 then
   398         (if num_non_self_recs = 1 then
   399            if self_rec then
   400              case List.last constrs of
   401                {delta = 0, epsilon = 1, exclusive = true, ...} =>
   402                {delta = 1, epsilon = card, exclusive = (num_self_recs = 1),
   403                 total = false}
   404              | _ => raise SAME ()
   405            else
   406              if domain_card 2 card_assigns T = 1 then
   407                {delta = 0, epsilon = 1, exclusive = acyclic, total = acyclic}
   408              else
   409                raise SAME ()
   410          else
   411            raise SAME ())
   412         handle SAME () =>
   413                {delta = 0, epsilon = card, exclusive = false, total = false}
   414       else if card = sum_dom_cards (card + 1) then
   415         let val delta = next_delta () in
   416           {delta = delta, epsilon = delta + domain_card card card_assigns T,
   417            exclusive = true, total = true}
   418         end
   419       else
   420         {delta = 0, epsilon = card,
   421          exclusive = (num_self_recs + num_non_self_recs = 1), total = false}
   422   in
   423     {const = x, delta = delta, epsilon = epsilon, exclusive = exclusive,
   424      explicit_max = max, total = total} :: constrs
   425   end
   426 
   427 fun has_exact_card hol_ctxt facto finitizable_dataTs card_assigns T =
   428   let val card = card_of_type card_assigns T in
   429     card = bounded_exact_card_of_type hol_ctxt
   430                (if facto then finitizable_dataTs else []) (card + 1) 0
   431                card_assigns T
   432   end
   433 
   434 fun datatype_spec_from_scope_descriptor (hol_ctxt as {ctxt, ...})
   435         binarize deep_dataTs finitizable_dataTs (desc as (card_assigns, _))
   436         (T, card) =
   437   let
   438     val deep = member (op =) deep_dataTs T
   439     val co = is_codatatype ctxt T
   440     val xs = binarized_and_boxed_datatype_constrs hol_ctxt binarize T
   441     val self_recs = map (is_self_recursive_constr_type o snd) xs
   442     val (num_self_recs, num_non_self_recs) =
   443       List.partition I self_recs |> pairself length
   444     val self_rec = num_self_recs > 0
   445     fun is_complete facto =
   446       has_exact_card hol_ctxt facto finitizable_dataTs card_assigns T
   447     fun is_concrete facto =
   448       is_word_type T orelse
   449       (* FIXME: looks wrong; other types than just functions might be
   450          abstract. "is_complete" is also suspicious. *)
   451       xs |> maps (binder_types o snd) |> maps binder_types
   452          |> forall (has_exact_card hol_ctxt facto finitizable_dataTs
   453                                    card_assigns)
   454     val complete = pair_from_fun is_complete
   455     val concrete = pair_from_fun is_concrete
   456     fun sum_dom_cards max =
   457       map (domain_card max card_assigns o snd) xs |> Integer.sum
   458     val constrs =
   459       fold_rev (add_constr_spec desc (not co) card sum_dom_cards num_self_recs
   460                                 num_non_self_recs)
   461                (sort (bool_ord o swap o pairself fst) (self_recs ~~ xs)) []
   462   in
   463     {typ = T, card = card, co = co, self_rec = self_rec, complete = complete,
   464      concrete = concrete, deep = deep, constrs = constrs}
   465   end
   466 
   467 fun scope_from_descriptor (hol_ctxt as {ctxt, ...}) binarize deep_dataTs
   468                           finitizable_dataTs (desc as (card_assigns, _)) =
   469   let
   470     val datatypes =
   471       map (datatype_spec_from_scope_descriptor hol_ctxt binarize deep_dataTs
   472                                                finitizable_dataTs desc)
   473           (filter (is_datatype ctxt o fst) card_assigns)
   474     val bits = card_of_type card_assigns @{typ signed_bit} - 1
   475                handle TYPE ("Nitpick_HOL.card_of_type", _, _) =>
   476                       card_of_type card_assigns @{typ unsigned_bit}
   477                       handle TYPE ("Nitpick_HOL.card_of_type", _, _) => 0
   478     val bisim_depth = card_of_type card_assigns @{typ bisim_iterator} - 1
   479   in
   480     {hol_ctxt = hol_ctxt, binarize = binarize, card_assigns = card_assigns,
   481      datatypes = datatypes, bits = bits, bisim_depth = bisim_depth,
   482      ofs = offset_table_for_card_assigns datatypes card_assigns}
   483   end
   484 
   485 fun repair_cards_assigns_wrt_boxing_etc _ _ [] = []
   486   | repair_cards_assigns_wrt_boxing_etc thy Ts ((SOME T, ks) :: cards_assigns) =
   487     (if is_fun_type T orelse is_pair_type T then
   488        Ts |> filter (curry (type_match thy o swap) T) |> map (rpair ks o SOME)
   489      else
   490        [(SOME T, ks)]) @
   491        repair_cards_assigns_wrt_boxing_etc thy Ts cards_assigns
   492   | repair_cards_assigns_wrt_boxing_etc thy Ts ((NONE, ks) :: cards_assigns) =
   493     (NONE, ks) :: repair_cards_assigns_wrt_boxing_etc thy Ts cards_assigns
   494 
   495 val max_scopes = 5000
   496 val distinct_threshold = 1000
   497 
   498 fun all_scopes (hol_ctxt as {thy, ...}) binarize cards_assigns maxes_assigns
   499                iters_assigns bitss bisim_depths mono_Ts nonmono_Ts deep_dataTs
   500                finitizable_dataTs =
   501   let
   502     val cards_assigns =
   503       repair_cards_assigns_wrt_boxing_etc thy mono_Ts cards_assigns
   504     val blocks =
   505       blocks_for_types hol_ctxt binarize cards_assigns maxes_assigns
   506                        iters_assigns bitss bisim_depths mono_Ts nonmono_Ts
   507     val ranks = map rank_of_block blocks
   508     val all = all_combinations_ordered_smartly (map (rpair 0) ranks)
   509     val head = take max_scopes all
   510     val descs =
   511       map_filter (scope_descriptor_from_combination hol_ctxt binarize blocks)
   512                  head
   513   in
   514     (length all - length head,
   515      descs |> length descs <= distinct_threshold ? distinct (op =)
   516            |> map (scope_from_descriptor hol_ctxt binarize deep_dataTs
   517                                          finitizable_dataTs))
   518   end
   519 
   520 end;