src/HOL/BNF/Tools/bnf_fp_rec_sugar_util.ML
changeset 53892 c54ebf9dbd34
parent 53891 27da6373a64f
child 53893 865da57dee93
equal deleted inserted replaced
53891:27da6373a64f 53892:c54ebf9dbd34
   369 
   369 
   370 fun expand_corec_code_rhs ctxt has_call bound_Ts t =
   370 fun expand_corec_code_rhs ctxt has_call bound_Ts t =
   371   (case fastype_of1 (bound_Ts, t) of
   371   (case fastype_of1 (bound_Ts, t) of
   372     Type (s, Ts) =>
   372     Type (s, Ts) =>
   373     massage_let_if_case ctxt has_call (fn bound_Ts => fn t =>
   373     massage_let_if_case ctxt has_call (fn bound_Ts => fn t =>
   374       if can (dest_ctr ctxt s) t then
   374       if can (dest_ctr ctxt s) t then t else expand_ctr_term ctxt s Ts t) bound_Ts t
   375         t
       
   376       else
       
   377         massage_let_if_case ctxt has_call (K I) bound_Ts (expand_ctr_term ctxt s Ts t)) bound_Ts t
       
   378   | _ => raise Fail "expand_corec_code_rhs");
   375   | _ => raise Fail "expand_corec_code_rhs");
   379 
   376 
   380 fun massage_corec_code_rhs ctxt massage_ctr =
   377 fun massage_corec_code_rhs ctxt massage_ctr =
   381   massage_let_if_case ctxt (K false)
   378   massage_let_if_case ctxt (K false)
   382     (fn bound_Ts => uncurry (massage_ctr bound_Ts) o Term.strip_comb);
   379     (fn bound_Ts => uncurry (massage_ctr bound_Ts) o Term.strip_comb);