@@ -300,53 +300,41 @@ by rw [cast_def, map_div₀, map_int_cast, map_nat_cast, cast_def]
300
300
@[simp] lemma eq_rat_cast {k} [division_ring k] [ring_hom_class F ℚ k] (f : F) (r : ℚ) : f r = r :=
301
301
by rw [← map_rat_cast f, rat.cast_id]
302
302
303
- lemma ring_hom.ext_rat {R : Type *} [semiring R] (f g : ℚ →+* R) : f = g :=
304
- begin
305
- ext r,
306
- refine rat.num_denom_cases_on' r _,
307
- intros a b b0,
308
- let φ : ℤ →+* R := f.comp (int.cast_ring_hom ℚ),
309
- let ψ : ℤ →+* R := g.comp (int.cast_ring_hom ℚ),
310
- rw [rat.mk_eq_div, int.cast_coe_nat],
311
- have b0' : (b:ℚ) ≠ 0 := nat.cast_ne_zero.2 b0,
312
- have : ∀ n : ℤ, f n = g n := λ n, show φ n = ψ n, by rw [φ.ext_int ψ],
313
- calc f (a * b⁻¹)
314
- = f a * f b⁻¹ * (g (b:ℤ) * g b⁻¹) :
315
- by rw [int.cast_coe_nat, ← g.map_mul, mul_inv_cancel b0', g.map_one, mul_one, f.map_mul]
316
- ... = g a * f b⁻¹ * (f (b:ℤ) * g b⁻¹) : by rw [this a, ← this b]
317
- ... = g (a * b⁻¹) :
318
- by rw [int.cast_coe_nat, mul_assoc, ← mul_assoc (f b⁻¹),
319
- ← f.map_mul, inv_mul_cancel b0', f.map_one, one_mul, g.map_mul]
320
- end
321
-
322
- instance rat.subsingleton_ring_hom {R : Type *} [semiring R] : subsingleton (ℚ →+* R) :=
323
- ⟨ring_hom.ext_rat⟩
324
-
325
303
namespace monoid_with_zero_hom
326
304
327
- variables {M : Type *} [group_with_zero M]
305
+ variables {M₀ : Type *} [monoid_with_zero M₀] [monoid_with_zero_hom_class F ℚ M₀] {f g : F}
306
+ include M₀
307
+
308
+ /-- If `f` and `g` agree on the integers then they are equal `φ`. -/
309
+ theorem ext_rat' (h : ∀ m : ℤ, f m = g m) : f = g :=
310
+ fun_like.ext f g $ λ r, by rw [← r.num_div_denom, div_eq_mul_inv, map_mul, map_mul, h,
311
+ ← int.cast_coe_nat, eq_on_inv₀ f g (h _)]
328
312
329
313
/-- If `f` and `g` agree on the integers then they are equal `φ`.
330
314
331
315
See note [partially-applied ext lemmas] for why `comp` is used here. -/
332
- @[ext]
333
- theorem ext_rat {f g : ℚ →*₀ M}
334
- (same_on_int : f.comp (int.cast_ring_hom ℚ).to_monoid_with_zero_hom =
335
- g.comp (int.cast_ring_hom ℚ).to_monoid_with_zero_hom) : f = g :=
336
- begin
337
- have same_on_int' : ∀ k : ℤ, f k = g k := congr_fun same_on_int,
338
- ext x,
339
- rw [← @rat.num_denom x, rat.mk_eq_div, map_div₀ f, map_div₀ g,
340
- same_on_int' x.num, same_on_int' x.denom],
341
- end
316
+ @[ext] theorem ext_rat {f g : ℚ →*₀ M₀}
317
+ (h : f.comp (int.cast_ring_hom ℚ : ℤ →*₀ ℚ) = g.comp (int.cast_ring_hom ℚ)) : f = g :=
318
+ ext_rat' $ congr_fun h
342
319
343
320
/-- Positive integer values of a morphism `φ` and its value on `-1` completely determine `φ`. -/
344
- theorem ext_rat_on_pnat {f g : ℚ →*₀ M}
321
+ theorem ext_rat_on_pnat
345
322
(same_on_neg_one : f (-1 ) = g (-1 )) (same_on_pnat : ∀ n : ℕ, 0 < n → f n = g n) : f = g :=
346
- ext_rat $ ext_int' (by simpa) ‹_›
323
+ ext_rat' $ fun_like.congr_fun $ show (f : ℚ →*₀ M₀).comp (int.cast_ring_hom ℚ : ℤ →*₀ ℚ) =
324
+ (g : ℚ →*₀ M₀).comp (int.cast_ring_hom ℚ : ℤ →*₀ ℚ),
325
+ from ext_int' (by simpa) (by simpa)
347
326
348
327
end monoid_with_zero_hom
349
328
329
+ /-- Any two ring homomorphisms from `ℚ` to a semiring are equal. If the codomain is a division ring,
330
+ then this lemma follows from `eq_rat_cast`. -/
331
+ lemma ring_hom.ext_rat {R : Type *} [semiring R] [ring_hom_class F ℚ R] (f g : F) : f = g :=
332
+ monoid_with_zero_hom.ext_rat' $ ring_hom.congr_fun $
333
+ ((f : ℚ →+* R).comp (int.cast_ring_hom ℚ)).ext_int ((g : ℚ →+* R).comp (int.cast_ring_hom ℚ))
334
+
335
+ instance rat.subsingleton_ring_hom {R : Type *} [semiring R] : subsingleton (ℚ →+* R) :=
336
+ ⟨ring_hom.ext_rat⟩
337
+
350
338
namespace mul_opposite
351
339
352
340
variables [division_ring α]
0 commit comments