@@ -723,32 +723,54 @@ have (n⁻¹.denom : α) = 0 → (n.num : α) = 0, from
723
723
rwa [int.cast_mul, int.cast_coe_nat, h, zero_mul] at this ,
724
724
by rw [division_def, cast_mul_of_ne_zero md (mt this nn), cast_inv_of_ne_zero nn nd, division_def]
725
725
726
+ @[simp] theorem cast_inj [char_zero α] : ∀ {m n : ℚ}, (m : α) = n ↔ m = n
727
+ | ⟨n₁, d₁, h₁, c₁⟩ ⟨n₂, d₂, h₂, c₂⟩ := begin
728
+ refine ⟨λ h, _, congr_arg _⟩,
729
+ have d₁0 : d₁ ≠ 0 := ne_of_gt h₁,
730
+ have d₂0 : d₂ ≠ 0 := ne_of_gt h₂,
731
+ have d₁a : (d₁:α) ≠ 0 := nat.cast_ne_zero.2 d₁0 ,
732
+ have d₂a : (d₂:α) ≠ 0 := nat.cast_ne_zero.2 d₂0 ,
733
+ rw [num_denom', num_denom'] at h ⊢,
734
+ rw [cast_mk_of_ne_zero, cast_mk_of_ne_zero] at h; simp [d₁0 , d₂0 ] at h ⊢,
735
+ rwa [eq_div_iff_mul_eq _ _ d₂a, division_def, mul_assoc,
736
+ inv_comm_of_comm d₁a (nat.mul_cast_comm _ _),
737
+ ← mul_assoc, ← division_def, eq_comm, eq_div_iff_mul_eq _ _ d₁a, eq_comm,
738
+ ← int.cast_coe_nat, ← int.cast_mul, ← int.cast_coe_nat, ← int.cast_mul,
739
+ int.cast_inj, ← mk_eq (int.coe_nat_ne_zero.2 d₁0 ) (int.coe_nat_ne_zero.2 d₂0 )] at h
726
740
end
727
741
728
- theorem cast_mk [discrete_linear_ordered_field α] (a b : ℤ) : ((a /. b) : α) = a / b :=
742
+ @[simp] theorem cast_eq_zero [char_zero α] {n : ℚ} : (n : α) = 0 ↔ n = 0 :=
743
+ by rw [← cast_zero, cast_inj]
744
+
745
+ @[simp] theorem cast_ne_zero [char_zero α] {n : ℚ} : (n : α) ≠ 0 ↔ n ≠ 0 :=
746
+ not_congr cast_eq_zero
747
+
748
+ end
749
+
750
+ theorem cast_mk [discrete_field α] [char_zero α] (a b : ℤ) : ((a /. b) : α) = a / b :=
729
751
if b0 : b = 0 then by simp [b0, div_zero]
730
752
else cast_mk_of_ne_zero a b (int.cast_ne_zero.2 b0)
731
753
732
- @[simp] theorem cast_add [linear_ordered_field α] (m n) : ((m + n : ℚ) : α) = m + n :=
754
+ @[simp] theorem cast_add [division_ring α] [char_zero α] (m n) : ((m + n : ℚ) : α) = m + n :=
733
755
cast_add_of_ne_zero (nat.cast_ne_zero.2 $ ne_of_gt m.pos) (nat.cast_ne_zero.2 $ ne_of_gt n.pos)
734
756
735
- @[simp] theorem cast_sub [linear_ordered_field α] (m n) : ((m - n : ℚ) : α) = m - n :=
757
+ @[simp] theorem cast_sub [division_ring α] [char_zero α] (m n) : ((m - n : ℚ) : α) = m - n :=
736
758
cast_sub_of_ne_zero (nat.cast_ne_zero.2 $ ne_of_gt m.pos) (nat.cast_ne_zero.2 $ ne_of_gt n.pos)
737
759
738
- @[simp] theorem cast_mul [linear_ordered_field α] (m n) : ((m * n : ℚ) : α) = m * n :=
760
+ @[simp] theorem cast_mul [division_ring α] [char_zero α] (m n) : ((m * n : ℚ) : α) = m * n :=
739
761
cast_mul_of_ne_zero (nat.cast_ne_zero.2 $ ne_of_gt m.pos) (nat.cast_ne_zero.2 $ ne_of_gt n.pos)
740
762
741
- @[simp] theorem cast_inv [discrete_linear_ordered_field α] (n) : ((n⁻¹ : ℚ) : α) = n⁻¹ :=
763
+ @[simp] theorem cast_inv [discrete_field α] [char_zero α] (n) : ((n⁻¹ : ℚ) : α) = n⁻¹ :=
742
764
if n0 : n.num = 0 then
743
765
by simp [show n = 0 , by rw [num_denom n, n0]; simp, inv_zero] else
744
766
cast_inv_of_ne_zero (int.cast_ne_zero.2 n0) (nat.cast_ne_zero.2 $ ne_of_gt n.pos)
745
767
746
- @[simp] theorem cast_div [discrete_linear_ordered_field α] (m n) : ((m / n : ℚ) : α) = m / n :=
768
+ @[simp] theorem cast_div [discrete_field α] [char_zero α] (m n) : ((m / n : ℚ) : α) = m / n :=
747
769
by rw [division_def, cast_mul, cast_inv, division_def]
748
770
749
- @[simp] theorem cast_bit0 [linear_ordered_field α] (n : ℚ) : ((bit0 n : ℚ) : α) = bit0 n := cast_add _ _
771
+ @[simp] theorem cast_bit0 [division_ring α] [char_zero α] (n : ℚ) : ((bit0 n : ℚ) : α) = bit0 n := cast_add _ _
750
772
751
- @[simp] theorem cast_bit1 [linear_ordered_field α] (n : ℚ) : ((bit1 n : ℚ) : α) = bit1 n :=
773
+ @[simp] theorem cast_bit1 [division_ring α] [char_zero α] (n : ℚ) : ((bit1 n : ℚ) : α) = bit1 n :=
752
774
by rw [bit1, cast_add, cast_one, cast_bit0]; refl
753
775
754
776
@[simp] theorem cast_nonneg [linear_ordered_field α] : ∀ {n : ℚ}, 0 ≤ (n : α) ↔ 0 ≤ n
@@ -763,9 +785,6 @@ by rw [← sub_nonneg, ← cast_sub, cast_nonneg, sub_nonneg]
763
785
@[simp] theorem cast_lt [linear_ordered_field α] {m n : ℚ} : (m : α) < n ↔ m < n :=
764
786
by simpa [-cast_le] using not_congr (@cast_le α _ n m)
765
787
766
- @[simp] theorem cast_inj [linear_ordered_field α] {m n : ℚ} : (m : α) = n ↔ m = n :=
767
- by simp [le_antisymm_iff]
768
-
769
788
@[simp] theorem cast_nonpos [linear_ordered_field α] {n : ℚ} : (n : α) ≤ 0 ↔ n ≤ 0 :=
770
789
by rw [← cast_zero, cast_le]
771
790
@@ -775,12 +794,6 @@ by rw [← cast_zero, cast_lt]
775
794
@[simp] theorem cast_lt_zero [linear_ordered_field α] {n : ℚ} : (n : α) < 0 ↔ n < 0 :=
776
795
by rw [← cast_zero, cast_lt]
777
796
778
- @[simp] theorem cast_eq_zero [linear_ordered_field α] {n : ℚ} : (n : α) = 0 ↔ n = 0 :=
779
- by rw [← cast_zero, cast_inj]
780
-
781
- @[simp] theorem cast_ne_zero [linear_ordered_field α] {n : ℚ} : (n : α) ≠ 0 ↔ n ≠ 0 :=
782
- not_congr cast_eq_zero
783
-
784
797
@[simp] theorem cast_id : ∀ n : ℚ, ↑n = n
785
798
| ⟨n, d, h, c⟩ := show (n / (d : ℤ) : ℚ) = _, by rw [num_denom', mk_eq_div]
786
799
0 commit comments