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
11c64b2e
Commit
11c64b2e
authored
1 year ago
by
Hans-Jörg
Browse files
Options
Downloads
Patches
Plain Diff
Finish bitblasting function description section
parent
a8bff734
No related branches found
No related tags found
1 merge request
!4
Add some bitvector rules
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
spec/doc.tex
+46
-21
46 additions, 21 deletions
spec/doc.tex
with
46 additions
and
21 deletions
spec/doc.tex
+
46
−
21
View file @
11c64b2e
...
...
@@ -1691,29 +1691,33 @@ is functional congruence, and \proofRule{sko_forall} works like
\subsection
{
Bitvector Reasoning with Bitblasting
}
A standard approach to handle bitvector reasoning in SMT solvers is bitblasting.
Bitblasting
\index
{
bitblasting
}
is the translation of bit-vector
\index
{
bit-vector
}
functions to propositional formulas.
To express bitplasting in the Alethe proof rules, the format uses multiple families
helper functions:
$
\lsymb
{
bbT
}$
,
$
\lsymb
{
bitOf
}$
,
$
\lsymb
{
bvsize
}$
, and
$
\lsymb
{
bv
}$
.
To avoid name clashes with user defined functions,
$
\lsymb
{
bbT
}$
is written as
\inlineAlethe
{
@bbT
}
,
$
\lsymb
{
bitOf
}$
as
\inlineAlethe
{
@bitOf
}
,
$
\lsymb
{
bvsize
}$
as
\inlineAlethe
{
@bvsize
}
, and
$
\lsymb
{
bv
}$
as
\inlineAlethe
{
@bv
}
.
The SMT-LIB standard specifies
A standard approach to handle bitvector reasoning in SMT solvers
is bitblasting. Bitblasting
\index
{
bitblasting
}
works by translating
bitvector
\index
{
bitvector
}
functions to propositional formulas that
model the logical circuit of the bitvector function.
To express bitblasting in Alethe proof rules, the the Alethe calculus uses
multiple families of helper functions:
$
\lsymb
{
bbT
}$
,
$
\lsymb
{
bitOf
}_
m
$
,
$
\lsymb
{
bvsize
}$
, and
$
\lsymb
{
bv
}_
n
^
i
$
. Functions in the families are
distinguished either by overloading (
$
\lsymb
{
bbT
}$
and
$
\lsymb
{
bvsize
}$
)
or by explicit indexing (
$
\lsymb
{
bitOf
}_
m
$
and
$
\lsymb
{
bv
}_
n
^
i
$
).
To avoid name clashes with user defined
functions,
$
\lsymb
{
bbT
}$
is written as
\inlineAlethe
{
@bbT
}
,
$
\lsymb
{
bitOf
}$
as
\inlineAlethe
{
@bitOf
}
,
$
\lsymb
{
bvsize
}$
as
\inlineAlethe
{
@bvsize
}
, and
$
\lsymb
{
bv
}$
as
\inlineAlethe
{
@bv
}
. The SMT-LIB standard specifies
that simple symbols starting with ``
\inlineAlethe
{
@
}
'' are reserved for
solver generated functions.
The family
$
\lsymb
{
bbT
}$
consists of one function for each bit
-
vector sort
The family
$
\lsymb
{
bbT
}$
consists of one function for each bitvector sort
$
(
\lsymb
{
BitVec
}
\;
n
)
$
.
\[
\lsymb
{
bbT
}
:
\underbrace
{
\lsymb
{
Bool
}
\dots
\lsymb
{
Bool
}}_
n
\;
(
\lsymb
{
BitVec
}
\;
n
)
.
\lsymb
{
bbT
}
\,
:
\,
\underbrace
{
\lsymb
{
Bool
}
\,
\dots
\,
\lsymb
{
Bool
}}_
n
\;
(
\lsymb
{
BitVec
}
\;
n
)
.
\]
\noindent
Intuitively, the
predicate
$
\lsymb
{
bbT
}$
takes a list of boolean arguments and
Intuitively, the
function
$
\lsymb
{
bbT
}$
takes a list of boolean arguments and
packs them into a bitvector.
Let
$
\langle
u
_
1
,
\dots
, u
_
n
\rangle
$
denote a bit
-
vector of sort
$
(
\lsymb
{
BitVec
}
\;
n
)
$
Let
$
\langle
u
_
1
,
\dots
, u
_
n
\rangle
$
denote a bitvector of sort
$
(
\lsymb
{
BitVec
}
\;
n
)
$
where
$
u
_
i
=
\top
$
if the bit at position
$
i
$
is
$
1
$
, and
$
u
_
i
=
\bot
$
otherwise.
The bit
$
u
_
n
$
is the least significant bit. Then
...
...
@@ -1722,8 +1726,7 @@ The bit $u_n$ is the least significant bit. Then
\]
\noindent
The addition of the
$
\lsymb
{
bbT
}$
predicates is a conservative extension.
They could be defined in terms of standard SMT-LIB functions.
The
$
\lsymb
{
bbT
}$
functions could be defined in terms of standard SMT-LIB functions.
\begin{align*}
\lsymb
{
bbT
}
\;
v
_
1
\dots
v
_
n :=
\;
&
\lsymb
{
concat
}
\,
(
\lsymb
{
concat
}
\,
(
\dots
\\
...
...
@@ -1734,18 +1737,40 @@ They could be defined in terms of standard SMT-LIB functions.
\end{align*}
\noindent
The functions
$
\lsymb
{
bitOf
}$
are the inverse of
$
\lsymb
{
bbT
}$
. They extract
The functions
$
\lsymb
{
bitOf
}
_
m
$
are the inverse of
$
\lsymb
{
bbT
}$
. They extract
a bit of a bitvector as a boolean. Just as the built in
$
\lsymb
{
extract
}$
symbol,
$
\lsymb
{
bitOf
}$
is used as an indexed symbol. Hence, for
$
n
\leq
m
$
, we
write
\inlineAlethe
{
(
_
@bitOf
}
$
n
$
\inlineAlethe
{
)
}
, to denote functions
symbol,
$
\lsymb
{
bitOf
}
_
m
$
is used as an indexed symbol. Hence, for
$
m
\leq
n
$
, we
write
\inlineAlethe
{
(
_
@bitOf
}
$
m
$
\inlineAlethe
{
)
}
, to denote functions
\[
\lsymb
{
bitOf
}_
n
:
(
\lsymb
{
BitVec
}
\;
m
)
\to
\lsymb
{
Bool
}
.
\lsymb
{
bitOf
}_
m
:
(
\lsymb
{
BitVec
}
\;
n
)
\to
\lsymb
{
Bool
}
.
\]
These functions are defined as
\[
\lsymb
{
bitOf
}_
n
\langle
u
_
1
,
\dots
, u
_
m
\rangle
:
=
u
_
n
.
\lsymb
{
bitOf
}_
m
\langle
u
_
1
,
\dots
, u
_
n
\rangle
:
=
u
_
m
.
\]
\noindent
The functions
$
\lsymb
{
bvsize
}$
return the size of a bitvector. Formally, there
is one
$
\lsymb
{
bvsize
}$
for for each bitvector sort
$
(
\lsymb
{
BitVec
}
\;
n
)
$
. Each
$
\lsymb
{
bvsize
}$
is a constant function that returns
$
n
$
. Using notation:
\begin{align*}
\lsymb
{
bvsize
}&
: (
\lsymb
{
BitVec
}
\;
n)
\to
\mathbb
{
N
}
\\
\lsymb
{
bvsize
}&
\;
b := n
\end{align*}
\noindent
Finally,
$
\lsymb
{
bv
}_
n
^
i
$
is a family of constants indexed by two parameters:
a bitvector length
$
n
$
, and a natural number
$
i
$
. We
write
\inlineAlethe
{
(
_
@bv
}$
n
$
$
i
$
\inlineAlethe
{
)
}
for
$
\lsymb
{
bv
}_
n
^
i
$
.
The space before
$
n
$
is omitted for historical reasons.
Each
$
\lsymb
{
bv
}_
n
^
i
$
is the bitvector constant that represents the bitvector
of length
$
n
$
that encodes the integer
$
i
$
. Formally, it corresponds
to
\inlineAlethe
{
nat2bv[n](i)
}
, where
\inlineAlethe
{
nat2bv
}
is defined
as in the SMT-LIB
standard.
\footnote
{
See
\url
{
https://smt-lib.github.io/theories-FixedSizeBitVectors.shtml
}
.
}
\section
{
The Alethe Rules
}
\label
{
apx:rules
}
\input
{
rule
_
list
}
...
...
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