diff --git a/proofs/eo/cpc/rules/Rewrites.eo b/proofs/eo/cpc/rules/Rewrites.eo index f5bd2dea981..a51ffbc3984 100644 --- a/proofs/eo/cpc/rules/Rewrites.eo +++ b/proofs/eo/cpc/rules/Rewrites.eo @@ -7,1741 +7,1741 @@ (include "../theories/Strings.eo") (include "../theories/Sets.eo") -(declare-rule arith-plus-zero ((@T0 Type) (@T1 Type) (t1 @T0 :list) (s2 @T1 :list)) - :args (t1 s2) - :conclusion (= ($singleton_elim (+ t1 0 s2)) ($singleton_elim (+ t1 s2))) -) -(declare-rule arith-mul-one ((@T0 Type) (@T1 Type) (t3 @T0 :list) (s4 @T1 :list)) - :args (t3 s4) - :conclusion (= ($singleton_elim (* t3 1 s4)) ($singleton_elim (* t3 s4))) -) -(declare-rule arith-mul-zero ((@T0 Type) (@T1 Type) (t5 @T0 :list) (s6 @T1 :list)) - :args (t5 s6) - :conclusion (= ($singleton_elim (* t5 0 s6)) 0) -) -(declare-rule arith-div-total ((@T0 Type) (@T1 Type) (t7 @T0) (s8 @T1)) - :premises ((= (= s8 0) false)) - :args (t7 s8) - :conclusion (= (/ t7 s8) (/_total t7 s8)) -) -(declare-rule arith-int-div-total ((t9 Int) (s10 Int)) - :premises ((= (= s10 0) false)) - :args (t9 s10) - :conclusion (= (div t9 s10) (div_total t9 s10)) -) -(declare-rule arith-int-div-total-one ((t11 Int)) - :args (t11) - :conclusion (= (div_total t11 1) t11) -) -(declare-rule arith-int-div-total-zero ((t12 Int)) - :args (t12) - :conclusion (= (div_total t12 0) 0) -) -(declare-rule arith-int-mod-total ((t13 Int) (s14 Int)) - :premises ((= (= s14 0) false)) - :args (t13 s14) - :conclusion (= (mod t13 s14) (mod_total t13 s14)) +(declare-rule arith-plus-zero ((@T0 Type) (@T1 Type) (t1 @T0 :list) (s1 @T1 :list)) + :args (t1 s1) + :conclusion (= ($singleton_elim (+ t1 0 s1)) ($singleton_elim (+ t1 s1))) +) +(declare-rule arith-mul-one ((@T0 Type) (@T1 Type) (t1 @T0 :list) (s1 @T1 :list)) + :args (t1 s1) + :conclusion (= ($singleton_elim (* t1 1 s1)) ($singleton_elim (* t1 s1))) +) +(declare-rule arith-mul-zero ((@T0 Type) (@T1 Type) (t1 @T0 :list) (s1 @T1 :list)) + :args (t1 s1) + :conclusion (= ($singleton_elim (* t1 0 s1)) 0) +) +(declare-rule arith-div-total ((@T0 Type) (@T1 Type) (t1 @T0) (s1 @T1)) + :premises ((= (= s1 0) false)) + :args (t1 s1) + :conclusion (= (/ t1 s1) (/_total t1 s1)) +) +(declare-rule arith-int-div-total ((t1 Int) (s1 Int)) + :premises ((= (= s1 0) false)) + :args (t1 s1) + :conclusion (= (div t1 s1) (div_total t1 s1)) +) +(declare-rule arith-int-div-total-one ((t1 Int)) + :args (t1) + :conclusion (= (div_total t1 1) t1) +) +(declare-rule arith-int-div-total-zero ((t1 Int)) + :args (t1) + :conclusion (= (div_total t1 0) 0) +) +(declare-rule arith-int-mod-total ((t1 Int) (s1 Int)) + :premises ((= (= s1 0) false)) + :args (t1 s1) + :conclusion (= (mod t1 s1) (mod_total t1 s1)) ) -(declare-rule arith-int-mod-total-one ((t15 Int)) - :args (t15) - :conclusion (= (mod_total t15 1) 0) +(declare-rule arith-int-mod-total-one ((t1 Int)) + :args (t1) + :conclusion (= (mod_total t1 1) 0) ) -(declare-rule arith-int-mod-total-zero ((t16 Int)) - :args (t16) - :conclusion (= (mod_total t16 0) t16) +(declare-rule arith-int-mod-total-zero ((t1 Int)) + :args (t1) + :conclusion (= (mod_total t1 0) t1) ) -(declare-rule arith-neg-neg-one ((@T0 Type) (t17 @T0)) - :args (t17) - :conclusion (= (* (- 1) (* (- 1) t17)) t17) +(declare-rule arith-neg-neg-one ((@T0 Type) (t1 @T0)) + :args (t1) + :conclusion (= (* (- 1) (* (- 1) t1)) t1) ) -(declare-rule arith-elim-uminus ((@T0 Type) (t18 @T0)) - :args (t18) - :conclusion (= (- t18) (* (- 1) t18)) +(declare-rule arith-elim-uminus ((@T0 Type) (t1 @T0)) + :args (t1) + :conclusion (= (- t1) (* (- 1) t1)) ) -(declare-rule arith-elim-minus ((@T0 Type) (@T1 Type) (t19 @T0) (s20 @T1)) - :args (t19 s20) - :conclusion (= (- t19 s20) (+ t19 (* (- 1) s20))) +(declare-rule arith-elim-minus ((@T0 Type) (@T1 Type) (t1 @T0) (s1 @T1)) + :args (t1 s1) + :conclusion (= (- t1 s1) (+ t1 (* (- 1) s1))) ) -(declare-rule arith-elim-gt ((@T0 Type) (@T1 Type) (t21 @T0) (s22 @T1)) - :args (t21 s22) - :conclusion (= (> t21 s22) (not (<= t21 s22))) +(declare-rule arith-elim-gt ((@T0 Type) (@T1 Type) (t1 @T0) (s1 @T1)) + :args (t1 s1) + :conclusion (= (> t1 s1) (not (<= t1 s1))) ) -(declare-rule arith-elim-lt ((@T0 Type) (@T1 Type) (t23 @T0) (s24 @T1)) - :args (t23 s24) - :conclusion (= (< t23 s24) (not (>= t23 s24))) -) -(declare-rule arith-elim-int-gt ((t25 Int) (s26 Int)) - :args (t25 s26) - :conclusion (= (> t25 s26) (>= t25 (+ s26 1))) -) -(declare-rule arith-elim-int-lt ((t27 Int) (s28 Int)) - :args (t27 s28) - :conclusion (= (< t27 s28) (>= s28 (+ t27 1))) -) -(declare-rule arith-elim-leq ((@T0 Type) (@T1 Type) (t29 @T0) (s30 @T1)) - :args (t29 s30) - :conclusion (= (<= t29 s30) (>= s30 t29)) -) -(declare-rule arith-leq-norm ((t31 Int) (s32 Int)) - :args (t31 s32) - :conclusion (= (<= t31 s32) (not (>= t31 (+ s32 1)))) -) -(declare-rule arith-geq-tighten ((t33 Int) (s34 Int)) - :args (t33 s34) - :conclusion (= (not (>= t33 s34)) (>= s34 (+ t33 1))) -) -(declare-rule arith-geq-norm1 ((@T0 Type) (@T1 Type) (t35 @T0) (s36 @T1)) - :args (t35 s36) - :conclusion (= (>= t35 s36) (>= (- t35 s36) 0)) -) -(declare-rule arith-geq-norm2 ((@T0 Type) (@T1 Type) (t37 @T0) (s38 @T1)) - :args (t37 s38) - :conclusion (= (>= t37 s38) (<= (- t37) (- s38))) -) -(declare-rule arith-refl-leq ((@T0 Type) (t39 @T0)) - :args (t39) - :conclusion (= (<= t39 t39) true) -) -(declare-rule arith-refl-lt ((@T0 Type) (t40 @T0)) - :args (t40) - :conclusion (= (< t40 t40) false) -) -(declare-rule arith-refl-geq ((@T0 Type) (t41 @T0)) - :args (t41) - :conclusion (= (>= t41 t41) true) -) -(declare-rule arith-refl-gt ((@T0 Type) (t42 @T0)) - :args (t42) - :conclusion (= (> t42 t42) false) -) -(declare-rule arith-real-eq-elim ((t43 Real) (s44 Real)) - :args (t43 s44) - :conclusion (= (= t43 s44) (and (>= t43 s44) (<= t43 s44))) -) -(declare-rule arith-int-eq-elim ((t45 Int) (s46 Int)) - :args (t45 s46) - :conclusion (= (= t45 s46) (and (>= t45 s46) (<= t45 s46))) -) -(declare-rule arith-plus-flatten ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (xs47 @T0 :list) (w48 @T1) (ys49 @T2 :list) (zs50 @T3 :list)) - :args (xs47 w48 ys49 zs50) - :conclusion (= ($singleton_elim (+ xs47 ($singleton_elim (+ w48 ys49)) zs50)) ($singleton_elim (+ xs47 w48 ys49 zs50))) -) -(declare-rule arith-mult-flatten ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (xs51 @T0 :list) (w52 @T1) (ys53 @T2 :list) (zs54 @T3 :list)) - :args (xs51 w52 ys53 zs54) - :conclusion (= ($singleton_elim (* xs51 ($singleton_elim (* w52 ys53)) zs54)) ($singleton_elim (* xs51 w52 ys53 zs54))) -) -(declare-rule arith-mult-dist ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (x55 @T0) (y56 @T1) (z57 @T2) (w58 @T3 :list)) - :args (x55 y56 z57 w58) - :conclusion (= (* x55 (+ y56 z57 w58)) (+ (* x55 y56) (* x55 ($singleton_elim (+ z57 w58))))) -) -(declare-rule arith-plus-cancel1 ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (t59 @T0 :list) (x60 @T1) (s61 @T2 :list) (r62 @T3 :list)) - :args (t59 x60 s61 r62) - :conclusion (= (+ t59 x60 s61 (* (- 1) x60) r62) ($singleton_elim (+ t59 s61 r62))) -) -(declare-rule arith-plus-cancel2 ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (t63 @T0 :list) (x64 @T1) (s65 @T2 :list) (r66 @T3 :list)) - :args (t63 x64 s65 r66) - :conclusion (= (+ t63 (* (- 1) x64) s65 x64 r66) ($singleton_elim (+ t63 s65 r66))) +(declare-rule arith-elim-lt ((@T0 Type) (@T1 Type) (t1 @T0) (s1 @T1)) + :args (t1 s1) + :conclusion (= (< t1 s1) (not (>= t1 s1))) +) +(declare-rule arith-elim-int-gt ((t1 Int) (s1 Int)) + :args (t1 s1) + :conclusion (= (> t1 s1) (>= t1 (+ s1 1))) +) +(declare-rule arith-elim-int-lt ((t1 Int) (s1 Int)) + :args (t1 s1) + :conclusion (= (< t1 s1) (>= s1 (+ t1 1))) +) +(declare-rule arith-elim-leq ((@T0 Type) (@T1 Type) (t1 @T0) (s1 @T1)) + :args (t1 s1) + :conclusion (= (<= t1 s1) (>= s1 t1)) +) +(declare-rule arith-leq-norm ((t1 Int) (s1 Int)) + :args (t1 s1) + :conclusion (= (<= t1 s1) (not (>= t1 (+ s1 1)))) +) +(declare-rule arith-geq-tighten ((t1 Int) (s1 Int)) + :args (t1 s1) + :conclusion (= (not (>= t1 s1)) (>= s1 (+ t1 1))) +) +(declare-rule arith-geq-norm1 ((@T0 Type) (@T1 Type) (t1 @T0) (s1 @T1)) + :args (t1 s1) + :conclusion (= (>= t1 s1) (>= (- t1 s1) 0)) +) +(declare-rule arith-geq-norm2 ((@T0 Type) (@T1 Type) (t1 @T0) (s1 @T1)) + :args (t1 s1) + :conclusion (= (>= t1 s1) (<= (- t1) (- s1))) +) +(declare-rule arith-refl-leq ((@T0 Type) (t1 @T0)) + :args (t1) + :conclusion (= (<= t1 t1) true) +) +(declare-rule arith-refl-lt ((@T0 Type) (t1 @T0)) + :args (t1) + :conclusion (= (< t1 t1) false) +) +(declare-rule arith-refl-geq ((@T0 Type) (t1 @T0)) + :args (t1) + :conclusion (= (>= t1 t1) true) +) +(declare-rule arith-refl-gt ((@T0 Type) (t1 @T0)) + :args (t1) + :conclusion (= (> t1 t1) false) +) +(declare-rule arith-real-eq-elim ((t1 Real) (s1 Real)) + :args (t1 s1) + :conclusion (= (= t1 s1) (and (>= t1 s1) (<= t1 s1))) +) +(declare-rule arith-int-eq-elim ((t1 Int) (s1 Int)) + :args (t1 s1) + :conclusion (= (= t1 s1) (and (>= t1 s1) (<= t1 s1))) +) +(declare-rule arith-plus-flatten ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (xs1 @T0 :list) (w1 @T1) (ys1 @T2 :list) (zs1 @T3 :list)) + :args (xs1 w1 ys1 zs1) + :conclusion (= ($singleton_elim (+ xs1 ($singleton_elim (+ w1 ys1)) zs1)) ($singleton_elim (+ xs1 w1 ys1 zs1))) +) +(declare-rule arith-mult-flatten ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (xs1 @T0 :list) (w1 @T1) (ys1 @T2 :list) (zs1 @T3 :list)) + :args (xs1 w1 ys1 zs1) + :conclusion (= ($singleton_elim (* xs1 ($singleton_elim (* w1 ys1)) zs1)) ($singleton_elim (* xs1 w1 ys1 zs1))) +) +(declare-rule arith-mult-dist ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (x1 @T0) (y1 @T1) (z1 @T2) (w1 @T3 :list)) + :args (x1 y1 z1 w1) + :conclusion (= (* x1 (+ y1 z1 w1)) (+ (* x1 y1) (* x1 ($singleton_elim (+ z1 w1))))) +) +(declare-rule arith-plus-cancel1 ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (t1 @T0 :list) (x1 @T1) (s1 @T2 :list) (r1 @T3 :list)) + :args (t1 x1 s1 r1) + :conclusion (= (+ t1 x1 s1 (* (- 1) x1) r1) ($singleton_elim (+ t1 s1 r1))) +) +(declare-rule arith-plus-cancel2 ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (t1 @T0 :list) (x1 @T1) (s1 @T2 :list) (r1 @T3 :list)) + :args (t1 x1 s1 r1) + :conclusion (= (+ t1 (* (- 1) x1) s1 x1 r1) ($singleton_elim (+ t1 s1 r1))) ) -(declare-rule arith-abs-elim ((@T0 Type) (x67 @T0)) - :args (x67) - :conclusion (= (abs x67) (ite (< x67 0) (- x67) x67)) +(declare-rule arith-abs-elim ((@T0 Type) (x1 @T0)) + :args (x1) + :conclusion (= (abs x1) (ite (< x1 0) (- x1) x1)) ) -(declare-rule arith-to-real-elim ((x68 Real)) - :args (x68) - :conclusion (= (to_real x68) x68) +(declare-rule arith-to-real-elim ((x1 Real)) + :args (x1) + :conclusion (= (to_real x1) x1) ) -(declare-rule arith-to-int-elim-to-real ((@T0 Type) (x69 @T0)) - :args (x69) - :conclusion (= (to_int (to_real x69)) (to_int x69)) +(declare-rule arith-to-int-elim-to-real ((@T0 Type) (x1 @T0)) + :args (x1) + :conclusion (= (to_int (to_real x1)) (to_int x1)) ) -(declare-rule arith-div-elim-to-real1 ((@T0 Type) (@T1 Type) (x70 @T0) (y71 @T1)) - :args (x70 y71) - :conclusion (= (/ (to_real x70) y71) (/ x70 y71)) +(declare-rule arith-div-elim-to-real1 ((@T0 Type) (@T1 Type) (x1 @T0) (y1 @T1)) + :args (x1 y1) + :conclusion (= (/ (to_real x1) y1) (/ x1 y1)) ) -(declare-rule arith-div-elim-to-real2 ((@T0 Type) (@T1 Type) (x72 @T0) (y73 @T1)) - :args (x72 y73) - :conclusion (= (/ x72 (to_real y73)) (/ x72 y73)) +(declare-rule arith-div-elim-to-real2 ((@T0 Type) (@T1 Type) (x1 @T0) (y1 @T1)) + :args (x1 y1) + :conclusion (= (/ x1 (to_real y1)) (/ x1 y1)) ) -(declare-rule array-read-over-write ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (t84 (Array @T0 @T1)) (i85 @T2) (e86 @T3)) - :args (t84 i85 e86) - :conclusion (= (select (store t84 i85 e86) i85) e86) +(declare-rule array-read-over-write ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (t1 (Array @T0 @T1)) (i1 @T2) (e1 @T3)) + :args (t1 i1 e1) + :conclusion (= (select (store t1 i1 e1) i1) e1) ) -(declare-rule array-read-over-write2 ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (@T4 Type) (t87 (Array @T0 @T1)) (i88 @T2) (j89 @T3) (e90 @T4)) - :premises ((= (= i88 j89) false)) - :args (t87 i88 j89 e90) - :conclusion (= (select (store t87 i88 e90) j89) (select t87 j89)) -) -(declare-rule array-store-overwrite ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (@T4 Type) (t91 (Array @T0 @T1)) (i92 @T2) (e93 @T3) (f94 @T4)) - :args (t91 i92 e93 f94) - :conclusion (= (store (store t91 i92 e93) i92 f94) (store t91 i92 f94)) -) -(declare-rule array-store-self ((@T0 Type) (@T1 Type) (@T2 Type) (t95 (Array @T0 @T1)) (i96 @T2)) - :args (t95 i96) - :conclusion (= (store t95 i96 (select t95 i96)) t95) -) -(declare-rule bool-double-not-elim ((t98 Bool)) - :args (t98) - :conclusion (= (not (not t98)) t98) -) -(declare-rule bool-not-true ((t99 Bool)) - :premises ((= t99 false)) - :args (t99) - :conclusion (= (not t99) true) -) -(declare-rule bool-not-false ((t100 Bool)) - :premises ((= t100 true)) - :args (t100) - :conclusion (= (not t100) false) +(declare-rule array-read-over-write2 ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (@T4 Type) (t1 (Array @T0 @T1)) (i1 @T2) (j1 @T3) (e1 @T4)) + :premises ((= (= i1 j1) false)) + :args (t1 i1 j1 e1) + :conclusion (= (select (store t1 i1 e1) j1) (select t1 j1)) +) +(declare-rule array-store-overwrite ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (@T4 Type) (t1 (Array @T0 @T1)) (i1 @T2) (e1 @T3) (f1 @T4)) + :args (t1 i1 e1 f1) + :conclusion (= (store (store t1 i1 e1) i1 f1) (store t1 i1 f1)) +) +(declare-rule array-store-self ((@T0 Type) (@T1 Type) (@T2 Type) (t1 (Array @T0 @T1)) (i1 @T2)) + :args (t1 i1) + :conclusion (= (store t1 i1 (select t1 i1)) t1) +) +(declare-rule bool-double-not-elim ((t1 Bool)) + :args (t1) + :conclusion (= (not (not t1)) t1) +) +(declare-rule bool-not-true ((t1 Bool)) + :premises ((= t1 false)) + :args (t1) + :conclusion (= (not t1) true) +) +(declare-rule bool-not-false ((t1 Bool)) + :premises ((= t1 true)) + :args (t1) + :conclusion (= (not t1) false) ) -(declare-rule bool-eq-true ((t101 Bool)) - :args (t101) - :conclusion (= (= t101 true) t101) +(declare-rule bool-eq-true ((t1 Bool)) + :args (t1) + :conclusion (= (= t1 true) t1) ) -(declare-rule bool-eq-false ((t102 Bool)) - :args (t102) - :conclusion (= (= t102 false) (not t102)) +(declare-rule bool-eq-false ((t1 Bool)) + :args (t1) + :conclusion (= (= t1 false) (not t1)) ) -(declare-rule bool-eq-nrefl ((x103 Bool)) - :args (x103) - :conclusion (= (= x103 (not x103)) false) +(declare-rule bool-eq-nrefl ((x1 Bool)) + :args (x1) + :conclusion (= (= x1 (not x1)) false) ) -(declare-rule bool-impl-false1 ((t104 Bool)) - :args (t104) - :conclusion (= (=> t104 false) (not t104)) +(declare-rule bool-impl-false1 ((t1 Bool)) + :args (t1) + :conclusion (= (=> t1 false) (not t1)) ) -(declare-rule bool-impl-false2 ((t105 Bool)) - :args (t105) - :conclusion (= (=> false t105) true) -) -(declare-rule bool-impl-true1 ((t106 Bool)) - :args (t106) - :conclusion (= (=> t106 true) true) -) -(declare-rule bool-impl-true2 ((t107 Bool)) - :args (t107) - :conclusion (= (=> true t107) t107) -) -(declare-rule bool-impl-elim ((t108 Bool) (s109 Bool)) - :args (t108 s109) - :conclusion (= (=> t108 s109) (or (not t108) s109)) -) -(declare-rule bool-or-true ((xs110 Bool :list) (ys111 Bool :list)) - :args (xs110 ys111) - :conclusion (= ($singleton_elim (or xs110 true ys111)) true) -) -(declare-rule bool-or-false ((xs112 Bool :list) (ys113 Bool :list)) - :args (xs112 ys113) - :conclusion (= ($singleton_elim (or xs112 false ys113)) ($singleton_elim (or xs112 ys113))) -) -(declare-rule bool-or-flatten ((xs114 Bool :list) (b115 Bool) (ys116 Bool :list) (zs117 Bool :list)) - :args (xs114 b115 ys116 zs117) - :conclusion (= ($singleton_elim (or xs114 ($singleton_elim (or b115 ys116)) zs117)) ($singleton_elim (or xs114 b115 ys116 zs117))) -) -(declare-rule bool-or-dup ((xs118 Bool :list) (b119 Bool) (ys120 Bool :list) (zs121 Bool :list)) - :args (xs118 b119 ys120 zs121) - :conclusion (= (or xs118 b119 ys120 b119 zs121) ($singleton_elim (or xs118 b119 ys120 zs121))) -) -(declare-rule bool-and-true ((xs122 Bool :list) (ys123 Bool :list)) - :args (xs122 ys123) - :conclusion (= ($singleton_elim (and xs122 true ys123)) ($singleton_elim (and xs122 ys123))) -) -(declare-rule bool-and-false ((xs124 Bool :list) (ys125 Bool :list)) - :args (xs124 ys125) - :conclusion (= ($singleton_elim (and xs124 false ys125)) false) -) -(declare-rule bool-and-flatten ((xs126 Bool :list) (b127 Bool) (ys128 Bool :list) (zs129 Bool :list)) - :args (xs126 b127 ys128 zs129) - :conclusion (= ($singleton_elim (and xs126 ($singleton_elim (and b127 ys128)) zs129)) ($singleton_elim (and xs126 b127 ys128 zs129))) -) -(declare-rule bool-and-dup ((xs130 Bool :list) (b131 Bool) (ys132 Bool :list) (zs133 Bool :list)) - :args (xs130 b131 ys132 zs133) - :conclusion (= (and xs130 b131 ys132 b131 zs133) ($singleton_elim (and xs130 b131 ys132 zs133))) -) -(declare-rule bool-and-conf ((xs134 Bool :list) (w135 Bool) (ys136 Bool :list) (zs137 Bool :list)) - :args (xs134 w135 ys136 zs137) - :conclusion (= (and xs134 w135 ys136 (not w135) zs137) false) -) -(declare-rule bool-or-taut ((xs138 Bool :list) (w139 Bool) (ys140 Bool :list) (zs141 Bool :list)) - :args (xs138 w139 ys140 zs141) - :conclusion (= (or xs138 w139 ys140 (not w139) zs141) true) -) -(declare-rule bool-or-de-morgan ((x142 Bool) (y143 Bool) (zs144 Bool :list)) - :args (x142 y143 zs144) - :conclusion (= (not (or x142 y143 zs144)) (and (not x142) (not ($singleton_elim (or y143 zs144))))) -) -(declare-rule bool-implies-de-morgan ((x145 Bool) (y146 Bool)) - :args (x145 y146) - :conclusion (= (not (=> x145 y146)) (and x145 (not y146))) -) -(declare-rule bool-and-de-morgan ((x147 Bool) (y148 Bool) (zs149 Bool :list)) - :args (x147 y148 zs149) - :conclusion (= (not (and x147 y148 zs149)) (or (not x147) (not ($singleton_elim (and y148 zs149))))) -) -(declare-rule bool-xor-refl ((x150 Bool)) - :args (x150) - :conclusion (= (xor x150 x150) false) -) -(declare-rule bool-xor-nrefl ((x151 Bool)) - :args (x151) - :conclusion (= (xor x151 (not x151)) true) -) -(declare-rule bool-xor-false ((x152 Bool)) - :args (x152) - :conclusion (= (xor x152 false) x152) -) -(declare-rule bool-xor-true ((x153 Bool)) - :args (x153) - :conclusion (= (xor x153 true) (not x153)) +(declare-rule bool-impl-false2 ((t1 Bool)) + :args (t1) + :conclusion (= (=> false t1) true) +) +(declare-rule bool-impl-true1 ((t1 Bool)) + :args (t1) + :conclusion (= (=> t1 true) true) +) +(declare-rule bool-impl-true2 ((t1 Bool)) + :args (t1) + :conclusion (= (=> true t1) t1) +) +(declare-rule bool-impl-elim ((t1 Bool) (s1 Bool)) + :args (t1 s1) + :conclusion (= (=> t1 s1) (or (not t1) s1)) +) +(declare-rule bool-or-true ((xs1 Bool :list) (ys1 Bool :list)) + :args (xs1 ys1) + :conclusion (= ($singleton_elim (or xs1 true ys1)) true) +) +(declare-rule bool-or-false ((xs1 Bool :list) (ys1 Bool :list)) + :args (xs1 ys1) + :conclusion (= ($singleton_elim (or xs1 false ys1)) ($singleton_elim (or xs1 ys1))) +) +(declare-rule bool-or-flatten ((xs1 Bool :list) (b1 Bool) (ys1 Bool :list) (zs1 Bool :list)) + :args (xs1 b1 ys1 zs1) + :conclusion (= ($singleton_elim (or xs1 ($singleton_elim (or b1 ys1)) zs1)) ($singleton_elim (or xs1 b1 ys1 zs1))) +) +(declare-rule bool-or-dup ((xs1 Bool :list) (b1 Bool) (ys1 Bool :list) (zs1 Bool :list)) + :args (xs1 b1 ys1 zs1) + :conclusion (= (or xs1 b1 ys1 b1 zs1) ($singleton_elim (or xs1 b1 ys1 zs1))) +) +(declare-rule bool-and-true ((xs1 Bool :list) (ys1 Bool :list)) + :args (xs1 ys1) + :conclusion (= ($singleton_elim (and xs1 true ys1)) ($singleton_elim (and xs1 ys1))) +) +(declare-rule bool-and-false ((xs1 Bool :list) (ys1 Bool :list)) + :args (xs1 ys1) + :conclusion (= ($singleton_elim (and xs1 false ys1)) false) +) +(declare-rule bool-and-flatten ((xs1 Bool :list) (b1 Bool) (ys1 Bool :list) (zs1 Bool :list)) + :args (xs1 b1 ys1 zs1) + :conclusion (= ($singleton_elim (and xs1 ($singleton_elim (and b1 ys1)) zs1)) ($singleton_elim (and xs1 b1 ys1 zs1))) +) +(declare-rule bool-and-dup ((xs1 Bool :list) (b1 Bool) (ys1 Bool :list) (zs1 Bool :list)) + :args (xs1 b1 ys1 zs1) + :conclusion (= (and xs1 b1 ys1 b1 zs1) ($singleton_elim (and xs1 b1 ys1 zs1))) +) +(declare-rule bool-and-conf ((xs1 Bool :list) (w1 Bool) (ys1 Bool :list) (zs1 Bool :list)) + :args (xs1 w1 ys1 zs1) + :conclusion (= (and xs1 w1 ys1 (not w1) zs1) false) +) +(declare-rule bool-or-taut ((xs1 Bool :list) (w1 Bool) (ys1 Bool :list) (zs1 Bool :list)) + :args (xs1 w1 ys1 zs1) + :conclusion (= (or xs1 w1 ys1 (not w1) zs1) true) +) +(declare-rule bool-or-de-morgan ((x1 Bool) (y1 Bool) (zs1 Bool :list)) + :args (x1 y1 zs1) + :conclusion (= (not (or x1 y1 zs1)) (and (not x1) (not ($singleton_elim (or y1 zs1))))) +) +(declare-rule bool-implies-de-morgan ((x1 Bool) (y1 Bool)) + :args (x1 y1) + :conclusion (= (not (=> x1 y1)) (and x1 (not y1))) +) +(declare-rule bool-and-de-morgan ((x1 Bool) (y1 Bool) (zs1 Bool :list)) + :args (x1 y1 zs1) + :conclusion (= (not (and x1 y1 zs1)) (or (not x1) (not ($singleton_elim (and y1 zs1))))) +) +(declare-rule bool-xor-refl ((x1 Bool)) + :args (x1) + :conclusion (= (xor x1 x1) false) +) +(declare-rule bool-xor-nrefl ((x1 Bool)) + :args (x1) + :conclusion (= (xor x1 (not x1)) true) +) +(declare-rule bool-xor-false ((x1 Bool)) + :args (x1) + :conclusion (= (xor x1 false) x1) +) +(declare-rule bool-xor-true ((x1 Bool)) + :args (x1) + :conclusion (= (xor x1 true) (not x1)) ) -(declare-rule bool-xor-comm ((x154 Bool) (y155 Bool)) - :args (x154 y155) - :conclusion (= (xor x154 y155) (xor y155 x154)) +(declare-rule bool-xor-comm ((x1 Bool) (y1 Bool)) + :args (x1 y1) + :conclusion (= (xor x1 y1) (xor y1 x1)) ) -(declare-rule bool-xor-elim ((x156 Bool) (y157 Bool)) - :args (x156 y157) - :conclusion (= (xor x156 y157) (= (not x156) y157)) -) -(declare-rule bool-not-xor-elim ((x158 Bool) (y159 Bool)) - :args (x158 y159) - :conclusion (= (not (xor x158 y159)) (= x158 y159)) -) -(declare-rule bool-not-eq-elim ((x160 Bool) (y161 Bool)) - :args (x160 y161) - :conclusion (= (not (= x160 y161)) (= (not x160) y161)) -) -(declare-rule ite-neg-branch ((c162 Bool) (x163 Bool) (y164 Bool)) - :premises ((= (not y164) x163)) - :args (c162 x163 y164) - :conclusion (= (ite c162 x163 y164) (= c162 x163)) -) -(declare-rule ite-then-true ((c165 Bool) (x166 Bool)) - :args (c165 x166) - :conclusion (= (ite c165 true x166) (or c165 x166)) -) -(declare-rule ite-else-false ((c167 Bool) (x168 Bool)) - :args (c167 x168) - :conclusion (= (ite c167 x168 false) (and c167 x168)) -) -(declare-rule ite-then-false ((c169 Bool) (x170 Bool)) - :args (c169 x170) - :conclusion (= (ite c169 false x170) (and (not c169) x170)) -) -(declare-rule ite-else-true ((c171 Bool) (x172 Bool)) - :args (c171 x172) - :conclusion (= (ite c171 x172 true) (or (not c171) x172)) -) -(declare-rule ite-then-lookahead-self ((c173 Bool) (x174 Bool)) - :args (c173 x174) - :conclusion (= (ite c173 c173 x174) (ite c173 true x174)) -) -(declare-rule ite-else-lookahead-self ((c175 Bool) (x176 Bool)) - :args (c175 x176) - :conclusion (= (ite c175 x176 c175) (ite c175 x176 false)) -) -(declare-rule bool-not-ite-elim ((c177 Bool) (x178 Bool) (y179 Bool)) - :args (c177 x178 y179) - :conclusion (= (not (ite c177 x178 y179)) (ite c177 (not x178) (not y179))) -) -(declare-rule ite-true-cond ((@T0 Type) (@T1 Type) (x190 @T0) (y191 @T1)) - :args (x190 y191) - :conclusion (= (ite true x190 y191) x190) -) -(declare-rule ite-false-cond ((@T0 Type) (@T1 Type) (x192 @T0) (y193 @T1)) - :args (x192 y193) - :conclusion (= (ite false x192 y193) y193) -) -(declare-rule ite-not-cond ((@T0 Type) (@T1 Type) (c194 Bool) (x195 @T0) (y196 @T1)) - :args (c194 x195 y196) - :conclusion (= (ite (not c194) x195 y196) (ite c194 y196 x195)) -) -(declare-rule ite-eq-branch ((@T0 Type) (c197 Bool) (x198 @T0)) - :args (c197 x198) - :conclusion (= (ite c197 x198 x198) x198) -) -(declare-rule ite-then-lookahead ((@T0 Type) (@T1 Type) (@T2 Type) (c199 Bool) (x200 @T0) (y201 @T1) (z202 @T2)) - :args (c199 x200 y201 z202) - :conclusion (= (ite c199 (ite c199 x200 y201) z202) (ite c199 x200 z202)) -) -(declare-rule ite-else-lookahead ((@T0 Type) (@T1 Type) (@T2 Type) (c203 Bool) (x204 @T0) (y205 @T1) (z206 @T2)) - :args (c203 x204 y205 z206) - :conclusion (= (ite c203 x204 (ite c203 y205 z206)) (ite c203 x204 z206)) -) -(declare-rule ite-then-neg-lookahead ((@T0 Type) (@T1 Type) (@T2 Type) (c207 Bool) (x208 @T0) (y209 @T1) (z210 @T2)) - :args (c207 x208 y209 z210) - :conclusion (= (ite c207 (ite (not c207) x208 y209) z210) (ite c207 y209 z210)) -) -(declare-rule ite-else-neg-lookahead ((@T0 Type) (@T1 Type) (@T2 Type) (c211 Bool) (x212 @T0) (y213 @T1) (z214 @T2)) - :args (c211 x212 y213 z214) - :conclusion (= (ite c211 x212 (ite (not c211) y213 z214)) (ite c211 x212 y213)) -) -(declare-rule bv-concat-flatten ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (xs216 (BitVec @n0) :list) (s217 (BitVec @n1)) (ys218 (BitVec @n2) :list) (zs219 (BitVec @n3) :list)) - :args (xs216 s217 ys218 zs219) - :conclusion (= ($singleton_elim (concat xs216 ($singleton_elim (concat s217 ys218)) zs219)) ($singleton_elim (concat xs216 s217 ys218 zs219))) -) -(declare-rule bv-concat-extract-merge ((@n0 Int) (@n1 Int) (@n2 Int) (xs220 (BitVec @n0) :list) (s221 (BitVec @n1)) (ys222 (BitVec @n2) :list) (i223 Int) (j224 Int) (j1225 Int) (k226 Int)) - :premises ((= j1225 (+ j224 1))) - :args (xs220 s221 ys222 i223 j224 j1225 k226) - :conclusion (= (concat xs220 (extract k226 j1225 s221) (extract j224 i223 s221) ys222) ($singleton_elim (concat xs220 (extract k226 i223 s221) ys222))) -) -(declare-rule bv-extract-extract ((@n0 Int) (x227 (BitVec @n0)) (i228 Int) (j229 Int) (k230 Int) (l231 Int)) - :args (x227 i228 j229 k230 l231) - :conclusion (= (extract l231 k230 (extract j229 i228 x227)) (extract (+ i228 l231) (+ i228 k230) x227)) -) -(declare-rule bv-extract-whole ((@n0 Int) (x232 (BitVec @n0)) (n233 Int)) - :premises ((= (>= n233 (- (@bvsize x232) 1)) true)) - :args (x232 n233) - :conclusion (= (extract n233 0 x232) x232) -) -(declare-rule bv-extract-concat-1 ((@n0 Int) (@n1 Int) (@n2 Int) (x234 (BitVec @n0)) (xs235 (BitVec @n1) :list) (y236 (BitVec @n2)) (i237 Int) (j238 Int)) - :premises ((= (<= j238 (@bvsize x234)) true)) - :args (x234 xs235 y236 i237 j238) - :conclusion (= (extract j238 i237 (concat xs235 y236 x234)) (extract j238 i237 x234)) -) -(declare-rule bv-extract-concat-2 ((@n0 Int) (@n1 Int) (@n2 Int) (x239 (BitVec @n0)) (xs240 (BitVec @n1) :list) (y241 (BitVec @n2)) (i242 Int) (j243 Int)) - :premises ((= (< i242 (@bvsize x239)) true) (= (>= j243 (@bvsize x239)) true)) - :args (x239 xs240 y241 i242 j243) - :conclusion (= (extract j243 i242 (concat xs240 y241 x239)) (eo::define ((_let_1 (@bvsize x239))) (concat (extract (- j243 _let_1) 0 ($singleton_elim (concat xs240 y241))) (extract (- _let_1 1) i242 x239)))) -) -(declare-rule bv-extract-concat-3 ((@n0 Int) (@n1 Int) (@n2 Int) (x244 (BitVec @n0)) (y245 (BitVec @n1)) (xs246 (BitVec @n2) :list) (i247 Int) (j248 Int)) - :premises ((= (>= i247 (@bvsize x244)) true)) - :args (x244 y245 xs246 i247 j248) - :conclusion (= (extract j248 i247 (concat xs246 y245 x244)) (eo::define ((_let_1 (@bvsize x244))) (extract (- j248 _let_1) (- i247 _let_1) ($singleton_elim (concat xs246 y245))))) -) -(declare-rule bv-extract-concat-4 ((@n0 Int) (@n1 Int) (@n2 Int) (x249 (BitVec @n0)) (y250 (BitVec @n1)) (xs251 (BitVec @n2) :list) (i252 Int) (j253 Int)) - :premises ((= (< j253 (- (@bvsize (concat x249 xs251 y250)) (@bvsize x249))) true)) - :args (x249 y250 xs251 i252 j253) - :conclusion (= (extract j253 i252 (concat x249 xs251 y250)) (extract j253 i252 ($singleton_elim (concat xs251 y250)))) -) -(declare-rule bv-extract-bitwise-and ((@n0 Int) (@n1 Int) (x254 (BitVec @n0)) (y255 (BitVec @n1)) (i256 Int) (j257 Int)) - :args (x254 y255 i256 j257) - :conclusion (= (extract j257 i256 (bvand x254 y255)) (bvand (extract j257 i256 x254) (extract j257 i256 y255))) -) -(declare-rule bv-extract-bitwise-or ((@n0 Int) (@n1 Int) (x258 (BitVec @n0)) (y259 (BitVec @n1)) (i260 Int) (j261 Int)) - :args (x258 y259 i260 j261) - :conclusion (= (extract j261 i260 (bvor x258 y259)) (bvor (extract j261 i260 x258) (extract j261 i260 y259))) -) -(declare-rule bv-extract-bitwise-xor ((@n0 Int) (@n1 Int) (x262 (BitVec @n0)) (y263 (BitVec @n1)) (i264 Int) (j265 Int)) - :args (x262 y263 i264 j265) - :conclusion (= (extract j265 i264 (bvxor x262 y263)) (bvxor (extract j265 i264 x262) (extract j265 i264 y263))) -) -(declare-rule bv-extract-not ((@n0 Int) (x266 (BitVec @n0)) (i267 Int) (j268 Int)) - :args (x266 i267 j268) - :conclusion (= (extract j268 i267 (bvnot x266)) (bvnot (extract j268 i267 x266))) -) -(declare-rule bv-extract-sign-extend-1 ((@n0 Int) (x269 (BitVec @n0)) (low270 Int) (high271 Int) (k272 Int)) - :premises ((= (< high271 (@bvsize x269)) true)) - :args (x269 low270 high271 k272) - :conclusion (= (extract high271 low270 (sign_extend k272 x269)) (extract high271 low270 x269)) -) -(declare-rule bv-extract-sign-extend-2 ((@n0 Int) (x273 (BitVec @n0)) (low274 Int) (high275 Int) (k276 Int)) - :premises ((= (< low274 (@bvsize x273)) true) (= (>= high275 (@bvsize x273)) true)) - :args (x273 low274 high275 k276) - :conclusion (= (extract high275 low274 (sign_extend k276 x273)) (eo::define ((_let_1 (@bvsize x273))) (sign_extend (+ 1 (- high275 _let_1)) (extract (- _let_1 1) low274 x273)))) -) -(declare-rule bv-extract-sign-extend-3 ((@n0 Int) (x277 (BitVec @n0)) (low278 Int) (high279 Int) (k280 Int)) - :premises ((= (>= low278 (@bvsize x277)) true)) - :args (x277 low278 high279 k280) - :conclusion (= (extract high279 low278 (sign_extend k280 x277)) (eo::define ((_let_1 (- (@bvsize x277) 1))) (repeat (+ 1 (- high279 low278)) (extract _let_1 _let_1 x277)))) -) -(declare-rule bv-neg-mult ((@n0 Int) (@n1 Int) (xs281 (BitVec @n0)) (ys282 (BitVec @n1)) (n283 Int) (m284 Int)) - :args (xs281 ys282 n283 m284) - :conclusion (= (bvneg (bvmul xs281 (@bv n283 m284) ys282)) (bvmul xs281 (@bv (- n283) m284) ys282)) -) -(declare-rule bv-neg-add ((@n0 Int) (@n1 Int) (@n2 Int) (x285 (BitVec @n0)) (y286 (BitVec @n1)) (zs287 (BitVec @n2) :list)) - :args (x285 y286 zs287) - :conclusion (= (bvneg (bvadd x285 y286 zs287)) (bvadd (bvneg x285) (bvneg ($singleton_elim (bvadd y286 zs287))))) -) -(declare-rule bv-mult-distrib-const-neg ((@n0 Int) (x288 (BitVec @n0)) (n289 Int) (m290 Int)) - :args (x288 n289 m290) - :conclusion (= (bvmul (bvneg x288) (@bv n289 m290)) (bvmul x288 (@bv (- n289) m290))) -) -(declare-rule bv-mult-distrib-const-add ((@n0 Int) (@n1 Int) (x291 (BitVec @n0)) (y292 (BitVec @n1)) (n293 Int) (m294 Int)) - :args (x291 y292 n293 m294) - :conclusion (= (bvmul (bvadd x291 y292) (@bv n293 m294)) (eo::define ((_let_1 (@bv n293 m294))) (bvadd (bvmul x291 _let_1) (bvmul y292 _let_1)))) -) -(declare-rule bv-mult-distrib-const-sub ((@n0 Int) (@n1 Int) (x295 (BitVec @n0)) (y296 (BitVec @n1)) (n297 Int) (m298 Int)) - :args (x295 y296 n297 m298) - :conclusion (= (bvmul (bvsub x295 y296) (@bv n297 m298)) (eo::define ((_let_1 (@bv n297 m298))) (bvsub (bvmul x295 _let_1) (bvmul y296 _let_1)))) -) -(declare-rule bv-mult-distrib-1 ((@n0 Int) (@n1 Int) (@n2 Int) (x1299 (BitVec @n0)) (x2300 (BitVec @n1)) (y301 (BitVec @n2))) - :args (x1299 x2300 y301) - :conclusion (= (bvmul (bvadd x1299 x2300) y301) (bvadd (bvmul x1299 y301) (bvmul x2300 y301))) -) -(declare-rule bv-mult-distrib-2 ((@n0 Int) (@n1 Int) (@n2 Int) (x1302 (BitVec @n0)) (x2303 (BitVec @n1)) (y304 (BitVec @n2))) - :args (x1302 x2303 y304) - :conclusion (= (bvmul y304 (bvadd x1302 x2303)) (bvadd (bvmul y304 x1302) (bvmul y304 x2303))) -) -(declare-rule bv-not-xor ((@n0 Int) (@n1 Int) (x305 (BitVec @n0)) (xs306 (BitVec @n1) :list)) - :args (x305 xs306) - :conclusion (= (bvnot ($singleton_elim (bvxor x305 xs306))) ($singleton_elim (bvxor (bvnot x305) xs306))) -) -(declare-rule bv-and-simplify-1 ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (xs307 (BitVec @n0) :list) (ys308 (BitVec @n1) :list) (zs309 (BitVec @n2) :list) (x310 (BitVec @n3))) - :args (xs307 ys308 zs309 x310) - :conclusion (= (bvand xs307 x310 ys308 x310 zs309) ($singleton_elim (bvand xs307 x310 ys308 zs309))) -) -(declare-rule bv-and-simplify-2 ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (xs311 (BitVec @n0) :list) (ys312 (BitVec @n1) :list) (zs313 (BitVec @n2) :list) (x314 (BitVec @n3))) - :args (xs311 ys312 zs313 x314) - :conclusion (= (bvand xs311 x314 ys312 (bvnot x314) zs313) (@bv 0 (@bvsize x314))) -) -(declare-rule bv-or-simplify-1 ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (xs315 (BitVec @n0) :list) (ys316 (BitVec @n1) :list) (zs317 (BitVec @n2) :list) (x318 (BitVec @n3))) - :args (xs315 ys316 zs317 x318) - :conclusion (= (bvor xs315 x318 ys316 x318 zs317) ($singleton_elim (bvor xs315 x318 ys316 zs317))) -) -(declare-rule bv-or-simplify-2 ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (xs319 (BitVec @n0) :list) (ys320 (BitVec @n1) :list) (zs321 (BitVec @n2) :list) (x322 (BitVec @n3))) - :args (xs319 ys320 zs321 x322) - :conclusion (= (bvor xs319 x322 ys320 (bvnot x322) zs321) (bvnot (@bv 0 (@bvsize x322)))) -) -(declare-rule bv-xor-simplify-1 ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (xs323 (BitVec @n0) :list) (ys324 (BitVec @n1) :list) (zs325 (BitVec @n2) :list) (x326 (BitVec @n3))) - :args (xs323 ys324 zs325 x326) - :conclusion (= (bvxor xs323 x326 ys324 x326 zs325) ($singleton_elim (bvxor xs323 ys324 zs325))) -) -(declare-rule bv-xor-simplify-2 ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (xs327 (BitVec @n0) :list) (ys328 (BitVec @n1) :list) (zs329 (BitVec @n2) :list) (x330 (BitVec @n3))) - :args (xs327 ys328 zs329 x330) - :conclusion (= (bvxor xs327 x330 ys328 (bvnot x330) zs329) (bvnot ($singleton_elim (bvxor xs327 ys328 zs329)))) -) -(declare-rule bv-xor-simplify-3 ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (xs331 (BitVec @n0) :list) (ys332 (BitVec @n1) :list) (zs333 (BitVec @n2) :list) (x334 (BitVec @n3))) - :args (xs331 ys332 zs333 x334) - :conclusion (= (bvxor xs331 (bvnot x334) ys332 x334 zs333) (bvnot ($singleton_elim (bvxor xs331 ys332 zs333)))) -) -(declare-rule bv-ult-add-one ((@n0 Int) (@n1 Int) (@n2 Int) (x335 (BitVec @n0)) (y336 (BitVec @n1)) (c1337 (BitVec @n2))) - :premises ((= c1337 (@bv 1 (@bvsize c1337)))) - :args (x335 y336 c1337) - :conclusion (= (bvult x335 (bvadd y336 c1337)) (and (not (bvult y336 x335)) (not (= y336 (bvnot (@bv 0 (@bvsize y336))))))) -) -(declare-rule bv-concat-to-mult ((@n0 Int) (x338 (BitVec @n0)) (i339 Int) (m340 Int) (n0341 Int)) - :premises ((= (+ 1 i339 m340) (@bvsize x338)) (= n0341 0)) - :args (x338 i339 m340 n0341) - :conclusion (= (concat (extract i339 n0341 x338) (@bv n0341 m340)) (eo::define ((_let_1 (@bvsize x338))) (bvmul x338 (bvshl (@bv 1 _let_1) (@bv m340 _let_1))))) -) -(declare-rule bv-mult-slt-mult-1 ((@n0 Int) (@n1 Int) (@n2 Int) (x342 (BitVec @n0)) (t343 (BitVec @n1)) (a344 (BitVec @n2)) (n345 Int) (m346 Int)) - :args (x342 t343 a344 n345 m346) - :conclusion (= (eo::define ((_let_1 (sign_extend m346 a344))) (bvslt (bvmul (sign_extend n345 (bvadd x342 t343)) _let_1) (bvmul (sign_extend n345 x342) _let_1))) (eo::define ((_let_1 (@bv 0 (@bvsize a344)))) (and (not (= t343 (@bv 0 (@bvsize t343)))) (not (= a344 _let_1)) (= (bvslt (bvadd x342 t343) x342) (bvsgt a344 _let_1))))) -) -(declare-rule bv-mult-slt-mult-2 ((@n0 Int) (@n1 Int) (@n2 Int) (x347 (BitVec @n0)) (t348 (BitVec @n1)) (a349 (BitVec @n2)) (n350 Int) (m351 Int)) - :args (x347 t348 a349 n350 m351) - :conclusion (= (eo::define ((_let_1 (sign_extend m351 a349))) (bvslt (bvmul (zero_extend n350 (bvadd x347 t348)) _let_1) (bvmul (zero_extend n350 x347) _let_1))) (eo::define ((_let_1 (@bv 0 (@bvsize a349)))) (and (not (= t348 (@bv 0 (@bvsize t348)))) (not (= a349 _let_1)) (= (bvult (bvadd x347 t348) x347) (bvsgt a349 _let_1))))) -) -(declare-rule bv-commutative-and ((@n0 Int) (@n1 Int) (x352 (BitVec @n0)) (y353 (BitVec @n1))) - :args (x352 y353) - :conclusion (= (bvand x352 y353) (bvand y353 x352)) -) -(declare-rule bv-commutative-or ((@n0 Int) (@n1 Int) (x354 (BitVec @n0)) (y355 (BitVec @n1))) - :args (x354 y355) - :conclusion (= (bvor x354 y355) (bvor y355 x354)) -) -(declare-rule bv-commutative-xor ((@n0 Int) (@n1 Int) (x356 (BitVec @n0)) (y357 (BitVec @n1))) - :args (x356 y357) - :conclusion (= (bvxor x356 y357) (bvxor y357 x356)) -) -(declare-rule bv-commutative-mul ((@n0 Int) (@n1 Int) (x358 (BitVec @n0)) (y359 (BitVec @n1))) - :args (x358 y359) - :conclusion (= (bvmul x358 y359) (bvmul y359 x358)) -) -(declare-rule bv-or-zero ((@n0 Int) (x360 (BitVec @n0)) (n361 Int)) - :args (x360 n361) - :conclusion (= (bvor x360 (@bv 0 n361)) x360) -) -(declare-rule bv-mul-one ((@n0 Int) (@n1 Int) (x362 (BitVec @n0)) (c1363 (BitVec @n1))) - :premises ((= c1363 (@bv 1 (@bvsize c1363)))) - :args (x362 c1363) - :conclusion (= (bvmul x362 c1363) x362) -) -(declare-rule bv-mul-zero ((@n0 Int) (@n1 Int) (x364 (BitVec @n0)) (c0365 (BitVec @n1))) - :premises ((= c0365 (@bv 0 (@bvsize c0365)))) - :args (x364 c0365) - :conclusion (= (bvmul x364 c0365) (@bv 0 (@bvsize x364))) -) -(declare-rule bv-add-zero ((@n0 Int) (@n1 Int) (x366 (BitVec @n0)) (c0367 (BitVec @n1))) - :premises ((= c0367 (@bv 0 (@bvsize c0367)))) - :args (x366 c0367) - :conclusion (= (bvadd x366 c0367) x366) -) -(declare-rule bv-add-two ((@n0 Int) (x368 (BitVec @n0))) - :args (x368) - :conclusion (= (bvadd x368 x368) (bvmul x368 (@bv 2 (@bvsize x368)))) -) -(declare-rule bv-zero-extend-eliminate-0 ((@n0 Int) (x369 (BitVec @n0))) - :args (x369) - :conclusion (= (zero_extend 0 x369) x369) -) -(declare-rule bv-sign-extend-eliminate-0 ((@n0 Int) (x370 (BitVec @n0))) - :args (x370) - :conclusion (= (sign_extend 0 x370) x370) -) -(declare-rule bv-not-neq ((@n0 Int) (x371 (BitVec @n0))) - :premises ((= (> (@bvsize x371) 0) true)) - :args (x371) - :conclusion (= (= x371 (bvnot x371)) false) -) -(declare-rule bv-ult-ones ((@n0 Int) (@n1 Int) (x372 (BitVec @n0)) (y373 (BitVec @n1))) - :premises ((= y373 (bvnot (@bv 0 (@bvsize y373))))) - :args (x372 y373) - :conclusion (= (bvult x372 y373) (distinct x372 y373)) -) -(declare-rule bv-or-flatten ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (xs374 (BitVec @n0) :list) (s375 (BitVec @n1)) (ys376 (BitVec @n2) :list) (zs377 (BitVec @n3) :list)) - :args (xs374 s375 ys376 zs377) - :conclusion (= ($singleton_elim (bvor xs374 ($singleton_elim (bvor s375 ys376)) zs377)) ($singleton_elim (bvor xs374 s375 ys376 zs377))) -) -(declare-rule bv-xor-flatten ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (xs378 (BitVec @n0) :list) (s379 (BitVec @n1)) (ys380 (BitVec @n2) :list) (zs381 (BitVec @n3) :list)) - :args (xs378 s379 ys380 zs381) - :conclusion (= ($singleton_elim (bvxor xs378 ($singleton_elim (bvxor s379 ys380)) zs381)) ($singleton_elim (bvxor xs378 s379 ys380 zs381))) -) -(declare-rule bv-and-flatten ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (xs382 (BitVec @n0) :list) (s383 (BitVec @n1)) (ys384 (BitVec @n2) :list) (zs385 (BitVec @n3) :list)) - :args (xs382 s383 ys384 zs385) - :conclusion (= ($singleton_elim (bvand xs382 ($singleton_elim (bvand s383 ys384)) zs385)) ($singleton_elim (bvand xs382 s383 ys384 zs385))) -) -(declare-rule bv-mul-flatten ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (xs386 (BitVec @n0) :list) (s387 (BitVec @n1)) (ys388 (BitVec @n2) :list) (zs389 (BitVec @n3) :list)) - :args (xs386 s387 ys388 zs389) - :conclusion (= ($singleton_elim (bvmul xs386 ($singleton_elim (bvmul s387 ys388)) zs389)) ($singleton_elim (bvmul xs386 s387 ys388 zs389))) -) -(declare-rule bv-concat-merge-const ((@n0 Int) (@n1 Int) (xs390 (BitVec @n0) :list) (n1391 Int) (w1392 Int) (n2393 Int) (w2394 Int) (zs395 (BitVec @n1) :list)) - :args (xs390 n1391 w1392 n2393 w2394 zs395) - :conclusion (= (concat xs390 (@bv n1391 w1392) (@bv n2393 w2394) zs395) ($singleton_elim (concat xs390 (@bv (+ (* n1391 (int.pow2 w2394)) n2393) (+ w1392 w2394)) zs395))) -) -(declare-rule bv-commutative-add ((@n0 Int) (@n1 Int) (x396 (BitVec @n0)) (y397 (BitVec @n1))) - :args (x396 y397) - :conclusion (= (bvadd x396 y397) (bvadd y397 x396)) -) -(declare-rule bv-neg-sub ((@n0 Int) (@n1 Int) (x398 (BitVec @n0)) (y399 (BitVec @n1))) - :args (x398 y399) - :conclusion (= (bvneg (bvsub x398 y399)) (bvsub y399 x398)) -) -(declare-rule bv-neg-idemp ((@n0 Int) (x400 (BitVec @n0))) - :args (x400) - :conclusion (= (bvneg (bvneg x400)) x400) -) -(declare-rule bv-sub-eliminate ((@n0 Int) (@n1 Int) (x401 (BitVec @n0)) (y402 (BitVec @n1))) - :args (x401 y402) - :conclusion (= (bvsub x401 y402) (bvadd x401 (bvneg y402))) -) -(declare-rule bv-ugt-eliminate ((@n0 Int) (@n1 Int) (x432 (BitVec @n0)) (y433 (BitVec @n1))) - :args (x432 y433) - :conclusion (= (bvugt x432 y433) (bvult y433 x432)) -) -(declare-rule bv-uge-eliminate ((@n0 Int) (@n1 Int) (x434 (BitVec @n0)) (y435 (BitVec @n1))) - :args (x434 y435) - :conclusion (= (bvuge x434 y435) (bvule y435 x434)) -) -(declare-rule bv-sgt-eliminate ((@n0 Int) (@n1 Int) (x436 (BitVec @n0)) (y437 (BitVec @n1))) - :args (x436 y437) - :conclusion (= (bvsgt x436 y437) (bvslt y437 x436)) -) -(declare-rule bv-sge-eliminate ((@n0 Int) (@n1 Int) (x438 (BitVec @n0)) (y439 (BitVec @n1))) - :args (x438 y439) - :conclusion (= (bvsge x438 y439) (bvsle y439 x438)) -) -(declare-rule bv-slt-eliminate ((@n0 Int) (@n1 Int) (x440 (BitVec @n0)) (y441 (BitVec @n1))) - :args (x440 y441) - :conclusion (= (bvslt x440 y441) (eo::define ((_let_1 (@bvsize x440))) (eo::define ((_let_2 (bvshl (@bv 1 _let_1) (@bv (- _let_1 1) _let_1)))) (bvult (bvadd x440 _let_2) (bvadd y441 _let_2))))) -) -(declare-rule bv-sle-eliminate ((@n0 Int) (@n1 Int) (x442 (BitVec @n0)) (y443 (BitVec @n1))) - :args (x442 y443) - :conclusion (= (bvsle x442 y443) (not (bvslt y443 x442))) -) -(declare-rule bv-redor-eliminate ((@n0 Int) (x444 (BitVec @n0))) - :args (x444) - :conclusion (= (bvredor x444) (bvnot (bvcomp x444 (@bv 0 (@bvsize x444))))) -) -(declare-rule bv-redand-eliminate ((@n0 Int) (x445 (BitVec @n0))) - :args (x445) - :conclusion (= (bvredand x445) (bvcomp x445 (bvnot (@bv 0 (@bvsize x445))))) -) -(declare-rule bv-ule-eliminate ((@n0 Int) (@n1 Int) (x446 (BitVec @n0)) (y447 (BitVec @n1))) - :args (x446 y447) - :conclusion (= (bvule x446 y447) (not (bvult y447 x446))) -) -(declare-rule bv-comp-eliminate ((@n0 Int) (@n1 Int) (x448 (BitVec @n0)) (y449 (BitVec @n1))) - :args (x448 y449) - :conclusion (= (bvcomp x448 y449) (ite (= x448 y449) (@bv 1 1) (@bv 0 1))) -) -(declare-rule bv-repeat-eliminate-1 ((@n0 Int) (x450 (BitVec @n0)) (n451 Int)) - :premises ((= (> n451 1) true)) - :args (x450 n451) - :conclusion (= (repeat n451 x450) (concat x450 (repeat (- n451 1) x450))) -) -(declare-rule bv-repeat-eliminate-2 ((@n0 Int) (x452 (BitVec @n0)) (n453 Int)) - :premises ((= n453 1)) - :args (x452 n453) - :conclusion (= (repeat n453 x452) x452) -) -(declare-rule bv-rotate-left-eliminate-1 ((@n0 Int) (x454 (BitVec @n0)) (amount455 Int)) - :premises ((= (= (mod amount455 (@bvsize x454)) 0) false)) - :args (x454 amount455) - :conclusion (= (rotate_left amount455 x454) (eo::define ((_let_1 (@bvsize x454))) (eo::define ((_let_2 (mod amount455 _let_1))) (concat (extract (- _let_1 (+ 1 _let_2)) 0 x454) (extract (- _let_1 1) (- _let_1 _let_2) x454))))) -) -(declare-rule bv-rotate-left-eliminate-2 ((@n0 Int) (x456 (BitVec @n0)) (amount457 Int)) - :premises ((= (mod amount457 (@bvsize x456)) 0)) - :args (x456 amount457) - :conclusion (= (rotate_left amount457 x456) x456) -) -(declare-rule bv-rotate-right-eliminate-1 ((@n0 Int) (x458 (BitVec @n0)) (amount459 Int)) - :premises ((= (= (mod amount459 (@bvsize x458)) 0) false)) - :args (x458 amount459) - :conclusion (= (rotate_right amount459 x458) (eo::define ((_let_1 (@bvsize x458))) (eo::define ((_let_2 (mod amount459 _let_1))) (concat (extract (- _let_2 1) 0 x458) (extract (- _let_1 1) _let_2 x458))))) -) -(declare-rule bv-rotate-right-eliminate-2 ((@n0 Int) (x460 (BitVec @n0)) (amount461 Int)) - :premises ((= (mod amount461 (@bvsize x460)) 0)) - :args (x460 amount461) - :conclusion (= (rotate_right amount461 x460) x460) -) -(declare-rule bv-nand-eliminate ((@n0 Int) (@n1 Int) (x462 (BitVec @n0)) (y463 (BitVec @n1))) - :args (x462 y463) - :conclusion (= (bvnand x462 y463) (bvnot (bvand x462 y463))) -) -(declare-rule bv-nor-eliminate ((@n0 Int) (@n1 Int) (x464 (BitVec @n0)) (y465 (BitVec @n1))) - :args (x464 y465) - :conclusion (= (bvnor x464 y465) (bvnot (bvor x464 y465))) -) -(declare-rule bv-xnor-eliminate ((@n0 Int) (@n1 Int) (x466 (BitVec @n0)) (y467 (BitVec @n1))) - :args (x466 y467) - :conclusion (= (bvxnor x466 y467) (bvnot (bvxor x466 y467))) -) -(declare-rule bv-sdiv-eliminate ((@n0 Int) (@n1 Int) (x468 (BitVec @n0)) (y469 (BitVec @n1))) - :args (x468 y469) - :conclusion (= (bvsdiv x468 y469) (eo::define ((_let_1 (@bv 1 1))) (eo::define ((_let_2 (- (@bvsize x468) 1))) (eo::define ((_let_3 (= (extract _let_2 _let_2 y469) _let_1))) (eo::define ((_let_4 (= (extract _let_2 _let_2 x468) _let_1))) (eo::define ((_let_5 (bvudiv (ite _let_4 (bvneg x468) x468) (ite _let_3 (bvneg y469) y469)))) (ite (xor _let_4 _let_3) (bvneg _let_5) _let_5))))))) -) -(declare-rule bv-sdiv-eliminate-fewer-bitwise-ops ((@n0 Int) (@n1 Int) (x470 (BitVec @n0)) (y471 (BitVec @n1))) - :args (x470 y471) - :conclusion (= (bvsdiv x470 y471) (eo::define ((_let_1 (concat (@bv 1 1) (@bv 0 (- (@bvsize x470) 1))))) (eo::define ((_let_2 (bvuge y471 _let_1))) (eo::define ((_let_3 (bvuge x470 _let_1))) (eo::define ((_let_4 (bvudiv (ite _let_3 (bvneg x470) x470) (ite _let_2 (bvneg y471) y471)))) (ite (xor _let_3 _let_2) (bvneg _let_4) _let_4)))))) -) -(declare-rule bv-zero-extend-eliminate ((@n0 Int) (x472 (BitVec @n0)) (n473 Int)) - :args (x472 n473) - :conclusion (= (zero_extend n473 x472) (concat (@bv 0 n473) x472)) -) -(declare-rule bv-sign-extend-eliminate ((@n0 Int) (x474 (BitVec @n0)) (n475 Int)) - :args (x474 n475) - :conclusion (= (sign_extend n475 x474) (eo::define ((_let_1 (- (@bvsize x474) 1))) (concat (repeat n475 (extract _let_1 _let_1 x474)) x474))) -) -(declare-rule bv-uaddo-eliminate ((@n0 Int) (@n1 Int) (x476 (BitVec @n0)) (y477 (BitVec @n1))) - :args (x476 y477) - :conclusion (= (bvuaddo x476 y477) (eo::define ((_let_1 (@bv 0 1))) (eo::define ((_let_2 (- (@bvsize x476) 1))) (= (extract _let_2 _let_2 (bvadd (concat _let_1 x476) (concat _let_1 y477))) (@bv 1 1))))) -) -(declare-rule bv-saddo-eliminate ((@n0 Int) (@n1 Int) (x478 (BitVec @n0)) (y479 (BitVec @n1))) - :args (x478 y479) - :conclusion (= (bvsaddo x478 y479) (eo::define ((_let_1 (@bv 0 1))) (eo::define ((_let_2 (- (@bvsize x478) 1))) (eo::define ((_let_3 (extract _let_2 _let_2 (bvadd x478 y479)))) (eo::define ((_let_4 (@bv 1 1))) (eo::define ((_let_5 (extract _let_2 _let_2 y479))) (eo::define ((_let_6 (extract _let_2 _let_2 x478))) (or (and (and (= _let_6 _let_1) (= _let_5 _let_1)) (= _let_3 _let_4)) (and (and (= _let_6 _let_4) (= _let_5 _let_4)) (= _let_3 _let_1)))))))))) -) -(declare-rule bv-sdivo-eliminate ((@n0 Int) (@n1 Int) (x480 (BitVec @n0)) (y481 (BitVec @n1))) - :args (x480 y481) - :conclusion (= (bvsdivo x480 y481) (and (= x480 (concat (@bv 1 1) (@bv 0 (- (@bvsize x480) 1)))) (= y481 (bvnot (@bv 0 (@bvsize y481)))))) -) -(declare-rule bv-smod-eliminate ((@n0 Int) (@n1 Int) (x482 (BitVec @n0)) (y483 (BitVec @n1))) - :args (x482 y483) - :conclusion (= (bvsmod x482 y483) (eo::define ((_let_1 (@bv 1 1))) (eo::define ((_let_2 (@bvsize x482))) (eo::define ((_let_3 (- _let_2 1))) (eo::define ((_let_4 (= (extract _let_3 _let_3 y483) _let_1))) (eo::define ((_let_5 (= (extract _let_3 _let_3 x482) _let_1))) (eo::define ((_let_6 (bvurem (ite _let_5 (bvneg x482) x482) (ite _let_4 (bvneg y483) y483)))) (eo::define ((_let_7 (bvneg _let_6))) (eo::define ((_let_8 (not _let_5))) (eo::define ((_let_9 (not _let_4))) (ite (= _let_6 (@bv 0 _let_2)) _let_6 (ite (and _let_8 _let_9) _let_6 (ite (and _let_5 _let_9) (bvadd _let_7 y483) (ite (and _let_8 _let_4) (bvadd _let_6 y483) _let_7)))))))))))))) -) -(declare-rule bv-smod-eliminate-fewer-bitwise-ops ((@n0 Int) (@n1 Int) (x484 (BitVec @n0)) (y485 (BitVec @n1))) - :args (x484 y485) - :conclusion (= (bvsmod x484 y485) (eo::define ((_let_1 (@bvsize x484))) (eo::define ((_let_2 (concat (@bv 1 1) (@bv 0 (- _let_1 1))))) (eo::define ((_let_3 (bvuge y485 _let_2))) (eo::define ((_let_4 (bvuge x484 _let_2))) (eo::define ((_let_5 (bvurem (ite _let_4 (bvneg x484) x484) (ite _let_3 (bvneg y485) y485)))) (eo::define ((_let_6 (bvneg _let_5))) (eo::define ((_let_7 (not _let_4))) (eo::define ((_let_8 (not _let_3))) (ite (= _let_5 (@bv 0 _let_1)) _let_5 (ite (and _let_7 _let_8) _let_5 (ite (and _let_4 _let_8) (bvadd _let_6 y485) (ite (and _let_7 _let_3) (bvadd _let_5 y485) _let_6))))))))))))) -) -(declare-rule bv-srem-eliminate ((@n0 Int) (@n1 Int) (x486 (BitVec @n0)) (y487 (BitVec @n1))) - :args (x486 y487) - :conclusion (= (bvsrem x486 y487) (eo::define ((_let_1 (- (@bvsize x486) 1))) (eo::define ((_let_2 (extract _let_1 _let_1 x486))) (eo::define ((_let_3 (bvurem (bvite _let_2 (bvneg x486) x486) (bvite (extract _let_1 _let_1 y487) (bvneg y487) y487)))) (bvite _let_2 (bvneg _let_3) _let_3))))) -) -(declare-rule bv-srem-eliminate-fewer-bitwise-ops ((@n0 Int) (@n1 Int) (x488 (BitVec @n0)) (y489 (BitVec @n1))) - :args (x488 y489) - :conclusion (= (bvsrem x488 y489) (eo::define ((_let_1 (concat (@bv 1 1) (@bv 0 (- (@bvsize x488) 1))))) (eo::define ((_let_2 (bvuge x488 _let_1))) (eo::define ((_let_3 (bvurem (ite _let_2 (bvneg x488) x488) (ite (bvuge y489 _let_1) (bvneg y489) y489)))) (ite _let_2 (bvneg _let_3) _let_3))))) -) -(declare-rule bv-usubo-eliminate ((@n0 Int) (@n1 Int) (x490 (BitVec @n0)) (y491 (BitVec @n1))) - :args (x490 y491) - :conclusion (= (bvusubo x490 y491) (eo::define ((_let_1 (@bvsize x490))) (= (extract _let_1 _let_1 (bvsub (zero_extend 1 x490) (zero_extend 1 y491))) (@bv 1 1)))) -) -(declare-rule bv-ssubo-eliminate ((@n0 Int) (@n1 Int) (x492 (BitVec @n0)) (y493 (BitVec @n1))) - :args (x492 y493) - :conclusion (= (bvssubo x492 y493) (eo::define ((_let_1 (@bv 1 1))) (eo::define ((_let_2 (- (@bvsize x492) 1))) (eo::define ((_let_3 (= (extract _let_2 _let_2 (bvsub x492 y493)) _let_1))) (eo::define ((_let_4 (= (extract _let_2 _let_2 y493) _let_1))) (eo::define ((_let_5 (= (extract _let_2 _let_2 x492) _let_1))) (or (and _let_5 (not _let_4) (not _let_3)) (and (not _let_5) _let_4 _let_3)))))))) -) -(declare-rule bv-ite-equal-children ((@n0 Int) (c546 (_ BitVec 1)) (x547 (BitVec @n0))) - :args (c546 x547) - :conclusion (= (bvite c546 x547 x547) x547) -) -(declare-rule bv-ite-const-children-1 ((c548 (_ BitVec 1))) - :args (c548) - :conclusion (= (bvite c548 (@bv 0 1) (@bv 1 1)) (bvnot c548)) -) -(declare-rule bv-ite-const-children-2 ((c549 (_ BitVec 1))) - :args (c549) - :conclusion (= (bvite c549 (@bv 1 1) (@bv 0 1)) c549) -) -(declare-rule bv-ite-equal-cond-1 ((@n0 Int) (@n1 Int) (@n2 Int) (c0550 (_ BitVec 1)) (t0551 (BitVec @n0)) (e0552 (BitVec @n1)) (e1553 (BitVec @n2))) - :args (c0550 t0551 e0552 e1553) - :conclusion (= (bvite c0550 (bvite c0550 t0551 e0552) e1553) (bvite c0550 t0551 e1553)) -) -(declare-rule bv-ite-equal-cond-2 ((@n0 Int) (@n1 Int) (@n2 Int) (c0554 (_ BitVec 1)) (t0555 (BitVec @n0)) (t1556 (BitVec @n1)) (e1557 (BitVec @n2))) - :args (c0554 t0555 t1556 e1557) - :conclusion (= (bvite c0554 t0555 (bvite c0554 t1556 e1557)) (bvite c0554 t0555 e1557)) -) -(declare-rule bv-ite-equal-cond-3 ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (c0558 (_ BitVec 1)) (t0559 (BitVec @n0)) (e0560 (BitVec @n1)) (t1561 (BitVec @n2)) (e1562 (BitVec @n3))) - :args (c0558 t0559 e0560 t1561 e1562) - :conclusion (= (bvite c0558 (bvite c0558 t0559 e0560) (bvite c0558 t1561 e1562)) (bvite c0558 t0559 e1562)) -) -(declare-rule bv-ite-merge-then-if ((@n0 Int) (@n1 Int) (c0563 (_ BitVec 1)) (c1564 (_ BitVec 1)) (t1565 (BitVec @n0)) (e1566 (BitVec @n1))) - :args (c0563 c1564 t1565 e1566) - :conclusion (= (bvite c0563 (bvite c1564 t1565 e1566) t1565) (bvite (bvand c0563 (bvnot c1564)) e1566 t1565)) -) -(declare-rule bv-ite-merge-else-if ((@n0 Int) (@n1 Int) (c0567 (_ BitVec 1)) (c1568 (_ BitVec 1)) (t1569 (BitVec @n0)) (e1570 (BitVec @n1))) - :args (c0567 c1568 t1569 e1570) - :conclusion (= (bvite c0567 (bvite c1568 t1569 e1570) e1570) (bvite (bvand c0567 c1568) t1569 e1570)) -) -(declare-rule bv-ite-merge-then-else ((@n0 Int) (@n1 Int) (c0571 (_ BitVec 1)) (c1572 (_ BitVec 1)) (t0573 (BitVec @n0)) (e1574 (BitVec @n1))) - :args (c0571 c1572 t0573 e1574) - :conclusion (= (bvite c0571 t0573 (bvite c1572 t0573 e1574)) (bvite (bvnor c0571 c1572) e1574 t0573)) -) -(declare-rule bv-ite-merge-else-else ((@n0 Int) (@n1 Int) (c0575 (_ BitVec 1)) (c1576 (_ BitVec 1)) (t1577 (BitVec @n0)) (t0578 (BitVec @n1))) - :args (c0575 c1576 t1577 t0578) - :conclusion (= (bvite c0575 t0578 (bvite c1576 t1577 t0578)) (bvite (bvand (bvnot c0575) c1576) t1577 t0578)) -) -(declare-rule bv-shl-by-const-0 ((@n0 Int) (x579 (BitVec @n0)) (sz580 Int)) - :args (x579 sz580) - :conclusion (= (bvshl x579 (@bv 0 sz580)) x579) -) -(declare-rule bv-shl-by-const-1 ((@n0 Int) (x581 (BitVec @n0)) (amount582 Int) (sz583 Int)) - :premises ((= (< amount582 (@bvsize x581)) true)) - :args (x581 amount582 sz583) - :conclusion (= (bvshl x581 (@bv amount582 sz583)) (concat (extract (- (@bvsize x581) (+ 1 amount582)) 0 x581) (@bv 0 amount582))) -) -(declare-rule bv-shl-by-const-2 ((@n0 Int) (x584 (BitVec @n0)) (amount585 Int) (sz586 Int)) - :premises ((= (>= amount585 (@bvsize x584)) true)) - :args (x584 amount585 sz586) - :conclusion (= (bvshl x584 (@bv amount585 sz586)) (@bv 0 (@bvsize x584))) -) -(declare-rule bv-lshr-by-const-0 ((@n0 Int) (x587 (BitVec @n0)) (sz588 Int)) - :args (x587 sz588) - :conclusion (= (bvlshr x587 (@bv 0 sz588)) x587) -) -(declare-rule bv-lshr-by-const-1 ((@n0 Int) (x589 (BitVec @n0)) (amount590 Int) (sz591 Int)) - :premises ((= (< amount590 (@bvsize x589)) true)) - :args (x589 amount590 sz591) - :conclusion (= (bvlshr x589 (@bv amount590 sz591)) (concat (@bv 0 amount590) (extract (- (@bvsize x589) 1) amount590 x589))) -) -(declare-rule bv-lshr-by-const-2 ((@n0 Int) (x592 (BitVec @n0)) (amount593 Int) (sz594 Int)) - :premises ((= (>= amount593 (@bvsize x592)) true)) - :args (x592 amount593 sz594) - :conclusion (= (bvlshr x592 (@bv amount593 sz594)) (@bv 0 sz594)) -) -(declare-rule bv-ashr-by-const-0 ((@n0 Int) (x595 (BitVec @n0)) (sz596 Int)) - :args (x595 sz596) - :conclusion (= (bvashr x595 (@bv 0 sz596)) x595) -) -(declare-rule bv-ashr-by-const-1 ((@n0 Int) (x597 (BitVec @n0)) (amount598 Int) (sz599 Int)) - :premises ((= (< amount598 (@bvsize x597)) true)) - :args (x597 amount598 sz599) - :conclusion (= (bvashr x597 (@bv amount598 sz599)) (eo::define ((_let_1 (- (@bvsize x597) 1))) (concat (repeat amount598 (extract _let_1 _let_1 x597)) (extract _let_1 amount598 x597)))) -) -(declare-rule bv-ashr-by-const-2 ((@n0 Int) (x600 (BitVec @n0)) (amount601 Int) (sz602 Int)) - :premises ((= (>= amount601 (@bvsize x600)) true)) - :args (x600 amount601 sz602) - :conclusion (= (bvashr x600 (@bv amount601 sz602)) (eo::define ((_let_1 (@bvsize x600))) (eo::define ((_let_2 (- _let_1 1))) (repeat _let_1 (extract _let_2 _let_2 x600))))) -) -(declare-rule bv-and-concat-pullup ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (x603 (BitVec @n0)) (y604 (BitVec @n1)) (z605 (BitVec @n2)) (ys606 (BitVec @n3) :list)) - :args (x603 y604 z605 ys606) - :conclusion (= (bvand x603 (concat ys606 z605 y604)) (eo::define ((_let_1 (@bvsize y604))) (concat (bvand (extract (- (@bvsize x603) 1) _let_1 x603) ($singleton_elim (concat ys606 z605))) (bvand (extract (- _let_1 1) 0 x603) y604)))) -) -(declare-rule bv-or-concat-pullup ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (x607 (BitVec @n0)) (y608 (BitVec @n1)) (z609 (BitVec @n2)) (ys610 (BitVec @n3) :list)) - :args (x607 y608 z609 ys610) - :conclusion (= (bvor x607 (concat ys610 z609 y608)) (eo::define ((_let_1 (@bvsize y608))) (concat (bvor (extract (- (@bvsize x607) 1) _let_1 x607) ($singleton_elim (concat ys610 z609))) (bvor (extract (- _let_1 1) 0 x607) y608)))) -) -(declare-rule bv-xor-concat-pullup ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (x611 (BitVec @n0)) (y612 (BitVec @n1)) (z613 (BitVec @n2)) (ys614 (BitVec @n3) :list)) - :args (x611 y612 z613 ys614) - :conclusion (= (bvxor x611 (concat ys614 z613 y612)) (eo::define ((_let_1 (@bvsize y612))) (concat (bvxor (extract (- (@bvsize x611) 1) _let_1 x611) ($singleton_elim (concat ys614 z613))) (bvxor (extract (- _let_1 1) 0 x611) y612)))) -) -(declare-rule bv-bitwise-idemp-1 ((@n0 Int) (x615 (BitVec @n0))) - :args (x615) - :conclusion (= (bvand x615 x615) x615) -) -(declare-rule bv-bitwise-idemp-2 ((@n0 Int) (x616 (BitVec @n0))) - :args (x616) - :conclusion (= (bvor x616 x616) x616) -) -(declare-rule bv-and-zero ((@n0 Int) (x617 (BitVec @n0)) (n618 Int)) - :args (x617 n618) - :conclusion (= (bvand x617 (@bv 0 n618)) (@bv 0 n618)) -) -(declare-rule bv-and-one ((@n0 Int) (@n1 Int) (x619 (BitVec @n0)) (y620 (BitVec @n1))) - :premises ((= y620 (bvnot (@bv 0 (@bvsize y620))))) - :args (x619 y620) - :conclusion (= (bvand x619 y620) x619) -) -(declare-rule bv-or-one ((@n0 Int) (@n1 Int) (x621 (BitVec @n0)) (y622 (BitVec @n1))) - :premises ((= y622 (bvnot (@bv 0 (@bvsize y622))))) - :args (x621 y622) - :conclusion (= (bvor x621 y622) (bvnot (@bv 0 (@bvsize y622)))) -) -(declare-rule bv-xor-duplicate ((@n0 Int) (x623 (BitVec @n0))) - :args (x623) - :conclusion (= (bvxor x623 x623) (@bv 0 (@bvsize x623))) -) -(declare-rule bv-xor-ones ((@n0 Int) (@n1 Int) (x624 (BitVec @n0)) (y625 (BitVec @n1))) - :premises ((= y625 (bvnot (@bv 0 (@bvsize y625))))) - :args (x624 y625) - :conclusion (= (bvxor x624 y625) (bvnot x624)) -) -(declare-rule bv-xor-zero ((@n0 Int) (x626 (BitVec @n0)) (n627 Int)) - :args (x626 n627) - :conclusion (= (bvxor x626 (@bv 0 n627)) x626) -) -(declare-rule bv-bitwise-not-and ((@n0 Int) (x628 (BitVec @n0))) - :args (x628) - :conclusion (= (bvand x628 (bvnot x628)) (@bv 0 (@bvsize x628))) -) -(declare-rule bv-bitwise-not-or ((@n0 Int) (x629 (BitVec @n0))) - :args (x629) - :conclusion (= (bvor x629 (bvnot x629)) (bvnot (@bv 0 (@bvsize x629)))) -) -(declare-rule bv-xor-not ((@n0 Int) (@n1 Int) (x630 (BitVec @n0)) (y631 (BitVec @n1))) - :args (x630 y631) - :conclusion (= (bvxor (bvnot x630) (bvnot y631)) (bvxor x630 y631)) -) -(declare-rule bv-not-idemp ((@n0 Int) (x632 (BitVec @n0))) - :args (x632) - :conclusion (= (bvnot (bvnot x632)) x632) -) -(declare-rule bv-ult-zero-1 ((@n0 Int) (x633 (BitVec @n0)) (n634 Int)) - :args (x633 n634) - :conclusion (= (bvult (@bv 0 n634) x633) (not (= x633 (@bv 0 n634)))) -) -(declare-rule bv-ult-zero-2 ((@n0 Int) (x635 (BitVec @n0)) (n636 Int)) - :args (x635 n636) - :conclusion (= (bvult x635 (@bv 0 n636)) false) -) -(declare-rule bv-ult-self ((@n0 Int) (x637 (BitVec @n0))) - :args (x637) - :conclusion (= (bvult x637 x637) false) -) -(declare-rule bv-lt-self ((@n0 Int) (x638 (BitVec @n0))) - :args (x638) - :conclusion (= (bvslt x638 x638) false) -) -(declare-rule bv-ule-self ((@n0 Int) (x639 (BitVec @n0))) - :args (x639) - :conclusion (= (bvule x639 x639) true) -) -(declare-rule bv-ule-zero ((@n0 Int) (x640 (BitVec @n0)) (n641 Int)) - :args (x640 n641) - :conclusion (= (bvule x640 (@bv 0 n641)) (= x640 (@bv 0 n641))) -) -(declare-rule bv-zero-ule ((@n0 Int) (x642 (BitVec @n0)) (n643 Int)) - :args (x642 n643) - :conclusion (= (bvule (@bv 0 n643) x642) true) -) -(declare-rule bv-sle-self ((@n0 Int) (x644 (BitVec @n0))) - :args (x644) - :conclusion (= (bvsle x644 x644) true) -) -(declare-rule bv-ule-max ((@n0 Int) (@n1 Int) (x645 (BitVec @n0)) (y646 (BitVec @n1))) - :premises ((= y646 (bvnot (@bv 0 (@bvsize y646))))) - :args (x645 y646) - :conclusion (= (bvule x645 y646) true) -) -(declare-rule bv-not-ult ((@n0 Int) (@n1 Int) (x647 (BitVec @n0)) (y648 (BitVec @n1))) - :args (x647 y648) - :conclusion (= (not (bvult x647 y648)) (bvule y648 x647)) -) -(declare-rule bv-not-ule ((@n0 Int) (@n1 Int) (x649 (BitVec @n0)) (y650 (BitVec @n1))) - :args (x649 y650) - :conclusion (= (not (bvule x649 y650)) (bvult y650 x649)) -) -(declare-rule bv-not-sle ((@n0 Int) (@n1 Int) (x651 (BitVec @n0)) (y652 (BitVec @n1))) - :args (x651 y652) - :conclusion (= (not (bvsle x651 y652)) (bvslt y652 x651)) -) -(declare-rule bv-mult-pow2-1 ((@n0 Int) (@n1 Int) (@n2 Int) (xs653 (BitVec @n0) :list) (ys654 (BitVec @n1) :list) (z655 (BitVec @n2)) (size656 Int) (n657 Int)) - :premises ((= (int.ispow2 n657) true)) - :args (xs653 ys654 z655 size656 n657) - :conclusion (= (bvmul xs653 z655 (@bv n657 size656) ys654) (eo::define ((_let_1 (int.log2 n657))) (concat (extract (- (- size656 _let_1) 1) 0 ($singleton_elim (bvmul xs653 z655 ys654))) (@bv 0 _let_1)))) -) -(declare-rule bv-mult-pow2-2 ((@n0 Int) (@n1 Int) (@n2 Int) (xs658 (BitVec @n0) :list) (ys659 (BitVec @n1) :list) (z660 (BitVec @n2)) (size661 Int) (n662 Int)) - :premises ((= (int.ispow2 (- n662)) true)) - :args (xs658 ys659 z660 size661 n662) - :conclusion (= (bvmul xs658 z660 (@bv n662 size661) ys659) (eo::define ((_let_1 (int.log2 (- n662)))) (concat (extract (- (- size661 _let_1) 1) 0 (bvneg ($singleton_elim (bvmul xs658 z660 ys659)))) (@bv 0 _let_1)))) -) -(declare-rule bv-mult-pow2-2b ((@n0 Int) (z663 (BitVec @n0)) (size664 Int) (n665 Int)) - :premises ((= (int.ispow2 (- n665)) true)) - :args (z663 size664 n665) - :conclusion (= (bvmul z663 (@bv n665 size664)) (eo::define ((_let_1 (int.log2 (- n665)))) (concat (extract (- (- size664 _let_1) 1) 0 (bvneg z663)) (@bv 0 _let_1)))) -) -(declare-rule bv-extract-mult-leading-bit ((@n0 Int) (@n1 Int) (high666 Int) (low667 Int) (x1i668 Int) (x1in669 Int) (x2670 (BitVec @n0)) (y1i671 Int) (y1in672 Int) (y2673 (BitVec @n1))) - :premises ((= (> (+ x1in669 (@bvsize x2670)) 64) true) (= (<= (- (* 2 (+ x1in669 (@bvsize x2670))) (+ (ite (= x1i668 0) x1in669 (- x1in669 (+ 1 (int.log2 x1i668)))) (ite (= y1i671 0) y1in672 (- y1in672 (+ 1 (int.log2 y1i671)))))) low667) true)) - :args (high666 low667 x1i668 x1in669 x2670 y1i671 y1in672 y2673) - :conclusion (= (extract high666 low667 (bvmul (concat (@bv x1i668 x1in669) x2670) (concat (@bv y1i671 y1in672) y2673))) (@bv 0 (+ 1 (- high666 low667)))) -) -(declare-rule bv-udiv-pow2-not-one ((@n0 Int) (x674 (BitVec @n0)) (v675 Int) (n676 Int)) - :premises ((= (int.ispow2 v675) true) (= (> v675 1) true)) - :args (x674 v675 n676) - :conclusion (= (bvudiv x674 (@bv v675 n676)) (eo::define ((_let_1 (int.log2 v675))) (concat (@bv 0 _let_1) (extract (- n676 1) _let_1 x674)))) -) -(declare-rule bv-udiv-zero ((@n0 Int) (x677 (BitVec @n0)) (n678 Int)) - :args (x677 n678) - :conclusion (= (bvudiv x677 (@bv 0 n678)) (bvnot (@bv 0 n678))) -) -(declare-rule bv-udiv-one ((@n0 Int) (x679 (BitVec @n0)) (n680 Int)) - :args (x679 n680) - :conclusion (= (bvudiv x679 (@bv 1 n680)) x679) -) -(declare-rule bv-urem-pow2-not-one ((@n0 Int) (x681 (BitVec @n0)) (v682 Int) (n683 Int)) - :premises ((= (int.ispow2 v682) true) (= (> v682 1) true)) - :args (x681 v682 n683) - :conclusion (= (bvurem x681 (@bv v682 n683)) (eo::define ((_let_1 (int.log2 v682))) (concat (@bv 0 (- n683 _let_1)) (extract (- _let_1 1) 0 x681)))) -) -(declare-rule bv-urem-one ((@n0 Int) (x684 (BitVec @n0)) (n685 Int)) - :args (x684 n685) - :conclusion (= (bvurem x684 (@bv 1 n685)) (@bv 0 n685)) -) -(declare-rule bv-urem-self ((@n0 Int) (x686 (BitVec @n0))) - :args (x686) - :conclusion (= (bvurem x686 x686) (@bv 0 (@bvsize x686))) -) -(declare-rule bv-shl-zero ((@n0 Int) (a687 (BitVec @n0)) (n688 Int)) - :args (a687 n688) - :conclusion (= (bvshl (@bv 0 n688) a687) (@bv 0 n688)) -) -(declare-rule bv-lshr-zero ((@n0 Int) (a689 (BitVec @n0)) (n690 Int)) - :args (a689 n690) - :conclusion (= (bvlshr (@bv 0 n690) a689) (@bv 0 n690)) -) -(declare-rule bv-ashr-zero ((@n0 Int) (a691 (BitVec @n0)) (n692 Int)) - :args (a691 n692) - :conclusion (= (bvashr (@bv 0 n692) a691) (@bv 0 n692)) -) -(declare-rule bv-ugt-urem ((@n0 Int) (@n1 Int) (y693 (BitVec @n0)) (x694 (BitVec @n1))) - :args (y693 x694) - :conclusion (= (bvugt (bvurem y693 x694) x694) (and (= x694 (@bv 0 (@bvsize x694))) (bvugt y693 (@bv 0 (@bvsize y693))))) -) -(declare-rule bv-ult-one ((@n0 Int) (x695 (BitVec @n0)) (n696 Int)) - :args (x695 n696) - :conclusion (= (bvult x695 (@bv 1 n696)) (= x695 (@bv 0 n696))) -) -(declare-rule bv-slt-zero ((@n0 Int) (x697 (BitVec @n0)) (n698 Int)) - :args (x697 n698) - :conclusion (= (bvslt x697 (@bv 0 n698)) (eo::define ((_let_1 (- n698 1))) (= (extract _let_1 _let_1 x697) (@bv 1 1)))) -) -(declare-rule bv-merge-sign-extend-1 ((@n0 Int) (x699 (BitVec @n0)) (i700 Int) (j701 Int)) - :args (x699 i700 j701) - :conclusion (= (sign_extend i700 (sign_extend j701 x699)) (sign_extend (+ i700 j701) x699)) -) -(declare-rule bv-merge-sign-extend-2 ((@n0 Int) (x702 (BitVec @n0)) (i703 Int) (j704 Int)) - :premises ((= (> j704 1) true)) - :args (x702 i703 j704) - :conclusion (= (sign_extend i703 (zero_extend j704 x702)) (zero_extend (+ i703 j704) x702)) -) -(declare-rule bv-merge-sign-extend-3 ((@n0 Int) (x705 (BitVec @n0)) (i706 Int) (n0707 Int)) - :premises ((= n0707 0)) - :args (x705 i706 n0707) - :conclusion (= (sign_extend i706 (zero_extend n0707 x705)) (sign_extend i706 x705)) -) -(declare-rule bv-sign-extend-eq-const-1 ((@n0 Int) (x708 (BitVec @n0)) (m709 Int) (c710 Int) (nm711 Int)) - :args (x708 m709 c710 nm711) - :conclusion (= (= (sign_extend m709 x708) (@bv c710 nm711)) (eo::define ((_let_1 (@bv c710 nm711))) (eo::define ((_let_2 (- (@bvsize x708) 1))) (eo::define ((_let_3 (@bv 0 (+ m709 1)))) (eo::define ((_let_4 (extract (- nm711 1) _let_2 _let_1))) (and (or (= _let_4 _let_3) (= _let_4 (bvnot _let_3))) (= x708 (extract _let_2 0 _let_1)))))))) -) -(declare-rule bv-sign-extend-eq-const-2 ((@n0 Int) (x712 (BitVec @n0)) (m713 Int) (c714 Int) (nm715 Int)) - :args (x712 m713 c714 nm715) - :conclusion (= (= (@bv c714 nm715) (sign_extend m713 x712)) (eo::define ((_let_1 (@bv c714 nm715))) (eo::define ((_let_2 (- (@bvsize x712) 1))) (eo::define ((_let_3 (@bv 0 (+ m713 1)))) (eo::define ((_let_4 (extract (- nm715 1) _let_2 _let_1))) (and (or (= _let_4 _let_3) (= _let_4 (bvnot _let_3))) (= x712 (extract _let_2 0 _let_1)))))))) -) -(declare-rule bv-zero-extend-eq-const-1 ((@n0 Int) (x716 (BitVec @n0)) (m717 Int) (c718 Int) (nm719 Int)) - :args (x716 m717 c718 nm719) - :conclusion (= (= (zero_extend m717 x716) (@bv c718 nm719)) (eo::define ((_let_1 (@bv c718 nm719))) (eo::define ((_let_2 (- (@bvsize x716) 1))) (and (= (extract (- nm719 1) _let_2 _let_1) (@bv 0 m717)) (= x716 (extract _let_2 0 _let_1)))))) -) -(declare-rule bv-zero-extend-eq-const-2 ((@n0 Int) (x720 (BitVec @n0)) (m721 Int) (c722 Int) (nm723 Int)) - :args (x720 m721 c722 nm723) - :conclusion (= (= (@bv c722 nm723) (zero_extend m721 x720)) (eo::define ((_let_1 (@bv c722 nm723))) (eo::define ((_let_2 (- (@bvsize x720) 1))) (and (= (extract (- nm723 1) _let_2 _let_1) (@bv 0 m721)) (= x720 (extract _let_2 0 _let_1)))))) -) -(declare-rule bv-zero-extend-ult-const-1 ((@n0 Int) (x724 (BitVec @n0)) (m725 Int) (c726 Int) (nm727 Int)) - :premises ((= (extract (- nm727 1) (@bvsize x724) (@bv c726 nm727)) (@bv 0 m725))) - :args (x724 m725 c726 nm727) - :conclusion (= (bvult (zero_extend m725 x724) (@bv c726 nm727)) (bvult x724 (extract (- (@bvsize x724) 1) 0 (@bv c726 nm727)))) -) -(declare-rule bv-zero-extend-ult-const-2 ((@n0 Int) (x728 (BitVec @n0)) (m729 Int) (c730 Int) (nm731 Int)) - :premises ((= (extract (- nm731 1) (@bvsize x728) (@bv c730 nm731)) (@bv 0 m729))) - :args (x728 m729 c730 nm731) - :conclusion (= (bvult (@bv c730 nm731) (zero_extend m729 x728)) (bvult (extract (- (@bvsize x728) 1) 0 (@bv c730 nm731)) x728)) -) -(declare-rule bv-sign-extend-ult-const-1 ((@n0 Int) (x732 (BitVec @n0)) (m733 Int) (c734 Int) (nm735 Int)) - :premises ((eo::define ((_let_1 (@bv (- (@bvsize x732) 1) nm735))) (eo::define ((_let_2 (@bv c734 nm735))) (= (or (bvule _let_2 (bvshl (@bv 1 nm735) _let_1)) (bvuge _let_2 (bvshl (bvnot (@bv 0 nm735)) _let_1))) true)))) - :args (x732 m733 c734 nm735) - :conclusion (= (bvult (sign_extend m733 x732) (@bv c734 nm735)) (bvult x732 (extract (- (@bvsize x732) 1) 0 (@bv c734 nm735)))) -) -(declare-rule bv-sign-extend-ult-const-2 ((@n0 Int) (x736 (BitVec @n0)) (m737 Int) (c738 Int) (nm739 Int)) - :premises ((= (bvult (bvshl (@bv 1 nm739) (@bv (- (@bvsize x736) 1) nm739)) (@bv c738 nm739)) true) (= (bvule (@bv c738 nm739) (bvshl (bvnot (@bv 0 nm739)) (@bv (- (@bvsize x736) 1) nm739))) true)) - :args (x736 m737 c738 nm739) - :conclusion (= (bvult (sign_extend m737 x736) (@bv c738 nm739)) (eo::define ((_let_1 (- (@bvsize x736) 1))) (= (extract _let_1 _let_1 x736) (@bv 0 1)))) -) -(declare-rule bv-sign-extend-ult-const-3 ((@n0 Int) (x740 (BitVec @n0)) (m741 Int) (c742 Int) (nm743 Int)) - :premises ((eo::define ((_let_1 (bvshl (@bv 1 nm743) (@bv (- (@bvsize x740) 1) nm743)))) (eo::define ((_let_2 (@bv c742 nm743))) (= (or (bvult _let_2 _let_1) (bvuge _let_2 (bvnot _let_1))) true)))) - :args (x740 m741 c742 nm743) - :conclusion (= (bvult (@bv c742 nm743) (sign_extend m741 x740)) (bvult (extract (- (@bvsize x740) 1) 0 (@bv c742 nm743)) x740)) -) -(declare-rule bv-sign-extend-ult-const-4 ((@n0 Int) (x744 (BitVec @n0)) (m745 Int) (c746 Int) (nm747 Int)) - :premises ((= (bvule (bvnot (bvshl (bvnot (@bv 0 nm747)) (@bv (- (@bvsize x744) 1) nm747))) (@bv c746 nm747)) true) (= (bvule (@bv c746 nm747) (bvnot (bvshl (@bv 1 nm747) (@bv (- (@bvsize x744) 1) nm747)))) true)) - :args (x744 m745 c746 nm747) - :conclusion (= (bvult (@bv c746 nm747) (sign_extend m745 x744)) (eo::define ((_let_1 (- (@bvsize x744) 1))) (= (extract _let_1 _let_1 x744) (@bv 1 1)))) -) -(declare-rule sets-eq-singleton-emp ((@T0 Type) (@T1 Type) (x812 (Set @T0)) (y813 @T1)) - :premises ((= (set.is_empty x812) true)) - :args (x812 y813) - :conclusion (= (= x812 (set.singleton y813)) false) -) -(declare-rule sets-member-singleton ((@T0 Type) (@T1 Type) (x814 @T0) (y815 @T1)) - :args (x814 y815) - :conclusion (= (set.member x814 (set.singleton y815)) (= x814 y815)) -) -(declare-rule sets-member-emp ((@T0 Type) (@T1 Type) (x816 @T0) (y817 (Set @T1))) - :premises ((= (set.is_empty y817) true)) - :args (x816 y817) - :conclusion (= (set.member x816 y817) false) -) -(declare-rule sets-subset-elim ((@T0 Type) (@T1 Type) (x818 (Set @T0)) (y819 (Set @T1))) - :args (x818 y819) - :conclusion (= (set.subset x818 y819) (= (set.union x818 y819) y819)) -) -(declare-rule sets-union-comm ((@T0 Type) (@T1 Type) (x820 (Set @T0)) (y821 (Set @T1))) - :args (x820 y821) - :conclusion (= (set.union x820 y821) (set.union y821 x820)) -) -(declare-rule sets-inter-comm ((@T0 Type) (@T1 Type) (x822 (Set @T0)) (y823 (Set @T1))) - :args (x822 y823) - :conclusion (= (set.inter x822 y823) (set.inter y823 x822)) -) -(declare-rule sets-inter-emp1 ((@T0 Type) (@T1 Type) (x824 (Set @T0)) (y825 (Set @T1))) - :premises ((= (set.is_empty x824) true)) - :args (x824 y825) - :conclusion (= (set.inter x824 y825) x824) -) -(declare-rule sets-inter-emp2 ((@T0 Type) (@T1 Type) (x826 (Set @T0)) (y827 (Set @T1))) - :premises ((= (set.is_empty y827) true)) - :args (x826 y827) - :conclusion (= (set.inter x826 y827) y827) -) -(declare-rule sets-minus-emp1 ((@T0 Type) (@T1 Type) (x828 (Set @T0)) (y829 (Set @T1))) - :premises ((= (set.is_empty x828) true)) - :args (x828 y829) - :conclusion (= (set.minus x828 y829) x828) -) -(declare-rule sets-minus-emp2 ((@T0 Type) (@T1 Type) (x830 (Set @T0)) (y831 (Set @T1))) - :premises ((= (set.is_empty y831) true)) - :args (x830 y831) - :conclusion (= (set.minus x830 y831) x830) -) -(declare-rule sets-union-emp1 ((@T0 Type) (@T1 Type) (x832 (Set @T0)) (y833 (Set @T1))) - :premises ((= (set.is_empty x832) true)) - :args (x832 y833) - :conclusion (= (set.union x832 y833) y833) -) -(declare-rule sets-union-emp2 ((@T0 Type) (@T1 Type) (x834 (Set @T0)) (y835 (Set @T1))) - :premises ((= (set.is_empty y835) true)) - :args (x834 y835) - :conclusion (= (set.union x834 y835) x834) -) -(declare-rule sets-inter-member ((@T0 Type) (@T1 Type) (@T2 Type) (x836 @T0) (y837 (Set @T1)) (z838 (Set @T2))) - :args (x836 y837 z838) - :conclusion (= (set.member x836 (set.inter y837 z838)) (and (set.member x836 y837) (set.member x836 z838))) -) -(declare-rule sets-minus-member ((@T0 Type) (@T1 Type) (@T2 Type) (x839 @T0) (y840 (Set @T1)) (z841 (Set @T2))) - :args (x839 y840 z841) - :conclusion (= (set.member x839 (set.minus y840 z841)) (and (set.member x839 y840) (not (set.member x839 z841)))) -) -(declare-rule sets-union-member ((@T0 Type) (@T1 Type) (@T2 Type) (x842 @T0) (y843 (Set @T1)) (z844 (Set @T2))) - :args (x842 y843 z844) - :conclusion (= (set.member x842 (set.union y843 z844)) (or (set.member x842 y843) (set.member x842 z844))) -) -(declare-rule sets-choose-singleton ((@T0 Type) (x845 @T0)) - :args (x845) - :conclusion (= (set.choose (set.singleton x845)) x845) -) -(declare-rule sets-card-singleton ((@T0 Type) (x846 @T0)) - :args (x846) - :conclusion (= (set.card (set.singleton x846)) 1) -) -(declare-rule sets-card-union ((@T0 Type) (@T1 Type) (s847 (Set @T0)) (t848 (Set @T1))) - :args (s847 t848) - :conclusion (= (set.card (set.union s847 t848)) (- (+ (set.card s847) (set.card t848)) (set.card (set.inter s847 t848)))) -) -(declare-rule sets-card-minus ((@T0 Type) (@T1 Type) (s849 (Set @T0)) (t850 (Set @T1))) - :args (s849 t850) - :conclusion (= (set.card (set.minus s849 t850)) (- (set.card s849) (set.card (set.inter s849 t850)))) -) -(declare-rule sets-card-emp ((@T0 Type) (x851 (Set @T0))) - :premises ((= (set.is_empty x851) true)) - :args (x851) - :conclusion (= (set.card x851) 0) -) -(declare-rule str-eq-ctn-false ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (x1854 (Seq @T0) :list) (x855 (Seq @T1)) (x2856 (Seq @T2) :list) (y857 (Seq @T3))) - :premises ((= (seq.contains y857 x855) false)) - :args (x1854 x855 x2856 y857) - :conclusion (= (= ($singleton_elim (seq.++ x1854 x855 x2856)) y857) false) -) -(declare-rule str-eq-ctn-full-false1 ((@T0 Type) (@T1 Type) (x858 (Seq @T0)) (y859 (Seq @T1))) - :premises ((= (seq.contains y859 x858) false)) - :args (x858 y859) - :conclusion (= (= x858 y859) false) -) -(declare-rule str-eq-ctn-full-false2 ((@T0 Type) (@T1 Type) (x860 (Seq @T0)) (y861 (Seq @T1))) - :premises ((= (seq.contains x860 y861) false)) - :args (x860 y861) - :conclusion (= (= x860 y861) false) -) -(declare-rule str-concat-flatten ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (xs862 (Seq @T0) :list) (s863 (Seq @T1)) (ys864 (Seq @T2) :list) (zs865 (Seq @T3) :list)) - :args (xs862 s863 ys864 zs865) - :conclusion (= ($singleton_elim (seq.++ xs862 ($singleton_elim (seq.++ s863 ys864)) zs865)) ($singleton_elim (seq.++ xs862 s863 ys864 zs865))) -) -(declare-rule str-concat-flatten-eq ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (x866 (Seq @T0)) (x1867 (Seq @T1) :list) (x2868 (Seq @T2) :list) (y869 (Seq @T3))) - :args (x866 x1867 x2868 y869) - :conclusion (= (= ($singleton_elim (seq.++ ($singleton_elim (seq.++ x866 x1867)) x2868)) y869) (= y869 ($singleton_elim (seq.++ x866 x1867 x2868)))) -) -(declare-rule str-concat-flatten-eq-rev ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (x870 (Seq @T0)) (x1871 (Seq @T1) :list) (x2872 (Seq @T2) :list) (y873 (Seq @T3))) - :args (x870 x1871 x2872 y873) - :conclusion (= (= ($singleton_elim (seq.++ x2872 ($singleton_elim (seq.++ x1871 x870)))) y873) (= y873 ($singleton_elim (seq.++ x2872 x1871 x870)))) -) -(declare-rule str-substr-empty-str ((n874 Int) (m875 Int)) - :args (n874 m875) - :conclusion (= (str.substr "" n874 m875) "") -) -(declare-rule str-substr-empty-range ((x876 String) (n877 Int) (m878 Int)) - :premises ((= (>= 0 m878) true)) - :args (x876 n877 m878) - :conclusion (= (str.substr x876 n877 m878) "") -) -(declare-rule str-substr-empty-start ((x879 String) (n880 Int) (m881 Int)) - :premises ((= (>= n880 (str.len x879)) true)) - :args (x879 n880 m881) - :conclusion (= (str.substr x879 n880 m881) "") -) -(declare-rule str-substr-empty-start-neg ((x882 String) (n883 Int) (m884 Int)) - :premises ((= (< n883 0) true)) - :args (x882 n883 m884) - :conclusion (= (str.substr x882 n883 m884) "") -) -(declare-rule str-substr-eq-empty ((s885 String) (n886 Int) (m887 Int)) - :premises ((= n886 0) (= (> m887 n886) true)) - :args (s885 n886 m887) - :conclusion (= (= (str.substr s885 n886 m887) "") (= s885 "")) -) -(declare-rule str-len-replace-inv ((@T0 Type) (@T1 Type) (@T2 Type) (t888 (Seq @T0)) (s889 (Seq @T1)) (r890 (Seq @T2))) - :premises ((= (seq.len s889) (seq.len r890))) - :args (t888 s889 r890) - :conclusion (= (seq.len (seq.replace t888 s889 r890)) (seq.len t888)) -) -(declare-rule str-len-update-inv ((@T0 Type) (@T1 Type) (t891 (Seq @T0)) (n892 Int) (r893 (Seq @T1))) - :args (t891 n892 r893) - :conclusion (= (seq.len (seq.update t891 n892 r893)) (seq.len t891)) -) -(declare-rule str-len-substr-in-range ((@T0 Type) (s894 (Seq @T0)) (n895 Int) (m896 Int)) - :premises ((= (>= n895 0) true) (= (>= m896 0) true) (= (>= (seq.len s894) (+ n895 m896)) true)) - :args (s894 n895 m896) - :conclusion (= (seq.len (seq.extract s894 n895 m896)) m896) -) -(declare-rule str-len-substr-ub1 ((@T0 Type) (s897 (Seq @T0)) (n898 Int) (m899 Int) (k900 Int)) - :premises ((= (>= k900 0) true) (= (>= k900 m899) true)) - :args (s897 n898 m899 k900) - :conclusion (= (>= k900 (seq.len (seq.extract s897 n898 m899))) true) -) -(declare-rule str-len-substr-ub2 ((@T0 Type) (s901 (Seq @T0)) (n902 Int) (m903 Int) (k904 Int)) - :premises ((= (>= k904 0) true) (= (>= k904 (- (seq.len s901) n902)) true)) - :args (s901 n902 m903 k904) - :conclusion (= (>= k904 (seq.len (seq.extract s901 n902 m903))) true) -) -(declare-rule str-concat-clash ((s1905 String) (s2906 String :list) (t1907 String) (t2908 String :list)) - :premises ((= (= s1905 t1907) false) (= (str.len s1905) (str.len t1907))) - :args (s1905 s2906 t1907 t2908) - :conclusion (= (= ($singleton_elim (str.++ s1905 s2906)) ($singleton_elim (str.++ t1907 t2908))) false) -) -(declare-rule str-concat-clash-rev ((s1909 String) (s2910 String :list) (t1911 String) (t2912 String :list)) - :premises ((= (= s1909 t1911) false) (= (str.len s1909) (str.len t1911))) - :args (s1909 s2910 t1911 t2912) - :conclusion (= (= ($singleton_elim (str.++ s2910 s1909)) ($singleton_elim (str.++ t2912 t1911))) false) -) -(declare-rule str-concat-clash2 ((s1913 String) (t1914 String) (t2915 String :list)) - :premises ((= (= s1913 t1914) false) (= (str.len s1913) (str.len t1914))) - :args (s1913 t1914 t2915) - :conclusion (= (= s1913 ($singleton_elim (str.++ t1914 t2915))) false) -) -(declare-rule str-concat-clash2-rev ((s1916 String) (t1917 String) (t2918 String :list)) - :premises ((= (= s1916 t1917) false) (= (str.len s1916) (str.len t1917))) - :args (s1916 t1917 t2918) - :conclusion (= (= s1916 ($singleton_elim (str.++ t2918 t1917))) false) -) -(declare-rule str-concat-unify ((s1919 String) (s2920 String) (s3921 String :list) (t2922 String) (t3923 String :list)) - :args (s1919 s2920 s3921 t2922 t3923) - :conclusion (= (= (str.++ s1919 s2920 s3921) (str.++ s1919 t2922 t3923)) (= ($singleton_elim (str.++ s2920 s3921)) ($singleton_elim (str.++ t2922 t3923)))) -) -(declare-rule str-concat-unify-rev ((s1924 String) (s2925 String) (s3926 String :list) (t2927 String) (t3928 String :list)) - :args (s1924 s2925 s3926 t2927 t3928) - :conclusion (= (= (str.++ s2925 s3926 s1924) (str.++ t2927 t3928 s1924)) (= ($singleton_elim (str.++ s2925 s3926)) ($singleton_elim (str.++ t2927 t3928)))) -) -(declare-rule str-concat-unify-base ((s929 String) (t1930 String) (t2931 String :list)) - :args (s929 t1930 t2931) - :conclusion (= (= s929 (str.++ s929 t1930 t2931)) (= "" ($singleton_elim (str.++ t1930 t2931)))) -) -(declare-rule str-concat-unify-base-rev ((s932 String) (t1933 String) (t2934 String :list)) - :args (s932 t1933 t2934) - :conclusion (= (= s932 (str.++ t1933 t2934 s932)) (= "" ($singleton_elim (str.++ t1933 t2934)))) -) -(declare-rule str-concat-clash-char ((s1935 String) (s2936 String :list) (s3937 String :list) (t1938 String) (t2939 String :list) (t3940 String :list)) - :premises ((= (= s1935 t1938) false) (= (str.len s1935) (str.len t1938))) - :args (s1935 s2936 s3937 t1938 t2939 t3940) - :conclusion (= (= ($singleton_elim (str.++ ($singleton_elim (str.++ s1935 s2936)) s3937)) ($singleton_elim (str.++ ($singleton_elim (str.++ t1938 t2939)) t3940))) false) -) -(declare-rule str-concat-clash-char-rev ((s1941 String) (s2942 String :list) (s3943 String :list) (t1944 String) (t2945 String :list) (t3946 String :list)) - :premises ((= (= s1941 t1944) false) (= (str.len s1941) (str.len t1944))) - :args (s1941 s2942 s3943 t1944 t2945 t3946) - :conclusion (= (= ($singleton_elim (str.++ s3943 ($singleton_elim (str.++ s2942 s1941)))) ($singleton_elim (str.++ t3946 ($singleton_elim (str.++ t2945 t1944))))) false) -) -(declare-rule str-prefixof-elim ((@T0 Type) (@T1 Type) (s947 (Seq @T0)) (t948 (Seq @T1))) - :args (s947 t948) - :conclusion (= (seq.prefixof s947 t948) (= s947 (seq.extract t948 0 (seq.len s947)))) -) -(declare-rule str-suffixof-elim ((@T0 Type) (@T1 Type) (s949 (Seq @T0)) (t950 (Seq @T1))) - :args (s949 t950) - :conclusion (= (seq.suffixof s949 t950) (eo::define ((_let_1 (seq.len s949))) (= s949 (seq.extract t950 (- (seq.len t950) _let_1) _let_1)))) -) -(declare-rule str-prefixof-one ((@T0 Type) (@T1 Type) (s951 (Seq @T0)) (t952 (Seq @T1))) - :premises ((= (seq.len t952) 1)) - :args (s951 t952) - :conclusion (= (seq.prefixof s951 t952) (seq.contains t952 s951)) -) -(declare-rule str-suffixof-one ((@T0 Type) (@T1 Type) (s953 (Seq @T0)) (t954 (Seq @T1))) - :premises ((= (seq.len t954) 1)) - :args (s953 t954) - :conclusion (= (seq.suffixof s953 t954) (seq.contains t954 s953)) -) -(declare-rule str-substr-combine1 ((s955 String) (n1956 Int) (m1957 Int) (n2958 Int) (m2959 Int)) - :premises ((= (>= n1956 0) true) (= (>= n2958 0) true) (= (>= (- m2959 (- m1957 n2958)) 0) true)) - :args (s955 n1956 m1957 n2958 m2959) - :conclusion (= (str.substr (str.substr s955 n1956 m1957) n2958 m2959) (str.substr s955 (+ n1956 n2958) (- m1957 n2958))) -) -(declare-rule str-substr-combine2 ((s960 String) (n1961 Int) (m1962 Int) (n2963 Int) (m2964 Int)) - :premises ((= (>= n1961 0) true) (= (>= n2963 0) true) (= (>= (- (- m1962 n2963) m2964) 0) true)) - :args (s960 n1961 m1962 n2963 m2964) - :conclusion (= (str.substr (str.substr s960 n1961 m1962) n2963 m2964) (str.substr s960 (+ n1961 n2963) m2964)) -) -(declare-rule str-substr-combine3 ((s965 String) (n1966 Int) (m1967 Int) (n2968 Int) (m2969 Int)) - :premises ((= (>= n1966 0) true) (= (>= n2968 0) true) (= (>= (str.len (str.substr s965 n1966 m1967)) (+ n2968 m2969)) true)) - :args (s965 n1966 m1967 n2968 m2969) - :conclusion (= (str.substr (str.substr s965 n1966 m1967) n2968 m2969) (str.substr s965 (+ n1966 n2968) m2969)) -) -(declare-rule str-substr-combine4 ((s970 String) (n1971 Int) (m1972 Int) (n2973 Int) (m2974 Int)) - :premises ((= (>= n1971 0) true) (= (>= n2973 0) true) (= (>= (+ n2973 m2974) (str.len (str.substr s970 n1971 m1972))) true)) - :args (s970 n1971 m1972 n2973 m2974) - :conclusion (= (str.substr (str.substr s970 n1971 m1972) n2973 m2974) (str.substr s970 (+ n1971 n2973) (- m1972 n2973))) -) -(declare-rule str-substr-concat1 ((@T0 Type) (@T1 Type) (s1975 (Seq @T0)) (s2976 (Seq @T1) :list) (n977 Int) (m978 Int)) - :premises ((= (>= n977 0) true) (= (>= (seq.len s1975) (+ n977 m978)) true)) - :args (s1975 s2976 n977 m978) - :conclusion (= (seq.extract ($singleton_elim (seq.++ s1975 s2976)) n977 m978) (seq.extract s1975 n977 m978)) -) -(declare-rule str-substr-concat2 ((@T0 Type) (@T1 Type) (@T2 Type) (s1979 (Seq @T0)) (s2980 (Seq @T1)) (s3981 (Seq @T2) :list) (n982 Int) (m983 Int)) - :premises ((= (>= n982 (seq.len s1979)) true)) - :args (s1979 s2980 s3981 n982 m983) - :conclusion (= (seq.extract (seq.++ s1979 s2980 s3981) n982 m983) (seq.extract ($singleton_elim (seq.++ s2980 s3981)) (- n982 (seq.len s1979)) m983)) -) -(declare-rule str-substr-full ((@T0 Type) (s984 (Seq @T0)) (n985 Int)) - :premises ((= (>= n985 (seq.len s984)) true)) - :args (s984 n985) - :conclusion (= (seq.extract s984 0 n985) s984) -) -(declare-rule str-substr-full-eq ((@T0 Type) (s986 (Seq @T0)) (n987 Int)) - :premises ((= (seq.len s986) n987)) - :args (s986 n987) - :conclusion (= (seq.extract s986 0 n987) s986) -) -(declare-rule str-contains-refl ((@T0 Type) (x988 (Seq @T0))) - :args (x988) - :conclusion (= (seq.contains x988 x988) true) -) -(declare-rule str-contains-concat-find ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (xs989 (Seq @T0) :list) (z990 (Seq @T1)) (y991 (Seq @T2)) (zs992 (Seq @T3) :list)) - :premises ((= (seq.contains z990 y991) true)) - :args (xs989 z990 y991 zs992) - :conclusion (= (seq.contains ($singleton_elim (seq.++ xs989 z990 zs992)) y991) true) -) -(declare-rule str-contains-split-char ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (x993 (Seq @T0)) (y994 (Seq @T1)) (z995 (Seq @T2) :list) (w996 (Seq @T3))) - :premises ((= (seq.len w996) 1)) - :args (x993 y994 z995 w996) - :conclusion (= (seq.contains (seq.++ x993 y994 z995) w996) (or (seq.contains x993 w996) (seq.contains ($singleton_elim (seq.++ y994 z995)) w996))) -) -(declare-rule str-contains-lt-len ((x997 String) (y998 String)) - :premises ((= (> (str.len y998) (str.len x997)) true)) - :args (x997 y998) - :conclusion (= (str.contains x997 y998) false) -) -(declare-rule str-contains-leq-len-eq ((x999 String) (y1000 String)) - :premises ((= (>= (str.len y1000) (str.len x999)) true)) - :args (x999 y1000) - :conclusion (= (str.contains x999 y1000) (= x999 y1000)) -) -(declare-rule str-contains-emp ((x1001 String) (y1002 String)) - :premises ((= (str.len y1002) 0)) - :args (x1001 y1002) - :conclusion (= (str.contains x1001 y1002) true) -) -(declare-rule str-contains-is-emp ((x1003 String) (y1004 String)) - :premises ((= (str.len x1003) 0)) - :args (x1003 y1004) - :conclusion (= (str.contains x1003 y1004) (= x1003 y1004)) -) -(declare-rule str-concat-emp ((xs1005 String :list) (ys1006 String :list)) - :args (xs1005 ys1006) - :conclusion (= ($singleton_elim (str.++ xs1005 "" ys1006)) ($singleton_elim (str.++ xs1005 ys1006))) -) -(declare-rule str-at-elim ((@T0 Type) (x1007 (Seq @T0)) (n1008 Int)) - :args (x1007 n1008) - :conclusion (= (seq.at x1007 n1008) (seq.extract x1007 n1008 1)) -) -(declare-rule str-replace-self ((@T0 Type) (@T1 Type) (t1009 (Seq @T0)) (s1010 (Seq @T1))) - :args (t1009 s1010) - :conclusion (= (seq.replace t1009 t1009 s1010) s1010) -) -(declare-rule str-replace-no-contains ((@T0 Type) (@T1 Type) (@T2 Type) (t1011 (Seq @T0)) (s1012 (Seq @T1)) (r1013 (Seq @T2))) - :premises ((= (seq.contains t1011 s1012) false)) - :args (t1011 s1012 r1013) - :conclusion (= (seq.replace t1011 s1012 r1013) t1011) -) -(declare-rule str-replace-empty ((@T0 Type) (@T1 Type) (t1014 (Seq @T0)) (s1015 (Seq @T1))) - :args (t1014 s1015) - :conclusion (= (seq.replace t1014 "" s1015) (seq.++ s1015 t1014)) -) -(declare-rule str-len-concat-rec ((@T0 Type) (@T1 Type) (@T2 Type) (s11016 (Seq @T0)) (s21017 (Seq @T1)) (s31018 (Seq @T2) :list)) - :args (s11016 s21017 s31018) - :conclusion (= (seq.len (seq.++ s11016 s21017 s31018)) (+ (seq.len s11016) (seq.len ($singleton_elim (seq.++ s21017 s31018))))) -) -(declare-rule str-indexof-self ((t1019 String) (n1020 Int)) - :args (t1019 n1020) - :conclusion (= (str.indexof t1019 t1019 n1020) (str.indexof "" "" n1020)) -) -(declare-rule str-indexof-no-contains ((t1021 String) (s1022 String) (n1023 Int)) - :premises ((= (str.contains (str.substr t1021 n1023 (str.len t1021)) s1022) false)) - :args (t1021 s1022 n1023) - :conclusion (= (str.indexof t1021 s1022 n1023) (- 1)) -) -(declare-rule str-to-lower-concat ((s11024 String) (s21025 String) (s31026 String :list)) - :args (s11024 s21025 s31026) - :conclusion (= (str.to_lower (str.++ s11024 s21025 s31026)) (str.++ (str.to_lower s11024) (str.to_lower ($singleton_elim (str.++ s21025 s31026))))) -) -(declare-rule str-to-upper-concat ((s11027 String) (s21028 String) (s31029 String :list)) - :args (s11027 s21028 s31029) - :conclusion (= (str.to_upper (str.++ s11027 s21028 s31029)) (str.++ (str.to_upper s11027) (str.to_upper ($singleton_elim (str.++ s21028 s31029))))) -) -(declare-rule str-to-lower-upper ((s1030 String)) - :args (s1030) - :conclusion (= (str.to_lower (str.to_upper s1030)) (str.to_lower s1030)) -) -(declare-rule str-to-upper-lower ((s1031 String)) - :args (s1031) - :conclusion (= (str.to_upper (str.to_lower s1031)) (str.to_upper s1031)) +(declare-rule bool-xor-elim ((x1 Bool) (y1 Bool)) + :args (x1 y1) + :conclusion (= (xor x1 y1) (= (not x1) y1)) +) +(declare-rule bool-not-xor-elim ((x1 Bool) (y1 Bool)) + :args (x1 y1) + :conclusion (= (not (xor x1 y1)) (= x1 y1)) +) +(declare-rule bool-not-eq-elim ((x1 Bool) (y1 Bool)) + :args (x1 y1) + :conclusion (= (not (= x1 y1)) (= (not x1) y1)) +) +(declare-rule ite-neg-branch ((c1 Bool) (x1 Bool) (y1 Bool)) + :premises ((= (not y1) x1)) + :args (c1 x1 y1) + :conclusion (= (ite c1 x1 y1) (= c1 x1)) +) +(declare-rule ite-then-true ((c1 Bool) (x1 Bool)) + :args (c1 x1) + :conclusion (= (ite c1 true x1) (or c1 x1)) +) +(declare-rule ite-else-false ((c1 Bool) (x1 Bool)) + :args (c1 x1) + :conclusion (= (ite c1 x1 false) (and c1 x1)) +) +(declare-rule ite-then-false ((c1 Bool) (x1 Bool)) + :args (c1 x1) + :conclusion (= (ite c1 false x1) (and (not c1) x1)) +) +(declare-rule ite-else-true ((c1 Bool) (x1 Bool)) + :args (c1 x1) + :conclusion (= (ite c1 x1 true) (or (not c1) x1)) +) +(declare-rule ite-then-lookahead-self ((c1 Bool) (x1 Bool)) + :args (c1 x1) + :conclusion (= (ite c1 c1 x1) (ite c1 true x1)) +) +(declare-rule ite-else-lookahead-self ((c1 Bool) (x1 Bool)) + :args (c1 x1) + :conclusion (= (ite c1 x1 c1) (ite c1 x1 false)) +) +(declare-rule bool-not-ite-elim ((c1 Bool) (x1 Bool) (y1 Bool)) + :args (c1 x1 y1) + :conclusion (= (not (ite c1 x1 y1)) (ite c1 (not x1) (not y1))) +) +(declare-rule ite-true-cond ((@T0 Type) (@T1 Type) (x1 @T0) (y1 @T1)) + :args (x1 y1) + :conclusion (= (ite true x1 y1) x1) +) +(declare-rule ite-false-cond ((@T0 Type) (@T1 Type) (x1 @T0) (y1 @T1)) + :args (x1 y1) + :conclusion (= (ite false x1 y1) y1) +) +(declare-rule ite-not-cond ((@T0 Type) (@T1 Type) (c1 Bool) (x1 @T0) (y1 @T1)) + :args (c1 x1 y1) + :conclusion (= (ite (not c1) x1 y1) (ite c1 y1 x1)) +) +(declare-rule ite-eq-branch ((@T0 Type) (c1 Bool) (x1 @T0)) + :args (c1 x1) + :conclusion (= (ite c1 x1 x1) x1) +) +(declare-rule ite-then-lookahead ((@T0 Type) (@T1 Type) (@T2 Type) (c1 Bool) (x1 @T0) (y1 @T1) (z1 @T2)) + :args (c1 x1 y1 z1) + :conclusion (= (ite c1 (ite c1 x1 y1) z1) (ite c1 x1 z1)) +) +(declare-rule ite-else-lookahead ((@T0 Type) (@T1 Type) (@T2 Type) (c1 Bool) (x1 @T0) (y1 @T1) (z1 @T2)) + :args (c1 x1 y1 z1) + :conclusion (= (ite c1 x1 (ite c1 y1 z1)) (ite c1 x1 z1)) +) +(declare-rule ite-then-neg-lookahead ((@T0 Type) (@T1 Type) (@T2 Type) (c1 Bool) (x1 @T0) (y1 @T1) (z1 @T2)) + :args (c1 x1 y1 z1) + :conclusion (= (ite c1 (ite (not c1) x1 y1) z1) (ite c1 y1 z1)) +) +(declare-rule ite-else-neg-lookahead ((@T0 Type) (@T1 Type) (@T2 Type) (c1 Bool) (x1 @T0) (y1 @T1) (z1 @T2)) + :args (c1 x1 y1 z1) + :conclusion (= (ite c1 x1 (ite (not c1) y1 z1)) (ite c1 x1 y1)) +) +(declare-rule bv-concat-flatten ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (xs1 (BitVec @n0) :list) (s1 (BitVec @n1)) (ys1 (BitVec @n2) :list) (zs1 (BitVec @n3) :list)) + :args (xs1 s1 ys1 zs1) + :conclusion (= ($singleton_elim (concat xs1 ($singleton_elim (concat s1 ys1)) zs1)) ($singleton_elim (concat xs1 s1 ys1 zs1))) +) +(declare-rule bv-concat-extract-merge ((@n0 Int) (@n1 Int) (@n2 Int) (xs1 (BitVec @n0) :list) (s1 (BitVec @n1)) (ys1 (BitVec @n2) :list) (i1 Int) (j1 Int) (j2 Int) (k1 Int)) + :premises ((= j2 (+ j1 1))) + :args (xs1 s1 ys1 i1 j1 j2 k1) + :conclusion (= (concat xs1 (extract k1 j2 s1) (extract j1 i1 s1) ys1) ($singleton_elim (concat xs1 (extract k1 i1 s1) ys1))) +) +(declare-rule bv-extract-extract ((@n0 Int) (x1 (BitVec @n0)) (i1 Int) (j1 Int) (k1 Int) (l1 Int)) + :args (x1 i1 j1 k1 l1) + :conclusion (= (extract l1 k1 (extract j1 i1 x1)) (extract (+ i1 l1) (+ i1 k1) x1)) +) +(declare-rule bv-extract-whole ((@n0 Int) (x1 (BitVec @n0)) (n1 Int)) + :premises ((= (>= n1 (- (@bvsize x1) 1)) true)) + :args (x1 n1) + :conclusion (= (extract n1 0 x1) x1) +) +(declare-rule bv-extract-concat-1 ((@n0 Int) (@n1 Int) (@n2 Int) (x1 (BitVec @n0)) (xs1 (BitVec @n1) :list) (y1 (BitVec @n2)) (i1 Int) (j1 Int)) + :premises ((= (<= j1 (@bvsize x1)) true)) + :args (x1 xs1 y1 i1 j1) + :conclusion (= (extract j1 i1 (concat xs1 y1 x1)) (extract j1 i1 x1)) +) +(declare-rule bv-extract-concat-2 ((@n0 Int) (@n1 Int) (@n2 Int) (x1 (BitVec @n0)) (xs1 (BitVec @n1) :list) (y1 (BitVec @n2)) (i1 Int) (j1 Int)) + :premises ((= (< i1 (@bvsize x1)) true) (= (>= j1 (@bvsize x1)) true)) + :args (x1 xs1 y1 i1 j1) + :conclusion (= (extract j1 i1 (concat xs1 y1 x1)) (eo::define ((_let_1 (@bvsize x1))) (concat (extract (- j1 _let_1) 0 ($singleton_elim (concat xs1 y1))) (extract (- _let_1 1) i1 x1)))) +) +(declare-rule bv-extract-concat-3 ((@n0 Int) (@n1 Int) (@n2 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1)) (xs1 (BitVec @n2) :list) (i1 Int) (j1 Int)) + :premises ((= (>= i1 (@bvsize x1)) true)) + :args (x1 y1 xs1 i1 j1) + :conclusion (= (extract j1 i1 (concat xs1 y1 x1)) (eo::define ((_let_1 (@bvsize x1))) (extract (- j1 _let_1) (- i1 _let_1) ($singleton_elim (concat xs1 y1))))) +) +(declare-rule bv-extract-concat-4 ((@n0 Int) (@n1 Int) (@n2 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1)) (xs1 (BitVec @n2) :list) (i1 Int) (j1 Int)) + :premises ((= (< j1 (- (@bvsize (concat x1 xs1 y1)) (@bvsize x1))) true)) + :args (x1 y1 xs1 i1 j1) + :conclusion (= (extract j1 i1 (concat x1 xs1 y1)) (extract j1 i1 ($singleton_elim (concat xs1 y1)))) +) +(declare-rule bv-extract-bitwise-and ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1)) (i1 Int) (j1 Int)) + :args (x1 y1 i1 j1) + :conclusion (= (extract j1 i1 (bvand x1 y1)) (bvand (extract j1 i1 x1) (extract j1 i1 y1))) +) +(declare-rule bv-extract-bitwise-or ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1)) (i1 Int) (j1 Int)) + :args (x1 y1 i1 j1) + :conclusion (= (extract j1 i1 (bvor x1 y1)) (bvor (extract j1 i1 x1) (extract j1 i1 y1))) +) +(declare-rule bv-extract-bitwise-xor ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1)) (i1 Int) (j1 Int)) + :args (x1 y1 i1 j1) + :conclusion (= (extract j1 i1 (bvxor x1 y1)) (bvxor (extract j1 i1 x1) (extract j1 i1 y1))) +) +(declare-rule bv-extract-not ((@n0 Int) (x1 (BitVec @n0)) (i1 Int) (j1 Int)) + :args (x1 i1 j1) + :conclusion (= (extract j1 i1 (bvnot x1)) (bvnot (extract j1 i1 x1))) +) +(declare-rule bv-extract-sign-extend-1 ((@n0 Int) (x1 (BitVec @n0)) (low1 Int) (high1 Int) (k1 Int)) + :premises ((= (< high1 (@bvsize x1)) true)) + :args (x1 low1 high1 k1) + :conclusion (= (extract high1 low1 (sign_extend k1 x1)) (extract high1 low1 x1)) +) +(declare-rule bv-extract-sign-extend-2 ((@n0 Int) (x1 (BitVec @n0)) (low1 Int) (high1 Int) (k1 Int)) + :premises ((= (< low1 (@bvsize x1)) true) (= (>= high1 (@bvsize x1)) true)) + :args (x1 low1 high1 k1) + :conclusion (= (extract high1 low1 (sign_extend k1 x1)) (eo::define ((_let_1 (@bvsize x1))) (sign_extend (+ 1 (- high1 _let_1)) (extract (- _let_1 1) low1 x1)))) +) +(declare-rule bv-extract-sign-extend-3 ((@n0 Int) (x1 (BitVec @n0)) (low1 Int) (high1 Int) (k1 Int)) + :premises ((= (>= low1 (@bvsize x1)) true)) + :args (x1 low1 high1 k1) + :conclusion (= (extract high1 low1 (sign_extend k1 x1)) (eo::define ((_let_1 (- (@bvsize x1) 1))) (repeat (+ 1 (- high1 low1)) (extract _let_1 _let_1 x1)))) +) +(declare-rule bv-neg-mult ((@n0 Int) (@n1 Int) (xs1 (BitVec @n0)) (ys1 (BitVec @n1)) (n1 Int) (m1 Int)) + :args (xs1 ys1 n1 m1) + :conclusion (= (bvneg (bvmul xs1 (@bv n1 m1) ys1)) (bvmul xs1 (@bv (- n1) m1) ys1)) +) +(declare-rule bv-neg-add ((@n0 Int) (@n1 Int) (@n2 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1)) (zs1 (BitVec @n2) :list)) + :args (x1 y1 zs1) + :conclusion (= (bvneg (bvadd x1 y1 zs1)) (bvadd (bvneg x1) (bvneg ($singleton_elim (bvadd y1 zs1))))) +) +(declare-rule bv-mult-distrib-const-neg ((@n0 Int) (x1 (BitVec @n0)) (n1 Int) (m1 Int)) + :args (x1 n1 m1) + :conclusion (= (bvmul (bvneg x1) (@bv n1 m1)) (bvmul x1 (@bv (- n1) m1))) +) +(declare-rule bv-mult-distrib-const-add ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1)) (n1 Int) (m1 Int)) + :args (x1 y1 n1 m1) + :conclusion (= (bvmul (bvadd x1 y1) (@bv n1 m1)) (eo::define ((_let_1 (@bv n1 m1))) (bvadd (bvmul x1 _let_1) (bvmul y1 _let_1)))) +) +(declare-rule bv-mult-distrib-const-sub ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1)) (n1 Int) (m1 Int)) + :args (x1 y1 n1 m1) + :conclusion (= (bvmul (bvsub x1 y1) (@bv n1 m1)) (eo::define ((_let_1 (@bv n1 m1))) (bvsub (bvmul x1 _let_1) (bvmul y1 _let_1)))) +) +(declare-rule bv-mult-distrib-1 ((@n0 Int) (@n1 Int) (@n2 Int) (x1 (BitVec @n0)) (x2 (BitVec @n1)) (y1 (BitVec @n2))) + :args (x1 x2 y1) + :conclusion (= (bvmul (bvadd x1 x2) y1) (bvadd (bvmul x1 y1) (bvmul x2 y1))) +) +(declare-rule bv-mult-distrib-2 ((@n0 Int) (@n1 Int) (@n2 Int) (x1 (BitVec @n0)) (x2 (BitVec @n1)) (y1 (BitVec @n2))) + :args (x1 x2 y1) + :conclusion (= (bvmul y1 (bvadd x1 x2)) (bvadd (bvmul y1 x1) (bvmul y1 x2))) +) +(declare-rule bv-not-xor ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (xs1 (BitVec @n1) :list)) + :args (x1 xs1) + :conclusion (= (bvnot ($singleton_elim (bvxor x1 xs1))) ($singleton_elim (bvxor (bvnot x1) xs1))) +) +(declare-rule bv-and-simplify-1 ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (xs1 (BitVec @n0) :list) (ys1 (BitVec @n1) :list) (zs1 (BitVec @n2) :list) (x1 (BitVec @n3))) + :args (xs1 ys1 zs1 x1) + :conclusion (= (bvand xs1 x1 ys1 x1 zs1) ($singleton_elim (bvand xs1 x1 ys1 zs1))) +) +(declare-rule bv-and-simplify-2 ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (xs1 (BitVec @n0) :list) (ys1 (BitVec @n1) :list) (zs1 (BitVec @n2) :list) (x1 (BitVec @n3))) + :args (xs1 ys1 zs1 x1) + :conclusion (= (bvand xs1 x1 ys1 (bvnot x1) zs1) (@bv 0 (@bvsize x1))) +) +(declare-rule bv-or-simplify-1 ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (xs1 (BitVec @n0) :list) (ys1 (BitVec @n1) :list) (zs1 (BitVec @n2) :list) (x1 (BitVec @n3))) + :args (xs1 ys1 zs1 x1) + :conclusion (= (bvor xs1 x1 ys1 x1 zs1) ($singleton_elim (bvor xs1 x1 ys1 zs1))) +) +(declare-rule bv-or-simplify-2 ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (xs1 (BitVec @n0) :list) (ys1 (BitVec @n1) :list) (zs1 (BitVec @n2) :list) (x1 (BitVec @n3))) + :args (xs1 ys1 zs1 x1) + :conclusion (= (bvor xs1 x1 ys1 (bvnot x1) zs1) (bvnot (@bv 0 (@bvsize x1)))) +) +(declare-rule bv-xor-simplify-1 ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (xs1 (BitVec @n0) :list) (ys1 (BitVec @n1) :list) (zs1 (BitVec @n2) :list) (x1 (BitVec @n3))) + :args (xs1 ys1 zs1 x1) + :conclusion (= (bvxor xs1 x1 ys1 x1 zs1) ($singleton_elim (bvxor xs1 ys1 zs1))) +) +(declare-rule bv-xor-simplify-2 ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (xs1 (BitVec @n0) :list) (ys1 (BitVec @n1) :list) (zs1 (BitVec @n2) :list) (x1 (BitVec @n3))) + :args (xs1 ys1 zs1 x1) + :conclusion (= (bvxor xs1 x1 ys1 (bvnot x1) zs1) (bvnot ($singleton_elim (bvxor xs1 ys1 zs1)))) +) +(declare-rule bv-xor-simplify-3 ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (xs1 (BitVec @n0) :list) (ys1 (BitVec @n1) :list) (zs1 (BitVec @n2) :list) (x1 (BitVec @n3))) + :args (xs1 ys1 zs1 x1) + :conclusion (= (bvxor xs1 (bvnot x1) ys1 x1 zs1) (bvnot ($singleton_elim (bvxor xs1 ys1 zs1)))) +) +(declare-rule bv-ult-add-one ((@n0 Int) (@n1 Int) (@n2 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1)) (c1 (BitVec @n2))) + :premises ((= c1 (@bv 1 (@bvsize c1)))) + :args (x1 y1 c1) + :conclusion (= (bvult x1 (bvadd y1 c1)) (and (not (bvult y1 x1)) (not (= y1 (bvnot (@bv 0 (@bvsize y1))))))) +) +(declare-rule bv-concat-to-mult ((@n0 Int) (x1 (BitVec @n0)) (i1 Int) (m1 Int) (n1 Int)) + :premises ((= (+ 1 i1 m1) (@bvsize x1)) (= n1 0)) + :args (x1 i1 m1 n1) + :conclusion (= (concat (extract i1 n1 x1) (@bv n1 m1)) (eo::define ((_let_1 (@bvsize x1))) (bvmul x1 (bvshl (@bv 1 _let_1) (@bv m1 _let_1))))) +) +(declare-rule bv-mult-slt-mult-1 ((@n0 Int) (@n1 Int) (@n2 Int) (x1 (BitVec @n0)) (t1 (BitVec @n1)) (a1 (BitVec @n2)) (n1 Int) (m1 Int)) + :args (x1 t1 a1 n1 m1) + :conclusion (= (eo::define ((_let_1 (sign_extend m1 a1))) (bvslt (bvmul (sign_extend n1 (bvadd x1 t1)) _let_1) (bvmul (sign_extend n1 x1) _let_1))) (eo::define ((_let_1 (@bv 0 (@bvsize a1)))) (and (not (= t1 (@bv 0 (@bvsize t1)))) (not (= a1 _let_1)) (= (bvslt (bvadd x1 t1) x1) (bvsgt a1 _let_1))))) +) +(declare-rule bv-mult-slt-mult-2 ((@n0 Int) (@n1 Int) (@n2 Int) (x1 (BitVec @n0)) (t1 (BitVec @n1)) (a1 (BitVec @n2)) (n1 Int) (m1 Int)) + :args (x1 t1 a1 n1 m1) + :conclusion (= (eo::define ((_let_1 (sign_extend m1 a1))) (bvslt (bvmul (zero_extend n1 (bvadd x1 t1)) _let_1) (bvmul (zero_extend n1 x1) _let_1))) (eo::define ((_let_1 (@bv 0 (@bvsize a1)))) (and (not (= t1 (@bv 0 (@bvsize t1)))) (not (= a1 _let_1)) (= (bvult (bvadd x1 t1) x1) (bvsgt a1 _let_1))))) +) +(declare-rule bv-commutative-and ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvand x1 y1) (bvand y1 x1)) +) +(declare-rule bv-commutative-or ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvor x1 y1) (bvor y1 x1)) +) +(declare-rule bv-commutative-xor ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvxor x1 y1) (bvxor y1 x1)) +) +(declare-rule bv-commutative-mul ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvmul x1 y1) (bvmul y1 x1)) +) +(declare-rule bv-or-zero ((@n0 Int) (x1 (BitVec @n0)) (n1 Int)) + :args (x1 n1) + :conclusion (= (bvor x1 (@bv 0 n1)) x1) +) +(declare-rule bv-mul-one ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (c1 (BitVec @n1))) + :premises ((= c1 (@bv 1 (@bvsize c1)))) + :args (x1 c1) + :conclusion (= (bvmul x1 c1) x1) +) +(declare-rule bv-mul-zero ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (c1 (BitVec @n1))) + :premises ((= c1 (@bv 0 (@bvsize c1)))) + :args (x1 c1) + :conclusion (= (bvmul x1 c1) (@bv 0 (@bvsize x1))) +) +(declare-rule bv-add-zero ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (c1 (BitVec @n1))) + :premises ((= c1 (@bv 0 (@bvsize c1)))) + :args (x1 c1) + :conclusion (= (bvadd x1 c1) x1) +) +(declare-rule bv-add-two ((@n0 Int) (x1 (BitVec @n0))) + :args (x1) + :conclusion (= (bvadd x1 x1) (bvmul x1 (@bv 2 (@bvsize x1)))) +) +(declare-rule bv-zero-extend-eliminate-0 ((@n0 Int) (x1 (BitVec @n0))) + :args (x1) + :conclusion (= (zero_extend 0 x1) x1) +) +(declare-rule bv-sign-extend-eliminate-0 ((@n0 Int) (x1 (BitVec @n0))) + :args (x1) + :conclusion (= (sign_extend 0 x1) x1) +) +(declare-rule bv-not-neq ((@n0 Int) (x1 (BitVec @n0))) + :premises ((= (> (@bvsize x1) 0) true)) + :args (x1) + :conclusion (= (= x1 (bvnot x1)) false) +) +(declare-rule bv-ult-ones ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :premises ((= y1 (bvnot (@bv 0 (@bvsize y1))))) + :args (x1 y1) + :conclusion (= (bvult x1 y1) (distinct x1 y1)) +) +(declare-rule bv-or-flatten ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (xs1 (BitVec @n0) :list) (s1 (BitVec @n1)) (ys1 (BitVec @n2) :list) (zs1 (BitVec @n3) :list)) + :args (xs1 s1 ys1 zs1) + :conclusion (= ($singleton_elim (bvor xs1 ($singleton_elim (bvor s1 ys1)) zs1)) ($singleton_elim (bvor xs1 s1 ys1 zs1))) +) +(declare-rule bv-xor-flatten ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (xs1 (BitVec @n0) :list) (s1 (BitVec @n1)) (ys1 (BitVec @n2) :list) (zs1 (BitVec @n3) :list)) + :args (xs1 s1 ys1 zs1) + :conclusion (= ($singleton_elim (bvxor xs1 ($singleton_elim (bvxor s1 ys1)) zs1)) ($singleton_elim (bvxor xs1 s1 ys1 zs1))) +) +(declare-rule bv-and-flatten ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (xs1 (BitVec @n0) :list) (s1 (BitVec @n1)) (ys1 (BitVec @n2) :list) (zs1 (BitVec @n3) :list)) + :args (xs1 s1 ys1 zs1) + :conclusion (= ($singleton_elim (bvand xs1 ($singleton_elim (bvand s1 ys1)) zs1)) ($singleton_elim (bvand xs1 s1 ys1 zs1))) +) +(declare-rule bv-mul-flatten ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (xs1 (BitVec @n0) :list) (s1 (BitVec @n1)) (ys1 (BitVec @n2) :list) (zs1 (BitVec @n3) :list)) + :args (xs1 s1 ys1 zs1) + :conclusion (= ($singleton_elim (bvmul xs1 ($singleton_elim (bvmul s1 ys1)) zs1)) ($singleton_elim (bvmul xs1 s1 ys1 zs1))) +) +(declare-rule bv-concat-merge-const ((@n0 Int) (@n1 Int) (xs1 (BitVec @n0) :list) (n1 Int) (w1 Int) (n2 Int) (w2 Int) (zs1 (BitVec @n1) :list)) + :args (xs1 n1 w1 n2 w2 zs1) + :conclusion (= (concat xs1 (@bv n1 w1) (@bv n2 w2) zs1) ($singleton_elim (concat xs1 (@bv (+ (* n1 (int.pow2 w2)) n2) (+ w1 w2)) zs1))) +) +(declare-rule bv-commutative-add ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvadd x1 y1) (bvadd y1 x1)) +) +(declare-rule bv-neg-sub ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvneg (bvsub x1 y1)) (bvsub y1 x1)) +) +(declare-rule bv-neg-idemp ((@n0 Int) (x1 (BitVec @n0))) + :args (x1) + :conclusion (= (bvneg (bvneg x1)) x1) +) +(declare-rule bv-sub-eliminate ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvsub x1 y1) (bvadd x1 (bvneg y1))) +) +(declare-rule bv-ugt-eliminate ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvugt x1 y1) (bvult y1 x1)) +) +(declare-rule bv-uge-eliminate ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvuge x1 y1) (bvule y1 x1)) +) +(declare-rule bv-sgt-eliminate ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvsgt x1 y1) (bvslt y1 x1)) +) +(declare-rule bv-sge-eliminate ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvsge x1 y1) (bvsle y1 x1)) +) +(declare-rule bv-slt-eliminate ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvslt x1 y1) (eo::define ((_let_1 (@bvsize x1))) (eo::define ((_let_2 (bvshl (@bv 1 _let_1) (@bv (- _let_1 1) _let_1)))) (bvult (bvadd x1 _let_2) (bvadd y1 _let_2))))) +) +(declare-rule bv-sle-eliminate ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvsle x1 y1) (not (bvslt y1 x1))) +) +(declare-rule bv-redor-eliminate ((@n0 Int) (x1 (BitVec @n0))) + :args (x1) + :conclusion (= (bvredor x1) (bvnot (bvcomp x1 (@bv 0 (@bvsize x1))))) +) +(declare-rule bv-redand-eliminate ((@n0 Int) (x1 (BitVec @n0))) + :args (x1) + :conclusion (= (bvredand x1) (bvcomp x1 (bvnot (@bv 0 (@bvsize x1))))) +) +(declare-rule bv-ule-eliminate ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvule x1 y1) (not (bvult y1 x1))) +) +(declare-rule bv-comp-eliminate ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvcomp x1 y1) (ite (= x1 y1) (@bv 1 1) (@bv 0 1))) +) +(declare-rule bv-repeat-eliminate-1 ((@n0 Int) (x1 (BitVec @n0)) (n1 Int)) + :premises ((= (> n1 1) true)) + :args (x1 n1) + :conclusion (= (repeat n1 x1) (concat x1 (repeat (- n1 1) x1))) +) +(declare-rule bv-repeat-eliminate-2 ((@n0 Int) (x1 (BitVec @n0)) (n1 Int)) + :premises ((= n1 1)) + :args (x1 n1) + :conclusion (= (repeat n1 x1) x1) +) +(declare-rule bv-rotate-left-eliminate-1 ((@n0 Int) (x1 (BitVec @n0)) (amount1 Int)) + :premises ((= (= (mod amount1 (@bvsize x1)) 0) false)) + :args (x1 amount1) + :conclusion (= (rotate_left amount1 x1) (eo::define ((_let_1 (@bvsize x1))) (eo::define ((_let_2 (mod amount1 _let_1))) (concat (extract (- _let_1 (+ 1 _let_2)) 0 x1) (extract (- _let_1 1) (- _let_1 _let_2) x1))))) +) +(declare-rule bv-rotate-left-eliminate-2 ((@n0 Int) (x1 (BitVec @n0)) (amount1 Int)) + :premises ((= (mod amount1 (@bvsize x1)) 0)) + :args (x1 amount1) + :conclusion (= (rotate_left amount1 x1) x1) +) +(declare-rule bv-rotate-right-eliminate-1 ((@n0 Int) (x1 (BitVec @n0)) (amount1 Int)) + :premises ((= (= (mod amount1 (@bvsize x1)) 0) false)) + :args (x1 amount1) + :conclusion (= (rotate_right amount1 x1) (eo::define ((_let_1 (@bvsize x1))) (eo::define ((_let_2 (mod amount1 _let_1))) (concat (extract (- _let_2 1) 0 x1) (extract (- _let_1 1) _let_2 x1))))) +) +(declare-rule bv-rotate-right-eliminate-2 ((@n0 Int) (x1 (BitVec @n0)) (amount1 Int)) + :premises ((= (mod amount1 (@bvsize x1)) 0)) + :args (x1 amount1) + :conclusion (= (rotate_right amount1 x1) x1) +) +(declare-rule bv-nand-eliminate ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvnand x1 y1) (bvnot (bvand x1 y1))) +) +(declare-rule bv-nor-eliminate ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvnor x1 y1) (bvnot (bvor x1 y1))) +) +(declare-rule bv-xnor-eliminate ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvxnor x1 y1) (bvnot (bvxor x1 y1))) +) +(declare-rule bv-sdiv-eliminate ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvsdiv x1 y1) (eo::define ((_let_1 (@bv 1 1))) (eo::define ((_let_2 (- (@bvsize x1) 1))) (eo::define ((_let_3 (= (extract _let_2 _let_2 y1) _let_1))) (eo::define ((_let_4 (= (extract _let_2 _let_2 x1) _let_1))) (eo::define ((_let_5 (bvudiv (ite _let_4 (bvneg x1) x1) (ite _let_3 (bvneg y1) y1)))) (ite (xor _let_4 _let_3) (bvneg _let_5) _let_5))))))) +) +(declare-rule bv-sdiv-eliminate-fewer-bitwise-ops ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvsdiv x1 y1) (eo::define ((_let_1 (concat (@bv 1 1) (@bv 0 (- (@bvsize x1) 1))))) (eo::define ((_let_2 (bvuge y1 _let_1))) (eo::define ((_let_3 (bvuge x1 _let_1))) (eo::define ((_let_4 (bvudiv (ite _let_3 (bvneg x1) x1) (ite _let_2 (bvneg y1) y1)))) (ite (xor _let_3 _let_2) (bvneg _let_4) _let_4)))))) +) +(declare-rule bv-zero-extend-eliminate ((@n0 Int) (x1 (BitVec @n0)) (n1 Int)) + :args (x1 n1) + :conclusion (= (zero_extend n1 x1) (concat (@bv 0 n1) x1)) +) +(declare-rule bv-sign-extend-eliminate ((@n0 Int) (x1 (BitVec @n0)) (n1 Int)) + :args (x1 n1) + :conclusion (= (sign_extend n1 x1) (eo::define ((_let_1 (- (@bvsize x1) 1))) (concat (repeat n1 (extract _let_1 _let_1 x1)) x1))) +) +(declare-rule bv-uaddo-eliminate ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvuaddo x1 y1) (eo::define ((_let_1 (@bv 0 1))) (eo::define ((_let_2 (- (@bvsize x1) 1))) (= (extract _let_2 _let_2 (bvadd (concat _let_1 x1) (concat _let_1 y1))) (@bv 1 1))))) +) +(declare-rule bv-saddo-eliminate ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvsaddo x1 y1) (eo::define ((_let_1 (@bv 0 1))) (eo::define ((_let_2 (- (@bvsize x1) 1))) (eo::define ((_let_3 (extract _let_2 _let_2 (bvadd x1 y1)))) (eo::define ((_let_4 (@bv 1 1))) (eo::define ((_let_5 (extract _let_2 _let_2 y1))) (eo::define ((_let_6 (extract _let_2 _let_2 x1))) (or (and (and (= _let_6 _let_1) (= _let_5 _let_1)) (= _let_3 _let_4)) (and (and (= _let_6 _let_4) (= _let_5 _let_4)) (= _let_3 _let_1)))))))))) +) +(declare-rule bv-sdivo-eliminate ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvsdivo x1 y1) (and (= x1 (concat (@bv 1 1) (@bv 0 (- (@bvsize x1) 1)))) (= y1 (bvnot (@bv 0 (@bvsize y1)))))) +) +(declare-rule bv-smod-eliminate ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvsmod x1 y1) (eo::define ((_let_1 (@bv 1 1))) (eo::define ((_let_2 (@bvsize x1))) (eo::define ((_let_3 (- _let_2 1))) (eo::define ((_let_4 (= (extract _let_3 _let_3 y1) _let_1))) (eo::define ((_let_5 (= (extract _let_3 _let_3 x1) _let_1))) (eo::define ((_let_6 (bvurem (ite _let_5 (bvneg x1) x1) (ite _let_4 (bvneg y1) y1)))) (eo::define ((_let_7 (bvneg _let_6))) (eo::define ((_let_8 (not _let_5))) (eo::define ((_let_9 (not _let_4))) (ite (= _let_6 (@bv 0 _let_2)) _let_6 (ite (and _let_8 _let_9) _let_6 (ite (and _let_5 _let_9) (bvadd _let_7 y1) (ite (and _let_8 _let_4) (bvadd _let_6 y1) _let_7)))))))))))))) +) +(declare-rule bv-smod-eliminate-fewer-bitwise-ops ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvsmod x1 y1) (eo::define ((_let_1 (@bvsize x1))) (eo::define ((_let_2 (concat (@bv 1 1) (@bv 0 (- _let_1 1))))) (eo::define ((_let_3 (bvuge y1 _let_2))) (eo::define ((_let_4 (bvuge x1 _let_2))) (eo::define ((_let_5 (bvurem (ite _let_4 (bvneg x1) x1) (ite _let_3 (bvneg y1) y1)))) (eo::define ((_let_6 (bvneg _let_5))) (eo::define ((_let_7 (not _let_4))) (eo::define ((_let_8 (not _let_3))) (ite (= _let_5 (@bv 0 _let_1)) _let_5 (ite (and _let_7 _let_8) _let_5 (ite (and _let_4 _let_8) (bvadd _let_6 y1) (ite (and _let_7 _let_3) (bvadd _let_5 y1) _let_6))))))))))))) +) +(declare-rule bv-srem-eliminate ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvsrem x1 y1) (eo::define ((_let_1 (- (@bvsize x1) 1))) (eo::define ((_let_2 (extract _let_1 _let_1 x1))) (eo::define ((_let_3 (bvurem (bvite _let_2 (bvneg x1) x1) (bvite (extract _let_1 _let_1 y1) (bvneg y1) y1)))) (bvite _let_2 (bvneg _let_3) _let_3))))) +) +(declare-rule bv-srem-eliminate-fewer-bitwise-ops ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvsrem x1 y1) (eo::define ((_let_1 (concat (@bv 1 1) (@bv 0 (- (@bvsize x1) 1))))) (eo::define ((_let_2 (bvuge x1 _let_1))) (eo::define ((_let_3 (bvurem (ite _let_2 (bvneg x1) x1) (ite (bvuge y1 _let_1) (bvneg y1) y1)))) (ite _let_2 (bvneg _let_3) _let_3))))) +) +(declare-rule bv-usubo-eliminate ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvusubo x1 y1) (eo::define ((_let_1 (@bvsize x1))) (= (extract _let_1 _let_1 (bvsub (zero_extend 1 x1) (zero_extend 1 y1))) (@bv 1 1)))) +) +(declare-rule bv-ssubo-eliminate ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvssubo x1 y1) (eo::define ((_let_1 (@bv 1 1))) (eo::define ((_let_2 (- (@bvsize x1) 1))) (eo::define ((_let_3 (= (extract _let_2 _let_2 (bvsub x1 y1)) _let_1))) (eo::define ((_let_4 (= (extract _let_2 _let_2 y1) _let_1))) (eo::define ((_let_5 (= (extract _let_2 _let_2 x1) _let_1))) (or (and _let_5 (not _let_4) (not _let_3)) (and (not _let_5) _let_4 _let_3)))))))) +) +(declare-rule bv-ite-equal-children ((@n0 Int) (c1 (_ BitVec 1)) (x1 (BitVec @n0))) + :args (c1 x1) + :conclusion (= (bvite c1 x1 x1) x1) +) +(declare-rule bv-ite-const-children-1 ((c1 (_ BitVec 1))) + :args (c1) + :conclusion (= (bvite c1 (@bv 0 1) (@bv 1 1)) (bvnot c1)) +) +(declare-rule bv-ite-const-children-2 ((c1 (_ BitVec 1))) + :args (c1) + :conclusion (= (bvite c1 (@bv 1 1) (@bv 0 1)) c1) +) +(declare-rule bv-ite-equal-cond-1 ((@n0 Int) (@n1 Int) (@n2 Int) (c1 (_ BitVec 1)) (t1 (BitVec @n0)) (e1 (BitVec @n1)) (e2 (BitVec @n2))) + :args (c1 t1 e1 e2) + :conclusion (= (bvite c1 (bvite c1 t1 e1) e2) (bvite c1 t1 e2)) +) +(declare-rule bv-ite-equal-cond-2 ((@n0 Int) (@n1 Int) (@n2 Int) (c1 (_ BitVec 1)) (t1 (BitVec @n0)) (t2 (BitVec @n1)) (e1 (BitVec @n2))) + :args (c1 t1 t2 e1) + :conclusion (= (bvite c1 t1 (bvite c1 t2 e1)) (bvite c1 t1 e1)) +) +(declare-rule bv-ite-equal-cond-3 ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (c1 (_ BitVec 1)) (t1 (BitVec @n0)) (e1 (BitVec @n1)) (t2 (BitVec @n2)) (e2 (BitVec @n3))) + :args (c1 t1 e1 t2 e2) + :conclusion (= (bvite c1 (bvite c1 t1 e1) (bvite c1 t2 e2)) (bvite c1 t1 e2)) +) +(declare-rule bv-ite-merge-then-if ((@n0 Int) (@n1 Int) (c1 (_ BitVec 1)) (c2 (_ BitVec 1)) (t1 (BitVec @n0)) (e1 (BitVec @n1))) + :args (c1 c2 t1 e1) + :conclusion (= (bvite c1 (bvite c2 t1 e1) t1) (bvite (bvand c1 (bvnot c2)) e1 t1)) +) +(declare-rule bv-ite-merge-else-if ((@n0 Int) (@n1 Int) (c1 (_ BitVec 1)) (c2 (_ BitVec 1)) (t1 (BitVec @n0)) (e1 (BitVec @n1))) + :args (c1 c2 t1 e1) + :conclusion (= (bvite c1 (bvite c2 t1 e1) e1) (bvite (bvand c1 c2) t1 e1)) +) +(declare-rule bv-ite-merge-then-else ((@n0 Int) (@n1 Int) (c1 (_ BitVec 1)) (c2 (_ BitVec 1)) (t1 (BitVec @n0)) (e1 (BitVec @n1))) + :args (c1 c2 t1 e1) + :conclusion (= (bvite c1 t1 (bvite c2 t1 e1)) (bvite (bvnor c1 c2) e1 t1)) +) +(declare-rule bv-ite-merge-else-else ((@n0 Int) (@n1 Int) (c1 (_ BitVec 1)) (c2 (_ BitVec 1)) (t1 (BitVec @n0)) (t2 (BitVec @n1))) + :args (c1 c2 t1 t2) + :conclusion (= (bvite c1 t2 (bvite c2 t1 t2)) (bvite (bvand (bvnot c1) c2) t1 t2)) +) +(declare-rule bv-shl-by-const-0 ((@n0 Int) (x1 (BitVec @n0)) (sz1 Int)) + :args (x1 sz1) + :conclusion (= (bvshl x1 (@bv 0 sz1)) x1) +) +(declare-rule bv-shl-by-const-1 ((@n0 Int) (x1 (BitVec @n0)) (amount1 Int) (sz1 Int)) + :premises ((= (< amount1 (@bvsize x1)) true)) + :args (x1 amount1 sz1) + :conclusion (= (bvshl x1 (@bv amount1 sz1)) (concat (extract (- (@bvsize x1) (+ 1 amount1)) 0 x1) (@bv 0 amount1))) +) +(declare-rule bv-shl-by-const-2 ((@n0 Int) (x1 (BitVec @n0)) (amount1 Int) (sz1 Int)) + :premises ((= (>= amount1 (@bvsize x1)) true)) + :args (x1 amount1 sz1) + :conclusion (= (bvshl x1 (@bv amount1 sz1)) (@bv 0 (@bvsize x1))) +) +(declare-rule bv-lshr-by-const-0 ((@n0 Int) (x1 (BitVec @n0)) (sz1 Int)) + :args (x1 sz1) + :conclusion (= (bvlshr x1 (@bv 0 sz1)) x1) +) +(declare-rule bv-lshr-by-const-1 ((@n0 Int) (x1 (BitVec @n0)) (amount1 Int) (sz1 Int)) + :premises ((= (< amount1 (@bvsize x1)) true)) + :args (x1 amount1 sz1) + :conclusion (= (bvlshr x1 (@bv amount1 sz1)) (concat (@bv 0 amount1) (extract (- (@bvsize x1) 1) amount1 x1))) +) +(declare-rule bv-lshr-by-const-2 ((@n0 Int) (x1 (BitVec @n0)) (amount1 Int) (sz1 Int)) + :premises ((= (>= amount1 (@bvsize x1)) true)) + :args (x1 amount1 sz1) + :conclusion (= (bvlshr x1 (@bv amount1 sz1)) (@bv 0 sz1)) +) +(declare-rule bv-ashr-by-const-0 ((@n0 Int) (x1 (BitVec @n0)) (sz1 Int)) + :args (x1 sz1) + :conclusion (= (bvashr x1 (@bv 0 sz1)) x1) +) +(declare-rule bv-ashr-by-const-1 ((@n0 Int) (x1 (BitVec @n0)) (amount1 Int) (sz1 Int)) + :premises ((= (< amount1 (@bvsize x1)) true)) + :args (x1 amount1 sz1) + :conclusion (= (bvashr x1 (@bv amount1 sz1)) (eo::define ((_let_1 (- (@bvsize x1) 1))) (concat (repeat amount1 (extract _let_1 _let_1 x1)) (extract _let_1 amount1 x1)))) +) +(declare-rule bv-ashr-by-const-2 ((@n0 Int) (x1 (BitVec @n0)) (amount1 Int) (sz1 Int)) + :premises ((= (>= amount1 (@bvsize x1)) true)) + :args (x1 amount1 sz1) + :conclusion (= (bvashr x1 (@bv amount1 sz1)) (eo::define ((_let_1 (@bvsize x1))) (eo::define ((_let_2 (- _let_1 1))) (repeat _let_1 (extract _let_2 _let_2 x1))))) +) +(declare-rule bv-and-concat-pullup ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1)) (z1 (BitVec @n2)) (ys1 (BitVec @n3) :list)) + :args (x1 y1 z1 ys1) + :conclusion (= (bvand x1 (concat ys1 z1 y1)) (eo::define ((_let_1 (@bvsize y1))) (concat (bvand (extract (- (@bvsize x1) 1) _let_1 x1) ($singleton_elim (concat ys1 z1))) (bvand (extract (- _let_1 1) 0 x1) y1)))) +) +(declare-rule bv-or-concat-pullup ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1)) (z1 (BitVec @n2)) (ys1 (BitVec @n3) :list)) + :args (x1 y1 z1 ys1) + :conclusion (= (bvor x1 (concat ys1 z1 y1)) (eo::define ((_let_1 (@bvsize y1))) (concat (bvor (extract (- (@bvsize x1) 1) _let_1 x1) ($singleton_elim (concat ys1 z1))) (bvor (extract (- _let_1 1) 0 x1) y1)))) +) +(declare-rule bv-xor-concat-pullup ((@n0 Int) (@n1 Int) (@n2 Int) (@n3 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1)) (z1 (BitVec @n2)) (ys1 (BitVec @n3) :list)) + :args (x1 y1 z1 ys1) + :conclusion (= (bvxor x1 (concat ys1 z1 y1)) (eo::define ((_let_1 (@bvsize y1))) (concat (bvxor (extract (- (@bvsize x1) 1) _let_1 x1) ($singleton_elim (concat ys1 z1))) (bvxor (extract (- _let_1 1) 0 x1) y1)))) +) +(declare-rule bv-bitwise-idemp-1 ((@n0 Int) (x1 (BitVec @n0))) + :args (x1) + :conclusion (= (bvand x1 x1) x1) +) +(declare-rule bv-bitwise-idemp-2 ((@n0 Int) (x1 (BitVec @n0))) + :args (x1) + :conclusion (= (bvor x1 x1) x1) +) +(declare-rule bv-and-zero ((@n0 Int) (x1 (BitVec @n0)) (n1 Int)) + :args (x1 n1) + :conclusion (= (bvand x1 (@bv 0 n1)) (@bv 0 n1)) +) +(declare-rule bv-and-one ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :premises ((= y1 (bvnot (@bv 0 (@bvsize y1))))) + :args (x1 y1) + :conclusion (= (bvand x1 y1) x1) +) +(declare-rule bv-or-one ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :premises ((= y1 (bvnot (@bv 0 (@bvsize y1))))) + :args (x1 y1) + :conclusion (= (bvor x1 y1) (bvnot (@bv 0 (@bvsize y1)))) +) +(declare-rule bv-xor-duplicate ((@n0 Int) (x1 (BitVec @n0))) + :args (x1) + :conclusion (= (bvxor x1 x1) (@bv 0 (@bvsize x1))) +) +(declare-rule bv-xor-ones ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :premises ((= y1 (bvnot (@bv 0 (@bvsize y1))))) + :args (x1 y1) + :conclusion (= (bvxor x1 y1) (bvnot x1)) +) +(declare-rule bv-xor-zero ((@n0 Int) (x1 (BitVec @n0)) (n1 Int)) + :args (x1 n1) + :conclusion (= (bvxor x1 (@bv 0 n1)) x1) +) +(declare-rule bv-bitwise-not-and ((@n0 Int) (x1 (BitVec @n0))) + :args (x1) + :conclusion (= (bvand x1 (bvnot x1)) (@bv 0 (@bvsize x1))) +) +(declare-rule bv-bitwise-not-or ((@n0 Int) (x1 (BitVec @n0))) + :args (x1) + :conclusion (= (bvor x1 (bvnot x1)) (bvnot (@bv 0 (@bvsize x1)))) +) +(declare-rule bv-xor-not ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (bvxor (bvnot x1) (bvnot y1)) (bvxor x1 y1)) +) +(declare-rule bv-not-idemp ((@n0 Int) (x1 (BitVec @n0))) + :args (x1) + :conclusion (= (bvnot (bvnot x1)) x1) +) +(declare-rule bv-ult-zero-1 ((@n0 Int) (x1 (BitVec @n0)) (n1 Int)) + :args (x1 n1) + :conclusion (= (bvult (@bv 0 n1) x1) (not (= x1 (@bv 0 n1)))) +) +(declare-rule bv-ult-zero-2 ((@n0 Int) (x1 (BitVec @n0)) (n1 Int)) + :args (x1 n1) + :conclusion (= (bvult x1 (@bv 0 n1)) false) +) +(declare-rule bv-ult-self ((@n0 Int) (x1 (BitVec @n0))) + :args (x1) + :conclusion (= (bvult x1 x1) false) +) +(declare-rule bv-lt-self ((@n0 Int) (x1 (BitVec @n0))) + :args (x1) + :conclusion (= (bvslt x1 x1) false) +) +(declare-rule bv-ule-self ((@n0 Int) (x1 (BitVec @n0))) + :args (x1) + :conclusion (= (bvule x1 x1) true) +) +(declare-rule bv-ule-zero ((@n0 Int) (x1 (BitVec @n0)) (n1 Int)) + :args (x1 n1) + :conclusion (= (bvule x1 (@bv 0 n1)) (= x1 (@bv 0 n1))) +) +(declare-rule bv-zero-ule ((@n0 Int) (x1 (BitVec @n0)) (n1 Int)) + :args (x1 n1) + :conclusion (= (bvule (@bv 0 n1) x1) true) +) +(declare-rule bv-sle-self ((@n0 Int) (x1 (BitVec @n0))) + :args (x1) + :conclusion (= (bvsle x1 x1) true) +) +(declare-rule bv-ule-max ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :premises ((= y1 (bvnot (@bv 0 (@bvsize y1))))) + :args (x1 y1) + :conclusion (= (bvule x1 y1) true) +) +(declare-rule bv-not-ult ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (not (bvult x1 y1)) (bvule y1 x1)) +) +(declare-rule bv-not-ule ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (not (bvule x1 y1)) (bvult y1 x1)) +) +(declare-rule bv-not-sle ((@n0 Int) (@n1 Int) (x1 (BitVec @n0)) (y1 (BitVec @n1))) + :args (x1 y1) + :conclusion (= (not (bvsle x1 y1)) (bvslt y1 x1)) +) +(declare-rule bv-mult-pow2-1 ((@n0 Int) (@n1 Int) (@n2 Int) (xs1 (BitVec @n0) :list) (ys1 (BitVec @n1) :list) (z1 (BitVec @n2)) (size1 Int) (n1 Int)) + :premises ((= (int.ispow2 n1) true)) + :args (xs1 ys1 z1 size1 n1) + :conclusion (= (bvmul xs1 z1 (@bv n1 size1) ys1) (eo::define ((_let_1 (int.log2 n1))) (concat (extract (- (- size1 _let_1) 1) 0 ($singleton_elim (bvmul xs1 z1 ys1))) (@bv 0 _let_1)))) +) +(declare-rule bv-mult-pow2-2 ((@n0 Int) (@n1 Int) (@n2 Int) (xs1 (BitVec @n0) :list) (ys1 (BitVec @n1) :list) (z1 (BitVec @n2)) (size1 Int) (n1 Int)) + :premises ((= (int.ispow2 (- n1)) true)) + :args (xs1 ys1 z1 size1 n1) + :conclusion (= (bvmul xs1 z1 (@bv n1 size1) ys1) (eo::define ((_let_1 (int.log2 (- n1)))) (concat (extract (- (- size1 _let_1) 1) 0 (bvneg ($singleton_elim (bvmul xs1 z1 ys1)))) (@bv 0 _let_1)))) +) +(declare-rule bv-mult-pow2-2b ((@n0 Int) (z1 (BitVec @n0)) (size1 Int) (n1 Int)) + :premises ((= (int.ispow2 (- n1)) true)) + :args (z1 size1 n1) + :conclusion (= (bvmul z1 (@bv n1 size1)) (eo::define ((_let_1 (int.log2 (- n1)))) (concat (extract (- (- size1 _let_1) 1) 0 (bvneg z1)) (@bv 0 _let_1)))) +) +(declare-rule bv-extract-mult-leading-bit ((@n0 Int) (@n1 Int) (high1 Int) (low1 Int) (x1i1 Int) (x1in1 Int) (x1 (BitVec @n0)) (y1i1 Int) (y1in1 Int) (y1 (BitVec @n1))) + :premises ((= (> (+ x1in1 (@bvsize x1)) 64) true) (= (<= (- (* 2 (+ x1in1 (@bvsize x1))) (+ (ite (= x1i1 0) x1in1 (- x1in1 (+ 1 (int.log2 x1i1)))) (ite (= y1i1 0) y1in1 (- y1in1 (+ 1 (int.log2 y1i1)))))) low1) true)) + :args (high1 low1 x1i1 x1in1 x1 y1i1 y1in1 y1) + :conclusion (= (extract high1 low1 (bvmul (concat (@bv x1i1 x1in1) x1) (concat (@bv y1i1 y1in1) y1))) (@bv 0 (+ 1 (- high1 low1)))) +) +(declare-rule bv-udiv-pow2-not-one ((@n0 Int) (x1 (BitVec @n0)) (v1 Int) (n1 Int)) + :premises ((= (int.ispow2 v1) true) (= (> v1 1) true)) + :args (x1 v1 n1) + :conclusion (= (bvudiv x1 (@bv v1 n1)) (eo::define ((_let_1 (int.log2 v1))) (concat (@bv 0 _let_1) (extract (- n1 1) _let_1 x1)))) +) +(declare-rule bv-udiv-zero ((@n0 Int) (x1 (BitVec @n0)) (n1 Int)) + :args (x1 n1) + :conclusion (= (bvudiv x1 (@bv 0 n1)) (bvnot (@bv 0 n1))) +) +(declare-rule bv-udiv-one ((@n0 Int) (x1 (BitVec @n0)) (n1 Int)) + :args (x1 n1) + :conclusion (= (bvudiv x1 (@bv 1 n1)) x1) +) +(declare-rule bv-urem-pow2-not-one ((@n0 Int) (x1 (BitVec @n0)) (v1 Int) (n1 Int)) + :premises ((= (int.ispow2 v1) true) (= (> v1 1) true)) + :args (x1 v1 n1) + :conclusion (= (bvurem x1 (@bv v1 n1)) (eo::define ((_let_1 (int.log2 v1))) (concat (@bv 0 (- n1 _let_1)) (extract (- _let_1 1) 0 x1)))) +) +(declare-rule bv-urem-one ((@n0 Int) (x1 (BitVec @n0)) (n1 Int)) + :args (x1 n1) + :conclusion (= (bvurem x1 (@bv 1 n1)) (@bv 0 n1)) +) +(declare-rule bv-urem-self ((@n0 Int) (x1 (BitVec @n0))) + :args (x1) + :conclusion (= (bvurem x1 x1) (@bv 0 (@bvsize x1))) +) +(declare-rule bv-shl-zero ((@n0 Int) (a1 (BitVec @n0)) (n1 Int)) + :args (a1 n1) + :conclusion (= (bvshl (@bv 0 n1) a1) (@bv 0 n1)) +) +(declare-rule bv-lshr-zero ((@n0 Int) (a1 (BitVec @n0)) (n1 Int)) + :args (a1 n1) + :conclusion (= (bvlshr (@bv 0 n1) a1) (@bv 0 n1)) +) +(declare-rule bv-ashr-zero ((@n0 Int) (a1 (BitVec @n0)) (n1 Int)) + :args (a1 n1) + :conclusion (= (bvashr (@bv 0 n1) a1) (@bv 0 n1)) +) +(declare-rule bv-ugt-urem ((@n0 Int) (@n1 Int) (y1 (BitVec @n0)) (x1 (BitVec @n1))) + :args (y1 x1) + :conclusion (= (bvugt (bvurem y1 x1) x1) (and (= x1 (@bv 0 (@bvsize x1))) (bvugt y1 (@bv 0 (@bvsize y1))))) +) +(declare-rule bv-ult-one ((@n0 Int) (x1 (BitVec @n0)) (n1 Int)) + :args (x1 n1) + :conclusion (= (bvult x1 (@bv 1 n1)) (= x1 (@bv 0 n1))) +) +(declare-rule bv-slt-zero ((@n0 Int) (x1 (BitVec @n0)) (n1 Int)) + :args (x1 n1) + :conclusion (= (bvslt x1 (@bv 0 n1)) (eo::define ((_let_1 (- n1 1))) (= (extract _let_1 _let_1 x1) (@bv 1 1)))) +) +(declare-rule bv-merge-sign-extend-1 ((@n0 Int) (x1 (BitVec @n0)) (i1 Int) (j1 Int)) + :args (x1 i1 j1) + :conclusion (= (sign_extend i1 (sign_extend j1 x1)) (sign_extend (+ i1 j1) x1)) +) +(declare-rule bv-merge-sign-extend-2 ((@n0 Int) (x1 (BitVec @n0)) (i1 Int) (j1 Int)) + :premises ((= (> j1 1) true)) + :args (x1 i1 j1) + :conclusion (= (sign_extend i1 (zero_extend j1 x1)) (zero_extend (+ i1 j1) x1)) +) +(declare-rule bv-merge-sign-extend-3 ((@n0 Int) (x1 (BitVec @n0)) (i1 Int) (n1 Int)) + :premises ((= n1 0)) + :args (x1 i1 n1) + :conclusion (= (sign_extend i1 (zero_extend n1 x1)) (sign_extend i1 x1)) +) +(declare-rule bv-sign-extend-eq-const-1 ((@n0 Int) (x1 (BitVec @n0)) (m1 Int) (c1 Int) (nm1 Int)) + :args (x1 m1 c1 nm1) + :conclusion (= (= (sign_extend m1 x1) (@bv c1 nm1)) (eo::define ((_let_1 (@bv c1 nm1))) (eo::define ((_let_2 (- (@bvsize x1) 1))) (eo::define ((_let_3 (@bv 0 (+ m1 1)))) (eo::define ((_let_4 (extract (- nm1 1) _let_2 _let_1))) (and (or (= _let_4 _let_3) (= _let_4 (bvnot _let_3))) (= x1 (extract _let_2 0 _let_1)))))))) +) +(declare-rule bv-sign-extend-eq-const-2 ((@n0 Int) (x1 (BitVec @n0)) (m1 Int) (c1 Int) (nm1 Int)) + :args (x1 m1 c1 nm1) + :conclusion (= (= (@bv c1 nm1) (sign_extend m1 x1)) (eo::define ((_let_1 (@bv c1 nm1))) (eo::define ((_let_2 (- (@bvsize x1) 1))) (eo::define ((_let_3 (@bv 0 (+ m1 1)))) (eo::define ((_let_4 (extract (- nm1 1) _let_2 _let_1))) (and (or (= _let_4 _let_3) (= _let_4 (bvnot _let_3))) (= x1 (extract _let_2 0 _let_1)))))))) +) +(declare-rule bv-zero-extend-eq-const-1 ((@n0 Int) (x1 (BitVec @n0)) (m1 Int) (c1 Int) (nm1 Int)) + :args (x1 m1 c1 nm1) + :conclusion (= (= (zero_extend m1 x1) (@bv c1 nm1)) (eo::define ((_let_1 (@bv c1 nm1))) (eo::define ((_let_2 (- (@bvsize x1) 1))) (and (= (extract (- nm1 1) _let_2 _let_1) (@bv 0 m1)) (= x1 (extract _let_2 0 _let_1)))))) +) +(declare-rule bv-zero-extend-eq-const-2 ((@n0 Int) (x1 (BitVec @n0)) (m1 Int) (c1 Int) (nm1 Int)) + :args (x1 m1 c1 nm1) + :conclusion (= (= (@bv c1 nm1) (zero_extend m1 x1)) (eo::define ((_let_1 (@bv c1 nm1))) (eo::define ((_let_2 (- (@bvsize x1) 1))) (and (= (extract (- nm1 1) _let_2 _let_1) (@bv 0 m1)) (= x1 (extract _let_2 0 _let_1)))))) +) +(declare-rule bv-zero-extend-ult-const-1 ((@n0 Int) (x1 (BitVec @n0)) (m1 Int) (c1 Int) (nm1 Int)) + :premises ((= (extract (- nm1 1) (@bvsize x1) (@bv c1 nm1)) (@bv 0 m1))) + :args (x1 m1 c1 nm1) + :conclusion (= (bvult (zero_extend m1 x1) (@bv c1 nm1)) (bvult x1 (extract (- (@bvsize x1) 1) 0 (@bv c1 nm1)))) +) +(declare-rule bv-zero-extend-ult-const-2 ((@n0 Int) (x1 (BitVec @n0)) (m1 Int) (c1 Int) (nm1 Int)) + :premises ((= (extract (- nm1 1) (@bvsize x1) (@bv c1 nm1)) (@bv 0 m1))) + :args (x1 m1 c1 nm1) + :conclusion (= (bvult (@bv c1 nm1) (zero_extend m1 x1)) (bvult (extract (- (@bvsize x1) 1) 0 (@bv c1 nm1)) x1)) +) +(declare-rule bv-sign-extend-ult-const-1 ((@n0 Int) (x1 (BitVec @n0)) (m1 Int) (c1 Int) (nm1 Int)) + :premises ((eo::define ((_let_1 (@bv (- (@bvsize x1) 1) nm1))) (eo::define ((_let_2 (@bv c1 nm1))) (= (or (bvule _let_2 (bvshl (@bv 1 nm1) _let_1)) (bvuge _let_2 (bvshl (bvnot (@bv 0 nm1)) _let_1))) true)))) + :args (x1 m1 c1 nm1) + :conclusion (= (bvult (sign_extend m1 x1) (@bv c1 nm1)) (bvult x1 (extract (- (@bvsize x1) 1) 0 (@bv c1 nm1)))) +) +(declare-rule bv-sign-extend-ult-const-2 ((@n0 Int) (x1 (BitVec @n0)) (m1 Int) (c1 Int) (nm1 Int)) + :premises ((= (bvult (bvshl (@bv 1 nm1) (@bv (- (@bvsize x1) 1) nm1)) (@bv c1 nm1)) true) (= (bvule (@bv c1 nm1) (bvshl (bvnot (@bv 0 nm1)) (@bv (- (@bvsize x1) 1) nm1))) true)) + :args (x1 m1 c1 nm1) + :conclusion (= (bvult (sign_extend m1 x1) (@bv c1 nm1)) (eo::define ((_let_1 (- (@bvsize x1) 1))) (= (extract _let_1 _let_1 x1) (@bv 0 1)))) +) +(declare-rule bv-sign-extend-ult-const-3 ((@n0 Int) (x1 (BitVec @n0)) (m1 Int) (c1 Int) (nm1 Int)) + :premises ((eo::define ((_let_1 (bvshl (@bv 1 nm1) (@bv (- (@bvsize x1) 1) nm1)))) (eo::define ((_let_2 (@bv c1 nm1))) (= (or (bvult _let_2 _let_1) (bvuge _let_2 (bvnot _let_1))) true)))) + :args (x1 m1 c1 nm1) + :conclusion (= (bvult (@bv c1 nm1) (sign_extend m1 x1)) (bvult (extract (- (@bvsize x1) 1) 0 (@bv c1 nm1)) x1)) +) +(declare-rule bv-sign-extend-ult-const-4 ((@n0 Int) (x1 (BitVec @n0)) (m1 Int) (c1 Int) (nm1 Int)) + :premises ((= (bvule (bvnot (bvshl (bvnot (@bv 0 nm1)) (@bv (- (@bvsize x1) 1) nm1))) (@bv c1 nm1)) true) (= (bvule (@bv c1 nm1) (bvnot (bvshl (@bv 1 nm1) (@bv (- (@bvsize x1) 1) nm1)))) true)) + :args (x1 m1 c1 nm1) + :conclusion (= (bvult (@bv c1 nm1) (sign_extend m1 x1)) (eo::define ((_let_1 (- (@bvsize x1) 1))) (= (extract _let_1 _let_1 x1) (@bv 1 1)))) +) +(declare-rule sets-eq-singleton-emp ((@T0 Type) (@T1 Type) (x1 (Set @T0)) (y1 @T1)) + :premises ((= (set.is_empty x1) true)) + :args (x1 y1) + :conclusion (= (= x1 (set.singleton y1)) false) +) +(declare-rule sets-member-singleton ((@T0 Type) (@T1 Type) (x1 @T0) (y1 @T1)) + :args (x1 y1) + :conclusion (= (set.member x1 (set.singleton y1)) (= x1 y1)) +) +(declare-rule sets-member-emp ((@T0 Type) (@T1 Type) (x1 @T0) (y1 (Set @T1))) + :premises ((= (set.is_empty y1) true)) + :args (x1 y1) + :conclusion (= (set.member x1 y1) false) +) +(declare-rule sets-subset-elim ((@T0 Type) (@T1 Type) (x1 (Set @T0)) (y1 (Set @T1))) + :args (x1 y1) + :conclusion (= (set.subset x1 y1) (= (set.union x1 y1) y1)) +) +(declare-rule sets-union-comm ((@T0 Type) (@T1 Type) (x1 (Set @T0)) (y1 (Set @T1))) + :args (x1 y1) + :conclusion (= (set.union x1 y1) (set.union y1 x1)) +) +(declare-rule sets-inter-comm ((@T0 Type) (@T1 Type) (x1 (Set @T0)) (y1 (Set @T1))) + :args (x1 y1) + :conclusion (= (set.inter x1 y1) (set.inter y1 x1)) +) +(declare-rule sets-inter-emp1 ((@T0 Type) (@T1 Type) (x1 (Set @T0)) (y1 (Set @T1))) + :premises ((= (set.is_empty x1) true)) + :args (x1 y1) + :conclusion (= (set.inter x1 y1) x1) +) +(declare-rule sets-inter-emp2 ((@T0 Type) (@T1 Type) (x1 (Set @T0)) (y1 (Set @T1))) + :premises ((= (set.is_empty y1) true)) + :args (x1 y1) + :conclusion (= (set.inter x1 y1) y1) +) +(declare-rule sets-minus-emp1 ((@T0 Type) (@T1 Type) (x1 (Set @T0)) (y1 (Set @T1))) + :premises ((= (set.is_empty x1) true)) + :args (x1 y1) + :conclusion (= (set.minus x1 y1) x1) +) +(declare-rule sets-minus-emp2 ((@T0 Type) (@T1 Type) (x1 (Set @T0)) (y1 (Set @T1))) + :premises ((= (set.is_empty y1) true)) + :args (x1 y1) + :conclusion (= (set.minus x1 y1) x1) +) +(declare-rule sets-union-emp1 ((@T0 Type) (@T1 Type) (x1 (Set @T0)) (y1 (Set @T1))) + :premises ((= (set.is_empty x1) true)) + :args (x1 y1) + :conclusion (= (set.union x1 y1) y1) +) +(declare-rule sets-union-emp2 ((@T0 Type) (@T1 Type) (x1 (Set @T0)) (y1 (Set @T1))) + :premises ((= (set.is_empty y1) true)) + :args (x1 y1) + :conclusion (= (set.union x1 y1) x1) +) +(declare-rule sets-inter-member ((@T0 Type) (@T1 Type) (@T2 Type) (x1 @T0) (y1 (Set @T1)) (z1 (Set @T2))) + :args (x1 y1 z1) + :conclusion (= (set.member x1 (set.inter y1 z1)) (and (set.member x1 y1) (set.member x1 z1))) +) +(declare-rule sets-minus-member ((@T0 Type) (@T1 Type) (@T2 Type) (x1 @T0) (y1 (Set @T1)) (z1 (Set @T2))) + :args (x1 y1 z1) + :conclusion (= (set.member x1 (set.minus y1 z1)) (and (set.member x1 y1) (not (set.member x1 z1)))) +) +(declare-rule sets-union-member ((@T0 Type) (@T1 Type) (@T2 Type) (x1 @T0) (y1 (Set @T1)) (z1 (Set @T2))) + :args (x1 y1 z1) + :conclusion (= (set.member x1 (set.union y1 z1)) (or (set.member x1 y1) (set.member x1 z1))) +) +(declare-rule sets-choose-singleton ((@T0 Type) (x1 @T0)) + :args (x1) + :conclusion (= (set.choose (set.singleton x1)) x1) +) +(declare-rule sets-card-singleton ((@T0 Type) (x1 @T0)) + :args (x1) + :conclusion (= (set.card (set.singleton x1)) 1) +) +(declare-rule sets-card-union ((@T0 Type) (@T1 Type) (s1 (Set @T0)) (t1 (Set @T1))) + :args (s1 t1) + :conclusion (= (set.card (set.union s1 t1)) (- (+ (set.card s1) (set.card t1)) (set.card (set.inter s1 t1)))) +) +(declare-rule sets-card-minus ((@T0 Type) (@T1 Type) (s1 (Set @T0)) (t1 (Set @T1))) + :args (s1 t1) + :conclusion (= (set.card (set.minus s1 t1)) (- (set.card s1) (set.card (set.inter s1 t1)))) +) +(declare-rule sets-card-emp ((@T0 Type) (x1 (Set @T0))) + :premises ((= (set.is_empty x1) true)) + :args (x1) + :conclusion (= (set.card x1) 0) +) +(declare-rule str-eq-ctn-false ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (x1 (Seq @T0) :list) (x2 (Seq @T1)) (x3 (Seq @T2) :list) (y1 (Seq @T3))) + :premises ((= (seq.contains y1 x2) false)) + :args (x1 x2 x3 y1) + :conclusion (= (= ($singleton_elim (seq.++ x1 x2 x3)) y1) false) +) +(declare-rule str-eq-ctn-full-false1 ((@T0 Type) (@T1 Type) (x1 (Seq @T0)) (y1 (Seq @T1))) + :premises ((= (seq.contains y1 x1) false)) + :args (x1 y1) + :conclusion (= (= x1 y1) false) +) +(declare-rule str-eq-ctn-full-false2 ((@T0 Type) (@T1 Type) (x1 (Seq @T0)) (y1 (Seq @T1))) + :premises ((= (seq.contains x1 y1) false)) + :args (x1 y1) + :conclusion (= (= x1 y1) false) +) +(declare-rule str-concat-flatten ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (xs1 (Seq @T0) :list) (s1 (Seq @T1)) (ys1 (Seq @T2) :list) (zs1 (Seq @T3) :list)) + :args (xs1 s1 ys1 zs1) + :conclusion (= ($singleton_elim (seq.++ xs1 ($singleton_elim (seq.++ s1 ys1)) zs1)) ($singleton_elim (seq.++ xs1 s1 ys1 zs1))) +) +(declare-rule str-concat-flatten-eq ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (x1 (Seq @T0)) (x2 (Seq @T1) :list) (x3 (Seq @T2) :list) (y1 (Seq @T3))) + :args (x1 x2 x3 y1) + :conclusion (= (= ($singleton_elim (seq.++ ($singleton_elim (seq.++ x1 x2)) x3)) y1) (= y1 ($singleton_elim (seq.++ x1 x2 x3)))) +) +(declare-rule str-concat-flatten-eq-rev ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (x1 (Seq @T0)) (x2 (Seq @T1) :list) (x3 (Seq @T2) :list) (y1 (Seq @T3))) + :args (x1 x2 x3 y1) + :conclusion (= (= ($singleton_elim (seq.++ x3 ($singleton_elim (seq.++ x2 x1)))) y1) (= y1 ($singleton_elim (seq.++ x3 x2 x1)))) +) +(declare-rule str-substr-empty-str ((n1 Int) (m1 Int)) + :args (n1 m1) + :conclusion (= (str.substr "" n1 m1) "") +) +(declare-rule str-substr-empty-range ((x1 String) (n1 Int) (m1 Int)) + :premises ((= (>= 0 m1) true)) + :args (x1 n1 m1) + :conclusion (= (str.substr x1 n1 m1) "") +) +(declare-rule str-substr-empty-start ((x1 String) (n1 Int) (m1 Int)) + :premises ((= (>= n1 (str.len x1)) true)) + :args (x1 n1 m1) + :conclusion (= (str.substr x1 n1 m1) "") +) +(declare-rule str-substr-empty-start-neg ((x1 String) (n1 Int) (m1 Int)) + :premises ((= (< n1 0) true)) + :args (x1 n1 m1) + :conclusion (= (str.substr x1 n1 m1) "") +) +(declare-rule str-substr-eq-empty ((s1 String) (n1 Int) (m1 Int)) + :premises ((= n1 0) (= (> m1 n1) true)) + :args (s1 n1 m1) + :conclusion (= (= (str.substr s1 n1 m1) "") (= s1 "")) +) +(declare-rule str-len-replace-inv ((@T0 Type) (@T1 Type) (@T2 Type) (t1 (Seq @T0)) (s1 (Seq @T1)) (r1 (Seq @T2))) + :premises ((= (seq.len s1) (seq.len r1))) + :args (t1 s1 r1) + :conclusion (= (seq.len (seq.replace t1 s1 r1)) (seq.len t1)) +) +(declare-rule str-len-update-inv ((@T0 Type) (@T1 Type) (t1 (Seq @T0)) (n1 Int) (r1 (Seq @T1))) + :args (t1 n1 r1) + :conclusion (= (seq.len (seq.update t1 n1 r1)) (seq.len t1)) +) +(declare-rule str-len-substr-in-range ((@T0 Type) (s1 (Seq @T0)) (n1 Int) (m1 Int)) + :premises ((= (>= n1 0) true) (= (>= m1 0) true) (= (>= (seq.len s1) (+ n1 m1)) true)) + :args (s1 n1 m1) + :conclusion (= (seq.len (seq.extract s1 n1 m1)) m1) +) +(declare-rule str-len-substr-ub1 ((@T0 Type) (s1 (Seq @T0)) (n1 Int) (m1 Int) (k1 Int)) + :premises ((= (>= k1 0) true) (= (>= k1 m1) true)) + :args (s1 n1 m1 k1) + :conclusion (= (>= k1 (seq.len (seq.extract s1 n1 m1))) true) +) +(declare-rule str-len-substr-ub2 ((@T0 Type) (s1 (Seq @T0)) (n1 Int) (m1 Int) (k1 Int)) + :premises ((= (>= k1 0) true) (= (>= k1 (- (seq.len s1) n1)) true)) + :args (s1 n1 m1 k1) + :conclusion (= (>= k1 (seq.len (seq.extract s1 n1 m1))) true) +) +(declare-rule str-concat-clash ((s1 String) (s2 String :list) (t1 String) (t2 String :list)) + :premises ((= (= s1 t1) false) (= (str.len s1) (str.len t1))) + :args (s1 s2 t1 t2) + :conclusion (= (= ($singleton_elim (str.++ s1 s2)) ($singleton_elim (str.++ t1 t2))) false) +) +(declare-rule str-concat-clash-rev ((s1 String) (s2 String :list) (t1 String) (t2 String :list)) + :premises ((= (= s1 t1) false) (= (str.len s1) (str.len t1))) + :args (s1 s2 t1 t2) + :conclusion (= (= ($singleton_elim (str.++ s2 s1)) ($singleton_elim (str.++ t2 t1))) false) +) +(declare-rule str-concat-clash2 ((s1 String) (t1 String) (t2 String :list)) + :premises ((= (= s1 t1) false) (= (str.len s1) (str.len t1))) + :args (s1 t1 t2) + :conclusion (= (= s1 ($singleton_elim (str.++ t1 t2))) false) +) +(declare-rule str-concat-clash2-rev ((s1 String) (t1 String) (t2 String :list)) + :premises ((= (= s1 t1) false) (= (str.len s1) (str.len t1))) + :args (s1 t1 t2) + :conclusion (= (= s1 ($singleton_elim (str.++ t2 t1))) false) +) +(declare-rule str-concat-unify ((s1 String) (s2 String) (s3 String :list) (t1 String) (t2 String :list)) + :args (s1 s2 s3 t1 t2) + :conclusion (= (= (str.++ s1 s2 s3) (str.++ s1 t1 t2)) (= ($singleton_elim (str.++ s2 s3)) ($singleton_elim (str.++ t1 t2)))) +) +(declare-rule str-concat-unify-rev ((s1 String) (s2 String) (s3 String :list) (t1 String) (t2 String :list)) + :args (s1 s2 s3 t1 t2) + :conclusion (= (= (str.++ s2 s3 s1) (str.++ t1 t2 s1)) (= ($singleton_elim (str.++ s2 s3)) ($singleton_elim (str.++ t1 t2)))) +) +(declare-rule str-concat-unify-base ((s1 String) (t1 String) (t2 String :list)) + :args (s1 t1 t2) + :conclusion (= (= s1 (str.++ s1 t1 t2)) (= "" ($singleton_elim (str.++ t1 t2)))) +) +(declare-rule str-concat-unify-base-rev ((s1 String) (t1 String) (t2 String :list)) + :args (s1 t1 t2) + :conclusion (= (= s1 (str.++ t1 t2 s1)) (= "" ($singleton_elim (str.++ t1 t2)))) +) +(declare-rule str-concat-clash-char ((s1 String) (s2 String :list) (s3 String :list) (t1 String) (t2 String :list) (t3 String :list)) + :premises ((= (= s1 t1) false) (= (str.len s1) (str.len t1))) + :args (s1 s2 s3 t1 t2 t3) + :conclusion (= (= ($singleton_elim (str.++ ($singleton_elim (str.++ s1 s2)) s3)) ($singleton_elim (str.++ ($singleton_elim (str.++ t1 t2)) t3))) false) +) +(declare-rule str-concat-clash-char-rev ((s1 String) (s2 String :list) (s3 String :list) (t1 String) (t2 String :list) (t3 String :list)) + :premises ((= (= s1 t1) false) (= (str.len s1) (str.len t1))) + :args (s1 s2 s3 t1 t2 t3) + :conclusion (= (= ($singleton_elim (str.++ s3 ($singleton_elim (str.++ s2 s1)))) ($singleton_elim (str.++ t3 ($singleton_elim (str.++ t2 t1))))) false) +) +(declare-rule str-prefixof-elim ((@T0 Type) (@T1 Type) (s1 (Seq @T0)) (t1 (Seq @T1))) + :args (s1 t1) + :conclusion (= (seq.prefixof s1 t1) (= s1 (seq.extract t1 0 (seq.len s1)))) +) +(declare-rule str-suffixof-elim ((@T0 Type) (@T1 Type) (s1 (Seq @T0)) (t1 (Seq @T1))) + :args (s1 t1) + :conclusion (= (seq.suffixof s1 t1) (eo::define ((_let_1 (seq.len s1))) (= s1 (seq.extract t1 (- (seq.len t1) _let_1) _let_1)))) +) +(declare-rule str-prefixof-one ((@T0 Type) (@T1 Type) (s1 (Seq @T0)) (t1 (Seq @T1))) + :premises ((= (seq.len t1) 1)) + :args (s1 t1) + :conclusion (= (seq.prefixof s1 t1) (seq.contains t1 s1)) +) +(declare-rule str-suffixof-one ((@T0 Type) (@T1 Type) (s1 (Seq @T0)) (t1 (Seq @T1))) + :premises ((= (seq.len t1) 1)) + :args (s1 t1) + :conclusion (= (seq.suffixof s1 t1) (seq.contains t1 s1)) +) +(declare-rule str-substr-combine1 ((s1 String) (n1 Int) (m1 Int) (n2 Int) (m2 Int)) + :premises ((= (>= n1 0) true) (= (>= n2 0) true) (= (>= (- m2 (- m1 n2)) 0) true)) + :args (s1 n1 m1 n2 m2) + :conclusion (= (str.substr (str.substr s1 n1 m1) n2 m2) (str.substr s1 (+ n1 n2) (- m1 n2))) +) +(declare-rule str-substr-combine2 ((s1 String) (n1 Int) (m1 Int) (n2 Int) (m2 Int)) + :premises ((= (>= n1 0) true) (= (>= n2 0) true) (= (>= (- (- m1 n2) m2) 0) true)) + :args (s1 n1 m1 n2 m2) + :conclusion (= (str.substr (str.substr s1 n1 m1) n2 m2) (str.substr s1 (+ n1 n2) m2)) +) +(declare-rule str-substr-combine3 ((s1 String) (n1 Int) (m1 Int) (n2 Int) (m2 Int)) + :premises ((= (>= n1 0) true) (= (>= n2 0) true) (= (>= (str.len (str.substr s1 n1 m1)) (+ n2 m2)) true)) + :args (s1 n1 m1 n2 m2) + :conclusion (= (str.substr (str.substr s1 n1 m1) n2 m2) (str.substr s1 (+ n1 n2) m2)) +) +(declare-rule str-substr-combine4 ((s1 String) (n1 Int) (m1 Int) (n2 Int) (m2 Int)) + :premises ((= (>= n1 0) true) (= (>= n2 0) true) (= (>= (+ n2 m2) (str.len (str.substr s1 n1 m1))) true)) + :args (s1 n1 m1 n2 m2) + :conclusion (= (str.substr (str.substr s1 n1 m1) n2 m2) (str.substr s1 (+ n1 n2) (- m1 n2))) +) +(declare-rule str-substr-concat1 ((@T0 Type) (@T1 Type) (s1 (Seq @T0)) (s2 (Seq @T1) :list) (n1 Int) (m1 Int)) + :premises ((= (>= n1 0) true) (= (>= (seq.len s1) (+ n1 m1)) true)) + :args (s1 s2 n1 m1) + :conclusion (= (seq.extract ($singleton_elim (seq.++ s1 s2)) n1 m1) (seq.extract s1 n1 m1)) +) +(declare-rule str-substr-concat2 ((@T0 Type) (@T1 Type) (@T2 Type) (s1 (Seq @T0)) (s2 (Seq @T1)) (s3 (Seq @T2) :list) (n1 Int) (m1 Int)) + :premises ((= (>= n1 (seq.len s1)) true)) + :args (s1 s2 s3 n1 m1) + :conclusion (= (seq.extract (seq.++ s1 s2 s3) n1 m1) (seq.extract ($singleton_elim (seq.++ s2 s3)) (- n1 (seq.len s1)) m1)) +) +(declare-rule str-substr-full ((@T0 Type) (s1 (Seq @T0)) (n1 Int)) + :premises ((= (>= n1 (seq.len s1)) true)) + :args (s1 n1) + :conclusion (= (seq.extract s1 0 n1) s1) +) +(declare-rule str-substr-full-eq ((@T0 Type) (s1 (Seq @T0)) (n1 Int)) + :premises ((= (seq.len s1) n1)) + :args (s1 n1) + :conclusion (= (seq.extract s1 0 n1) s1) +) +(declare-rule str-contains-refl ((@T0 Type) (x1 (Seq @T0))) + :args (x1) + :conclusion (= (seq.contains x1 x1) true) +) +(declare-rule str-contains-concat-find ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (xs1 (Seq @T0) :list) (z1 (Seq @T1)) (y1 (Seq @T2)) (zs1 (Seq @T3) :list)) + :premises ((= (seq.contains z1 y1) true)) + :args (xs1 z1 y1 zs1) + :conclusion (= (seq.contains ($singleton_elim (seq.++ xs1 z1 zs1)) y1) true) +) +(declare-rule str-contains-split-char ((@T0 Type) (@T1 Type) (@T2 Type) (@T3 Type) (x1 (Seq @T0)) (y1 (Seq @T1)) (z1 (Seq @T2) :list) (w1 (Seq @T3))) + :premises ((= (seq.len w1) 1)) + :args (x1 y1 z1 w1) + :conclusion (= (seq.contains (seq.++ x1 y1 z1) w1) (or (seq.contains x1 w1) (seq.contains ($singleton_elim (seq.++ y1 z1)) w1))) +) +(declare-rule str-contains-lt-len ((x1 String) (y1 String)) + :premises ((= (> (str.len y1) (str.len x1)) true)) + :args (x1 y1) + :conclusion (= (str.contains x1 y1) false) +) +(declare-rule str-contains-leq-len-eq ((x1 String) (y1 String)) + :premises ((= (>= (str.len y1) (str.len x1)) true)) + :args (x1 y1) + :conclusion (= (str.contains x1 y1) (= x1 y1)) +) +(declare-rule str-contains-emp ((x1 String) (y1 String)) + :premises ((= (str.len y1) 0)) + :args (x1 y1) + :conclusion (= (str.contains x1 y1) true) +) +(declare-rule str-contains-is-emp ((x1 String) (y1 String)) + :premises ((= (str.len x1) 0)) + :args (x1 y1) + :conclusion (= (str.contains x1 y1) (= x1 y1)) +) +(declare-rule str-concat-emp ((xs1 String :list) (ys1 String :list)) + :args (xs1 ys1) + :conclusion (= ($singleton_elim (str.++ xs1 "" ys1)) ($singleton_elim (str.++ xs1 ys1))) +) +(declare-rule str-at-elim ((@T0 Type) (x1 (Seq @T0)) (n1 Int)) + :args (x1 n1) + :conclusion (= (seq.at x1 n1) (seq.extract x1 n1 1)) +) +(declare-rule str-replace-self ((@T0 Type) (@T1 Type) (t1 (Seq @T0)) (s1 (Seq @T1))) + :args (t1 s1) + :conclusion (= (seq.replace t1 t1 s1) s1) +) +(declare-rule str-replace-no-contains ((@T0 Type) (@T1 Type) (@T2 Type) (t1 (Seq @T0)) (s1 (Seq @T1)) (r1 (Seq @T2))) + :premises ((= (seq.contains t1 s1) false)) + :args (t1 s1 r1) + :conclusion (= (seq.replace t1 s1 r1) t1) +) +(declare-rule str-replace-empty ((@T0 Type) (@T1 Type) (t1 (Seq @T0)) (s1 (Seq @T1))) + :args (t1 s1) + :conclusion (= (seq.replace t1 "" s1) (seq.++ s1 t1)) +) +(declare-rule str-len-concat-rec ((@T0 Type) (@T1 Type) (@T2 Type) (s1 (Seq @T0)) (s2 (Seq @T1)) (s3 (Seq @T2) :list)) + :args (s1 s2 s3) + :conclusion (= (seq.len (seq.++ s1 s2 s3)) (+ (seq.len s1) (seq.len ($singleton_elim (seq.++ s2 s3))))) +) +(declare-rule str-indexof-self ((t1 String) (n1 Int)) + :args (t1 n1) + :conclusion (= (str.indexof t1 t1 n1) (str.indexof "" "" n1)) +) +(declare-rule str-indexof-no-contains ((t1 String) (s1 String) (n1 Int)) + :premises ((= (str.contains (str.substr t1 n1 (str.len t1)) s1) false)) + :args (t1 s1 n1) + :conclusion (= (str.indexof t1 s1 n1) (- 1)) +) +(declare-rule str-to-lower-concat ((s1 String) (s2 String) (s3 String :list)) + :args (s1 s2 s3) + :conclusion (= (str.to_lower (str.++ s1 s2 s3)) (str.++ (str.to_lower s1) (str.to_lower ($singleton_elim (str.++ s2 s3))))) +) +(declare-rule str-to-upper-concat ((s1 String) (s2 String) (s3 String :list)) + :args (s1 s2 s3) + :conclusion (= (str.to_upper (str.++ s1 s2 s3)) (str.++ (str.to_upper s1) (str.to_upper ($singleton_elim (str.++ s2 s3))))) +) +(declare-rule str-to-lower-upper ((s1 String)) + :args (s1) + :conclusion (= (str.to_lower (str.to_upper s1)) (str.to_lower s1)) +) +(declare-rule str-to-upper-lower ((s1 String)) + :args (s1) + :conclusion (= (str.to_upper (str.to_lower s1)) (str.to_upper s1)) ) (declare-rule re-all-elim () :args () :conclusion (= re.all (re.* re.allchar)) ) -(declare-rule re-opt-elim ((x1032 RegLan)) - :args (x1032) - :conclusion (= (re.opt x1032) (re.union (str.to_re "") x1032)) -) -(declare-rule re-diff-elim ((x1033 RegLan) (y1034 RegLan)) - :args (x1033 y1034) - :conclusion (= (re.diff x1033 y1034) (re.inter x1033 (re.comp y1034))) -) -(declare-rule re-concat-emp ((xs1035 RegLan :list) (ys1036 RegLan :list)) - :args (xs1035 ys1036) - :conclusion (= ($singleton_elim (re.++ xs1035 (str.to_re "") ys1036)) ($singleton_elim (re.++ xs1035 ys1036))) -) -(declare-rule re-concat-none ((xs1037 RegLan :list) (ys1038 RegLan :list)) - :args (xs1037 ys1038) - :conclusion (= ($singleton_elim (re.++ xs1037 re.none ys1038)) re.none) -) -(declare-rule re-concat-flatten ((xs1039 RegLan :list) (s1040 RegLan) (ys1041 RegLan :list) (zs1042 RegLan :list)) - :args (xs1039 s1040 ys1041 zs1042) - :conclusion (= ($singleton_elim (re.++ xs1039 ($singleton_elim (re.++ s1040 ys1041)) zs1042)) ($singleton_elim (re.++ xs1039 s1040 ys1041 zs1042))) -) -(declare-rule re-concat-star-swap ((xs1043 RegLan :list) (r1044 RegLan) (ys1045 RegLan :list)) - :args (xs1043 r1044 ys1045) - :conclusion (= (re.++ xs1043 (re.* r1044) r1044 ys1045) (re.++ xs1043 r1044 (re.* r1044) ys1045)) -) -(declare-rule re-concat-merge ((xs1046 RegLan :list) (s1047 String) (t1048 String) (ys1049 RegLan :list)) - :args (xs1046 s1047 t1048 ys1049) - :conclusion (= (re.++ xs1046 (str.to_re s1047) (str.to_re t1048) ys1049) ($singleton_elim (re.++ xs1046 (str.to_re (str.++ s1047 t1048)) ys1049))) -) -(declare-rule re-union-all ((xs1050 RegLan :list) (ys1051 RegLan :list)) - :args (xs1050 ys1051) - :conclusion (= ($singleton_elim (re.union xs1050 (re.* re.allchar) ys1051)) (re.* re.allchar)) -) -(declare-rule re-union-none ((xs1052 RegLan :list) (ys1053 RegLan :list)) - :args (xs1052 ys1053) - :conclusion (= ($singleton_elim (re.union xs1052 re.none ys1053)) ($singleton_elim (re.union xs1052 ys1053))) -) -(declare-rule re-union-flatten ((xs1054 RegLan :list) (b1055 RegLan) (ys1056 RegLan :list) (zs1057 RegLan :list)) - :args (xs1054 b1055 ys1056 zs1057) - :conclusion (= ($singleton_elim (re.union xs1054 ($singleton_elim (re.union b1055 ys1056)) zs1057)) ($singleton_elim (re.union xs1054 b1055 ys1056 zs1057))) -) -(declare-rule re-union-dup ((xs1058 RegLan :list) (b1059 RegLan) (ys1060 RegLan :list) (zs1061 RegLan :list)) - :args (xs1058 b1059 ys1060 zs1061) - :conclusion (= (re.union xs1058 b1059 ys1060 b1059 zs1061) ($singleton_elim (re.union xs1058 b1059 ys1060 zs1061))) -) -(declare-rule re-inter-all ((xs1062 RegLan :list) (ys1063 RegLan :list)) - :args (xs1062 ys1063) - :conclusion (= ($singleton_elim (re.inter xs1062 (re.* re.allchar) ys1063)) ($singleton_elim (re.inter xs1062 ys1063))) -) -(declare-rule re-inter-none ((xs1064 RegLan :list) (ys1065 RegLan :list)) - :args (xs1064 ys1065) - :conclusion (= ($singleton_elim (re.inter xs1064 re.none ys1065)) re.none) -) -(declare-rule re-inter-flatten ((xs1066 RegLan :list) (b1067 RegLan) (ys1068 RegLan :list) (zs1069 RegLan :list)) - :args (xs1066 b1067 ys1068 zs1069) - :conclusion (= ($singleton_elim (re.inter xs1066 ($singleton_elim (re.inter b1067 ys1068)) zs1069)) ($singleton_elim (re.inter xs1066 b1067 ys1068 zs1069))) -) -(declare-rule re-inter-dup ((xs1070 RegLan :list) (b1071 RegLan) (ys1072 RegLan :list) (zs1073 RegLan :list)) - :args (xs1070 b1071 ys1072 zs1073) - :conclusion (= (re.inter xs1070 b1071 ys1072 b1071 zs1073) ($singleton_elim (re.inter xs1070 b1071 ys1072 zs1073))) -) -(declare-rule re-loop-neg ((n1074 Int) (m1075 Int) (r1076 RegLan)) - :premises ((= (> n1074 m1075) true)) - :args (n1074 m1075 r1076) - :conclusion (= (re.loop n1074 m1075 r1076) re.none) -) -(declare-rule re-inter-cstring ((xs1077 RegLan :list) (ys1078 RegLan :list) (s1079 String)) - :premises ((= (str.in_re s1079 ($singleton_elim (re.inter xs1077 ys1078))) true)) - :args (xs1077 ys1078 s1079) - :conclusion (= ($singleton_elim (re.inter xs1077 (str.to_re s1079) ys1078)) (str.to_re s1079)) -) -(declare-rule re-inter-cstring-neg ((xs1080 RegLan :list) (ys1081 RegLan :list) (s1082 String)) - :premises ((= (str.in_re s1082 ($singleton_elim (re.inter xs1080 ys1081))) false)) - :args (xs1080 ys1081 s1082) - :conclusion (= ($singleton_elim (re.inter xs1080 (str.to_re s1082) ys1081)) re.none) -) -(declare-rule str-substr-len-include ((@T0 Type) (@T1 Type) (s11083 (Seq @T0)) (s21084 (Seq @T1) :list) (n1085 Int)) - :premises ((= n1085 (seq.len s11083))) - :args (s11083 s21084 n1085) - :conclusion (= (seq.extract ($singleton_elim (seq.++ s11083 s21084)) 0 n1085) s11083) -) -(declare-rule str-substr-len-include-pre ((@T0 Type) (@T1 Type) (@T2 Type) (s11086 (Seq @T0)) (s21087 (Seq @T1)) (s31088 (Seq @T2) :list) (n1089 Int)) - :premises ((= (>= n1089 (seq.len s11086)) true)) - :args (s11086 s21087 s31088 n1089) - :conclusion (= (seq.extract (seq.++ s11086 s21087 s31088) 0 n1089) (seq.++ s11086 (seq.extract ($singleton_elim (seq.++ s21087 s31088)) 0 (- n1089 (seq.len s11086))))) -) -(declare-rule str-substr-len-skip ((@T0 Type) (@T1 Type) (@T2 Type) (s11090 (Seq @T0)) (s21091 (Seq @T1)) (s31092 (Seq @T2) :list) (n1093 Int) (m1094 Int)) - :premises ((= (>= n1093 (seq.len s11090)) true)) - :args (s11090 s21091 s31092 n1093 m1094) - :conclusion (= (seq.extract (seq.++ s11090 s21091 s31092) n1093 m1094) (seq.extract ($singleton_elim (seq.++ s21091 s31092)) (- n1093 (seq.len s11090)) m1094)) -) -(declare-rule seq-rev-concat ((@T0 Type) (@T1 Type) (@T2 Type) (x1095 (Seq @T0)) (y1096 (Seq @T1) :list) (z1097 (Seq @T2))) - :args (x1095 y1096 z1097) - :conclusion (= (seq.rev (seq.++ x1095 y1096 z1097)) (seq.++ (seq.rev z1097) (seq.rev ($singleton_elim (seq.++ x1095 y1096))))) -) -(declare-rule seq-len-unit ((@T0 Type) (x1098 @T0)) - :args (x1098) - :conclusion (= (seq.len (seq.unit x1098)) 1) -) -(declare-rule seq-nth-unit ((@T0 Type) (x1099 @T0)) - :args (x1099) - :conclusion (= (seq.nth (seq.unit x1099) 0) x1099) -) -(declare-rule seq-rev-unit ((@T0 Type) (x1100 @T0)) - :args (x1100) - :conclusion (= (seq.rev (seq.unit x1100)) (seq.unit x1100)) -) -(declare-rule re-in-empty ((t1132 String)) - :args (t1132) - :conclusion (= (str.in_re t1132 re.none) false) -) -(declare-rule re-in-sigma ((t1133 String)) - :args (t1133) - :conclusion (= (str.in_re t1133 re.allchar) (= (str.len t1133) 1)) -) -(declare-rule re-in-sigma-star ((t1134 String)) - :args (t1134) - :conclusion (= (str.in_re t1134 (re.* re.allchar)) true) -) -(declare-rule re-in-cstring ((t1135 String) (s1136 String)) - :args (t1135 s1136) - :conclusion (= (str.in_re t1135 (str.to_re s1136)) (= t1135 s1136)) -) -(declare-rule re-in-comp ((t1137 String) (r1138 RegLan)) - :args (t1137 r1138) - :conclusion (= (str.in_re t1137 (re.comp r1138)) (not (str.in_re t1137 r1138))) -) -(declare-rule str-in-re-union-elim ((s1139 String) (r11140 RegLan) (r21141 RegLan) (rs1142 RegLan :list)) - :args (s1139 r11140 r21141 rs1142) - :conclusion (= (str.in_re s1139 (re.union r11140 r21141 rs1142)) (or (str.in_re s1139 r11140) (str.in_re s1139 ($singleton_elim (re.union r21141 rs1142))))) -) -(declare-rule str-in-re-inter-elim ((s1143 String) (r11144 RegLan) (r21145 RegLan) (rs1146 RegLan :list)) - :args (s1143 r11144 r21145 rs1146) - :conclusion (= (str.in_re s1143 (re.inter r11144 r21145 rs1146)) (and (str.in_re s1143 r11144) (str.in_re s1143 ($singleton_elim (re.inter r21145 rs1146))))) -) -(declare-rule str-in-re-range-elim ((s1147 String) (c11148 String) (c21149 String)) - :premises ((= (str.len c11148) 1) (= (str.len c21149) 1)) - :args (s1147 c11148 c21149) - :conclusion (= (str.in_re s1147 (re.range c11148 c21149)) (eo::define ((_let_1 (str.to_code s1147))) (and (<= (str.to_code c11148) _let_1) (<= _let_1 (str.to_code c21149))))) -) -(declare-rule str-in-re-contains ((t1150 String) (s1151 String)) - :args (t1150 s1151) - :conclusion (= (eo::define ((_let_1 (re.* re.allchar))) (str.in_re t1150 (re.++ _let_1 (str.to_re s1151) _let_1))) (str.contains t1150 s1151)) -) -(declare-rule str-in-re-strip-prefix ((s1152 String) (s11153 String) (s21154 String :list) (sr11155 String) (sr21156 String :list) (r1157 RegLan :list)) - :args (s1152 s11153 s21154 sr11155 sr21156 r1157) - :conclusion (= (str.in_re (str.++ s1152 s11153 s21154) ($singleton_elim (re.++ (str.to_re (str.++ s1152 sr11155 sr21156)) r1157))) (str.in_re ($singleton_elim (str.++ s11153 s21154)) ($singleton_elim (re.++ (str.to_re ($singleton_elim (str.++ sr11155 sr21156))) r1157)))) -) -(declare-rule str-in-re-strip-prefix-neg ((s1158 String) (t1159 String) (s11160 String) (s21161 String :list) (sr11162 String) (sr21163 String :list) (r1164 RegLan :list)) - :premises ((= (str.len s1158) (str.len t1159)) (= (= s1158 t1159) false)) - :args (s1158 t1159 s11160 s21161 sr11162 sr21163 r1164) - :conclusion (= (str.in_re (str.++ s1158 s11160 s21161) ($singleton_elim (re.++ (str.to_re (str.++ t1159 sr11162 sr21163)) r1164))) false) -) -(declare-rule str-in-re-strip-prefix-sr-single ((s1165 String) (s11166 String) (s21167 String :list) (r11168 RegLan) (r21169 RegLan :list)) - :args (s1165 s11166 s21167 r11168 r21169) - :conclusion (= (str.in_re (str.++ s1165 s11166 s21167) (re.++ (str.to_re s1165) r11168 r21169)) (str.in_re ($singleton_elim (str.++ s11166 s21167)) ($singleton_elim (re.++ r11168 r21169)))) -) -(declare-rule str-in-re-strip-prefix-sr-single-neg ((s1170 String) (t1171 String) (s11172 String) (s21173 String :list) (r11174 RegLan) (r21175 RegLan :list)) - :premises ((= (str.len s1170) (str.len t1171)) (= (= s1170 t1171) false)) - :args (s1170 t1171 s11172 s21173 r11174 r21175) - :conclusion (= (str.in_re (str.++ s1170 s11172 s21173) (re.++ (str.to_re t1171) r11174 r21175)) false) -) -(declare-rule str-in-re-strip-prefix-srs-single ((s1176 String) (r11177 RegLan) (r21178 RegLan :list)) - :args (s1176 r11177 r21178) - :conclusion (= (str.in_re s1176 (re.++ (str.to_re s1176) r11177 r21178)) (str.in_re "" ($singleton_elim (re.++ r11177 r21178)))) -) -(declare-rule str-in-re-strip-prefix-srs-single-neg ((s1179 String) (t1180 String) (r11181 RegLan) (r21182 RegLan :list)) - :premises ((= (str.len s1179) (str.len t1180)) (= (= s1179 t1180) false)) - :args (s1179 t1180 r11181 r21182) - :conclusion (= (str.in_re s1179 (re.++ (str.to_re t1180) r11181 r21182)) false) -) -(declare-rule str-in-re-strip-prefix-s-single ((s1183 String) (sr11184 String) (sr21185 String :list) (r1186 RegLan :list)) - :args (s1183 sr11184 sr21185 r1186) - :conclusion (= (str.in_re s1183 ($singleton_elim (re.++ (str.to_re (str.++ s1183 sr11184 sr21185)) r1186))) (str.in_re "" ($singleton_elim (re.++ (str.to_re ($singleton_elim (str.++ sr11184 sr21185))) r1186)))) -) -(declare-rule str-in-re-strip-prefix-s-single-neg ((s1187 String) (t1188 String) (sr11189 String) (sr21190 String :list) (r1191 RegLan :list)) - :premises ((= (str.len s1187) (str.len t1188)) (= (= s1187 t1188) false)) - :args (s1187 t1188 sr11189 sr21190 r1191) - :conclusion (= (str.in_re s1187 ($singleton_elim (re.++ (str.to_re (str.++ t1188 sr11189 sr21190)) r1191))) false) -) -(declare-rule str-in-re-strip-prefix-base ((s1192 String) (s11193 String) (s21194 String :list) (sr11195 String) (sr21196 String :list)) - :args (s1192 s11193 s21194 sr11195 sr21196) - :conclusion (= (str.in_re (str.++ s1192 s11193 s21194) (str.to_re (str.++ s1192 sr11195 sr21196))) (str.in_re ($singleton_elim (str.++ s11193 s21194)) (str.to_re ($singleton_elim (str.++ sr11195 sr21196))))) -) -(declare-rule str-in-re-strip-prefix-base-neg ((s1197 String) (t1198 String) (s11199 String) (s21200 String :list) (sr11201 String) (sr21202 String :list)) - :premises ((= (str.len s1197) (str.len t1198)) (= (= s1197 t1198) false)) - :args (s1197 t1198 s11199 s21200 sr11201 sr21202) - :conclusion (= (str.in_re (str.++ s1197 s11199 s21200) (str.to_re (str.++ t1198 sr11201 sr21202))) false) -) -(declare-rule str-in-re-strip-prefix-base-s-single ((s1203 String) (sr11204 String) (sr21205 String :list)) - :args (s1203 sr11204 sr21205) - :conclusion (= (str.in_re s1203 (str.to_re (str.++ s1203 sr11204 sr21205))) (str.in_re "" (str.to_re ($singleton_elim (str.++ sr11204 sr21205))))) -) -(declare-rule str-in-re-strip-prefix-base-s-single-neg ((s1206 String) (t1207 String) (sr11208 String) (sr21209 String :list)) - :premises ((= (str.len s1206) (str.len t1207)) (= (= s1206 t1207) false)) - :args (s1206 t1207 sr11208 sr21209) - :conclusion (= (str.in_re s1206 (str.to_re (str.++ t1207 sr11208 sr21209))) false) -) -(declare-rule str-in-re-strip-char ((s1210 String) (s11211 String) (s21212 String :list) (r11213 RegLan) (r21214 RegLan :list)) - :premises ((= (str.len s1210) 1)) - :args (s1210 s11211 s21212 r11213 r21214) - :conclusion (= (str.in_re (str.++ s1210 s11211 s21212) (re.++ re.allchar r11213 r21214)) (str.in_re ($singleton_elim (str.++ s11211 s21212)) ($singleton_elim (re.++ r11213 r21214)))) -) -(declare-rule str-in-re-strip-char-s-single ((s1215 String) (r11216 RegLan) (r21217 RegLan :list)) - :premises ((= (str.len s1215) 1)) - :args (s1215 r11216 r21217) - :conclusion (= (str.in_re s1215 (re.++ re.allchar r11216 r21217)) (str.in_re "" ($singleton_elim (re.++ r11216 r21217)))) -) -(declare-rule str-in-re-strip-prefix-rev ((s1218 String) (s11219 String) (s21220 String :list) (sr11221 String) (sr21222 String :list) (r1223 RegLan :list)) - :args (s1218 s11219 s21220 sr11221 sr21222 r1223) - :conclusion (= (str.in_re (str.++ s11219 s21220 s1218) ($singleton_elim (re.++ r1223 (str.to_re (str.++ sr11221 sr21222 s1218))))) (str.in_re ($singleton_elim (str.++ s11219 s21220)) ($singleton_elim (re.++ r1223 (str.to_re ($singleton_elim (str.++ sr11221 sr21222))))))) -) -(declare-rule str-in-re-strip-prefix-neg-rev ((s1224 String) (t1225 String) (s11226 String) (s21227 String :list) (sr11228 String) (sr21229 String :list) (r1230 RegLan :list)) - :premises ((= (str.len s1224) (str.len t1225)) (= (= s1224 t1225) false)) - :args (s1224 t1225 s11226 s21227 sr11228 sr21229 r1230) - :conclusion (= (str.in_re (str.++ s11226 s21227 s1224) ($singleton_elim (re.++ r1230 (str.to_re (str.++ sr11228 sr21229 t1225))))) false) -) -(declare-rule str-in-re-strip-prefix-sr-single-rev ((s1231 String) (s11232 String) (s21233 String :list) (r11234 RegLan) (r21235 RegLan :list)) - :args (s1231 s11232 s21233 r11234 r21235) - :conclusion (= (str.in_re (str.++ s11232 s21233 s1231) (re.++ r11234 r21235 (str.to_re s1231))) (str.in_re ($singleton_elim (str.++ s11232 s21233)) ($singleton_elim (re.++ r11234 r21235)))) -) -(declare-rule str-in-re-strip-prefix-sr-single-neg-rev ((s1236 String) (t1237 String) (s11238 String) (s21239 String :list) (r11240 RegLan) (r21241 RegLan :list)) - :premises ((= (str.len s1236) (str.len t1237)) (= (= s1236 t1237) false)) - :args (s1236 t1237 s11238 s21239 r11240 r21241) - :conclusion (= (str.in_re (str.++ s11238 s21239 s1236) (re.++ r11240 r21241 (str.to_re t1237))) false) -) -(declare-rule str-in-re-strip-prefix-srs-single-rev ((s1242 String) (r11243 RegLan) (r21244 RegLan :list)) - :args (s1242 r11243 r21244) - :conclusion (= (str.in_re s1242 (re.++ r11243 r21244 (str.to_re s1242))) (str.in_re "" ($singleton_elim (re.++ r11243 r21244)))) -) -(declare-rule str-in-re-strip-prefix-srs-single-neg-rev ((s1245 String) (t1246 String) (r11247 RegLan) (r21248 RegLan :list)) - :premises ((= (str.len s1245) (str.len t1246)) (= (= s1245 t1246) false)) - :args (s1245 t1246 r11247 r21248) - :conclusion (= (str.in_re s1245 (re.++ r11247 r21248 (str.to_re t1246))) false) -) -(declare-rule str-in-re-strip-prefix-s-single-rev ((s1249 String) (sr11250 String) (sr21251 String :list) (r1252 RegLan :list)) - :args (s1249 sr11250 sr21251 r1252) - :conclusion (= (str.in_re s1249 ($singleton_elim (re.++ r1252 (str.to_re (str.++ sr11250 sr21251 s1249))))) (str.in_re "" ($singleton_elim (re.++ r1252 (str.to_re ($singleton_elim (str.++ sr11250 sr21251))))))) -) -(declare-rule str-in-re-strip-prefix-s-single-neg-rev ((s1253 String) (t1254 String) (sr11255 String) (sr21256 String :list) (r1257 RegLan :list)) - :premises ((= (str.len s1253) (str.len t1254)) (= (= s1253 t1254) false)) - :args (s1253 t1254 sr11255 sr21256 r1257) - :conclusion (= (str.in_re s1253 ($singleton_elim (re.++ r1257 (str.to_re (str.++ sr11255 sr21256 t1254))))) false) -) -(declare-rule str-in-re-strip-prefix-base-rev ((s1258 String) (s11259 String) (s21260 String :list) (sr11261 String) (sr21262 String :list)) - :args (s1258 s11259 s21260 sr11261 sr21262) - :conclusion (= (str.in_re (str.++ s11259 s21260 s1258) (str.to_re (str.++ sr11261 sr21262 s1258))) (str.in_re ($singleton_elim (str.++ s11259 s21260)) (str.to_re ($singleton_elim (str.++ sr11261 sr21262))))) -) -(declare-rule str-in-re-strip-prefix-base-neg-rev ((s1263 String) (t1264 String) (s11265 String) (s21266 String :list) (sr11267 String) (sr21268 String :list)) - :premises ((= (str.len s1263) (str.len t1264)) (= (= s1263 t1264) false)) - :args (s1263 t1264 s11265 s21266 sr11267 sr21268) - :conclusion (= (str.in_re (str.++ s11265 s21266 s1263) (str.to_re (str.++ sr11267 sr21268 t1264))) false) -) -(declare-rule str-in-re-strip-prefix-base-s-single-rev ((s1269 String) (sr11270 String) (sr21271 String :list)) - :args (s1269 sr11270 sr21271) - :conclusion (= (str.in_re s1269 (str.to_re (str.++ sr11270 sr21271 s1269))) (str.in_re "" (str.to_re ($singleton_elim (str.++ sr11270 sr21271))))) -) -(declare-rule str-in-re-strip-prefix-base-s-single-neg-rev ((s1272 String) (t1273 String) (sr11274 String) (sr21275 String :list)) - :premises ((= (str.len s1272) (str.len t1273)) (= (= s1272 t1273) false)) - :args (s1272 t1273 sr11274 sr21275) - :conclusion (= (str.in_re s1272 (str.to_re (str.++ sr11274 sr21275 t1273))) false) -) -(declare-rule str-in-re-strip-char-rev ((s1276 String) (s11277 String) (s21278 String :list) (r11279 RegLan) (r21280 RegLan :list)) - :premises ((= (str.len s1276) 1)) - :args (s1276 s11277 s21278 r11279 r21280) - :conclusion (= (str.in_re (str.++ s11277 s21278 s1276) (re.++ r11279 r21280 re.allchar)) (str.in_re ($singleton_elim (str.++ s11277 s21278)) ($singleton_elim (re.++ r11279 r21280)))) -) -(declare-rule str-in-re-strip-char-s-single-rev ((s1281 String) (r11282 RegLan) (r21283 RegLan :list)) - :premises ((= (str.len s1281) 1)) - :args (s1281 r11282 r21283) - :conclusion (= (str.in_re s1281 (re.++ r11282 r21283 re.allchar)) (str.in_re "" ($singleton_elim (re.++ r11282 r21283)))) -) -(declare-rule str-in-re-req-unfold ((s1284 String) (r11285 RegLan) (r21286 RegLan) (r31287 RegLan :list)) - :premises ((= (str.in_re s1284 ($singleton_elim (re.++ r21286 r31287))) false)) - :args (s1284 r11285 r21286 r31287) - :conclusion (= (str.in_re s1284 (re.++ (re.* r11285) r21286 r31287)) (str.in_re s1284 (re.++ r11285 (re.* r11285) r21286 r31287))) -) -(declare-rule str-in-re-req-unfold-rev ((s1288 String) (r11289 RegLan) (r21290 RegLan :list) (r31291 RegLan)) - :premises ((= (str.in_re s1288 ($singleton_elim (re.++ r11289 r21290))) false)) - :args (s1288 r11289 r21290 r31291) - :conclusion (= (str.in_re s1288 (re.++ r11289 r21290 (re.* r31291))) (str.in_re s1288 (re.++ r11289 r21290 (re.* r31291) r31291))) -) -(declare-rule str-in-re-skip-unfold ((s1292 String) (r11293 RegLan) (r21294 RegLan) (r31295 RegLan :list)) - :premises ((= (str.in_re s1292 (re.++ r11293 (re.* r11293) r21294 r31295)) false)) - :args (s1292 r11293 r21294 r31295) - :conclusion (= (str.in_re s1292 (re.++ (re.* r11293) r21294 r31295)) (str.in_re s1292 ($singleton_elim (re.++ r21294 r31295)))) -) -(declare-rule str-in-re-skip-unfold-rev ((s1296 String) (r11297 RegLan) (r21298 RegLan :list) (r31299 RegLan)) - :premises ((= (str.in_re s1296 (re.++ r11297 r21298 (re.* r31299) r31299)) false)) - :args (s1296 r11297 r21298 r31299) - :conclusion (= (str.in_re s1296 (re.++ r11297 r21298 (re.* r31299))) (str.in_re s1296 ($singleton_elim (re.++ r11297 r21298)))) -) -(declare-rule str-in-re-test-unfold ((s1300 String) (r11301 RegLan) (r21302 RegLan) (r31303 RegLan :list)) - :premises ((= (str.in_re s1300 ($singleton_elim (re.++ r21302 r31303))) false) (= (str.in_re s1300 (re.++ r11301 (re.* r11301) r21302 r31303)) false)) - :args (s1300 r11301 r21302 r31303) - :conclusion (= (str.in_re s1300 (re.++ (re.* r11301) r21302 r31303)) false) -) -(declare-rule str-in-re-test-unfold-rev ((s1304 String) (r11305 RegLan) (r21306 RegLan :list) (r31307 RegLan)) - :premises ((= (str.in_re s1304 ($singleton_elim (re.++ r11305 r21306))) false) (= (str.in_re s1304 (re.++ r11305 r21306 (re.* r31307) r31307)) false)) - :args (s1304 r11305 r21306 r31307) - :conclusion (= (str.in_re s1304 (re.++ r11305 r21306 (re.* r31307))) false) -) -(declare-rule eq-refl ((@T0 Type) (t1329 @T0)) - :args (t1329) - :conclusion (= (= t1329 t1329) true) -) -(declare-rule eq-symm ((@T0 Type) (@T1 Type) (t1330 @T0) (s1331 @T1)) - :args (t1330 s1331) - :conclusion (= (= t1330 s1331) (= s1331 t1330)) -) -(declare-rule distinct-binary-elim ((@T0 Type) (@T1 Type) (t1332 @T0) (s1333 @T1)) - :args (t1332 s1333) - :conclusion (= (distinct t1332 s1333) (not (= t1332 s1333))) -) -(declare-rule uf-bv2nat-geq-elim ((@n0 Int) (x1334 (BitVec @n0)) (n1335 Int)) - :args (x1334 n1335) - :conclusion (= (>= (bv2nat x1334) n1335) (eo::define ((_let_1 (@bvsize x1334))) (ite (>= n1335 _let_1) false (ite (< n1335 0) true (bvuge x1334 (int2bv _let_1 n1335)))))) +(declare-rule re-opt-elim ((x1 RegLan)) + :args (x1) + :conclusion (= (re.opt x1) (re.union (str.to_re "") x1)) +) +(declare-rule re-diff-elim ((x1 RegLan) (y1 RegLan)) + :args (x1 y1) + :conclusion (= (re.diff x1 y1) (re.inter x1 (re.comp y1))) +) +(declare-rule re-concat-emp ((xs1 RegLan :list) (ys1 RegLan :list)) + :args (xs1 ys1) + :conclusion (= ($singleton_elim (re.++ xs1 (str.to_re "") ys1)) ($singleton_elim (re.++ xs1 ys1))) +) +(declare-rule re-concat-none ((xs1 RegLan :list) (ys1 RegLan :list)) + :args (xs1 ys1) + :conclusion (= ($singleton_elim (re.++ xs1 re.none ys1)) re.none) +) +(declare-rule re-concat-flatten ((xs1 RegLan :list) (s1 RegLan) (ys1 RegLan :list) (zs1 RegLan :list)) + :args (xs1 s1 ys1 zs1) + :conclusion (= ($singleton_elim (re.++ xs1 ($singleton_elim (re.++ s1 ys1)) zs1)) ($singleton_elim (re.++ xs1 s1 ys1 zs1))) +) +(declare-rule re-concat-star-swap ((xs1 RegLan :list) (r1 RegLan) (ys1 RegLan :list)) + :args (xs1 r1 ys1) + :conclusion (= (re.++ xs1 (re.* r1) r1 ys1) (re.++ xs1 r1 (re.* r1) ys1)) +) +(declare-rule re-concat-merge ((xs1 RegLan :list) (s1 String) (t1 String) (ys1 RegLan :list)) + :args (xs1 s1 t1 ys1) + :conclusion (= (re.++ xs1 (str.to_re s1) (str.to_re t1) ys1) ($singleton_elim (re.++ xs1 (str.to_re (str.++ s1 t1)) ys1))) +) +(declare-rule re-union-all ((xs1 RegLan :list) (ys1 RegLan :list)) + :args (xs1 ys1) + :conclusion (= ($singleton_elim (re.union xs1 (re.* re.allchar) ys1)) (re.* re.allchar)) +) +(declare-rule re-union-none ((xs1 RegLan :list) (ys1 RegLan :list)) + :args (xs1 ys1) + :conclusion (= ($singleton_elim (re.union xs1 re.none ys1)) ($singleton_elim (re.union xs1 ys1))) +) +(declare-rule re-union-flatten ((xs1 RegLan :list) (b1 RegLan) (ys1 RegLan :list) (zs1 RegLan :list)) + :args (xs1 b1 ys1 zs1) + :conclusion (= ($singleton_elim (re.union xs1 ($singleton_elim (re.union b1 ys1)) zs1)) ($singleton_elim (re.union xs1 b1 ys1 zs1))) +) +(declare-rule re-union-dup ((xs1 RegLan :list) (b1 RegLan) (ys1 RegLan :list) (zs1 RegLan :list)) + :args (xs1 b1 ys1 zs1) + :conclusion (= (re.union xs1 b1 ys1 b1 zs1) ($singleton_elim (re.union xs1 b1 ys1 zs1))) +) +(declare-rule re-inter-all ((xs1 RegLan :list) (ys1 RegLan :list)) + :args (xs1 ys1) + :conclusion (= ($singleton_elim (re.inter xs1 (re.* re.allchar) ys1)) ($singleton_elim (re.inter xs1 ys1))) +) +(declare-rule re-inter-none ((xs1 RegLan :list) (ys1 RegLan :list)) + :args (xs1 ys1) + :conclusion (= ($singleton_elim (re.inter xs1 re.none ys1)) re.none) +) +(declare-rule re-inter-flatten ((xs1 RegLan :list) (b1 RegLan) (ys1 RegLan :list) (zs1 RegLan :list)) + :args (xs1 b1 ys1 zs1) + :conclusion (= ($singleton_elim (re.inter xs1 ($singleton_elim (re.inter b1 ys1)) zs1)) ($singleton_elim (re.inter xs1 b1 ys1 zs1))) +) +(declare-rule re-inter-dup ((xs1 RegLan :list) (b1 RegLan) (ys1 RegLan :list) (zs1 RegLan :list)) + :args (xs1 b1 ys1 zs1) + :conclusion (= (re.inter xs1 b1 ys1 b1 zs1) ($singleton_elim (re.inter xs1 b1 ys1 zs1))) +) +(declare-rule re-loop-neg ((n1 Int) (m1 Int) (r1 RegLan)) + :premises ((= (> n1 m1) true)) + :args (n1 m1 r1) + :conclusion (= (re.loop n1 m1 r1) re.none) +) +(declare-rule re-inter-cstring ((xs1 RegLan :list) (ys1 RegLan :list) (s1 String)) + :premises ((= (str.in_re s1 ($singleton_elim (re.inter xs1 ys1))) true)) + :args (xs1 ys1 s1) + :conclusion (= ($singleton_elim (re.inter xs1 (str.to_re s1) ys1)) (str.to_re s1)) +) +(declare-rule re-inter-cstring-neg ((xs1 RegLan :list) (ys1 RegLan :list) (s1 String)) + :premises ((= (str.in_re s1 ($singleton_elim (re.inter xs1 ys1))) false)) + :args (xs1 ys1 s1) + :conclusion (= ($singleton_elim (re.inter xs1 (str.to_re s1) ys1)) re.none) +) +(declare-rule str-substr-len-include ((@T0 Type) (@T1 Type) (s1 (Seq @T0)) (s2 (Seq @T1) :list) (n1 Int)) + :premises ((= n1 (seq.len s1))) + :args (s1 s2 n1) + :conclusion (= (seq.extract ($singleton_elim (seq.++ s1 s2)) 0 n1) s1) +) +(declare-rule str-substr-len-include-pre ((@T0 Type) (@T1 Type) (@T2 Type) (s1 (Seq @T0)) (s2 (Seq @T1)) (s3 (Seq @T2) :list) (n1 Int)) + :premises ((= (>= n1 (seq.len s1)) true)) + :args (s1 s2 s3 n1) + :conclusion (= (seq.extract (seq.++ s1 s2 s3) 0 n1) (seq.++ s1 (seq.extract ($singleton_elim (seq.++ s2 s3)) 0 (- n1 (seq.len s1))))) +) +(declare-rule str-substr-len-skip ((@T0 Type) (@T1 Type) (@T2 Type) (s1 (Seq @T0)) (s2 (Seq @T1)) (s3 (Seq @T2) :list) (n1 Int) (m1 Int)) + :premises ((= (>= n1 (seq.len s1)) true)) + :args (s1 s2 s3 n1 m1) + :conclusion (= (seq.extract (seq.++ s1 s2 s3) n1 m1) (seq.extract ($singleton_elim (seq.++ s2 s3)) (- n1 (seq.len s1)) m1)) +) +(declare-rule seq-rev-concat ((@T0 Type) (@T1 Type) (@T2 Type) (x1 (Seq @T0)) (y1 (Seq @T1) :list) (z1 (Seq @T2))) + :args (x1 y1 z1) + :conclusion (= (seq.rev (seq.++ x1 y1 z1)) (seq.++ (seq.rev z1) (seq.rev ($singleton_elim (seq.++ x1 y1))))) +) +(declare-rule seq-len-unit ((@T0 Type) (x1 @T0)) + :args (x1) + :conclusion (= (seq.len (seq.unit x1)) 1) +) +(declare-rule seq-nth-unit ((@T0 Type) (x1 @T0)) + :args (x1) + :conclusion (= (seq.nth (seq.unit x1) 0) x1) +) +(declare-rule seq-rev-unit ((@T0 Type) (x1 @T0)) + :args (x1) + :conclusion (= (seq.rev (seq.unit x1)) (seq.unit x1)) +) +(declare-rule re-in-empty ((t1 String)) + :args (t1) + :conclusion (= (str.in_re t1 re.none) false) +) +(declare-rule re-in-sigma ((t1 String)) + :args (t1) + :conclusion (= (str.in_re t1 re.allchar) (= (str.len t1) 1)) +) +(declare-rule re-in-sigma-star ((t1 String)) + :args (t1) + :conclusion (= (str.in_re t1 (re.* re.allchar)) true) +) +(declare-rule re-in-cstring ((t1 String) (s1 String)) + :args (t1 s1) + :conclusion (= (str.in_re t1 (str.to_re s1)) (= t1 s1)) +) +(declare-rule re-in-comp ((t1 String) (r1 RegLan)) + :args (t1 r1) + :conclusion (= (str.in_re t1 (re.comp r1)) (not (str.in_re t1 r1))) +) +(declare-rule str-in-re-union-elim ((s1 String) (r1 RegLan) (r2 RegLan) (rs1 RegLan :list)) + :args (s1 r1 r2 rs1) + :conclusion (= (str.in_re s1 (re.union r1 r2 rs1)) (or (str.in_re s1 r1) (str.in_re s1 ($singleton_elim (re.union r2 rs1))))) +) +(declare-rule str-in-re-inter-elim ((s1 String) (r1 RegLan) (r2 RegLan) (rs1 RegLan :list)) + :args (s1 r1 r2 rs1) + :conclusion (= (str.in_re s1 (re.inter r1 r2 rs1)) (and (str.in_re s1 r1) (str.in_re s1 ($singleton_elim (re.inter r2 rs1))))) +) +(declare-rule str-in-re-range-elim ((s1 String) (c1 String) (c2 String)) + :premises ((= (str.len c1) 1) (= (str.len c2) 1)) + :args (s1 c1 c2) + :conclusion (= (str.in_re s1 (re.range c1 c2)) (eo::define ((_let_1 (str.to_code s1))) (and (<= (str.to_code c1) _let_1) (<= _let_1 (str.to_code c2))))) +) +(declare-rule str-in-re-contains ((t1 String) (s1 String)) + :args (t1 s1) + :conclusion (= (eo::define ((_let_1 (re.* re.allchar))) (str.in_re t1 (re.++ _let_1 (str.to_re s1) _let_1))) (str.contains t1 s1)) +) +(declare-rule str-in-re-strip-prefix ((s1 String) (s2 String) (s3 String :list) (sr1 String) (sr2 String :list) (r1 RegLan :list)) + :args (s1 s2 s3 sr1 sr2 r1) + :conclusion (= (str.in_re (str.++ s1 s2 s3) ($singleton_elim (re.++ (str.to_re (str.++ s1 sr1 sr2)) r1))) (str.in_re ($singleton_elim (str.++ s2 s3)) ($singleton_elim (re.++ (str.to_re ($singleton_elim (str.++ sr1 sr2))) r1)))) +) +(declare-rule str-in-re-strip-prefix-neg ((s1 String) (t1 String) (s2 String) (s3 String :list) (sr1 String) (sr2 String :list) (r1 RegLan :list)) + :premises ((= (str.len s1) (str.len t1)) (= (= s1 t1) false)) + :args (s1 t1 s2 s3 sr1 sr2 r1) + :conclusion (= (str.in_re (str.++ s1 s2 s3) ($singleton_elim (re.++ (str.to_re (str.++ t1 sr1 sr2)) r1))) false) +) +(declare-rule str-in-re-strip-prefix-sr-single ((s1 String) (s2 String) (s3 String :list) (r1 RegLan) (r2 RegLan :list)) + :args (s1 s2 s3 r1 r2) + :conclusion (= (str.in_re (str.++ s1 s2 s3) (re.++ (str.to_re s1) r1 r2)) (str.in_re ($singleton_elim (str.++ s2 s3)) ($singleton_elim (re.++ r1 r2)))) +) +(declare-rule str-in-re-strip-prefix-sr-single-neg ((s1 String) (t1 String) (s2 String) (s3 String :list) (r1 RegLan) (r2 RegLan :list)) + :premises ((= (str.len s1) (str.len t1)) (= (= s1 t1) false)) + :args (s1 t1 s2 s3 r1 r2) + :conclusion (= (str.in_re (str.++ s1 s2 s3) (re.++ (str.to_re t1) r1 r2)) false) +) +(declare-rule str-in-re-strip-prefix-srs-single ((s1 String) (r1 RegLan) (r2 RegLan :list)) + :args (s1 r1 r2) + :conclusion (= (str.in_re s1 (re.++ (str.to_re s1) r1 r2)) (str.in_re "" ($singleton_elim (re.++ r1 r2)))) +) +(declare-rule str-in-re-strip-prefix-srs-single-neg ((s1 String) (t1 String) (r1 RegLan) (r2 RegLan :list)) + :premises ((= (str.len s1) (str.len t1)) (= (= s1 t1) false)) + :args (s1 t1 r1 r2) + :conclusion (= (str.in_re s1 (re.++ (str.to_re t1) r1 r2)) false) +) +(declare-rule str-in-re-strip-prefix-s-single ((s1 String) (sr1 String) (sr2 String :list) (r1 RegLan :list)) + :args (s1 sr1 sr2 r1) + :conclusion (= (str.in_re s1 ($singleton_elim (re.++ (str.to_re (str.++ s1 sr1 sr2)) r1))) (str.in_re "" ($singleton_elim (re.++ (str.to_re ($singleton_elim (str.++ sr1 sr2))) r1)))) +) +(declare-rule str-in-re-strip-prefix-s-single-neg ((s1 String) (t1 String) (sr1 String) (sr2 String :list) (r1 RegLan :list)) + :premises ((= (str.len s1) (str.len t1)) (= (= s1 t1) false)) + :args (s1 t1 sr1 sr2 r1) + :conclusion (= (str.in_re s1 ($singleton_elim (re.++ (str.to_re (str.++ t1 sr1 sr2)) r1))) false) +) +(declare-rule str-in-re-strip-prefix-base ((s1 String) (s2 String) (s3 String :list) (sr1 String) (sr2 String :list)) + :args (s1 s2 s3 sr1 sr2) + :conclusion (= (str.in_re (str.++ s1 s2 s3) (str.to_re (str.++ s1 sr1 sr2))) (str.in_re ($singleton_elim (str.++ s2 s3)) (str.to_re ($singleton_elim (str.++ sr1 sr2))))) +) +(declare-rule str-in-re-strip-prefix-base-neg ((s1 String) (t1 String) (s2 String) (s3 String :list) (sr1 String) (sr2 String :list)) + :premises ((= (str.len s1) (str.len t1)) (= (= s1 t1) false)) + :args (s1 t1 s2 s3 sr1 sr2) + :conclusion (= (str.in_re (str.++ s1 s2 s3) (str.to_re (str.++ t1 sr1 sr2))) false) +) +(declare-rule str-in-re-strip-prefix-base-s-single ((s1 String) (sr1 String) (sr2 String :list)) + :args (s1 sr1 sr2) + :conclusion (= (str.in_re s1 (str.to_re (str.++ s1 sr1 sr2))) (str.in_re "" (str.to_re ($singleton_elim (str.++ sr1 sr2))))) +) +(declare-rule str-in-re-strip-prefix-base-s-single-neg ((s1 String) (t1 String) (sr1 String) (sr2 String :list)) + :premises ((= (str.len s1) (str.len t1)) (= (= s1 t1) false)) + :args (s1 t1 sr1 sr2) + :conclusion (= (str.in_re s1 (str.to_re (str.++ t1 sr1 sr2))) false) +) +(declare-rule str-in-re-strip-char ((s1 String) (s2 String) (s3 String :list) (r1 RegLan) (r2 RegLan :list)) + :premises ((= (str.len s1) 1)) + :args (s1 s2 s3 r1 r2) + :conclusion (= (str.in_re (str.++ s1 s2 s3) (re.++ re.allchar r1 r2)) (str.in_re ($singleton_elim (str.++ s2 s3)) ($singleton_elim (re.++ r1 r2)))) +) +(declare-rule str-in-re-strip-char-s-single ((s1 String) (r1 RegLan) (r2 RegLan :list)) + :premises ((= (str.len s1) 1)) + :args (s1 r1 r2) + :conclusion (= (str.in_re s1 (re.++ re.allchar r1 r2)) (str.in_re "" ($singleton_elim (re.++ r1 r2)))) +) +(declare-rule str-in-re-strip-prefix-rev ((s1 String) (s2 String) (s3 String :list) (sr1 String) (sr2 String :list) (r1 RegLan :list)) + :args (s1 s2 s3 sr1 sr2 r1) + :conclusion (= (str.in_re (str.++ s2 s3 s1) ($singleton_elim (re.++ r1 (str.to_re (str.++ sr1 sr2 s1))))) (str.in_re ($singleton_elim (str.++ s2 s3)) ($singleton_elim (re.++ r1 (str.to_re ($singleton_elim (str.++ sr1 sr2))))))) +) +(declare-rule str-in-re-strip-prefix-neg-rev ((s1 String) (t1 String) (s2 String) (s3 String :list) (sr1 String) (sr2 String :list) (r1 RegLan :list)) + :premises ((= (str.len s1) (str.len t1)) (= (= s1 t1) false)) + :args (s1 t1 s2 s3 sr1 sr2 r1) + :conclusion (= (str.in_re (str.++ s2 s3 s1) ($singleton_elim (re.++ r1 (str.to_re (str.++ sr1 sr2 t1))))) false) +) +(declare-rule str-in-re-strip-prefix-sr-single-rev ((s1 String) (s2 String) (s3 String :list) (r1 RegLan) (r2 RegLan :list)) + :args (s1 s2 s3 r1 r2) + :conclusion (= (str.in_re (str.++ s2 s3 s1) (re.++ r1 r2 (str.to_re s1))) (str.in_re ($singleton_elim (str.++ s2 s3)) ($singleton_elim (re.++ r1 r2)))) +) +(declare-rule str-in-re-strip-prefix-sr-single-neg-rev ((s1 String) (t1 String) (s2 String) (s3 String :list) (r1 RegLan) (r2 RegLan :list)) + :premises ((= (str.len s1) (str.len t1)) (= (= s1 t1) false)) + :args (s1 t1 s2 s3 r1 r2) + :conclusion (= (str.in_re (str.++ s2 s3 s1) (re.++ r1 r2 (str.to_re t1))) false) +) +(declare-rule str-in-re-strip-prefix-srs-single-rev ((s1 String) (r1 RegLan) (r2 RegLan :list)) + :args (s1 r1 r2) + :conclusion (= (str.in_re s1 (re.++ r1 r2 (str.to_re s1))) (str.in_re "" ($singleton_elim (re.++ r1 r2)))) +) +(declare-rule str-in-re-strip-prefix-srs-single-neg-rev ((s1 String) (t1 String) (r1 RegLan) (r2 RegLan :list)) + :premises ((= (str.len s1) (str.len t1)) (= (= s1 t1) false)) + :args (s1 t1 r1 r2) + :conclusion (= (str.in_re s1 (re.++ r1 r2 (str.to_re t1))) false) +) +(declare-rule str-in-re-strip-prefix-s-single-rev ((s1 String) (sr1 String) (sr2 String :list) (r1 RegLan :list)) + :args (s1 sr1 sr2 r1) + :conclusion (= (str.in_re s1 ($singleton_elim (re.++ r1 (str.to_re (str.++ sr1 sr2 s1))))) (str.in_re "" ($singleton_elim (re.++ r1 (str.to_re ($singleton_elim (str.++ sr1 sr2))))))) +) +(declare-rule str-in-re-strip-prefix-s-single-neg-rev ((s1 String) (t1 String) (sr1 String) (sr2 String :list) (r1 RegLan :list)) + :premises ((= (str.len s1) (str.len t1)) (= (= s1 t1) false)) + :args (s1 t1 sr1 sr2 r1) + :conclusion (= (str.in_re s1 ($singleton_elim (re.++ r1 (str.to_re (str.++ sr1 sr2 t1))))) false) +) +(declare-rule str-in-re-strip-prefix-base-rev ((s1 String) (s2 String) (s3 String :list) (sr1 String) (sr2 String :list)) + :args (s1 s2 s3 sr1 sr2) + :conclusion (= (str.in_re (str.++ s2 s3 s1) (str.to_re (str.++ sr1 sr2 s1))) (str.in_re ($singleton_elim (str.++ s2 s3)) (str.to_re ($singleton_elim (str.++ sr1 sr2))))) +) +(declare-rule str-in-re-strip-prefix-base-neg-rev ((s1 String) (t1 String) (s2 String) (s3 String :list) (sr1 String) (sr2 String :list)) + :premises ((= (str.len s1) (str.len t1)) (= (= s1 t1) false)) + :args (s1 t1 s2 s3 sr1 sr2) + :conclusion (= (str.in_re (str.++ s2 s3 s1) (str.to_re (str.++ sr1 sr2 t1))) false) +) +(declare-rule str-in-re-strip-prefix-base-s-single-rev ((s1 String) (sr1 String) (sr2 String :list)) + :args (s1 sr1 sr2) + :conclusion (= (str.in_re s1 (str.to_re (str.++ sr1 sr2 s1))) (str.in_re "" (str.to_re ($singleton_elim (str.++ sr1 sr2))))) +) +(declare-rule str-in-re-strip-prefix-base-s-single-neg-rev ((s1 String) (t1 String) (sr1 String) (sr2 String :list)) + :premises ((= (str.len s1) (str.len t1)) (= (= s1 t1) false)) + :args (s1 t1 sr1 sr2) + :conclusion (= (str.in_re s1 (str.to_re (str.++ sr1 sr2 t1))) false) +) +(declare-rule str-in-re-strip-char-rev ((s1 String) (s2 String) (s3 String :list) (r1 RegLan) (r2 RegLan :list)) + :premises ((= (str.len s1) 1)) + :args (s1 s2 s3 r1 r2) + :conclusion (= (str.in_re (str.++ s2 s3 s1) (re.++ r1 r2 re.allchar)) (str.in_re ($singleton_elim (str.++ s2 s3)) ($singleton_elim (re.++ r1 r2)))) +) +(declare-rule str-in-re-strip-char-s-single-rev ((s1 String) (r1 RegLan) (r2 RegLan :list)) + :premises ((= (str.len s1) 1)) + :args (s1 r1 r2) + :conclusion (= (str.in_re s1 (re.++ r1 r2 re.allchar)) (str.in_re "" ($singleton_elim (re.++ r1 r2)))) +) +(declare-rule str-in-re-req-unfold ((s1 String) (r1 RegLan) (r2 RegLan) (r3 RegLan :list)) + :premises ((= (str.in_re s1 ($singleton_elim (re.++ r2 r3))) false)) + :args (s1 r1 r2 r3) + :conclusion (= (str.in_re s1 (re.++ (re.* r1) r2 r3)) (str.in_re s1 (re.++ r1 (re.* r1) r2 r3))) +) +(declare-rule str-in-re-req-unfold-rev ((s1 String) (r1 RegLan) (r2 RegLan :list) (r3 RegLan)) + :premises ((= (str.in_re s1 ($singleton_elim (re.++ r1 r2))) false)) + :args (s1 r1 r2 r3) + :conclusion (= (str.in_re s1 (re.++ r1 r2 (re.* r3))) (str.in_re s1 (re.++ r1 r2 (re.* r3) r3))) +) +(declare-rule str-in-re-skip-unfold ((s1 String) (r1 RegLan) (r2 RegLan) (r3 RegLan :list)) + :premises ((= (str.in_re s1 (re.++ r1 (re.* r1) r2 r3)) false)) + :args (s1 r1 r2 r3) + :conclusion (= (str.in_re s1 (re.++ (re.* r1) r2 r3)) (str.in_re s1 ($singleton_elim (re.++ r2 r3)))) +) +(declare-rule str-in-re-skip-unfold-rev ((s1 String) (r1 RegLan) (r2 RegLan :list) (r3 RegLan)) + :premises ((= (str.in_re s1 (re.++ r1 r2 (re.* r3) r3)) false)) + :args (s1 r1 r2 r3) + :conclusion (= (str.in_re s1 (re.++ r1 r2 (re.* r3))) (str.in_re s1 ($singleton_elim (re.++ r1 r2)))) +) +(declare-rule str-in-re-test-unfold ((s1 String) (r1 RegLan) (r2 RegLan) (r3 RegLan :list)) + :premises ((= (str.in_re s1 ($singleton_elim (re.++ r2 r3))) false) (= (str.in_re s1 (re.++ r1 (re.* r1) r2 r3)) false)) + :args (s1 r1 r2 r3) + :conclusion (= (str.in_re s1 (re.++ (re.* r1) r2 r3)) false) +) +(declare-rule str-in-re-test-unfold-rev ((s1 String) (r1 RegLan) (r2 RegLan :list) (r3 RegLan)) + :premises ((= (str.in_re s1 ($singleton_elim (re.++ r1 r2))) false) (= (str.in_re s1 (re.++ r1 r2 (re.* r3) r3)) false)) + :args (s1 r1 r2 r3) + :conclusion (= (str.in_re s1 (re.++ r1 r2 (re.* r3))) false) +) +(declare-rule eq-refl ((@T0 Type) (t1 @T0)) + :args (t1) + :conclusion (= (= t1 t1) true) +) +(declare-rule eq-symm ((@T0 Type) (@T1 Type) (t1 @T0) (s1 @T1)) + :args (t1 s1) + :conclusion (= (= t1 s1) (= s1 t1)) +) +(declare-rule distinct-binary-elim ((@T0 Type) (@T1 Type) (t1 @T0) (s1 @T1)) + :args (t1 s1) + :conclusion (= (distinct t1 s1) (not (= t1 s1))) +) +(declare-rule uf-bv2nat-geq-elim ((@n0 Int) (x1 (BitVec @n0)) (n1 Int)) + :args (x1 n1) + :conclusion (= (>= (bv2nat x1) n1) (eo::define ((_let_1 (@bvsize x1))) (ite (>= n1 _let_1) false (ite (< n1 0) true (bvuge x1 (int2bv _let_1 n1)))))) ) diff --git a/src/api/cpp/cvc5.cpp b/src/api/cpp/cvc5.cpp index 4d2c01c9157..c4cbcbe02e7 100644 --- a/src/api/cpp/cvc5.cpp +++ b/src/api/cpp/cvc5.cpp @@ -6873,21 +6873,14 @@ void Solver::ensureWellFormedTerm(const Term& t) const // only check if option is set if (d_slv->getOptions().expr.wellFormedChecking) { - bool wasShadow = false; - if (internal::expr::hasFreeOrShadowedVar(*t.d_node, wasShadow)) + // Call isWellFormedTerm of the underlying solver, which checks if the + // given node has free variables. We do not check for variable shadowing, + // since this can be handled by our rewriter. + if (!d_slv->isWellFormedTerm(*t.d_node)) { std::stringstream se; - se << "cannot process term " << *t.d_node << " with "; - if (wasShadow) - { - se << "shadowed variables " << std::endl; - } - else - { - std::unordered_set fvs; - internal::expr::getFreeVariables(*t.d_node, fvs); - se << "free variables: " << fvs << std::endl; - } + se << "cannot process term " << *t.d_node << " with free variables" + << std::endl; throw CVC5ApiException(se.str().c_str()); } } diff --git a/src/expr/node_algorithm.cpp b/src/expr/node_algorithm.cpp index c087f6e4831..e97d038260a 100644 --- a/src/expr/node_algorithm.cpp +++ b/src/expr/node_algorithm.cpp @@ -348,11 +348,12 @@ bool checkVariablesInternal(TNode n, else if (cur.isClosure()) { // add to scope + std::vector boundvars; for (const TNode& cn : cur[0]) { - if (checkShadow) + if (scope.find(cn) != scope.end()) { - if (scope.find(cn) != scope.end()) + if (checkShadow) { wasShadow = true; return true; @@ -360,11 +361,10 @@ bool checkVariablesInternal(TNode n, } else { - // should not shadow - Assert(scope.find(cn) == scope.end()) - << "Shadowed variable " << cn << " in " << cur << "\n"; + // add to scope if it is not shadowing + boundvars.push_back(cn); + scope.insert(cn); } - scope.insert(cn); } // must make recursive call to use separate cache if (checkVariablesInternal( @@ -374,7 +374,7 @@ bool checkVariablesInternal(TNode n, return true; } // cleanup - for (const TNode& cn : cur[0]) + for (const TNode& cn : boundvars) { scope.erase(cn); } diff --git a/src/options/options_handler.cpp b/src/options/options_handler.cpp index e22fb78a911..d53f4ffad28 100644 --- a/src/options/options_handler.cpp +++ b/src/options/options_handler.cpp @@ -36,6 +36,7 @@ #include "options/language.h" #include "options/main_options.h" #include "options/option_exception.h" +#include "options/parser_options.h" #include "options/smt_options.h" #include "options/theory_options.h" #include "util/didyoumean.h" @@ -400,5 +401,17 @@ void OptionsHandler::showTraceTags(const std::string& flag, bool value) printTags(Configuration::getTraceTags()); } +void OptionsHandler::strictParsing(const std::string& flag, bool value) +{ + if (value) + { + d_options->write_parser().parsingMode = options::ParsingMode::STRICT; + } + else if (d_options->parser.parsingMode == options::ParsingMode::STRICT) + { + d_options->write_parser().parsingMode = options::ParsingMode::DEFAULT; + } +} + } // namespace options } // namespace cvc5::internal diff --git a/src/options/options_handler.h b/src/options/options_handler.h index a182b8bd067..e0ffad1bf13 100644 --- a/src/options/options_handler.h +++ b/src/options/options_handler.h @@ -111,6 +111,9 @@ class OptionsHandler /** Show all trace tags and exit */ void showTraceTags(const std::string& flag, bool value); + /***************************** parser options *******************************/ + void strictParsing(const std::string& flag, bool value); + private: /** Pointer to the containing Options object.*/ Options* d_options; diff --git a/src/options/parser_options.toml b/src/options/parser_options.toml index 6d702042623..efba5d29db8 100644 --- a/src/options/parser_options.toml +++ b/src/options/parser_options.toml @@ -7,7 +7,26 @@ name = "Parser" long = "strict-parsing" type = "bool" default = "false" - help = "be less tolerant of non-conforming inputs" + predicates = ["strictParsing"] + help = "be less tolerant of non-conforming inputs, this is an alias for --parsing-mode=strict" + +[[option]] + name = "parsingMode" + category = "expert" + long = "parsing-mode=MODE" + type = "ParsingMode" + default = "DEFAULT" + help = "choose parsing mode, see --parsing-mode=help" + help_mode = "Parsing modes." +[[option.mode.DEFAULT]] + name = "default" + help = "Be reasonably tolerant of non-conforming inputs." +[[option.mode.STRICT]] + name = "strict" + help = "Be less tolerant of non-conforming inputs." +[[option.mode.LENIENT]] + name = "lenient" + help = "Be more tolerant of non-conforming inputs." [[option]] name = "semanticChecks" diff --git a/src/parser/parser.cpp b/src/parser/parser.cpp index 04f75f4308c..ada5d419afd 100644 --- a/src/parser/parser.cpp +++ b/src/parser/parser.cpp @@ -126,8 +126,17 @@ std::unique_ptr Parser::mkParser(modes::InputLanguage lang, || lang == modes::InputLanguage::SYGUS_2_1) { bool isSygus = (lang == modes::InputLanguage::SYGUS_2_1); - bool strictMode = solver->getOptionInfo("strict-parsing").boolValue(); - parser.reset(new Smt2Parser(solver, sm, strictMode, isSygus)); + ParsingMode parsingMode = ParsingMode::DEFAULT; + std::string mode = solver->getOption("parsing-mode"); + if (mode == "strict") + { + parsingMode = ParsingMode::STRICT; + } + else if (mode == "lenient") + { + parsingMode = ParsingMode::LENIENT; + } + parser.reset(new Smt2Parser(solver, sm, parsingMode, isSygus)); } else { diff --git a/src/parser/parser_state.cpp b/src/parser/parser_state.cpp index 02cb0520cb1..c20c1aa5938 100644 --- a/src/parser/parser_state.cpp +++ b/src/parser/parser_state.cpp @@ -37,14 +37,14 @@ namespace parser { ParserState::ParserState(ParserStateCallback* psc, Solver* solver, SymManager* sm, - bool strictMode) + ParsingMode parsingMode) : d_solver(solver), d_tm(d_solver->getTermManager()), d_psc(psc), d_symman(sm), d_symtab(sm->getSymbolTable()), d_checksEnabled(true), - d_strictMode(strictMode), + d_parsingMode(parsingMode), d_parseOnly(d_solver->getOptionInfo("parse-only").boolValue()) { } diff --git a/src/parser/parser_state.h b/src/parser/parser_state.h index 2686b26b871..008824f5f02 100644 --- a/src/parser/parser_state.h +++ b/src/parser/parser_state.h @@ -36,6 +36,17 @@ namespace parser { class Command; +/** + * The parsing mode, defines how strict we are on accepting non-conforming + * inputs. + */ +enum class ParsingMode +{ + DEFAULT, // reasonably strict + STRICT, // more strict + LENIENT, // less strict +}; + /** * Callback from the parser state to the parser, for command preemption * and error handling. @@ -67,16 +78,16 @@ class CVC5_EXPORT ParserState * @attention The parser takes "ownership" of the given * input and will delete it on destruction. * - * @param psc The callback for implementing parser-specific methods - * @param solver solver API object - * @param symm reference to the symbol manager - * @param input the parser input - * @param strictMode whether to incorporate strict(er) compliance checks + * @param psc The callback for implementing parser-specific methods. + * @param solver The solver API object. + * @param symm The symbol manager. + * @param input The parser input. + * @param parsingMode The parsing mode. */ ParserState(ParserStateCallback* psc, Solver* solver, SymManager* sm, - bool strictMode = false); + ParsingMode parsingMode = ParsingMode::DEFAULT); virtual ~ParserState(); @@ -91,13 +102,15 @@ class CVC5_EXPORT ParserState void disableChecks() { d_checksEnabled = false; } /** Enable strict parsing, according to the language standards. */ - void enableStrictMode() { d_strictMode = true; } + void enableStrictMode() { d_parsingMode = ParsingMode::STRICT; } /** Disable strict parsing. Allows certain syntactic infelicities to pass without comment. */ - void disableStrictMode() { d_strictMode = false; } + void disableStrictMode() { d_parsingMode = ParsingMode::DEFAULT; } + + bool strictModeEnabled() { return d_parsingMode == ParsingMode::STRICT; } - bool strictModeEnabled() { return d_strictMode; } + bool lenientModeEnabled() { return d_parsingMode == ParsingMode::LENIENT; } const std::string& getForcedLogic() const; bool logicIsForced() const; @@ -577,7 +590,7 @@ class CVC5_EXPORT ParserState bool d_checksEnabled; /** Are we parsing in strict mode? */ - bool d_strictMode; + ParsingMode d_parsingMode; /** Are we in parse-only mode? */ bool d_parseOnly; diff --git a/src/parser/smt2/smt2_parser.cpp b/src/parser/smt2/smt2_parser.cpp index d574a1aaa0d..65525f94995 100644 --- a/src/parser/smt2/smt2_parser.cpp +++ b/src/parser/smt2/smt2_parser.cpp @@ -23,11 +23,11 @@ namespace parser { Smt2Parser::Smt2Parser(Solver* solver, SymManager* sm, - bool isStrict, + ParsingMode parsingMode, bool isSygus) : Parser(solver, sm), - d_slex(isStrict, isSygus), - d_state(this, solver, sm, isStrict, isSygus), + d_slex(parsingMode == ParsingMode::STRICT, isSygus), + d_state(this, solver, sm, parsingMode, isSygus), d_termParser(d_slex, d_state), d_cmdParser(d_slex, d_state, d_termParser) { diff --git a/src/parser/smt2/smt2_parser.h b/src/parser/smt2/smt2_parser.h index 7ca0b785e83..57a81b06a4a 100644 --- a/src/parser/smt2/smt2_parser.h +++ b/src/parser/smt2/smt2_parser.h @@ -39,7 +39,7 @@ class Smt2Parser : public Parser public: Smt2Parser(Solver* solver, SymManager* sm, - bool isStrict = false, + ParsingMode parsingMode = ParsingMode::DEFAULT, bool isSygus = false); virtual ~Smt2Parser() {} /** Set the logic */ diff --git a/src/parser/smt2/smt2_state.cpp b/src/parser/smt2/smt2_state.cpp index abf0f50636e..857f936ca9f 100644 --- a/src/parser/smt2/smt2_state.cpp +++ b/src/parser/smt2/smt2_state.cpp @@ -27,9 +27,9 @@ namespace parser { Smt2State::Smt2State(ParserStateCallback* psc, Solver* solver, SymManager* sm, - bool strictMode, + ParsingMode parsingMode, bool isSygus) - : ParserState(psc, solver, sm, strictMode), + : ParserState(psc, solver, sm, parsingMode), d_isSygus(isSygus), d_logicSet(false), d_seenSetLogic(false) diff --git a/src/parser/smt2/smt2_state.h b/src/parser/smt2/smt2_state.h index 44f1aece4cf..ccfc55459b4 100644 --- a/src/parser/smt2/smt2_state.h +++ b/src/parser/smt2/smt2_state.h @@ -43,7 +43,7 @@ class Smt2State : public ParserState Smt2State(ParserStateCallback* psc, Solver* solver, SymManager* sm, - bool strictMode = false, + ParsingMode parsingMode = ParsingMode::DEFAULT, bool isSygus = false); ~Smt2State(); @@ -280,7 +280,8 @@ class Smt2State : public ParserState void checkUserSymbol(const std::string& name) { - if (name.length() > 0 && (name[0] == '.' || name[0] == '@')) + if (!lenientModeEnabled() && name.length() > 0 + && (name[0] == '.' || name[0] == '@')) { std::stringstream ss; ss << "cannot declare or define symbol `" << name diff --git a/src/preprocessing/passes/ackermann.cpp b/src/preprocessing/passes/ackermann.cpp index df46d3ad5c6..7e6ac487466 100644 --- a/src/preprocessing/passes/ackermann.cpp +++ b/src/preprocessing/passes/ackermann.cpp @@ -145,13 +145,13 @@ void storeFunctionAndAddLemmas(TNode func, * storeFunctionAndAddLemmas will then add the constraint g(x)=g(y) -> * f(g(x))=f(g(y)). * Now that we see g(x) and g(y), we explicitly add them as well. */ -void collectFunctionsAndLemmas(FunctionToArgsMap& fun_to_args, +void collectFunctionsAndLemmas(NodeManager* nm, + FunctionToArgsMap& fun_to_args, SubstitutionMap& fun_to_skolem, std::vector* vec, AssertionPipeline* assertions) { TNodeSet seen; - NodeManager* nm = NodeManager::currentNM(); TNode term; while (!vec->empty()) { @@ -203,11 +203,11 @@ size_t getBVSkolemSize(size_t capacity) * a sufficient bit-vector size. * Populate usVarsToBVVars so that it maps variables with uninterpreted sort to * the fresh skolem BV variables. variables */ -void collectUSortsToBV(const std::unordered_set& vars, +void collectUSortsToBV(NodeManager* nm, + const std::unordered_set& vars, const USortToBVSizeMap& usortCardinality, SubstitutionMap& usVarsToBVVars) { - NodeManager* nm = NodeManager::currentNM(); SkolemManager* sm = nm->getSkolemManager(); for (TNode var : vars) @@ -253,7 +253,8 @@ std::unordered_set getVarsWithUSorts(AssertionPipeline* assertions) * size. The size is calculated to have enough capacity, that can accommodate * the variables occured in the original formula. At the end, all variables of * uninterpreted sorts will be converted into Skolem variables of BV */ -void usortsToBitVectors(const LogicInfo& d_logic, +void usortsToBitVectors(NodeManager* nm, + const LogicInfo& d_logic, AssertionPipeline* assertions, USortToBVSizeMap& usortCardinality, SubstitutionMap& usVarsToBVVars) @@ -277,7 +278,7 @@ void usortsToBitVectors(const LogicInfo& d_logic, usortCardinality[type] = usortCardinality[type] + 1; } - collectUSortsToBV(toProcess, usortCardinality, usVarsToBVVars); + collectUSortsToBV(nm, toProcess, usortCardinality, usVarsToBVVars); for (size_t i = 0, size = assertions->size(); i < size; ++i) { @@ -315,8 +316,11 @@ PreprocessingPassResult Ackermann::applyInternal( { to_process.push_back(a); } - collectFunctionsAndLemmas( - d_funcToArgs, d_funcToSkolem, &to_process, assertionsToPreprocess); + collectFunctionsAndLemmas(nodeManager(), + d_funcToArgs, + d_funcToSkolem, + &to_process, + assertionsToPreprocess); /* replace applications of UF by skolems */ // FIXME for model building, github issue #1901 @@ -327,8 +331,11 @@ PreprocessingPassResult Ackermann::applyInternal( } /* replace uninterpreted sorts with bit-vectors */ - usortsToBitVectors( - d_logic, assertionsToPreprocess, d_usortCardinality, d_usVarsToBVVars); + usortsToBitVectors(nodeManager(), + d_logic, + assertionsToPreprocess, + d_usortCardinality, + d_usVarsToBVVars); return PreprocessingPassResult::NO_CONFLICT; } diff --git a/src/preprocessing/passes/ff_bitsum.cpp b/src/preprocessing/passes/ff_bitsum.cpp index 60163f1f226..8ce746718fe 100644 --- a/src/preprocessing/passes/ff_bitsum.cpp +++ b/src/preprocessing/passes/ff_bitsum.cpp @@ -35,12 +35,11 @@ FfBitsum::FfBitsum(PreprocessingPassContext* preprocContext) { } -Node mkAdd(const std::vector& children) +Node mkAdd(NodeManager* nm, const std::vector& children) { Assert(children.size() > 0); return children.size() == 1 ? children[0] - : NodeManager::currentNM()->mkNode( - Kind::FINITE_FIELD_ADD, children); + : nm->mkNode(Kind::FINITE_FIELD_ADD, children); } PreprocessingPassResult FfBitsum::applyInternal( @@ -67,7 +66,7 @@ PreprocessingPassResult FfBitsum::applyInternal( } // collect bitsums - auto nm = NodeManager::currentNM(); + auto nm = nodeManager(); std::unordered_map cache{}; for (uint64_t i = 0, n = assertionsToPreprocess->size(); i < n; ++i) { @@ -113,7 +112,7 @@ PreprocessingPassResult FfBitsum::applyInternal( Trace("ff::bitsum") << "found " << scaled << std::endl; bs->second.push_back(scaled); } - translation = mkAdd(std::move(bs->second)); + translation = mkAdd(nm, std::move(bs->second)); } } } diff --git a/src/preprocessing/passes/int_to_bv.cpp b/src/preprocessing/passes/int_to_bv.cpp index d1ec15ddbbb..1350df0acd9 100644 --- a/src/preprocessing/passes/int_to_bv.cpp +++ b/src/preprocessing/passes/int_to_bv.cpp @@ -58,14 +58,12 @@ bool childrenTypesChanged(Node n, NodeMap& cache) { return false; } - -Node intToBVMakeBinary(TNode n, NodeMap& cache) +Node intToBVMakeBinary(NodeManager* nm, TNode n, NodeMap& cache) { for (TNode current : NodeDfsIterable(n, VisitOrder::POSTORDER, [&cache](TNode nn) { return cache.count(nn) > 0; })) { Node result; - NodeManager* nm = NodeManager::currentNM(); if (current.getNumChildren() == 0) { result = current; @@ -112,10 +110,10 @@ Node IntToBV::intToBV(TNode n, NodeMap& cache) AlwaysAssert(size > 0); AlwaysAssert(!options().base.incrementalSolving); - NodeManager* nm = NodeManager::currentNM(); + NodeManager* nm = nodeManager(); SkolemManager* sm = nm->getSkolemManager(); NodeMap binaryCache; - Node n_binary = intToBVMakeBinary(n, binaryCache); + Node n_binary = intToBVMakeBinary(nm, n, binaryCache); for (TNode current : NodeDfsIterable(n_binary, VisitOrder::POSTORDER, [&cache](TNode nn) { return cache.count(nn) > 0; })) diff --git a/src/preprocessing/passes/ite_simp.cpp b/src/preprocessing/passes/ite_simp.cpp index a38b9648e76..205ea69afa7 100644 --- a/src/preprocessing/passes/ite_simp.cpp +++ b/src/preprocessing/passes/ite_simp.cpp @@ -32,9 +32,8 @@ namespace cvc5::internal { namespace preprocessing { namespace passes { -Node mkAssocAnd(const std::vector& children) +Node mkAssocAnd(NodeManager* nm, const std::vector& children) { - NodeManager* nm = NodeManager::currentNM(); if (children.size() == 0) { return nm->mkConst(true); diff --git a/src/preprocessing/passes/pseudo_boolean_processor.cpp b/src/preprocessing/passes/pseudo_boolean_processor.cpp index ac6f8f3c497..6e2ccd2659a 100644 --- a/src/preprocessing/passes/pseudo_boolean_processor.cpp +++ b/src/preprocessing/passes/pseudo_boolean_processor.cpp @@ -298,9 +298,8 @@ void PseudoBooleanProcessor::learn(Node assertion) } } -Node PseudoBooleanProcessor::mkGeqOne(Node v) +Node PseudoBooleanProcessor::mkGeqOne(NodeManager* nm, Node v) { - NodeManager* nm = NodeManager::currentNM(); return nm->mkNode( Kind::GEQ, v, nm->mkConstRealOrInt(v.getType(), Rational(1))); } @@ -340,6 +339,8 @@ void PseudoBooleanProcessor::learnGeqSub(Node geq) // \sum pos >= \sum neg + off + NodeManager* nm = nodeManager(); + // for now special case everything we want // target easy clauses if (d_pos.size() == 1 && d_neg.size() == 1 && off.isZero()) @@ -349,8 +350,8 @@ void PseudoBooleanProcessor::learnGeqSub(Node geq) Node x = d_pos.front(); Node y = d_neg.front(); - Node xGeq1 = mkGeqOne(x); - Node yGeq1 = mkGeqOne(y); + Node xGeq1 = mkGeqOne(nm, x); + Node yGeq1 = mkGeqOne(nm, y); Node imp = yGeq1.impNode(xGeq1); addSub(geq, imp); } @@ -362,8 +363,8 @@ void PseudoBooleanProcessor::learnGeqSub(Node geq) Node x = d_neg[0]; Node y = d_neg[1]; - Node xGeq1 = mkGeqOne(x); - Node yGeq1 = mkGeqOne(y); + Node xGeq1 = mkGeqOne(nm, x); + Node yGeq1 = mkGeqOne(nm, y); Node cases = (xGeq1.notNode()).orNode(yGeq1.notNode()); addSub(geq, cases); } @@ -375,10 +376,9 @@ void PseudoBooleanProcessor::learnGeqSub(Node geq) Node y = d_pos[1]; Node z = d_neg[0]; - Node xGeq1 = mkGeqOne(x); - Node yGeq1 = mkGeqOne(y); - Node zGeq1 = mkGeqOne(z); - NodeManager* nm = NodeManager::currentNM(); + Node xGeq1 = mkGeqOne(nm, x); + Node yGeq1 = mkGeqOne(nm, y); + Node zGeq1 = mkGeqOne(nm, z); Node dis = nm->mkNode(Kind::OR, zGeq1.notNode(), xGeq1, yGeq1); addSub(geq, dis); } diff --git a/src/preprocessing/passes/pseudo_boolean_processor.h b/src/preprocessing/passes/pseudo_boolean_processor.h index 35cc05dd0b3..4febff54aac 100644 --- a/src/preprocessing/passes/pseudo_boolean_processor.h +++ b/src/preprocessing/passes/pseudo_boolean_processor.h @@ -87,7 +87,7 @@ class PseudoBooleanProcessor : public PreprocessingPass void addSub(Node from, Node to); void learnGeqSub(Node geq); - static Node mkGeqOne(Node v); + static Node mkGeqOne(NodeManager* nm, Node v); // x -> typedef context::CDHashMap> CDNode2PairMap; diff --git a/src/preprocessing/passes/sep_skolem_emp.cpp b/src/preprocessing/passes/sep_skolem_emp.cpp index d0b99e092df..20bbd60b1b9 100644 --- a/src/preprocessing/passes/sep_skolem_emp.cpp +++ b/src/preprocessing/passes/sep_skolem_emp.cpp @@ -37,7 +37,8 @@ using namespace cvc5::internal::theory; namespace { -Node preSkolemEmp(TypeNode locType, +Node preSkolemEmp(NodeManager* nm, + TypeNode locType, TypeNode dataType, Node n, bool pol, @@ -46,7 +47,6 @@ Node preSkolemEmp(TypeNode locType, std::map::iterator it = visited[pol].find(n); if (it == visited[pol].end()) { - NodeManager* nm = NodeManager::currentNM(); SkolemManager* sm = nm->getSkolemManager(); Trace("sep-preprocess") << "Pre-skolem emp " << n << " with pol " << pol << std::endl; @@ -81,7 +81,7 @@ Node preSkolemEmp(TypeNode locType, Node nc = n[i]; if (newHasPol) { - nc = preSkolemEmp(locType, dataType, n[i], newPol, visited); + nc = preSkolemEmp(nm, locType, dataType, n[i], newPol, visited); childChanged = childChanged || nc != n[i]; } children.push_back(nc); @@ -122,7 +122,8 @@ PreprocessingPassResult SepSkolemEmp::applyInternal( { Node prev = (*assertionsToPreprocess)[i]; bool pol = true; - Node next = preSkolemEmp(locType, dataType, prev, pol, visited); + Node next = + preSkolemEmp(nodeManager(), locType, dataType, prev, pol, visited); if (next != prev) { assertionsToPreprocess->replace(i, rewrite(next)); diff --git a/src/preprocessing/util/ite_utilities.cpp b/src/preprocessing/util/ite_utilities.cpp index 269ff65c368..22776ffe4b5 100644 --- a/src/preprocessing/util/ite_utilities.cpp +++ b/src/preprocessing/util/ite_utilities.cpp @@ -146,7 +146,7 @@ Node ITEUtilities::simplifyWithCare(TNode e) { if (d_careSimp == NULL) { - d_careSimp = new ITECareSimplifier(); + d_careSimp = new ITECareSimplifier(nodeManager()); } return d_careSimp->simplifyWithCare(e); } @@ -296,8 +296,8 @@ ITECompressor::ITECompressor(Env& env, ContainsTermITEVisitor* contains) { Assert(d_contains != NULL); - d_true = NodeManager::currentNM()->mkConst(true); - d_false = NodeManager::currentNM()->mkConst(false); + d_true = nodeManager()->mkConst(true); + d_false = nodeManager()->mkConst(false); } ITECompressor::~ITECompressor() { reset(); } @@ -345,7 +345,7 @@ Node ITECompressor::push_back_boolean(Node original, Node compressed) } else { - NodeManager* nm = NodeManager::currentNM(); + NodeManager* nm = nodeManager(); SkolemManager* sm = nm->getSkolemManager(); Node skolem = sm->mkDummySkolem("compress", nm->booleanType()); d_compressed[rewritten] = skolem; @@ -654,8 +654,8 @@ ITESimplifier::ITESimplifier(Env& env, ContainsTermITEVisitor* contains) d_statistics(env.getStatisticsRegistry()) { Assert(d_containsVisitor != NULL); - d_true = NodeManager::currentNM()->mkConst(true); - d_false = NodeManager::currentNM()->mkConst(false); + d_true = nodeManager()->mkConst(true); + d_false = nodeManager()->mkConst(false); } ITESimplifier::~ITESimplifier() @@ -977,7 +977,7 @@ Node ITESimplifier::attemptLiftEquality(TNode atom) search.nonConstants.size()); Trace("ite::simpite") << "used " << search.nonConstants.size() << " nonconstants" << endl; - NodeManager* nm = NodeManager::currentNM(); + NodeManager* nm = nodeManager(); Node simpVar = getSimpVar(notIte.getType()); TNode newLeft = leftIsIte ? simpVar : notIte; TNode newRight = leftIsIte ? notIte : simpVar; @@ -1010,7 +1010,7 @@ Node ITESimplifier::attemptLiftEquality(TNode atom) Node lT = lite[1]; Node lE = lite[2]; - NodeManager* nm = NodeManager::currentNM(); + NodeManager* nm = nodeManager(); Node negRite = atom[1][1]; Node rC = negRite[0]; Node rT = nm->mkNode(Kind::MULT, negOne, negRite[1]); @@ -1045,7 +1045,7 @@ Node ITESimplifier::transformAtom(TNode atom) if (atom.getKind() == Kind::EQUAL && atom[0].isConst() && atom[1].isConst()) { // constant equality - return NodeManager::currentNM()->mkConst(atom[0] == atom[1]); + return nodeManager()->mkConst(atom[0] == atom[1]); } return Node::null(); } @@ -1360,7 +1360,7 @@ Node ITESimplifier::getSimpVar(TypeNode t) { return (*it).second; } - SkolemManager* sm = NodeManager::currentNM()->getSkolemManager(); + SkolemManager* sm = nodeManager()->getSkolemManager(); Node var = sm->mkDummySkolem( "iteSimp", t, "is a variable resulting from ITE simplification"); d_simpVars[t] = var; @@ -1614,10 +1614,10 @@ Node ITESimplifier::simpITE(TNode assertion) return d_simpITECache[assertion]; } -ITECareSimplifier::ITECareSimplifier() : d_careSetsOutstanding(0), d_usedSets() +ITECareSimplifier::ITECareSimplifier(NodeManager* nm) : d_careSetsOutstanding(0), d_usedSets() { - d_true = NodeManager::currentNM()->mkConst(true); - d_false = NodeManager::currentNM()->mkConst(false); + d_true = nm->mkConst(true); + d_false = nm->mkConst(false); } ITECareSimplifier::~ITECareSimplifier() diff --git a/src/preprocessing/util/ite_utilities.h b/src/preprocessing/util/ite_utilities.h index a1e3387001f..317c5366b23 100644 --- a/src/preprocessing/util/ite_utilities.h +++ b/src/preprocessing/util/ite_utilities.h @@ -327,7 +327,7 @@ class ITESimplifier : protected EnvObj class ITECareSimplifier { public: - ITECareSimplifier(); + ITECareSimplifier(NodeManager* nm); ~ITECareSimplifier(); Node simplifyWithCare(TNode e); diff --git a/src/proof/alethe/alethe_let_binding.cpp b/src/proof/alethe/alethe_let_binding.cpp index f1d775b82bf..cb2ac123bae 100644 --- a/src/proof/alethe/alethe_let_binding.cpp +++ b/src/proof/alethe/alethe_let_binding.cpp @@ -25,13 +25,14 @@ AletheLetBinding::AletheLetBinding(uint32_t thresh) : LetBinding("let", thresh) { } -Node AletheLetBinding::convert(Node n, const std::string& prefix) +Node AletheLetBinding::convert(NodeManager* nm, + Node n, + const std::string& prefix) { if (d_letMap.empty()) { return n; } - NodeManager* nm = NodeManager::currentNM(); // terms with a child that is being declared std::unordered_set hasDeclaredChild; // For a term being declared, its position relative to the list of children diff --git a/src/proof/alethe/alethe_let_binding.h b/src/proof/alethe/alethe_let_binding.h index 1f1461c5539..ea0d357192d 100644 --- a/src/proof/alethe/alethe_let_binding.h +++ b/src/proof/alethe/alethe_let_binding.h @@ -46,7 +46,7 @@ class AletheLetBinding : public LetBinding * @param prefix The prefix of variables to convert * @return the converted node. */ - Node convert(Node n, const std::string& prefix); + Node convert(NodeManager* nm, Node n, const std::string& prefix); private: /** The set of terms that have already been "decleared", i.e., already had diff --git a/src/proof/alethe/alethe_node_converter.cpp b/src/proof/alethe/alethe_node_converter.cpp index 767fac30e80..2b474c344a9 100644 --- a/src/proof/alethe/alethe_node_converter.cpp +++ b/src/proof/alethe/alethe_node_converter.cpp @@ -41,7 +41,6 @@ Node AletheNodeConverter::maybeConvert(Node n, bool isAssumption) Node AletheNodeConverter::postConvert(Node n) { - NodeManager* nm = NodeManager::currentNM(); Kind k = n.getKind(); Trace("alethe-conv") << "AletheNodeConverter: convert " << n << ", kind " << k << "\n"; @@ -52,9 +51,9 @@ Node AletheNodeConverter::postConvert(Node n) std::stringstream ss; ss << "(_ @bitOf " << n.getOperator().getConst().d_bitIndex << ")"; - TypeNode fType = nm->mkFunctionType(n[0].getType(), n.getType()); + TypeNode fType = d_nm->mkFunctionType(n[0].getType(), n.getType()); Node op = mkInternalSymbol(ss.str(), fType, true); - Node converted = nm->mkNode(Kind::APPLY_UF, op, n[0]); + Node converted = d_nm->mkNode(Kind::APPLY_UF, op, n[0]); return converted; } case Kind::BITVECTOR_FROM_BOOLS: @@ -66,10 +65,10 @@ Node AletheNodeConverter::postConvert(Node n) childrenTypes.push_back(c.getType()); children.push_back(c); } - TypeNode fType = nm->mkFunctionType(childrenTypes, n.getType()); + TypeNode fType = d_nm->mkFunctionType(childrenTypes, n.getType()); Node op = mkInternalSymbol("@bbT", fType, true); children.insert(children.begin(), op); - Node converted = nm->mkNode(Kind::APPLY_UF, children); + Node converted = d_nm->mkNode(Kind::APPLY_UF, children); return converted; } case Kind::BITVECTOR_EAGER_ATOM: @@ -78,21 +77,21 @@ Node AletheNodeConverter::postConvert(Node n) } case Kind::DIVISION_TOTAL: { - return nm->mkNode(Kind::DIVISION, n[0], n[1]); + return d_nm->mkNode(Kind::DIVISION, n[0], n[1]); } case Kind::INTS_DIVISION_TOTAL: { - return nm->mkNode(Kind::INTS_DIVISION, n[0], n[1]); + return d_nm->mkNode(Kind::INTS_DIVISION, n[0], n[1]); } case Kind::INTS_MODULUS_TOTAL: { - return nm->mkNode(Kind::INTS_MODULUS, n[0], n[1]); + return d_nm->mkNode(Kind::INTS_MODULUS, n[0], n[1]); } case Kind::SKOLEM: { Trace("alethe-conv") << "AletheNodeConverter: handling skolem " << n << "\n"; - SkolemManager* sm = nm->getSkolemManager(); + SkolemManager* sm = d_nm->getSkolemManager(); SkolemId sfi = SkolemId::NONE; Node cacheVal; sm->isSkolemFunction(n, sfi, cacheVal); @@ -138,12 +137,12 @@ Node AletheNodeConverter::postConvert(Node n) Node body = (index == quant[0].getNumChildren() - 1 ? quant[1] - : nm->mkNode( - Kind::FORALL, - nm->mkNode(Kind::BOUND_VAR_LIST, - std::vector{quant[0].begin() + index + 1, - quant[0].end()}), - quant[1])) + : d_nm->mkNode(Kind::FORALL, + d_nm->mkNode(Kind::BOUND_VAR_LIST, + std::vector{ + quant[0].begin() + index + 1, + quant[0].end()}), + quant[1])) .notNode(); // we need to replace in the body all the free variables (i.e., from 0 // to index) by their respective choice terms. To do this, we get @@ -154,7 +153,7 @@ Node AletheNodeConverter::postConvert(Node n) std::vector subs; for (size_t i = 0; i < index; ++i) { - std::vector cacheVals{quant, nm->mkConstInt(Rational(i))}; + std::vector cacheVals{quant, d_nm->mkConstInt(Rational(i))}; Node sk = sm->mkSkolemFunction(SkolemId::QUANTIFIERS_SKOLEMIZE, cacheVals); Assert(!sk.isNull()); @@ -165,8 +164,8 @@ Node AletheNodeConverter::postConvert(Node n) subs.begin(), subs.end()); } - Node witness = nm->mkNode( - Kind::WITNESS, nm->mkNode(Kind::BOUND_VAR_LIST, var), body); + Node witness = d_nm->mkNode( + Kind::WITNESS, d_nm->mkNode(Kind::BOUND_VAR_LIST, var), body); Trace("alethe-conv") << ".. witness: " << witness << "\n"; witness = convert(witness); if (d_defineSkolems) @@ -179,7 +178,7 @@ Node AletheNodeConverter::postConvert(Node n) for (size_t i = index + 1; i > 0; --i) { std::vector cacheVals{quant, - nm->mkConstInt(Rational(i - 1))}; + d_nm->mkConstInt(Rational(i - 1))}; Node sk = sm->mkSkolemFunction(SkolemId::QUANTIFIERS_SKOLEMIZE, cacheVals); Assert(!sk.isNull()); @@ -203,7 +202,8 @@ Node AletheNodeConverter::postConvert(Node n) case Kind::FORALL: { // remove patterns, if any - return n.getNumChildren() == 3 ? nm->mkNode(Kind::FORALL, n[0], n[1]) : n; + return n.getNumChildren() == 3 ? d_nm->mkNode(Kind::FORALL, n[0], n[1]) + : n; } // we must make it to be printed with "choice", so we create an operator // with that name and the correct type and do a function application @@ -214,9 +214,9 @@ Node AletheNodeConverter::postConvert(Node n) { childrenTypes.push_back(c.getType()); } - TypeNode fType = nm->mkFunctionType(childrenTypes, n.getType()); + TypeNode fType = d_nm->mkFunctionType(childrenTypes, n.getType()); Node choiceOp = mkInternalSymbol("choice", fType); - Node converted = nm->mkNode(Kind::APPLY_UF, choiceOp, n[0], n[1]); + Node converted = d_nm->mkNode(Kind::APPLY_UF, choiceOp, n[0], n[1]); Trace("alethe-conv") << ".. converted to choice: " << converted << "\n"; return converted; } @@ -427,8 +427,8 @@ Node AletheNodeConverter::mkInternalSymbol(const std::string& name, { return it->second; } - NodeManager* nm = NodeManager::currentNM(); - Node sym = useRawSym ? nm->mkRawSymbol(name, tn) : nm->mkBoundVar(name, tn); + Node sym = + useRawSym ? d_nm->mkRawSymbol(name, tn) : d_nm->mkBoundVar(name, tn); d_symbolsMap[key] = sym; return sym; } diff --git a/src/proof/alethe/alethe_printer.cpp b/src/proof/alethe/alethe_printer.cpp index 9253164f9a2..aa89c8efa49 100644 --- a/src/proof/alethe/alethe_printer.cpp +++ b/src/proof/alethe/alethe_printer.cpp @@ -154,7 +154,7 @@ void AletheProofPrinter::printTerm(std::ostream& out, TNode n) options::ioutils::applyDagThresh(ss, 0); // Guarantee we print reals as expected options::ioutils::applyPrintArithLitToken(ss, true); - ss << d_lbind.convert(n, "@p_"); + ss << d_lbind.convert(nodeManager(), n, "@p_"); out << ss.str(); } diff --git a/src/proof/alf/alf_node_converter.cpp b/src/proof/alf/alf_node_converter.cpp index c1b18a3674d..eb6f0a0e84e 100644 --- a/src/proof/alf/alf_node_converter.cpp +++ b/src/proof/alf/alf_node_converter.cpp @@ -72,7 +72,6 @@ Node AlfNodeConverter::preConvert(Node n) Node AlfNodeConverter::postConvert(Node n) { - NodeManager* nm = NodeManager::currentNM(); Kind k = n.getKind(); // we eliminate MATCH at preConvert above Assert(k != Kind::MATCH); @@ -105,14 +104,12 @@ Node AlfNodeConverter::postConvert(Node n) // This case will only apply for terms originating from places with no // proof support. Note it is not added as a declared variable, instead it // is used as (var N T) throughout. - Node index = nm->mkConstInt(Rational(getOrAssignIndexForConst(n))); + Node index = d_nm->mkConstInt(Rational(getOrAssignIndexForConst(n))); Node tc = typeAsNode(tn); return mkInternalApp("const", {index, tc}, tn); } else if (k == Kind::BOUND_VARIABLE) { - // note: we always distinguish variables, to ensure they do not have - // names that are overloaded with user names std::string sname; if (n.hasName()) { @@ -126,11 +123,14 @@ Node AlfNodeConverter::postConvert(Node n) ss << n; sname = ss.str(); } - size_t index = d_varIndex[sname]; - d_varIndex[sname]++; - std::stringstream ssn; - ssn << "@v." << index << "." << sname; - return NodeManager::currentNM()->mkBoundVar(ssn.str(), tn); + // A variable x of type T can unambiguously referred to as (eo::var "x" T). + // We convert to this representation here, which will often be letified. + std::vector args; + Node nn = d_nm->mkConst(String(sname)); + args.push_back(nn); + Node tnn = typeAsNode(tn); + args.push_back(tnn); + return mkInternalApp("eo::var", args, tn); } else if (k == Kind::VARIABLE) { @@ -155,15 +155,13 @@ Node AlfNodeConverter::postConvert(Node n) else if (n.isClosure()) { Node vl = n[0]; - // notice that intentionally we drop annotations here. + // Notice that intentionally we drop annotations here. + // Additionally, it is important that we convert the closure to a + // non-closure operator here, since we will be traversing over it + // during letification. std::vector args; - // We take the *original* bound variable list, since variable names are - // preserved in the translation; using the updated variable `@v.N.x` - // would lead to using a variable named "@v.N.x" instead of "x", where - // `@v.N.x` is a macro for the variable "x". - args.push_back(n[0]); args.insert(args.end(), - n.begin() + 1, + n.begin(), n.begin() + getNumChildrenToProcessForClosure(k)); return mkInternalApp( printer::smt2::Smt2Printer::smtKindString(k), args, tn); @@ -201,8 +199,8 @@ Node AlfNodeConverter::postConvert(Node n) else if (k == Kind::CONST_FINITE_FIELD) { const FiniteFieldValue& ffv = n.getConst(); - Node v = convert(nm->mkConstInt(ffv.getValue())); - Node fs = convert(nm->mkConstInt(ffv.getFieldSize())); + Node v = convert(d_nm->mkConstInt(ffv.getValue())); + Node fs = convert(d_nm->mkConstInt(ffv.getFieldSize())); return mkInternalApp("ff.value", {fs, v}, tn); } else if (k == Kind::FUNCTION_ARRAY_CONST) @@ -236,14 +234,14 @@ Node AlfNodeConverter::postConvert(Node n) } newArgs.push_back(opc); newArgs.insert(newArgs.end(), n.begin(), n.end()); - return nm->mkNode(Kind::APPLY_UF, newArgs); + return d_nm->mkNode(Kind::APPLY_UF, newArgs); } else if (k == Kind::INDEXED_ROOT_PREDICATE) { const IndexedRootPredicate& irp = n.getOperator().getConst(); std::vector newArgs; - newArgs.push_back(nm->mkConstInt(irp.d_index)); + newArgs.push_back(d_nm->mkConstInt(irp.d_index)); newArgs.insert(newArgs.end(), n.begin(), n.end()); return mkInternalApp("@indexed_root_predicate", newArgs, tn); } @@ -321,8 +319,7 @@ bool AlfNodeConverter::shouldTraverse(Node n) Node AlfNodeConverter::maybeMkSkolemFun(Node k) { - NodeManager* nm = NodeManager::currentNM(); - SkolemManager* sm = nm->getSkolemManager(); + SkolemManager* sm = d_nm->getSkolemManager(); SkolemId sfi = SkolemId::NONE; Node cacheVal; TypeNode tn = k.getType(); @@ -393,7 +390,7 @@ size_t AlfNodeConverter::getNumChildrenToProcessForClosure(Kind k) const Node AlfNodeConverter::mkList(const std::vector& args) { Assert(!args.empty()); - TypeNode tn = NodeManager::currentNM()->booleanType(); + TypeNode tn = d_nm->booleanType(); // singleton lists are handled due to (@list x) ---> (@list x eo::nil) return mkInternalApp("@list", args, tn); } @@ -403,8 +400,8 @@ Node AlfNodeConverter::mkInternalSymbol(const std::string& name, bool useRawSym) { // use raw symbol so that it is never quoted - NodeManager* nm = NodeManager::currentNM(); - Node sym = useRawSym ? nm->mkRawSymbol(name, tn) : nm->mkBoundVar(name, tn); + Node sym = + useRawSym ? d_nm->mkRawSymbol(name, tn) : d_nm->mkBoundVar(name, tn); d_symbols.insert(sym); return sym; } @@ -422,13 +419,12 @@ Node AlfNodeConverter::mkInternalApp(const std::string& name, Assert(!a.isNull()); argTypes.push_back(a.getType()); } - NodeManager* nm = NodeManager::currentNM(); - TypeNode atype = nm->mkFunctionType(argTypes, ret); + TypeNode atype = d_nm->mkFunctionType(argTypes, ret); Node op = mkInternalSymbol(name, atype, useRawSym); std::vector aargs; aargs.push_back(op); aargs.insert(aargs.end(), args.begin(), args.end()); - return nm->mkNode(Kind::APPLY_UF, aargs); + return d_nm->mkNode(Kind::APPLY_UF, aargs); } return mkInternalSymbol(name, ret, useRawSym); } @@ -436,7 +432,6 @@ Node AlfNodeConverter::mkInternalApp(const std::string& name, Node AlfNodeConverter::getOperatorOfTerm(Node n, bool reqCast) { Assert(n.hasOperator()); - NodeManager* nm = NodeManager::currentNM(); Kind k = n.getKind(); std::stringstream opName; Trace("alf-term-process-debug2") @@ -494,7 +489,7 @@ Node AlfNodeConverter::getOperatorOfTerm(Node n, bool reqCast) if (dt.isTuple()) { opName << "tuple.update"; - indices.push_back(nm->mkConstInt(cindex)); + indices.push_back(d_nm->mkConstInt(cindex)); } else { @@ -545,7 +540,7 @@ Node AlfNodeConverter::getOperatorOfTerm(Node n, bool reqCast) const DType& dt = DType::datatypeOf(op); if (dt.isTuple()) { - indices.push_back(nm->mkConstInt(index)); + indices.push_back(d_nm->mkConstInt(index)); opName << "tuple.select"; } else @@ -573,14 +568,14 @@ Node AlfNodeConverter::getOperatorOfTerm(Node n, bool reqCast) || k == Kind::BITVECTOR_XOR) { TypeNode tna = n[0].getType(); - indices.push_back(nm->mkConstInt(tna.getBitVectorSize())); + indices.push_back(d_nm->mkConstInt(tna.getBitVectorSize())); isParameterized = true; } else if (k == Kind::FINITE_FIELD_ADD || k == Kind::FINITE_FIELD_BITSUM || k == Kind::FINITE_FIELD_MULT) { TypeNode tna = n[0].getType(); - indices.push_back(nm->mkConstInt(tna.getFfSize())); + indices.push_back(d_nm->mkConstInt(tna.getFfSize())); isParameterized = true; } else if (k == Kind::STRING_CONCAT) diff --git a/src/proof/alf/alf_node_converter.h b/src/proof/alf/alf_node_converter.h index b354f940239..a22c55e12d1 100644 --- a/src/proof/alf/alf_node_converter.h +++ b/src/proof/alf/alf_node_converter.h @@ -152,8 +152,6 @@ class AlfNodeConverter : public BaseAlfNodeConverter TypeNode d_sortType; /** Used for getting unique index for uncategorized skolems */ std::map d_constIndex; - /** Used for getting unique names for bound variables */ - std::map d_varIndex; /** Cache for typeAsNode */ std::map d_typeAsNode; }; diff --git a/src/proof/alf/alf_print_channel.cpp b/src/proof/alf/alf_print_channel.cpp index 603fc40d3d2..8136f685610 100644 --- a/src/proof/alf/alf_print_channel.cpp +++ b/src/proof/alf/alf_print_channel.cpp @@ -20,6 +20,7 @@ #include "expr/node_algorithm.h" #include "expr/skolem_manager.h" #include "printer/printer.h" +#include "proof/trust_id.h" #include "rewriter/rewrite_db.h" namespace cvc5::internal { @@ -31,8 +32,12 @@ AlfPrintChannel::~AlfPrintChannel() {} AlfPrintChannelOut::AlfPrintChannelOut(std::ostream& out, const LetBinding* lbind, - const std::string& tprefix) - : d_out(out), d_lbind(lbind), d_termLetPrefix(tprefix) + const std::string& tprefix, + bool trackWarn) + : d_out(out), + d_lbind(lbind), + d_termLetPrefix(tprefix), + d_trackWarn(trackWarn) { } @@ -129,10 +134,13 @@ void AlfPrintChannelOut::printTrustStep(ProofRule r, TNode nc) { Assert(!nc.isNull()); - if (d_warnedRules.find(r) == d_warnedRules.end()) + if (d_trackWarn) { - d_out << "; WARNING: add trust step for " << r << std::endl; - d_warnedRules.insert(r); + if (d_warnedRules.find(r) == d_warnedRules.end()) + { + d_out << "; WARNING: add trust step for " << r << std::endl; + d_warnedRules.insert(r); + } } d_out << "; trust " << r; if (r == ProofRule::DSL_REWRITE) @@ -151,6 +159,14 @@ void AlfPrintChannelOut::printTrustStep(ProofRule r, d_out << " " << di; } } + else if (r == ProofRule::TRUST) + { + TrustId tid; + if (getTrustId(args[0], tid)) + { + d_out << " " << tid; + } + } d_out << std::endl; // trust takes a premise-list which must be specified even if empty printStepInternal("trust", n, i, premises, {nc}, false, true); @@ -230,48 +246,6 @@ void AlfPrintChannelPre::processInternal(const Node& n) d_lbind->process(n); } d_keep.insert(n); // probably not necessary - NodeManager* nm = NodeManager::currentNM(); - SkolemManager* sm = nm->getSkolemManager(); - // traverse and collect all free variables in this term, which includes - // traversing skolem indices. - std::vector visit; - TNode cur; - SkolemId sfi; - Node cacheVal; - visit.push_back(n); - do - { - cur = visit.back(); - visit.pop_back(); - if (d_varsVisited.find(cur) == d_varsVisited.end()) - { - d_varsVisited.insert(cur); - Kind ck = cur.getKind(); - if (ck == Kind::BOUND_VARIABLE) - { - d_vars.insert(cur); - continue; - } - else if (ck == Kind::SKOLEM) - { - if (sm->isSkolemFunction(cur, sfi, cacheVal) && !cacheVal.isNull()) - { - visit.push_back(cacheVal); - } - continue; - } - if (cur.hasOperator()) - { - visit.push_back(cur.getOperator()); - } - visit.insert(visit.end(), cur.begin(), cur.end()); - } - } while (!visit.empty()); -} - -const std::unordered_set& AlfPrintChannelPre::getVariables() const -{ - return d_vars; } } // namespace proof diff --git a/src/proof/alf/alf_print_channel.h b/src/proof/alf/alf_print_channel.h index aa0ea355f13..33af4df1508 100644 --- a/src/proof/alf/alf_print_channel.h +++ b/src/proof/alf/alf_print_channel.h @@ -75,7 +75,8 @@ class AlfPrintChannelOut : public AlfPrintChannel public: AlfPrintChannelOut(std::ostream& out, const LetBinding* lbind, - const std::string& tprefix); + const std::string& tprefix, + bool trackWarn); void printNode(TNode n) override; void printTypeNode(TypeNode tn) override; void printAssume(TNode n, size_t i, bool isPush) override; @@ -100,6 +101,7 @@ class AlfPrintChannelOut : public AlfPrintChannel * Print type node to stream in the expected format of ALF. */ void printTypeNodeInternal(std::ostream& out, TypeNode tn); + std::ostream& getOStream() { return d_out; } private: /** @@ -124,6 +126,8 @@ class AlfPrintChannelOut : public AlfPrintChannel * associated with trusted steps. */ std::unordered_set d_warnedRules; + /** Are we tracking warned rules? */ + bool d_trackWarn; }; /** @@ -151,18 +155,11 @@ class AlfPrintChannelPre : public AlfPrintChannel const std::vector& args, TNode conc) override; - /** Get variables we encountered in printing */ - const std::unordered_set& getVariables() const; - private: /** The let binding */ LetBinding* d_lbind; /** For computing free variables */ std::unordered_set d_keep; - /** The set of variables we have encountered */ - std::unordered_set d_vars; - /** The visited cache for computing variables */ - std::unordered_set d_varsVisited; /** Process that we will print node n in the final proof */ void processInternal(const Node& n); }; diff --git a/src/proof/alf/alf_printer.cpp b/src/proof/alf/alf_printer.cpp index 84ebdb7af9e..4321052c752 100644 --- a/src/proof/alf/alf_printer.cpp +++ b/src/proof/alf/alf_printer.cpp @@ -38,13 +38,24 @@ namespace proof { AlfPrinter::AlfPrinter(Env& env, BaseAlfNodeConverter& atp, - rewriter::RewriteDb* rdb) + rewriter::RewriteDb* rdb, + uint32_t letThresh) : EnvObj(env), d_tproc(atp), + d_pfIdCounter(0), + d_alreadyPrinted(&d_passumeCtx), d_passumeMap(&d_passumeCtx), d_termLetPrefix("@t"), d_ltproc(nodeManager(), atp), - d_rdb(rdb) + d_rdb(rdb), + // Use a let binding if proofDagGlobal is true. We can traverse binders + // due to the way we print global declare-var, since terms beneath + // binders will always have their variables in scope and hence can be + // printed in define commands. We additionally traverse skolems with this + // utility. + d_lbind(d_termLetPrefix, letThresh, true, true), + d_lbindUse(options().proof.proofDagGlobal ? &d_lbind : nullptr), + d_aletify(d_lbindUse) { d_pfType = nodeManager()->mkSort("proofType"); d_false = nodeManager()->mkConst(false); @@ -461,6 +472,8 @@ void AlfPrinter::printDslRule(std::ostream& out, ProofRewriteRule r) out << "(declare-rule " << r << " ("; AlfDependentTypeConverter adtc(nodeManager(), d_tproc); std::stringstream ssExplicit; + std::map nameCount; + std::vector uviList; for (size_t i = 0, nvars = uvarList.size(); i < nvars; i++) { if (i > 0) @@ -470,9 +483,23 @@ void AlfPrinter::printDslRule(std::ostream& out, ProofRewriteRule r) const Node& uv = uvarList[i]; std::stringstream sss; sss << uv; + // Use a consistent variable name, which e.g. ensures that minor changes + // to the RARE rules do not induce major changes in the CPC definition. + // Below, we have a variable when the user has named x (which itself may + // contain digits), and the cvc5 RARE parser has renamed to xN where N is + // +. We rename this to xM where M is the number of times we have + // seen a variable with prefix M. For example, the variable `x1s2` may be + // renamed to `x1s2123`, which will be renamed to `x1s1` here. + std::string str = sss.str(); + size_t index = str.find_last_not_of("0123456789"); + std::string result = str.substr(0, index + 1); + sss.str(""); + nameCount[result]++; + sss << result << nameCount[result]; Node uvi = d_tproc.mkInternalSymbol(sss.str(), uv.getType()); + uviList.emplace_back(uvi); su.add(varList[i], uvi); - ssExplicit << "(" << uv << " "; + ssExplicit << "(" << sss.str() << " "; TypeNode uvt = uv.getType(); Node uvtp = adtc.process(uvt); ssExplicit << uvtp; @@ -515,13 +542,13 @@ void AlfPrinter::printDslRule(std::ostream& out, ProofRewriteRule r) out << ")" << std::endl; } out << " :args ("; - for (size_t i = 0, nvars = uvarList.size(); i < nvars; i++) + for (size_t i = 0, nvars = uviList.size(); i < nvars; i++) { if (i > 0) { out << " "; } - out << uvarList[i]; + out << uviList[i]; } out << ")" << std::endl; Node sconc = d_tproc.convert(su.apply(conc)); @@ -531,6 +558,8 @@ void AlfPrinter::printDslRule(std::ostream& out, ProofRewriteRule r) out << ")" << std::endl; } +LetBinding* AlfPrinter::getLetBinding() { return d_lbindUse; } + void AlfPrinter::printLetList(std::ostream& out, LetBinding& lbind) { std::vector letList; @@ -547,88 +576,86 @@ void AlfPrinter::printLetList(std::ostream& out, LetBinding& lbind) } } -void AlfPrinter::print(std::ostream& out, std::shared_ptr pfn) +void AlfPrinter::print(std::ostream& out, + std::shared_ptr pfn, + ProofScopeMode psm) { // ensures options are set once and for all options::ioutils::applyOutputLanguage(out, Language::LANG_SMTLIB_V2_6); options::ioutils::applyPrintArithLitToken(out, true); options::ioutils::applyPrintSkolemDefinitions(out, true); - d_pfIdCounter = 0; - - // Get the definitions and assertions and print the declarations from them - const std::vector& definitions = pfn->getArguments(); - const std::vector& assertions = pfn->getChildren()[0]->getArguments(); - const ProofNode* pnBody = pfn->getChildren()[0]->getChildren()[0].get(); + // allocate a print channel + AlfPrintChannelOut aprint(out, d_lbindUse, d_termLetPrefix, true); + print(aprint, pfn, psm); +} - // Use a let binding if proofDagGlobal is true. - // We can traverse binders due to the way we print global declare-var, since - // terms beneath binders will always have their variables in scope and hence - // can be printed in define commands. - // We additionally traverse skolems with this utility. - LetBinding lbind(d_termLetPrefix, 2, true, true); - LetBinding* lbindUse = options().proof.proofDagGlobal ? &lbind : nullptr; - AlfPrintChannelPre aletify(lbindUse); - AlfPrintChannelOut aprint(out, lbindUse, d_termLetPrefix); +void AlfPrinter::print(AlfPrintChannelOut& aout, + std::shared_ptr pfn, + ProofScopeMode psm) +{ + std::ostream& out = aout.getOStream(); + Assert(d_pletMap.empty()); + d_pfIdCounter = 0; - d_pletMap.clear(); + const ProofNode* ascope = nullptr; + const ProofNode* dscope = nullptr; + const ProofNode* pnBody = nullptr; + if (psm == ProofScopeMode::NONE) + { + pnBody = pfn.get(); + } + else if (psm == ProofScopeMode::UNIFIED) + { + ascope = pfn.get(); + Assert(ascope->getRule() == ProofRule::SCOPE); + pnBody = pfn->getChildren()[0].get(); + } + else if (psm == ProofScopeMode::DEFINITIONS_AND_ASSERTIONS) + { + dscope = pfn.get(); + Assert(dscope->getRule() == ProofRule::SCOPE); + ascope = pfn->getChildren()[0].get(); + Assert(ascope->getRule() == ProofRule::SCOPE); + pnBody = pfn->getChildren()[0]->getChildren()[0].get(); + } + // Get the definitions and assertions and print the declarations from them + const std::vector& definitions = + dscope != nullptr ? dscope->getArguments() : d_emptyVec; + const std::vector& assertions = + ascope != nullptr ? ascope->getArguments() : d_emptyVec; bool wasAlloc; for (size_t i = 0; i < 2; i++) { - AlfPrintChannel* aout; + AlfPrintChannel* ao; if (i == 0) { - aout = &aletify; + ao = &d_aletify; } else { - aout = &aprint; + ao = &aout; } if (i == 1) { - std::stringstream outVars; - const std::unordered_set& vars = aletify.getVariables(); - for (const Node& v : vars) - { - if (v.getKind() == Kind::BOUND_VARIABLE) - { - std::string origName = v.getName(); - // Strip off "@v.N." from the variable. It may also be an original - // variable appearing in a quantifier, in which case we skip. - if (origName.substr(0, 3) != "@v.") - { - continue; - } - origName = origName.substr(4); - origName = origName.substr(origName.find(".") + 1); - outVars << "(define " << v << " () (eo::var \"" << origName << "\" " - << v.getType() << "))" << std::endl; - } - } // do not need to print DSL rules - if (options().proof.proofPrintReference) - { - // [2] print only the universal variables - out << outVars.str(); - // we do not print the reference command here, since we don't know - // where the proof is stored. - } - else + if (!options().proof.proofPrintReference) { - // [2] print the types + // [1] print the declarations printer::smt2::Smt2Printer alfp(printer::smt2::Variant::alf_variant); - smt::PrintBenchmark pb(&alfp, &d_tproc); - std::stringstream outFuns; - pb.printDeclarationsFrom(out, outFuns, definitions, assertions); - // [3] print the universal variables - out << outVars.str(); - // [4] print the declared functions - out << outFuns.str(); + // we do not print declarations in a sorted manner to reduce overhead + smt::PrintBenchmark pb(&alfp, false, &d_tproc); + std::stringstream outDecl; + std::stringstream outDef; + pb.printDeclarationsFrom(outDecl, outDef, definitions, assertions); + out << outDecl.str(); + // [2] print the definitions + out << outDef.str(); } - // [5] print proof-level term bindings - printLetList(out, lbind); + // [3] print proof-level term bindings + printLetList(out, d_lbind); } - // [6] print (unique) assumptions + // [4] print (unique) assumptions, including definitions std::unordered_set processed; for (const Node& n : assertions) { @@ -639,7 +666,7 @@ void AlfPrinter::print(std::ostream& out, std::shared_ptr pfn) processed.insert(n); size_t id = allocateAssumeId(n, wasAlloc); Node nc = d_tproc.convert(n); - aout->printAssume(nc, id, false); + ao->printAssume(nc, id, false); } for (const Node& n : definitions) { @@ -657,14 +684,31 @@ void AlfPrinter::print(std::ostream& out, std::shared_ptr pfn) size_t id = allocateAssumeId(n, wasAlloc); Node f = d_tproc.convert(n[0]); Node lam = d_tproc.convert(n[1]); - aout->printStep("refl", f.eqNode(lam), id, {}, {lam}); + ao->printStep("refl", f.eqNode(lam), id, {}, {lam}); } - // [7] print proof body - printProofInternal(aout, pnBody); + // [5] print proof body + printProofInternal(ao, pnBody, i == 1); } } -void AlfPrinter::printProofInternal(AlfPrintChannel* out, const ProofNode* pn) +void AlfPrinter::printNext(AlfPrintChannelOut& aout, + std::shared_ptr pfn) +{ + const ProofNode* pnBody = pfn.get(); + // print with letification + printProofInternal(&d_aletify, pnBody, false); + // print the new let bindings + std::ostream& out = aout.getOStream(); + // Print new terms from the let binding. note that this should print only + // the terms we have yet to see so far. + printLetList(out, d_lbind); + // print the proof + printProofInternal(&aout, pnBody, true); +} + +void AlfPrinter::printProofInternal(AlfPrintChannel* out, + const ProofNode* pn, + bool addToCache) { // the stack std::vector visit; @@ -679,6 +723,11 @@ void AlfPrinter::printProofInternal(AlfPrintChannel* out, const ProofNode* pn) do { cur = visit.back(); + if (d_alreadyPrinted.find(cur) != d_alreadyPrinted.end()) + { + visit.pop_back(); + continue; + } pit = processingChildren.find(cur); if (pit == processingChildren.end()) { @@ -708,6 +757,10 @@ void AlfPrinter::printProofInternal(AlfPrintChannel* out, const ProofNode* pn) processingChildren[cur] = false; // print postorder traversal printStepPost(out, cur); + if (addToCache) + { + d_alreadyPrinted.insert(cur); + } } } while (!visit.empty()); } diff --git a/src/proof/alf/alf_printer.h b/src/proof/alf/alf_printer.h index df7a444a48f..678edcfcd23 100644 --- a/src/proof/alf/alf_printer.h +++ b/src/proof/alf/alf_printer.h @@ -23,6 +23,7 @@ #include #include "context/cdhashmap.h" +#include "context/cdhashset.h" #include "expr/node_algorithm.h" #include "proof/alf/alf_list_node_converter.h" #include "proof/alf/alf_node_converter.h" @@ -31,6 +32,7 @@ #include "proof/proof_node.h" #include "rewriter/rewrite_proof_rule.h" #include "smt/env_obj.h" +#include "smt/proof_manager.h" namespace cvc5::internal { @@ -39,15 +41,39 @@ namespace proof { class AlfPrinter : protected EnvObj { public: - AlfPrinter(Env& env, BaseAlfNodeConverter& atp, rewriter::RewriteDb* rdb); + AlfPrinter(Env& env, + BaseAlfNodeConverter& atp, + rewriter::RewriteDb* rdb, + uint32_t letThresh = 2); ~AlfPrinter() {} /** - * Print the full proof of assertions => false by pfn. + * Print the full proof pfn. * @param out The output stream. * @param pfn The proof node. + * @param psm The scope mode, which determines whether there are outermost + * scope to process in pfn. If this is the case, we print assume steps. */ - void print(std::ostream& out, std::shared_ptr pfn); + void print(std::ostream& out, + std::shared_ptr pfn, + ProofScopeMode psm = ProofScopeMode::DEFINITIONS_AND_ASSERTIONS); + /** + * Same as above, but with an alf print output channel. + * @param out The output stream. + * @param pfn The proof node. + * @param psm The scope mode. + */ + void print(AlfPrintChannelOut& out, + std::shared_ptr pfn, + ProofScopeMode psm = ProofScopeMode::DEFINITIONS_AND_ASSERTIONS); + /** + * Print the proof, assuming that previous proofs have been printed on this + * printer that have (partially) given the definition of subterms and + * subproofs in pfn. + * @param out The output stream. + * @param pfn The proof node. + */ + void printNext(AlfPrintChannelOut& out, std::shared_ptr pfn); /** * Print proof rewrite rule name r to output stream out @@ -56,6 +82,11 @@ class AlfPrinter : protected EnvObj * rules that corresponds to a RARE rewrite. */ void printDslRule(std::ostream& out, ProofRewriteRule r); + /** + * Get the let binding that is computed by calls to printing terms in this + * class. + */ + LetBinding* getLetBinding(); private: /** Return true if it is possible to trust the topmost application in pfn */ @@ -93,8 +124,15 @@ class AlfPrinter : protected EnvObj /** * Helper for print. Prints the proof node using the print channel out. This * may either write the proof to an output stream or preprocess it. + * + * @param out The output channel to print to. + * @param pn The proof node to print. + * @param addToCache If true, we add (subproofs) of pn to the cache and do + * not print them with this method if they are encounted again. */ - void printProofInternal(AlfPrintChannel* out, const ProofNode* pn); + void printProofInternal(AlfPrintChannel* out, + const ProofNode* pn, + bool addToCache); /** * Called at preorder traversal of proof node pn. Prints (if necessary) to * out. @@ -134,6 +172,11 @@ class AlfPrinter : protected EnvObj * SCOPE proofs. */ context::Context d_passumeCtx; + /** + * The set of proof nodes we have already printed with this class, as + * used by printProofInternal. + */ + context::CDHashSet d_alreadyPrinted; /** Mapping assumed formulas to identifiers */ context::CDHashMap d_passumeMap; /** The (dummy) type used for proof terms */ @@ -146,6 +189,14 @@ class AlfPrinter : protected EnvObj AlfListNodeConverter d_ltproc; /** Pointer to the rewrite database */ rewriter::RewriteDb* d_rdb; + /** The empty vector */ + std::vector d_emptyVec; + /** The let binding */ + LetBinding d_lbind; + /** The let binding we are using (possibly null) */ + LetBinding* d_lbindUse; + /** The letification channel. */ + AlfPrintChannelPre d_aletify; }; } // namespace proof diff --git a/src/proof/lfsc/lfsc_list_sc_node_converter.cpp b/src/proof/lfsc/lfsc_list_sc_node_converter.cpp index 72acf22991f..cd3ba482479 100644 --- a/src/proof/lfsc/lfsc_list_sc_node_converter.cpp +++ b/src/proof/lfsc/lfsc_list_sc_node_converter.cpp @@ -29,7 +29,6 @@ LfscListScNodeConverter::LfscListScNodeConverter( Node LfscListScNodeConverter::postConvert(Node n) { - NodeManager* nm = NodeManager::currentNM(); Kind k = n.getKind(); if (d_isPre) { @@ -63,7 +62,7 @@ Node LfscListScNodeConverter::postConvert(Node n) children.push_back(d_conv.convert(null)); Node sop = mkOperatorFor("nary_elim", children, tn); children.insert(children.begin(), sop); - return nm->mkNode(Kind::APPLY_UF, children); + return d_nm->mkNode(Kind::APPLY_UF, children); } return n; } @@ -86,7 +85,7 @@ Node LfscListScNodeConverter::postConvert(Node n) Assert(k != Kind::UNDEFINED_KIND); // for uniformity, reconstruct in original form std::vector nchildren(n.begin(), n.end()); - n = nm->mkNode(k, nchildren); + n = d_nm->mkNode(k, nchildren); } Node null = d_conv.getNullTerminator(k, tn); AlwaysAssert(!null.isNull()) @@ -106,7 +105,7 @@ Node LfscListScNodeConverter::postConvert(Node n) children.push_back(null); Node sop = mkOperatorFor("nary_concat", children, tn); children.insert(children.begin(), sop); - return nm->mkNode(Kind::APPLY_UF, children); + return d_nm->mkNode(Kind::APPLY_UF, children); } return n; } @@ -115,13 +114,12 @@ Node LfscListScNodeConverter::mkOperatorFor(const std::string& name, const std::vector& children, TypeNode retType) { - NodeManager* nm = NodeManager::currentNM(); std::vector childTypes; for (const Node& c : children) { childTypes.push_back(c.getType()); } - TypeNode ftype = nm->mkFunctionType(childTypes, retType); + TypeNode ftype = d_nm->mkFunctionType(childTypes, retType); return d_conv.mkInternalSymbol(name, ftype); } diff --git a/src/proof/lfsc/lfsc_node_converter.cpp b/src/proof/lfsc/lfsc_node_converter.cpp index f6b41bf2bfe..1791f1ba167 100644 --- a/src/proof/lfsc/lfsc_node_converter.cpp +++ b/src/proof/lfsc/lfsc_node_converter.cpp @@ -89,7 +89,6 @@ Node LfscNodeConverter::preConvert(Node n) Node LfscNodeConverter::postConvert(Node n) { - NodeManager* nm = NodeManager::currentNM(); Kind k = n.getKind(); // we eliminate MATCH at preConvert above Assert(k != Kind::MATCH); @@ -109,10 +108,10 @@ Node LfscNodeConverter::postConvert(Node n) return n; } // bound variable v is (bvar x T) - TypeNode intType = nm->integerType(); - Node x = nm->mkConstInt(Rational(getOrAssignIndexForBVar(n))); + TypeNode intType = d_nm->integerType(); + Node x = d_nm->mkConstInt(Rational(getOrAssignIndexForBVar(n))); Node tc = typeAsNode(convertType(tn)); - TypeNode ftype = nm->mkFunctionType({intType, d_sortType}, tn); + TypeNode ftype = d_nm->mkFunctionType({intType, d_sortType}, tn); Node bvarOp = getSymbolInternal(k, ftype, "bvar"); return mkApplyUf(bvarOp, {x, tc}); } @@ -142,7 +141,7 @@ Node LfscNodeConverter::postConvert(Node n) wi = convert(wi); Trace("lfsc-term-process-debug") << "...converted original for " << wi << std::endl; - TypeNode ftype = nm->mkFunctionType(tn, tn); + TypeNode ftype = d_nm->mkFunctionType(tn, tn); Node skolemOp = getSymbolInternal(k, ftype, "skolem"); return mkApplyUf(skolemOp, {wi}); } @@ -156,10 +155,10 @@ Node LfscNodeConverter::postConvert(Node n) // This case will only apply for terms originating from places with no // proof support. Note it is not added as a declared variable, instead it // is used as (var N T) throughout. - TypeNode intType = nm->integerType(); - TypeNode varType = nm->mkFunctionType({intType, d_sortType}, tn); + TypeNode intType = d_nm->integerType(); + TypeNode varType = d_nm->mkFunctionType({intType, d_sortType}, tn); Node var = mkInternalSymbol("var", varType); - Node index = nm->mkConstInt(Rational(getOrAssignIndexForFVar(n))); + Node index = d_nm->mkConstInt(Rational(getOrAssignIndexForFVar(n))); Node tc = typeAsNode(convertType(tn)); return mkApplyUf(var, {index, tc}); } @@ -175,9 +174,9 @@ Node LfscNodeConverter::postConvert(Node n) const CardinalityConstraint& cc = n.getOperator().getConst(); Node tnn = typeAsNode(convertType(cc.getType())); - Node ub = nm->mkConstInt(Rational(cc.getUpperBound())); - TypeNode tnc = - nm->mkFunctionType({tnn.getType(), ub.getType()}, nm->booleanType()); + Node ub = d_nm->mkConstInt(Rational(cc.getUpperBound())); + TypeNode tnc = d_nm->mkFunctionType({tnn.getType(), ub.getType()}, + d_nm->booleanType()); Node fcard = getSymbolInternal(k, tnc, "fmf.card"); return mkApplyUf(fcard, {tnn, ub}); } @@ -205,13 +204,13 @@ Node LfscNodeConverter::postConvert(Node n) std::vector argTypes; argTypes.push_back(n[0].getType()); argTypes.push_back(n[1].getType()); - TypeNode tnh = nm->mkFunctionType(argTypes, tn); + TypeNode tnh = d_nm->mkFunctionType(argTypes, tn); Node hconstf = getSymbolInternal(k, tnh, "apply"); return mkApplyUf(hconstf, {n[0], n[1]}); } else if (k == Kind::CONST_RATIONAL || k == Kind::CONST_INTEGER) { - TypeNode tnv = nm->mkFunctionType(tn, tn); + TypeNode tnv = d_nm->mkFunctionType(tn, tn); Node rconstf; Node arg; Rational r = n.getConst(); @@ -221,8 +220,8 @@ Node LfscNodeConverter::postConvert(Node n) if (r.sgn() == -1) { // use LFSC syntax for mpz negation - Node mpzn = getSymbolInternal(k, nm->mkFunctionType(tn, tn), "~"); - arg = mkApplyUf(mpzn, {nm->mkConstInt(r.abs())}); + Node mpzn = getSymbolInternal(k, d_nm->mkFunctionType(tn, tn), "~"); + arg = mkApplyUf(mpzn, {d_nm->mkConstInt(r.abs())}); } else { @@ -241,7 +240,7 @@ Node LfscNodeConverter::postConvert(Node n) // negative (~ n/m) if (r.sgn() == -1) { - Node mpzn = getSymbolInternal(k, nm->mkFunctionType(tn, tn), "~"); + Node mpzn = getSymbolInternal(k, d_nm->mkFunctionType(tn, tn), "~"); arg = mkApplyUf(mpzn, {arg}); } } @@ -249,8 +248,8 @@ Node LfscNodeConverter::postConvert(Node n) } else if (k == Kind::CONST_BITVECTOR) { - TypeNode btn = nm->booleanType(); - TypeNode tnv = nm->mkFunctionType(btn, tn); + TypeNode btn = d_nm->booleanType(); + TypeNode tnv = d_nm->mkFunctionType(btn, tn); BitVector bv = n.getConst(); Node ret = convertBitVector(bv); Node bconstf = getSymbolInternal(k, tnv, "bv"); @@ -260,20 +259,20 @@ Node LfscNodeConverter::postConvert(Node n) { BitVector s, e, i; n.getConst().getIEEEBitvectors(s, e, i); - Node sn = convert(nm->mkConst(s)); - Node en = convert(nm->mkConst(e)); - Node in = convert(nm->mkConst(i)); + Node sn = convert(d_nm->mkConst(s)); + Node en = convert(d_nm->mkConst(e)); + Node in = convert(d_nm->mkConst(i)); TypeNode tnv = - nm->mkFunctionType({sn.getType(), en.getType(), in.getType()}, tn); + d_nm->mkFunctionType({sn.getType(), en.getType(), in.getType()}, tn); Node bconstf = getSymbolInternal(k, tnv, "fp"); return mkApplyUf(bconstf, {sn, en, in}); } else if (k == Kind::CONST_FINITE_FIELD) { const FiniteFieldValue& ffv = n.getConst(); - Node v = convert(nm->mkConstInt(ffv.getValue())); - Node fs = convert(nm->mkConstInt(ffv.getFieldSize())); - TypeNode tnv = nm->mkFunctionType({v.getType(), fs.getType()}, tn); + Node v = convert(d_nm->mkConstInt(ffv.getValue())); + Node fs = convert(d_nm->mkConstInt(ffv.getFieldSize())); + TypeNode tnv = d_nm->mkFunctionType({v.getType(), fs.getType()}, tn); Node ffconstf = getSymbolInternal(k, tnv, "ff.value"); return mkApplyUf(ffconstf, {v, fs}); } @@ -294,34 +293,35 @@ Node LfscNodeConverter::postConvert(Node n) Node ret = postConvert(getNullTerminator(Kind::STRING_CONCAT, tn)); for (size_t i = 0, size = charVec.size(); i < size; i++) { - ret = nm->mkNode(Kind::STRING_CONCAT, charVec[i], ret); + ret = d_nm->mkNode(Kind::STRING_CONCAT, charVec[i], ret); } return ret; } else if (k == Kind::CONST_SEQUENCE) { const std::vector& charVec = n.getConst().getVec(); - TypeNode etype = nm->mkFunctionType(d_sortType, tn); + TypeNode etype = d_nm->mkFunctionType(d_sortType, tn); Node ret = getSymbolInternal(k, etype, "seq.empty"); ret = mkApplyUf(ret, {typeAsNode(convertType(tn))}); std::vector vecu; for (size_t i = 0, size = charVec.size(); i < size; i++) { - Node u = nm->mkNode(Kind::SEQ_UNIT, postConvert(charVec[size - (i + 1)])); + Node u = + d_nm->mkNode(Kind::SEQ_UNIT, postConvert(charVec[size - (i + 1)])); if (size == 1) { // singleton case return u; } - ret = nm->mkNode(Kind::STRING_CONCAT, u, ret); + ret = d_nm->mkNode(Kind::STRING_CONCAT, u, ret); } return ret; } else if (k == Kind::STORE_ALL) { Node t = typeAsNode(convertType(tn)); - TypeNode caRetType = nm->mkFunctionType(tn.getArrayConstituentType(), tn); - TypeNode catype = nm->mkFunctionType(d_sortType, caRetType); + TypeNode caRetType = d_nm->mkFunctionType(tn.getArrayConstituentType(), tn); + TypeNode catype = d_nm->mkFunctionType(d_sortType, caRetType); Node bconstf = getSymbolInternal(k, catype, "array_const"); Node f = mkApplyUf(bconstf, {t}); ArrayStoreAll storeAll = n.getConst(); @@ -344,7 +344,7 @@ Node LfscNodeConverter::postConvert(Node n) || k == Kind::BAG_EMPTY) { Node t = typeAsNode(convertType(tn)); - TypeNode etype = nm->mkFunctionType(d_sortType, tn); + TypeNode etype = d_nm->mkFunctionType(d_sortType, tn); Node ef = getSymbolInternal( k, etype, @@ -383,27 +383,27 @@ Node LfscNodeConverter::postConvert(Node n) else if (k == Kind::REGEXP_LOOP) { // ((_ re.loop n1 n2) t) is ((re.loop n1 n2) t) - TypeNode intType = nm->integerType(); + TypeNode intType = d_nm->integerType(); TypeNode relType = - nm->mkFunctionType({intType, intType}, nm->mkFunctionType(tn, tn)); + d_nm->mkFunctionType({intType, intType}, d_nm->mkFunctionType(tn, tn)); Node rop = getSymbolInternal( k, relType, printer::smt2::Smt2Printer::smtKindString(k)); RegExpLoop op = n.getOperator().getConst(); - Node n1 = nm->mkConstInt(Rational(op.d_loopMinOcc)); - Node n2 = nm->mkConstInt(Rational(op.d_loopMaxOcc)); + Node n1 = d_nm->mkConstInt(Rational(op.d_loopMinOcc)); + Node n2 = d_nm->mkConstInt(Rational(op.d_loopMaxOcc)); return mkApplyUf(mkApplyUf(rop, {n1, n2}), {n[0]}); } else if (k == Kind::BITVECTOR_FROM_BOOLS) { - TypeNode btn = nm->booleanType(); + TypeNode btn = d_nm->booleanType(); // (from_bools t1 ... tn) is // (from_bools t1 (from_bools t2 ... (from_bools tn emptybv))) // where notice that each from_bools has a different type Node curr = getNullTerminator(Kind::BITVECTOR_CONCAT, tn); for (size_t i = 0, nchild = n.getNumChildren(); i < nchild; ++i) { - TypeNode bvt = nm->mkBitVectorType(i + 1); - TypeNode ftype = nm->mkFunctionType({btn, curr.getType()}, bvt); + TypeNode bvt = d_nm->mkBitVectorType(i + 1); + TypeNode ftype = d_nm->mkFunctionType({btn, curr.getType()}, bvt); Node bbt = getSymbolInternal(k, ftype, "from_bools"); curr = mkApplyUf(bbt, {n[nchild - (i + 1)], curr}); } @@ -412,7 +412,7 @@ Node LfscNodeConverter::postConvert(Node n) else if (k == Kind::SEP_NIL) { Node tnn = typeAsNode(convertType(tn)); - TypeNode ftype = nm->mkFunctionType(d_sortType, tn); + TypeNode ftype = d_nm->mkFunctionType(d_sortType, tn); Node s = getSymbolInternal(k, ftype, "sep.nil"); return mkApplyUf(s, {tnn}); } @@ -427,14 +427,14 @@ Node LfscNodeConverter::postConvert(Node n) { // DISTINCT(x1,...,xn) ---> // AND(DISTINCT(x1,x2), AND(,..., AND(,..,DISTINCT(x_{n-1},x_n)))) - Node ret = nm->mkNode(k, children[0], children[1]); + Node ret = d_nm->mkNode(k, children[0], children[1]); for (unsigned i = 0; i < nchild; i++) for (unsigned j = i + 1; j < nchild; j++) { if (i != 0 && j != 1) { - ret = nm->mkNode( - Kind::AND, ret, nm->mkNode(k, children[i], children[j])); + ret = d_nm->mkNode( + Kind::AND, ret, d_nm->mkNode(k, children[i], children[j])); } } Trace("lfsc-term-process-debug") << "n: " << n << std::endl @@ -484,13 +484,13 @@ Node LfscNodeConverter::postConvert(Node n) // avoid debug failures. TypeNode tn1 = children[i].getType(); TypeNode tn2 = ret.getType(); - TypeNode ftype = nm->mkFunctionType({tn1, tn2}, tn); + TypeNode ftype = d_nm->mkFunctionType({tn1, tn2}, tn); Node opc = getSymbolInternal(k, ftype, arithOpName.str()); ret = mkApplyUf(opc, {children[i], ret}); } else { - ret = nm->mkNode(k, children[i], ret); + ret = d_nm->mkNode(k, children[i], ret); } } Trace("lfsc-term-process-debug") @@ -502,7 +502,6 @@ Node LfscNodeConverter::postConvert(Node n) Node LfscNodeConverter::mkApplyUf(Node op, const std::vector& args) const { - NodeManager * nm = NodeManager::currentNM(); std::vector aargs; if (op.isVar()) { @@ -515,11 +514,11 @@ Node LfscNodeConverter::mkApplyUf(Node op, const std::vector& args) const options::ioutils::applyOutputLanguage(ss, Language::LANG_SMTLIB_V2_6); options::ioutils::applyDagThresh(ss, 0); ss << op; - Node opv = nm->mkRawSymbol(ss.str(), op.getType()); + Node opv = d_nm->mkRawSymbol(ss.str(), op.getType()); aargs.push_back(opv); } aargs.insert(aargs.end(), args.begin(), args.end()); - return nm->mkNode(Kind::APPLY_UF, aargs); + return d_nm->mkNode(Kind::APPLY_UF, aargs); } TypeNode LfscNodeConverter::preConvertType(TypeNode tn) @@ -536,7 +535,6 @@ TypeNode LfscNodeConverter::preConvertType(TypeNode tn) TypeNode LfscNodeConverter::postConvertType(TypeNode tn) { - NodeManager* nm = NodeManager::currentNM(); TypeNode cur = tn; Node tnn; Kind k = tn.getKind(); @@ -559,21 +557,21 @@ TypeNode LfscNodeConverter::postConvertType(TypeNode tn) std::vector aargs; aargs.push_back(*it); aargs.push_back(cur); - cur = nm->mkSort(d_arrow, aargs); + cur = d_nm->mkSort(d_arrow, aargs); tnn = mkApplyUf(arrown, {typeAsNode(*it), tnn}); } } else if (k == Kind::BITVECTOR_TYPE) { tnn = d_typeKindToNodeCons[k]; - Node w = nm->mkConstInt(Rational(tn.getBitVectorSize())); + Node w = d_nm->mkConstInt(Rational(tn.getBitVectorSize())); tnn = mkApplyUf(tnn, {w}); } else if (k == Kind::FLOATINGPOINT_TYPE) { tnn = d_typeKindToNodeCons[k]; - Node e = nm->mkConstInt(Rational(tn.getFloatingPointExponentSize())); - Node s = nm->mkConstInt(Rational(tn.getFloatingPointSignificandSize())); + Node e = d_nm->mkConstInt(Rational(tn.getFloatingPointExponentSize())); + Node s = d_nm->mkConstInt(Rational(tn.getFloatingPointSignificandSize())); tnn = mkApplyUf(tnn, {e, s}); } else if (k == Kind::TUPLE_TYPE) @@ -592,14 +590,14 @@ TypeNode LfscNodeConverter::postConvertType(TypeNode tn) convTypes.push_back(tnc); targs.push_back(typeAsNode(tnc)); } - TypeNode ftype = nm->mkFunctionType(types, d_sortType); + TypeNode ftype = d_nm->mkFunctionType(types, d_sortType); // must distinguish by arity std::stringstream ss; ss << "Tuple_" << nargs; tnn = mkApplyUf(getSymbolInternal(k, ftype, ss.str()), targs); // we are changing its name, we must make a sort constructor - cur = nm->mkSortConstructor(ss.str(), nargs); - cur = nm->mkSort(cur, convTypes); + cur = d_nm->mkSortConstructor(ss.str(), nargs); + cur = d_nm->mkSort(cur, convTypes); } else { @@ -620,13 +618,14 @@ TypeNode LfscNodeConverter::postConvertType(TypeNode tn) { std::string s = getNameForUserNameOfInternal(tn.getId(), ss.str()); tnn = getSymbolInternal(k, d_sortType, s, false); - cur = nm->mkSortConstructor(s, tn.getUninterpretedSortConstructorArity()); + cur = + d_nm->mkSortConstructor(s, tn.getUninterpretedSortConstructorArity()); } else if (tn.isUninterpretedSort() || tn.isDatatype()) { std::string s = getNameForUserNameOfInternal(tn.getId(), ss.str()); tnn = getSymbolInternal(k, d_sortType, s, false); - cur = nm->mkSort(s); + cur = d_nm->mkSort(s); } else { @@ -652,7 +651,7 @@ TypeNode LfscNodeConverter::postConvertType(TypeNode tn) // erase first child, which repeats the datatype targs.erase(targs.begin(), targs.begin() + 1); types.erase(types.begin(), types.begin() + 1); - TypeNode ftype = nm->mkFunctionType(types, d_sortType); + TypeNode ftype = d_nm->mkFunctionType(types, d_sortType); // the operator has been converted; it is no longer a datatype, thus // we must print to get its name. std::stringstream ss; @@ -667,13 +666,13 @@ TypeNode LfscNodeConverter::postConvertType(TypeNode tn) // should be erased from children. targs.erase(targs.begin(), targs.begin() + 1); types.erase(types.begin(), types.begin() + 1); - TypeNode ftype = nm->mkFunctionType(types, d_sortType); + TypeNode ftype = d_nm->mkFunctionType(types, d_sortType); std::string name = tn.getUninterpretedSortConstructor().getName(); op = getSymbolInternal(k, ftype, name, false); } else if (k == Kind::NULLABLE_TYPE) { - TypeNode ftype = nm->mkFunctionType(d_sortType, d_sortType); + TypeNode ftype = d_nm->mkFunctionType(d_sortType, d_sortType); op = getSymbolInternal(k, ftype, "Nullable", false); } else @@ -792,8 +791,7 @@ bool LfscNodeConverter::shouldTraverse(Node n) Node LfscNodeConverter::maybeMkSkolemFun(Node k, bool macroApply) { - NodeManager* nm = NodeManager::currentNM(); - SkolemManager* sm = nm->getSkolemManager(); + SkolemManager* sm = d_nm->getSkolemManager(); SkolemId sfi = SkolemId::NONE; Node cacheVal; TypeNode tn = k.getType(); @@ -804,10 +802,10 @@ Node LfscNodeConverter::maybeMkSkolemFun(Node k, bool macroApply) // a skolem corresponding to a regular expression unfolding component // should print as (skolem_re_unfold_pos t R n) where the skolem is the // n^th component for the unfolding of (str.in_re t R). - TypeNode strType = nm->stringType(); - TypeNode reType = nm->regExpType(); - TypeNode intType = nm->integerType(); - TypeNode reut = nm->mkFunctionType({strType, reType, intType}, strType); + TypeNode strType = d_nm->stringType(); + TypeNode reType = d_nm->regExpType(); + TypeNode intType = d_nm->integerType(); + TypeNode reut = d_nm->mkFunctionType({strType, reType, intType}, strType); Node sk = getSymbolInternal(k.getKind(), reut, "skolem_re_unfold_pos"); Assert(!cacheVal.isNull() && cacheVal.getKind() == Kind::SEXPR && cacheVal.getNumChildren() == 3); @@ -833,8 +831,8 @@ Node LfscNodeConverter::mkInternalSymbol(const std::string& name, bool useRawSym) { // use raw symbol so that it is never quoted - NodeManager* nm = NodeManager::currentNM(); - Node sym = useRawSym ? nm->mkRawSymbol(name, tn) : nm->mkBoundVar(name, tn); + Node sym = + useRawSym ? d_nm->mkRawSymbol(name, tn) : d_nm->mkBoundVar(name, tn); d_symbols.insert(sym); return sym; } @@ -867,7 +865,6 @@ Node LfscNodeConverter::getSymbolInternal(Kind k, void LfscNodeConverter::getCharVectorInternal(Node c, std::vector& chars) { Assert(c.getKind() == Kind::CONST_STRING); - NodeManager* nm = NodeManager::currentNM(); const std::vector& vec = c.getConst().getVec(); if (vec.size() == 0) { @@ -875,20 +872,19 @@ void LfscNodeConverter::getCharVectorInternal(Node c, std::vector& chars) chars.push_back(ec); return; } - TypeNode tnc = nm->mkFunctionType(nm->integerType(), c.getType()); + TypeNode tnc = d_nm->mkFunctionType(d_nm->integerType(), c.getType()); Node aconstf = getSymbolInternal(Kind::CONST_STRING, tnc, "char"); for (unsigned i = 0, size = vec.size(); i < size; i++) { - Node cc = mkApplyUf(aconstf, {nm->mkConstInt(Rational(vec[i]))}); + Node cc = mkApplyUf(aconstf, {d_nm->mkConstInt(Rational(vec[i]))}); chars.push_back(cc); } } Node LfscNodeConverter::convertBitVector(const BitVector& bv) { - NodeManager* nm = NodeManager::currentNM(); - TypeNode btn = nm->booleanType(); - TypeNode btnv = nm->mkFunctionType({btn, btn}, btn); + TypeNode btn = d_nm->booleanType(); + TypeNode btnv = d_nm->mkFunctionType({btn, btn}, btn); size_t w = bv.getSize(); Node ret = getSymbolInternal(Kind::CONST_BITVECTOR, btn, "bvn"); Node b0 = getSymbolInternal(Kind::CONST_BITVECTOR, btn, "b0"); @@ -904,7 +900,6 @@ Node LfscNodeConverter::convertBitVector(const BitVector& bv) Node LfscNodeConverter::getNullTerminator(Kind k, TypeNode tn) { - NodeManager* nm = NodeManager::currentNM(); Node nullTerm; switch (k) { @@ -918,7 +913,7 @@ Node LfscNodeConverter::getNullTerminator(Kind k, TypeNode tn) // the null terminator of bitvector concat is a dummy variable of // bit-vector type with zero width, regardless of the type of the overall // concat. - TypeNode bvz = nm->mkBitVectorType(0); + TypeNode bvz = d_nm->mkBitVectorType(0); nullTerm = getSymbolInternal(k, bvz, "emptybv"); } break; @@ -948,7 +943,6 @@ Node LfscNodeConverter::getOperatorOfTerm(Node n, bool macroApply) { Assert(n.hasOperator()); Assert(!n.isClosure()); - NodeManager* nm = NodeManager::currentNM(); Kind k = n.getKind(); std::stringstream opName; Trace("lfsc-term-process-debug2") @@ -967,7 +961,7 @@ Node LfscNodeConverter::getOperatorOfTerm(Node n, bool macroApply) { Assert(indices.size() == 1); // must convert to user name - TypeNode intType = nm->integerType(); + TypeNode intType = d_nm->integerType(); indices[0] = getSymbolInternal(k, intType, getNameForUserNameOf(indices[0])); } @@ -985,7 +979,7 @@ Node LfscNodeConverter::getOperatorOfTerm(Node n, bool macroApply) TypeNode ftype = n.getType(); if (!argTypes.empty()) { - ftype = nm->mkFunctionType(argTypes, ftype); + ftype = d_nm->mkFunctionType(argTypes, ftype); } Node ret; if (GenericOp::isIndexedOperatorKind(k)) @@ -997,7 +991,7 @@ Node LfscNodeConverter::getOperatorOfTerm(Node n, bool macroApply) } if (!itypes.empty()) { - ftype = nm->mkFunctionType(itypes, ftype); + ftype = d_nm->mkFunctionType(itypes, ftype); } if (!macroApply) { @@ -1087,7 +1081,7 @@ Node LfscNodeConverter::getOperatorOfTerm(Node n, bool macroApply) argTypes.resize(2); } TypeNode tn = n.getType(); - TypeNode ftype = nm->mkFunctionType(argTypes, tn); + TypeNode ftype = d_nm->mkFunctionType(argTypes, tn); // most functions are called f_X where X is the SMT-LIB name, if we are // getting the macroApply variant, then we don't prefix with `f_`. if (!macroApply) @@ -1117,13 +1111,12 @@ Node LfscNodeConverter::getOperatorOfClosure(Node q, bool macroApply, bool isPartial) { - NodeManager* nm = NodeManager::currentNM(); TypeNode retType = isPartial ? q[1].getType() : q.getType(); - TypeNode bodyType = nm->mkFunctionType(q[1].getType(), retType); + TypeNode bodyType = d_nm->mkFunctionType(q[1].getType(), retType); // We permit non-flat function types here // intType is used here for variable indices - TypeNode intType = nm->integerType(); - TypeNode ftype = nm->mkFunctionType({intType, d_sortType}, bodyType); + TypeNode intType = d_nm->integerType(); + TypeNode ftype = d_nm->mkFunctionType({intType, d_sortType}, bodyType); Kind k = q.getKind(); std::stringstream opName; if (!macroApply) @@ -1136,8 +1129,7 @@ Node LfscNodeConverter::getOperatorOfClosure(Node q, Node LfscNodeConverter::getOperatorOfBoundVar(Node cop, Node v) { - NodeManager* nm = NodeManager::currentNM(); - Node x = nm->mkConstInt(Rational(getOrAssignIndexForBVar(v))); + Node x = d_nm->mkConstInt(Rational(getOrAssignIndexForBVar(v))); Node tc = typeAsNode(convertType(v.getType())); return mkApplyUf(cop, {x, tc}); } diff --git a/src/proof/lfsc/lfsc_post_processor.cpp b/src/proof/lfsc/lfsc_post_processor.cpp index 8b570e100e4..04139e0539a 100644 --- a/src/proof/lfsc/lfsc_post_processor.cpp +++ b/src/proof/lfsc/lfsc_post_processor.cpp @@ -59,7 +59,7 @@ bool LfscProofPostprocessCallback::update(Node res, Trace("lfsc-pp") << "LfscProofPostprocessCallback::update: " << id << std::endl; Trace("lfsc-pp-debug") << "...proves " << res << std::endl; - NodeManager* nm = NodeManager::currentNM(); + NodeManager* nm = nodeManager(); Assert(id != ProofRule::LFSC_RULE); switch (id) @@ -114,7 +114,7 @@ bool LfscProofPostprocessCallback::update(Node res, size_t ii = (nargs - 1) - i; // Use a dummy conclusion for what LAMBDA proves, since there is no // FOL representation for its type. - Node fconc = mkDummyPredicate(); + Node fconc = mkDummyPredicate(nm); addLfscRule(cdp, fconc, {curr}, LfscRule::LAMBDA, {args[ii]}); // we use a chained implication (=> F1 ... (=> Fn C)) which avoids // aliasing. @@ -478,7 +478,7 @@ void LfscProofPostprocessCallback::updateCong(Node res, } Node curL = currEq[0]; Node curR = currEq[1]; - NodeManager* nm = NodeManager::currentNM(); + NodeManager* nm = nodeManager(); for (; i < nchildren; i++) { // CONG rules for each child @@ -507,7 +507,7 @@ void LfscProofPostprocessCallback::addLfscRule( const std::vector& args) { std::vector largs; - largs.push_back(mkLfscRuleNode(lr)); + largs.push_back(mkLfscRuleNode(nodeManager(), lr)); largs.push_back(conc); largs.insert(largs.end(), args.begin(), args.end()); cdp->addStep(conc, ProofRule::LFSC_RULE, children, largs); @@ -517,7 +517,7 @@ Node LfscProofPostprocessCallback::mkChain(Kind k, const std::vector& children) { Assert(!children.empty()); - NodeManager* nm = NodeManager::currentNM(); + NodeManager* nm = nodeManager(); size_t nchildren = children.size(); size_t i = 0; // do we have a null terminator? If so, we start with it. @@ -535,9 +535,8 @@ Node LfscProofPostprocessCallback::mkChain(Kind k, return ret; } -Node LfscProofPostprocessCallback::mkDummyPredicate() +Node LfscProofPostprocessCallback::mkDummyPredicate(NodeManager* nm) { - NodeManager* nm = NodeManager::currentNM(); return nm->mkBoundVar(nm->booleanType()); } diff --git a/src/proof/lfsc/lfsc_post_processor.h b/src/proof/lfsc/lfsc_post_processor.h index 7e913fc49fb..e68851fb0c7 100644 --- a/src/proof/lfsc/lfsc_post_processor.h +++ b/src/proof/lfsc/lfsc_post_processor.h @@ -89,7 +89,7 @@ class LfscProofPostprocessCallback : protected EnvObj, CDProof* cdp, Node startOp); /** Make fresh dummy predicate */ - static Node mkDummyPredicate(); + static Node mkDummyPredicate(NodeManager* nm); }; /** diff --git a/src/proof/lfsc/lfsc_util.cpp b/src/proof/lfsc/lfsc_util.cpp index 2fbc9112686..643ceae13fc 100644 --- a/src/proof/lfsc/lfsc_util.cpp +++ b/src/proof/lfsc/lfsc_util.cpp @@ -69,10 +69,9 @@ LfscRule getLfscRule(Node n) return lr; } -Node mkLfscRuleNode(LfscRule r) +Node mkLfscRuleNode(NodeManager* nm, LfscRule r) { - return NodeManager::currentNM()->mkConstInt( - Rational(static_cast(r))); + return nm->mkConstInt(Rational(static_cast(r))); } bool LfscProofLetifyTraverseCallback::shouldTraverse(const ProofNode* pn) diff --git a/src/proof/lfsc/lfsc_util.h b/src/proof/lfsc/lfsc_util.h index 4f41095185b..3808953bc15 100644 --- a/src/proof/lfsc/lfsc_util.h +++ b/src/proof/lfsc/lfsc_util.h @@ -96,7 +96,7 @@ LfscRule getLfscRule(Node n); /** Get LFSC rule from a node, return true if success and store in lr */ bool getLfscRule(Node n, LfscRule& lr); /** Make node for LFSC rule */ -Node mkLfscRuleNode(LfscRule r); +Node mkLfscRuleNode(NodeManager* nm, LfscRule r); /** Helper class used for letifying LFSC proofs. */ class LfscProofLetifyTraverseCallback : public ProofLetifyTraverseCallback diff --git a/src/smt/print_benchmark.cpp b/src/smt/print_benchmark.cpp index 687f6e01f61..463c2b26be6 100644 --- a/src/smt/print_benchmark.cpp +++ b/src/smt/print_benchmark.cpp @@ -41,15 +41,25 @@ void PrintBenchmark::printDeclarationsFrom(std::ostream& outDecl, const std::vector& defs, const std::vector& terms) { - std::unordered_set types; + std::unordered_set unorderedTypes; std::unordered_set typeVisited; for (const Node& a : defs) { - expr::getTypes(a, types, typeVisited); + expr::getTypes(a, unorderedTypes, typeVisited); } for (const Node& a : terms) { - expr::getTypes(a, types, typeVisited); + expr::getTypes(a, unorderedTypes, typeVisited); + } + std::vector types{unorderedTypes.begin(), unorderedTypes.end()}; + if (d_sorted) + { + // We want to print declarations in a deterministic order, independent of + // the implementation of data structures. Hence, we insert into a vector + // and reorder. Note that collecting the types in an std::unordered_map, + // then inserting them into a vector and sorting the vector is faster than + // immediately using an std::set instead. + std::sort(types.begin(), types.end()); } // print the declared types first std::unordered_set alreadyPrintedDeclSorts; @@ -120,12 +130,33 @@ void PrintBenchmark::printDeclarationsFrom(std::ostream& outDecl, { std::vector recDefs; std::vector ordinaryDefs; - std::unordered_set syms; - getConnectedDefinitions( - s, recDefs, ordinaryDefs, syms, defMap, alreadyPrintedDef, visited); + std::unordered_set unorderedSyms; + getConnectedDefinitions(s, + recDefs, + ordinaryDefs, + unorderedSyms, + defMap, + alreadyPrintedDef, + visited); + std::vector syms{unorderedSyms.begin(), unorderedSyms.end()}; + if (d_sorted) + { + // We want to print declarations in a deterministic order, independent of + // the implementation of data structures. Hence, we insert into a vector + // and reorder. Note that collecting `syms` in an std::unordered_map, + // then inserting them into a vector and sorting the vector is faster than + // immediately using an std::set instead. + std::sort(syms.begin(), syms.end()); + } // print the declarations that are encountered for the first time in this // block printDeclaredFuns(outDecl, syms, alreadyPrintedDecl); + if (d_sorted) + { + // Sort ordinary and recursive definitions for deterministic order. + std::sort(recDefs.begin(), recDefs.end()); + std::sort(ordinaryDefs.begin(), ordinaryDefs.end()); + } // print the ordinary definitions for (const Node& f : ordinaryDefs) { @@ -163,13 +194,24 @@ void PrintBenchmark::printDeclarationsFrom(std::ostream& outDecl, } // print the remaining declared symbols - std::unordered_set syms; + std::unordered_set unorderedSyms; for (const Node& a : terms) { - expr::getSymbols(a, syms, visited); + expr::getSymbols(a, unorderedSyms, visited); + } + std::vector syms{unorderedSyms.begin(), unorderedSyms.end()}; + if (d_sorted) + { + // We want to print declarations in a deterministic order, independent of + // the implementation of data structures. Hence, we insert into a vector + // and reorder. Note that collecting `syms` in an std::unordered_map, + // then inserting them into a vector and sorting the vector is faster than + // immediately using an std::set instead. + std::sort(syms.begin(), syms.end()); } printDeclaredFuns(outDecl, syms, alreadyPrintedDecl); } + void PrintBenchmark::printAssertions(std::ostream& out, const std::vector& defs, const std::vector& assertions) @@ -196,7 +238,7 @@ void PrintBenchmark::printAssertions(std::ostream& out, } void PrintBenchmark::printDeclaredFuns(std::ostream& out, - const std::unordered_set& funs, + const std::vector& funs, std::unordered_set& alreadyPrinted) { BenchmarkNoPrintAttribute bnpa; diff --git a/src/smt/print_benchmark.h b/src/smt/print_benchmark.h index d1ffe439f5d..0955071431c 100644 --- a/src/smt/print_benchmark.h +++ b/src/smt/print_benchmark.h @@ -39,8 +39,16 @@ namespace smt { class PrintBenchmark { public: - PrintBenchmark(const Printer* p, NodeConverter* c = nullptr) - : d_printer(p), d_converter(c) + /** + * Constructor. + * @param p The associated printer. + * @param sorted True if declarations should be sorted wrt node id. + * @param c The associated node converter. + */ + PrintBenchmark(const Printer* p, + bool sorted = true, + NodeConverter* c = nullptr) + : d_printer(p), d_sorted(sorted), d_converter(c) { } /** @@ -98,7 +106,7 @@ class PrintBenchmark * include what was printed */ void printDeclaredFuns(std::ostream& out, - const std::unordered_set& funs, + const std::vector& funs, std::unordered_set& processed); /** * Get the connected types. This traverses subfield types of datatypes and @@ -150,6 +158,8 @@ class PrintBenchmark * individual commands. */ const Printer* d_printer; + /* True if declarations should be sorted wrt node id. */ + bool d_sorted; /** (Optional) node converter */ NodeConverter* d_converter; }; diff --git a/src/smt/proof_manager.h b/src/smt/proof_manager.h index ed137c394f4..82dcac5b1e4 100644 --- a/src/smt/proof_manager.h +++ b/src/smt/proof_manager.h @@ -34,13 +34,6 @@ namespace rewriter { class RewriteDb; } -namespace smt { - -class Assertions; -class SmtSolver; -class PreprocessProofGenerator; -class ProofPostprocess; - /** Modes for global Proof scopes introducing definitions and assertions. */ enum class ProofScopeMode { @@ -52,6 +45,13 @@ enum class ProofScopeMode DEFINITIONS_AND_ASSERTIONS, }; +namespace smt { + +class Assertions; +class SmtSolver; +class PreprocessProofGenerator; +class ProofPostprocess; + /** * This class is responsible for managing the proof output of SolverEngine, as * well as setting up the global proof checker and proof node manager. diff --git a/src/smt/solver_engine.cpp b/src/smt/solver_engine.cpp index ff28c4b19d8..a226b4c7c4f 100644 --- a/src/smt/solver_engine.cpp +++ b/src/smt/solver_engine.cpp @@ -1340,10 +1340,7 @@ void SolverEngine::blockModel(modes::BlockModelsMode mode) void SolverEngine::blockModelValues(const std::vector& exprs) { Trace("smt") << "SMT blockModelValues()" << endl; - for (const Node& e : exprs) - { - ensureWellFormedTerm(e, "block model values"); - } + ensureWellFormedTerms(exprs, "block model values"); TheoryModel* m = getAvailableModel("block model values"); @@ -1397,21 +1394,27 @@ std::vector SolverEngine::getAssertionsInternal() const const Options& SolverEngine::options() const { return d_env->getOptions(); } +bool SolverEngine::isWellFormedTerm(const Node& n) const +{ + // Well formed if it does not have free variables. Note that n may have + // variable shadowing. + return !expr::hasFreeVar(n); +} + void SolverEngine::ensureWellFormedTerm(const Node& n, const std::string& src) const { if (Configuration::isAssertionBuild()) { - // Must rewrite before checking for free variables - Node nr = d_env->getRewriter()->rewrite(n); // Don't check for shadowing here, since shadowing may occur from API - // users, including the smt2 parser. + // users, including the smt2 parser. We don't need to rewrite since + // getFreeVariables is robust to variable shadowing. std::unordered_set fvs; - expr::getFreeVariables(nr, fvs); + expr::getFreeVariables(n, fvs); if (!fvs.empty()) { std::stringstream se; - se << "Cannot process term " << nr << " with "; + se << "Cannot process term " << n << " with "; se << "free variables: " << fvs << std::endl; throw ModalException(se.str().c_str()); } diff --git a/src/smt/solver_engine.h b/src/smt/solver_engine.h index 1358bd93679..47a564e8314 100644 --- a/src/smt/solver_engine.h +++ b/src/smt/solver_engine.h @@ -1032,6 +1032,14 @@ class CVC5_EXPORT SolverEngine */ const Options& options() const; + /** + * Return true if the given term is a valid closed term, which can be used as + * an argument to, e.g., assert, get-value, block-model-values, etc. + * + * @param n The node to check + * @return true if n is a well formed term. + */ + bool isWellFormedTerm(const Node& n) const; /** * Check that the given term is a valid closed term, which can be used as an * argument to, e.g., assert, get-value, block-model-values, etc. diff --git a/src/theory/quantifiers/inst_strategy_mbqi.cpp b/src/theory/quantifiers/inst_strategy_mbqi.cpp index a938b332d89..e32dfadc200 100644 --- a/src/theory/quantifiers/inst_strategy_mbqi.cpp +++ b/src/theory/quantifiers/inst_strategy_mbqi.cpp @@ -180,13 +180,13 @@ void InstStrategyMbqi::process(Node q) for (const Node& k : skolems.d_subs) { TypeNode tn = k.getType(); - itk = freshVarType.find(tn); - if (itk == freshVarType.end()) + if (!tn.isUninterpretedSort()) { // not an uninterpreted sort, continue continue; } - if (itk->second.empty()) + itk = freshVarType.find(tn); + if (itk == freshVarType.end() || itk->second.empty()) { Trace("mbqi") << "warning: failed to get vars for type " << tn << std::endl; @@ -350,14 +350,6 @@ Node InstStrategyMbqi::convertToQuery( { cmap[cur] = cur; } - else if (ck == Kind::UNINTERPRETED_SORT_VALUE) - { - // return the fresh variable for this term - Node k = sm->mkPurifySkolem(cur); - freshVarType[cur.getType()].insert(k); - cmap[cur] = k; - continue; - } else if (ck == Kind::CONST_SEQUENCE || ck == Kind::FUNCTION_ARRAY_CONST || cur.isVar()) { @@ -408,6 +400,16 @@ Node InstStrategyMbqi::convertToQuery( } else if (d_nonClosedKinds.find(ck) != d_nonClosedKinds.end()) { + // if its a constant, we can continue, we will assume it is distinct + // from all others of its type + if (cur.isConst()) + { + // return the fresh variable for this term + Node k = sm->mkPurifySkolem(cur); + freshVarType[cur.getType()].insert(k); + cmap[cur] = k; + continue; + } // if this is a bad kind, fail immediately return Node::null(); } diff --git a/test/regress/cli/CMakeLists.txt b/test/regress/cli/CMakeLists.txt index 868aceb3151..60a3c1657b5 100644 --- a/test/regress/cli/CMakeLists.txt +++ b/test/regress/cli/CMakeLists.txt @@ -1213,6 +1213,7 @@ set(regress_0_tests regress0/parser/shadow_fun_symbol_nirat.smt2 regress0/parser/stdout-diag.smt2 regress0/parser/strict-numeral.smt2 + regress0/parser/lenient-numeral.smt2 regress0/parser/strings20.smt2 regress0/parser/strings25.smt2 regress0/parser/to_fp.smt2 diff --git a/test/regress/cli/regress0/parser/lenient-numeral.smt2 b/test/regress/cli/regress0/parser/lenient-numeral.smt2 new file mode 100644 index 00000000000..c7358595a8e --- /dev/null +++ b/test/regress/cli/regress0/parser/lenient-numeral.smt2 @@ -0,0 +1,9 @@ +; COMMAND-LINE: --parsing-mode=lenient +; EXPECT: unsat +(set-logic QF_LIRA) +(declare-fun @x () Int) +(declare-fun .y () Int) +(assert (= @x 3)) +(assert (= @x -2)) +(assert (distinct @x .y)) +(check-sat)