src/HOL/Tools/Nitpick/nitpick_model.ML
changeset 33558 a2db56854b83
parent 33232 f93390060bbe
child 33565 5fad8e36dfb1
equal deleted inserted replaced
33557:107f3df799f6 33558:a2db56854b83
   327           HOLogic.mk_number nat_T (card_of_type card_assigns T - j - 1)
   327           HOLogic.mk_number nat_T (card_of_type card_assigns T - j - 1)
   328         else if T = @{typ bisim_iterator} then
   328         else if T = @{typ bisim_iterator} then
   329           HOLogic.mk_number nat_T j
   329           HOLogic.mk_number nat_T j
   330         else case datatype_spec datatypes T of
   330         else case datatype_spec datatypes T of
   331           NONE => atom for_auto T j
   331           NONE => atom for_auto T j
   332         | SOME {constrs, co, ...} =>
   332         | SOME {shallow = true, ...} => atom for_auto T j
       
   333         | SOME {co, constrs, ...} =>
   333           let
   334           let
   334             (* styp -> int list *)
   335             (* styp -> int list *)
   335             fun tuples_for_const (s, T) =
   336             fun tuples_for_const (s, T) =
   336               tuple_list_for_name rel_table bounds (ConstName (s, T, Any))
   337               tuple_list_for_name rel_table bounds (ConstName (s, T, Any))
   337             (* unit -> indexname * typ *)
   338             (* unit -> indexname * typ *)
   598                     (index_seq 0 card) @
   599                     (index_seq 0 card) @
   599                 (if precise then [] else [Pretty.str unrep]))])
   600                 (if precise then [] else [Pretty.str unrep]))])
   600     (* typ -> dtype_spec list *)
   601     (* typ -> dtype_spec list *)
   601     fun integer_datatype T =
   602     fun integer_datatype T =
   602       [{typ = T, card = card_of_type card_assigns T, co = false,
   603       [{typ = T, card = card_of_type card_assigns T, co = false,
   603         precise = false, constrs = []}]
   604         precise = false, shallow = false, constrs = []}]
   604       handle TYPE ("Nitpick_HOL.card_of_type", _, _) => []
   605       handle TYPE ("Nitpick_HOL.card_of_type", _, _) => []
   605     val (codatatypes, datatypes) =
   606     val (codatatypes, datatypes) =
   606       List.partition #co datatypes
   607       datatypes |> filter_out #shallow
   607       ||> append (integer_datatype nat_T @ integer_datatype int_T)
   608                 |> List.partition #co
       
   609                 ||> append (integer_datatype nat_T @ integer_datatype int_T)
   608     val block_of_datatypes =
   610     val block_of_datatypes =
   609       if show_datatypes andalso not (null datatypes) then
   611       if show_datatypes andalso not (null datatypes) then
   610         [Pretty.big_list ("Datatype" ^ plural_s_for_list datatypes ^ ":")
   612         [Pretty.big_list ("Datatype" ^ plural_s_for_list datatypes ^ ":")
   611                          (map pretty_for_datatype datatypes)]
   613                          (map pretty_for_datatype datatypes)]
   612       else
   614       else