feat: support the unsigned value of `sshiftRight` in `grind`'s bit-vector homomorphism rules This PR makes `grind` relate the unsigned value of an arithmetic shift to the signed value of its operand: goals such as `((x.sshiftRight n).toNat : Int) = (x.toInt / 2 ^ n) % 2 ^ 16` over `BitVec 16` are now proved. `grind` translates `(x.sshiftRight n).toInt` into `x.toInt >>> n` with the homomorphism rule `BitVec.toInt_sshiftRight`, but a goal about `(x.sshiftRight n).toNat` never mentions the signed value of the shift, so that rule had nothing to apply to. This PR adds `BitVec.toNat_sshiftRight_eq_toNat_emod : (x.sshiftRight n).toNat = (x.toInt >>> n % 2 ^ w).toNat`, the unsigned view of the signed shift in the same shape as `BitVec.toNat_ofInt`, and registers it as a homomorphism rule. It is proved with the new lemma `BitVec.toInt_emod_two_pow : x.toInt % 2 ^ w = x.toNat`. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This is the repository for Lean 4.
See Install Lean.
Please read our Contribution Guidelines first.
See Building Lean.