@@ -687,21 +687,43 @@ instance : Coe ℕ∞ PartENat := ⟨ofENat⟩
687
687
example (n : ℕ) : ((n : ℕ∞) : PartENat) = ↑n := rfl
688
688
689
689
-- Porting note (#10756): new lemma
690
- @[simp]
691
- lemma ofENat_none : ofENat Option.none = ⊤ := rfl
690
+ @[simp, norm_cast ]
691
+ lemma ofENat_top : ofENat ⊤ = ⊤ := rfl
692
692
693
693
-- Porting note (#10756): new lemma
694
- @[simp]
695
- lemma ofENat_some (n : ℕ) : ofENat (Option.some n) = ↑n := rfl
694
+ @[simp, norm_cast]
695
+ lemma ofENat_coe (n : ℕ) : ofENat n = n := rfl
696
+
697
+ @[simp, norm_cast]
698
+ theorem ofENat_zero : ofENat 0 = 0 := rfl
699
+
700
+ @[simp, norm_cast]
701
+ theorem ofENat_one : ofENat 1 = 1 := rfl
702
+
703
+ @[simp, norm_cast]
704
+ theorem ofENat_ofNat (n : Nat) [n.AtLeastTwo] : ofENat (no_index (OfNat.ofNat n)) = OfNat.ofNat n :=
705
+ rfl
696
706
697
707
-- Porting note (#10756): new theorem
698
708
@[simp, norm_cast]
699
709
theorem toWithTop_ofENat (n : ℕ∞) {_ : Decidable (n : PartENat).Dom} : toWithTop (↑n) = n := by
700
- induction n with
701
- | none => simp; rfl
702
- | some n =>
703
- simp only [toWithTop_natCast', ofENat_some]
704
- rfl
710
+ cases n using ENat.recTopCoe with
711
+ | top => simp
712
+ | coe n => simp
713
+
714
+ @[simp, norm_cast]
715
+ theorem ofENat_toWithTop (x : PartENat) {_ : Decidable (x : PartENat).Dom} : toWithTop x = x := by
716
+ induction x using PartENat.casesOn <;> simp
717
+
718
+ @[simp, norm_cast]
719
+ theorem ofENat_le {x y : ℕ∞} : ofENat x ≤ ofENat y ↔ x ≤ y := by
720
+ classical
721
+ rw [← toWithTop_le, toWithTop_ofENat, toWithTop_ofENat]
722
+
723
+ @[simp, norm_cast]
724
+ theorem ofENat_lt {x y : ℕ∞} : ofENat x < ofENat y ↔ x < y := by
725
+ classical
726
+ rw [← toWithTop_lt, toWithTop_ofENat, toWithTop_ofENat]
705
727
706
728
section WithTopEquiv
707
729
@@ -717,98 +739,75 @@ theorem toWithTop_add {x y : PartENat} : toWithTop (x + y) = toWithTop x + toWit
717
739
· simp_rw [toWithTop_natCast', ← Nat.cast_add, toWithTop_natCast', forall_const]
718
740
#align part_enat.to_with_top_add PartENat.toWithTop_add
719
741
720
- -- Porting note: The old proof of `right_inv` didn't work.
721
- -- (`by cases x; simp [with_top_equiv._match_1]; refl`)
722
- -- In order to get it to work, I introduced some new statements (see above),
723
- -- in particular `toWithTop_ofENat`.
724
742
/-- `Equiv` between `PartENat` and `ℕ∞` (for the order isomorphism see
725
743
`withTopOrderIso`). -/
744
+ @[simps]
726
745
noncomputable def withTopEquiv : PartENat ≃ ℕ∞ where
727
746
toFun x := toWithTop x
728
747
invFun x := ↑x
729
- left_inv x := by
730
- induction x using PartENat.casesOn <;>
731
- simp <;>
732
- rfl
733
- right_inv x := by
734
- simp [toWithTop_ofENat]
748
+ left_inv x := by simp
749
+ right_inv x := by simp
735
750
#align part_enat.with_top_equiv PartENat.withTopEquiv
736
751
737
- @[simp]
738
- theorem withTopEquiv_top : withTopEquiv ⊤ = ⊤ :=
739
- toWithTop_top'
752
+ theorem withTopEquiv_top : withTopEquiv ⊤ = ⊤ := by
753
+ simp
740
754
#align part_enat.with_top_equiv_top PartENat.withTopEquiv_top
741
755
742
- @[simp]
743
- theorem withTopEquiv_natCast (n : Nat) : withTopEquiv n = n :=
744
- toWithTop_natCast' _
756
+ theorem withTopEquiv_natCast (n : Nat) : withTopEquiv n = n := by
757
+ simp
745
758
#align part_enat.with_top_equiv_coe PartENat.withTopEquiv_natCast
746
759
747
- @[simp]
748
760
theorem withTopEquiv_zero : withTopEquiv 0 = 0 := by
749
- simpa only [Nat.cast_zero] using withTopEquiv_natCast 0
761
+ simp
750
762
#align part_enat.with_top_equiv_zero PartENat.withTopEquiv_zero
751
763
752
- @[simp]
753
764
theorem withTopEquiv_one : withTopEquiv 1 = 1 := by
754
- simpa only [Nat.cast_one] using withTopEquiv_natCast 1
765
+ simp
755
766
756
- @[simp]
757
767
theorem withTopEquiv_ofNat (n : Nat) [n.AtLeastTwo] :
758
- withTopEquiv (no_index (OfNat.ofNat n)) = OfNat.ofNat n :=
759
- withTopEquiv_natCast n
768
+ withTopEquiv (no_index (OfNat.ofNat n)) = OfNat.ofNat n := by
769
+ simp
760
770
761
- @[simp]
762
- theorem withTopEquiv_le {x y : PartENat} : withTopEquiv x ≤ withTopEquiv y ↔ x ≤ y :=
763
- toWithTop_le
771
+ theorem withTopEquiv_le {x y : PartENat} : withTopEquiv x ≤ withTopEquiv y ↔ x ≤ y := by
772
+ simp
764
773
#align part_enat.with_top_equiv_le PartENat.withTopEquiv_le
765
774
766
- @[simp]
767
- theorem withTopEquiv_lt {x y : PartENat} : withTopEquiv x < withTopEquiv y ↔ x < y :=
768
- toWithTop_lt
775
+ theorem withTopEquiv_lt {x y : PartENat} : withTopEquiv x < withTopEquiv y ↔ x < y := by
776
+ simp
769
777
#align part_enat.with_top_equiv_lt PartENat.withTopEquiv_lt
770
778
771
- /-- `to_WithTop` induces an order isomorphism between `PartENat` and `ℕ∞`. -/
772
- noncomputable def withTopOrderIso : PartENat ≃o ℕ∞ :=
773
- { withTopEquiv with map_rel_iff' := @fun _ _ => withTopEquiv_le }
774
- #align part_enat.with_top_order_iso PartENat.withTopOrderIso
775
-
776
- @[simp]
777
- theorem withTopEquiv_symm_top : withTopEquiv.symm ⊤ = ⊤ :=
778
- rfl
779
+ theorem withTopEquiv_symm_top : withTopEquiv.symm ⊤ = ⊤ := by
780
+ simp
779
781
#align part_enat.with_top_equiv_symm_top PartENat.withTopEquiv_symm_top
780
782
781
- @[simp]
782
- theorem withTopEquiv_symm_coe (n : Nat) : withTopEquiv.symm n = n :=
783
- rfl
783
+ theorem withTopEquiv_symm_coe (n : Nat) : withTopEquiv.symm n = n := by
784
+ simp
784
785
#align part_enat.with_top_equiv_symm_coe PartENat.withTopEquiv_symm_coe
785
786
786
- @[simp]
787
- theorem withTopEquiv_symm_zero : withTopEquiv.symm 0 = 0 :=
788
- rfl
787
+ theorem withTopEquiv_symm_zero : withTopEquiv.symm 0 = 0 := by
788
+ simp
789
789
#align part_enat.with_top_equiv_symm_zero PartENat.withTopEquiv_symm_zero
790
790
791
- @[simp]
792
- theorem withTopEquiv_symm_one : withTopEquiv.symm 1 = 1 :=
793
- rfl
791
+ theorem withTopEquiv_symm_one : withTopEquiv.symm 1 = 1 := by
792
+ simp
794
793
795
- @[simp]
796
794
theorem withTopEquiv_symm_ofNat (n : Nat) [n.AtLeastTwo] :
797
- withTopEquiv.symm (no_index (OfNat.ofNat n)) = OfNat.ofNat n :=
798
- rfl
795
+ withTopEquiv.symm (no_index (OfNat.ofNat n)) = OfNat.ofNat n := by
796
+ simp
799
797
800
- @[simp]
801
798
theorem withTopEquiv_symm_le {x y : ℕ∞} : withTopEquiv.symm x ≤ withTopEquiv.symm y ↔ x ≤ y := by
802
- rw [← withTopEquiv_le]
803
799
simp
804
800
#align part_enat.with_top_equiv_symm_le PartENat.withTopEquiv_symm_le
805
801
806
- @[simp]
807
802
theorem withTopEquiv_symm_lt {x y : ℕ∞} : withTopEquiv.symm x < withTopEquiv.symm y ↔ x < y := by
808
- rw [← withTopEquiv_lt]
809
803
simp
810
804
#align part_enat.with_top_equiv_symm_lt PartENat.withTopEquiv_symm_lt
811
805
806
+ /-- `toWithTop` induces an order isomorphism between `PartENat` and `ℕ∞`. -/
807
+ noncomputable def withTopOrderIso : PartENat ≃o ℕ∞ :=
808
+ { withTopEquiv with map_rel_iff' := @fun _ _ => withTopEquiv_le }
809
+ #align part_enat.with_top_order_iso PartENat.withTopOrderIso
810
+
812
811
/-- `toWithTop` induces an additive monoid isomorphism between `PartENat` and `ℕ∞`. -/
813
812
noncomputable def withTopAddEquiv : PartENat ≃+ ℕ∞ :=
814
813
{ withTopEquiv with
0 commit comments