src/HOL/Tools/BNF/bnf_fp_def_sugar.ML
changeset 72154 2b41b710f6ef
parent 71214 5727bcc3c47c
child 72450 24bd1316eaae
equal deleted inserted replaced
72153:bdbd6ff5fd0b 72154:2b41b710f6ef
   661     val ctr_rhss =
   661     val ctr_rhss =
   662       map2 (fn k => fn xs => fold_rev Term.lambda xs (ctor $ mk_absumprod ctor_absT abs n k xs))
   662       map2 (fn k => fn xs => fold_rev Term.lambda xs (ctor $ mk_absumprod ctor_absT abs n k xs))
   663         ks xss;
   663         ks xss;
   664 
   664 
   665     val ((raw_ctrs, raw_ctr_defs), (lthy, lthy_old)) = lthy
   665     val ((raw_ctrs, raw_ctr_defs), (lthy, lthy_old)) = lthy
   666       |> Local_Theory.open_target |> snd
   666       |> Local_Theory.open_target
   667       |> apfst split_list o @{fold_map 3} (fn b => fn mx => fn rhs =>
   667       |> apfst split_list o @{fold_map 3} (fn b => fn mx => fn rhs =>
   668           Local_Theory.define ((b, mx),
   668           Local_Theory.define ((b, mx),
   669             ((Thm.make_def_binding (Config.get lthy bnf_internals) b, []), rhs))
   669             ((Thm.make_def_binding (Config.get lthy bnf_internals) b, []), rhs))
   670           #>> apsnd snd) ctr_bindings ctr_mixfixes ctr_rhss
   670           #>> apsnd snd) ctr_bindings ctr_mixfixes ctr_rhss
   671       ||> `Local_Theory.close_target;
   671       ||> `Local_Theory.close_target;
  1586 fun define_co_rec_as fp Cs fpT b rhs lthy0 =
  1586 fun define_co_rec_as fp Cs fpT b rhs lthy0 =
  1587   let
  1587   let
  1588     val thy = Proof_Context.theory_of lthy0;
  1588     val thy = Proof_Context.theory_of lthy0;
  1589 
  1589 
  1590     val ((cst, (_, def)), (lthy', lthy)) = lthy0
  1590     val ((cst, (_, def)), (lthy', lthy)) = lthy0
  1591       |> Local_Theory.open_target |> snd
  1591       |> Local_Theory.open_target
  1592       |> Local_Theory.define
  1592       |> Local_Theory.define
  1593           ((b, NoSyn), ((Thm.make_def_binding (Config.get lthy0 bnf_internals) b, []), rhs))
  1593           ((b, NoSyn), ((Thm.make_def_binding (Config.get lthy0 bnf_internals) b, []), rhs))
  1594       ||> `Local_Theory.close_target;
  1594       ||> `Local_Theory.close_target;
  1595 
  1595 
  1596     val phi = Proof_Context.export_morphism lthy lthy';
  1596     val phi = Proof_Context.export_morphism lthy lthy';