[sledge] Refactor: pretty-printing of classes out of Ses to Fol

Reviewed By: jvillard

Differential Revision: D22381644

fbshipit-source-id: c5b487769
master
Josh Berdine 4 years ago committed by Facebook GitHub Bot
parent 58dae840d3
commit 8725d5fe81

@ -1183,23 +1183,19 @@ module Context = struct
let cls' = List.map ~f:of_ses cls in
Term.Map.set ~key:rep' ~data:cls' clss )
let classes_to_ses clss =
Term.Map.fold clss ~init:Ses.Term.Map.empty
~f:(fun ~key:rep ~data:cls clss ->
let rep' = to_ses rep in
let cls' = List.map ~f:to_ses cls in
Ses.Term.Map.set ~key:rep' ~data:cls' clss )
let classes x = classes_of_ses (Ses.Equality.classes x)
let diff_classes x y = classes_of_ses (Ses.Equality.diff_classes x y)
let pp = Ses.Equality.pp
let pp_classes = Ses.Equality.pp_classes
let ppx_cls x = List.pp "@ = " (Term.ppx x)
let ppx_classes x fs clss =
Ses.Equality.ppx_classes
(fun v -> x (v_of_ses v))
fs (classes_to_ses clss)
List.pp "@ @<2>∧ "
(fun fs (rep, cls) ->
Format.fprintf fs "@[%a@ = %a@]" (Term.ppx x) rep (ppx_cls x)
(List.sort ~compare:Term.compare cls) )
fs (Term.Map.to_alist clss)
let pp_classes fs r = ppx_classes (fun _ -> None) fs (classes r)
let invariant = Ses.Equality.invariant
let true_ = Ses.Equality.true_

@ -147,11 +147,13 @@ let%test_module _ =
pp q' ;
[%expect
{|
%x_6 . %x_6 = %x_6^ (%y_7 + -1) = %y_7^ emp
%x_6 . %x_6 = %x_6^ ((-1 × 1) + (1 × %y_7)) = %y_7^ emp
(%y_7 + -1) = %y_7^ (%y_7^ = ((-1 × 1) + (1 × %y_7))) emp
((-1 × 1) + (1 × %y_7)) = %y_7^
(%y_7^ = ((-1 × 1) + (1 × %y_7)))
emp
(%y_7 + -1) = %y_7^ emp |}]
((-1 × 1) + (1 × %y_7)) = %y_7^ emp |}]
let%expect_test _ =
let q =

@ -158,7 +158,7 @@ let%test_module _ =
\- %a_3, %m_8 .
%l_6 -[ %l_6, %m_8 )-> 16,%a_3
) infer_frame:
%a_2 = _ (8,%a_1^8,%a_2) = %a_3 16 = %m_8 emp |}]
%a_2 = _ 16 = %m_8 (8,%a_1^8,%a_2) = %a_3 emp |}]
let%expect_test _ =
check_frame
@ -174,7 +174,7 @@ let%test_module _ =
\- %a_3, %m_8 .
%l_6 -[ %l_6, %m_8 )-> %m_8,%a_3
) infer_frame:
%a_2 = _ (8,%a_1^8,%a_2) = %a_3 16 = %m_8 emp |}]
%a_2 = _ 16 = %m_8 (8,%a_1^8,%a_2) = %a_3 emp |}]
let%expect_test _ =
check_frame
@ -194,8 +194,8 @@ let%test_module _ =
) infer_frame:
%a0_10, %a1_11 .
%a_2 = %a0_10
(16,%a_2^16,%a1_11) = %a_1
16 = %m_8 = %n_9
(16,%a_2^16,%a1_11) = %a_1
((16 × 1) + (1 × %k_5)) -[ %k_5, 16 )-> 16,%a1_11 |}]
let%expect_test _ =
@ -216,8 +216,8 @@ let%test_module _ =
) infer_frame:
%a0_10, %a1_11 .
%a_2 = %a0_10
(16,%a_2^16,%a1_11) = %a_1
16 = %m_8 = %n_9
(16,%a_2^16,%a1_11) = %a_1
((16 × 1) + (1 × %k_5)) -[ %k_5, 16 )-> 16,%a1_11 |}]
let seg_split_symbolically =
@ -249,14 +249,14 @@ let%test_module _ =
16 = %m_8
((16 × 1) + (1 × %l_6)) -[ %l_6, 16 )-> 0,%a_3)
( %a_3 = _
(8,%a_2^8,%a_3) = %a_1
1 = %n_9
16 = %m_8
(8,%a_2^8,%a_3) = %a_1
emp)
( %a_3 = _
(0,%a_2^16,%a_3) = %a_1
0 = %n_9
16 = %m_8
(0,%a_2^16,%a_3) = %a_1
emp)
) |}]

Loading…
Cancel
Save