@ -66,7 +66,7 @@ let%test_module _ =
let % expect_test _ =
pp_raw f1 ;
[ % expect { | { sat = false ; rep = [ [ - 1 ↦ ] ; [ 0 ↦ ] ] } | } ]
[ % expect { | { sat = false ; rep = [ [ 0 ↦ ] ; [ - 1 ↦ ] ] } | } ]
let % test _ = is_unsat ( add_eq ! 1 ! 1 f1 )
@ -76,7 +76,7 @@ let%test_module _ =
let % expect_test _ =
pp_raw f2 ;
[ % expect { | { sat = false ; rep = [ [ % x_5 ↦ ] ; [ - 1 ↦ ] ; [ 0 ↦ ] ] } | } ]
[ % expect { | { sat = false ; rep = [ [ 0 ↦ ] ; [ - 1 ↦ ] ; [ % x_5 ↦ ] ] } | } ]
let f3 = of_eqs [ ( x + ! 0 , x + ! 1 ) ]
@ -84,7 +84,7 @@ let%test_module _ =
let % expect_test _ =
pp_raw f3 ;
[ % expect { | { sat = false ; rep = [ [ % x_5 ↦ ] ; [ - 1 ↦ ] ; [ 0 ↦ ] ] } | } ]
[ % expect { | { sat = false ; rep = [ [ 0 ↦ ] ; [ - 1 ↦ ] ; [ % x_5 ↦ ] ] } | } ]
let f4 = of_eqs [ ( x , y ) ; ( x + ! 0 , y + ! 1 ) ]
@ -93,7 +93,7 @@ let%test_module _ =
let % expect_test _ =
pp_raw f4 ;
[ % expect
{ | { sat = false ; rep = [ [ % x_5 ↦ ] ; [ % y_6 ↦ % x_5 ] ; [ -1 ↦ ] ; [ 0 ↦ ] ] } | } ]
{ | { sat = false ; rep = [ [ 0 ↦ ] ; [ - 1 ↦ ] ; [ % y_6 ↦ % x_5 ] ; [ %x_5 ↦ ] ] } | } ]
let t1 = of_eqs [ ( ! 1 , ! 1 ) ]
@ -109,7 +109,7 @@ let%test_module _ =
let % expect_test _ =
pp_raw r0 ;
[ % expect { | { sat = true ; rep = [ [ - 1 ↦ ] ; [ 0 ↦ ] ] } | } ]
[ % expect { | { sat = true ; rep = [ [ 0 ↦ ] ; [ - 1 ↦ ] ] } | } ]
let % expect_test _ =
pp r0 ;
@ -128,7 +128,7 @@ let%test_module _ =
% x_5 = % y_6
{ sat = true ; rep = [ [ % x_5 ↦ ] ; [ % y_6 ↦ % x_5 ] ; [ -1 ↦ ] ; [ 0 ↦ ] ] } | } ]
{ sat = true ; rep = [ [ 0 ↦ ] ; [ - 1 ↦ ] ; [ % y_6 ↦ % x_5 ] ; [ %x_5 ↦ ] ] } | } ]
let % test _ = implies_eq r1 x y
@ -142,12 +142,12 @@ let%test_module _ =
% x_5 = % y_6 = % z_7 = % x_5 ^
{ sat = true ;
rep = [ [ % x_5 ↦ ] ;
[ % y_6 ↦ % x_5 ] ;
[ % z_7 ↦ % x_5 ] ;
[ % x_5 ^ ↦ % x_5 ] ;
rep = [ [ 0 ↦ ] ;
[ - 1 ↦ ] ;
[ 0 ↦ ] ] } | } ]
[ % x_5 ^ ↦ % x_5 ] ;
[ % z_7 ↦ % x_5 ] ;
[ % y_6 ↦ % x_5 ] ;
[ % x_5 ↦ ] ] } | } ]
let % test _ = implies_eq r2 x z
let % test _ = implies_eq ( inter r1 r2 ) x y
@ -169,12 +169,12 @@ let%test_module _ =
[ % expect
{ |
{ sat = true ;
rep = [ [ % w_4 ↦ ] ; [ % y_6 ↦ % w_4 ] ; [ % z_7 ↦ % w_4 ] ; [ -1 ↦ ] ; [ 0 ↦ ] ] }
rep = [ [ 0 ↦ ] ; [ - 1 ↦ ] ; [ % z_7 ↦ % w_4 ] ; [ %y_6 ↦ % w_4 ] ; [ % w_4 ↦ ] ] }
{ sat = true ;
rep = [ [ % x_5 ↦ ] ; [ % y_6 ↦ % x_5 ] ; [ % z_7 ↦ % x_5 ] ; [ -1 ↦ ] ; [ 0 ↦ ] ] }
rep = [ [ 0 ↦ ] ; [ - 1 ↦ ] ; [ % z_7 ↦ % x_5 ] ; [ %y_6 ↦ % x_5 ] ; [ % x_5 ↦ ] ] }
{ sat = true ; rep = [ [ % y_6 ↦ ] ; [ % z_7 ↦ % y_6 ] ; [ -1 ↦ ] ; [ 0 ↦ ] ] } | } ]
{ sat = true ; rep = [ [ 0 ↦ ] ; [ - 1 ↦ ] ; [ % z_7 ↦ % y_6 ] ; [ %y_6 ↦ ] ] } | } ]
let % test _ =
let r = of_eqs [ ( w , y ) ; ( y , z ) ] in
@ -189,21 +189,21 @@ let%test_module _ =
pp_raw r3 ;
[ % expect
{ |
%z_7 = % u_2 = % v_3 = % w_4 = % x_5 = ( % z_7 × % y_6 )
∧ (% z_7 × ( % y_6 × % y_6 ) ) = % t_1
(% z_7 × ( % y_6 × % y_6 ) ) = % t_1
∧ %z_7 = % u_2 = % v_3 = % w_4 = % x_5 = ( % z_7 × % y_6 )
{ sat = true ;
rep = [ [ % t_1 ↦ ( % y_6 ^ 2 × % z_7 ) ] ;
[ % u_2 ↦ % z_7 ] ;
[ % v_3 ↦ % z_7 ] ;
[ % w_4 ↦ % z_7 ] ;
[ % x_5 ↦ % z_7 ] ;
[ % y_6 ↦ ] ;
[ % z_7 ↦ ] ;
[ ( % y_6 × % z_7 ) ↦ % z_7 ] ;
[ ( % y_6 ^ 2 × % z_7 ) ↦ ] ;
rep = [ [ 0 ↦ ] ;
[ - 1 ↦ ] ;
[ 0 ↦ ] ] } | } ]
[ ( % z_7 × % y_6 ^ 2 ) ↦ ] ;
[ ( % z_7 × % y_6 ) ↦ % z_7 ] ;
[ % z_7 ↦ ] ;
[ % y_6 ↦ ] ;
[ % x_5 ↦ % z_7 ] ;
[ % w_4 ↦ % z_7 ] ;
[ % v_3 ↦ % z_7 ] ;
[ % u_2 ↦ % z_7 ] ;
[ % t_1 ↦ ( % z_7 × % y_6 ^ 2 ) ] ] } | } ]
let % test _ = not ( implies_eq r3 t z ) (* incomplete *)
let % test _ = implies_eq r3 x z
@ -216,15 +216,15 @@ let%test_module _ =
pp_raw r4 ;
[ % expect
{ |
( - 4 + % z_7 ) = % y_6 ∧ ( 3 + % z_7 ) = % w_4 ∧ ( 8 + % z_7 ) = % x_5
( 8 + % z_7 ) = % x_5 ∧ ( 3 + % z_7 ) = % w_4 ∧ ( - 4 + % z_7 ) = % y_6
{ sat = true ;
rep = [ [ % w_4 ↦ ( % z_7 + 3 ) ] ;
[ % x_5 ↦ ( % z_7 + 8 ) ] ;
[ % y_6 ↦ ( % z_7 + - 4 ) ] ;
[ % z_7 ↦ ] ;
rep = [ [ 0 ↦ ] ;
[ - 1 ↦ ] ;
[ 0 ↦ ] ] } | } ]
[ % z_7 ↦ ] ;
[ % y_6 ↦ ( - 4 + % z_7 ) ] ;
[ % x_5 ↦ ( 8 + % z_7 ) ] ;
[ % w_4 ↦ ( 3 + % z_7 ) ] ] } | } ]
let % test _ = implies_eq r4 x ( w + ! 5 )
let % test _ = difference r4 x w | > Poly . equal ( Some ( Z . of_int 5 ) )
@ -242,7 +242,7 @@ let%test_module _ =
{ |
1 = % x_5 = % y_6
{ sat = true ; rep = [ [ % x_5 ↦ 1 ] ; [ % y_6 ↦ 1 ] ; [ - 1 ↦ ] ; [ 0 ↦ ] ] } | } ]
{ sat = true ; rep = [ [ 0 ↦ ] ; [ - 1 ↦ ] ; [ % y_6 ↦ 1 ] ; [ % x_5 ↦ 1 ] ] } | } ]
let % test _ = implies_eq r6 x y
@ -255,25 +255,25 @@ let%test_module _ =
pp ( add_eq x z r7 ) ;
[ % expect
{ |
% v_3 = % x_5 ∧ % w_4 = % y_6 = % z_7
% w_4 = % y_6 = % z_7 ∧ % v_3 = % x_5
{ sat = true ;
rep = [ [ % v_3 ↦ ] ;
[ % w_4 ↦ ] ;
[ % x_5 ↦ % v_3 ] ;
[ % y_6 ↦ % w_4 ] ;
[ % z_7 ↦ % w_4 ] ;
rep = [ [ 0 ↦ ] ;
[ - 1 ↦ ] ;
[ 0 ↦ ] ] }
[ % z_7 ↦ % w_4 ] ;
[ % y_6 ↦ % w_4 ] ;
[ % x_5 ↦ % v_3 ] ;
[ % w_4 ↦ ] ;
[ % v_3 ↦ ] ] }
{ sat = true ;
rep = [ [ % v_3 ↦ ] ;
[ % w_4 ↦ % v_3 ] ;
[ % x_5 ↦ % v_3 ] ;
[ % y_6 ↦ % v_3 ] ;
[ % z_7 ↦ % v_3 ] ;
rep = [ [ 0 ↦ ] ;
[ - 1 ↦ ] ;
[ 0 ↦ ] ] }
[ % z_7 ↦ % v_3 ] ;
[ % y_6 ↦ % v_3 ] ;
[ % x_5 ↦ % v_3 ] ;
[ % w_4 ↦ % v_3 ] ;
[ % v_3 ↦ ] ] }
% v_3 = % w_4 = % x_5 = % y_6 = % z_7 | } ]
@ -299,13 +299,13 @@ let%test_module _ =
% v_3 = % w_4 = % x_5 = % y_6 = % z_7
{ sat = true ;
rep = [ [ % v_3 ↦ ] ;
[ % w_4 ↦ % v_3 ] ;
[ % x_5 ↦ % v_3 ] ;
[ % y_6 ↦ % v_3 ] ;
[ % z_7 ↦ % v_3 ] ;
rep = [ [ 0 ↦ ] ;
[ - 1 ↦ ] ;
[ 0 ↦ ] ] } | } ]
[ % z_7 ↦ % v_3 ] ;
[ % y_6 ↦ % v_3 ] ;
[ % x_5 ↦ % v_3 ] ;
[ % w_4 ↦ % v_3 ] ;
[ % v_3 ↦ ] ] } | } ]
let % test _ = normalize r7' w | > Term . equal v
@ -322,10 +322,10 @@ let%test_module _ =
pp_raw r8 ;
[ % expect
{ |
14 = % y_6 ∧ ( 13 × % z_7 ) = % x_5
( 13 × % z_7 ) = % x_5 ∧ 14 = % y_6
{ sat = true ;
rep = [ [ % x_5 ↦ ( 13 × % z_7 ) ] ; [ % y_6 ↦ 14 ] ; [ % z_7 ↦ ] ; [ - 1 ↦ ] ; [ 0 ↦ ] ] } | } ]
rep = [ [ 0 ↦ ] ; [ - 1 ↦ ] ; [ % z_7 ↦ ] ; [ % y_6 ↦ 14 ] ; [ % x_5 ↦ ( 13 × % z_7 ) ] ] } | } ]
let % test _ = implies_eq r8 y ! 14
@ -337,10 +337,10 @@ let%test_module _ =
[ % expect
{ |
{ sat = true ;
rep = [ [ % x_5 ↦ ( % z_7 + - 16 ) ] ; [ % z_7 ↦ ] ; [ - 1 ↦ ] ; [ 0 ↦ ] ] }
rep = [ [ 0 ↦ ] ; [ - 1 ↦ ] ; [ % z_7 ↦ ] ; [ % x_5 ↦ ( - 16 + % z_7 ) ] ] }
{ sat = true ;
rep = [ [ % x_5 ↦ ( % z_7 + - 16 ) ] ; [ % z_7 ↦ ] ; [ - 1 ↦ ] ; [ 0 ↦ ] ] } | } ]
rep = [ [ 0 ↦ ] ; [ - 1 ↦ ] ; [ % z_7 ↦ ] ; [ % x_5 ↦ ( - 16 + % z_7 ) ] ] } | } ]
let % test _ = difference r9 z ( x + ! 8 ) | > Poly . equal ( Some ( Z . of_int 8 ) )
@ -356,10 +356,10 @@ let%test_module _ =
[ % expect
{ |
{ sat = true ;
rep = [ [ % x_5 ↦ ( % z_7 + - 16 ) ] ; [ % z_7 ↦ ] ; [ - 1 ↦ ] ; [ 0 ↦ ] ] }
rep = [ [ 0 ↦ ] ; [ - 1 ↦ ] ; [ % z_7 ↦ ] ; [ % x_5 ↦ ( - 16 + % z_7 ) ] ] }
{ sat = true ;
rep = [ [ % x_5 ↦ ( % z_7 + - 16 ) ] ; [ % z_7 ↦ ] ; [ - 1 ↦ ] ; [ 0 ↦ ] ] }
rep = [ [ 0 ↦ ] ; [ - 1 ↦ ] ; [ % z_7 ↦ ] ; [ % x_5 ↦ ( - 16 + % z_7 ) ] ] }
( % z_7 - ( % x_5 + 8 ) )
@ -395,7 +395,7 @@ let%test_module _ =
let % expect_test _ =
pp_raw r13 ;
[ % expect
{ | { sat = true ; rep = [ [ % y_6 ↦ ] ; [ % z_7 ↦ % y_6 ] ; [ -1 ↦ ] ; [ 0 ↦ ] ] } | } ]
{ | { sat = true ; rep = [ [ 0 ↦ ] ; [ - 1 ↦ ] ; [ % z_7 ↦ % y_6 ] ; [ %y_6 ↦ ] ] } | } ]
let % test _ = not ( is_unsat r13 ) (* incomplete *)
@ -406,7 +406,7 @@ let%test_module _ =
pp_raw r14 ;
[ % expect
{ |
{ sat = true ; rep = [ [ % x_5 ↦ 1 ] ; [ - 1 ↦ ] ; [ 0 ↦ ] ] } | } ]
{ sat = true ; rep = [ [ 0 ↦ ] ; [ - 1 ↦ ] ; [ % x_5 ↦ 1 ] ] } | } ]
let % test _ = implies_eq r14 a ( Formula . inject Formula . tt )
@ -418,12 +418,12 @@ let%test_module _ =
[ % expect
{ |
{ sat = true ;
rep = [ [ % x_5 ↦ 1 ] ;
[ % y_6 ↦ ] ;
[ ( % x_5 ≠ 0 ) ↦ - 1 ] ;
[ ( % y_6 ≠ 0 ) ↦ - 1 ] ;
rep = [ [ 0 ↦ ] ;
[ - 1 ↦ ] ;
[ 0 ↦ ] ] } | } ]
[ ( % y_6 ≠ 0 ) ↦ - 1 ] ;
[ ( % x_5 ≠ 0 ) ↦ - 1 ] ;
[ % y_6 ↦ ] ;
[ % x_5 ↦ 1 ] ] } | } ]
let % test _ = implies_eq r14 a ( Formula . inject Formula . tt )
let % test _ = implies_eq r14 b ( Formula . inject Formula . tt )
@ -435,7 +435,7 @@ let%test_module _ =
pp_raw r15 ;
[ % expect
{ |
{ sat = true ; rep = [ [ % x_5 ↦ 1 ] ; [ - 1 ↦ ] ; [ 0 ↦ ] ] } | } ]
{ sat = true ; rep = [ [ 0 ↦ ] ; [ - 1 ↦ ] ; [ % x_5 ↦ 1 ] ] } | } ]
(* f ( x− 1 ) − 1=x+1, f( y ) +1=y− 1, y+1=x ⊢ false *)
let r16 =
@ -446,12 +446,12 @@ let%test_module _ =
[ % expect
{ |
{ sat = false ;
rep = [ [ % x_5 ↦ ( % y_6 + 1 ) ] ;
[ % y_6 ↦ ] ;
[ % y_6 ^ ↦ ( % y_6 + - 2 ) ] ;
[ ( % x_5 + - 1 ) ^ ↦ ( % y_6 + 3 ) ] ;
rep = [ [ 0 ↦ ] ;
[ - 1 ↦ ] ;
[ 0 ↦ ] ] } | } ]
[ ( - 1 + % x_5 ) ^ ↦ ( 3 + % y_6 ) ] ;
[ % y_6 ^ ↦ ( - 2 + % y_6 ) ] ;
[ % y_6 ↦ ] ;
[ % x_5 ↦ ( 1 + % y_6 ) ] ] } | } ]
let % test _ = is_unsat r16
@ -463,12 +463,12 @@ let%test_module _ =
[ % expect
{ |
{ sat = false ;
rep = [ [ % x_5 ↦ ] ;
[ % y_6 ↦ % x_5 ] ;
[ % x_5 ^ ↦ % x_5 ] ;
[ % y_6 ^ ↦ ( % x_5 + - 1 ) ] ;
rep = [ [ 0 ↦ ] ;
[ - 1 ↦ ] ;
[ 0 ↦ ] ] } | } ]
[ % y_6 ^ ↦ ( - 1 + % x_5 ) ] ;
[ % x_5 ^ ↦ % x_5 ] ;
[ % y_6 ↦ % x_5 ] ;
[ % x_5 ↦ ] ] } | } ]
let % test _ = is_unsat r17
@ -479,14 +479,14 @@ let%test_module _ =
[ % expect
{ |
{ sat = true ;
rep = [ [ % x_5 ↦ ] ;
[ % y_6 ↦ ] ;
[ % x_5 ^ ↦ % x_5 ] ;
[ % y_6 ^ ↦ ( % y_6 + - 1 ) ] ;
rep = [ [ 0 ↦ ] ;
[ - 1 ↦ ] ;
[ 0 ↦ ] ] }
[ % y_6 ^ ↦ ( - 1 + % y_6 ) ] ;
[ % x_5 ^ ↦ % x_5 ] ;
[ % y_6 ↦ ] ;
[ % x_5 ↦ ] ] }
% x_5 = % x_5 ^ ∧ ( - 1 + % y_6 ) = % y_6 ^ | } ]
(- 1 + % y_6 ) = % y_6 ^ ∧ % x_5 = % x_5 ^ | } ]
let r19 = of_eqs [ ( x , y + z ) ; ( x , ! 0 ) ; ( y , ! 0 ) ]
@ -495,7 +495,7 @@ let%test_module _ =
[ % expect
{ |
{ sat = true ;
rep = [ [ % x_5 ↦ 0 ] ; [ % y_6 ↦ 0 ] ; [ % z_7 ↦ 0 ] ; [ -1 ↦ ] ; [ 0 ↦ ] ] } | } ]
rep = [ [ 0 ↦ ] ; [ - 1 ↦ ] ; [ % z_7 ↦ 0 ] ; [ %y_6 ↦ 0 ] ; [ % x_5 ↦ 0 ] ] } | } ]
let % test _ = implies_eq r19 z ! 0