Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Alethe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
veriT
Alethe
Commits
c6c13b4c
Commit
c6c13b4c
authored
2 weeks ago
by
bernborgess
Browse files
Options
Downloads
Patches
Plain Diff
Add pseudo boolean bitblasting rules
parent
2eee4712
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#54541
passed
2 weeks ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
spec/rule_list.tex
+236
-1
236 additions, 1 deletion
spec/rule_list.tex
with
236 additions
and
1 deletion
spec/rule_list.tex
+
236
−
1
View file @
c6c13b4c
...
@@ -1940,7 +1940,242 @@ to quickly find the definition of rules.
...
@@ -1940,7 +1940,242 @@ to quickly find the definition of rules.
\end{RuleDescription}
\end{RuleDescription}
% Put pseudo boolean bitblasting rules here
\begin{RuleDescription}
{
pbblast
_
bveq
}
Consider bitvectors
\textbf
{
x
}
and
\textbf
{
y
}
of length
$
n
$
.
The pseudo-boolean bitblasting of their equality is expressed by:
\begin{AletheX}
$
i
$
.
&
\ctxsep
&
$
(
\lsymb
{
=
}
\
x
\
y
)
\approx
A
$
&
(
\currule
)
\end{AletheX}
The term ``
$
A
$
'' is the PseudoBoolean constraint:
\[
\sum
_{
i
=
0
}^{
n
-
1
}{
2
^
i x
_{
i
}}
-
\sum
_{
i
=
0
}^{
n
-
1
}{
2
^
i y
_{
i
}}
=
0
\]
% TODO: Add example
\end{RuleDescription}
\begin{RuleDescription}
{
pbblast
_
bvult
}
The `unsigned-less-than' operation over BitVectors with
$
n
$
bits is expressed using PseudoBoolean inequalities by:
\begin{AletheX}
$
i
$
.
&
\ctxsep
&
$
(
\lsymb
{
bvult
}
\
x
\
y
)
\approx
A
$
&
(
\currule
)
\end{AletheX}
The term ``
$
A
$
'' is `true' iff:
\[
\sum
_{
i
=
0
}^{
n
-
1
}
2
^
i
\mathbf
{
y
}_{
i
}
-
\sum
_{
i
=
0
}^{
n
-
1
}
2
^
i
\mathbf
{
x
}_{
i
}
\ge
1
.
\]
% TODO: Add example
\end{RuleDescription}
\begin{RuleDescription}
{
pbblast
_
bvugt
}
The `unsigned-greater-than' operation over BitVectors with
$
n
$
bits is expressed using PseudoBoolean inequalities by:
\begin{AletheX}
$
i
$
.
&
\ctxsep
&
$
(
\lsymb
{
bvugt
}
\
x
\
y
)
\approx
A
$
&
(
\currule
)
\end{AletheX}
The term ``
$
A
$
'' is `true' iff:
\[
\sum
_{
i
=
0
}^{
n
-
1
}
2
^
i
\mathbf
{
x
}_{
i
}
-
\sum
_{
i
=
0
}^{
n
-
1
}
2
^
i
\mathbf
{
y
}_{
i
}
\ge
1
.
\]
\noindent
Or in terms of
\proofRule
{
pbblast
_
bvult
}
:
\begin{AletheX}
$
i
$
.
&
\ctxsep
&
$
(
\lsymb
{
bvugt
}
\
x
\
y
)
\approx
(
\lsymb
{
bvult
}
\
y
\
x
)
$
&
(
\currule
)
\end{AletheX}
% TODO: Add example
\end{RuleDescription}
% https://github.com/cvc5/cvc5/blob/96a35d7cc97ee375e263ab43a2ed9ba03cc32858/src/rewriter/node.py#L44
\begin{RuleDescription}
{
pbblast
_
bvuge
}
The `unsigned-greater-or-equal' operation over BitVectors with
$
n
$
bits is expressed using PseudoBoolean inequalities by:
\begin{AletheX}
$
i
$
.
&
\ctxsep
&
$
(
\lsymb
{
bvuge
}
\
x
\
y
)
\approx
A
$
&
(
\currule
)
\end{AletheX}
The term ``
$
A
$
'' is `true' iff:
\[
\sum
_{
i
=
0
}^{
n
-
1
}
2
^
i
\mathbf
{
x
}_{
i
}
-
\sum
_{
i
=
0
}^{
n
-
1
}
2
^
i
\mathbf
{
y
}_{
i
}
\ge
0
.
\]
% TODO: Add example
\end{RuleDescription}
\begin{RuleDescription}
{
pbblast
_
bvule
}
The `unsigned-less-or-equal' operation over BitVectors with
$
n
$
bits is expressed using PseudoBoolean inequalities by:
\begin{AletheX}
$
i
$
.
&
\ctxsep
&
$
(
\lsymb
{
bvule
}
\
x
\
y
)
\approx
A
$
&
(
\currule
)
\end{AletheX}
The term ``
$
A
$
'' is `true' iff:
\[
\sum
_{
i
=
0
}^{
n
-
1
}
2
^
i
\mathbf
{
y
}_{
i
}
-
\sum
_{
i
=
0
}^{
n
-
1
}
2
^
i
\mathbf
{
x
}_{
i
}
\ge
0
.
\]
\noindent
Or in terms of
\proofRule
{
pbblast
_
bvuge
}
:
\begin{AletheX}
$
i
$
.
&
\ctxsep
&
$
(
\lsymb
{
bvule
}
\
x
\
y
)
\approx
(
\lsymb
{
bvuge
}
\
y
\
x
)
$
&
(
\currule
)
\end{AletheX}
% TODO: Add example
\end{RuleDescription}
\begin{RuleDescription}
{
pbblast
_
bvslt
}
The `signed-less-than' operation over BitVectors with
$
n
$
bits is expressed using PseudoBoolean inequalities by:
\begin{AletheX}
$
i
$
.
&
\ctxsep
&
$
(
\lsymb
{
bvslt
}
\
x
\
y
)
\approx
A
$
&
(
\currule
)
\end{AletheX}
The term ``
$
A
$
'' is `true' iff:
\[
-(
2
^{
n
-
1
}
)
\mathbf
{
y
}_{
n
-
1
}
+
\sum
_{
i
=
0
}^{
n
-
2
}
2
^
i
\mathbf
{
y
}_{
i
}
+
2
^{
n
-
1
}
\mathbf
{
x
}_{
n
-
1
}
-
\sum
_{
i
=
0
}^{
n
-
2
}
2
^
i
\mathbf
{
x
}_{
i
}
\geq
1
\]
% TODO: Add example
\end{RuleDescription}
\begin{RuleDescription}
{
pbblast
_
bvsgt
}
The `signed-greater-than' operation over BitVectors with
$
n
$
bits is expressed using PseudoBoolean inequalities by:
\begin{AletheX}
$
i
$
.
&
\ctxsep
&
$
(
\lsymb
{
bvsgt
}
\
x
\
y
)
\approx
A
$
&
(
\currule
)
\end{AletheX}
The term ``
$
A
$
'' is `true' iff:
\[
-(
2
^{
n
-
1
}
)
\mathbf
{
x
}_{
n
-
1
}
+
\sum
_{
i
=
0
}^{
n
-
2
}
2
^
i
\mathbf
{
x
}_{
i
}
+
2
^{
n
-
1
}
\mathbf
{
y
}_{
n
-
1
}
-
\sum
_{
i
=
0
}^{
n
-
2
}
2
^
i
\mathbf
{
y
}_{
i
}
\geq
1
\]
\noindent
Or in terms of
\proofRule
{
pbblast
_
bvslt
}
:
\begin{AletheX}
$
i
$
.
&
\ctxsep
&
$
(
\lsymb
{
bvsgt
}
\
x
\
y
)
\approx
(
\lsymb
{
bvslt
}
\
y
\
x
)
$
&
(
\currule
)
\end{AletheX}
% TODO: Add example
\end{RuleDescription}
\begin{RuleDescription}
{
pbblast
_
bvsge
}
The `signed-greater-or-equal' operation over BitVectors with
$
n
$
bits is expressed using PseudoBoolean inequalities by:
\begin{AletheX}
$
i
$
.
&
\ctxsep
&
$
(
\lsymb
{
bvsge
}
\
x
\
y
)
\approx
A
$
&
(
\currule
)
\end{AletheX}
The term ``
$
A
$
'' is `true' iff:
\[
-(
2
^{
n
-
1
}
)
\mathbf
{
x
}_{
n
-
1
}
+
\sum
_{
i
=
0
}^{
n
-
2
}
2
^
i
\mathbf
{
x
}_{
i
}
+
2
^{
n
-
1
}
\mathbf
{
y
}_{
n
-
1
}
-
\sum
_{
i
=
0
}^{
n
-
2
}
2
^
i
\mathbf
{
y
}_{
i
}
\geq
0
\]
% TODO: Add example
\end{RuleDescription}
\begin{RuleDescription}
{
pbblast
_
bvsle
}
The `signed-less-or-equal' operation over BitVectors with
$
n
$
bits is expressed using PseudoBoolean inequalities by:
\begin{AletheX}
$
i
$
.
&
\ctxsep
&
$
(
\lsymb
{
bvsle
}
\
x
\
y
)
\approx
A
$
&
(
\currule
)
\end{AletheX}
The term ``
$
A
$
'' is `true' iff:
\[
-(
2
^{
n
-
1
}
)
\mathbf
{
y
}_{
n
-
1
}
+
\sum
_{
i
=
0
}^{
n
-
2
}
2
^
i
\mathbf
{
y
}_{
i
}
+
2
^{
n
-
1
}
\mathbf
{
x
}_{
n
-
1
}
-
\sum
_{
i
=
0
}^{
n
-
2
}
2
^
i
\mathbf
{
x
}_{
i
}
\geq
0
\]
\noindent
Or in terms of
\proofRule
{
pbblast
_
bvsge
}
:
\begin{AletheX}
$
i
$
.
&
\ctxsep
&
$
(
\lsymb
{
bvsle
}
\
x
\
y
)
\approx
(
\lsymb
{
bvsge
}
\
y
\
x
)
$
&
(
\currule
)
\end{AletheX}
% TODO: Add example
\end{RuleDescription}
\begin{RuleDescription}
{
pbblast
_
pbbvar
}
Conversion from a BitVector of
$
n
$
bits to
$
n
$
PseudoBoolean variables passed to pbbT:
\begin{AletheX}
$
i
$
.
&
\ctxsep
&
$
x
\approx
\lsymb
{
pbbT
}
\;
x
_
1
\dots
x
_{
n
+
1
}$
&
(
\currule
)
\end{AletheX}
% TODO: Add example
\end{RuleDescription}
\begin{RuleDescription}
{
pbblast
_
pbbconst
}
Constraints on each bit of the constant BitVector b:
\begin{AletheX}
$
i
$
.
&
\ctxsep
&
$
\left
(
b
\approx
\lsymb
{
pbbT
}
\
r
\right
)
\land
\bigwedge
_{
i
=
0
}^{
n
-
1
}{
\left
(
r
_
i
=
\lsymb
{
PB
\_
ZERO
\_
OR
\_
ONE
}
(
b
_{
n
-
i
-
1
}
)
\right
)
}$
&
(
\currule
)
\\
\end{AletheX}
% TODO: Explain PB_ZERO_OR_ONE := if b_i is 1 then b_i = 1 else b_i = 0
\noindent
In which we expand
\textbf
{
PB
\_
ZERO
\_
OR
\_
ONE(
$
b
_
i
$
)
}
into:
\begin{itemize}
\item
$
\left
(
b
_
i
=
0
\right
)
$
if
$
b
_
i
$
is
$
0
$
\item
$
\left
(
b
_
i
=
1
\right
)
$
if
$
b
_
i
$
is
$
1
$
\end{itemize}
% TODO: Add example
\end{RuleDescription}
\begin{RuleDescription}
{
pbblast
_
bvxor
}
The `bvxor' operation over BitVectors with
$
n
$
bits is expressed using PseudoBoolean inequalities by:
\begin{AletheX}
$
i
$
.
&
\ctxsep
&
$
(
\lsymb
{
bvxor
}
\
x
\
y
)
\approx
[
r
_
0
,
\dots
,r
_{
n
-
1
}
]
\land
A
$
&
(
\currule
)
\\
\end{AletheX}
The term ``
$
A
$
'' is the conjunction of these PseudoBoolean inequalities and the term
\textbf
{
r
}
stands
for the result of the `bvxor' operation between
\textbf
{
x
}
and
\textbf
{
y
}
, for
$
0
\le
i < n
$
:
\[
-
\textbf
{
r
}_
i
+
\textbf
{
x
}_
i
+
\textbf
{
y
}_
i
\ge
0
\]
\[
-
\textbf
{
r
}_
i
-
\textbf
{
x
}_
i
-
\textbf
{
y
}_
i
\ge
-
2
\]
\[
\textbf
{
r
}_
i
+
\textbf
{
x
}_
i
-
\textbf
{
y
}_
i
\ge
0
\]
\[
\textbf
{
r
}_
i
-
\textbf
{
x
}_
i
+
\textbf
{
y
}_
i
\ge
0
\]
% TODO: Add example
\end{RuleDescription}
\begin{RuleDescription}
{
pbblast
_
bvand
}
The `bvand' operation over BitVectors with
$
n
$
bits is expressed using PseudoBoolean inequalities by:
\begin{AletheX}
$
i
$
.
&
\ctxsep
&
$
(
\lsymb
{
bvand
}
\
x
\
y
)
\approx
[
r
_
0
,
\dots
,r
_{
n
-
1
}
]
\land
A
$
&
(
\currule
)
\\
\end{AletheX}
The term ``
$
A
$
'' is the conjunction of these PseudoBoolean inequalities and the term
\textbf
{
r
}
stands
for the result of the `bvand' operation between
\textbf
{
x
}
and
\textbf
{
y
}
, for
$
0
\le
i < n
$
:
\[
\textbf
{
x
}_
i
-
\textbf
{
r
}_
i
\ge
0
\]
\[
\textbf
{
y
}_
i
-
\textbf
{
r
}_
i
\ge
0
\]
\[
\textbf
{
r
}_
i
-
\textbf
{
x
}_
i
-
\textbf
{
y
}_
1
\ge
-
1
\]
% TODO: Add example
\end{RuleDescription}
\begin{RuleDescription}
{
symm
}
\begin{RuleDescription}
{
symm
}
\begin{AletheX}
\begin{AletheX}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment