Skip to content

Comments

Add IntBv, a bit-blastable LLVM type#178

Closed
tobiasgrosser wants to merge 3 commits intomainfrom
tobias/add_intbv
Closed

Add IntBv, a bit-blastable LLVM type#178
tobiasgrosser wants to merge 3 commits intomainfrom
tobias/add_intbv

Conversation

@tobiasgrosser
Copy link
Collaborator

This type allows us to call bv_decide right on the IntBv type.

Copy link
Collaborator

@math-fehr math-fehr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some comments but otherwise it's fine!
I think we should probably rename the current folder, Dialects is not really appropriate for all these datatypes, as they are going to be reused in both LLVM, and the MLIR dialects

@@ -0,0 +1,45 @@
module
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this file just replace Int/Basic.lean? It seems this is exactly the same structure, just with a different encoding?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would a Data/ folder be useful? All the data structures used by dialects (which should not anyways be that many) could live there. I find it a little bit confusing to have the data types with the semantics of the operations

Copy link
Contributor

@luisacicolini luisacicolini Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also don't understand what';s the difference between Int and IntBv?
And a design question: why do we want to have a bool for poison? I find the Option more intuitive, especially because I suppose in a lot of cases we won't be able to specify a priori what the value of poison is (?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another alternative that comes to mind is creating a type that contains all integers (bitvecs) + a special element poison - have we considered this? What are the advantages of this def?

namespace Veir.Dialects.LLVM.IntBv

example (w : Nat) (x y : IntBv w) : x + y = y + x := by
grind
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this grind works btw? Is it unfolding add by default here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no clue, please let me know if you find out!

Comment on lines 8 to 10
The `IntBv` type can have any bitwidth `w`. It is either a two's complement
integer value of width `w` or a poison value indicating delayed undefined
behavior.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just remove the first sentence here?

Co-authored-by: Fehr Mathieu <mathieu.fehr@gmail.com>
Co-authored-by: Fehr Mathieu <mathieu.fehr@gmail.com>
Copy link
Contributor

@luisacicolini luisacicolini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you - I left a few questions about the IntBv definition!

github-merge-queue bot pushed a commit that referenced this pull request Feb 21, 2026
This follows Lean's repository layout and implements @luisacicolini's
suggestion in #178.
@tobiasgrosser
Copy link
Collaborator Author

Let's close this for now until I have time to look into better bitblastability again.

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.

3 participants