Commit 5a245c24 authored by MARCHE Claude's avatar MARCHE Claude

Put transformations "subst" and "subst_all" in a separate file

Incidentally, move the local "fold" function of apply.ml into the general
module Trans
parent 3a3014de
......@@ -199,7 +199,7 @@ LIB_TRANSFORM = simplify_formula inlining split_goal \
intro_vc_vars_counterexmp prepare_for_counterexmp \
eval_match instantiate_predicate smoke_detector \
prop_curry \
generic_arg_trans_utils case apply \
generic_arg_trans_utils case apply subst \
ind_itp destruct cut \
eliminate_literal induction induction_pr
......
......@@ -101,6 +101,13 @@ let fold fn v =
let fold_l fn v = fold (fun task -> Lists.apply (fn task)) [v]
let fold_decl fn v =
fold (fun task v ->
match task.task_decl.td_node with
| Decl d -> fn d v
| _ -> v)
v
let fold_map fn v t = conv_res snd (fold fn (v, t))
let fold_map_l fn v t = conv_res (List.map snd) (fold_l fn (v, t))
(* we use List.map instead of List.map_rev to preserve the order *)
......
......@@ -52,6 +52,7 @@ val par : task trans list -> task tlist
(** {2 Iterating transformations} *)
val fold : (task_hd -> 'a -> 'a ) -> 'a -> 'a trans
val fold_l : (task_hd -> 'a -> 'a list) -> 'a -> 'a tlist
val fold_decl : (decl -> 'a -> 'a ) -> 'a -> 'a trans
val fold_map : (task_hd -> 'a * 'b -> ('a * 'b) ) -> 'a -> 'b -> 'b trans
val fold_map_l : (task_hd -> 'a * 'b -> ('a * 'b) list) -> 'a -> 'b -> 'b tlist
......
This diff is collapsed.
......@@ -117,7 +117,7 @@ let destruct_alg replace (x: term) : Task.task Trans.tlist =
| _ -> [[d]]) None
in
if replace && is_lsymbol x then
Trans.compose_l trans (Trans.singleton (Apply.subst [x]))
Trans.compose_l trans (Trans.singleton (Subst.subst [x]))
else
trans
end
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment