src/HOL/Tools/BNF/bnf_fp_util.ML
changeset 59621 291934bac95e
parent 59582 0fbed69ff081
child 59642 929984c529d3
equal deleted inserted replaced
59620:92d7d8e4f1bf 59621:291934bac95e
   467     let
   467     let
   468       val (tfrees, _) = BNF_Util.mk_TFrees n @{context};
   468       val (tfrees, _) = BNF_Util.mk_TFrees n @{context};
   469       val T = mk_tupleT_balanced tfrees;
   469       val T = mk_tupleT_balanced tfrees;
   470     in
   470     in
   471       @{thm asm_rl[of "ALL x. P x --> Q x" for P Q]}
   471       @{thm asm_rl[of "ALL x. P x --> Q x" for P Q]}
   472       |> Drule.instantiate' [SOME (Thm.ctyp_of @{theory} T)] []
   472       |> Drule.instantiate' [SOME (Thm.global_ctyp_of @{theory} T)] []
   473       |> Raw_Simplifier.rewrite_goals_rule @{context} @{thms split_paired_All[THEN eq_reflection]}
   473       |> Raw_Simplifier.rewrite_goals_rule @{context} @{thms split_paired_All[THEN eq_reflection]}
   474       |> (fn thm => impI RS funpow n (fn th => allI RS th) thm)
   474       |> (fn thm => impI RS funpow n (fn th => allI RS th) thm)
   475       |> Thm.varifyT_global
   475       |> Thm.varifyT_global
   476     end;
   476     end;
   477 
   477 
   576 fun mk_coinduct_strong_thm coind rel_eqs rel_monos mk_vimage2p ctxt =
   576 fun mk_coinduct_strong_thm coind rel_eqs rel_monos mk_vimage2p ctxt =
   577   let
   577   let
   578     val n = Thm.nprems_of coind;
   578     val n = Thm.nprems_of coind;
   579     val m = Thm.nprems_of (hd rel_monos) - n;
   579     val m = Thm.nprems_of (hd rel_monos) - n;
   580     fun mk_inst phi = (phi, mk_union (phi, HOLogic.eq_const (fst (dest_pred2T (fastype_of phi)))))
   580     fun mk_inst phi = (phi, mk_union (phi, HOLogic.eq_const (fst (dest_pred2T (fastype_of phi)))))
   581       |> apply2 (Proof_Context.cterm_of ctxt);
   581       |> apply2 (Thm.cterm_of ctxt);
   582     val insts = Term.add_vars (Thm.prop_of coind) [] |> rev |> take n |> map (mk_inst o Var);
   582     val insts = Term.add_vars (Thm.prop_of coind) [] |> rev |> take n |> map (mk_inst o Var);
   583     fun mk_unfold rel_eq rel_mono =
   583     fun mk_unfold rel_eq rel_mono =
   584       let
   584       let
   585         val eq = iffD2 OF [rel_eq RS @{thm predicate2_eqD}, refl];
   585         val eq = iffD2 OF [rel_eq RS @{thm predicate2_eqD}, refl];
   586         val mono = rel_mono OF (replicate m @{thm order_refl} @ replicate n @{thm eq_subset});
   586         val mono = rel_mono OF (replicate m @{thm order_refl} @ replicate n @{thm eq_subset});