Commit ccfd1bce authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Stop as soon we reach each goal state [s'] from at least one of the

entry states.
parent c98db5fe
...@@ -320,22 +320,34 @@ module G = ...@@ -320,22 +320,34 @@ module G =
let backward s : Q.t -> property = let backward s : Q.t -> property =
G.lfp (backward s) G.lfp (backward s)
let backward s s' : property = let backward s' : property =
(* Compute which states can reach the goal state [s']. *) (* Compute which states can reach the goal state [s']. *)
let relevant = Lr1.reverse_dfs s' in let relevant = Lr1.reverse_dfs s' in
(* If [s] cannot reach [s'], there is no need to look for a path. *) (* Iterate over all possible start states. *)
if not (relevant s) then Lr1.fold_entry (fun _ s _ _ accu ->
P.bottom
else (* If [s] cannot reach [s'], there is no need to look for a path. *)
foreach_terminal_until_finite (fun z -> if not (relevant s) then
if causes_an_error s z then accu
P.add (backward s (s', z)) (P.singleton z)
else else
P.bottom P.until_finite accu (lazy (
)
Printf.fprintf stderr
"Attempting to go from state %d to an error in state %d:\n%!"
(Lr1.number s) (Lr1.number s');
foreach_terminal_until_finite (fun z ->
if causes_an_error s z then
P.add (backward s (s', z)) (P.singleton z)
else
P.bottom
)
))
) P.bottom
(* Test. *) (* Test. *)
(* TEMPORARY ne marche que s'il y a un seul point d'entr'ee. (* TEMPORARY ne marche que s'il y a un seul point d'entr'ee.
...@@ -344,11 +356,7 @@ let backward s s' : property = ...@@ -344,11 +356,7 @@ let backward s s' : property =
let () = let () =
Lr1.iter (fun s' -> Lr1.iter (fun s' ->
Lr1.fold_entry (fun _ s _ _ () -> let p = backward s' in
Printf.fprintf stderr "Attempting to go from state %d to an error in state %d:\n%!" Printf.fprintf stderr "%s\n%!" (P.print Terminal.print p);
(Lr1.number s) (Lr1.number s'); Printf.fprintf stderr "Questions asked so far: %d\n" !qs
let p = backward s s' in
Printf.fprintf stderr "%s\n%!" (P.print Terminal.print p);
Printf.fprintf stderr "Questions asked so far: %d\n" !qs
) ()
) )
Supports Markdown
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