src/HOL/Tools/Function/context_tree.ML
changeset 51717 9e7d1c139569
parent 44338 700008399ee5
child 55085 0e8e4dc55866
equal deleted inserted replaced
51709:19b47bfac6ef 51717:9e7d1c139569
    31    (ctxt * thm) list ->
    31    (ctxt * thm) list ->
    32    (ctxt * thm) list * 'b ->
    32    (ctxt * thm) list * 'b ->
    33    (ctxt * thm) list * 'b)
    33    (ctxt * thm) list * 'b)
    34    -> ctx_tree -> 'b -> 'b
    34    -> ctx_tree -> 'b -> 'b
    35 
    35 
    36   val rewrite_by_tree : theory -> term -> thm -> (thm * thm) list ->
    36   val rewrite_by_tree : Proof.context -> term -> thm -> (thm * thm) list ->
    37     ctx_tree -> thm * (thm * thm) list
    37     ctx_tree -> thm * (thm * thm) list
    38 end
    38 end
    39 
    39 
    40 structure Function_Ctx_Tree : FUNCTION_CTXTREE =
    40 structure Function_Ctx_Tree : FUNCTION_CTXTREE =
    41 struct
    41 struct
   238           end
   238           end
   239   in
   239   in
   240     snd o traverse_help ([], []) tr []
   240     snd o traverse_help ([], []) tr []
   241   end
   241   end
   242 
   242 
   243 fun rewrite_by_tree thy h ih x tr =
   243 fun rewrite_by_tree ctxt h ih x tr =
   244   let
   244   let
       
   245     val thy = Proof_Context.theory_of ctxt
   245     fun rewrite_help _ _ x (Leaf t) = (Thm.reflexive (cterm_of thy t), x)
   246     fun rewrite_help _ _ x (Leaf t) = (Thm.reflexive (cterm_of thy t), x)
   246       | rewrite_help fix h_as x (RCall (_ $ arg, st)) =
   247       | rewrite_help fix h_as x (RCall (_ $ arg, st)) =
   247         let
   248         let
   248           val (inner, (lRi,ha)::x') = rewrite_help fix h_as x st (* "a' = a" *)
   249           val (inner, (lRi,ha)::x') = rewrite_help fix h_as x st (* "a' = a" *)
   249 
   250 
   266               val ((fixes, assumes), st) = nth branches i
   267               val ((fixes, assumes), st) = nth branches i
   267               val used = map lu (Int_Graph.immediate_succs deps i)
   268               val used = map lu (Int_Graph.immediate_succs deps i)
   268                 |> map (fn u_eq => (u_eq RS sym) RS eq_reflection)
   269                 |> map (fn u_eq => (u_eq RS sym) RS eq_reflection)
   269                 |> filter_out Thm.is_reflexive
   270                 |> filter_out Thm.is_reflexive
   270 
   271 
   271               val assumes' = map (simplify (HOL_basic_ss addsimps used)) assumes
   272               val assumes' = map (simplify (put_simpset HOL_basic_ss  ctxt addsimps used)) assumes
   272 
   273 
   273               val (subeq, x') =
   274               val (subeq, x') =
   274                 rewrite_help (fix @ fixes) (h_as @ assumes') x st
   275                 rewrite_help (fix @ fixes) (h_as @ assumes') x st
   275               val subeq_exp =
   276               val subeq_exp =
   276                 export_thm thy (fixes, assumes) (subeq RS meta_eq_to_obj_eq)
   277                 export_thm thy (fixes, assumes) (subeq RS meta_eq_to_obj_eq)