src/HOL/Tools/Function/induction_schema.ML
changeset 59627 bb1e4a35d506
parent 59621 291934bac95e
child 59970 e9f73d87d904
equal deleted inserted replaced
59626:a6e977d8b070 59627:bb1e4a35d506
    43 fun meta thm = thm RS eq_reflection
    43 fun meta thm = thm RS eq_reflection
    44 
    44 
    45 fun sum_prod_conv ctxt = Raw_Simplifier.rewrite ctxt true
    45 fun sum_prod_conv ctxt = Raw_Simplifier.rewrite ctxt true
    46   (map meta (@{thm split_conv} :: @{thms sum.case}))
    46   (map meta (@{thm split_conv} :: @{thms sum.case}))
    47 
    47 
    48 fun term_conv thy cv t =
    48 fun term_conv ctxt cv t =
    49   cv (Thm.global_cterm_of thy t)
    49   cv (Thm.cterm_of ctxt t)
    50   |> Thm.prop_of |> Logic.dest_equals |> snd
    50   |> Thm.prop_of |> Logic.dest_equals |> snd
    51 
    51 
    52 fun mk_relT T = HOLogic.mk_setT (HOLogic.mk_prodT (T, T))
    52 fun mk_relT T = HOLogic.mk_setT (HOLogic.mk_prodT (T, T))
    53 
    53 
    54 fun dest_hhf ctxt t =
    54 fun dest_hhf ctxt t =
   192 
   192 
   193     fun brnch (SchemeBranch { P, xs, ws, Cs, ... }) =
   193     fun brnch (SchemeBranch { P, xs, ws, Cs, ... }) =
   194       HOLogic.mk_Trueprop (list_comb (P, map Free xs))
   194       HOLogic.mk_Trueprop (list_comb (P, map Free xs))
   195       |> fold_rev (curry Logic.mk_implies) Cs
   195       |> fold_rev (curry Logic.mk_implies) Cs
   196       |> fold_rev (Logic.all o Free) ws
   196       |> fold_rev (Logic.all o Free) ws
   197       |> term_conv thy (ind_atomize ctxt)
   197       |> term_conv ctxt (ind_atomize ctxt)
   198       |> Object_Logic.drop_judgment thy
   198       |> Object_Logic.drop_judgment thy
   199       |> HOLogic.tupled_lambda (foldr1 HOLogic.mk_prod (map Free xs))
   199       |> HOLogic.tupled_lambda (foldr1 HOLogic.mk_prod (map Free xs))
   200   in
   200   in
   201     Sum_Tree.mk_sumcases HOLogic.boolT (map brnch branches)
   201     Sum_Tree.mk_sumcases HOLogic.boolT (map brnch branches)
   202   end
   202   end