feat(Data/ZMod/Basic): unit characterization for ZMod (p ^ d)#38628
feat(Data/ZMod/Basic): unit characterization for ZMod (p ^ d)#38628tautschnig wants to merge 1 commit intoleanprover-community:masterfrom
Conversation
Add two lemmas characterizing units in `ZMod (p ^ d)` for a prime `p`: * `ZMod.isUnit_natCast_of_not_dvd_pow`: a natural number not divisible by `p` is a unit in `ZMod (p ^ d)`. * `ZMod.prime_natCast_not_isUnit_pow`: the prime `p` is not a unit in `ZMod (p ^ d)` when `d ≥ 1`. These arise naturally in SAT-based bounded model checking, where arithmetic verification over fixed-width bitvectors works in `ZMod (2 ^ d)`. The unit structure determines which constants can be inverted by a Gröbner basis solver: odd constants are invertible (enabling algebraic simplification), while even constants are not (requiring fallback to SAT). Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
Welcome new contributor!Thank you for contributing to Mathlib! If you haven't done so already, please review our contribution guidelines, as well as the style guide and naming conventions. In particular, we kindly remind contributors that we have guidelines regarding the use of AI when making pull requests. We use a review queue to manage reviews. If your PR does not appear there, it is probably because it is not successfully building (i.e., it doesn't have a green checkmark), has the If you haven't already done so, please come to https://leanprover.zulipchat.com/, introduce yourself, and mention your new PR. Thank you again for joining our community. |
PR summary 04e84bf966Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
Add two lemmas characterizing units in
ZMod (p ^ d)for a primep:ZMod.isUnit_natCast_of_not_dvd_pow: a natural number not divisible bypis a unit inZMod (p ^ d).ZMod.prime_natCast_not_isUnit_pow: the primepis not a unit inZMod (p ^ d)whend ≥ 1.These complement the existing
isUnit_prime_iff_not_dvd(which characterizes when a prime is a unit inZMod n) by characterizing when an arbitrary natural number is a unit inZMod (p ^ d).Motivation. Arithmetic verification over fixed-width bitvectors works in
ZMod (2 ^ d). A Gröbner basis solver over this ring needs to know which constants are invertible: odd constants are units (enabling algebraic simplification), while even constants are not (requiring fallback to SAT). These lemmas formalize that characterization for any prime, not just 2.Further work related to Gröbner basis will be published once #29203 (and, before that, #34873) have been merged.