Skip to content
Snippets Groups Projects
Commit 7f439124 authored by Michele Alberti's avatar Michele Alberti
Browse files

[PyRAT] Avoid task split and use pyrat full capability to handle logical operators.

parent 06b3af48
No related branches found
No related tags found
No related merge requests found
...@@ -24,9 +24,10 @@ let number_format = ...@@ -24,9 +24,10 @@ let number_format =
Why3.Number.frac_real_support = `Unsupported (fun _ _ -> assert false); Why3.Number.frac_real_support = `Unsupported (fun _ _ -> assert false);
} }
let rec print_term info fmt t = let rec print_base_term info fmt t =
let open Why3 in let open Why3 in
match t.Term.t_node with match t.Term.t_node with
| Tbinop ((Tand | Tor), _, _) -> assert false
| Tbinop ((Timplies | Tiff), _, _) | Tbinop ((Timplies | Tiff), _, _)
| Tnot _ | Ttrue | Tfalse | Tvar _ | Tlet _ | Tif _ | Tcase _ | Tquant _ | Tnot _ | Ttrue | Tfalse | Tvar _ | Tlet _ | Tif _ | Tcase _ | Tquant _
| Teps _ -> | Teps _ ->
...@@ -34,17 +35,13 @@ let rec print_term info fmt t = ...@@ -34,17 +35,13 @@ let rec print_term info fmt t =
| Tconst c -> Constant.(print number_format unsupported_escape) fmt c | Tconst c -> Constant.(print number_format unsupported_escape) fmt c
| Tapp (ls, l) -> ( | Tapp (ls, l) -> (
match Printer.query_syntax info.info_syn ls.ls_name with match Printer.query_syntax info.info_syn ls.ls_name with
| Some s -> Printer.syntax_arguments s (print_term info) fmt l | Some s -> Printer.syntax_arguments s (print_base_term info) fmt l
| None -> ( | None -> (
match (Term.Hls.find_opt info.variables ls, l) with match (Term.Hls.find_opt info.variables ls, l) with
| Some s, [] -> Fmt.string fmt s | Some s, [] -> Fmt.string fmt s
| _ -> Printer.unsupportedTerm t "Unknown variable(s)")) | _ -> Printer.unsupportedTerm t "Unknown variable(s)"))
| Tbinop (Tand, _, _) ->
Printer.unsupportedTerm t "Unexpected conjunction not at top-level"
| Tbinop (Tor, t1, t2) ->
Fmt.pf fmt "%a or %a" (print_term info) t1 (print_term info) t2
let rec print_top_level_term info fmt t = let rec print_term ?(nested = false) info fmt t =
let open Why3 in let open Why3 in
(* Don't print things we don't know. *) (* Don't print things we don't know. *)
let t_is_known = let t_is_known =
...@@ -55,15 +52,22 @@ let rec print_top_level_term info fmt t = ...@@ -55,15 +52,22 @@ let rec print_top_level_term info fmt t =
in in
match t.Term.t_node with match t.Term.t_node with
| Tquant _ -> () | Tquant _ -> ()
| Tbinop (Tand, t1, t2) -> | Tbinop (((Tand | Tor) as lop), t1, t2) ->
if t_is_known t1 && t_is_known t2 if t_is_known t1 && t_is_known t2
then then
Fmt.pf fmt "%a%a" let nested = true in
(print_top_level_term info) let psx, lop, pdx =
t1 match lop with
(print_top_level_term info) | Tand -> ("", "and", "")
t2 | Tor -> ("(", "or", ")")
| _ -> if t_is_known t then Fmt.pf fmt "%a@." (print_term info) t | _ -> assert false
in
Fmt.pf fmt "%s%a %s %a%s" psx (print_term ~nested info) t1 lop
(print_term ~nested info) t2 pdx
| _ ->
if t_is_known t
then
Fmt.pf fmt "%a%(%)" (print_base_term info) t (if nested then "" else "@.")
let print_decl info fmt d = let print_decl info fmt d =
let open Why3 in let open Why3 in
...@@ -74,8 +78,8 @@ let print_decl info fmt d = ...@@ -74,8 +78,8 @@ let print_decl info fmt d =
| Dlogic _ -> () | Dlogic _ -> ()
| Dind _ -> () | Dind _ -> ()
| Dprop (Decl.Plemma, _, _) -> assert false | Dprop (Decl.Plemma, _, _) -> assert false
| Dprop (Decl.Paxiom, _, f) -> print_top_level_term info fmt f | Dprop (Decl.Paxiom, _, f) -> print_term info fmt f
| Dprop (Decl.Pgoal, _, f) -> print_top_level_term info fmt f | Dprop (Decl.Pgoal, _, f) -> print_term info fmt f
let rec print_tdecl info fmt task = let rec print_tdecl info fmt task =
let open Why3 in let open Why3 in
......
...@@ -42,7 +42,9 @@ let call_prover ~limit (prover : Why3.Whyconf.config_prover) driver task = ...@@ -42,7 +42,9 @@ let call_prover ~limit (prover : Why3.Whyconf.config_prover) driver task =
let task_prepared = Driver.prepare_task driver task in let task_prepared = Driver.prepare_task driver task in
let tasks = let tasks =
(* We make [tasks] as a list (ie, conjunction) of disjunctions. *) (* We make [tasks] as a list (ie, conjunction) of disjunctions. *)
Trans.apply Split_goal.split_goal_full task_prepared if String.equal prover.prover.prover_name "Marabou"
then Trans.apply Split_goal.split_goal_full task_prepared
else [ task_prepared ]
in in
let command = Whyconf.get_complete_command ~with_steps:false prover in let command = Whyconf.get_complete_command ~with_steps:false prover in
let nn_file = let nn_file =
......
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