Skip to content

Commit 9b9dd85

Browse files
bollutobiasgrosser
andauthored
feat: simplify T-division into E-division when numerator is positive (#8205)
This PR adds a simp lemma that simplifies T-division where the numerator is a `Nat` into an E-division: ```lean @[simp] theorem ofNat_tdiv_eq_ediv {a : Nat} {b : Int} : (a : Int).tdiv b = a / b := tdiv_eq_ediv_of_nonneg (by simp) ``` --------- Co-authored-by: Tobias Grosser <[email protected]>
1 parent de7d438 commit 9b9dd85

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Init/Data/Int/DivMod/Lemmas.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ theorem tdiv_eq_ediv_of_nonneg : ∀ {a b : Int}, 0 ≤ a → a.tdiv b = a / b
203203
| succ _, succ _, _ => rfl
204204
| succ _, -[_+1], _ => rfl
205205

206+
@[simp] theorem natCast_tdiv_eq_ediv {a : Nat} {b : Int} : (a : Int).tdiv b = a / b :=
207+
tdiv_eq_ediv_of_nonneg (by simp)
208+
206209
theorem tdiv_eq_ediv {a b : Int} :
207210
a.tdiv b = a / b + if 0 ≤ a ∨ b ∣ a then 0 else sign b := by
208211
simp only [dvd_iff_emod_eq_zero]

0 commit comments

Comments
 (0)