Skip to content

Commit 010d25f

Browse files
author
Jérôme FERET
committed
Associativity of or and and, when pretty-printing formula
1 parent ed9f6dd commit 010d25f

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

core/KaSa_rep/abstract_domains/mvbdu/logical_formulae.ml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,34 +57,36 @@ let rec print parameter error string_of formula =
5757
error
5858
| NOT x ->
5959
let () = Loggers.fprintf (Remanent_parameters.get_logger parameter) "~" in
60-
print_arg parameter error string_of x
60+
print_arg parameter error string_of False x
6161
| OR (x1, x2) ->
62-
let error = print_arg parameter error string_of x1 in
62+
let error = print_arg parameter error string_of (OR (P (),P ())) x1 in
6363
let () =
6464
Loggers.fprintf (Remanent_parameters.get_logger parameter) ".or."
6565
in
66-
print_arg parameter error string_of x2
66+
print_arg parameter error string_of (OR (P (),P ())) x2
6767
| AND (x1, x2) ->
68-
let error = print_arg parameter error string_of x1 in
68+
let error = print_arg parameter error string_of (AND(P (),P())) x1 in
6969
let () =
7070
Loggers.fprintf (Remanent_parameters.get_logger parameter) ".and."
7171
in
72-
print_arg parameter error string_of x2
72+
print_arg parameter error string_of (AND(P (),P ())) x2
7373
| IMPLY (x1, x2) ->
74-
let error = print_arg parameter error string_of x1 in
74+
let error = print_arg parameter error string_of False x1 in
7575
let () = Loggers.fprintf (Remanent_parameters.get_logger parameter) "=>" in
76-
print_arg parameter error string_of x2
76+
print_arg parameter error string_of False x2
7777
| True ->
7878
let () = Loggers.fprintf (Remanent_parameters.get_logger parameter) ".T." in
7979
error
8080
| False ->
8181
let () = Loggers.fprintf (Remanent_parameters.get_logger parameter) ".F." in
8282
error
8383

84-
and print_arg parameter error string_of formula =
85-
match formula with
86-
| P _ | True | False -> print parameter error string_of formula
87-
| NOT _ | OR (_, _) | AND (_, _) | IMPLY (_, _) ->
84+
and print_arg parameter error string_of scheme formula =
85+
match (formula, scheme) with
86+
| (P _ | True | False), _ -> print parameter error string_of formula
87+
| OR(_,_), OR(_,_) -> print parameter error string_of formula
88+
| AND(_,_), AND(_,_) -> print parameter error string_of formula
89+
| (NOT _ | OR (_, _) | AND (_, _) | IMPLY (_, _)), _ ->
8890
let () = Loggers.fprintf (Remanent_parameters.get_logger parameter) "(" in
8991
let error = print parameter error string_of formula in
9092
let () = Loggers.fprintf (Remanent_parameters.get_logger parameter) ")" in

0 commit comments

Comments
 (0)