@@ -529,20 +529,31 @@ theorem map_ne_one_iff {M N} [MulOneClass M] [MulOneClass N] (h : M ≃* N) {x :
529
529
#align mul_equiv.map_ne_one_iff MulEquiv.map_ne_one_iff
530
530
#align add_equiv.map_ne_zero_iff AddEquiv.map_ne_zero_iff
531
531
532
+ -- porting note: Mathlib 3 had `@[simps apply]` but right now in Lean 4 it's generating
533
+ -- simp lemmas which don't lint.
532
534
/-- A bijective `Semigroup` homomorphism is an isomorphism -/
533
- @[to_additive "A bijective `AddSemigroup` homomorphism is an isomorphism", simps apply ]
535
+ @[to_additive "A bijective `AddSemigroup` homomorphism is an isomorphism"]
534
536
noncomputable def ofBijective {M N F} [Mul M] [Mul N] [MulHomClass F M N]
535
537
(f : F) (hf : Function.Bijective f) :
536
538
M ≃* N :=
537
539
{ Equiv.ofBijective f hf with map_mul' := map_mul f }
538
540
#align mul_equiv.of_bijective MulEquiv.ofBijective
539
541
#align add_equiv.of_bijective AddEquiv.ofBijective
540
542
541
- @[simp]
543
+ -- porting note: `@[simps apply]` should be making this lemma but it actually makes
544
+ -- a lemma with `toFun` which isn't in simp normal form.
545
+ @[simp, to_additive] theorem ofBijective_apply {M N F} [Mul M] [Mul N] [MulHomClass F M N]
546
+ (f : F) (hf : Function.Bijective f) (a : M) : (MulEquiv.ofBijective f hf).toEquiv a = f a :=
547
+ rfl
548
+ #align mul_equiv.of_bijective_apply MulEquiv.ofBijective_apply
549
+ #align add_equiv.of_bijective_apply AddEquiv.ofBijective_apply
550
+
551
+ @[simp, to_additive]
542
552
theorem ofBijective_apply_symm_apply {M N} [MulOneClass M] [MulOneClass N] {n : N} (f : M →* N)
543
553
(hf : Function.Bijective f) : f ((Equiv.ofBijective f hf).symm n) = n :=
544
554
(MulEquiv.ofBijective f hf).apply_symm_apply n
545
555
#align mul_equiv.of_bijective_apply_symm_apply MulEquiv.ofBijective_apply_symm_apply
556
+ #align add_equiv.of_bijective_apply_symm_apply AddEquiv.ofBijective_apply_symm_apply
546
557
547
558
/-- Extract the forward direction of a multiplicative equivalence
548
559
as a multiplication-preserving function.
@@ -589,8 +600,9 @@ for multiplicative maps from a monoid to a commutative monoid.
589
600
-/
590
601
@[to_additive
591
602
"An additive analogue of `Equiv.arrowCongr`,
592
- for additive maps from an additive monoid to a commutative additive monoid." ,
593
- simps apply]
603
+ for additive maps from an additive monoid to a commutative additive monoid." ]
604
+ -- porting note: @[simps apply] removed because it was making a lemma which
605
+ -- wasn't in simp normal form.
594
606
def monoidHomCongr {M N P Q} [MulOneClass M] [MulOneClass N] [CommMonoid P] [CommMonoid Q]
595
607
(f : M ≃* N) (g : P ≃* Q) :
596
608
(M →* P) ≃* (N →* Q) where
@@ -602,6 +614,14 @@ def monoidHomCongr {M N P Q} [MulOneClass M] [MulOneClass N] [CommMonoid P] [Com
602
614
#align mul_equiv.monoid_hom_congr MulEquiv.monoidHomCongr
603
615
#align add_equiv.add_monoid_hom_congr AddEquiv.addMonoidHomCongr
604
616
617
+ @[simp, to_additive] theorem monoidHomCongr_apply {M N P Q} [MulOneClass M] [MulOneClass N]
618
+ [CommMonoid P] [CommMonoid Q] (f : M ≃* N) (g : P ≃* Q) (h : M →* P) :
619
+ (MulEquiv.monoidHomCongr f g).toEquiv h = MonoidHom.comp (MulEquiv.toMonoidHom g)
620
+ (MonoidHom.comp h (MulEquiv.toMonoidHom (MulEquiv.symm f))) :=
621
+ rfl
622
+ #align mul_equiv.monoid_hom_congr_apply MulEquiv.monoidHomCongr_apply
623
+ #align add_equiv.add_monoid_hom_congr_apply AddEquiv.addMonoidHomCongr_apply
624
+
605
625
/-- A family of multiplicative equivalences `Π j, (Ms j ≃* Ns j)` generates a
606
626
multiplicative equivalence between `Π j, Ms j` and `Π j, Ns j`.
607
627
@@ -647,14 +667,29 @@ theorem piCongrRight_trans {η : Type _} {Ms Ns Ps : η → Type _} [∀ j, Mul
647
667
index. -/
648
668
@[to_additive
649
669
"A family indexed by a nonempty subsingleton type is
650
- equivalent to the element at the single index." ,
651
- simps]
670
+ equivalent to the element at the single index." ]
652
671
def piSubsingleton {ι : Type _} (M : ι → Type _) [∀ j, Mul (M j)] [Subsingleton ι]
653
672
(i : ι) : (∀ j, M j) ≃* M i :=
654
673
{ Equiv.piSubsingleton M i with map_mul' := fun _ _ => Pi.mul_apply _ _ _ }
655
674
#align mul_equiv.Pi_subsingleton MulEquiv.piSubsingleton
656
675
#align add_equiv.Pi_subsingleton AddEquiv.piSubsingleton
657
676
677
+ -- porting note: the next two lemmas should be being generated by `@[to_additive, simps]`.
678
+ -- They are added manually because `@[simps]` is currently generating lemmas with `toFun` in
679
+ @[simp, to_additive] theorem piSubsingleton_apply {ι : Type _} (M : ι → Type _) [∀ j, Mul (M j)]
680
+ [Subsingleton ι] (i : ι) (f : (x : ι) → M x) : (MulEquiv.piSubsingleton M i).toEquiv f = f i :=
681
+ rfl
682
+ #align mul_equiv.Pi_subsingleton_apply MulEquiv.piSubsingleton_apply
683
+ #align add_equiv.Pi_subsingleton_apply AddEquiv.piSubsingleton_apply
684
+
685
+ @[simp, to_additive] theorem piSubsingleton_symmApply {ι : Type _} (M : ι → Type _) [∀ j, Mul (M j)]
686
+ [Subsingleton ι] (i : ι) (x : M i) (b : ι) :
687
+ (MulEquiv.symm (MulEquiv.piSubsingleton M i)) x b =
688
+ cast (Subsingleton.elim i b ▸ rfl : M i = M b) x :=
689
+ rfl
690
+ #align mul_equiv.Pi_subsingleton_symmApply MulEquiv.piSubsingleton_symmApply
691
+ #align add_equiv.Pi_subsingleton_symmApply AddEquiv.piSubsingleton_symmApply
692
+
658
693
/-!
659
694
# Groups
660
695
-/
@@ -677,6 +712,10 @@ protected theorem map_div [Group G] [DivisionMonoid H] (h : G ≃* H) (x y : G)
677
712
678
713
end MulEquiv
679
714
715
+ -- porting note: we want to add
716
+ -- `@[simps (config := { fullyApplied := false })]`
717
+ -- here, but it generates simp lemmas which aren't in simp normal form
718
+ -- (they have `toFun` in)
680
719
/-- Given a pair of multiplicative homomorphisms `f`, `g` such that `g.comp f = id` and
681
720
`f.comp g = id`, returns an multiplicative equivalence with `toFun = f` and `invFun = g`. This
682
721
constructor is useful if the underlying type(s) have specialized `ext` lemmas for multiplicative
@@ -685,8 +724,7 @@ homomorphisms. -/
685
724
"Given a pair of additive homomorphisms `f`, `g` such that `g.comp f = id` and
686
725
`f.comp g = id`, returns an additive equivalence with `toFun = f` and `invFun = g`. This
687
726
constructor is useful if the underlying type(s) have specialized `ext` lemmas for additive
688
- homomorphisms." ,
689
- simps (config := { fullyApplied := false })]
727
+ homomorphisms." ]
690
728
def MulHom.toMulEquiv [Mul M] [Mul N] (f : M →ₙ* N) (g : N →ₙ* M) (h₁ : g.comp f = MulHom.id _)
691
729
(h₂ : f.comp g = MulHom.id _) : M ≃* N where
692
730
toFun := f
@@ -697,15 +735,32 @@ def MulHom.toMulEquiv [Mul M] [Mul N] (f : M →ₙ* N) (g : N →ₙ* M) (h₁
697
735
#align mul_hom.to_mul_equiv MulHom.toMulEquiv
698
736
#align add_hom.to_add_equiv AddHom.toAddEquiv
699
737
738
+ -- porting note: the next two lemmas were added manually because `@[simps]` is generating
739
+ -- lemmas with `toFun` in
740
+ @[simp, to_additive] theorem MulHom.toMulEquiv_apply [Mul M] [Mul N] (f : M →ₙ* N) (g : N →ₙ* M)
741
+ (h₁ : g.comp f = MulHom.id _) (h₂ : f.comp g = MulHom.id _) :
742
+ ((MulHom.toMulEquiv f g h₁ h₂).toEquiv : M → N) = f :=
743
+ rfl
744
+ #align mul_hom.to_mul_equiv_apply MulHom.toMulEquiv_apply
745
+ #align add_hom.to_add_equiv_apply AddHom.toAddEquiv_apply
746
+
747
+ @[simp, to_additive] theorem MulHom.toMulEquiv_symmApply [Mul M] [Mul N] (f : M →ₙ* N) (g : N →ₙ* M)
748
+ (h₁ : g.comp f = MulHom.id _) (h₂ : f.comp g = MulHom.id _) :
749
+ (MulEquiv.symm (MulHom.toMulEquiv f g h₁ h₂) : N → M) = ↑g :=
750
+ rfl
751
+ #align mul_hom.to_mul_equiv_symm_apply MulHom.toMulEquiv_symmApply
752
+ #align add_hom.to_add_equiv_symm_apply AddHom.toAddEquiv_symmApply
753
+
754
+ -- porting note: `@[simps (config := { fullyApplied := false })]` generates a simp lemma
755
+ -- which is not in simp normal form, so we add them manually
700
756
/-- Given a pair of monoid homomorphisms `f`, `g` such that `g.comp f = id` and `f.comp g = id`,
701
757
returns an multiplicative equivalence with `toFun = f` and `invFun = g`. This constructor is
702
758
useful if the underlying type(s) have specialized `ext` lemmas for monoid homomorphisms. -/
703
759
@[to_additive
704
760
"Given a pair of additive monoid homomorphisms `f`, `g` such that `g.comp f = id`
705
761
and `f.comp g = id`, returns an additive equivalence with `toFun = f` and `invFun = g`. This
706
762
constructor is useful if the underlying type(s) have specialized `ext` lemmas for additive
707
- monoid homomorphisms." ,
708
- simps (config := { fullyApplied := false })]
763
+ monoid homomorphisms." ]
709
764
def MonoidHom.toMulEquiv [MulOneClass M] [MulOneClass N] (f : M →* N) (g : N →* M)
710
765
(h₁ : g.comp f = MonoidHom.id _) (h₂ : f.comp g = MonoidHom.id _) : M ≃* N where
711
766
toFun := f
@@ -716,6 +771,23 @@ def MonoidHom.toMulEquiv [MulOneClass M] [MulOneClass N] (f : M →* N) (g : N
716
771
#align monoid_hom.to_mul_equiv MonoidHom.toMulEquiv
717
772
#align add_monoid_hom.to_add_mul_equiv AddMonoidHom.toAddEquiv
718
773
774
+ -- porting note: the next 2 lemmas should be being generated by
775
+ -- `@[to_additive, simps (config := { fullyApplied := false })]`
776
+ -- but right now it's generating `simp` lemmas which aren't in `simp` normal form.
777
+ @[simp, to_additive] theorem MonoidHom.toMulEquiv_apply [MulOneClass M] [MulOneClass N] (f : M →* N)
778
+ (g : N →* M) (h₁ : g.comp f = MonoidHom.id _) (h₂ : f.comp g = MonoidHom.id _) :
779
+ ((MonoidHom.toMulEquiv f g h₁ h₂).toEquiv : M → N) = ↑f :=
780
+ rfl
781
+ #align monoid_hom.to_mul_equiv_apply MonoidHom.toMulEquiv_apply
782
+ #align add_monoid_hom.to_add_equiv_apply AddMonoidHom.toAddEquiv_apply
783
+
784
+ @[simp, to_additive] theorem MonoidHom.toMulEquiv_symmApply [MulOneClass M] [MulOneClass N]
785
+ (f : M →* N) (g : N →* M) (h₁ : g.comp f = MonoidHom.id _) (h₂ : f.comp g = MonoidHom.id _) :
786
+ (MulEquiv.symm (MonoidHom.toMulEquiv f g h₁ h₂) : N → M) = g :=
787
+ rfl
788
+ #align monoid_hom.to_mul_equiv_symm_apply MonoidHom.toMulEquiv_symmApply
789
+ #align add_monoid_hom.to_add_equiv_symm_apply AddMonoidHom.toAddEquiv_symmApply
790
+
719
791
namespace Equiv
720
792
721
793
section InvolutiveInv
0 commit comments