let rec change_exp_in_pred do_exp quantif_do_exp p =
let subst_pred = change_exp_in_pred do_exp quantif_do_exp in
match p with
| Ptrue -> Ptrue
| Pfalse -> Pfalse
| Pvar v -> Pvar v
| Pif (t,p1,p2) ->
Pif (do_exp t, subst_pred p1, subst_pred p2)
| Pnot p -> pnot (subst_pred p)
| Pforall (v,p') ->
let f = do_exp in
Pforall (v,change_exp_in_pred f quantif_do_exp p')
| Pexists (v,p') ->
let f = do_exp in
Pexists (v,change_exp_in_pred f quantif_do_exp p')
| Plet (x,v,p) ->
let f = do_exp in
Plet (x, do_exp v,change_exp_in_pred f quantif_do_exp p)
| Pnamed (n,p) -> Pnamed (n,subst_pred p)
| Pimplies (p1,p2) -> pimplies (subst_pred p1,subst_pred p2)
| Pand (p1,p2) -> pand (subst_pred p1,subst_pred p2)
| Por (p1,p2) -> por (subst_pred p1,subst_pred p2)
| Pxor(p1,p2) -> pxor (subst_pred p1, subst_pred p2)
| Piff (p1,p2) -> piff (subst_pred p1,subst_pred p2)
| Papp (n,t) -> papp (n,List.map do_exp t)