lean4-htt/src/Init
Luisa Cicolini 3e11f27ff4
feat: add fast circuit for unsigned multiplication overflow detection fastUmulOverflow_eq and surrounding definitions (#7858)
This PR implements the fast circuit for overflow detection in unsigned
multiplication used by Bitwuzla and proposed in:
https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=987767

The theorem is based on three definitions: 
* `uppcRec`: the unsigned parallel prefix circuit for the bits until a
certain `i`
* `aandRec`: the conjunction between the parallel prefix circuit at of
the first operand until a certain `i` and the `i`-th bit in the second
operand
* `resRec`: the preliminary overflow flag computed with these two
definitions
To establish the correspondence between these definitiions and their
meaning in `Nat`, we rely on `clz` and `clzAuxRec` definitions.
Therefore, this PR contains the `clz`- and `clzAuxRec`-related
infrastructure that was necessary to get the proofs through.

An additional change this PR contains is the moving of `### Count
leading zeros` section in `BitVec.Lemmas` downwards. In fact, some of
the proofs I wrote required introducing `Bitvec.toNat_lt_iff` and
`BitVec.le_toNat_iff` which I believe should live in the `Inequalities`
section. Therefore, to put these in the appropriate section, I decided
to move the whole `clz` section downwards (while it's small and
relatively self contained. Specifically, the theorems I moved are:
`clzAuxRec_zero`, `clzAuxRec_succ`, `clzAuxRec_eq_clzAuxRec_of_le`,
`clzAuxRec_eq_clzAuxRec_of_getLsbD_false`.
 
The fast circuit is not yet the default one in the bitblaster, as it's
performance is not yet competitive due to some missing rewrites that
bitwuzla supports but are not in Lean yet.
 
co-authored-by: @bollu

---------

Co-authored-by: Tobias Grosser <tobias@grosser.es>
2025-08-26 13:21:23 +00:00
..
Control chore: avoid confusing public import all combination (#10051) 2025-08-22 12:04:42 +00:00
Data feat: add fast circuit for unsigned multiplication overflow detection fastUmulOverflow_eq and surrounding definitions (#7858) 2025-08-26 13:21:23 +00:00
Grind chore: replace Lean.Grind internal preorder classes with the classes from Std (#10129) 2025-08-26 13:18:22 +00:00
GrindInstances chore: replace Lean.Grind internal preorder classes with the classes from Std (#10129) 2025-08-26 13:18:22 +00:00
Internal chore: avoid confusing public import all combination (#10051) 2025-08-22 12:04:42 +00:00
Omega chore: avoid confusing public import all combination (#10051) 2025-08-22 12:04:42 +00:00
System feat: integrate high-level order typeclasses with BEq and Ord (#9908) 2025-08-19 07:54:53 +00:00
BinderNameHint.lean chore: fix spelling errors (#9175) 2025-07-24 23:35:32 +00:00
BinderPredicates.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
ByCases.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
Classical.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
Coe.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
Control.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
Conv.lean feat: add enter [in patt] syntax (#10081) 2025-08-23 17:16:53 +00:00
Core.lean feat: .ctorIdx for all inductives (#9951) 2025-08-25 10:47:06 +00:00
Data.lean feat: dyadic rationals (#9993) 2025-08-26 03:49:39 +00:00
Dynamic.lean fix: inaccessible private messages in the module system (#9518) 2025-07-25 09:09:17 +00:00
Ext.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
GetElem.lean chore: remove >6 month old deprecations (#9640) 2025-08-05 02:29:15 +00:00
Grind.lean feat: AC theorems for grind (#10093) 2025-08-24 05:02:37 +00:00
GrindInstances.lean feat: upstream several Rat lemmas from mathlib (#10077) 2025-08-25 06:02:27 +00:00
Guard.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
Hints.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
Internal.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
MacroTrace.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
Meta.lean chore: avoid confusing public import all combination (#10051) 2025-08-22 12:04:42 +00:00
MetaTypes.lean feat: improve grind cutsat support for Fin n when n is not a numeral (#10022) 2025-08-21 17:25:52 +00:00
Notation.lean doc: documentation of p,+ macro should mention that it maps to sepBy1, not sepBy (#9876) 2025-08-19 11:54:47 +00:00
NotationExtra.lean chore: warn on [expose] on private definition (#9917) 2025-08-15 11:31:33 +00:00
Omega.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
Prelude.lean feat: .ctorIdx for all inductives (#9951) 2025-08-25 10:47:06 +00:00
PropLemmas.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
RCases.lean fix: add missing spaces for pretty printing (#9475) 2025-07-23 19:35:04 +00:00
ShareCommon.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
SimpLemmas.lean fix: performance issue when elaborating match-expressions with many literals (#9372) 2025-07-15 03:52:23 +00:00
Simproc.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
SizeOf.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
SizeOfLemmas.lean chore: avoid confusing public import all combination (#10051) 2025-08-22 12:04:42 +00:00
Syntax.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
System.lean chore: remove >6 month old deprecations (#9640) 2025-08-05 02:29:15 +00:00
Tactics.lean chore: eliminate uses of intros x y z (#9983) 2025-08-19 06:09:13 +00:00
TacticsExtra.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
Task.lean refactor: implement IO.waitAny using Lean (#9732) 2025-08-06 13:09:15 +00:00
Try.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
Util.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
WF.lean feat: add @[grind =] to Prod.lex_def (#9609) 2025-07-29 02:45:02 +00:00
WFTactics.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00
While.lean feat: make private the default in module (#9044) 2025-06-28 16:30:53 +00:00