src/HOL/Tools/BNF/bnf_fp_def_sugar.ML
changeset 58472 4d00caa0e4d7
parent 58462 b46874f2090f
child 58507 ce0b9be06f85
equal deleted inserted replaced
58469:66ddc5ad4f63 58472:4d00caa0e4d7
  1122   end;
  1122   end;
  1123 
  1123 
  1124 fun postproc_co_induct lthy nn prop prop_conj =
  1124 fun postproc_co_induct lthy nn prop prop_conj =
  1125   Drule.zero_var_indexes
  1125   Drule.zero_var_indexes
  1126   #> `(conj_dests nn)
  1126   #> `(conj_dests nn)
  1127   #>> map (fn thm => Thm.permute_prems 0 (~1) (thm RS prop))
  1127   #>> map (fn thm => Thm.permute_prems 0 ~1 (thm RS prop))
  1128   ##> (fn thm => Thm.permute_prems 0 (~nn)
  1128   ##> (fn thm => Thm.permute_prems 0 (~ nn)
  1129     (if nn = 1 then thm RS prop
  1129     (if nn = 1 then thm RS prop
  1130      else funpow nn (fn thm => unfold_thms lthy @{thms conj_assoc} (thm RS prop_conj)) thm));
  1130      else funpow nn (fn thm => unfold_thms lthy @{thms conj_assoc} (thm RS prop_conj)) thm));
  1131 
  1131 
  1132 fun mk_induct_attrs ctrss =
  1132 fun mk_induct_attrs ctrss =
  1133   let
  1133   let
  1522       in
  1522       in
  1523         (thm, case_names_attr :: induct_set_attrs)
  1523         (thm, case_names_attr :: induct_set_attrs)
  1524       end
  1524       end
  1525     val consumes_attr = Attrib.internal (K (Rule_Cases.consumes 1));
  1525     val consumes_attr = Attrib.internal (K (Rule_Cases.consumes 1));
  1526   in
  1526   in
  1527     map (fn Asets =>
  1527     map (mk_thm lthy fpTs ctrss
  1528       let
  1528         #> nn = 1 ? map_prod (fn thm => rotate_prems ~1 (thm RS bspec)) (cons consumes_attr))
  1529         fun massage_thm thm = rotate_prems (~1) (thm RS bspec);
  1529       (transpose setss)
  1530       in
       
  1531         mk_thm lthy fpTs ctrss Asets |> nn = 1 ? map_prod massage_thm (cons consumes_attr)
       
  1532       end) (transpose setss)
       
  1533   end;
  1530   end;
  1534 
  1531 
  1535 fun derive_coinduct_corecs_thms_for_types pre_bnfs (x, cs, cpss, (((pgss, _, _, _), cqgsss), _))
  1532 fun derive_coinduct_corecs_thms_for_types pre_bnfs (x, cs, cpss, (((pgss, _, _, _), cqgsss), _))
  1536     dtor_coinduct dtor_injects dtor_ctors dtor_corec_thms live_nesting_bnfs fpTs Cs Xs ctrXs_Tsss
  1533     dtor_coinduct dtor_injects dtor_ctors dtor_corec_thms live_nesting_bnfs fpTs Cs Xs ctrXs_Tsss
  1537     kss mss ns fp_abs_inverses abs_inverses mk_vimage2p ctr_defss (ctr_sugars : ctr_sugar list)
  1534     kss mss ns fp_abs_inverses abs_inverses mk_vimage2p ctr_defss (ctr_sugars : ctr_sugar list)