Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
stdpp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Iris
stdpp
Commits
b8af0318
Commit
b8af0318
authored
2 years ago
by
Michael Sammler
Browse files
Options
Downloads
Patches
Plain Diff
Fix unfolding logic of bv_simplify
parent
2c03acaf
No related branches found
No related tags found
1 merge request
!411
Fix unfolding logic of bv_simplify
Pipeline
#71418
passed
2 years ago
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
stdpp_unstable/bitvector_tactics.v
+10
-2
10 additions, 2 deletions
stdpp_unstable/bitvector_tactics.v
tests/bitvector_tactics.ref
+22
-0
22 additions, 0 deletions
tests/bitvector_tactics.ref
tests/bitvector_tactics.v
+10
-0
10 additions, 0 deletions
tests/bitvector_tactics.v
with
42 additions
and
2 deletions
stdpp_unstable/bitvector_tactics.v
+
10
−
2
View file @
b8af0318
...
...
@@ -482,14 +482,22 @@ Tactic Notation "bv_simplify" :=
with length of lists of bytes. *)
reduce_closed_N
;
autorewrite
with
bv_simplify
;
first
[
apply
bv_eq_wrap
|
apply
bv_neq_wrap
|
idtac
];
lazymatch
goal
with
|
|
-
_
=@
{
bv
_}
_
=>
apply
bv_eq_wrap
|
|
-
not
(_
=@
{
bv
_}
_)
=>
apply
bv_neq_wrap
|
_
=>
idtac
end
;
bv_unfold
;
autorewrite
with
bv_unfolded_simplify
.
Tactic
Notation
"bv_simplify"
ident
(
H
)
:=
unfold_lets_in_context
;
autorewrite
with
bv_simplify
in
H
;
first
[
apply
bv_eq
in
H
|
apply
bv_neq
in
H
|
idtac
];
lazymatch
(
type
of
H
)
with
|
_
=@
{
bv
_}
_
=>
apply
bv_eq
in
H
|
not
(_
=@
{
bv
_}
_)
=>
apply
bv_neq
in
H
|
_
=>
idtac
end
;
tactic
bv_unfold
in
H
;
autorewrite
with
bv_unfolded_simplify
in
H
.
Tactic
Notation
"bv_simplify"
"select"
open_constr
(
pat
)
:=
...
...
This diff is collapsed.
Click to expand it.
tests/bitvector_tactics.ref
+
22
−
0
View file @
b8af0318
...
...
@@ -64,3 +64,25 @@ goal 2 is:
(bv_wrap (16 * 2) (bv_unsigned v ≫ Z.of_N (16 * 2)) ≪ Z.of_N (16 * 2))
(Z.lor (bv_unsigned b ≪ Z.of_N (16 * 1))
(bv_wrap (16 * 1) (bv_unsigned v))))
1 goal
b : bv 16
============================
bv_wrap 16 (bv_unsigned b) = bv_wrap 16 (bv_unsigned b)
1 goal
b : bv 16
============================
bv_wrap 16 (bv_unsigned b) ≠ bv_wrap 16 (bv_unsigned b + 1)
1 goal
b : bv 16
H : bv_unsigned b = bv_unsigned b
============================
True
1 goal
b : bv 16
H : bv_unsigned b ≠ bv_wrap 16 (bv_unsigned b + 1)
============================
True
This diff is collapsed.
Click to expand it.
tests/bitvector_tactics.v
+
10
−
0
View file @
b8af0318
...
...
@@ -73,3 +73,13 @@ Goal ∀ b : bv 16, ∀ v : bv 64,
Proof
.
intros
.
bv_simplify
.
Show
.
bitblast
.
Qed
.
(** Regression test for https://gitlab.mpi-sws.org/iris/stdpp/-/merge_requests/411 *)
Goal
∀
b
:
bv
16
,
bv_wrap
16
(
bv_unsigned
b
)
=
bv_wrap
16
(
bv_unsigned
b
)
.
Proof
.
intros
.
bv_simplify
.
Show
.
Restart
.
intros
.
bv_solve
.
Qed
.
Goal
∀
b
:
bv
16
,
bv_wrap
16
(
bv_unsigned
b
)
≠
bv_wrap
16
(
bv_unsigned
(
b
+
BV
16
1
))
.
Proof
.
intros
.
bv_simplify
.
Show
.
Restart
.
intros
.
bv_solve
.
Qed
.
Goal
∀
b
:
bv
16
,
bv_unsigned
b
=
bv_unsigned
b
→
True
.
Proof
.
intros
?
H
.
bv_simplify
H
.
Show
.
Abort
.
Goal
∀
b
:
bv
16
,
bv_unsigned
b
≠
bv_unsigned
(
b
+
BV
16
1
)
→
True
.
Proof
.
intros
?
H
.
bv_simplify
H
.
Show
.
Abort
.
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