Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve commutativity/associativity reasoning for addition #444

Open
aytey opened this issue Aug 11, 2022 · 1 comment
Open

Improve commutativity/associativity reasoning for addition #444

aytey opened this issue Aug 11, 2022 · 1 comment

Comments

@aytey
Copy link
Member

aytey commented Aug 11, 2022

For this file:

(set-logic QF_BV)
(declare-const __T1 (_ BitVec 5))
(declare-const __ (_ BitVec 6))
(declare-const _T1 (_ BitVec 3))
(declare-const __T (_ BitVec 6))
(declare-const T1 (_ BitVec 3))
(declare-const T (_ BitVec 7))
(declare-const _T (_ BitVec 1))
(assert
  (let
    ((?x25 ((_ zero_extend 24) ((_ zero_extend 1) ((_ zero_extend 1) __T)))))
    (bvslt
      (_ bv111 32)
      (bvadd
        ((_ zero_extend 24) ((_ zero_extend 4) ((_ zero_extend 1) T1)))
        (bvadd
          ((_ zero_extend 24) ((_ zero_extend 1) T))
          ?x25
          (
            (_ zero_extend 24)
            ((_ zero_extend 1) ((_ zero_extend 1) ((_ zero_extend 1) __T1))))
          ((_ zero_extend 24) ((_ zero_extend 4) ((_ zero_extend 1) _T1)))
          ((_ zero_extend 24) ((_ zero_extend 1) ((_ zero_extend 1) __))))))))
(assert
  (let
    (
      (?x1088
        (bvadd
          ((_ zero_extend 24) ((_ zero_extend 7) _T))
          ((_ zero_extend 24) ((_ zero_extend 1) ((_ zero_extend 1) __))))))
    (bvsge
      (_ bv111 32)
      (bvadd
        (bvadd
          ((_ zero_extend 24) ((_ zero_extend 4) ((_ zero_extend 1) T1)))
          (
            (_ zero_extend 24)
            ((_ zero_extend 1) ((_ zero_extend 1) ((_ zero_extend 1) __T1)))))
        ?x1088
        ((_ zero_extend 24) ((_ zero_extend 4) ((_ zero_extend 1) _T1)))
        ((_ zero_extend 24) ((_ zero_extend 1) ((_ zero_extend 1) __T)))
        (bvadd
          ((_ zero_extend 24) ((_ zero_extend 7) _T))
          ((_ zero_extend 24) ((_ zero_extend 1) T)))))))
(check-sat)

STP as submitted to SMTCOMP 2022 times-out:

/usr/bin/time -vvv ./stp reduced.smt2
Timed Out.
        Command being timed: "./stp reduced.smt2"
        User time (seconds): 11.04
        System time (seconds): 0.00
        Percent of CPU this job got: 100%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 0:11.04
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 5180
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 0
        Minor (reclaiming a frame) page faults: 722
        Voluntary context switches: 1
        Involuntary context switches: 11
        Swaps: 0
        File system inputs: 0
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0

This file was reduced with ddSMT from:

cvc5 (cvc5/cvc5@cc80711) is almost instantaneous on this file:

/usr/bin/time -vvv ./cvc5-Linux-2022-08-08-cc80711 reduced.smt2
unsat
        Command being timed: "./cvc5-Linux-2022-08-08-cc80711 reduced.smt2"
        User time (seconds): 0.00
        System time (seconds): 0.00
        Percent of CPU this job got: 100%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.00
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 15860
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 0
        Minor (reclaiming a frame) page faults: 564
        Voluntary context switches: 1
        Involuntary context switches: 0
        Swaps: 0
        File system inputs: 0
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0
@TrevorHansen
Copy link
Member

Thanks @aytey,

This problem is solved easily with some commutativity/associativity reasoning. STP solves it in about 20ms with --flattening=1 .

Unfortunately, the current implementation of flattening slows down other problems, so I've not enabled it by default.

If anyone else wants to investigate, that'd be great. Currently, it's about my 15th highest priority, so it'll be a while before I look at it.

Trev.

@TrevorHansen TrevorHansen changed the title Performance issue on QF_BV query (missing rewrite?) Improve commutativity/associativity reasoning for addition Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants