Skip to content

Commit

Permalink
feat: udiv/umod bitblasting for LeanSAT
Browse files Browse the repository at this point in the history
  • Loading branch information
bollu committed Sep 9, 2024
1 parent ec7ae59 commit 750c694
Show file tree
Hide file tree
Showing 5 changed files with 454 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/Init/Data/BitVec/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,13 @@ result of appending a single bit to the front in the naive implementation).
That is, the new bit is the least significant bit. -/
def concat {n} (msbs : BitVec n) (lsb : Bool) : BitVec (n+1) := msbs ++ (ofBool lsb)

/--
`x.shiftConcat b` shifts all bits of `x` to the left by `1` and sets the least significant bit to `b`.
It is a non-dependent version of `concat` that does not change the total bitwidth.
-/
def shiftConcat (x : BitVec n) (b : Bool) : BitVec n :=
x <<< 1 ||| (ofBool b).zeroExtend n

/-- Prepend a single bit to the front of a bitvector, using big endian order (see `append`).
That is, the new bit is the most significant bit. -/
def cons {n} (msb : Bool) (lsbs : BitVec n) : BitVec (n+1) :=
Expand Down
Loading

0 comments on commit 750c694

Please sign in to comment.