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

feat: Convert Circuit to AIG, which will then be passed to cadical for bitblasting #952

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

bollu
Copy link
Collaborator

@bollu bollu commented Jan 8, 2025

This tests the ability of our infrastructure to switch over to AIG, and should also provide a fairly hefty speedup by querying a SAT solver for the expensive check. Based off of #950 which adds files that this PR builds on.

Currently a draft as the AIG builder is half-done.

bollu added 8 commits January 7, 2025 18:20
This uses 'shareCommon' to allow us to print the pointer-location of
arbitrary lean variables as a cheap way to identify variables.
Actually plumbing a [ToString a] instance throughout the entire
machinery will be a bit too nightmarish for me to contemplate.

This also lets me test out the technique, in case I want to reuse
it to automatically fold our circuits into a DAG and
prove this version to be equivalent to the slow tree version.

These games that people play have sharp edges, so we should
only go down this route if it turns out that 'eval' is the bottleneck.
@bollu bollu changed the title feat: Convert Circuit to AIG, which will then be passed to cadical for Bitblasting feat: Convert Circuit to AIG, which will then be passed to cadical for bitblasting Jan 8, 2025
Copy link

github-actions bot commented Jan 8, 2025

Alive Statistics: 90 / 93 (3 failed)

bollu added 5 commits January 8, 2025 09:51
…rough

It's really now clear how painful plumbing a [Hashable a] through the
entirity of the thousand line FiniteStateMachine.lean will be.
God protect my soul.
Now I must perform the unenviable task of finding out which modules
bv_decide needs to correctly invoke cadical.
> uncaught exception: auxiliary declaration cannot be created when declaration name is not available
bollu@ultrapower ~/n/b/ssa (circuit-to-aig-to-cnf-to-cadical) lake build bv-circuit-profile && ./.lake/build/bin/bv-circuit-profile

Predicate.eq
  (Term.add
    (Term.sub (Term.neg (Term.not (Term.xor (Term.var 0) (Term.var 1)))) (Term.shiftL (Term.var 1) 1))
    (Term.not (Term.var 0)))
  (Term.sub
    (Term.neg (Term.not (Term.or (Term.var 0) (Term.not (Term.var 1)))))
    (Term.add (Term.and (Term.var 0) (Term.var 1)) (Term.shiftL (Term.and (Term.var 0) (Term.var 1)) 1)))
Iteration #1
 (pure)     is all zeroes: 'true' | time: '1315' ms
 (cadical)  is all zeroes: 'true' | time: '307' ms
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

Successfully merging this pull request may close these issues.

1 participant