src/HOL/Tools/BNF/bnf_fp_def_sugar.ML
changeset 59859 f9d1442c70f3
parent 59819 dbec7f33093d
child 59877 a04ea4709c8d
equal deleted inserted replaced
59858:890b68e1e8b6 59859:f9d1442c70f3
  1216 fun define_co_rec_as fp Cs fpT b rhs lthy0 =
  1216 fun define_co_rec_as fp Cs fpT b rhs lthy0 =
  1217   let
  1217   let
  1218     val thy = Proof_Context.theory_of lthy0;
  1218     val thy = Proof_Context.theory_of lthy0;
  1219 
  1219 
  1220     val maybe_conceal_def_binding = Thm.def_binding
  1220     val maybe_conceal_def_binding = Thm.def_binding
  1221       #> not (Config.get lthy0 bnf_note_all) ? Binding.conceal;
  1221       #> not (Config.get lthy0 bnf_note_all) ? Binding.concealed;
  1222 
  1222 
  1223     val ((cst, (_, def)), (lthy', lthy)) = lthy0
  1223     val ((cst, (_, def)), (lthy', lthy)) = lthy0
  1224       |> Local_Theory.define ((b, NoSyn), ((maybe_conceal_def_binding b, []), rhs))
  1224       |> Local_Theory.define ((b, NoSyn), ((maybe_conceal_def_binding b, []), rhs))
  1225       ||> `Local_Theory.restore;
  1225       ||> `Local_Theory.restore;
  1226 
  1226 
  2113         val ctr_rhss =
  2113         val ctr_rhss =
  2114           map2 (fn k => fn xs => fold_rev Term.lambda xs (ctor $ mk_absumprod ctr_absT abs n k xs))
  2114           map2 (fn k => fn xs => fold_rev Term.lambda xs (ctor $ mk_absumprod ctr_absT abs n k xs))
  2115             ks xss;
  2115             ks xss;
  2116 
  2116 
  2117         val maybe_conceal_def_binding = Thm.def_binding
  2117         val maybe_conceal_def_binding = Thm.def_binding
  2118           #> not (Config.get no_defs_lthy bnf_note_all) ? Binding.conceal;
  2118           #> not (Config.get no_defs_lthy bnf_note_all) ? Binding.concealed;
  2119 
  2119 
  2120         val ((raw_ctrs, raw_ctr_defs), (lthy', lthy)) = no_defs_lthy
  2120         val ((raw_ctrs, raw_ctr_defs), (lthy', lthy)) = no_defs_lthy
  2121           |> apfst split_list o @{fold_map 3} (fn b => fn mx => fn rhs =>
  2121           |> apfst split_list o @{fold_map 3} (fn b => fn mx => fn rhs =>
  2122               Local_Theory.define ((b, mx), ((maybe_conceal_def_binding b, []), rhs)) #>> apsnd snd)
  2122               Local_Theory.define ((b, mx), ((maybe_conceal_def_binding b, []), rhs)) #>> apsnd snd)
  2123             ctr_bindings ctr_mixfixes ctr_rhss
  2123             ctr_bindings ctr_mixfixes ctr_rhss