src/ZF/Tools/datatype_package.ML
changeset 29579 cb520b766e00
parent 28965 1de908189869
child 30190 479806475f3c
equal deleted inserted replaced
29578:8c4e961fcb08 29579:cb520b766e00
   245 
   245 
   246   fun add_recursor thy =
   246   fun add_recursor thy =
   247       if need_recursor then
   247       if need_recursor then
   248            thy |> Sign.add_consts_i
   248            thy |> Sign.add_consts_i
   249                     [(recursor_base_name, recursor_typ, NoSyn)]
   249                     [(recursor_base_name, recursor_typ, NoSyn)]
   250                |> (snd o PureThy.add_defs false [Thm.no_attributes recursor_def])
   250                |> (snd o PureThy.add_defs false [(Thm.no_attributes o apfst Binding.name) recursor_def])
   251       else thy;
   251       else thy;
   252 
   252 
   253   val (con_defs, thy0) = thy_path
   253   val (con_defs, thy0) = thy_path
   254              |> Sign.add_consts_i
   254              |> Sign.add_consts_i
   255                  ((case_base_name, case_typ, NoSyn) ::
   255                  ((case_base_name, case_typ, NoSyn) ::
   256                   map #1 (List.concat con_ty_lists))
   256                   map #1 (List.concat con_ty_lists))
   257              |> PureThy.add_defs false
   257              |> PureThy.add_defs false
   258                  (map Thm.no_attributes
   258                  (map (Thm.no_attributes o apfst Binding.name)
   259                   (case_def ::
   259                   (case_def ::
   260                    List.concat (ListPair.map mk_con_defs
   260                    List.concat (ListPair.map mk_con_defs
   261                          (1 upto npart, con_ty_lists))))
   261                          (1 upto npart, con_ty_lists))))
   262              ||> add_recursor
   262              ||> add_recursor
   263              ||> Sign.parent_path
   263              ||> Sign.parent_path
   381 
   381 
   382  in
   382  in
   383   (*Updating theory components: simprules and datatype info*)
   383   (*Updating theory components: simprules and datatype info*)
   384   (thy1 |> Sign.add_path big_rec_base_name
   384   (thy1 |> Sign.add_path big_rec_base_name
   385         |> PureThy.add_thmss
   385         |> PureThy.add_thmss
   386          [(("simps", simps), [Simplifier.simp_add]),
   386          [((Binding.name "simps", simps), [Simplifier.simp_add]),
   387           (("", intrs), [Classical.safe_intro NONE]),
   387           ((Binding.empty , intrs), [Classical.safe_intro NONE]),
   388           (("con_defs", con_defs), []),
   388           ((Binding.name "con_defs", con_defs), []),
   389           (("case_eqns", case_eqns), []),
   389           ((Binding.name "case_eqns", case_eqns), []),
   390           (("recursor_eqns", recursor_eqns), []),
   390           ((Binding.name "recursor_eqns", recursor_eqns), []),
   391           (("free_iffs", free_iffs), []),
   391           ((Binding.name "free_iffs", free_iffs), []),
   392           (("free_elims", free_SEs), [])] |> snd
   392           ((Binding.name "free_elims", free_SEs), [])] |> snd
   393         |> DatatypesData.map (Symtab.update (big_rec_name, dt_info))
   393         |> DatatypesData.map (Symtab.update (big_rec_name, dt_info))
   394         |> ConstructorsData.map (fold Symtab.update con_pairs)
   394         |> ConstructorsData.map (fold Symtab.update con_pairs)
   395         |> Sign.parent_path,
   395         |> Sign.parent_path,
   396    ind_result,
   396    ind_result,
   397    {con_defs = con_defs,
   397    {con_defs = con_defs,