src/HOL/Tools/BNF/bnf_fp_def_sugar.ML
changeset 57890 1e13f63fb452
parent 57882 38bf4de248a6
child 57891 d23a85b59dec
equal deleted inserted replaced
57889:049e13f616d4 57890:1e13f63fb452
  1840             dtor_injects dtor_ctors xtor_co_rec_thms live_nesting_bnfs fpTs Cs Xs ctrXs_Tsss kss mss
  1840             dtor_injects dtor_ctors xtor_co_rec_thms live_nesting_bnfs fpTs Cs Xs ctrXs_Tsss kss mss
  1841             ns abs_inverses abs_inverses I ctr_defss ctr_sugars corecs corec_defs
  1841             ns abs_inverses abs_inverses I ctr_defss ctr_sugars corecs corec_defs
  1842             (Proof_Context.export lthy' no_defs_lthy) lthy;
  1842             (Proof_Context.export lthy' no_defs_lthy) lthy;
  1843 
  1843 
  1844         fun distinct_prems ctxt th =
  1844         fun distinct_prems ctxt th =
  1845           Goal.prove ctxt [] []
  1845           Goal.prove (*no sorry*) ctxt [] []
  1846             (th |> Thm.prop_of |> Logic.strip_horn |>> distinct (op aconv) |> Logic.list_implies)
  1846             (th |> Thm.prop_of |> Logic.strip_horn |>> distinct (op aconv) |> Logic.list_implies)
  1847             (fn _ => HEADGOAL (cut_tac th THEN' atac) THEN ALLGOALS eq_assume_tac);
  1847             (fn _ => HEADGOAL (cut_tac th THEN' atac) THEN ALLGOALS eq_assume_tac);
  1848 
  1848 
  1849         fun eq_ifIN _ [thm] = thm
  1849         fun eq_ifIN _ [thm] = thm
  1850           | eq_ifIN ctxt (thm :: thms) =
  1850           | eq_ifIN ctxt (thm :: thms) =
  1851               distinct_prems ctxt (@{thm eq_ifI} OF
  1851               distinct_prems ctxt (@{thm eq_ifI} OF
  1852                 (map (unfold_thms ctxt @{thms atomize_imp[of _ "t = u" for t u]})
  1852                 (map (unfold_thms ctxt @{thms atomize_imp[of _ "t = u" for t u]})
  1853                   [thm, eq_ifIN ctxt thms]));
  1853                   [thm, eq_ifIN ctxt thms]));
  1854 
  1854 
  1855         val corec_code_thms = map (eq_ifIN lthy) corec_thmss
  1855         val corec_code_thms = map (eq_ifIN lthy) corec_thmss;
  1856         val sel_corec_thmss = map flat sel_corec_thmsss;
  1856         val sel_corec_thmss = map flat sel_corec_thmsss;
  1857 
  1857 
  1858         val coinduct_type_attr = Attrib.internal o K o Induct.coinduct_type;
  1858         val coinduct_type_attr = Attrib.internal o K o Induct.coinduct_type;
  1859         val coinduct_pred_attr = Attrib.internal o K o Induct.coinduct_pred;
  1859         val coinduct_pred_attr = Attrib.internal o K o Induct.coinduct_pred;
  1860 
  1860