src/HOL/Tools/datatype_rep_proofs.ML
changeset 18314 4595eb4627fa
parent 17985 d5d576b72371
child 18330 444f16d232a2
equal deleted inserted replaced
18313:e61d2424863d 18314:4595eb4627fa
    14 signature DATATYPE_REP_PROOFS =
    14 signature DATATYPE_REP_PROOFS =
    15 sig
    15 sig
    16   val representation_proofs : bool -> DatatypeAux.datatype_info Symtab.table ->
    16   val representation_proofs : bool -> DatatypeAux.datatype_info Symtab.table ->
    17     string list -> DatatypeAux.descr list -> (string * sort) list ->
    17     string list -> DatatypeAux.descr list -> (string * sort) list ->
    18       (string * mixfix) list -> (string * mixfix) list list -> theory attribute
    18       (string * mixfix) list -> (string * mixfix) list list -> theory attribute
    19         -> theory -> theory * thm list list * thm list list * thm list list *
    19         -> theory -> (thm list list * thm list list * thm list list *
    20           DatatypeAux.simproc_dist list * thm
    20           DatatypeAux.simproc_dist list * thm) * theory
    21 end;
    21 end;
    22 
    22 
    23 structure DatatypeRepProofs : DATATYPE_REP_PROOFS =
    23 structure DatatypeRepProofs : DATATYPE_REP_PROOFS =
    24 struct
    24 struct
    25 
    25 
   575       end;
   575       end;
   576 
   576 
   577     val constr_inject = map (fn (ts, thms) => map (prove_constr_inj_thm thms) ts)
   577     val constr_inject = map (fn (ts, thms) => map (prove_constr_inj_thm thms) ts)
   578       ((DatatypeProp.make_injs descr sorts) ~~ constr_rep_thms);
   578       ((DatatypeProp.make_injs descr sorts) ~~ constr_rep_thms);
   579 
   579 
   580     val (thy6, (constr_inject', distinct_thms'))= thy5 |> parent_path flat_names |>
   580     val ((constr_inject', distinct_thms'), thy6) =
   581       store_thmss "inject" new_type_names constr_inject |>>>
   581       thy5
   582       store_thmss "distinct" new_type_names distinct_thms;
   582       |> parent_path flat_names
       
   583       |> store_thmss "inject" new_type_names constr_inject
       
   584       ||>> store_thmss "distinct" new_type_names distinct_thms;
   583 
   585 
   584     (*************************** induction theorem ****************************)
   586     (*************************** induction theorem ****************************)
   585 
   587 
   586     val _ = message "Proving induction rule for datatypes ...";
   588     val _ = message "Proving induction rule for datatypes ...";
   587 
   589 
   640     val (thy7, [dt_induct']) = thy6 |>
   642     val (thy7, [dt_induct']) = thy6 |>
   641       Theory.add_path big_name |>
   643       Theory.add_path big_name |>
   642       PureThy.add_thms [(("induct", dt_induct), [case_names_induct])] |>>
   644       PureThy.add_thms [(("induct", dt_induct), [case_names_induct])] |>>
   643       Theory.parent_path;
   645       Theory.parent_path;
   644 
   646 
   645   in (thy7, constr_inject', distinct_thms', dist_rewrites, simproc_dists, dt_induct')
   647   in
       
   648     ((constr_inject', distinct_thms', dist_rewrites, simproc_dists, dt_induct'), thy7)
   646   end;
   649   end;
   647 
   650 
   648 end;
   651 end;