@@ -268,6 +268,7 @@ noncomputable def DivisionRing.ofIsUnitOrEqZero [Ring R] (h : ∀ a : R, IsUnit
268268 DivisionRing R where
269269 toRing := ‹Ring R›
270270 __ := groupWithZeroOfIsUnitOrEqZero h
271+ nnqsmul := _
271272 qsmul := _
272273#align division_ring_of_is_unit_or_eq_zero DivisionRing.ofIsUnitOrEqZero
273274
@@ -282,20 +283,23 @@ noncomputable def Field.ofIsUnitOrEqZero [CommRing R] (h : ∀ a : R, IsUnit a
282283end NoncomputableDefs
283284
284285namespace Function.Injective
285- variable [Zero α] [Add α] [Neg α] [Sub α] [One α] [Mul α] [Inv α] [Div α] [SMul ℕ α]
286- [SMul ℤ α] [SMul ℚ α] [Pow α ℕ] [Pow α ℤ] [NatCast α] [IntCast α] [RatCast α]
286+ variable [Zero α] [Add α] [Neg α] [Sub α] [One α] [Mul α] [Inv α] [Div α] [SMul ℕ α] [SMul ℤ α]
287+ [SMul ℚ≥ 0 α] [SMul ℚ α] [Pow α ℕ] [Pow α ℤ] [NatCast α] [IntCast α] [NNRatCast α] [RatCast α]
287288 (f : α → β) (hf : Injective f)
288289
289290/-- Pullback a `DivisionSemiring` along an injective function. -/
290291@[reducible] -- See note [reducible non-instances]
291292protected def divisionSemiring [DivisionSemiring β] (zero : f 0 = 0 ) (one : f 1 = 1 )
292293 (add : ∀ x y, f (x + y) = f x + f y) (mul : ∀ x y, f (x * y) = f x * f y)
293294 (inv : ∀ x, f x⁻¹ = (f x)⁻¹) (div : ∀ x y, f (x / y) = f x / f y)
294- (nsmul : ∀ (n : ℕ) (x), f (n • x) = n • f x)
295+ (nsmul : ∀ (n : ℕ) (x), f (n • x) = n • f x) (nnqsmul : ∀ (q : ℚ≥ 0 ) (x), f (q • x) = q • f x)
295296 (npow : ∀ (x) (n : ℕ), f (x ^ n) = f x ^ n) (zpow : ∀ (x) (n : ℤ), f (x ^ n) = f x ^ n)
296- (natCast : ∀ n : ℕ, f n = n) : DivisionSemiring α where
297+ (natCast : ∀ n : ℕ, f n = n) (nnratCast : ∀ q : ℚ≥ 0 , f q = q) : DivisionSemiring α where
297298 toSemiring := hf.semiring f zero one add mul nsmul npow natCast
298299 __ := hf.groupWithZero f zero one mul inv div npow zpow
300+ nnratCast_def q := hf $ by rw [nnratCast, NNRat.cast_def, div, natCast, natCast]
301+ nnqsmul := (· • ·)
302+ nnqsmul_def q a := hf $ by rw [nnqsmul, NNRat.smul_def, mul, nnratCast]
299303#align function.injective.division_semiring Function.Injective.divisionSemiring
300304
301305/-- Pullback a `DivisionSemiring` along an injective function. -/
@@ -304,14 +308,14 @@ protected def divisionRing [DivisionRing β] (zero : f 0 = 0) (one : f 1 = 1)
304308 (add : ∀ x y, f (x + y) = f x + f y) (mul : ∀ x y, f (x * y) = f x * f y)
305309 (neg : ∀ x, f (-x) = -f x) (sub : ∀ x y, f (x - y) = f x - f y) (inv : ∀ x, f x⁻¹ = (f x)⁻¹)
306310 (div : ∀ x y, f (x / y) = f x / f y)
307- (nsmul : ∀ (n : ℕ) (x), f (n • x) = n • f x)
308- (zsmul : ∀ (n : ℤ ) (x), f (n • x) = n • f x) (qsmul : ∀ (q : ℚ) (x), f (q • x) = q • f x)
311+ (nsmul : ∀ (n : ℕ) (x), f (n • x) = n • f x) (zsmul : ∀ (n : ℤ) (x), f (n • x) = n • f x)
312+ (nnqsmul : ∀ (q : ℚ≥ 0 ) (x), f (q • x) = q • f x) (qsmul : ∀ (q : ℚ) (x), f (q • x) = q • f x)
309313 (npow : ∀ (x) (n : ℕ), f (x ^ n) = f x ^ n) (zpow : ∀ (x) (n : ℤ), f (x ^ n) = f x ^ n)
310- (natCast : ∀ n : ℕ, f n = n) (intCast : ∀ n : ℤ, f n = n)
314+ (natCast : ∀ n : ℕ, f n = n) (intCast : ∀ n : ℤ, f n = n) (nnratCast : ∀ q : ℚ≥ 0 , f q = q)
311315 (ratCast : ∀ q : ℚ, f q = q) : DivisionRing α where
312316 toRing := hf.ring f zero one add mul neg sub nsmul zsmul npow natCast intCast
313317 __ := hf.groupWithZero f zero one mul inv div npow zpow
314- __ := hf.divisionSemiring f zero one add mul inv div nsmul npow zpow natCast
318+ __ := hf.divisionSemiring f zero one add mul inv div nsmul nnqsmul npow zpow natCast nnratCast
315319 ratCast_def q := hf $ by erw [ratCast, div, intCast, natCast, Rat.cast_def]
316320 qsmul := (· • ·)
317321 qsmul_def q a := hf $ by erw [qsmul, mul, Rat.smul_def, ratCast]
@@ -322,12 +326,12 @@ protected def divisionRing [DivisionRing β] (zero : f 0 = 0) (one : f 1 = 1)
322326protected def semifield [Semifield β] (zero : f 0 = 0 ) (one : f 1 = 1 )
323327 (add : ∀ x y, f (x + y) = f x + f y) (mul : ∀ x y, f (x * y) = f x * f y)
324328 (inv : ∀ x, f x⁻¹ = (f x)⁻¹) (div : ∀ x y, f (x / y) = f x / f y)
325- (nsmul : ∀ (n : ℕ) (x), f (n • x) = n • f x)
329+ (nsmul : ∀ (n : ℕ) (x), f (n • x) = n • f x) (nnqsmul : ∀ (q : ℚ≥ 0 ) (x), f (q • x) = q • f x)
326330 (npow : ∀ (x) (n : ℕ), f (x ^ n) = f x ^ n) (zpow : ∀ (x) (n : ℤ), f (x ^ n) = f x ^ n)
327- (natCast : ∀ n : ℕ, f n = n) : Semifield α where
331+ (natCast : ∀ n : ℕ, f n = n) (nnratCast : ∀ q : ℚ≥ 0 , f q = q) : Semifield α where
328332 toCommSemiring := hf.commSemiring f zero one add mul nsmul npow natCast
329333 __ := hf.commGroupWithZero f zero one mul inv div npow zpow
330- __ := hf.divisionSemiring f zero one add mul inv div nsmul npow zpow natCast
334+ __ := hf.divisionSemiring f zero one add mul inv div nsmul nnqsmul npow zpow natCast nnratCast
331335#align function.injective.semifield Function.Injective.semifield
332336
333337/-- Pullback a `Field` along an injective function. -/
@@ -336,15 +340,15 @@ protected def field [Field β] (zero : f 0 = 0) (one : f 1 = 1)
336340 (add : ∀ x y, f (x + y) = f x + f y) (mul : ∀ x y, f (x * y) = f x * f y)
337341 (neg : ∀ x, f (-x) = -f x) (sub : ∀ x y, f (x - y) = f x - f y) (inv : ∀ x, f x⁻¹ = (f x)⁻¹)
338342 (div : ∀ x y, f (x / y) = f x / f y)
339- (nsmul : ∀ (n : ℕ) (x), f (n • x) = n • f x)
340- (zsmul : ∀ (n : ℤ ) (x), f (n • x) = n • f x) (qsmul : ∀ (q : ℚ) (x), f (q • x) = q • f x)
343+ (nsmul : ∀ (n : ℕ) (x), f (n • x) = n • f x) (zsmul : ∀ (n : ℤ) (x), f (n • x) = n • f x)
344+ (nnqsmul : ∀ (q : ℚ≥ 0 ) (x), f (q • x) = q • f x) (qsmul : ∀ (q : ℚ) (x), f (q • x) = q • f x)
341345 (npow : ∀ (x) (n : ℕ), f (x ^ n) = f x ^ n) (zpow : ∀ (x) (n : ℤ), f (x ^ n) = f x ^ n)
342- (natCast : ∀ n : ℕ, f n = n) (intCast : ∀ n : ℤ, f n = n)
346+ (natCast : ∀ n : ℕ, f n = n) (intCast : ∀ n : ℤ, f n = n) (nnratCast : ∀ q : ℚ≥ 0 , f q = q)
343347 (ratCast : ∀ q : ℚ, f q = q) :
344348 Field α where
345349 toCommRing := hf.commRing f zero one add mul neg sub nsmul zsmul npow natCast intCast
346- __ := hf.divisionRing f zero one add mul neg sub inv div nsmul zsmul qsmul npow zpow
347- natCast intCast ratCast
350+ __ := hf.divisionRing f zero one add mul neg sub inv div nsmul zsmul nnqsmul qsmul npow zpow
351+ natCast intCast nnratCast ratCast
348352#align function.injective.field Function.Injective.field
349353
350354end Function.Injective
0 commit comments