fix: mark Nat.div and Nat.modCore irreducible (#7614)

This PR marks `Nat.div` and `Nat.modCore` as `irreducible`, to recover 
the behavior from from before #7558.

Fixes #7612. H't to @tobiasgrosser for the good bug report.
This commit is contained in:
Joachim Breitner 2025-03-21 15:23:03 +01:00 committed by GitHub
parent 501bd64a89
commit 6931e91bf0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View file

@ -39,7 +39,7 @@ Examples:
* `0 / 22 = 0`
* `5 / 0 = 0`
-/
@[extern "lean_nat_div"]
@[extern "lean_nat_div", irreducible]
protected def div (x y : @& Nat) : Nat :=
if hy : 0 < y then
let rec
@ -140,7 +140,7 @@ reductions](lean-manual://section/type-system) when the `Nat`s contain free vari
This function is overridden at runtime with an efficient implementation. This definition is the
logical model.
-/
@[extern "lean_nat_mod"]
@[extern "lean_nat_mod", irreducible]
protected noncomputable def modCore (x y : Nat) : Nat :=
if hy : 0 < y then
let rec

5
tests/lean/run/7612.lean Normal file
View file

@ -0,0 +1,5 @@
theorem extracted_1 (x y : BitVec 9) :
(y - y.srem x).sdiv x = y.sdiv x := by
ac_nf
sorry