Skip to content
Snippets Groups Projects
Commit 180e9524 authored by Allan Blanchard's avatar Allan Blanchard
Browse files

[WP] Improve Conditions.subst doc and fixes usages

parent e7c5bea4
No related branches found
No related tags found
No related merge requests found
...@@ -85,7 +85,11 @@ let t_range e a b ~upper ~lower ~range s = ...@@ -85,7 +85,11 @@ let t_range e a b ~upper ~lower ~range s =
] ]
let t_replace ?(equal="equal") ~src ~tgt (pi : Tactical.process) s = let t_replace ?(equal="equal") ~src ~tgt (pi : Tactical.process) s =
let s' = Conditions.subst (fun e -> if e == src then tgt else e) s in let s' =
Conditions.subst
(fun e -> if e == src then tgt else raise Not_found)
s
in
(equal , (fst s, p_equal src tgt)) :: (pi s') (equal , (fst s, p_equal src tgt)) :: (pi s')
(* -------------------------------------------------------------------------- *) (* -------------------------------------------------------------------------- *)
......
...@@ -134,6 +134,7 @@ val subst : (term -> term) -> sequent -> sequent ...@@ -134,6 +134,7 @@ val subst : (term -> term) -> sequent -> sequent
Function [f] should only transform the head of the predicate, and can assume Function [f] should only transform the head of the predicate, and can assume
its sub-terms have been already substituted. The atomic substitution is also applied its sub-terms have been already substituted. The atomic substitution is also applied
to predicates. to predicates.
[f] should raise [Not_found] on terms that must not be replaced
*) *)
val introduction : sequent -> sequent option val introduction : sequent -> sequent option
......
...@@ -48,7 +48,7 @@ class overflow = ...@@ -48,7 +48,7 @@ class overflow =
"In-Range", (hs , cond) ; "In-Range", (hs , cond) ;
"No-Overflow" , "No-Overflow" ,
Conditions.subst Conditions.subst
(fun u -> if u == e then v else u) (fun u -> if u == e then v else raise Not_found)
(hs , F.p_imply cond g) (hs , F.p_imply cond g)
]) ])
| _ -> Not_applicable | _ -> Not_applicable
......
...@@ -366,7 +366,7 @@ let rewrite ?at patterns sequent = ...@@ -366,7 +366,7 @@ let rewrite ?at patterns sequent =
(fun (descr,guard,src,tgt) -> (fun (descr,guard,src,tgt) ->
let sequent = let sequent =
Conditions.subst Conditions.subst
(fun e -> if e == src then tgt else e) (fun e -> if e == src then tgt else raise Not_found)
sequent in sequent in
let step = Conditions.(step ~descr (When guard)) in let step = Conditions.(step ~descr (When guard)) in
descr , Conditions.insert ?at step sequent descr , Conditions.insert ?at step sequent
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment