@ -64,19 +64,24 @@ let%test_module _ =
let f2 = of_eqs [ ( x , x + ! 1 ) ]
let % test _ = is_false f2
let % expect_test _ = pp f2 ; [ % expect { | { sat = false ; rep = [] } | } ]
let % expect_test _ =
pp f2 ; [ % expect { | { sat = false ; rep = [ [ % x_5 ↦ ] ] } | } ]
let f3 = of_eqs [ ( x + ! 0 , x + ! 1 ) ]
let % test _ = is_false f3
let % expect_test _ = pp f3 ; [ % expect { | { sat = false ; rep = [] } | } ]
let % expect_test _ =
pp f3 ; [ % expect { | { sat = false ; rep = [ [ % x_5 ↦ ] ] } | } ]
let f4 = of_eqs [ ( x , y ) ; ( x + ! 0 , y + ! 1 ) ]
let % test _ = is_false f4
let % expect_test _ =
pp f4 ; [ % expect { | { sat = false ; rep = [ [ % y_6 ↦ % x_5 ] ] } | } ]
pp f4 ;
[ % expect { | { sat = false ; rep = [ [ % x_5 ↦ ] ; [ % y_6 ↦ % x_5 ] ] } | } ]
let t1 = of_eqs [ ( ! 1 , ! 1 ) ]
@ -104,7 +109,7 @@ let%test_module _ =
{ |
% x_5 = % y_6
{ sat = true ; rep = [ [ % y_6 ↦ % x_5 ] ] } | } ]
{ sat = true ; rep = [ [ % x_5 ↦ ] ; [ % y_6 ↦ % x_5 ] ] } | } ]
let % test _ = entails_eq r1 x y
@ -118,7 +123,10 @@ let%test_module _ =
% x_5 = % y_6 = % z_7 = ( ( u8 ) % x_5 )
{ sat = true ;
rep = [ [ % y_6 ↦ % x_5 ] ; [ % z_7 ↦ % x_5 ] ; [ ( ( u8 ) % x_5 ) ↦ % x_5 ] ] } | } ]
rep = [ [ % x_5 ↦ ] ;
[ % y_6 ↦ % x_5 ] ;
[ % z_7 ↦ % x_5 ] ;
[ ( ( u8 ) % x_5 ) ↦ % x_5 ] ] } | } ]
let % test _ = entails_eq r2 x z
let % test _ = entails_eq ( or_ r1 r2 ) x y
@ -139,11 +147,11 @@ let%test_module _ =
pp rs ;
[ % expect
{ |
{ sat = true ; rep = [ [ % y_6 ↦ % w_4 ] ; [ % z_7 ↦ % w_4 ] ] }
{ sat = true ; rep = [ [ % w_4 ↦ ] ; [ % y_6 ↦ % w_4 ] ; [ % z_7 ↦ % w_4 ] ] }
{ sat = true ; rep = [ [ % y_6 ↦ % x_5 ] ; [ % z_7 ↦ % x_5 ] ] }
{ sat = true ; rep = [ [ % x_5 ↦ ] ; [ % y_6 ↦ % x_5 ] ; [ % z_7 ↦ % x_5 ] ] }
{ sat = true ; rep = [ [ % z_7 ↦ % y_6 ] ] } | } ]
{ sat = true ; rep = [ [ % y_6 ↦ ] ; [ % z_7 ↦ % y_6 ] ] } | } ]
let % test _ =
let r = of_eqs [ ( w , y ) ; ( y , z ) ] in
@ -162,10 +170,12 @@ let%test_module _ =
= ( % y_6 rem % t_1 )
{ sat = true ;
rep = [ [ % u_2 ↦ % t_1 ] ;
rep = [ [ % t_1 ↦ ] ;
[ % u_2 ↦ % t_1 ] ;
[ % v_3 ↦ % t_1 ] ;
[ % w_4 ↦ % t_1 ] ;
[ % x_5 ↦ % t_1 ] ;
[ % y_6 ↦ ] ;
[ % z_7 ↦ % t_1 ] ;
[ ( % y_6 rem % v_3 ) ↦ % t_1 ] ;
[ ( % y_6 rem % z_7 ) ↦ % t_1 ] ] } | } ]
@ -186,7 +196,8 @@ let%test_module _ =
{ sat = true ;
rep = [ [ % w_4 ↦ ( % z_7 + 3 ) ] ;
[ % x_5 ↦ ( % z_7 + 8 ) ] ;
[ % y_6 ↦ ( % z_7 + - 4 ) ] ] } | } ]
[ % y_6 ↦ ( % z_7 + - 4 ) ] ;
[ % z_7 ↦ ] ] } | } ]
let % test _ = entails_eq r4 x ( w + ! 5 )
let % test _ = difference r4 x w | > Poly . equal ( Some ( Z . of_int 5 ) )
@ -219,10 +230,19 @@ let%test_module _ =
{ |
% v_3 = % x_5 ∧ % w_4 = % y_6 = % z_7
{ sat = true ; rep = [ [ % x_5 ↦ % v_3 ] ; [ % y_6 ↦ % w_4 ] ; [ % z_7 ↦ % w_4 ] ] }
{ sat = true ;
rep = [ [ % v_3 ↦ ] ;
[ % w_4 ↦ ] ;
[ % x_5 ↦ % v_3 ] ;
[ % y_6 ↦ % w_4 ] ;
[ % z_7 ↦ % w_4 ] ] }
{ sat = true ;
rep = [ [ % w_4 ↦ % v_3 ] ; [ % x_5 ↦ % v_3 ] ; [ % y_6 ↦ % v_3 ] ; [ % z_7 ↦ % v_3 ] ] }
rep = [ [ % v_3 ↦ ] ;
[ % w_4 ↦ % v_3 ] ;
[ % x_5 ↦ % v_3 ] ;
[ % y_6 ↦ % v_3 ] ;
[ % z_7 ↦ % v_3 ] ] }
% v_3 = % w_4 = % x_5 = % y_6 = % z_7 | } ]
@ -248,7 +268,11 @@ let%test_module _ =
% v_3 = % w_4 = % x_5 = % y_6 = % z_7
{ sat = true ;
rep = [ [ % w_4 ↦ % v_3 ] ; [ % x_5 ↦ % v_3 ] ; [ % y_6 ↦ % v_3 ] ; [ % z_7 ↦ % v_3 ] ] } | } ]
rep = [ [ % v_3 ↦ ] ;
[ % w_4 ↦ % v_3 ] ;
[ % x_5 ↦ % v_3 ] ;
[ % y_6 ↦ % v_3 ] ;
[ % z_7 ↦ % v_3 ] ] } | } ]
let % test _ = normalize r7' w | > Term . equal v
@ -267,7 +291,7 @@ let%test_module _ =
{ |
( 13 × % z_7 ) = % x_5 ∧ 14 = % y_6
{ sat = true ; rep = [ [ % x_5 ↦ ( 13 × % z_7 ) ] ; [ % y_6 ↦ 14 ] ]} | } ]
{ sat = true ; rep = [ [ % x_5 ↦ ( 13 × % z_7 ) ] ; [ % y_6 ↦ 14 ] ; [ % z_7 ↦ ] ]} | } ]
let % test _ = entails_eq r8 y ! 14
@ -280,7 +304,7 @@ let%test_module _ =
{ |
( % z_7 + - 16 ) = % x_5
{ sat = true ; rep = [ [ % x_5 ↦ ( % z_7 + - 16 ) ] ]} | } ]
{ sat = true ; rep = [ [ % x_5 ↦ ( % z_7 + - 16 ) ] ; [ % z_7 ↦ ] ]} | } ]
let % test _ = difference r9 z ( x + ! 8 ) | > Poly . equal ( Some ( Z . of_int 8 ) )
@ -297,7 +321,7 @@ let%test_module _ =
{ |
( % z_7 + - 16 ) = % x_5
{ sat = true ; rep = [ [ % x_5 ↦ ( % z_7 + - 16 ) ] ]}
{ sat = true ; rep = [ [ % x_5 ↦ ( % z_7 + - 16 ) ] ; [ % z_7 ↦ ] ]}
( - 1 × % x_5 + % z_7 + - 8 )
@ -327,7 +351,11 @@ let%test_module _ =
[ % expect
{ |
{ sat = true ;
rep = [ [ % z_7 ↦ % y_6 ] ; [ ( % x_5 = 2 ) ↦ % y_6 ] ; [ ( % x_5 ≠ 2 ) ↦ % y_6 ] ] } | } ]
rep = [ [ % x_5 ↦ ] ;
[ % y_6 ↦ ] ;
[ % z_7 ↦ % y_6 ] ;
[ ( % x_5 = 2 ) ↦ % y_6 ] ;
[ ( % x_5 ≠ 2 ) ↦ % y_6 ] ] } | } ]
let % test _ = not ( is_false r13 ) (* incomplete *)
@ -335,7 +363,9 @@ let%test_module _ =
let r14 = of_eqs [ ( a , a ) ; ( x , ! 1 ) ]
let % expect_test _ =
pp r14 ; [ % expect { | { sat = true ; rep = [ [ % x_5 ↦ 1 ] ] } | } ]
pp r14 ;
[ % expect
{ | { sat = true ; rep = [ [ % x_5 ↦ 1 ] ; [ ( % x_5 ≠ 0 ) ↦ - 1 ] ] } | } ]
let % test _ = entails_eq r14 a Term . true_
@ -346,7 +376,8 @@ let%test_module _ =
pp r14 ;
[ % expect
{ |
{ sat = true ; rep = [ [ % x_5 ↦ 1 ] ; [ ( % y_6 ≠ 0 ) ↦ - 1 ] ] } | } ]
{ sat = true ;
rep = [ [ % x_5 ↦ 1 ] ; [ % y_6 ↦ ] ; [ ( % x_5 ≠ 0 ) ↦ - 1 ] ; [ ( % y_6 ≠ 0 ) ↦ - 1 ] ] } | } ]
let % test _ = entails_eq r14 a Term . true_
let % test _ = entails_eq r14 b Term . true_
@ -355,7 +386,9 @@ let%test_module _ =
let r15 = of_eqs [ ( b , b ) ; ( x , ! 1 ) ]
let % expect_test _ =
pp r15 ; [ % expect { | { sat = true ; rep = [ [ % x_5 ↦ 1 ] ] } | } ]
pp r15 ;
[ % expect
{ | { sat = true ; rep = [ [ % x_5 ↦ 1 ] ; [ ( % x_5 ≠ 0 ) ↦ - 1 ] ] } | } ]
let % test _ = entails_eq r15 b ( Term . signed 1 ! 1 )
let % test _ = entails_eq r15 ( Term . unsigned 1 b ) ! 1
@ -370,6 +403,7 @@ let%test_module _ =
{ |
{ sat = false ;
rep = [ [ % x_5 ↦ ( % y_6 + 1 ) ] ;
[ % y_6 ↦ ] ;
[ ( ( u8 ) % y_6 ) ↦ ( % y_6 + - 2 ) ] ;
[ ( ( u8 ) ( % x_5 + - 1 ) ) ↦ ( % y_6 + 3 ) ] ] } | } ]
@ -383,7 +417,8 @@ let%test_module _ =
[ % expect
{ |
{ sat = false ;
rep = [ [ % y_6 ↦ % x_5 ] ;
rep = [ [ % x_5 ↦ ] ;
[ % y_6 ↦ % x_5 ] ;
[ ( ( u8 ) % x_5 ) ↦ % x_5 ] ;
[ ( ( u8 ) % y_6 ) ↦ ( % x_5 + - 1 ) ] ] } | } ]
@ -396,7 +431,10 @@ let%test_module _ =
[ % expect
{ |
{ sat = true ;
rep = [ [ ( ( u8 ) % x_5 ) ↦ % x_5 ] ; [ ( ( u8 ) % y_6 ) ↦ ( % y_6 + - 1 ) ] ] }
rep = [ [ % x_5 ↦ ] ;
[ % y_6 ↦ ] ;
[ ( ( u8 ) % x_5 ) ↦ % x_5 ] ;
[ ( ( u8 ) % y_6 ) ↦ ( % y_6 + - 1 ) ] ] }
% x_5 = ( ( u8 ) % x_5 ) ∧ ( % y_6 + - 1 ) = ( ( u8 ) % y_6 ) | } ]