diff --git "a/Extracted/Mathlib/TacticPrediction/Mathlib_Algebra_Algebra_Equiv.jsonl" "b/Extracted/Mathlib/TacticPrediction/Mathlib_Algebra_Algebra_Equiv.jsonl" deleted file mode 100644--- "a/Extracted/Mathlib/TacticPrediction/Mathlib_Algebra_Algebra_Equiv.jsonl" +++ /dev/null @@ -1,59 +0,0 @@ -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne f g : A₁ ≃ₐ[R] A₂\nh₁ : (fun f => f.toFun) f = (fun f => f.toFun) g\nh₂ : (fun f => f.invFun) f = (fun f => f.invFun) g\n⊢ f = g","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n ","nextTactic":"obtain ⟨⟨f,_⟩,_⟩ := f","declUpToTactic":"instance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.104_0.gpEhvIDvcS3ZH5c","decl":"instance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f "} -{"state":"case mk.mk\nR : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne g : A₁ ≃ₐ[R] A₂\nf : A₁ → A₂\ninvFun✝ : A₂ → A₁\nleft_inv✝ : Function.LeftInverse invFun✝ f\nright_inv✝ : Function.RightInverse invFun✝ f\nmap_mul'✝ :\n ∀ (x y : A₁),\n Equiv.toFun { toFun := f, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ } (x * y) =\n Equiv.toFun { toFun := f, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ } x *\n Equiv.toFun { toFun := f, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ } y\nmap_add'✝ :\n ∀ (x y : A₁),\n Equiv.toFun { toFun := f, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ } (x + y) =\n Equiv.toFun { toFun := f, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ } x +\n Equiv.toFun { toFun := f, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ } y\ncommutes'✝ :\n ∀ (r : R),\n Equiv.toFun { toFun := f, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ }\n ((algebraMap R A₁) r) =\n (algebraMap R A₂) r\nh₁ :\n (fun f => f.toFun)\n { toEquiv := { toFun := f, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ },\n map_mul' := map_mul'✝, map_add' := map_add'✝, commutes' := commutes'✝ } =\n (fun f => f.toFun) g\nh₂ :\n (fun f => f.invFun)\n { toEquiv := { toFun := f, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ },\n map_mul' := map_mul'✝, map_add' := map_add'✝, commutes' := commutes'✝ } =\n (fun f => f.invFun) g\n⊢ { toEquiv := { toFun := f, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ }, map_mul' := map_mul'✝,\n map_add' := map_add'✝, commutes' := commutes'✝ } =\n g","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n ","nextTactic":"obtain ⟨⟨g,_⟩,_⟩ := g","declUpToTactic":"instance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.104_0.gpEhvIDvcS3ZH5c","decl":"instance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f "} -{"state":"case mk.mk.mk.mk\nR : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\nf : A₁ → A₂\ninvFun✝¹ : A₂ → A₁\nleft_inv✝¹ : Function.LeftInverse invFun✝¹ f\nright_inv✝¹ : Function.RightInverse invFun✝¹ f\nmap_mul'✝¹ :\n ∀ (x y : A₁),\n Equiv.toFun { toFun := f, invFun := invFun✝¹, left_inv := left_inv✝¹, right_inv := right_inv✝¹ } (x * y) =\n Equiv.toFun { toFun := f, invFun := invFun✝¹, left_inv := left_inv✝¹, right_inv := right_inv✝¹ } x *\n Equiv.toFun { toFun := f, invFun := invFun✝¹, left_inv := left_inv✝¹, right_inv := right_inv✝¹ } y\nmap_add'✝¹ :\n ∀ (x y : A₁),\n Equiv.toFun { toFun := f, invFun := invFun✝¹, left_inv := left_inv✝¹, right_inv := right_inv✝¹ } (x + y) =\n Equiv.toFun { toFun := f, invFun := invFun✝¹, left_inv := left_inv✝¹, right_inv := right_inv✝¹ } x +\n Equiv.toFun { toFun := f, invFun := invFun✝¹, left_inv := left_inv✝¹, right_inv := right_inv✝¹ } y\ncommutes'✝¹ :\n ∀ (r : R),\n Equiv.toFun { toFun := f, invFun := invFun✝¹, left_inv := left_inv✝¹, right_inv := right_inv✝¹ }\n ((algebraMap R A₁) r) =\n (algebraMap R A₂) r\ng : A₁ → A₂\ninvFun✝ : A₂ → A₁\nleft_inv✝ : Function.LeftInverse invFun✝ g\nright_inv✝ : Function.RightInverse invFun✝ g\nmap_mul'✝ :\n ∀ (x y : A₁),\n Equiv.toFun { toFun := g, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ } (x * y) =\n Equiv.toFun { toFun := g, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ } x *\n Equiv.toFun { toFun := g, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ } y\nmap_add'✝ :\n ∀ (x y : A₁),\n Equiv.toFun { toFun := g, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ } (x + y) =\n Equiv.toFun { toFun := g, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ } x +\n Equiv.toFun { toFun := g, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ } y\ncommutes'✝ :\n ∀ (r : R),\n Equiv.toFun { toFun := g, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ }\n ((algebraMap R A₁) r) =\n (algebraMap R A₂) r\nh₁ :\n (fun f => f.toFun)\n { toEquiv := { toFun := f, invFun := invFun✝¹, left_inv := left_inv✝¹, right_inv := right_inv✝¹ },\n map_mul' := map_mul'✝¹, map_add' := map_add'✝¹, commutes' := commutes'✝¹ } =\n (fun f => f.toFun)\n { toEquiv := { toFun := g, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ },\n map_mul' := map_mul'✝, map_add' := map_add'✝, commutes' := commutes'✝ }\nh₂ :\n (fun f => f.invFun)\n { toEquiv := { toFun := f, invFun := invFun✝¹, left_inv := left_inv✝¹, right_inv := right_inv✝¹ },\n map_mul' := map_mul'✝¹, map_add' := map_add'✝¹, commutes' := commutes'✝¹ } =\n (fun f => f.invFun)\n { toEquiv := { toFun := g, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ },\n map_mul' := map_mul'✝, map_add' := map_add'✝, commutes' := commutes'✝ }\n⊢ { toEquiv := { toFun := f, invFun := invFun✝¹, left_inv := left_inv✝¹, right_inv := right_inv✝¹ },\n map_mul' := map_mul'✝¹, map_add' := map_add'✝¹, commutes' := commutes'✝¹ } =\n { toEquiv := { toFun := g, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ },\n map_mul' := map_mul'✝, map_add' := map_add'✝, commutes' := commutes'✝ }","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n ","nextTactic":"congr","declUpToTactic":"instance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.104_0.gpEhvIDvcS3ZH5c","decl":"instance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne f g : A₁ ≃ₐ[R] A₂\nh₁ : (fun f => f.toFun) f = (fun f => f.toFun) g\nh₂ : (fun f => f.invFun) f = (fun f => f.invFun) g\n⊢ f = g","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n ","nextTactic":"obtain ⟨⟨f,_⟩,_⟩ := f","declUpToTactic":"instance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.123_0.gpEhvIDvcS3ZH5c","decl":"instance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f "} -{"state":"case mk.mk\nR : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne g : A₁ ≃ₐ[R] A₂\nf : A₁ → A₂\ninvFun✝ : A₂ → A₁\nleft_inv✝ : Function.LeftInverse invFun✝ f\nright_inv✝ : Function.RightInverse invFun✝ f\nmap_mul'✝ :\n ∀ (x y : A₁),\n Equiv.toFun { toFun := f, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ } (x * y) =\n Equiv.toFun { toFun := f, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ } x *\n Equiv.toFun { toFun := f, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ } y\nmap_add'✝ :\n ∀ (x y : A₁),\n Equiv.toFun { toFun := f, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ } (x + y) =\n Equiv.toFun { toFun := f, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ } x +\n Equiv.toFun { toFun := f, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ } y\ncommutes'✝ :\n ∀ (r : R),\n Equiv.toFun { toFun := f, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ }\n ((algebraMap R A₁) r) =\n (algebraMap R A₂) r\nh₁ :\n (fun f => f.toFun)\n { toEquiv := { toFun := f, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ },\n map_mul' := map_mul'✝, map_add' := map_add'✝, commutes' := commutes'✝ } =\n (fun f => f.toFun) g\nh₂ :\n (fun f => f.invFun)\n { toEquiv := { toFun := f, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ },\n map_mul' := map_mul'✝, map_add' := map_add'✝, commutes' := commutes'✝ } =\n (fun f => f.invFun) g\n⊢ { toEquiv := { toFun := f, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ }, map_mul' := map_mul'✝,\n map_add' := map_add'✝, commutes' := commutes'✝ } =\n g","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n ","nextTactic":"obtain ⟨⟨g,_⟩,_⟩ := g","declUpToTactic":"instance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.123_0.gpEhvIDvcS3ZH5c","decl":"instance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f "} -{"state":"case mk.mk.mk.mk\nR : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\nf : A₁ → A₂\ninvFun✝¹ : A₂ → A₁\nleft_inv✝¹ : Function.LeftInverse invFun✝¹ f\nright_inv✝¹ : Function.RightInverse invFun✝¹ f\nmap_mul'✝¹ :\n ∀ (x y : A₁),\n Equiv.toFun { toFun := f, invFun := invFun✝¹, left_inv := left_inv✝¹, right_inv := right_inv✝¹ } (x * y) =\n Equiv.toFun { toFun := f, invFun := invFun✝¹, left_inv := left_inv✝¹, right_inv := right_inv✝¹ } x *\n Equiv.toFun { toFun := f, invFun := invFun✝¹, left_inv := left_inv✝¹, right_inv := right_inv✝¹ } y\nmap_add'✝¹ :\n ∀ (x y : A₁),\n Equiv.toFun { toFun := f, invFun := invFun✝¹, left_inv := left_inv✝¹, right_inv := right_inv✝¹ } (x + y) =\n Equiv.toFun { toFun := f, invFun := invFun✝¹, left_inv := left_inv✝¹, right_inv := right_inv✝¹ } x +\n Equiv.toFun { toFun := f, invFun := invFun✝¹, left_inv := left_inv✝¹, right_inv := right_inv✝¹ } y\ncommutes'✝¹ :\n ∀ (r : R),\n Equiv.toFun { toFun := f, invFun := invFun✝¹, left_inv := left_inv✝¹, right_inv := right_inv✝¹ }\n ((algebraMap R A₁) r) =\n (algebraMap R A₂) r\ng : A₁ → A₂\ninvFun✝ : A₂ → A₁\nleft_inv✝ : Function.LeftInverse invFun✝ g\nright_inv✝ : Function.RightInverse invFun✝ g\nmap_mul'✝ :\n ∀ (x y : A₁),\n Equiv.toFun { toFun := g, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ } (x * y) =\n Equiv.toFun { toFun := g, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ } x *\n Equiv.toFun { toFun := g, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ } y\nmap_add'✝ :\n ∀ (x y : A₁),\n Equiv.toFun { toFun := g, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ } (x + y) =\n Equiv.toFun { toFun := g, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ } x +\n Equiv.toFun { toFun := g, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ } y\ncommutes'✝ :\n ∀ (r : R),\n Equiv.toFun { toFun := g, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ }\n ((algebraMap R A₁) r) =\n (algebraMap R A₂) r\nh₁ :\n (fun f => f.toFun)\n { toEquiv := { toFun := f, invFun := invFun✝¹, left_inv := left_inv✝¹, right_inv := right_inv✝¹ },\n map_mul' := map_mul'✝¹, map_add' := map_add'✝¹, commutes' := commutes'✝¹ } =\n (fun f => f.toFun)\n { toEquiv := { toFun := g, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ },\n map_mul' := map_mul'✝, map_add' := map_add'✝, commutes' := commutes'✝ }\nh₂ :\n (fun f => f.invFun)\n { toEquiv := { toFun := f, invFun := invFun✝¹, left_inv := left_inv✝¹, right_inv := right_inv✝¹ },\n map_mul' := map_mul'✝¹, map_add' := map_add'✝¹, commutes' := commutes'✝¹ } =\n (fun f => f.invFun)\n { toEquiv := { toFun := g, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ },\n map_mul' := map_mul'✝, map_add' := map_add'✝, commutes' := commutes'✝ }\n⊢ { toEquiv := { toFun := f, invFun := invFun✝¹, left_inv := left_inv✝¹, right_inv := right_inv✝¹ },\n map_mul' := map_mul'✝¹, map_add' := map_add'✝¹, commutes' := commutes'✝¹ } =\n { toEquiv := { toFun := g, invFun := invFun✝, left_inv := left_inv✝, right_inv := right_inv✝ },\n map_mul' := map_mul'✝, map_add' := map_add'✝, commutes' := commutes'✝ }","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n ","nextTactic":"congr","declUpToTactic":"instance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.123_0.gpEhvIDvcS3ZH5c","decl":"instance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\nr : R\nx : A₁\n⊢ e (r • x) = r • e x","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n ","nextTactic":"simp only [Algebra.smul_def, map_mul, commutes]","declUpToTactic":"theorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.240_0.gpEhvIDvcS3ZH5c","decl":"theorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne✝ e : A₁ ≃ₐ[R] A₂\nsrc✝ : A₂ ≃+* A₁ := RingEquiv.symm (toRingEquiv e)\nr : R\n⊢ Equiv.toFun src✝.toEquiv ((algebraMap R A₂) r) = (algebraMap R A₁) r","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n ","nextTactic":"rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]","declUpToTactic":"/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.323_0.gpEhvIDvcS3ZH5c","decl":"/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne✝ e : A₁ ≃ₐ[R] A₂\nsrc✝ : A₂ ≃+* A₁ := RingEquiv.symm (toRingEquiv e)\nr : R\n⊢ Equiv.toFun src✝.toEquiv ((algebraMap R A₂) r) =\n (RingEquiv.symm (toRingEquiv e)) ((toRingEquiv e) ((algebraMap R A₁) r))","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n ","nextTactic":"congr","declUpToTactic":"/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.323_0.gpEhvIDvcS3ZH5c","decl":"/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ "} -{"state":"case e_a\nR : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne✝ e : A₁ ≃ₐ[R] A₂\nsrc✝ : A₂ ≃+* A₁ := RingEquiv.symm (toRingEquiv e)\nr : R\n⊢ (algebraMap R A₂) r = (toRingEquiv e) ((algebraMap R A₁) r)","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n ","nextTactic":"change _ = e _","declUpToTactic":"/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.323_0.gpEhvIDvcS3ZH5c","decl":"/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ "} -{"state":"case e_a\nR : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne✝ e : A₁ ≃ₐ[R] A₂\nsrc✝ : A₂ ≃+* A₁ := RingEquiv.symm (toRingEquiv e)\nr : R\n⊢ (algebraMap R A₂) r = e ((algebraMap R A₁) r)","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smul��ₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n ","nextTactic":"rw [e.commutes]","declUpToTactic":"/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.323_0.gpEhvIDvcS3ZH5c","decl":"/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne✝ e : A₁ ≃ₐ[R] A₂\n⊢ symm (symm e) = e","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ","nextTactic":"ext","declUpToTactic":"@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.362_0.gpEhvIDvcS3ZH5c","decl":"@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e "} -{"state":"case h\nR : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne✝ e : A₁ ≃ₐ[R] A₂\na✝ : A₁\n⊢ (symm (symm e)) a✝ = e a✝","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A��} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n ","nextTactic":"rfl","declUpToTactic":"@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.362_0.gpEhvIDvcS3ZH5c","decl":"@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne e₁ : A₁ ≃ₐ[R] A₂\ne₂ : A₂ ≃ₐ[R] A₃\nsrc✝ : A₁ ≃+* A₃ := RingEquiv.trans (toRingEquiv e₁) (toRingEquiv e₂)\nr : R\n⊢ Equiv.toFun e₂.toEquiv (Equiv.toFun e₁.toEquiv ((algebraMap R A₁) r)) = (algebraMap R A₃) r","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by ","nextTactic":"rw [e₁.commutes', e₂.commutes']","declUpToTactic":"/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.402_0.gpEhvIDvcS3ZH5c","decl":"/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne✝ e : A₁ ≃ₐ[R] A₂\n⊢ AlgHom.comp ↑e ↑(symm e) = AlgHom.id R A₂","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ","nextTactic":"ext","declUpToTactic":"@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.435_0.gpEhvIDvcS3ZH5c","decl":"@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ "} -{"state":"case H\nR : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne✝ e : A₁ ≃ₐ[R] A₂\nx✝ : A₂\n⊢ (AlgHom.comp ↑e ↑(symm e)) x✝ = (AlgHom.id R A₂) x✝","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h��, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n ","nextTactic":"simp","declUpToTactic":"@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.435_0.gpEhvIDvcS3ZH5c","decl":"@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne✝ e : A₁ ≃ₐ[R] A₂\n⊢ AlgHom.comp ↑(symm e) ↑e = AlgHom.id R A₁","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ","nextTactic":"ext","declUpToTactic":"@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.441_0.gpEhvIDvcS3ZH5c","decl":"@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ "} -{"state":"case H\nR : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne✝ e : A₁ ≃ₐ[R] A₂\nx✝ : A₁\n⊢ (AlgHom.comp ↑(symm e) ↑e) x✝ = (AlgHom.id R A₁) x✝","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A�� :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n ","nextTactic":"simp","declUpToTactic":"@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.441_0.gpEhvIDvcS3ZH5c","decl":"@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\ne₁ : A₁ ≃ₐ[R] A₁'\ne₂ : A₂ ≃ₐ[R] A₂'\nf : A₁ →ₐ[R] A₂\n⊢ (fun f => AlgHom.comp (AlgHom.comp (↑(symm e₂)) f) ↑e₁) ((fun f => AlgHom.comp (AlgHom.comp (↑e₂) f) ↑(symm e₁)) f) =\n f","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n ","nextTactic":"simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]","declUpToTactic":"/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.455_0.gpEhvIDvcS3ZH5c","decl":"/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\ne₁ : A₁ ≃ₐ[R] A₁'\ne₂ : A₂ ≃ₐ[R] A₂'\nf : A₁ →ₐ[R] A₂\n⊢ AlgHom.comp (↑(symm e₂)) (AlgHom.comp (↑e₂) (AlgHom.comp f (AlgHom.id R A₁))) = f","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n ","nextTactic":"simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]","declUpToTactic":"/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.455_0.gpEhvIDvcS3ZH5c","decl":"/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\ne�� : A₁ ≃ₐ[R] A₁'\ne₂ : A₂ ≃ₐ[R] A₂'\nf : A₁' →ₐ[R] A₂'\n⊢ (fun f => AlgHom.comp (AlgHom.comp (↑e₂) f) ↑(symm e₁)) ((fun f => AlgHom.comp (AlgHom.comp (↑(symm e₂)) f) ↑e₁) f) =\n f","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n ","nextTactic":"simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]","declUpToTactic":"/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.455_0.gpEhvIDvcS3ZH5c","decl":"/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\ne₁ : A₁ ≃ₐ[R] A₁'\ne₂ : A₂ ≃ₐ[R] A₂'\nf : A₁' →ₐ[R] A₂'\n⊢ AlgHom.comp (↑e₂) (AlgHom.comp (↑(symm e₂)) (AlgHom.comp f (AlgHom.id R A₁'))) = f","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n ","nextTactic":"simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]","declUpToTactic":"/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.455_0.gpEhvIDvcS3ZH5c","decl":"/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\ne₁ : A₁ ≃ₐ[R] A₁'\ne₂ : A₂ ≃ₐ[R] A₂'\ne₃ : A₃ ≃ₐ[R] A₃'\nf : A₁ →ₐ[R] A₂\ng : A₂ →ₐ[R] A₃\n⊢ (arrowCongr e₁ e₃) (AlgHom.comp g f) = AlgHom.comp ((arrowCongr e₂ e₃) g) ((arrowCongr e₁ e₂) f)","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ","nextTactic":"ext","declUpToTactic":"theorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.469_0.gpEhvIDvcS3ZH5c","decl":"theorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) "} -{"state":"case H\nR : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\ne₁ : A₁ ≃ₐ[R] A₁'\ne₂ : A₂ ≃ₐ[R] A₂'\ne₃ : A₃ ≃ₐ[R] A₃'\nf : A₁ →ₐ[R] A₂\ng : A₂ →ₐ[R] A₃\nx✝ : A₁'\n⊢ ((arrowCongr e₁ e₃) (AlgHom.comp g f)) x✝ = (AlgHom.comp ((arrowCongr e₂ e₃) g) ((arrowCongr e₁ e₂) f)) x✝","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n ","nextTactic":"simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]","declUpToTactic":"theorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.469_0.gpEhvIDvcS3ZH5c","decl":"theorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) "} -{"state":"case H\nR : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\ne₁ : A₁ ≃ₐ[R] A₁'\ne₂ : A₂ ≃ₐ[R] A₂'\ne₃ : A₃ ≃ₐ[R] A₃'\nf : A₁ →ₐ[R] A₂\ng : A₂ →ₐ[R] A₃\nx✝ : A₁'\n⊢ ↑e₃ (g (f (↑(symm e₁) x✝))) = ↑e₃ (g (↑(symm e₂) (↑e₂ (f (↑(symm e₁) x✝)))))","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) ��� A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n ","nextTactic":"congr","declUpToTactic":"theorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.469_0.gpEhvIDvcS3ZH5c","decl":"theorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃���[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) "} -{"state":"case H.h.e_6.h.h.e_6.h\nR : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\ne₁ : A₁ ≃ₐ[R] A₁'\ne₂ : A₂ ≃ₐ[R] A₂'\ne₃ : A₃ ≃ₐ[R] A₃'\nf : A₁ →ₐ[R] A₂\ng : A₂ →ₐ[R] A₃\nx✝ : A₁'\n⊢ f (↑(symm e₁) x✝) = ↑(symm e₂) (↑e₂ (f (↑(symm e₁) x✝)))","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃���[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n ","nextTactic":"exact (e₂.symm_apply_apply _).symm","declUpToTactic":"theorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.469_0.gpEhvIDvcS3ZH5c","decl":"theorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\n⊢ arrowCongr refl refl = Equiv.refl (A₁ →ₐ[R] A���)","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ","nextTactic":"ext","declUpToTactic":"@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.478_0.gpEhvIDvcS3ZH5c","decl":"@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) "} -{"state":"case H.H\nR : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\nx✝¹ : A₁ →ₐ[R] A₂\nx✝ : A₁\n⊢ ((arrowCongr refl refl) x✝¹) x✝ = ((Equiv.refl (A₁ →ₐ[R] A₂)) x✝¹) x✝","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃���[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n ","nextTactic":"rfl","declUpToTactic":"@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.478_0.gpEhvIDvcS3ZH5c","decl":"@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne e₁ : A₁ ≃ₐ[R] A₂\ne₁' : A₁' ≃ₐ[R] A₂'\ne₂ : A₂ ≃ₐ[R] A₃\ne₂' : A₂' ≃ₐ[R] A₃'\n⊢ arrowCongr (trans e₁ e₂) (trans e₁' e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂')","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ","nextTactic":"ext","declUpToTactic":"@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.484_0.gpEhvIDvcS3ZH5c","decl":"@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') "} -{"state":"case H.H\nR : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne e₁ : A₁ ≃ₐ[R] A₂\ne₁' : A₁' ≃ₐ[R] A₂'\ne₂ : A₂ ≃ₐ[R] A₃\ne₂' : A₂' ≃ₐ[R] A₃'\nx✝¹ : A₁ →ₐ[R] A₁'\nx✝ : A₃\n⊢ ((arrowCongr (trans e₁ e₂) (trans e₁' e₂')) x✝¹) x✝ = (((arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂')) x✝¹) x✝","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A��).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n ","nextTactic":"rfl","declUpToTactic":"@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.484_0.gpEhvIDvcS3ZH5c","decl":"@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\ne₁ : A₁ ≃ₐ[R] A₁'\ne₂ : A₂ ≃ₐ[R] A₂'\n⊢ (arrowCongr e₁ e₂).symm = arrowCongr (symm e₁) (symm e₂)","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smul��ₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ","nextTactic":"ext","declUpToTactic":"@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.492_0.gpEhvIDvcS3ZH5c","decl":"@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm "} -{"state":"case H.H\nR : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\ne₁ : A₁ ≃ₐ[R] A₁'\ne₂ : A₂ ≃ₐ[R] A₂'\nx✝¹ : A₁' →ₐ[R] A₂'\nx✝ : A₁\n⊢ ((arrowCongr e₁ e₂).symm x✝¹) x✝ = ((arrowCongr (symm e₁) (symm e₂)) x✝¹) x✝","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n ","nextTactic":"rfl","declUpToTactic":"@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.492_0.gpEhvIDvcS3ZH5c","decl":"@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne✝ e : A₁ ≃ₐ[R] A₂\ne' : A₁' ≃ₐ[R] A₂'\nψ : A₁ ≃ₐ[R] A₁'\n⊢ (fun ψ => trans e (trans ψ (symm e'))) ((fun ψ => trans (symm e) (trans ψ e')) ψ) = ψ","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ��_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ","nextTactic":"ext","declUpToTactic":"/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.499_0.gpEhvIDvcS3ZH5c","decl":"/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ "} -{"state":"case h\nR : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne✝ e : A₁ ≃ₐ[R] A₂\ne' : A₁' ≃ₐ[R] A₂'\nψ : A₁ ≃ₐ[R] A₁'\na✝ : A₁\n⊢ ((fun ψ => trans e (trans ψ (symm e'))) ((fun ψ => trans (symm e) (trans ψ e')) ψ)) a✝ = ψ a✝","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ �� A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n ","nextTactic":"simp_rw [trans_apply, symm_apply_apply]","declUpToTactic":"/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.499_0.gpEhvIDvcS3ZH5c","decl":"/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne✝ e : A₁ ≃ₐ[R] A₂\ne' : A₁' ≃ₐ[R] A₂'\nψ : A₂ ≃ₐ[R] A₂'\n⊢ (fun ψ => trans (symm e) (trans ψ e')) ((fun ψ => trans e (trans ψ (symm e'))) ψ) = ψ","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ","nextTactic":"ext","declUpToTactic":"/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.499_0.gpEhvIDvcS3ZH5c","decl":"/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ "} -{"state":"case h\nR : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne✝ e : A₁ ≃ₐ[R] A₂\ne' : A₁' ≃ₐ[R] A₂'\nψ : A₂ ≃ₐ[R] A₂'\na✝ : A₂\n⊢ ((fun ψ => trans (symm e) (trans ψ e')) ((fun ψ => trans e (trans ψ (symm e'))) ψ)) a✝ = ψ a✝","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ext\n ","nextTactic":"simp_rw [trans_apply, apply_symm_apply]","declUpToTactic":"/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ext\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.499_0.gpEhvIDvcS3ZH5c","decl":"/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\n⊢ equivCongr refl refl = Equiv.refl (A₁ ≃ₐ[R] A₁')","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ext\n simp_rw [trans_apply, apply_symm_apply]\n\n@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') := by\n ","nextTactic":"ext","declUpToTactic":"@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.514_0.gpEhvIDvcS3ZH5c","decl":"@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') "} -{"state":"case H.h\nR : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\nx✝ : A₁ ≃ₐ[R] A₁'\na✝ : A₁\n⊢ ((equivCongr refl refl) x✝) a✝ = ((Equiv.refl (A₁ ≃ₐ[R] A₁')) x✝) a✝","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ext\n simp_rw [trans_apply, apply_symm_apply]\n\n@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') := by\n ext\n ","nextTactic":"rfl","declUpToTactic":"@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') := by\n ext\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.514_0.gpEhvIDvcS3ZH5c","decl":"@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\nl : A₁ ≃ₗ[R] A₂\nmap_one✝ : l 1 = 1\nmap_mul✝ : ∀ (x y : A₁), l (x * y) = l x * l y\nmap_mul : (toLinearEquiv e) 1 = 1\nmap_one : ∀ (x y : A₁), (toLinearEquiv e) (x * y) = (toLinearEquiv e) x * (toLinearEquiv e) y\n⊢ ofLinearEquiv (toLinearEquiv e) map_mul map_one = e","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ext\n simp_rw [trans_apply, apply_symm_apply]\n\n@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') := by\n ext\n rfl\n\n@[simp]\ntheorem equivCongr_symm (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') :\n (equivCongr e e').symm = equivCongr e.symm e'.symm :=\n rfl\n\n@[simp]\ntheorem equivCongr_trans (e₁₂ : A₁ ≃ₐ[R] A₂) (e₁₂' : A₁' ≃ₐ[R] A₂')\n (e₂₃ : A₂ ≃ₐ[R] A₃) (e₂₃' : A₂' ≃ₐ[R] A₃') :\n (equivCongr e₁₂ e₁₂').trans (equivCongr e₂₃ e₂₃') =\n equivCongr (e₁₂.trans e₂₃) (e₁₂'.trans e₂₃') :=\n rfl\n\n/-- If an algebra morphism has an inverse, it is an algebra isomorphism. -/\ndef ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ : f.comp g = AlgHom.id R A₂)\n (h₂ : g.comp f = AlgHom.id R A₁) : A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := g\n left_inv := AlgHom.ext_iff.1 h₂\n right_inv := AlgHom.ext_iff.1 h₁ }\n#align alg_equiv.of_alg_hom AlgEquiv.ofAlgHom\n\ntheorem coe_algHom_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ↑(ofAlgHom f g h₁ h₂) = f :=\n AlgHom.ext fun _ => rfl\n#align alg_equiv.coe_alg_hom_of_alg_hom AlgEquiv.coe_algHom_ofAlgHom\n\n@[simp]\ntheorem ofAlgHom_coe_algHom (f : A₁ ≃ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ofAlgHom (↑f) g h₁ h₂ = f :=\n ext fun _ => rfl\n#align alg_equiv.of_alg_hom_coe_alg_hom AlgEquiv.ofAlgHom_coe_algHom\n\ntheorem ofAlgHom_symm (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).symm = ofAlgHom g f h₂ h₁ :=\n rfl\n#align alg_equiv.of_alg_hom_symm AlgEquiv.ofAlgHom_symm\n\n/-- Promotes a bijective algebra homomorphism to an algebra equivalence. -/\nnoncomputable def ofBijective (f : A₁ →ₐ[R] A₂) (hf : Function.Bijective f) : A₁ ≃ₐ[R] A₂ :=\n { RingEquiv.ofBijective (f : A₁ →+* A₂) hf, f with }\n#align alg_equiv.of_bijective AlgEquiv.ofBijective\n\n@[simp]\ntheorem coe_ofBijective {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} :\n (AlgEquiv.ofBijective f hf : A₁ → A₂) = f :=\n rfl\n#align alg_equiv.coe_of_bijective AlgEquiv.coe_ofBijective\n\ntheorem ofBijective_apply {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} (a : A₁) :\n (AlgEquiv.ofBijective f hf) a = f a :=\n rfl\n#align alg_equiv.of_bijective_apply AlgEquiv.ofBijective_apply\n\n/-- Forgetting the multiplicative structures, an equivalence of algebras is a linear equivalence. -/\n@[simps apply]\ndef toLinearEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ₗ[R] A₂ :=\n { e with\n toFun := e\n map_smul' := e.map_smul\n invFun := e.symm }\n#align alg_equiv.to_linear_equiv AlgEquiv.toLinearEquiv\n#align alg_equiv.to_linear_equiv_apply AlgEquiv.toLinearEquiv_apply\n\n@[simp]\ntheorem toLinearEquiv_refl : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).toLinearEquiv = LinearEquiv.refl R A₁ :=\n rfl\n#align alg_equiv.to_linear_equiv_refl AlgEquiv.toLinearEquiv_refl\n\n@[simp]\ntheorem toLinearEquiv_symm (e : A₁ ≃ₐ[R] A₂) : e.toLinearEquiv.symm = e.symm.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_symm AlgEquiv.toLinearEquiv_symm\n\n@[simp]\ntheorem toLinearEquiv_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) :\n (e₁.trans e₂).toLinearEquiv = e₁.toLinearEquiv.trans e₂.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_trans AlgEquiv.toLinearEquiv_trans\n\ntheorem toLinearEquiv_injective : Function.Injective (toLinearEquiv : _ → A₁ ≃ₗ[R] A₂) :=\n fun _ _ h => ext <| LinearEquiv.congr_fun h\n#align alg_equiv.to_linear_equiv_injective AlgEquiv.toLinearEquiv_injective\n\n/-- Interpret an algebra equivalence as a linear map. -/\ndef toLinearMap : A₁ →ₗ[R] A₂ :=\n e.toAlgHom.toLinearMap\n#align alg_equiv.to_linear_map AlgEquiv.toLinearMap\n\n@[simp]\ntheorem toAlgHom_toLinearMap : (e : A₁ →ₐ[R] A₂).toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_alg_hom_to_linear_map AlgEquiv.toAlgHom_toLinearMap\n\ntheorem toLinearMap_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).toLinearMap = f.toLinearMap :=\n LinearMap.ext fun _ => rfl\n\n@[simp]\ntheorem toLinearEquiv_toLinearMap : e.toLinearEquiv.toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_linear_equiv_to_linear_map AlgEquiv.toLinearEquiv_toLinearMap\n\n@[simp]\ntheorem toLinearMap_apply (x : A₁) : e.toLinearMap x = e x :=\n rfl\n#align alg_equiv.to_linear_map_apply AlgEquiv.toLinearMap_apply\n\ntheorem toLinearMap_injective : Function.Injective (toLinearMap : _ → A₁ →ₗ[R] A₂) := fun _ _ h =>\n ext <| LinearMap.congr_fun h\n#align alg_equiv.to_linear_map_injective AlgEquiv.toLinearMap_injective\n\n@[simp]\ntheorem trans_toLinearMap (f : A₁ ≃ₐ[R] A₂) (g : A₂ ≃ₐ[R] A₃) :\n (f.trans g).toLinearMap = g.toLinearMap.comp f.toLinearMap :=\n rfl\n#align alg_equiv.trans_to_linear_map AlgEquiv.trans_toLinearMap\n\nsection OfLinearEquiv\n\nvariable (l : A₁ ≃ₗ[R] A₂) (map_one : l 1 = 1) (map_mul : ∀ x y : A₁, l (x * y) = l x * l y)\n\n/-- Upgrade a linear equivalence to an algebra equivalence,\ngiven that it distributes over multiplication and the identity\n-/\n@[simps apply]\ndef ofLinearEquiv : A₁ ≃ₐ[R] A₂ :=\n { l with\n toFun := l\n invFun := l.symm\n map_mul' := map_mul\n commutes' := (AlgHom.ofLinearMap l map_one map_mul : A₁ →ₐ[R] A₂).commutes }\n#align alg_equiv.of_linear_equiv AlgEquiv.ofLinearEquivₓ\n\n@[simp]\ntheorem ofLinearEquiv_symm :\n (ofLinearEquiv l map_one map_mul).symm =\n ofLinearEquiv l.symm (ofLinearEquiv l map_one map_mul).symm.map_one\n (ofLinearEquiv l map_one map_mul).symm.map_mul :=\n rfl\n#align alg_equiv.of_linear_equiv_symm AlgEquiv.ofLinearEquiv_symm\n\n@[simp]\ntheorem ofLinearEquiv_toLinearEquiv (map_mul) (map_one) :\n ofLinearEquiv e.toLinearEquiv map_mul map_one = e := by\n ","nextTactic":"ext","declUpToTactic":"@[simp]\ntheorem ofLinearEquiv_toLinearEquiv (map_mul) (map_one) :\n ofLinearEquiv e.toLinearEquiv map_mul map_one = e := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.661_0.gpEhvIDvcS3ZH5c","decl":"@[simp]\ntheorem ofLinearEquiv_toLinearEquiv (map_mul) (map_one) :\n ofLinearEquiv e.toLinearEquiv map_mul map_one = e "} -{"state":"case h\nR : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\nl : A₁ ≃ₗ[R] A₂\nmap_one✝ : l 1 = 1\nmap_mul✝ : ∀ (x y : A₁), l (x * y) = l x * l y\nmap_mul : (toLinearEquiv e) 1 = 1\nmap_one : ∀ (x y : A₁), (toLinearEquiv e) (x * y) = (toLinearEquiv e) x * (toLinearEquiv e) y\na✝ : A₁\n⊢ (ofLinearEquiv (toLinearEquiv e) map_mul map_one) a✝ = e a✝","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ext\n simp_rw [trans_apply, apply_symm_apply]\n\n@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') := by\n ext\n rfl\n\n@[simp]\ntheorem equivCongr_symm (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') :\n (equivCongr e e').symm = equivCongr e.symm e'.symm :=\n rfl\n\n@[simp]\ntheorem equivCongr_trans (e₁₂ : A₁ ≃ₐ[R] A₂) (e₁₂' : A₁' ≃ₐ[R] A₂')\n (e₂₃ : A₂ ≃ₐ[R] A₃) (e₂₃' : A₂' ≃ₐ[R] A₃') :\n (equivCongr e₁₂ e₁₂').trans (equivCongr e₂₃ e₂₃') =\n equivCongr (e₁₂.trans e₂₃) (e₁₂'.trans e₂₃') :=\n rfl\n\n/-- If an algebra morphism has an inverse, it is an algebra isomorphism. -/\ndef ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ : f.comp g = AlgHom.id R A₂)\n (h₂ : g.comp f = AlgHom.id R A₁) : A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := g\n left_inv := AlgHom.ext_iff.1 h₂\n right_inv := AlgHom.ext_iff.1 h₁ }\n#align alg_equiv.of_alg_hom AlgEquiv.ofAlgHom\n\ntheorem coe_algHom_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ↑(ofAlgHom f g h₁ h₂) = f :=\n AlgHom.ext fun _ => rfl\n#align alg_equiv.coe_alg_hom_of_alg_hom AlgEquiv.coe_algHom_ofAlgHom\n\n@[simp]\ntheorem ofAlgHom_coe_algHom (f : A₁ ≃ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ofAlgHom (↑f) g h₁ h₂ = f :=\n ext fun _ => rfl\n#align alg_equiv.of_alg_hom_coe_alg_hom AlgEquiv.ofAlgHom_coe_algHom\n\ntheorem ofAlgHom_symm (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).symm = ofAlgHom g f h₂ h₁ :=\n rfl\n#align alg_equiv.of_alg_hom_symm AlgEquiv.ofAlgHom_symm\n\n/-- Promotes a bijective algebra homomorphism to an algebra equivalence. -/\nnoncomputable def ofBijective (f : A₁ →ₐ[R] A₂) (hf : Function.Bijective f) : A₁ ≃ₐ[R] A₂ :=\n { RingEquiv.ofBijective (f : A₁ →+* A₂) hf, f with }\n#align alg_equiv.of_bijective AlgEquiv.ofBijective\n\n@[simp]\ntheorem coe_ofBijective {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} :\n (AlgEquiv.ofBijective f hf : A₁ → A₂) = f :=\n rfl\n#align alg_equiv.coe_of_bijective AlgEquiv.coe_ofBijective\n\ntheorem ofBijective_apply {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} (a : A₁) :\n (AlgEquiv.ofBijective f hf) a = f a :=\n rfl\n#align alg_equiv.of_bijective_apply AlgEquiv.ofBijective_apply\n\n/-- Forgetting the multiplicative structures, an equivalence of algebras is a linear equivalence. -/\n@[simps apply]\ndef toLinearEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ₗ[R] A₂ :=\n { e with\n toFun := e\n map_smul' := e.map_smul\n invFun := e.symm }\n#align alg_equiv.to_linear_equiv AlgEquiv.toLinearEquiv\n#align alg_equiv.to_linear_equiv_apply AlgEquiv.toLinearEquiv_apply\n\n@[simp]\ntheorem toLinearEquiv_refl : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).toLinearEquiv = LinearEquiv.refl R A₁ :=\n rfl\n#align alg_equiv.to_linear_equiv_refl AlgEquiv.toLinearEquiv_refl\n\n@[simp]\ntheorem toLinearEquiv_symm (e : A₁ ≃ₐ[R] A₂) : e.toLinearEquiv.symm = e.symm.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_symm AlgEquiv.toLinearEquiv_symm\n\n@[simp]\ntheorem toLinearEquiv_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) :\n (e₁.trans e₂).toLinearEquiv = e₁.toLinearEquiv.trans e₂.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_trans AlgEquiv.toLinearEquiv_trans\n\ntheorem toLinearEquiv_injective : Function.Injective (toLinearEquiv : _ → A₁ ≃ₗ[R] A₂) :=\n fun _ _ h => ext <| LinearEquiv.congr_fun h\n#align alg_equiv.to_linear_equiv_injective AlgEquiv.toLinearEquiv_injective\n\n/-- Interpret an algebra equivalence as a linear map. -/\ndef toLinearMap : A₁ →ₗ[R] A₂ :=\n e.toAlgHom.toLinearMap\n#align alg_equiv.to_linear_map AlgEquiv.toLinearMap\n\n@[simp]\ntheorem toAlgHom_toLinearMap : (e : A₁ →ₐ[R] A₂).toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_alg_hom_to_linear_map AlgEquiv.toAlgHom_toLinearMap\n\ntheorem toLinearMap_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).toLinearMap = f.toLinearMap :=\n LinearMap.ext fun _ => rfl\n\n@[simp]\ntheorem toLinearEquiv_toLinearMap : e.toLinearEquiv.toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_linear_equiv_to_linear_map AlgEquiv.toLinearEquiv_toLinearMap\n\n@[simp]\ntheorem toLinearMap_apply (x : A₁) : e.toLinearMap x = e x :=\n rfl\n#align alg_equiv.to_linear_map_apply AlgEquiv.toLinearMap_apply\n\ntheorem toLinearMap_injective : Function.Injective (toLinearMap : _ → A₁ →ₗ[R] A₂) := fun _ _ h =>\n ext <| LinearMap.congr_fun h\n#align alg_equiv.to_linear_map_injective AlgEquiv.toLinearMap_injective\n\n@[simp]\ntheorem trans_toLinearMap (f : A₁ ≃ₐ[R] A₂) (g : A₂ ≃ₐ[R] A₃) :\n (f.trans g).toLinearMap = g.toLinearMap.comp f.toLinearMap :=\n rfl\n#align alg_equiv.trans_to_linear_map AlgEquiv.trans_toLinearMap\n\nsection OfLinearEquiv\n\nvariable (l : A₁ ≃ₗ[R] A₂) (map_one : l 1 = 1) (map_mul : ∀ x y : A₁, l (x * y) = l x * l y)\n\n/-- Upgrade a linear equivalence to an algebra equivalence,\ngiven that it distributes over multiplication and the identity\n-/\n@[simps apply]\ndef ofLinearEquiv : A₁ ≃ₐ[R] A₂ :=\n { l with\n toFun := l\n invFun := l.symm\n map_mul' := map_mul\n commutes' := (AlgHom.ofLinearMap l map_one map_mul : A₁ →ₐ[R] A₂).commutes }\n#align alg_equiv.of_linear_equiv AlgEquiv.ofLinearEquivₓ\n\n@[simp]\ntheorem ofLinearEquiv_symm :\n (ofLinearEquiv l map_one map_mul).symm =\n ofLinearEquiv l.symm (ofLinearEquiv l map_one map_mul).symm.map_one\n (ofLinearEquiv l map_one map_mul).symm.map_mul :=\n rfl\n#align alg_equiv.of_linear_equiv_symm AlgEquiv.ofLinearEquiv_symm\n\n@[simp]\ntheorem ofLinearEquiv_toLinearEquiv (map_mul) (map_one) :\n ofLinearEquiv e.toLinearEquiv map_mul map_one = e := by\n ext\n ","nextTactic":"rfl","declUpToTactic":"@[simp]\ntheorem ofLinearEquiv_toLinearEquiv (map_mul) (map_one) :\n ofLinearEquiv e.toLinearEquiv map_mul map_one = e := by\n ext\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.661_0.gpEhvIDvcS3ZH5c","decl":"@[simp]\ntheorem ofLinearEquiv_toLinearEquiv (map_mul) (map_one) :\n ofLinearEquiv e.toLinearEquiv map_mul map_one = e "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\nl : A₁ ≃ₗ[R] A₂\nmap_one : l 1 = 1\nmap_mul : ∀ (x y : A₁), l (x * y) = l x * l y\n⊢ toLinearEquiv (ofLinearEquiv l map_one map_mul) = l","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ext\n simp_rw [trans_apply, apply_symm_apply]\n\n@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') := by\n ext\n rfl\n\n@[simp]\ntheorem equivCongr_symm (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') :\n (equivCongr e e').symm = equivCongr e.symm e'.symm :=\n rfl\n\n@[simp]\ntheorem equivCongr_trans (e₁₂ : A₁ ≃ₐ[R] A₂) (e₁₂' : A₁' ≃ₐ[R] A₂')\n (e₂₃ : A₂ ≃ₐ[R] A₃) (e₂₃' : A₂' ≃ₐ[R] A₃') :\n (equivCongr e₁₂ e₁₂').trans (equivCongr e₂₃ e₂₃') =\n equivCongr (e₁₂.trans e₂₃) (e₁₂'.trans e₂₃') :=\n rfl\n\n/-- If an algebra morphism has an inverse, it is an algebra isomorphism. -/\ndef ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ : f.comp g = AlgHom.id R A₂)\n (h₂ : g.comp f = AlgHom.id R A₁) : A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := g\n left_inv := AlgHom.ext_iff.1 h₂\n right_inv := AlgHom.ext_iff.1 h₁ }\n#align alg_equiv.of_alg_hom AlgEquiv.ofAlgHom\n\ntheorem coe_algHom_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ↑(ofAlgHom f g h₁ h₂) = f :=\n AlgHom.ext fun _ => rfl\n#align alg_equiv.coe_alg_hom_of_alg_hom AlgEquiv.coe_algHom_ofAlgHom\n\n@[simp]\ntheorem ofAlgHom_coe_algHom (f : A₁ ≃ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ofAlgHom (↑f) g h₁ h₂ = f :=\n ext fun _ => rfl\n#align alg_equiv.of_alg_hom_coe_alg_hom AlgEquiv.ofAlgHom_coe_algHom\n\ntheorem ofAlgHom_symm (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).symm = ofAlgHom g f h₂ h₁ :=\n rfl\n#align alg_equiv.of_alg_hom_symm AlgEquiv.ofAlgHom_symm\n\n/-- Promotes a bijective algebra homomorphism to an algebra equivalence. -/\nnoncomputable def ofBijective (f : A₁ →ₐ[R] A₂) (hf : Function.Bijective f) : A₁ ≃ₐ[R] A₂ :=\n { RingEquiv.ofBijective (f : A₁ →+* A₂) hf, f with }\n#align alg_equiv.of_bijective AlgEquiv.ofBijective\n\n@[simp]\ntheorem coe_ofBijective {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} :\n (AlgEquiv.ofBijective f hf : A₁ → A₂) = f :=\n rfl\n#align alg_equiv.coe_of_bijective AlgEquiv.coe_ofBijective\n\ntheorem ofBijective_apply {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} (a : A₁) :\n (AlgEquiv.ofBijective f hf) a = f a :=\n rfl\n#align alg_equiv.of_bijective_apply AlgEquiv.ofBijective_apply\n\n/-- Forgetting the multiplicative structures, an equivalence of algebras is a linear equivalence. -/\n@[simps apply]\ndef toLinearEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ₗ[R] A₂ :=\n { e with\n toFun := e\n map_smul' := e.map_smul\n invFun := e.symm }\n#align alg_equiv.to_linear_equiv AlgEquiv.toLinearEquiv\n#align alg_equiv.to_linear_equiv_apply AlgEquiv.toLinearEquiv_apply\n\n@[simp]\ntheorem toLinearEquiv_refl : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).toLinearEquiv = LinearEquiv.refl R A₁ :=\n rfl\n#align alg_equiv.to_linear_equiv_refl AlgEquiv.toLinearEquiv_refl\n\n@[simp]\ntheorem toLinearEquiv_symm (e : A₁ ≃ₐ[R] A₂) : e.toLinearEquiv.symm = e.symm.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_symm AlgEquiv.toLinearEquiv_symm\n\n@[simp]\ntheorem toLinearEquiv_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) :\n (e₁.trans e₂).toLinearEquiv = e₁.toLinearEquiv.trans e₂.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_trans AlgEquiv.toLinearEquiv_trans\n\ntheorem toLinearEquiv_injective : Function.Injective (toLinearEquiv : _ → A₁ ≃ₗ[R] A₂) :=\n fun _ _ h => ext <| LinearEquiv.congr_fun h\n#align alg_equiv.to_linear_equiv_injective AlgEquiv.toLinearEquiv_injective\n\n/-- Interpret an algebra equivalence as a linear map. -/\ndef toLinearMap : A₁ →ₗ[R] A₂ :=\n e.toAlgHom.toLinearMap\n#align alg_equiv.to_linear_map AlgEquiv.toLinearMap\n\n@[simp]\ntheorem toAlgHom_toLinearMap : (e : A₁ →ₐ[R] A₂).toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_alg_hom_to_linear_map AlgEquiv.toAlgHom_toLinearMap\n\ntheorem toLinearMap_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).toLinearMap = f.toLinearMap :=\n LinearMap.ext fun _ => rfl\n\n@[simp]\ntheorem toLinearEquiv_toLinearMap : e.toLinearEquiv.toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_linear_equiv_to_linear_map AlgEquiv.toLinearEquiv_toLinearMap\n\n@[simp]\ntheorem toLinearMap_apply (x : A₁) : e.toLinearMap x = e x :=\n rfl\n#align alg_equiv.to_linear_map_apply AlgEquiv.toLinearMap_apply\n\ntheorem toLinearMap_injective : Function.Injective (toLinearMap : _ → A₁ →ₗ[R] A₂) := fun _ _ h =>\n ext <| LinearMap.congr_fun h\n#align alg_equiv.to_linear_map_injective AlgEquiv.toLinearMap_injective\n\n@[simp]\ntheorem trans_toLinearMap (f : A₁ ≃ₐ[R] A₂) (g : A₂ ≃ₐ[R] A₃) :\n (f.trans g).toLinearMap = g.toLinearMap.comp f.toLinearMap :=\n rfl\n#align alg_equiv.trans_to_linear_map AlgEquiv.trans_toLinearMap\n\nsection OfLinearEquiv\n\nvariable (l : A₁ ≃ₗ[R] A₂) (map_one : l 1 = 1) (map_mul : ∀ x y : A₁, l (x * y) = l x * l y)\n\n/-- Upgrade a linear equivalence to an algebra equivalence,\ngiven that it distributes over multiplication and the identity\n-/\n@[simps apply]\ndef ofLinearEquiv : A₁ ≃ₐ[R] A₂ :=\n { l with\n toFun := l\n invFun := l.symm\n map_mul' := map_mul\n commutes' := (AlgHom.ofLinearMap l map_one map_mul : A₁ →ₐ[R] A₂).commutes }\n#align alg_equiv.of_linear_equiv AlgEquiv.ofLinearEquivₓ\n\n@[simp]\ntheorem ofLinearEquiv_symm :\n (ofLinearEquiv l map_one map_mul).symm =\n ofLinearEquiv l.symm (ofLinearEquiv l map_one map_mul).symm.map_one\n (ofLinearEquiv l map_one map_mul).symm.map_mul :=\n rfl\n#align alg_equiv.of_linear_equiv_symm AlgEquiv.ofLinearEquiv_symm\n\n@[simp]\ntheorem ofLinearEquiv_toLinearEquiv (map_mul) (map_one) :\n ofLinearEquiv e.toLinearEquiv map_mul map_one = e := by\n ext\n rfl\n#align alg_equiv.of_linear_equiv_to_linear_equiv AlgEquiv.ofLinearEquiv_toLinearEquiv\n\n@[simp]\ntheorem toLinearEquiv_ofLinearEquiv : toLinearEquiv (ofLinearEquiv l map_one map_mul) = l := by\n ","nextTactic":"ext","declUpToTactic":"@[simp]\ntheorem toLinearEquiv_ofLinearEquiv : toLinearEquiv (ofLinearEquiv l map_one map_mul) = l := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.668_0.gpEhvIDvcS3ZH5c","decl":"@[simp]\ntheorem toLinearEquiv_ofLinearEquiv : toLinearEquiv (ofLinearEquiv l map_one map_mul) = l "} -{"state":"case h\nR : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\nl : A₁ ≃ₗ[R] A₂\nmap_one : l 1 = 1\nmap_mul : ∀ (x y : A₁), l (x * y) = l x * l y\nx✝ : A₁\n⊢ (toLinearEquiv (ofLinearEquiv l map_one map_mul)) x✝ = l x✝","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e���).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ext\n simp_rw [trans_apply, apply_symm_apply]\n\n@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') := by\n ext\n rfl\n\n@[simp]\ntheorem equivCongr_symm (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') :\n (equivCongr e e').symm = equivCongr e.symm e'.symm :=\n rfl\n\n@[simp]\ntheorem equivCongr_trans (e₁₂ : A₁ ≃ₐ[R] A₂) (e₁₂' : A₁' ≃ₐ[R] A₂')\n (e₂₃ : A₂ ≃ₐ[R] A₃) (e₂₃' : A₂' ≃ₐ[R] A₃') :\n (equivCongr e₁₂ e₁₂').trans (equivCongr e₂₃ e₂₃') =\n equivCongr (e₁₂.trans e₂₃) (e₁₂'.trans e₂₃') :=\n rfl\n\n/-- If an algebra morphism has an inverse, it is an algebra isomorphism. -/\ndef ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ : f.comp g = AlgHom.id R A₂)\n (h₂ : g.comp f = AlgHom.id R A₁) : A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := g\n left_inv := AlgHom.ext_iff.1 h₂\n right_inv := AlgHom.ext_iff.1 h₁ }\n#align alg_equiv.of_alg_hom AlgEquiv.ofAlgHom\n\ntheorem coe_algHom_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ↑(ofAlgHom f g h₁ h₂) = f :=\n AlgHom.ext fun _ => rfl\n#align alg_equiv.coe_alg_hom_of_alg_hom AlgEquiv.coe_algHom_ofAlgHom\n\n@[simp]\ntheorem ofAlgHom_coe_algHom (f : A₁ ≃ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ofAlgHom (↑f) g h₁ h₂ = f :=\n ext fun _ => rfl\n#align alg_equiv.of_alg_hom_coe_alg_hom AlgEquiv.ofAlgHom_coe_algHom\n\ntheorem ofAlgHom_symm (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).symm = ofAlgHom g f h₂ h₁ :=\n rfl\n#align alg_equiv.of_alg_hom_symm AlgEquiv.ofAlgHom_symm\n\n/-- Promotes a bijective algebra homomorphism to an algebra equivalence. -/\nnoncomputable def ofBijective (f : A₁ →ₐ[R] A₂) (hf : Function.Bijective f) : A₁ ≃ₐ[R] A₂ :=\n { RingEquiv.ofBijective (f : A₁ →+* A₂) hf, f with }\n#align alg_equiv.of_bijective AlgEquiv.ofBijective\n\n@[simp]\ntheorem coe_ofBijective {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} :\n (AlgEquiv.ofBijective f hf : A₁ → A₂) = f :=\n rfl\n#align alg_equiv.coe_of_bijective AlgEquiv.coe_ofBijective\n\ntheorem ofBijective_apply {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} (a : A₁) :\n (AlgEquiv.ofBijective f hf) a = f a :=\n rfl\n#align alg_equiv.of_bijective_apply AlgEquiv.ofBijective_apply\n\n/-- Forgetting the multiplicative structures, an equivalence of algebras is a linear equivalence. -/\n@[simps apply]\ndef toLinearEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ₗ[R] A₂ :=\n { e with\n toFun := e\n map_smul' := e.map_smul\n invFun := e.symm }\n#align alg_equiv.to_linear_equiv AlgEquiv.toLinearEquiv\n#align alg_equiv.to_linear_equiv_apply AlgEquiv.toLinearEquiv_apply\n\n@[simp]\ntheorem toLinearEquiv_refl : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).toLinearEquiv = LinearEquiv.refl R A₁ :=\n rfl\n#align alg_equiv.to_linear_equiv_refl AlgEquiv.toLinearEquiv_refl\n\n@[simp]\ntheorem toLinearEquiv_symm (e : A₁ ≃ₐ[R] A₂) : e.toLinearEquiv.symm = e.symm.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_symm AlgEquiv.toLinearEquiv_symm\n\n@[simp]\ntheorem toLinearEquiv_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) :\n (e₁.trans e₂).toLinearEquiv = e₁.toLinearEquiv.trans e₂.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_trans AlgEquiv.toLinearEquiv_trans\n\ntheorem toLinearEquiv_injective : Function.Injective (toLinearEquiv : _ → A₁ ≃ₗ[R] A₂) :=\n fun _ _ h => ext <| LinearEquiv.congr_fun h\n#align alg_equiv.to_linear_equiv_injective AlgEquiv.toLinearEquiv_injective\n\n/-- Interpret an algebra equivalence as a linear map. -/\ndef toLinearMap : A₁ →ₗ[R] A₂ :=\n e.toAlgHom.toLinearMap\n#align alg_equiv.to_linear_map AlgEquiv.toLinearMap\n\n@[simp]\ntheorem toAlgHom_toLinearMap : (e : A₁ →ₐ[R] A₂).toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_alg_hom_to_linear_map AlgEquiv.toAlgHom_toLinearMap\n\ntheorem toLinearMap_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).toLinearMap = f.toLinearMap :=\n LinearMap.ext fun _ => rfl\n\n@[simp]\ntheorem toLinearEquiv_toLinearMap : e.toLinearEquiv.toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_linear_equiv_to_linear_map AlgEquiv.toLinearEquiv_toLinearMap\n\n@[simp]\ntheorem toLinearMap_apply (x : A₁) : e.toLinearMap x = e x :=\n rfl\n#align alg_equiv.to_linear_map_apply AlgEquiv.toLinearMap_apply\n\ntheorem toLinearMap_injective : Function.Injective (toLinearMap : _ → A₁ →ₗ[R] A₂) := fun _ _ h =>\n ext <| LinearMap.congr_fun h\n#align alg_equiv.to_linear_map_injective AlgEquiv.toLinearMap_injective\n\n@[simp]\ntheorem trans_toLinearMap (f : A₁ ≃ₐ[R] A₂) (g : A₂ ≃ₐ[R] A₃) :\n (f.trans g).toLinearMap = g.toLinearMap.comp f.toLinearMap :=\n rfl\n#align alg_equiv.trans_to_linear_map AlgEquiv.trans_toLinearMap\n\nsection OfLinearEquiv\n\nvariable (l : A₁ ≃ₗ[R] A₂) (map_one : l 1 = 1) (map_mul : ∀ x y : A₁, l (x * y) = l x * l y)\n\n/-- Upgrade a linear equivalence to an algebra equivalence,\ngiven that it distributes over multiplication and the identity\n-/\n@[simps apply]\ndef ofLinearEquiv : A₁ ≃ₐ[R] A₂ :=\n { l with\n toFun := l\n invFun := l.symm\n map_mul' := map_mul\n commutes' := (AlgHom.ofLinearMap l map_one map_mul : A₁ →ₐ[R] A₂).commutes }\n#align alg_equiv.of_linear_equiv AlgEquiv.ofLinearEquivₓ\n\n@[simp]\ntheorem ofLinearEquiv_symm :\n (ofLinearEquiv l map_one map_mul).symm =\n ofLinearEquiv l.symm (ofLinearEquiv l map_one map_mul).symm.map_one\n (ofLinearEquiv l map_one map_mul).symm.map_mul :=\n rfl\n#align alg_equiv.of_linear_equiv_symm AlgEquiv.ofLinearEquiv_symm\n\n@[simp]\ntheorem ofLinearEquiv_toLinearEquiv (map_mul) (map_one) :\n ofLinearEquiv e.toLinearEquiv map_mul map_one = e := by\n ext\n rfl\n#align alg_equiv.of_linear_equiv_to_linear_equiv AlgEquiv.ofLinearEquiv_toLinearEquiv\n\n@[simp]\ntheorem toLinearEquiv_ofLinearEquiv : toLinearEquiv (ofLinearEquiv l map_one map_mul) = l := by\n ext\n ","nextTactic":"rfl","declUpToTactic":"@[simp]\ntheorem toLinearEquiv_ofLinearEquiv : toLinearEquiv (ofLinearEquiv l map_one map_mul) = l := by\n ext\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.668_0.gpEhvIDvcS3ZH5c","decl":"@[simp]\ntheorem toLinearEquiv_ofLinearEquiv : toLinearEquiv (ofLinearEquiv l map_one map_mul) = l "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne ϕ : A₁ ≃ₐ[R] A₂\nsrc✝ : (A₁ ≃ₐ[R] A₁) ≃ A₂ ≃ₐ[R] A₂ := equivCongr ϕ ϕ\nψ χ : A₁ ≃ₐ[R] A₁\n⊢ Equiv.toFun\n { toFun := fun ψ => trans (symm ϕ) (trans ψ ϕ), invFun := fun ψ => trans ϕ (trans ψ (symm ϕ)),\n left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),\n right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }\n (ψ * χ) =\n Equiv.toFun\n { toFun := fun ψ => trans (symm ϕ) (trans ψ ϕ), invFun := fun ψ => trans ϕ (trans ψ (symm ϕ)),\n left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),\n right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }\n ψ *\n Equiv.toFun\n { toFun := fun ψ => trans (symm ϕ) (trans ψ ϕ), invFun := fun ψ => trans ϕ (trans ψ (symm ϕ)),\n left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),\n right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }\n χ","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ext\n simp_rw [trans_apply, apply_symm_apply]\n\n@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') := by\n ext\n rfl\n\n@[simp]\ntheorem equivCongr_symm (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') :\n (equivCongr e e').symm = equivCongr e.symm e'.symm :=\n rfl\n\n@[simp]\ntheorem equivCongr_trans (e₁₂ : A₁ ≃ₐ[R] A₂) (e₁₂' : A₁' ≃ₐ[R] A₂')\n (e₂₃ : A₂ ≃ₐ[R] A₃) (e₂₃' : A₂' ≃ₐ[R] A₃') :\n (equivCongr e₁₂ e₁₂').trans (equivCongr e₂₃ e₂₃') =\n equivCongr (e₁₂.trans e₂₃) (e₁₂'.trans e₂₃') :=\n rfl\n\n/-- If an algebra morphism has an inverse, it is an algebra isomorphism. -/\ndef ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ : f.comp g = AlgHom.id R A₂)\n (h₂ : g.comp f = AlgHom.id R A₁) : A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := g\n left_inv := AlgHom.ext_iff.1 h₂\n right_inv := AlgHom.ext_iff.1 h₁ }\n#align alg_equiv.of_alg_hom AlgEquiv.ofAlgHom\n\ntheorem coe_algHom_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ↑(ofAlgHom f g h₁ h₂) = f :=\n AlgHom.ext fun _ => rfl\n#align alg_equiv.coe_alg_hom_of_alg_hom AlgEquiv.coe_algHom_ofAlgHom\n\n@[simp]\ntheorem ofAlgHom_coe_algHom (f : A₁ ≃ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ofAlgHom (↑f) g h₁ h₂ = f :=\n ext fun _ => rfl\n#align alg_equiv.of_alg_hom_coe_alg_hom AlgEquiv.ofAlgHom_coe_algHom\n\ntheorem ofAlgHom_symm (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).symm = ofAlgHom g f h₂ h₁ :=\n rfl\n#align alg_equiv.of_alg_hom_symm AlgEquiv.ofAlgHom_symm\n\n/-- Promotes a bijective algebra homomorphism to an algebra equivalence. -/\nnoncomputable def ofBijective (f : A₁ →ₐ[R] A₂) (hf : Function.Bijective f) : A₁ ≃ₐ[R] A₂ :=\n { RingEquiv.ofBijective (f : A₁ →+* A₂) hf, f with }\n#align alg_equiv.of_bijective AlgEquiv.ofBijective\n\n@[simp]\ntheorem coe_ofBijective {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} :\n (AlgEquiv.ofBijective f hf : A₁ → A₂) = f :=\n rfl\n#align alg_equiv.coe_of_bijective AlgEquiv.coe_ofBijective\n\ntheorem ofBijective_apply {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} (a : A₁) :\n (AlgEquiv.ofBijective f hf) a = f a :=\n rfl\n#align alg_equiv.of_bijective_apply AlgEquiv.ofBijective_apply\n\n/-- Forgetting the multiplicative structures, an equivalence of algebras is a linear equivalence. -/\n@[simps apply]\ndef toLinearEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ₗ[R] A₂ :=\n { e with\n toFun := e\n map_smul' := e.map_smul\n invFun := e.symm }\n#align alg_equiv.to_linear_equiv AlgEquiv.toLinearEquiv\n#align alg_equiv.to_linear_equiv_apply AlgEquiv.toLinearEquiv_apply\n\n@[simp]\ntheorem toLinearEquiv_refl : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).toLinearEquiv = LinearEquiv.refl R A₁ :=\n rfl\n#align alg_equiv.to_linear_equiv_refl AlgEquiv.toLinearEquiv_refl\n\n@[simp]\ntheorem toLinearEquiv_symm (e : A₁ ≃ₐ[R] A₂) : e.toLinearEquiv.symm = e.symm.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_symm AlgEquiv.toLinearEquiv_symm\n\n@[simp]\ntheorem toLinearEquiv_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) :\n (e₁.trans e₂).toLinearEquiv = e₁.toLinearEquiv.trans e₂.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_trans AlgEquiv.toLinearEquiv_trans\n\ntheorem toLinearEquiv_injective : Function.Injective (toLinearEquiv : _ → A₁ ≃ₗ[R] A₂) :=\n fun _ _ h => ext <| LinearEquiv.congr_fun h\n#align alg_equiv.to_linear_equiv_injective AlgEquiv.toLinearEquiv_injective\n\n/-- Interpret an algebra equivalence as a linear map. -/\ndef toLinearMap : A₁ →ₗ[R] A₂ :=\n e.toAlgHom.toLinearMap\n#align alg_equiv.to_linear_map AlgEquiv.toLinearMap\n\n@[simp]\ntheorem toAlgHom_toLinearMap : (e : A₁ →ₐ[R] A₂).toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_alg_hom_to_linear_map AlgEquiv.toAlgHom_toLinearMap\n\ntheorem toLinearMap_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).toLinearMap = f.toLinearMap :=\n LinearMap.ext fun _ => rfl\n\n@[simp]\ntheorem toLinearEquiv_toLinearMap : e.toLinearEquiv.toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_linear_equiv_to_linear_map AlgEquiv.toLinearEquiv_toLinearMap\n\n@[simp]\ntheorem toLinearMap_apply (x : A₁) : e.toLinearMap x = e x :=\n rfl\n#align alg_equiv.to_linear_map_apply AlgEquiv.toLinearMap_apply\n\ntheorem toLinearMap_injective : Function.Injective (toLinearMap : _ → A₁ →ₗ[R] A₂) := fun _ _ h =>\n ext <| LinearMap.congr_fun h\n#align alg_equiv.to_linear_map_injective AlgEquiv.toLinearMap_injective\n\n@[simp]\ntheorem trans_toLinearMap (f : A₁ ≃ₐ[R] A₂) (g : A₂ ≃ₐ[R] A₃) :\n (f.trans g).toLinearMap = g.toLinearMap.comp f.toLinearMap :=\n rfl\n#align alg_equiv.trans_to_linear_map AlgEquiv.trans_toLinearMap\n\nsection OfLinearEquiv\n\nvariable (l : A₁ ≃ₗ[R] A₂) (map_one : l 1 = 1) (map_mul : ∀ x y : A₁, l (x * y) = l x * l y)\n\n/-- Upgrade a linear equivalence to an algebra equivalence,\ngiven that it distributes over multiplication and the identity\n-/\n@[simps apply]\ndef ofLinearEquiv : A₁ ≃ₐ[R] A₂ :=\n { l with\n toFun := l\n invFun := l.symm\n map_mul' := map_mul\n commutes' := (AlgHom.ofLinearMap l map_one map_mul : A₁ →ₐ[R] A₂).commutes }\n#align alg_equiv.of_linear_equiv AlgEquiv.ofLinearEquivₓ\n\n@[simp]\ntheorem ofLinearEquiv_symm :\n (ofLinearEquiv l map_one map_mul).symm =\n ofLinearEquiv l.symm (ofLinearEquiv l map_one map_mul).symm.map_one\n (ofLinearEquiv l map_one map_mul).symm.map_mul :=\n rfl\n#align alg_equiv.of_linear_equiv_symm AlgEquiv.ofLinearEquiv_symm\n\n@[simp]\ntheorem ofLinearEquiv_toLinearEquiv (map_mul) (map_one) :\n ofLinearEquiv e.toLinearEquiv map_mul map_one = e := by\n ext\n rfl\n#align alg_equiv.of_linear_equiv_to_linear_equiv AlgEquiv.ofLinearEquiv_toLinearEquiv\n\n@[simp]\ntheorem toLinearEquiv_ofLinearEquiv : toLinearEquiv (ofLinearEquiv l map_one map_mul) = l := by\n ext\n rfl\n#align alg_equiv.to_linear_equiv_of_linear_equiv AlgEquiv.toLinearEquiv_ofLinearEquiv\n\nend OfLinearEquiv\n\nsection OfRingEquiv\n\n/-- Promotes a linear ring_equiv to an AlgEquiv. -/\n@[simps apply symm_apply toEquiv] -- Porting note: don't want redundant `toEquiv_symm_apply` simps\ndef ofRingEquiv {f : A₁ ≃+* A₂} (hf : ∀ x, f (algebraMap R A₁ x) = algebraMap R A₂ x) :\n A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := f.symm\n commutes' := hf }\n#align alg_equiv.of_ring_equiv AlgEquiv.ofRingEquiv\n\nend OfRingEquiv\n\n-- Porting note: projections mul & one not found, removed [simps] and added theorems manually\n-- @[simps (config := .lemmasOnly) one]\ninstance aut : Group (A₁ ≃ₐ[R] A₁) where\n mul ϕ ψ := ψ.trans ϕ\n mul_assoc ϕ ψ χ := rfl\n one := refl\n one_mul ϕ := ext fun x => rfl\n mul_one ϕ := ext fun x => rfl\n inv := symm\n mul_left_inv ϕ := ext <| symm_apply_apply ϕ\n#align alg_equiv.aut AlgEquiv.aut\n\ntheorem aut_mul (ϕ ψ : A₁ ≃ₐ[R] A₁) : ϕ * ψ = ψ.trans ϕ :=\n rfl\n\ntheorem aut_one : 1 = AlgEquiv.refl (R := R) (A₁ := A₁) :=\n rfl\n\n@[simp]\ntheorem one_apply (x : A₁) : (1 : A₁ ≃ₐ[R] A₁) x = x :=\n rfl\n#align alg_equiv.one_apply AlgEquiv.one_apply\n\n@[simp]\ntheorem mul_apply (e₁ e₂ : A₁ ≃ₐ[R] A₁) (x : A₁) : (e₁ * e₂) x = e₁ (e₂ x) :=\n rfl\n#align alg_equiv.mul_apply AlgEquiv.mul_apply\n\n/-- An algebra isomorphism induces a group isomorphism between automorphism groups.\n\nThis is a more bundled version of `AlgEquiv.equivCongr`. -/\n@[simps apply]\ndef autCongr (ϕ : A₁ ≃ₐ[R] A₂) : (A₁ ≃ₐ[R] A₁) ≃* A₂ ≃ₐ[R] A₂ where\n __ := equivCongr ϕ ϕ\n toFun ψ := ϕ.symm.trans (ψ.trans ϕ)\n invFun ψ := ϕ.trans (ψ.trans ϕ.symm)\n map_mul' ψ χ := by\n ","nextTactic":"ext","declUpToTactic":"/-- An algebra isomorphism induces a group isomorphism between automorphism groups.\n\nThis is a more bundled version of `AlgEquiv.equivCongr`. -/\n@[simps apply]\ndef autCongr (ϕ : A₁ ≃ₐ[R] A₂) : (A₁ ≃ₐ[R] A₁) ≃* A₂ ≃ₐ[R] A₂ where\n __ := equivCongr ϕ ϕ\n toFun ψ := ϕ.symm.trans (ψ.trans ϕ)\n invFun ψ := ϕ.trans (ψ.trans ϕ.symm)\n map_mul' ψ χ := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.718_0.gpEhvIDvcS3ZH5c","decl":"/-- An algebra isomorphism induces a group isomorphism between automorphism groups.\n\nThis is a more bundled version of `AlgEquiv.equivCongr`. -/\n@[simps apply]\ndef autCongr (ϕ : A₁ ≃ₐ[R] A₂) : (A₁ ≃ₐ[R] A₁) ≃* A₂ ≃ₐ[R] A₂ where\n __ "} -{"state":"case h\nR : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne ϕ : A₁ ≃ₐ[R] A₂\nsrc✝ : (A₁ ≃ₐ[R] A₁) ≃ A₂ ≃ₐ[R] A₂ := equivCongr ϕ ϕ\nψ χ : A₁ ≃ₐ[R] A₁\na✝ : A₂\n⊢ (Equiv.toFun\n { toFun := fun ψ => trans (symm ϕ) (trans ψ ϕ), invFun := fun ψ => trans ϕ (trans ψ (symm ϕ)),\n left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),\n right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }\n (ψ * χ))\n a✝ =\n (Equiv.toFun\n { toFun := fun ψ => trans (symm ϕ) (trans ψ ϕ), invFun := fun ψ => trans ϕ (trans ψ (symm ϕ)),\n left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),\n right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }\n ψ *\n Equiv.toFun\n { toFun := fun ψ => trans (symm ϕ) (trans ψ ϕ), invFun := fun ψ => trans ϕ (trans ψ (symm ϕ)),\n left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),\n right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }\n χ)\n a✝","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ext\n simp_rw [trans_apply, apply_symm_apply]\n\n@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') := by\n ext\n rfl\n\n@[simp]\ntheorem equivCongr_symm (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') :\n (equivCongr e e').symm = equivCongr e.symm e'.symm :=\n rfl\n\n@[simp]\ntheorem equivCongr_trans (e₁₂ : A₁ ≃ₐ[R] A₂) (e₁₂' : A₁' ≃ₐ[R] A₂')\n (e₂₃ : A₂ ≃ₐ[R] A₃) (e₂₃' : A₂' ≃ₐ[R] A₃') :\n (equivCongr e₁₂ e₁₂').trans (equivCongr e₂₃ e₂₃') =\n equivCongr (e₁₂.trans e₂₃) (e₁₂'.trans e₂₃') :=\n rfl\n\n/-- If an algebra morphism has an inverse, it is an algebra isomorphism. -/\ndef ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ : f.comp g = AlgHom.id R A₂)\n (h₂ : g.comp f = AlgHom.id R A₁) : A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := g\n left_inv := AlgHom.ext_iff.1 h₂\n right_inv := AlgHom.ext_iff.1 h₁ }\n#align alg_equiv.of_alg_hom AlgEquiv.ofAlgHom\n\ntheorem coe_algHom_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ↑(ofAlgHom f g h₁ h₂) = f :=\n AlgHom.ext fun _ => rfl\n#align alg_equiv.coe_alg_hom_of_alg_hom AlgEquiv.coe_algHom_ofAlgHom\n\n@[simp]\ntheorem ofAlgHom_coe_algHom (f : A₁ ≃ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ofAlgHom (↑f) g h₁ h₂ = f :=\n ext fun _ => rfl\n#align alg_equiv.of_alg_hom_coe_alg_hom AlgEquiv.ofAlgHom_coe_algHom\n\ntheorem ofAlgHom_symm (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).symm = ofAlgHom g f h₂ h₁ :=\n rfl\n#align alg_equiv.of_alg_hom_symm AlgEquiv.ofAlgHom_symm\n\n/-- Promotes a bijective algebra homomorphism to an algebra equivalence. -/\nnoncomputable def ofBijective (f : A₁ →ₐ[R] A₂) (hf : Function.Bijective f) : A₁ ≃ₐ[R] A₂ :=\n { RingEquiv.ofBijective (f : A₁ →+* A₂) hf, f with }\n#align alg_equiv.of_bijective AlgEquiv.ofBijective\n\n@[simp]\ntheorem coe_ofBijective {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} :\n (AlgEquiv.ofBijective f hf : A₁ → A₂) = f :=\n rfl\n#align alg_equiv.coe_of_bijective AlgEquiv.coe_ofBijective\n\ntheorem ofBijective_apply {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} (a : A₁) :\n (AlgEquiv.ofBijective f hf) a = f a :=\n rfl\n#align alg_equiv.of_bijective_apply AlgEquiv.ofBijective_apply\n\n/-- Forgetting the multiplicative structures, an equivalence of algebras is a linear equivalence. -/\n@[simps apply]\ndef toLinearEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ₗ[R] A₂ :=\n { e with\n toFun := e\n map_smul' := e.map_smul\n invFun := e.symm }\n#align alg_equiv.to_linear_equiv AlgEquiv.toLinearEquiv\n#align alg_equiv.to_linear_equiv_apply AlgEquiv.toLinearEquiv_apply\n\n@[simp]\ntheorem toLinearEquiv_refl : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).toLinearEquiv = LinearEquiv.refl R A₁ :=\n rfl\n#align alg_equiv.to_linear_equiv_refl AlgEquiv.toLinearEquiv_refl\n\n@[simp]\ntheorem toLinearEquiv_symm (e : A₁ ≃ₐ[R] A₂) : e.toLinearEquiv.symm = e.symm.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_symm AlgEquiv.toLinearEquiv_symm\n\n@[simp]\ntheorem toLinearEquiv_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) :\n (e₁.trans e₂).toLinearEquiv = e₁.toLinearEquiv.trans e₂.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_trans AlgEquiv.toLinearEquiv_trans\n\ntheorem toLinearEquiv_injective : Function.Injective (toLinearEquiv : _ → A₁ ≃ₗ[R] A₂) :=\n fun _ _ h => ext <| LinearEquiv.congr_fun h\n#align alg_equiv.to_linear_equiv_injective AlgEquiv.toLinearEquiv_injective\n\n/-- Interpret an algebra equivalence as a linear map. -/\ndef toLinearMap : A₁ →ₗ[R] A₂ :=\n e.toAlgHom.toLinearMap\n#align alg_equiv.to_linear_map AlgEquiv.toLinearMap\n\n@[simp]\ntheorem toAlgHom_toLinearMap : (e : A₁ →ₐ[R] A₂).toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_alg_hom_to_linear_map AlgEquiv.toAlgHom_toLinearMap\n\ntheorem toLinearMap_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).toLinearMap = f.toLinearMap :=\n LinearMap.ext fun _ => rfl\n\n@[simp]\ntheorem toLinearEquiv_toLinearMap : e.toLinearEquiv.toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_linear_equiv_to_linear_map AlgEquiv.toLinearEquiv_toLinearMap\n\n@[simp]\ntheorem toLinearMap_apply (x : A₁) : e.toLinearMap x = e x :=\n rfl\n#align alg_equiv.to_linear_map_apply AlgEquiv.toLinearMap_apply\n\ntheorem toLinearMap_injective : Function.Injective (toLinearMap : _ → A₁ →ₗ[R] A₂) := fun _ _ h =>\n ext <| LinearMap.congr_fun h\n#align alg_equiv.to_linear_map_injective AlgEquiv.toLinearMap_injective\n\n@[simp]\ntheorem trans_toLinearMap (f : A₁ ≃ₐ[R] A₂) (g : A₂ ≃ₐ[R] A₃) :\n (f.trans g).toLinearMap = g.toLinearMap.comp f.toLinearMap :=\n rfl\n#align alg_equiv.trans_to_linear_map AlgEquiv.trans_toLinearMap\n\nsection OfLinearEquiv\n\nvariable (l : A₁ ≃ₗ[R] A₂) (map_one : l 1 = 1) (map_mul : ∀ x y : A₁, l (x * y) = l x * l y)\n\n/-- Upgrade a linear equivalence to an algebra equivalence,\ngiven that it distributes over multiplication and the identity\n-/\n@[simps apply]\ndef ofLinearEquiv : A₁ ≃ₐ[R] A₂ :=\n { l with\n toFun := l\n invFun := l.symm\n map_mul' := map_mul\n commutes' := (AlgHom.ofLinearMap l map_one map_mul : A₁ →ₐ[R] A₂).commutes }\n#align alg_equiv.of_linear_equiv AlgEquiv.ofLinearEquivₓ\n\n@[simp]\ntheorem ofLinearEquiv_symm :\n (ofLinearEquiv l map_one map_mul).symm =\n ofLinearEquiv l.symm (ofLinearEquiv l map_one map_mul).symm.map_one\n (ofLinearEquiv l map_one map_mul).symm.map_mul :=\n rfl\n#align alg_equiv.of_linear_equiv_symm AlgEquiv.ofLinearEquiv_symm\n\n@[simp]\ntheorem ofLinearEquiv_toLinearEquiv (map_mul) (map_one) :\n ofLinearEquiv e.toLinearEquiv map_mul map_one = e := by\n ext\n rfl\n#align alg_equiv.of_linear_equiv_to_linear_equiv AlgEquiv.ofLinearEquiv_toLinearEquiv\n\n@[simp]\ntheorem toLinearEquiv_ofLinearEquiv : toLinearEquiv (ofLinearEquiv l map_one map_mul) = l := by\n ext\n rfl\n#align alg_equiv.to_linear_equiv_of_linear_equiv AlgEquiv.toLinearEquiv_ofLinearEquiv\n\nend OfLinearEquiv\n\nsection OfRingEquiv\n\n/-- Promotes a linear ring_equiv to an AlgEquiv. -/\n@[simps apply symm_apply toEquiv] -- Porting note: don't want redundant `toEquiv_symm_apply` simps\ndef ofRingEquiv {f : A₁ ≃+* A₂} (hf : ∀ x, f (algebraMap R A₁ x) = algebraMap R A₂ x) :\n A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := f.symm\n commutes' := hf }\n#align alg_equiv.of_ring_equiv AlgEquiv.ofRingEquiv\n\nend OfRingEquiv\n\n-- Porting note: projections mul & one not found, removed [simps] and added theorems manually\n-- @[simps (config := .lemmasOnly) one]\ninstance aut : Group (A₁ ≃ₐ[R] A₁) where\n mul ϕ ψ := ψ.trans ϕ\n mul_assoc ϕ ψ χ := rfl\n one := refl\n one_mul ϕ := ext fun x => rfl\n mul_one ϕ := ext fun x => rfl\n inv := symm\n mul_left_inv ϕ := ext <| symm_apply_apply ϕ\n#align alg_equiv.aut AlgEquiv.aut\n\ntheorem aut_mul (ϕ ψ : A₁ ≃ₐ[R] A₁) : ϕ * ψ = ψ.trans ϕ :=\n rfl\n\ntheorem aut_one : 1 = AlgEquiv.refl (R := R) (A₁ := A₁) :=\n rfl\n\n@[simp]\ntheorem one_apply (x : A₁) : (1 : A₁ ≃ₐ[R] A₁) x = x :=\n rfl\n#align alg_equiv.one_apply AlgEquiv.one_apply\n\n@[simp]\ntheorem mul_apply (e₁ e₂ : A₁ ≃ₐ[R] A₁) (x : A₁) : (e₁ * e₂) x = e₁ (e₂ x) :=\n rfl\n#align alg_equiv.mul_apply AlgEquiv.mul_apply\n\n/-- An algebra isomorphism induces a group isomorphism between automorphism groups.\n\nThis is a more bundled version of `AlgEquiv.equivCongr`. -/\n@[simps apply]\ndef autCongr (ϕ : A₁ ≃ₐ[R] A₂) : (A₁ ≃ₐ[R] A₁) ≃* A₂ ≃ₐ[R] A₂ where\n __ := equivCongr ϕ ϕ\n toFun ψ := ϕ.symm.trans (ψ.trans ϕ)\n invFun ψ := ϕ.trans (ψ.trans ϕ.symm)\n map_mul' ψ χ := by\n ext\n ","nextTactic":"simp only [mul_apply, trans_apply, symm_apply_apply]","declUpToTactic":"/-- An algebra isomorphism induces a group isomorphism between automorphism groups.\n\nThis is a more bundled version of `AlgEquiv.equivCongr`. -/\n@[simps apply]\ndef autCongr (ϕ : A₁ ≃ₐ[R] A₂) : (A₁ ≃ₐ[R] A₁) ≃* A₂ ≃ₐ[R] A₂ where\n __ := equivCongr ϕ ϕ\n toFun ψ := ϕ.symm.trans (ψ.trans ϕ)\n invFun ψ := ϕ.trans (ψ.trans ϕ.symm)\n map_mul' ψ χ := by\n ext\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.718_0.gpEhvIDvcS3ZH5c","decl":"/-- An algebra isomorphism induces a group isomorphism between automorphism groups.\n\nThis is a more bundled version of `AlgEquiv.equivCongr`. -/\n@[simps apply]\ndef autCongr (ϕ : A₁ ≃ₐ[R] A₂) : (A₁ ≃ₐ[R] A₁) ≃* A₂ ≃ₐ[R] A₂ where\n __ "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\n⊢ autCongr refl = MulEquiv.refl (A₁ ≃ₐ[R] A₁)","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ext\n simp_rw [trans_apply, apply_symm_apply]\n\n@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') := by\n ext\n rfl\n\n@[simp]\ntheorem equivCongr_symm (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') :\n (equivCongr e e').symm = equivCongr e.symm e'.symm :=\n rfl\n\n@[simp]\ntheorem equivCongr_trans (e₁₂ : A₁ ≃ₐ[R] A₂) (e₁₂' : A₁' ≃ₐ[R] A₂')\n (e₂₃ : A₂ ≃ₐ[R] A₃) (e₂₃' : A₂' ≃ₐ[R] A₃') :\n (equivCongr e₁₂ e₁₂').trans (equivCongr e₂₃ e₂₃') =\n equivCongr (e₁₂.trans e₂₃) (e₁₂'.trans e₂₃') :=\n rfl\n\n/-- If an algebra morphism has an inverse, it is an algebra isomorphism. -/\ndef ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ : f.comp g = AlgHom.id R A₂)\n (h₂ : g.comp f = AlgHom.id R A₁) : A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := g\n left_inv := AlgHom.ext_iff.1 h₂\n right_inv := AlgHom.ext_iff.1 h₁ }\n#align alg_equiv.of_alg_hom AlgEquiv.ofAlgHom\n\ntheorem coe_algHom_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ↑(ofAlgHom f g h₁ h₂) = f :=\n AlgHom.ext fun _ => rfl\n#align alg_equiv.coe_alg_hom_of_alg_hom AlgEquiv.coe_algHom_ofAlgHom\n\n@[simp]\ntheorem ofAlgHom_coe_algHom (f : A₁ ≃ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ofAlgHom (↑f) g h₁ h₂ = f :=\n ext fun _ => rfl\n#align alg_equiv.of_alg_hom_coe_alg_hom AlgEquiv.ofAlgHom_coe_algHom\n\ntheorem ofAlgHom_symm (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).symm = ofAlgHom g f h₂ h₁ :=\n rfl\n#align alg_equiv.of_alg_hom_symm AlgEquiv.ofAlgHom_symm\n\n/-- Promotes a bijective algebra homomorphism to an algebra equivalence. -/\nnoncomputable def ofBijective (f : A₁ →ₐ[R] A₂) (hf : Function.Bijective f) : A₁ ≃ₐ[R] A₂ :=\n { RingEquiv.ofBijective (f : A₁ →+* A₂) hf, f with }\n#align alg_equiv.of_bijective AlgEquiv.ofBijective\n\n@[simp]\ntheorem coe_ofBijective {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} :\n (AlgEquiv.ofBijective f hf : A₁ → A₂) = f :=\n rfl\n#align alg_equiv.coe_of_bijective AlgEquiv.coe_ofBijective\n\ntheorem ofBijective_apply {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} (a : A₁) :\n (AlgEquiv.ofBijective f hf) a = f a :=\n rfl\n#align alg_equiv.of_bijective_apply AlgEquiv.ofBijective_apply\n\n/-- Forgetting the multiplicative structures, an equivalence of algebras is a linear equivalence. -/\n@[simps apply]\ndef toLinearEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ₗ[R] A₂ :=\n { e with\n toFun := e\n map_smul' := e.map_smul\n invFun := e.symm }\n#align alg_equiv.to_linear_equiv AlgEquiv.toLinearEquiv\n#align alg_equiv.to_linear_equiv_apply AlgEquiv.toLinearEquiv_apply\n\n@[simp]\ntheorem toLinearEquiv_refl : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).toLinearEquiv = LinearEquiv.refl R A₁ :=\n rfl\n#align alg_equiv.to_linear_equiv_refl AlgEquiv.toLinearEquiv_refl\n\n@[simp]\ntheorem toLinearEquiv_symm (e : A₁ ≃ₐ[R] A₂) : e.toLinearEquiv.symm = e.symm.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_symm AlgEquiv.toLinearEquiv_symm\n\n@[simp]\ntheorem toLinearEquiv_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) :\n (e₁.trans e₂).toLinearEquiv = e₁.toLinearEquiv.trans e₂.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_trans AlgEquiv.toLinearEquiv_trans\n\ntheorem toLinearEquiv_injective : Function.Injective (toLinearEquiv : _ → A₁ ≃ₗ[R] A₂) :=\n fun _ _ h => ext <| LinearEquiv.congr_fun h\n#align alg_equiv.to_linear_equiv_injective AlgEquiv.toLinearEquiv_injective\n\n/-- Interpret an algebra equivalence as a linear map. -/\ndef toLinearMap : A₁ →ₗ[R] A₂ :=\n e.toAlgHom.toLinearMap\n#align alg_equiv.to_linear_map AlgEquiv.toLinearMap\n\n@[simp]\ntheorem toAlgHom_toLinearMap : (e : A₁ →ₐ[R] A₂).toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_alg_hom_to_linear_map AlgEquiv.toAlgHom_toLinearMap\n\ntheorem toLinearMap_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).toLinearMap = f.toLinearMap :=\n LinearMap.ext fun _ => rfl\n\n@[simp]\ntheorem toLinearEquiv_toLinearMap : e.toLinearEquiv.toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_linear_equiv_to_linear_map AlgEquiv.toLinearEquiv_toLinearMap\n\n@[simp]\ntheorem toLinearMap_apply (x : A₁) : e.toLinearMap x = e x :=\n rfl\n#align alg_equiv.to_linear_map_apply AlgEquiv.toLinearMap_apply\n\ntheorem toLinearMap_injective : Function.Injective (toLinearMap : _ → A₁ →ₗ[R] A₂) := fun _ _ h =>\n ext <| LinearMap.congr_fun h\n#align alg_equiv.to_linear_map_injective AlgEquiv.toLinearMap_injective\n\n@[simp]\ntheorem trans_toLinearMap (f : A₁ ≃ₐ[R] A₂) (g : A₂ ≃ₐ[R] A₃) :\n (f.trans g).toLinearMap = g.toLinearMap.comp f.toLinearMap :=\n rfl\n#align alg_equiv.trans_to_linear_map AlgEquiv.trans_toLinearMap\n\nsection OfLinearEquiv\n\nvariable (l : A₁ ≃ₗ[R] A₂) (map_one : l 1 = 1) (map_mul : ∀ x y : A₁, l (x * y) = l x * l y)\n\n/-- Upgrade a linear equivalence to an algebra equivalence,\ngiven that it distributes over multiplication and the identity\n-/\n@[simps apply]\ndef ofLinearEquiv : A₁ ≃ₐ[R] A₂ :=\n { l with\n toFun := l\n invFun := l.symm\n map_mul' := map_mul\n commutes' := (AlgHom.ofLinearMap l map_one map_mul : A₁ →ₐ[R] A₂).commutes }\n#align alg_equiv.of_linear_equiv AlgEquiv.ofLinearEquivₓ\n\n@[simp]\ntheorem ofLinearEquiv_symm :\n (ofLinearEquiv l map_one map_mul).symm =\n ofLinearEquiv l.symm (ofLinearEquiv l map_one map_mul).symm.map_one\n (ofLinearEquiv l map_one map_mul).symm.map_mul :=\n rfl\n#align alg_equiv.of_linear_equiv_symm AlgEquiv.ofLinearEquiv_symm\n\n@[simp]\ntheorem ofLinearEquiv_toLinearEquiv (map_mul) (map_one) :\n ofLinearEquiv e.toLinearEquiv map_mul map_one = e := by\n ext\n rfl\n#align alg_equiv.of_linear_equiv_to_linear_equiv AlgEquiv.ofLinearEquiv_toLinearEquiv\n\n@[simp]\ntheorem toLinearEquiv_ofLinearEquiv : toLinearEquiv (ofLinearEquiv l map_one map_mul) = l := by\n ext\n rfl\n#align alg_equiv.to_linear_equiv_of_linear_equiv AlgEquiv.toLinearEquiv_ofLinearEquiv\n\nend OfLinearEquiv\n\nsection OfRingEquiv\n\n/-- Promotes a linear ring_equiv to an AlgEquiv. -/\n@[simps apply symm_apply toEquiv] -- Porting note: don't want redundant `toEquiv_symm_apply` simps\ndef ofRingEquiv {f : A₁ ≃+* A₂} (hf : ∀ x, f (algebraMap R A₁ x) = algebraMap R A₂ x) :\n A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := f.symm\n commutes' := hf }\n#align alg_equiv.of_ring_equiv AlgEquiv.ofRingEquiv\n\nend OfRingEquiv\n\n-- Porting note: projections mul & one not found, removed [simps] and added theorems manually\n-- @[simps (config := .lemmasOnly) one]\ninstance aut : Group (A₁ ≃ₐ[R] A₁) where\n mul ϕ ψ := ψ.trans ϕ\n mul_assoc ϕ ψ χ := rfl\n one := refl\n one_mul ϕ := ext fun x => rfl\n mul_one ϕ := ext fun x => rfl\n inv := symm\n mul_left_inv ϕ := ext <| symm_apply_apply ϕ\n#align alg_equiv.aut AlgEquiv.aut\n\ntheorem aut_mul (ϕ ψ : A₁ ≃ₐ[R] A₁) : ϕ * ψ = ψ.trans ϕ :=\n rfl\n\ntheorem aut_one : 1 = AlgEquiv.refl (R := R) (A₁ := A₁) :=\n rfl\n\n@[simp]\ntheorem one_apply (x : A₁) : (1 : A₁ ≃ₐ[R] A₁) x = x :=\n rfl\n#align alg_equiv.one_apply AlgEquiv.one_apply\n\n@[simp]\ntheorem mul_apply (e₁ e₂ : A₁ ≃ₐ[R] A₁) (x : A₁) : (e₁ * e₂) x = e₁ (e₂ x) :=\n rfl\n#align alg_equiv.mul_apply AlgEquiv.mul_apply\n\n/-- An algebra isomorphism induces a group isomorphism between automorphism groups.\n\nThis is a more bundled version of `AlgEquiv.equivCongr`. -/\n@[simps apply]\ndef autCongr (ϕ : A₁ ≃ₐ[R] A₂) : (A₁ ≃ₐ[R] A₁) ≃* A₂ ≃ₐ[R] A₂ where\n __ := equivCongr ϕ ϕ\n toFun ψ := ϕ.symm.trans (ψ.trans ϕ)\n invFun ψ := ϕ.trans (ψ.trans ϕ.symm)\n map_mul' ψ χ := by\n ext\n simp only [mul_apply, trans_apply, symm_apply_apply]\n#align alg_equiv.aut_congr AlgEquiv.autCongr\n\n@[simp]\ntheorem autCongr_refl : autCongr AlgEquiv.refl = MulEquiv.refl (A₁ ≃ₐ[R] A₁) := by\n ","nextTactic":"ext","declUpToTactic":"@[simp]\ntheorem autCongr_refl : autCongr AlgEquiv.refl = MulEquiv.refl (A₁ ≃ₐ[R] A₁) := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.731_0.gpEhvIDvcS3ZH5c","decl":"@[simp]\ntheorem autCongr_refl : autCongr AlgEquiv.refl = MulEquiv.refl (A₁ ≃ₐ[R] A₁) "} -{"state":"case h.h\nR : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\nx✝ : A₁ ≃ₐ[R] A₁\na✝ : A₁\n⊢ ((autCongr refl) x✝) a✝ = ((MulEquiv.refl (A₁ ≃ₐ[R] A₁)) x✝) a✝","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ext\n simp_rw [trans_apply, apply_symm_apply]\n\n@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') := by\n ext\n rfl\n\n@[simp]\ntheorem equivCongr_symm (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') :\n (equivCongr e e').symm = equivCongr e.symm e'.symm :=\n rfl\n\n@[simp]\ntheorem equivCongr_trans (e₁₂ : A₁ ≃ₐ[R] A₂) (e₁₂' : A₁' ≃ₐ[R] A₂')\n (e₂₃ : A₂ ≃ₐ[R] A₃) (e₂₃' : A₂' ≃ₐ[R] A₃') :\n (equivCongr e₁₂ e₁₂').trans (equivCongr e₂₃ e₂₃') =\n equivCongr (e₁₂.trans e₂₃) (e₁₂'.trans e₂₃') :=\n rfl\n\n/-- If an algebra morphism has an inverse, it is an algebra isomorphism. -/\ndef ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ : f.comp g = AlgHom.id R A₂)\n (h₂ : g.comp f = AlgHom.id R A₁) : A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := g\n left_inv := AlgHom.ext_iff.1 h₂\n right_inv := AlgHom.ext_iff.1 h₁ }\n#align alg_equiv.of_alg_hom AlgEquiv.ofAlgHom\n\ntheorem coe_algHom_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ↑(ofAlgHom f g h₁ h₂) = f :=\n AlgHom.ext fun _ => rfl\n#align alg_equiv.coe_alg_hom_of_alg_hom AlgEquiv.coe_algHom_ofAlgHom\n\n@[simp]\ntheorem ofAlgHom_coe_algHom (f : A₁ ≃ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ofAlgHom (↑f) g h₁ h₂ = f :=\n ext fun _ => rfl\n#align alg_equiv.of_alg_hom_coe_alg_hom AlgEquiv.ofAlgHom_coe_algHom\n\ntheorem ofAlgHom_symm (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).symm = ofAlgHom g f h₂ h₁ :=\n rfl\n#align alg_equiv.of_alg_hom_symm AlgEquiv.ofAlgHom_symm\n\n/-- Promotes a bijective algebra homomorphism to an algebra equivalence. -/\nnoncomputable def ofBijective (f : A₁ →ₐ[R] A₂) (hf : Function.Bijective f) : A₁ ≃ₐ[R] A₂ :=\n { RingEquiv.ofBijective (f : A₁ →+* A₂) hf, f with }\n#align alg_equiv.of_bijective AlgEquiv.ofBijective\n\n@[simp]\ntheorem coe_ofBijective {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} :\n (AlgEquiv.ofBijective f hf : A₁ → A₂) = f :=\n rfl\n#align alg_equiv.coe_of_bijective AlgEquiv.coe_ofBijective\n\ntheorem ofBijective_apply {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} (a : A₁) :\n (AlgEquiv.ofBijective f hf) a = f a :=\n rfl\n#align alg_equiv.of_bijective_apply AlgEquiv.ofBijective_apply\n\n/-- Forgetting the multiplicative structures, an equivalence of algebras is a linear equivalence. -/\n@[simps apply]\ndef toLinearEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ₗ[R] A₂ :=\n { e with\n toFun := e\n map_smul' := e.map_smul\n invFun := e.symm }\n#align alg_equiv.to_linear_equiv AlgEquiv.toLinearEquiv\n#align alg_equiv.to_linear_equiv_apply AlgEquiv.toLinearEquiv_apply\n\n@[simp]\ntheorem toLinearEquiv_refl : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).toLinearEquiv = LinearEquiv.refl R A₁ :=\n rfl\n#align alg_equiv.to_linear_equiv_refl AlgEquiv.toLinearEquiv_refl\n\n@[simp]\ntheorem toLinearEquiv_symm (e : A₁ ≃ₐ[R] A₂) : e.toLinearEquiv.symm = e.symm.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_symm AlgEquiv.toLinearEquiv_symm\n\n@[simp]\ntheorem toLinearEquiv_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) :\n (e₁.trans e₂).toLinearEquiv = e₁.toLinearEquiv.trans e₂.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_trans AlgEquiv.toLinearEquiv_trans\n\ntheorem toLinearEquiv_injective : Function.Injective (toLinearEquiv : _ → A₁ ≃ₗ[R] A₂) :=\n fun _ _ h => ext <| LinearEquiv.congr_fun h\n#align alg_equiv.to_linear_equiv_injective AlgEquiv.toLinearEquiv_injective\n\n/-- Interpret an algebra equivalence as a linear map. -/\ndef toLinearMap : A₁ →ₗ[R] A₂ :=\n e.toAlgHom.toLinearMap\n#align alg_equiv.to_linear_map AlgEquiv.toLinearMap\n\n@[simp]\ntheorem toAlgHom_toLinearMap : (e : A₁ →ₐ[R] A₂).toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_alg_hom_to_linear_map AlgEquiv.toAlgHom_toLinearMap\n\ntheorem toLinearMap_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).toLinearMap = f.toLinearMap :=\n LinearMap.ext fun _ => rfl\n\n@[simp]\ntheorem toLinearEquiv_toLinearMap : e.toLinearEquiv.toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_linear_equiv_to_linear_map AlgEquiv.toLinearEquiv_toLinearMap\n\n@[simp]\ntheorem toLinearMap_apply (x : A₁) : e.toLinearMap x = e x :=\n rfl\n#align alg_equiv.to_linear_map_apply AlgEquiv.toLinearMap_apply\n\ntheorem toLinearMap_injective : Function.Injective (toLinearMap : _ → A₁ →ₗ[R] A₂) := fun _ _ h =>\n ext <| LinearMap.congr_fun h\n#align alg_equiv.to_linear_map_injective AlgEquiv.toLinearMap_injective\n\n@[simp]\ntheorem trans_toLinearMap (f : A₁ ≃ₐ[R] A₂) (g : A₂ ≃ₐ[R] A₃) :\n (f.trans g).toLinearMap = g.toLinearMap.comp f.toLinearMap :=\n rfl\n#align alg_equiv.trans_to_linear_map AlgEquiv.trans_toLinearMap\n\nsection OfLinearEquiv\n\nvariable (l : A₁ ≃ₗ[R] A₂) (map_one : l 1 = 1) (map_mul : ∀ x y : A₁, l (x * y) = l x * l y)\n\n/-- Upgrade a linear equivalence to an algebra equivalence,\ngiven that it distributes over multiplication and the identity\n-/\n@[simps apply]\ndef ofLinearEquiv : A₁ ≃ₐ[R] A₂ :=\n { l with\n toFun := l\n invFun := l.symm\n map_mul' := map_mul\n commutes' := (AlgHom.ofLinearMap l map_one map_mul : A₁ →ₐ[R] A₂).commutes }\n#align alg_equiv.of_linear_equiv AlgEquiv.ofLinearEquivₓ\n\n@[simp]\ntheorem ofLinearEquiv_symm :\n (ofLinearEquiv l map_one map_mul).symm =\n ofLinearEquiv l.symm (ofLinearEquiv l map_one map_mul).symm.map_one\n (ofLinearEquiv l map_one map_mul).symm.map_mul :=\n rfl\n#align alg_equiv.of_linear_equiv_symm AlgEquiv.ofLinearEquiv_symm\n\n@[simp]\ntheorem ofLinearEquiv_toLinearEquiv (map_mul) (map_one) :\n ofLinearEquiv e.toLinearEquiv map_mul map_one = e := by\n ext\n rfl\n#align alg_equiv.of_linear_equiv_to_linear_equiv AlgEquiv.ofLinearEquiv_toLinearEquiv\n\n@[simp]\ntheorem toLinearEquiv_ofLinearEquiv : toLinearEquiv (ofLinearEquiv l map_one map_mul) = l := by\n ext\n rfl\n#align alg_equiv.to_linear_equiv_of_linear_equiv AlgEquiv.toLinearEquiv_ofLinearEquiv\n\nend OfLinearEquiv\n\nsection OfRingEquiv\n\n/-- Promotes a linear ring_equiv to an AlgEquiv. -/\n@[simps apply symm_apply toEquiv] -- Porting note: don't want redundant `toEquiv_symm_apply` simps\ndef ofRingEquiv {f : A₁ ≃+* A₂} (hf : ∀ x, f (algebraMap R A₁ x) = algebraMap R A₂ x) :\n A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := f.symm\n commutes' := hf }\n#align alg_equiv.of_ring_equiv AlgEquiv.ofRingEquiv\n\nend OfRingEquiv\n\n-- Porting note: projections mul & one not found, removed [simps] and added theorems manually\n-- @[simps (config := .lemmasOnly) one]\ninstance aut : Group (A₁ ≃ₐ[R] A₁) where\n mul ϕ ψ := ψ.trans ϕ\n mul_assoc ϕ ψ χ := rfl\n one := refl\n one_mul ϕ := ext fun x => rfl\n mul_one ϕ := ext fun x => rfl\n inv := symm\n mul_left_inv ϕ := ext <| symm_apply_apply ϕ\n#align alg_equiv.aut AlgEquiv.aut\n\ntheorem aut_mul (ϕ ψ : A₁ ≃ₐ[R] A₁) : ϕ * ψ = ψ.trans ϕ :=\n rfl\n\ntheorem aut_one : 1 = AlgEquiv.refl (R := R) (A₁ := A₁) :=\n rfl\n\n@[simp]\ntheorem one_apply (x : A₁) : (1 : A₁ ≃ₐ[R] A₁) x = x :=\n rfl\n#align alg_equiv.one_apply AlgEquiv.one_apply\n\n@[simp]\ntheorem mul_apply (e₁ e₂ : A₁ ≃ₐ[R] A₁) (x : A₁) : (e₁ * e₂) x = e₁ (e₂ x) :=\n rfl\n#align alg_equiv.mul_apply AlgEquiv.mul_apply\n\n/-- An algebra isomorphism induces a group isomorphism between automorphism groups.\n\nThis is a more bundled version of `AlgEquiv.equivCongr`. -/\n@[simps apply]\ndef autCongr (ϕ : A₁ ≃ₐ[R] A₂) : (A₁ ≃ₐ[R] A₁) ≃* A₂ ≃ₐ[R] A₂ where\n __ := equivCongr ϕ ϕ\n toFun ψ := ϕ.symm.trans (ψ.trans ϕ)\n invFun ψ := ϕ.trans (ψ.trans ϕ.symm)\n map_mul' ψ χ := by\n ext\n simp only [mul_apply, trans_apply, symm_apply_apply]\n#align alg_equiv.aut_congr AlgEquiv.autCongr\n\n@[simp]\ntheorem autCongr_refl : autCongr AlgEquiv.refl = MulEquiv.refl (A₁ ≃ₐ[R] A₁) := by\n ext\n ","nextTactic":"rfl","declUpToTactic":"@[simp]\ntheorem autCongr_refl : autCongr AlgEquiv.refl = MulEquiv.refl (A₁ ≃ₐ[R] A₁) := by\n ext\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.731_0.gpEhvIDvcS3ZH5c","decl":"@[simp]\ntheorem autCongr_refl : autCongr AlgEquiv.refl = MulEquiv.refl (A₁ ≃ₐ[R] A₁) "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\nx : A₁ˣ\n⊢ 1 • x = x","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A���] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ext\n simp_rw [trans_apply, apply_symm_apply]\n\n@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') := by\n ext\n rfl\n\n@[simp]\ntheorem equivCongr_symm (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') :\n (equivCongr e e').symm = equivCongr e.symm e'.symm :=\n rfl\n\n@[simp]\ntheorem equivCongr_trans (e₁₂ : A₁ ≃ₐ[R] A₂) (e₁₂' : A₁' ≃ₐ[R] A₂')\n (e₂₃ : A₂ ≃ₐ[R] A₃) (e₂₃' : A₂' ≃ₐ[R] A₃') :\n (equivCongr e₁₂ e₁₂').trans (equivCongr e₂₃ e₂₃') =\n equivCongr (e₁₂.trans e₂₃) (e₁₂'.trans e₂₃') :=\n rfl\n\n/-- If an algebra morphism has an inverse, it is an algebra isomorphism. -/\ndef ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ : f.comp g = AlgHom.id R A₂)\n (h₂ : g.comp f = AlgHom.id R A₁) : A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := g\n left_inv := AlgHom.ext_iff.1 h₂\n right_inv := AlgHom.ext_iff.1 h₁ }\n#align alg_equiv.of_alg_hom AlgEquiv.ofAlgHom\n\ntheorem coe_algHom_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ↑(ofAlgHom f g h₁ h₂) = f :=\n AlgHom.ext fun _ => rfl\n#align alg_equiv.coe_alg_hom_of_alg_hom AlgEquiv.coe_algHom_ofAlgHom\n\n@[simp]\ntheorem ofAlgHom_coe_algHom (f : A₁ ≃ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ofAlgHom (↑f) g h₁ h₂ = f :=\n ext fun _ => rfl\n#align alg_equiv.of_alg_hom_coe_alg_hom AlgEquiv.ofAlgHom_coe_algHom\n\ntheorem ofAlgHom_symm (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).symm = ofAlgHom g f h₂ h₁ :=\n rfl\n#align alg_equiv.of_alg_hom_symm AlgEquiv.ofAlgHom_symm\n\n/-- Promotes a bijective algebra homomorphism to an algebra equivalence. -/\nnoncomputable def ofBijective (f : A₁ →ₐ[R] A₂) (hf : Function.Bijective f) : A₁ ≃ₐ[R] A₂ :=\n { RingEquiv.ofBijective (f : A₁ →+* A₂) hf, f with }\n#align alg_equiv.of_bijective AlgEquiv.ofBijective\n\n@[simp]\ntheorem coe_ofBijective {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} :\n (AlgEquiv.ofBijective f hf : A₁ → A₂) = f :=\n rfl\n#align alg_equiv.coe_of_bijective AlgEquiv.coe_ofBijective\n\ntheorem ofBijective_apply {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} (a : A₁) :\n (AlgEquiv.ofBijective f hf) a = f a :=\n rfl\n#align alg_equiv.of_bijective_apply AlgEquiv.ofBijective_apply\n\n/-- Forgetting the multiplicative structures, an equivalence of algebras is a linear equivalence. -/\n@[simps apply]\ndef toLinearEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ₗ[R] A₂ :=\n { e with\n toFun := e\n map_smul' := e.map_smul\n invFun := e.symm }\n#align alg_equiv.to_linear_equiv AlgEquiv.toLinearEquiv\n#align alg_equiv.to_linear_equiv_apply AlgEquiv.toLinearEquiv_apply\n\n@[simp]\ntheorem toLinearEquiv_refl : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).toLinearEquiv = LinearEquiv.refl R A₁ :=\n rfl\n#align alg_equiv.to_linear_equiv_refl AlgEquiv.toLinearEquiv_refl\n\n@[simp]\ntheorem toLinearEquiv_symm (e : A₁ ≃ₐ[R] A₂) : e.toLinearEquiv.symm = e.symm.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_symm AlgEquiv.toLinearEquiv_symm\n\n@[simp]\ntheorem toLinearEquiv_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) :\n (e₁.trans e₂).toLinearEquiv = e₁.toLinearEquiv.trans e₂.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_trans AlgEquiv.toLinearEquiv_trans\n\ntheorem toLinearEquiv_injective : Function.Injective (toLinearEquiv : _ → A₁ ≃ₗ[R] A₂) :=\n fun _ _ h => ext <| LinearEquiv.congr_fun h\n#align alg_equiv.to_linear_equiv_injective AlgEquiv.toLinearEquiv_injective\n\n/-- Interpret an algebra equivalence as a linear map. -/\ndef toLinearMap : A₁ →ₗ[R] A₂ :=\n e.toAlgHom.toLinearMap\n#align alg_equiv.to_linear_map AlgEquiv.toLinearMap\n\n@[simp]\ntheorem toAlgHom_toLinearMap : (e : A₁ →ₐ[R] A₂).toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_alg_hom_to_linear_map AlgEquiv.toAlgHom_toLinearMap\n\ntheorem toLinearMap_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).toLinearMap = f.toLinearMap :=\n LinearMap.ext fun _ => rfl\n\n@[simp]\ntheorem toLinearEquiv_toLinearMap : e.toLinearEquiv.toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_linear_equiv_to_linear_map AlgEquiv.toLinearEquiv_toLinearMap\n\n@[simp]\ntheorem toLinearMap_apply (x : A₁) : e.toLinearMap x = e x :=\n rfl\n#align alg_equiv.to_linear_map_apply AlgEquiv.toLinearMap_apply\n\ntheorem toLinearMap_injective : Function.Injective (toLinearMap : _ → A₁ →ₗ[R] A₂) := fun _ _ h =>\n ext <| LinearMap.congr_fun h\n#align alg_equiv.to_linear_map_injective AlgEquiv.toLinearMap_injective\n\n@[simp]\ntheorem trans_toLinearMap (f : A₁ ≃ₐ[R] A₂) (g : A₂ ≃ₐ[R] A₃) :\n (f.trans g).toLinearMap = g.toLinearMap.comp f.toLinearMap :=\n rfl\n#align alg_equiv.trans_to_linear_map AlgEquiv.trans_toLinearMap\n\nsection OfLinearEquiv\n\nvariable (l : A₁ ≃ₗ[R] A₂) (map_one : l 1 = 1) (map_mul : ∀ x y : A₁, l (x * y) = l x * l y)\n\n/-- Upgrade a linear equivalence to an algebra equivalence,\ngiven that it distributes over multiplication and the identity\n-/\n@[simps apply]\ndef ofLinearEquiv : A₁ ≃ₐ[R] A₂ :=\n { l with\n toFun := l\n invFun := l.symm\n map_mul' := map_mul\n commutes' := (AlgHom.ofLinearMap l map_one map_mul : A₁ →ₐ[R] A₂).commutes }\n#align alg_equiv.of_linear_equiv AlgEquiv.ofLinearEquivₓ\n\n@[simp]\ntheorem ofLinearEquiv_symm :\n (ofLinearEquiv l map_one map_mul).symm =\n ofLinearEquiv l.symm (ofLinearEquiv l map_one map_mul).symm.map_one\n (ofLinearEquiv l map_one map_mul).symm.map_mul :=\n rfl\n#align alg_equiv.of_linear_equiv_symm AlgEquiv.ofLinearEquiv_symm\n\n@[simp]\ntheorem ofLinearEquiv_toLinearEquiv (map_mul) (map_one) :\n ofLinearEquiv e.toLinearEquiv map_mul map_one = e := by\n ext\n rfl\n#align alg_equiv.of_linear_equiv_to_linear_equiv AlgEquiv.ofLinearEquiv_toLinearEquiv\n\n@[simp]\ntheorem toLinearEquiv_ofLinearEquiv : toLinearEquiv (ofLinearEquiv l map_one map_mul) = l := by\n ext\n rfl\n#align alg_equiv.to_linear_equiv_of_linear_equiv AlgEquiv.toLinearEquiv_ofLinearEquiv\n\nend OfLinearEquiv\n\nsection OfRingEquiv\n\n/-- Promotes a linear ring_equiv to an AlgEquiv. -/\n@[simps apply symm_apply toEquiv] -- Porting note: don't want redundant `toEquiv_symm_apply` simps\ndef ofRingEquiv {f : A₁ ≃+* A₂} (hf : ∀ x, f (algebraMap R A₁ x) = algebraMap R A₂ x) :\n A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := f.symm\n commutes' := hf }\n#align alg_equiv.of_ring_equiv AlgEquiv.ofRingEquiv\n\nend OfRingEquiv\n\n-- Porting note: projections mul & one not found, removed [simps] and added theorems manually\n-- @[simps (config := .lemmasOnly) one]\ninstance aut : Group (A₁ ≃ₐ[R] A₁) where\n mul ϕ ψ := ψ.trans ϕ\n mul_assoc ϕ ψ χ := rfl\n one := refl\n one_mul ϕ := ext fun x => rfl\n mul_one ϕ := ext fun x => rfl\n inv := symm\n mul_left_inv ϕ := ext <| symm_apply_apply ϕ\n#align alg_equiv.aut AlgEquiv.aut\n\ntheorem aut_mul (ϕ ψ : A₁ ≃ₐ[R] A₁) : ϕ * ψ = ψ.trans ϕ :=\n rfl\n\ntheorem aut_one : 1 = AlgEquiv.refl (R := R) (A₁ := A₁) :=\n rfl\n\n@[simp]\ntheorem one_apply (x : A₁) : (1 : A₁ ≃ₐ[R] A₁) x = x :=\n rfl\n#align alg_equiv.one_apply AlgEquiv.one_apply\n\n@[simp]\ntheorem mul_apply (e₁ e₂ : A₁ ≃ₐ[R] A₁) (x : A₁) : (e₁ * e₂) x = e₁ (e₂ x) :=\n rfl\n#align alg_equiv.mul_apply AlgEquiv.mul_apply\n\n/-- An algebra isomorphism induces a group isomorphism between automorphism groups.\n\nThis is a more bundled version of `AlgEquiv.equivCongr`. -/\n@[simps apply]\ndef autCongr (ϕ : A₁ ≃ₐ[R] A₂) : (A₁ ≃ₐ[R] A₁) ≃* A₂ ≃ₐ[R] A₂ where\n __ := equivCongr ϕ ϕ\n toFun ψ := ϕ.symm.trans (ψ.trans ϕ)\n invFun ψ := ϕ.trans (ψ.trans ϕ.symm)\n map_mul' ψ χ := by\n ext\n simp only [mul_apply, trans_apply, symm_apply_apply]\n#align alg_equiv.aut_congr AlgEquiv.autCongr\n\n@[simp]\ntheorem autCongr_refl : autCongr AlgEquiv.refl = MulEquiv.refl (A₁ ≃ₐ[R] A₁) := by\n ext\n rfl\n#align alg_equiv.aut_congr_refl AlgEquiv.autCongr_refl\n\n@[simp]\ntheorem autCongr_symm (ϕ : A₁ ≃ₐ[R] A₂) : (autCongr ϕ).symm = autCongr ϕ.symm :=\n rfl\n#align alg_equiv.aut_congr_symm AlgEquiv.autCongr_symm\n\n@[simp]\ntheorem autCongr_trans (ϕ : A₁ ≃ₐ[R] A₂) (ψ : A₂ ≃ₐ[R] A₃) :\n (autCongr ϕ).trans (autCongr ψ) = autCongr (ϕ.trans ψ) :=\n rfl\n#align alg_equiv.aut_congr_trans AlgEquiv.autCongr_trans\n\n/-- The tautological action by `A₁ ≃ₐ[R] A₁` on `A₁`.\n\nThis generalizes `Function.End.applyMulAction`. -/\ninstance applyMulSemiringAction : MulSemiringAction (A₁ ≃ₐ[R] A₁) A₁ where\n smul := (· <| ·)\n smul_zero := AlgEquiv.map_zero\n smul_add := AlgEquiv.map_add\n smul_one := AlgEquiv.map_one\n smul_mul := AlgEquiv.map_mul\n one_smul _ := rfl\n mul_smul _ _ _ := rfl\n#align alg_equiv.apply_mul_semiring_action AlgEquiv.applyMulSemiringAction\n\ninstance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul := fun f => Units.map f\n one_smul := fun x => by ","nextTactic":"ext","declUpToTactic":"instance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul := fun f => Units.map f\n one_smul := fun x => by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.761_0.gpEhvIDvcS3ZH5c","decl":"instance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul "} -{"state":"case a\nR : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\nx : A₁ˣ\n⊢ ↑(1 • x) = ↑x","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ext\n simp_rw [trans_apply, apply_symm_apply]\n\n@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') := by\n ext\n rfl\n\n@[simp]\ntheorem equivCongr_symm (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') :\n (equivCongr e e').symm = equivCongr e.symm e'.symm :=\n rfl\n\n@[simp]\ntheorem equivCongr_trans (e₁₂ : A₁ ≃ₐ[R] A₂) (e₁₂' : A₁' ≃ₐ[R] A₂')\n (e₂₃ : A₂ ≃ₐ[R] A₃) (e₂₃' : A₂' ≃ₐ[R] A₃') :\n (equivCongr e₁₂ e₁₂').trans (equivCongr e₂₃ e₂₃') =\n equivCongr (e₁₂.trans e₂₃) (e₁₂'.trans e₂₃') :=\n rfl\n\n/-- If an algebra morphism has an inverse, it is an algebra isomorphism. -/\ndef ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ : f.comp g = AlgHom.id R A₂)\n (h₂ : g.comp f = AlgHom.id R A₁) : A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := g\n left_inv := AlgHom.ext_iff.1 h₂\n right_inv := AlgHom.ext_iff.1 h₁ }\n#align alg_equiv.of_alg_hom AlgEquiv.ofAlgHom\n\ntheorem coe_algHom_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ↑(ofAlgHom f g h₁ h₂) = f :=\n AlgHom.ext fun _ => rfl\n#align alg_equiv.coe_alg_hom_of_alg_hom AlgEquiv.coe_algHom_ofAlgHom\n\n@[simp]\ntheorem ofAlgHom_coe_algHom (f : A₁ ≃ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ofAlgHom (↑f) g h₁ h₂ = f :=\n ext fun _ => rfl\n#align alg_equiv.of_alg_hom_coe_alg_hom AlgEquiv.ofAlgHom_coe_algHom\n\ntheorem ofAlgHom_symm (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).symm = ofAlgHom g f h₂ h₁ :=\n rfl\n#align alg_equiv.of_alg_hom_symm AlgEquiv.ofAlgHom_symm\n\n/-- Promotes a bijective algebra homomorphism to an algebra equivalence. -/\nnoncomputable def ofBijective (f : A₁ →ₐ[R] A₂) (hf : Function.Bijective f) : A₁ ≃ₐ[R] A₂ :=\n { RingEquiv.ofBijective (f : A₁ →+* A₂) hf, f with }\n#align alg_equiv.of_bijective AlgEquiv.ofBijective\n\n@[simp]\ntheorem coe_ofBijective {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} :\n (AlgEquiv.ofBijective f hf : A₁ → A₂) = f :=\n rfl\n#align alg_equiv.coe_of_bijective AlgEquiv.coe_ofBijective\n\ntheorem ofBijective_apply {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} (a : A₁) :\n (AlgEquiv.ofBijective f hf) a = f a :=\n rfl\n#align alg_equiv.of_bijective_apply AlgEquiv.ofBijective_apply\n\n/-- Forgetting the multiplicative structures, an equivalence of algebras is a linear equivalence. -/\n@[simps apply]\ndef toLinearEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ₗ[R] A₂ :=\n { e with\n toFun := e\n map_smul' := e.map_smul\n invFun := e.symm }\n#align alg_equiv.to_linear_equiv AlgEquiv.toLinearEquiv\n#align alg_equiv.to_linear_equiv_apply AlgEquiv.toLinearEquiv_apply\n\n@[simp]\ntheorem toLinearEquiv_refl : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).toLinearEquiv = LinearEquiv.refl R A₁ :=\n rfl\n#align alg_equiv.to_linear_equiv_refl AlgEquiv.toLinearEquiv_refl\n\n@[simp]\ntheorem toLinearEquiv_symm (e : A₁ ≃ₐ[R] A₂) : e.toLinearEquiv.symm = e.symm.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_symm AlgEquiv.toLinearEquiv_symm\n\n@[simp]\ntheorem toLinearEquiv_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) :\n (e₁.trans e₂).toLinearEquiv = e₁.toLinearEquiv.trans e₂.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_trans AlgEquiv.toLinearEquiv_trans\n\ntheorem toLinearEquiv_injective : Function.Injective (toLinearEquiv : _ → A₁ ≃ₗ[R] A₂) :=\n fun _ _ h => ext <| LinearEquiv.congr_fun h\n#align alg_equiv.to_linear_equiv_injective AlgEquiv.toLinearEquiv_injective\n\n/-- Interpret an algebra equivalence as a linear map. -/\ndef toLinearMap : A₁ →ₗ[R] A₂ :=\n e.toAlgHom.toLinearMap\n#align alg_equiv.to_linear_map AlgEquiv.toLinearMap\n\n@[simp]\ntheorem toAlgHom_toLinearMap : (e : A₁ →ₐ[R] A₂).toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_alg_hom_to_linear_map AlgEquiv.toAlgHom_toLinearMap\n\ntheorem toLinearMap_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).toLinearMap = f.toLinearMap :=\n LinearMap.ext fun _ => rfl\n\n@[simp]\ntheorem toLinearEquiv_toLinearMap : e.toLinearEquiv.toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_linear_equiv_to_linear_map AlgEquiv.toLinearEquiv_toLinearMap\n\n@[simp]\ntheorem toLinearMap_apply (x : A₁) : e.toLinearMap x = e x :=\n rfl\n#align alg_equiv.to_linear_map_apply AlgEquiv.toLinearMap_apply\n\ntheorem toLinearMap_injective : Function.Injective (toLinearMap : _ → A₁ →ₗ[R] A₂) := fun _ _ h =>\n ext <| LinearMap.congr_fun h\n#align alg_equiv.to_linear_map_injective AlgEquiv.toLinearMap_injective\n\n@[simp]\ntheorem trans_toLinearMap (f : A₁ ≃ₐ[R] A₂) (g : A₂ ≃ₐ[R] A₃) :\n (f.trans g).toLinearMap = g.toLinearMap.comp f.toLinearMap :=\n rfl\n#align alg_equiv.trans_to_linear_map AlgEquiv.trans_toLinearMap\n\nsection OfLinearEquiv\n\nvariable (l : A₁ ≃ₗ[R] A₂) (map_one : l 1 = 1) (map_mul : ∀ x y : A₁, l (x * y) = l x * l y)\n\n/-- Upgrade a linear equivalence to an algebra equivalence,\ngiven that it distributes over multiplication and the identity\n-/\n@[simps apply]\ndef ofLinearEquiv : A₁ ≃ₐ[R] A₂ :=\n { l with\n toFun := l\n invFun := l.symm\n map_mul' := map_mul\n commutes' := (AlgHom.ofLinearMap l map_one map_mul : A₁ →ₐ[R] A₂).commutes }\n#align alg_equiv.of_linear_equiv AlgEquiv.ofLinearEquivₓ\n\n@[simp]\ntheorem ofLinearEquiv_symm :\n (ofLinearEquiv l map_one map_mul).symm =\n ofLinearEquiv l.symm (ofLinearEquiv l map_one map_mul).symm.map_one\n (ofLinearEquiv l map_one map_mul).symm.map_mul :=\n rfl\n#align alg_equiv.of_linear_equiv_symm AlgEquiv.ofLinearEquiv_symm\n\n@[simp]\ntheorem ofLinearEquiv_toLinearEquiv (map_mul) (map_one) :\n ofLinearEquiv e.toLinearEquiv map_mul map_one = e := by\n ext\n rfl\n#align alg_equiv.of_linear_equiv_to_linear_equiv AlgEquiv.ofLinearEquiv_toLinearEquiv\n\n@[simp]\ntheorem toLinearEquiv_ofLinearEquiv : toLinearEquiv (ofLinearEquiv l map_one map_mul) = l := by\n ext\n rfl\n#align alg_equiv.to_linear_equiv_of_linear_equiv AlgEquiv.toLinearEquiv_ofLinearEquiv\n\nend OfLinearEquiv\n\nsection OfRingEquiv\n\n/-- Promotes a linear ring_equiv to an AlgEquiv. -/\n@[simps apply symm_apply toEquiv] -- Porting note: don't want redundant `toEquiv_symm_apply` simps\ndef ofRingEquiv {f : A₁ ≃+* A₂} (hf : ∀ x, f (algebraMap R A₁ x) = algebraMap R A₂ x) :\n A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := f.symm\n commutes' := hf }\n#align alg_equiv.of_ring_equiv AlgEquiv.ofRingEquiv\n\nend OfRingEquiv\n\n-- Porting note: projections mul & one not found, removed [simps] and added theorems manually\n-- @[simps (config := .lemmasOnly) one]\ninstance aut : Group (A₁ ≃ₐ[R] A₁) where\n mul ϕ ψ := ψ.trans ϕ\n mul_assoc ϕ ψ χ := rfl\n one := refl\n one_mul ϕ := ext fun x => rfl\n mul_one ϕ := ext fun x => rfl\n inv := symm\n mul_left_inv ϕ := ext <| symm_apply_apply ϕ\n#align alg_equiv.aut AlgEquiv.aut\n\ntheorem aut_mul (ϕ ψ : A₁ ≃ₐ[R] A₁) : ϕ * ψ = ψ.trans ϕ :=\n rfl\n\ntheorem aut_one : 1 = AlgEquiv.refl (R := R) (A₁ := A₁) :=\n rfl\n\n@[simp]\ntheorem one_apply (x : A₁) : (1 : A₁ ≃ₐ[R] A₁) x = x :=\n rfl\n#align alg_equiv.one_apply AlgEquiv.one_apply\n\n@[simp]\ntheorem mul_apply (e₁ e₂ : A₁ ≃ₐ[R] A₁) (x : A₁) : (e₁ * e₂) x = e₁ (e₂ x) :=\n rfl\n#align alg_equiv.mul_apply AlgEquiv.mul_apply\n\n/-- An algebra isomorphism induces a group isomorphism between automorphism groups.\n\nThis is a more bundled version of `AlgEquiv.equivCongr`. -/\n@[simps apply]\ndef autCongr (ϕ : A₁ ≃ₐ[R] A₂) : (A₁ ≃ₐ[R] A₁) ≃* A₂ ≃ₐ[R] A₂ where\n __ := equivCongr ϕ ϕ\n toFun ψ := ϕ.symm.trans (ψ.trans ϕ)\n invFun ψ := ϕ.trans (ψ.trans ϕ.symm)\n map_mul' ψ χ := by\n ext\n simp only [mul_apply, trans_apply, symm_apply_apply]\n#align alg_equiv.aut_congr AlgEquiv.autCongr\n\n@[simp]\ntheorem autCongr_refl : autCongr AlgEquiv.refl = MulEquiv.refl (A₁ ≃ₐ[R] A₁) := by\n ext\n rfl\n#align alg_equiv.aut_congr_refl AlgEquiv.autCongr_refl\n\n@[simp]\ntheorem autCongr_symm (ϕ : A₁ ≃ₐ[R] A₂) : (autCongr ϕ).symm = autCongr ϕ.symm :=\n rfl\n#align alg_equiv.aut_congr_symm AlgEquiv.autCongr_symm\n\n@[simp]\ntheorem autCongr_trans (ϕ : A₁ ≃ₐ[R] A₂) (ψ : A₂ ≃ₐ[R] A₃) :\n (autCongr ϕ).trans (autCongr ψ) = autCongr (ϕ.trans ψ) :=\n rfl\n#align alg_equiv.aut_congr_trans AlgEquiv.autCongr_trans\n\n/-- The tautological action by `A₁ ≃ₐ[R] A₁` on `A₁`.\n\nThis generalizes `Function.End.applyMulAction`. -/\ninstance applyMulSemiringAction : MulSemiringAction (A₁ ≃ₐ[R] A₁) A₁ where\n smul := (· <| ·)\n smul_zero := AlgEquiv.map_zero\n smul_add := AlgEquiv.map_add\n smul_one := AlgEquiv.map_one\n smul_mul := AlgEquiv.map_mul\n one_smul _ := rfl\n mul_smul _ _ _ := rfl\n#align alg_equiv.apply_mul_semiring_action AlgEquiv.applyMulSemiringAction\n\ninstance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul := fun f => Units.map f\n one_smul := fun x => by ext; ","nextTactic":"rfl","declUpToTactic":"instance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul := fun f => Units.map f\n one_smul := fun x => by ext; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.761_0.gpEhvIDvcS3ZH5c","decl":"instance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\nx y : A₁ ≃ₐ[R] A₁\nz : A₁ˣ\n⊢ (x * y) • z = x • y • z","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ext\n simp_rw [trans_apply, apply_symm_apply]\n\n@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') := by\n ext\n rfl\n\n@[simp]\ntheorem equivCongr_symm (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') :\n (equivCongr e e').symm = equivCongr e.symm e'.symm :=\n rfl\n\n@[simp]\ntheorem equivCongr_trans (e₁₂ : A₁ ≃ₐ[R] A₂) (e₁₂' : A₁' ≃ₐ[R] A₂')\n (e₂₃ : A₂ ≃ₐ[R] A₃) (e₂₃' : A₂' ≃ₐ[R] A₃') :\n (equivCongr e₁₂ e₁₂').trans (equivCongr e₂₃ e₂₃') =\n equivCongr (e₁₂.trans e₂₃) (e₁₂'.trans e₂₃') :=\n rfl\n\n/-- If an algebra morphism has an inverse, it is an algebra isomorphism. -/\ndef ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ : f.comp g = AlgHom.id R A₂)\n (h₂ : g.comp f = AlgHom.id R A₁) : A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := g\n left_inv := AlgHom.ext_iff.1 h₂\n right_inv := AlgHom.ext_iff.1 h₁ }\n#align alg_equiv.of_alg_hom AlgEquiv.ofAlgHom\n\ntheorem coe_algHom_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ↑(ofAlgHom f g h₁ h₂) = f :=\n AlgHom.ext fun _ => rfl\n#align alg_equiv.coe_alg_hom_of_alg_hom AlgEquiv.coe_algHom_ofAlgHom\n\n@[simp]\ntheorem ofAlgHom_coe_algHom (f : A₁ ≃ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ofAlgHom (↑f) g h₁ h₂ = f :=\n ext fun _ => rfl\n#align alg_equiv.of_alg_hom_coe_alg_hom AlgEquiv.ofAlgHom_coe_algHom\n\ntheorem ofAlgHom_symm (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).symm = ofAlgHom g f h₂ h₁ :=\n rfl\n#align alg_equiv.of_alg_hom_symm AlgEquiv.ofAlgHom_symm\n\n/-- Promotes a bijective algebra homomorphism to an algebra equivalence. -/\nnoncomputable def ofBijective (f : A₁ →ₐ[R] A₂) (hf : Function.Bijective f) : A₁ ≃ₐ[R] A₂ :=\n { RingEquiv.ofBijective (f : A₁ →+* A₂) hf, f with }\n#align alg_equiv.of_bijective AlgEquiv.ofBijective\n\n@[simp]\ntheorem coe_ofBijective {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} :\n (AlgEquiv.ofBijective f hf : A₁ → A₂) = f :=\n rfl\n#align alg_equiv.coe_of_bijective AlgEquiv.coe_ofBijective\n\ntheorem ofBijective_apply {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} (a : A₁) :\n (AlgEquiv.ofBijective f hf) a = f a :=\n rfl\n#align alg_equiv.of_bijective_apply AlgEquiv.ofBijective_apply\n\n/-- Forgetting the multiplicative structures, an equivalence of algebras is a linear equivalence. -/\n@[simps apply]\ndef toLinearEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ₗ[R] A₂ :=\n { e with\n toFun := e\n map_smul' := e.map_smul\n invFun := e.symm }\n#align alg_equiv.to_linear_equiv AlgEquiv.toLinearEquiv\n#align alg_equiv.to_linear_equiv_apply AlgEquiv.toLinearEquiv_apply\n\n@[simp]\ntheorem toLinearEquiv_refl : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).toLinearEquiv = LinearEquiv.refl R A₁ :=\n rfl\n#align alg_equiv.to_linear_equiv_refl AlgEquiv.toLinearEquiv_refl\n\n@[simp]\ntheorem toLinearEquiv_symm (e : A₁ ≃ₐ[R] A₂) : e.toLinearEquiv.symm = e.symm.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_symm AlgEquiv.toLinearEquiv_symm\n\n@[simp]\ntheorem toLinearEquiv_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) :\n (e₁.trans e₂).toLinearEquiv = e₁.toLinearEquiv.trans e₂.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_trans AlgEquiv.toLinearEquiv_trans\n\ntheorem toLinearEquiv_injective : Function.Injective (toLinearEquiv : _ → A₁ ≃ₗ[R] A₂) :=\n fun _ _ h => ext <| LinearEquiv.congr_fun h\n#align alg_equiv.to_linear_equiv_injective AlgEquiv.toLinearEquiv_injective\n\n/-- Interpret an algebra equivalence as a linear map. -/\ndef toLinearMap : A₁ →ₗ[R] A₂ :=\n e.toAlgHom.toLinearMap\n#align alg_equiv.to_linear_map AlgEquiv.toLinearMap\n\n@[simp]\ntheorem toAlgHom_toLinearMap : (e : A₁ →ₐ[R] A₂).toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_alg_hom_to_linear_map AlgEquiv.toAlgHom_toLinearMap\n\ntheorem toLinearMap_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).toLinearMap = f.toLinearMap :=\n LinearMap.ext fun _ => rfl\n\n@[simp]\ntheorem toLinearEquiv_toLinearMap : e.toLinearEquiv.toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_linear_equiv_to_linear_map AlgEquiv.toLinearEquiv_toLinearMap\n\n@[simp]\ntheorem toLinearMap_apply (x : A₁) : e.toLinearMap x = e x :=\n rfl\n#align alg_equiv.to_linear_map_apply AlgEquiv.toLinearMap_apply\n\ntheorem toLinearMap_injective : Function.Injective (toLinearMap : _ → A₁ →ₗ[R] A₂) := fun _ _ h =>\n ext <| LinearMap.congr_fun h\n#align alg_equiv.to_linear_map_injective AlgEquiv.toLinearMap_injective\n\n@[simp]\ntheorem trans_toLinearMap (f : A₁ ≃ₐ[R] A₂) (g : A₂ ≃ₐ[R] A₃) :\n (f.trans g).toLinearMap = g.toLinearMap.comp f.toLinearMap :=\n rfl\n#align alg_equiv.trans_to_linear_map AlgEquiv.trans_toLinearMap\n\nsection OfLinearEquiv\n\nvariable (l : A₁ ≃ₗ[R] A₂) (map_one : l 1 = 1) (map_mul : ∀ x y : A₁, l (x * y) = l x * l y)\n\n/-- Upgrade a linear equivalence to an algebra equivalence,\ngiven that it distributes over multiplication and the identity\n-/\n@[simps apply]\ndef ofLinearEquiv : A₁ ≃ₐ[R] A₂ :=\n { l with\n toFun := l\n invFun := l.symm\n map_mul' := map_mul\n commutes' := (AlgHom.ofLinearMap l map_one map_mul : A₁ →ₐ[R] A₂).commutes }\n#align alg_equiv.of_linear_equiv AlgEquiv.ofLinearEquivₓ\n\n@[simp]\ntheorem ofLinearEquiv_symm :\n (ofLinearEquiv l map_one map_mul).symm =\n ofLinearEquiv l.symm (ofLinearEquiv l map_one map_mul).symm.map_one\n (ofLinearEquiv l map_one map_mul).symm.map_mul :=\n rfl\n#align alg_equiv.of_linear_equiv_symm AlgEquiv.ofLinearEquiv_symm\n\n@[simp]\ntheorem ofLinearEquiv_toLinearEquiv (map_mul) (map_one) :\n ofLinearEquiv e.toLinearEquiv map_mul map_one = e := by\n ext\n rfl\n#align alg_equiv.of_linear_equiv_to_linear_equiv AlgEquiv.ofLinearEquiv_toLinearEquiv\n\n@[simp]\ntheorem toLinearEquiv_ofLinearEquiv : toLinearEquiv (ofLinearEquiv l map_one map_mul) = l := by\n ext\n rfl\n#align alg_equiv.to_linear_equiv_of_linear_equiv AlgEquiv.toLinearEquiv_ofLinearEquiv\n\nend OfLinearEquiv\n\nsection OfRingEquiv\n\n/-- Promotes a linear ring_equiv to an AlgEquiv. -/\n@[simps apply symm_apply toEquiv] -- Porting note: don't want redundant `toEquiv_symm_apply` simps\ndef ofRingEquiv {f : A₁ ≃+* A₂} (hf : ∀ x, f (algebraMap R A₁ x) = algebraMap R A₂ x) :\n A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := f.symm\n commutes' := hf }\n#align alg_equiv.of_ring_equiv AlgEquiv.ofRingEquiv\n\nend OfRingEquiv\n\n-- Porting note: projections mul & one not found, removed [simps] and added theorems manually\n-- @[simps (config := .lemmasOnly) one]\ninstance aut : Group (A₁ ≃ₐ[R] A₁) where\n mul ϕ ψ := ψ.trans ϕ\n mul_assoc ϕ ψ χ := rfl\n one := refl\n one_mul ϕ := ext fun x => rfl\n mul_one ϕ := ext fun x => rfl\n inv := symm\n mul_left_inv ϕ := ext <| symm_apply_apply ϕ\n#align alg_equiv.aut AlgEquiv.aut\n\ntheorem aut_mul (ϕ ψ : A₁ ≃ₐ[R] A₁) : ϕ * ψ = ψ.trans ϕ :=\n rfl\n\ntheorem aut_one : 1 = AlgEquiv.refl (R := R) (A₁ := A₁) :=\n rfl\n\n@[simp]\ntheorem one_apply (x : A₁) : (1 : A₁ ≃ₐ[R] A₁) x = x :=\n rfl\n#align alg_equiv.one_apply AlgEquiv.one_apply\n\n@[simp]\ntheorem mul_apply (e₁ e₂ : A₁ ≃ₐ[R] A₁) (x : A₁) : (e₁ * e₂) x = e₁ (e₂ x) :=\n rfl\n#align alg_equiv.mul_apply AlgEquiv.mul_apply\n\n/-- An algebra isomorphism induces a group isomorphism between automorphism groups.\n\nThis is a more bundled version of `AlgEquiv.equivCongr`. -/\n@[simps apply]\ndef autCongr (ϕ : A₁ ≃ₐ[R] A₂) : (A₁ ≃ₐ[R] A₁) ≃* A₂ ≃ₐ[R] A₂ where\n __ := equivCongr ϕ ϕ\n toFun ψ := ϕ.symm.trans (ψ.trans ϕ)\n invFun ψ := ϕ.trans (ψ.trans ϕ.symm)\n map_mul' ψ χ := by\n ext\n simp only [mul_apply, trans_apply, symm_apply_apply]\n#align alg_equiv.aut_congr AlgEquiv.autCongr\n\n@[simp]\ntheorem autCongr_refl : autCongr AlgEquiv.refl = MulEquiv.refl (A₁ ≃ₐ[R] A₁) := by\n ext\n rfl\n#align alg_equiv.aut_congr_refl AlgEquiv.autCongr_refl\n\n@[simp]\ntheorem autCongr_symm (ϕ : A₁ ≃ₐ[R] A₂) : (autCongr ϕ).symm = autCongr ϕ.symm :=\n rfl\n#align alg_equiv.aut_congr_symm AlgEquiv.autCongr_symm\n\n@[simp]\ntheorem autCongr_trans (ϕ : A₁ ≃ₐ[R] A₂) (ψ : A₂ ≃ₐ[R] A₃) :\n (autCongr ϕ).trans (autCongr ψ) = autCongr (ϕ.trans ψ) :=\n rfl\n#align alg_equiv.aut_congr_trans AlgEquiv.autCongr_trans\n\n/-- The tautological action by `A₁ ≃ₐ[R] A₁` on `A₁`.\n\nThis generalizes `Function.End.applyMulAction`. -/\ninstance applyMulSemiringAction : MulSemiringAction (A₁ ≃ₐ[R] A₁) A₁ where\n smul := (· <| ·)\n smul_zero := AlgEquiv.map_zero\n smul_add := AlgEquiv.map_add\n smul_one := AlgEquiv.map_one\n smul_mul := AlgEquiv.map_mul\n one_smul _ := rfl\n mul_smul _ _ _ := rfl\n#align alg_equiv.apply_mul_semiring_action AlgEquiv.applyMulSemiringAction\n\ninstance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul := fun f => Units.map f\n one_smul := fun x => by ext; rfl\n mul_smul := fun x y z => by ","nextTactic":"ext","declUpToTactic":"instance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul := fun f => Units.map f\n one_smul := fun x => by ext; rfl\n mul_smul := fun x y z => by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.761_0.gpEhvIDvcS3ZH5c","decl":"instance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul "} -{"state":"case a\nR : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\nx y : A₁ ≃ₐ[R] A₁\nz : A₁ˣ\n⊢ ↑((x * y) • z) = ↑(x • y • z)","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ext\n simp_rw [trans_apply, apply_symm_apply]\n\n@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') := by\n ext\n rfl\n\n@[simp]\ntheorem equivCongr_symm (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') :\n (equivCongr e e').symm = equivCongr e.symm e'.symm :=\n rfl\n\n@[simp]\ntheorem equivCongr_trans (e₁₂ : A₁ ≃ₐ[R] A₂) (e₁₂' : A₁' ≃ₐ[R] A₂')\n (e₂₃ : A₂ ≃ₐ[R] A₃) (e₂₃' : A₂' ≃ₐ[R] A₃') :\n (equivCongr e₁₂ e₁₂').trans (equivCongr e₂₃ e₂₃') =\n equivCongr (e₁₂.trans e₂₃) (e₁₂'.trans e₂₃') :=\n rfl\n\n/-- If an algebra morphism has an inverse, it is an algebra isomorphism. -/\ndef ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ : f.comp g = AlgHom.id R A₂)\n (h₂ : g.comp f = AlgHom.id R A₁) : A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := g\n left_inv := AlgHom.ext_iff.1 h₂\n right_inv := AlgHom.ext_iff.1 h₁ }\n#align alg_equiv.of_alg_hom AlgEquiv.ofAlgHom\n\ntheorem coe_algHom_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ↑(ofAlgHom f g h₁ h₂) = f :=\n AlgHom.ext fun _ => rfl\n#align alg_equiv.coe_alg_hom_of_alg_hom AlgEquiv.coe_algHom_ofAlgHom\n\n@[simp]\ntheorem ofAlgHom_coe_algHom (f : A₁ ≃ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ofAlgHom (↑f) g h₁ h₂ = f :=\n ext fun _ => rfl\n#align alg_equiv.of_alg_hom_coe_alg_hom AlgEquiv.ofAlgHom_coe_algHom\n\ntheorem ofAlgHom_symm (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).symm = ofAlgHom g f h₂ h₁ :=\n rfl\n#align alg_equiv.of_alg_hom_symm AlgEquiv.ofAlgHom_symm\n\n/-- Promotes a bijective algebra homomorphism to an algebra equivalence. -/\nnoncomputable def ofBijective (f : A₁ →ₐ[R] A₂) (hf : Function.Bijective f) : A₁ ≃ₐ[R] A₂ :=\n { RingEquiv.ofBijective (f : A₁ →+* A₂) hf, f with }\n#align alg_equiv.of_bijective AlgEquiv.ofBijective\n\n@[simp]\ntheorem coe_ofBijective {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} :\n (AlgEquiv.ofBijective f hf : A₁ → A₂) = f :=\n rfl\n#align alg_equiv.coe_of_bijective AlgEquiv.coe_ofBijective\n\ntheorem ofBijective_apply {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} (a : A₁) :\n (AlgEquiv.ofBijective f hf) a = f a :=\n rfl\n#align alg_equiv.of_bijective_apply AlgEquiv.ofBijective_apply\n\n/-- Forgetting the multiplicative structures, an equivalence of algebras is a linear equivalence. -/\n@[simps apply]\ndef toLinearEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ₗ[R] A₂ :=\n { e with\n toFun := e\n map_smul' := e.map_smul\n invFun := e.symm }\n#align alg_equiv.to_linear_equiv AlgEquiv.toLinearEquiv\n#align alg_equiv.to_linear_equiv_apply AlgEquiv.toLinearEquiv_apply\n\n@[simp]\ntheorem toLinearEquiv_refl : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).toLinearEquiv = LinearEquiv.refl R A₁ :=\n rfl\n#align alg_equiv.to_linear_equiv_refl AlgEquiv.toLinearEquiv_refl\n\n@[simp]\ntheorem toLinearEquiv_symm (e : A₁ ≃ₐ[R] A₂) : e.toLinearEquiv.symm = e.symm.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_symm AlgEquiv.toLinearEquiv_symm\n\n@[simp]\ntheorem toLinearEquiv_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) :\n (e₁.trans e₂).toLinearEquiv = e₁.toLinearEquiv.trans e₂.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_trans AlgEquiv.toLinearEquiv_trans\n\ntheorem toLinearEquiv_injective : Function.Injective (toLinearEquiv : _ → A₁ ≃ₗ[R] A₂) :=\n fun _ _ h => ext <| LinearEquiv.congr_fun h\n#align alg_equiv.to_linear_equiv_injective AlgEquiv.toLinearEquiv_injective\n\n/-- Interpret an algebra equivalence as a linear map. -/\ndef toLinearMap : A₁ →ₗ[R] A₂ :=\n e.toAlgHom.toLinearMap\n#align alg_equiv.to_linear_map AlgEquiv.toLinearMap\n\n@[simp]\ntheorem toAlgHom_toLinearMap : (e : A₁ →ₐ[R] A₂).toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_alg_hom_to_linear_map AlgEquiv.toAlgHom_toLinearMap\n\ntheorem toLinearMap_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).toLinearMap = f.toLinearMap :=\n LinearMap.ext fun _ => rfl\n\n@[simp]\ntheorem toLinearEquiv_toLinearMap : e.toLinearEquiv.toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_linear_equiv_to_linear_map AlgEquiv.toLinearEquiv_toLinearMap\n\n@[simp]\ntheorem toLinearMap_apply (x : A₁) : e.toLinearMap x = e x :=\n rfl\n#align alg_equiv.to_linear_map_apply AlgEquiv.toLinearMap_apply\n\ntheorem toLinearMap_injective : Function.Injective (toLinearMap : _ → A₁ →ₗ[R] A₂) := fun _ _ h =>\n ext <| LinearMap.congr_fun h\n#align alg_equiv.to_linear_map_injective AlgEquiv.toLinearMap_injective\n\n@[simp]\ntheorem trans_toLinearMap (f : A₁ ≃ₐ[R] A₂) (g : A₂ ≃ₐ[R] A₃) :\n (f.trans g).toLinearMap = g.toLinearMap.comp f.toLinearMap :=\n rfl\n#align alg_equiv.trans_to_linear_map AlgEquiv.trans_toLinearMap\n\nsection OfLinearEquiv\n\nvariable (l : A₁ ≃ₗ[R] A₂) (map_one : l 1 = 1) (map_mul : ∀ x y : A₁, l (x * y) = l x * l y)\n\n/-- Upgrade a linear equivalence to an algebra equivalence,\ngiven that it distributes over multiplication and the identity\n-/\n@[simps apply]\ndef ofLinearEquiv : A₁ ≃ₐ[R] A₂ :=\n { l with\n toFun := l\n invFun := l.symm\n map_mul' := map_mul\n commutes' := (AlgHom.ofLinearMap l map_one map_mul : A₁ →ₐ[R] A₂).commutes }\n#align alg_equiv.of_linear_equiv AlgEquiv.ofLinearEquivₓ\n\n@[simp]\ntheorem ofLinearEquiv_symm :\n (ofLinearEquiv l map_one map_mul).symm =\n ofLinearEquiv l.symm (ofLinearEquiv l map_one map_mul).symm.map_one\n (ofLinearEquiv l map_one map_mul).symm.map_mul :=\n rfl\n#align alg_equiv.of_linear_equiv_symm AlgEquiv.ofLinearEquiv_symm\n\n@[simp]\ntheorem ofLinearEquiv_toLinearEquiv (map_mul) (map_one) :\n ofLinearEquiv e.toLinearEquiv map_mul map_one = e := by\n ext\n rfl\n#align alg_equiv.of_linear_equiv_to_linear_equiv AlgEquiv.ofLinearEquiv_toLinearEquiv\n\n@[simp]\ntheorem toLinearEquiv_ofLinearEquiv : toLinearEquiv (ofLinearEquiv l map_one map_mul) = l := by\n ext\n rfl\n#align alg_equiv.to_linear_equiv_of_linear_equiv AlgEquiv.toLinearEquiv_ofLinearEquiv\n\nend OfLinearEquiv\n\nsection OfRingEquiv\n\n/-- Promotes a linear ring_equiv to an AlgEquiv. -/\n@[simps apply symm_apply toEquiv] -- Porting note: don't want redundant `toEquiv_symm_apply` simps\ndef ofRingEquiv {f : A₁ ≃+* A₂} (hf : ∀ x, f (algebraMap R A₁ x) = algebraMap R A₂ x) :\n A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := f.symm\n commutes' := hf }\n#align alg_equiv.of_ring_equiv AlgEquiv.ofRingEquiv\n\nend OfRingEquiv\n\n-- Porting note: projections mul & one not found, removed [simps] and added theorems manually\n-- @[simps (config := .lemmasOnly) one]\ninstance aut : Group (A₁ ≃ₐ[R] A₁) where\n mul ϕ ψ := ψ.trans ϕ\n mul_assoc ϕ ψ χ := rfl\n one := refl\n one_mul ϕ := ext fun x => rfl\n mul_one ϕ := ext fun x => rfl\n inv := symm\n mul_left_inv ϕ := ext <| symm_apply_apply ϕ\n#align alg_equiv.aut AlgEquiv.aut\n\ntheorem aut_mul (ϕ ψ : A₁ ≃ₐ[R] A₁) : ϕ * ψ = ψ.trans ϕ :=\n rfl\n\ntheorem aut_one : 1 = AlgEquiv.refl (R := R) (A₁ := A₁) :=\n rfl\n\n@[simp]\ntheorem one_apply (x : A₁) : (1 : A₁ ≃ₐ[R] A₁) x = x :=\n rfl\n#align alg_equiv.one_apply AlgEquiv.one_apply\n\n@[simp]\ntheorem mul_apply (e₁ e₂ : A₁ ≃ₐ[R] A₁) (x : A₁) : (e₁ * e₂) x = e₁ (e₂ x) :=\n rfl\n#align alg_equiv.mul_apply AlgEquiv.mul_apply\n\n/-- An algebra isomorphism induces a group isomorphism between automorphism groups.\n\nThis is a more bundled version of `AlgEquiv.equivCongr`. -/\n@[simps apply]\ndef autCongr (ϕ : A₁ ≃ₐ[R] A₂) : (A₁ ≃ₐ[R] A₁) ≃* A₂ ≃ₐ[R] A₂ where\n __ := equivCongr ϕ ϕ\n toFun ψ := ϕ.symm.trans (ψ.trans ϕ)\n invFun ψ := ϕ.trans (ψ.trans ϕ.symm)\n map_mul' ψ χ := by\n ext\n simp only [mul_apply, trans_apply, symm_apply_apply]\n#align alg_equiv.aut_congr AlgEquiv.autCongr\n\n@[simp]\ntheorem autCongr_refl : autCongr AlgEquiv.refl = MulEquiv.refl (A₁ ≃ₐ[R] A₁) := by\n ext\n rfl\n#align alg_equiv.aut_congr_refl AlgEquiv.autCongr_refl\n\n@[simp]\ntheorem autCongr_symm (ϕ : A₁ ≃ₐ[R] A₂) : (autCongr ϕ).symm = autCongr ϕ.symm :=\n rfl\n#align alg_equiv.aut_congr_symm AlgEquiv.autCongr_symm\n\n@[simp]\ntheorem autCongr_trans (ϕ : A₁ ≃ₐ[R] A₂) (ψ : A₂ ≃ₐ[R] A₃) :\n (autCongr ϕ).trans (autCongr ψ) = autCongr (ϕ.trans ψ) :=\n rfl\n#align alg_equiv.aut_congr_trans AlgEquiv.autCongr_trans\n\n/-- The tautological action by `A₁ ≃ₐ[R] A₁` on `A₁`.\n\nThis generalizes `Function.End.applyMulAction`. -/\ninstance applyMulSemiringAction : MulSemiringAction (A₁ ≃ₐ[R] A₁) A₁ where\n smul := (· <| ·)\n smul_zero := AlgEquiv.map_zero\n smul_add := AlgEquiv.map_add\n smul_one := AlgEquiv.map_one\n smul_mul := AlgEquiv.map_mul\n one_smul _ := rfl\n mul_smul _ _ _ := rfl\n#align alg_equiv.apply_mul_semiring_action AlgEquiv.applyMulSemiringAction\n\ninstance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul := fun f => Units.map f\n one_smul := fun x => by ext; rfl\n mul_smul := fun x y z => by ext; ","nextTactic":"rfl","declUpToTactic":"instance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul := fun f => Units.map f\n one_smul := fun x => by ext; rfl\n mul_smul := fun x y z => by ext; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.761_0.gpEhvIDvcS3ZH5c","decl":"instance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\nx : A₁ ≃ₐ[R] A₁\ny z : A₁ˣ\n⊢ x • (y * z) = x • y * x • z","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ext\n simp_rw [trans_apply, apply_symm_apply]\n\n@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') := by\n ext\n rfl\n\n@[simp]\ntheorem equivCongr_symm (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') :\n (equivCongr e e').symm = equivCongr e.symm e'.symm :=\n rfl\n\n@[simp]\ntheorem equivCongr_trans (e₁₂ : A₁ ≃ₐ[R] A₂) (e₁₂' : A₁' ≃ₐ[R] A₂')\n (e₂₃ : A₂ ≃ₐ[R] A₃) (e₂₃' : A₂' ≃ₐ[R] A₃') :\n (equivCongr e₁₂ e₁₂').trans (equivCongr e₂₃ e₂₃') =\n equivCongr (e₁₂.trans e₂₃) (e₁₂'.trans e₂₃') :=\n rfl\n\n/-- If an algebra morphism has an inverse, it is an algebra isomorphism. -/\ndef ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ : f.comp g = AlgHom.id R A₂)\n (h₂ : g.comp f = AlgHom.id R A₁) : A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := g\n left_inv := AlgHom.ext_iff.1 h₂\n right_inv := AlgHom.ext_iff.1 h₁ }\n#align alg_equiv.of_alg_hom AlgEquiv.ofAlgHom\n\ntheorem coe_algHom_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ↑(ofAlgHom f g h₁ h₂) = f :=\n AlgHom.ext fun _ => rfl\n#align alg_equiv.coe_alg_hom_of_alg_hom AlgEquiv.coe_algHom_ofAlgHom\n\n@[simp]\ntheorem ofAlgHom_coe_algHom (f : A₁ ≃ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ofAlgHom (↑f) g h₁ h₂ = f :=\n ext fun _ => rfl\n#align alg_equiv.of_alg_hom_coe_alg_hom AlgEquiv.ofAlgHom_coe_algHom\n\ntheorem ofAlgHom_symm (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).symm = ofAlgHom g f h₂ h₁ :=\n rfl\n#align alg_equiv.of_alg_hom_symm AlgEquiv.ofAlgHom_symm\n\n/-- Promotes a bijective algebra homomorphism to an algebra equivalence. -/\nnoncomputable def ofBijective (f : A₁ →ₐ[R] A₂) (hf : Function.Bijective f) : A₁ ≃ₐ[R] A₂ :=\n { RingEquiv.ofBijective (f : A₁ →+* A₂) hf, f with }\n#align alg_equiv.of_bijective AlgEquiv.ofBijective\n\n@[simp]\ntheorem coe_ofBijective {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} :\n (AlgEquiv.ofBijective f hf : A₁ → A₂) = f :=\n rfl\n#align alg_equiv.coe_of_bijective AlgEquiv.coe_ofBijective\n\ntheorem ofBijective_apply {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} (a : A₁) :\n (AlgEquiv.ofBijective f hf) a = f a :=\n rfl\n#align alg_equiv.of_bijective_apply AlgEquiv.ofBijective_apply\n\n/-- Forgetting the multiplicative structures, an equivalence of algebras is a linear equivalence. -/\n@[simps apply]\ndef toLinearEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ₗ[R] A₂ :=\n { e with\n toFun := e\n map_smul' := e.map_smul\n invFun := e.symm }\n#align alg_equiv.to_linear_equiv AlgEquiv.toLinearEquiv\n#align alg_equiv.to_linear_equiv_apply AlgEquiv.toLinearEquiv_apply\n\n@[simp]\ntheorem toLinearEquiv_refl : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).toLinearEquiv = LinearEquiv.refl R A₁ :=\n rfl\n#align alg_equiv.to_linear_equiv_refl AlgEquiv.toLinearEquiv_refl\n\n@[simp]\ntheorem toLinearEquiv_symm (e : A₁ ≃ₐ[R] A₂) : e.toLinearEquiv.symm = e.symm.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_symm AlgEquiv.toLinearEquiv_symm\n\n@[simp]\ntheorem toLinearEquiv_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) :\n (e₁.trans e₂).toLinearEquiv = e₁.toLinearEquiv.trans e₂.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_trans AlgEquiv.toLinearEquiv_trans\n\ntheorem toLinearEquiv_injective : Function.Injective (toLinearEquiv : _ → A₁ ≃ₗ[R] A₂) :=\n fun _ _ h => ext <| LinearEquiv.congr_fun h\n#align alg_equiv.to_linear_equiv_injective AlgEquiv.toLinearEquiv_injective\n\n/-- Interpret an algebra equivalence as a linear map. -/\ndef toLinearMap : A₁ →ₗ[R] A₂ :=\n e.toAlgHom.toLinearMap\n#align alg_equiv.to_linear_map AlgEquiv.toLinearMap\n\n@[simp]\ntheorem toAlgHom_toLinearMap : (e : A₁ →ₐ[R] A₂).toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_alg_hom_to_linear_map AlgEquiv.toAlgHom_toLinearMap\n\ntheorem toLinearMap_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).toLinearMap = f.toLinearMap :=\n LinearMap.ext fun _ => rfl\n\n@[simp]\ntheorem toLinearEquiv_toLinearMap : e.toLinearEquiv.toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_linear_equiv_to_linear_map AlgEquiv.toLinearEquiv_toLinearMap\n\n@[simp]\ntheorem toLinearMap_apply (x : A₁) : e.toLinearMap x = e x :=\n rfl\n#align alg_equiv.to_linear_map_apply AlgEquiv.toLinearMap_apply\n\ntheorem toLinearMap_injective : Function.Injective (toLinearMap : _ → A₁ →ₗ[R] A₂) := fun _ _ h =>\n ext <| LinearMap.congr_fun h\n#align alg_equiv.to_linear_map_injective AlgEquiv.toLinearMap_injective\n\n@[simp]\ntheorem trans_toLinearMap (f : A₁ ≃ₐ[R] A₂) (g : A₂ ≃ₐ[R] A₃) :\n (f.trans g).toLinearMap = g.toLinearMap.comp f.toLinearMap :=\n rfl\n#align alg_equiv.trans_to_linear_map AlgEquiv.trans_toLinearMap\n\nsection OfLinearEquiv\n\nvariable (l : A₁ ≃ₗ[R] A₂) (map_one : l 1 = 1) (map_mul : ∀ x y : A₁, l (x * y) = l x * l y)\n\n/-- Upgrade a linear equivalence to an algebra equivalence,\ngiven that it distributes over multiplication and the identity\n-/\n@[simps apply]\ndef ofLinearEquiv : A₁ ≃ₐ[R] A₂ :=\n { l with\n toFun := l\n invFun := l.symm\n map_mul' := map_mul\n commutes' := (AlgHom.ofLinearMap l map_one map_mul : A₁ →ₐ[R] A₂).commutes }\n#align alg_equiv.of_linear_equiv AlgEquiv.ofLinearEquivₓ\n\n@[simp]\ntheorem ofLinearEquiv_symm :\n (ofLinearEquiv l map_one map_mul).symm =\n ofLinearEquiv l.symm (ofLinearEquiv l map_one map_mul).symm.map_one\n (ofLinearEquiv l map_one map_mul).symm.map_mul :=\n rfl\n#align alg_equiv.of_linear_equiv_symm AlgEquiv.ofLinearEquiv_symm\n\n@[simp]\ntheorem ofLinearEquiv_toLinearEquiv (map_mul) (map_one) :\n ofLinearEquiv e.toLinearEquiv map_mul map_one = e := by\n ext\n rfl\n#align alg_equiv.of_linear_equiv_to_linear_equiv AlgEquiv.ofLinearEquiv_toLinearEquiv\n\n@[simp]\ntheorem toLinearEquiv_ofLinearEquiv : toLinearEquiv (ofLinearEquiv l map_one map_mul) = l := by\n ext\n rfl\n#align alg_equiv.to_linear_equiv_of_linear_equiv AlgEquiv.toLinearEquiv_ofLinearEquiv\n\nend OfLinearEquiv\n\nsection OfRingEquiv\n\n/-- Promotes a linear ring_equiv to an AlgEquiv. -/\n@[simps apply symm_apply toEquiv] -- Porting note: don't want redundant `toEquiv_symm_apply` simps\ndef ofRingEquiv {f : A₁ ≃+* A₂} (hf : ∀ x, f (algebraMap R A₁ x) = algebraMap R A₂ x) :\n A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := f.symm\n commutes' := hf }\n#align alg_equiv.of_ring_equiv AlgEquiv.ofRingEquiv\n\nend OfRingEquiv\n\n-- Porting note: projections mul & one not found, removed [simps] and added theorems manually\n-- @[simps (config := .lemmasOnly) one]\ninstance aut : Group (A₁ ≃ₐ[R] A₁) where\n mul ϕ ψ := ψ.trans ϕ\n mul_assoc ϕ ψ χ := rfl\n one := refl\n one_mul ϕ := ext fun x => rfl\n mul_one ϕ := ext fun x => rfl\n inv := symm\n mul_left_inv ϕ := ext <| symm_apply_apply ϕ\n#align alg_equiv.aut AlgEquiv.aut\n\ntheorem aut_mul (ϕ ψ : A₁ ≃ₐ[R] A₁) : ϕ * ψ = ψ.trans ϕ :=\n rfl\n\ntheorem aut_one : 1 = AlgEquiv.refl (R := R) (A₁ := A₁) :=\n rfl\n\n@[simp]\ntheorem one_apply (x : A₁) : (1 : A₁ ≃ₐ[R] A₁) x = x :=\n rfl\n#align alg_equiv.one_apply AlgEquiv.one_apply\n\n@[simp]\ntheorem mul_apply (e₁ e₂ : A₁ ≃ₐ[R] A₁) (x : A₁) : (e₁ * e₂) x = e₁ (e₂ x) :=\n rfl\n#align alg_equiv.mul_apply AlgEquiv.mul_apply\n\n/-- An algebra isomorphism induces a group isomorphism between automorphism groups.\n\nThis is a more bundled version of `AlgEquiv.equivCongr`. -/\n@[simps apply]\ndef autCongr (ϕ : A₁ ≃ₐ[R] A₂) : (A₁ ≃ₐ[R] A₁) ≃* A₂ ≃ₐ[R] A₂ where\n __ := equivCongr ϕ ϕ\n toFun ψ := ϕ.symm.trans (ψ.trans ϕ)\n invFun ψ := ϕ.trans (ψ.trans ϕ.symm)\n map_mul' ψ χ := by\n ext\n simp only [mul_apply, trans_apply, symm_apply_apply]\n#align alg_equiv.aut_congr AlgEquiv.autCongr\n\n@[simp]\ntheorem autCongr_refl : autCongr AlgEquiv.refl = MulEquiv.refl (A₁ ≃ₐ[R] A₁) := by\n ext\n rfl\n#align alg_equiv.aut_congr_refl AlgEquiv.autCongr_refl\n\n@[simp]\ntheorem autCongr_symm (ϕ : A₁ ≃ₐ[R] A₂) : (autCongr ϕ).symm = autCongr ϕ.symm :=\n rfl\n#align alg_equiv.aut_congr_symm AlgEquiv.autCongr_symm\n\n@[simp]\ntheorem autCongr_trans (ϕ : A₁ ≃ₐ[R] A₂) (ψ : A₂ ≃ₐ[R] A₃) :\n (autCongr ϕ).trans (autCongr ψ) = autCongr (ϕ.trans ψ) :=\n rfl\n#align alg_equiv.aut_congr_trans AlgEquiv.autCongr_trans\n\n/-- The tautological action by `A₁ ≃ₐ[R] A₁` on `A₁`.\n\nThis generalizes `Function.End.applyMulAction`. -/\ninstance applyMulSemiringAction : MulSemiringAction (A₁ ≃ₐ[R] A₁) A₁ where\n smul := (· <| ·)\n smul_zero := AlgEquiv.map_zero\n smul_add := AlgEquiv.map_add\n smul_one := AlgEquiv.map_one\n smul_mul := AlgEquiv.map_mul\n one_smul _ := rfl\n mul_smul _ _ _ := rfl\n#align alg_equiv.apply_mul_semiring_action AlgEquiv.applyMulSemiringAction\n\ninstance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul := fun f => Units.map f\n one_smul := fun x => by ext; rfl\n mul_smul := fun x y z => by ext; rfl\n smul_mul := fun x y z => by ","nextTactic":"ext","declUpToTactic":"instance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul := fun f => Units.map f\n one_smul := fun x => by ext; rfl\n mul_smul := fun x y z => by ext; rfl\n smul_mul := fun x y z => by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.761_0.gpEhvIDvcS3ZH5c","decl":"instance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul "} -{"state":"case a\nR : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\nx : A₁ ≃ₐ[R] A₁\ny z : A₁ˣ\n⊢ ↑(x • (y * z)) = ↑(x • y * x • z)","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ext\n simp_rw [trans_apply, apply_symm_apply]\n\n@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') := by\n ext\n rfl\n\n@[simp]\ntheorem equivCongr_symm (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') :\n (equivCongr e e').symm = equivCongr e.symm e'.symm :=\n rfl\n\n@[simp]\ntheorem equivCongr_trans (e₁₂ : A₁ ≃ₐ[R] A₂) (e₁₂' : A₁' ≃ₐ[R] A₂')\n (e₂₃ : A₂ ≃ₐ[R] A₃) (e₂₃' : A₂' ≃ₐ[R] A₃') :\n (equivCongr e₁₂ e₁₂').trans (equivCongr e₂₃ e₂₃') =\n equivCongr (e₁₂.trans e₂₃) (e₁₂'.trans e₂₃') :=\n rfl\n\n/-- If an algebra morphism has an inverse, it is an algebra isomorphism. -/\ndef ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ : f.comp g = AlgHom.id R A₂)\n (h₂ : g.comp f = AlgHom.id R A₁) : A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := g\n left_inv := AlgHom.ext_iff.1 h₂\n right_inv := AlgHom.ext_iff.1 h₁ }\n#align alg_equiv.of_alg_hom AlgEquiv.ofAlgHom\n\ntheorem coe_algHom_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ↑(ofAlgHom f g h₁ h₂) = f :=\n AlgHom.ext fun _ => rfl\n#align alg_equiv.coe_alg_hom_of_alg_hom AlgEquiv.coe_algHom_ofAlgHom\n\n@[simp]\ntheorem ofAlgHom_coe_algHom (f : A₁ ≃ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ofAlgHom (↑f) g h₁ h₂ = f :=\n ext fun _ => rfl\n#align alg_equiv.of_alg_hom_coe_alg_hom AlgEquiv.ofAlgHom_coe_algHom\n\ntheorem ofAlgHom_symm (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).symm = ofAlgHom g f h₂ h₁ :=\n rfl\n#align alg_equiv.of_alg_hom_symm AlgEquiv.ofAlgHom_symm\n\n/-- Promotes a bijective algebra homomorphism to an algebra equivalence. -/\nnoncomputable def ofBijective (f : A₁ →ₐ[R] A₂) (hf : Function.Bijective f) : A₁ ≃ₐ[R] A₂ :=\n { RingEquiv.ofBijective (f : A₁ →+* A₂) hf, f with }\n#align alg_equiv.of_bijective AlgEquiv.ofBijective\n\n@[simp]\ntheorem coe_ofBijective {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} :\n (AlgEquiv.ofBijective f hf : A₁ → A₂) = f :=\n rfl\n#align alg_equiv.coe_of_bijective AlgEquiv.coe_ofBijective\n\ntheorem ofBijective_apply {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} (a : A₁) :\n (AlgEquiv.ofBijective f hf) a = f a :=\n rfl\n#align alg_equiv.of_bijective_apply AlgEquiv.ofBijective_apply\n\n/-- Forgetting the multiplicative structures, an equivalence of algebras is a linear equivalence. -/\n@[simps apply]\ndef toLinearEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ₗ[R] A₂ :=\n { e with\n toFun := e\n map_smul' := e.map_smul\n invFun := e.symm }\n#align alg_equiv.to_linear_equiv AlgEquiv.toLinearEquiv\n#align alg_equiv.to_linear_equiv_apply AlgEquiv.toLinearEquiv_apply\n\n@[simp]\ntheorem toLinearEquiv_refl : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).toLinearEquiv = LinearEquiv.refl R A₁ :=\n rfl\n#align alg_equiv.to_linear_equiv_refl AlgEquiv.toLinearEquiv_refl\n\n@[simp]\ntheorem toLinearEquiv_symm (e : A₁ ≃ₐ[R] A₂) : e.toLinearEquiv.symm = e.symm.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_symm AlgEquiv.toLinearEquiv_symm\n\n@[simp]\ntheorem toLinearEquiv_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) :\n (e₁.trans e₂).toLinearEquiv = e₁.toLinearEquiv.trans e₂.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_trans AlgEquiv.toLinearEquiv_trans\n\ntheorem toLinearEquiv_injective : Function.Injective (toLinearEquiv : _ → A₁ ≃ₗ[R] A₂) :=\n fun _ _ h => ext <| LinearEquiv.congr_fun h\n#align alg_equiv.to_linear_equiv_injective AlgEquiv.toLinearEquiv_injective\n\n/-- Interpret an algebra equivalence as a linear map. -/\ndef toLinearMap : A₁ →ₗ[R] A₂ :=\n e.toAlgHom.toLinearMap\n#align alg_equiv.to_linear_map AlgEquiv.toLinearMap\n\n@[simp]\ntheorem toAlgHom_toLinearMap : (e : A₁ →ₐ[R] A₂).toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_alg_hom_to_linear_map AlgEquiv.toAlgHom_toLinearMap\n\ntheorem toLinearMap_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).toLinearMap = f.toLinearMap :=\n LinearMap.ext fun _ => rfl\n\n@[simp]\ntheorem toLinearEquiv_toLinearMap : e.toLinearEquiv.toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_linear_equiv_to_linear_map AlgEquiv.toLinearEquiv_toLinearMap\n\n@[simp]\ntheorem toLinearMap_apply (x : A₁) : e.toLinearMap x = e x :=\n rfl\n#align alg_equiv.to_linear_map_apply AlgEquiv.toLinearMap_apply\n\ntheorem toLinearMap_injective : Function.Injective (toLinearMap : _ → A₁ →ₗ[R] A₂) := fun _ _ h =>\n ext <| LinearMap.congr_fun h\n#align alg_equiv.to_linear_map_injective AlgEquiv.toLinearMap_injective\n\n@[simp]\ntheorem trans_toLinearMap (f : A₁ ≃ₐ[R] A₂) (g : A₂ ≃ₐ[R] A₃) :\n (f.trans g).toLinearMap = g.toLinearMap.comp f.toLinearMap :=\n rfl\n#align alg_equiv.trans_to_linear_map AlgEquiv.trans_toLinearMap\n\nsection OfLinearEquiv\n\nvariable (l : A₁ ≃ₗ[R] A₂) (map_one : l 1 = 1) (map_mul : ∀ x y : A₁, l (x * y) = l x * l y)\n\n/-- Upgrade a linear equivalence to an algebra equivalence,\ngiven that it distributes over multiplication and the identity\n-/\n@[simps apply]\ndef ofLinearEquiv : A₁ ≃ₐ[R] A₂ :=\n { l with\n toFun := l\n invFun := l.symm\n map_mul' := map_mul\n commutes' := (AlgHom.ofLinearMap l map_one map_mul : A₁ →ₐ[R] A₂).commutes }\n#align alg_equiv.of_linear_equiv AlgEquiv.ofLinearEquivₓ\n\n@[simp]\ntheorem ofLinearEquiv_symm :\n (ofLinearEquiv l map_one map_mul).symm =\n ofLinearEquiv l.symm (ofLinearEquiv l map_one map_mul).symm.map_one\n (ofLinearEquiv l map_one map_mul).symm.map_mul :=\n rfl\n#align alg_equiv.of_linear_equiv_symm AlgEquiv.ofLinearEquiv_symm\n\n@[simp]\ntheorem ofLinearEquiv_toLinearEquiv (map_mul) (map_one) :\n ofLinearEquiv e.toLinearEquiv map_mul map_one = e := by\n ext\n rfl\n#align alg_equiv.of_linear_equiv_to_linear_equiv AlgEquiv.ofLinearEquiv_toLinearEquiv\n\n@[simp]\ntheorem toLinearEquiv_ofLinearEquiv : toLinearEquiv (ofLinearEquiv l map_one map_mul) = l := by\n ext\n rfl\n#align alg_equiv.to_linear_equiv_of_linear_equiv AlgEquiv.toLinearEquiv_ofLinearEquiv\n\nend OfLinearEquiv\n\nsection OfRingEquiv\n\n/-- Promotes a linear ring_equiv to an AlgEquiv. -/\n@[simps apply symm_apply toEquiv] -- Porting note: don't want redundant `toEquiv_symm_apply` simps\ndef ofRingEquiv {f : A₁ ≃+* A₂} (hf : ∀ x, f (algebraMap R A₁ x) = algebraMap R A₂ x) :\n A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := f.symm\n commutes' := hf }\n#align alg_equiv.of_ring_equiv AlgEquiv.ofRingEquiv\n\nend OfRingEquiv\n\n-- Porting note: projections mul & one not found, removed [simps] and added theorems manually\n-- @[simps (config := .lemmasOnly) one]\ninstance aut : Group (A₁ ≃ₐ[R] A₁) where\n mul ϕ ψ := ψ.trans ϕ\n mul_assoc ϕ ψ χ := rfl\n one := refl\n one_mul ϕ := ext fun x => rfl\n mul_one ϕ := ext fun x => rfl\n inv := symm\n mul_left_inv ϕ := ext <| symm_apply_apply ϕ\n#align alg_equiv.aut AlgEquiv.aut\n\ntheorem aut_mul (ϕ ψ : A₁ ≃ₐ[R] A₁) : ϕ * ψ = ψ.trans ϕ :=\n rfl\n\ntheorem aut_one : 1 = AlgEquiv.refl (R := R) (A₁ := A₁) :=\n rfl\n\n@[simp]\ntheorem one_apply (x : A₁) : (1 : A₁ ≃ₐ[R] A₁) x = x :=\n rfl\n#align alg_equiv.one_apply AlgEquiv.one_apply\n\n@[simp]\ntheorem mul_apply (e₁ e₂ : A₁ ≃ₐ[R] A₁) (x : A₁) : (e₁ * e₂) x = e₁ (e₂ x) :=\n rfl\n#align alg_equiv.mul_apply AlgEquiv.mul_apply\n\n/-- An algebra isomorphism induces a group isomorphism between automorphism groups.\n\nThis is a more bundled version of `AlgEquiv.equivCongr`. -/\n@[simps apply]\ndef autCongr (ϕ : A₁ ≃ₐ[R] A₂) : (A₁ ≃ₐ[R] A₁) ≃* A₂ ≃ₐ[R] A₂ where\n __ := equivCongr ϕ ϕ\n toFun ψ := ϕ.symm.trans (ψ.trans ϕ)\n invFun ψ := ϕ.trans (ψ.trans ϕ.symm)\n map_mul' ψ χ := by\n ext\n simp only [mul_apply, trans_apply, symm_apply_apply]\n#align alg_equiv.aut_congr AlgEquiv.autCongr\n\n@[simp]\ntheorem autCongr_refl : autCongr AlgEquiv.refl = MulEquiv.refl (A₁ ≃ₐ[R] A₁) := by\n ext\n rfl\n#align alg_equiv.aut_congr_refl AlgEquiv.autCongr_refl\n\n@[simp]\ntheorem autCongr_symm (ϕ : A₁ ≃ₐ[R] A₂) : (autCongr ϕ).symm = autCongr ϕ.symm :=\n rfl\n#align alg_equiv.aut_congr_symm AlgEquiv.autCongr_symm\n\n@[simp]\ntheorem autCongr_trans (ϕ : A₁ ≃ₐ[R] A₂) (ψ : A₂ ≃ₐ[R] A₃) :\n (autCongr ϕ).trans (autCongr ψ) = autCongr (ϕ.trans ψ) :=\n rfl\n#align alg_equiv.aut_congr_trans AlgEquiv.autCongr_trans\n\n/-- The tautological action by `A₁ ≃ₐ[R] A₁` on `A₁`.\n\nThis generalizes `Function.End.applyMulAction`. -/\ninstance applyMulSemiringAction : MulSemiringAction (A₁ ≃ₐ[R] A₁) A₁ where\n smul := (· <| ·)\n smul_zero := AlgEquiv.map_zero\n smul_add := AlgEquiv.map_add\n smul_one := AlgEquiv.map_one\n smul_mul := AlgEquiv.map_mul\n one_smul _ := rfl\n mul_smul _ _ _ := rfl\n#align alg_equiv.apply_mul_semiring_action AlgEquiv.applyMulSemiringAction\n\ninstance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul := fun f => Units.map f\n one_smul := fun x => by ext; rfl\n mul_smul := fun x y z => by ext; rfl\n smul_mul := fun x y z => by ext; ","nextTactic":"exact x.map_mul _ _","declUpToTactic":"instance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul := fun f => Units.map f\n one_smul := fun x => by ext; rfl\n mul_smul := fun x y z => by ext; rfl\n smul_mul := fun x y z => by ext; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.761_0.gpEhvIDvcS3ZH5c","decl":"instance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\nx : A₁ ≃ₐ[R] A₁\n⊢ x • 1 = 1","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ext\n simp_rw [trans_apply, apply_symm_apply]\n\n@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') := by\n ext\n rfl\n\n@[simp]\ntheorem equivCongr_symm (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') :\n (equivCongr e e').symm = equivCongr e.symm e'.symm :=\n rfl\n\n@[simp]\ntheorem equivCongr_trans (e₁₂ : A₁ ≃ₐ[R] A₂) (e₁₂' : A₁' ≃ₐ[R] A₂')\n (e₂₃ : A₂ ≃ₐ[R] A₃) (e₂₃' : A₂' ≃ₐ[R] A₃') :\n (equivCongr e₁₂ e₁₂').trans (equivCongr e₂₃ e₂₃') =\n equivCongr (e₁₂.trans e₂₃) (e₁₂'.trans e₂₃') :=\n rfl\n\n/-- If an algebra morphism has an inverse, it is an algebra isomorphism. -/\ndef ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ : f.comp g = AlgHom.id R A₂)\n (h₂ : g.comp f = AlgHom.id R A₁) : A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := g\n left_inv := AlgHom.ext_iff.1 h₂\n right_inv := AlgHom.ext_iff.1 h₁ }\n#align alg_equiv.of_alg_hom AlgEquiv.ofAlgHom\n\ntheorem coe_algHom_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ↑(ofAlgHom f g h₁ h₂) = f :=\n AlgHom.ext fun _ => rfl\n#align alg_equiv.coe_alg_hom_of_alg_hom AlgEquiv.coe_algHom_ofAlgHom\n\n@[simp]\ntheorem ofAlgHom_coe_algHom (f : A₁ ≃ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ofAlgHom (↑f) g h₁ h₂ = f :=\n ext fun _ => rfl\n#align alg_equiv.of_alg_hom_coe_alg_hom AlgEquiv.ofAlgHom_coe_algHom\n\ntheorem ofAlgHom_symm (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).symm = ofAlgHom g f h₂ h₁ :=\n rfl\n#align alg_equiv.of_alg_hom_symm AlgEquiv.ofAlgHom_symm\n\n/-- Promotes a bijective algebra homomorphism to an algebra equivalence. -/\nnoncomputable def ofBijective (f : A₁ →ₐ[R] A₂) (hf : Function.Bijective f) : A₁ ≃ₐ[R] A₂ :=\n { RingEquiv.ofBijective (f : A₁ →+* A₂) hf, f with }\n#align alg_equiv.of_bijective AlgEquiv.ofBijective\n\n@[simp]\ntheorem coe_ofBijective {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} :\n (AlgEquiv.ofBijective f hf : A₁ → A₂) = f :=\n rfl\n#align alg_equiv.coe_of_bijective AlgEquiv.coe_ofBijective\n\ntheorem ofBijective_apply {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} (a : A₁) :\n (AlgEquiv.ofBijective f hf) a = f a :=\n rfl\n#align alg_equiv.of_bijective_apply AlgEquiv.ofBijective_apply\n\n/-- Forgetting the multiplicative structures, an equivalence of algebras is a linear equivalence. -/\n@[simps apply]\ndef toLinearEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ₗ[R] A₂ :=\n { e with\n toFun := e\n map_smul' := e.map_smul\n invFun := e.symm }\n#align alg_equiv.to_linear_equiv AlgEquiv.toLinearEquiv\n#align alg_equiv.to_linear_equiv_apply AlgEquiv.toLinearEquiv_apply\n\n@[simp]\ntheorem toLinearEquiv_refl : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).toLinearEquiv = LinearEquiv.refl R A₁ :=\n rfl\n#align alg_equiv.to_linear_equiv_refl AlgEquiv.toLinearEquiv_refl\n\n@[simp]\ntheorem toLinearEquiv_symm (e : A₁ ≃ₐ[R] A₂) : e.toLinearEquiv.symm = e.symm.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_symm AlgEquiv.toLinearEquiv_symm\n\n@[simp]\ntheorem toLinearEquiv_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) :\n (e₁.trans e₂).toLinearEquiv = e₁.toLinearEquiv.trans e₂.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_trans AlgEquiv.toLinearEquiv_trans\n\ntheorem toLinearEquiv_injective : Function.Injective (toLinearEquiv : _ → A₁ ≃ₗ[R] A₂) :=\n fun _ _ h => ext <| LinearEquiv.congr_fun h\n#align alg_equiv.to_linear_equiv_injective AlgEquiv.toLinearEquiv_injective\n\n/-- Interpret an algebra equivalence as a linear map. -/\ndef toLinearMap : A₁ →ₗ[R] A₂ :=\n e.toAlgHom.toLinearMap\n#align alg_equiv.to_linear_map AlgEquiv.toLinearMap\n\n@[simp]\ntheorem toAlgHom_toLinearMap : (e : A₁ →ₐ[R] A₂).toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_alg_hom_to_linear_map AlgEquiv.toAlgHom_toLinearMap\n\ntheorem toLinearMap_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).toLinearMap = f.toLinearMap :=\n LinearMap.ext fun _ => rfl\n\n@[simp]\ntheorem toLinearEquiv_toLinearMap : e.toLinearEquiv.toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_linear_equiv_to_linear_map AlgEquiv.toLinearEquiv_toLinearMap\n\n@[simp]\ntheorem toLinearMap_apply (x : A₁) : e.toLinearMap x = e x :=\n rfl\n#align alg_equiv.to_linear_map_apply AlgEquiv.toLinearMap_apply\n\ntheorem toLinearMap_injective : Function.Injective (toLinearMap : _ → A₁ →ₗ[R] A₂) := fun _ _ h =>\n ext <| LinearMap.congr_fun h\n#align alg_equiv.to_linear_map_injective AlgEquiv.toLinearMap_injective\n\n@[simp]\ntheorem trans_toLinearMap (f : A₁ ≃ₐ[R] A₂) (g : A₂ ≃ₐ[R] A₃) :\n (f.trans g).toLinearMap = g.toLinearMap.comp f.toLinearMap :=\n rfl\n#align alg_equiv.trans_to_linear_map AlgEquiv.trans_toLinearMap\n\nsection OfLinearEquiv\n\nvariable (l : A₁ ≃ₗ[R] A₂) (map_one : l 1 = 1) (map_mul : ∀ x y : A₁, l (x * y) = l x * l y)\n\n/-- Upgrade a linear equivalence to an algebra equivalence,\ngiven that it distributes over multiplication and the identity\n-/\n@[simps apply]\ndef ofLinearEquiv : A₁ ≃ₐ[R] A₂ :=\n { l with\n toFun := l\n invFun := l.symm\n map_mul' := map_mul\n commutes' := (AlgHom.ofLinearMap l map_one map_mul : A₁ →ₐ[R] A₂).commutes }\n#align alg_equiv.of_linear_equiv AlgEquiv.ofLinearEquivₓ\n\n@[simp]\ntheorem ofLinearEquiv_symm :\n (ofLinearEquiv l map_one map_mul).symm =\n ofLinearEquiv l.symm (ofLinearEquiv l map_one map_mul).symm.map_one\n (ofLinearEquiv l map_one map_mul).symm.map_mul :=\n rfl\n#align alg_equiv.of_linear_equiv_symm AlgEquiv.ofLinearEquiv_symm\n\n@[simp]\ntheorem ofLinearEquiv_toLinearEquiv (map_mul) (map_one) :\n ofLinearEquiv e.toLinearEquiv map_mul map_one = e := by\n ext\n rfl\n#align alg_equiv.of_linear_equiv_to_linear_equiv AlgEquiv.ofLinearEquiv_toLinearEquiv\n\n@[simp]\ntheorem toLinearEquiv_ofLinearEquiv : toLinearEquiv (ofLinearEquiv l map_one map_mul) = l := by\n ext\n rfl\n#align alg_equiv.to_linear_equiv_of_linear_equiv AlgEquiv.toLinearEquiv_ofLinearEquiv\n\nend OfLinearEquiv\n\nsection OfRingEquiv\n\n/-- Promotes a linear ring_equiv to an AlgEquiv. -/\n@[simps apply symm_apply toEquiv] -- Porting note: don't want redundant `toEquiv_symm_apply` simps\ndef ofRingEquiv {f : A₁ ≃+* A₂} (hf : ∀ x, f (algebraMap R A₁ x) = algebraMap R A₂ x) :\n A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := f.symm\n commutes' := hf }\n#align alg_equiv.of_ring_equiv AlgEquiv.ofRingEquiv\n\nend OfRingEquiv\n\n-- Porting note: projections mul & one not found, removed [simps] and added theorems manually\n-- @[simps (config := .lemmasOnly) one]\ninstance aut : Group (A₁ ≃ₐ[R] A₁) where\n mul ϕ ψ := ψ.trans ϕ\n mul_assoc ϕ ψ χ := rfl\n one := refl\n one_mul ϕ := ext fun x => rfl\n mul_one ϕ := ext fun x => rfl\n inv := symm\n mul_left_inv ϕ := ext <| symm_apply_apply ϕ\n#align alg_equiv.aut AlgEquiv.aut\n\ntheorem aut_mul (ϕ ψ : A₁ ≃ₐ[R] A₁) : ϕ * ψ = ψ.trans ϕ :=\n rfl\n\ntheorem aut_one : 1 = AlgEquiv.refl (R := R) (A₁ := A₁) :=\n rfl\n\n@[simp]\ntheorem one_apply (x : A₁) : (1 : A₁ ≃ₐ[R] A₁) x = x :=\n rfl\n#align alg_equiv.one_apply AlgEquiv.one_apply\n\n@[simp]\ntheorem mul_apply (e₁ e₂ : A₁ ≃ₐ[R] A₁) (x : A₁) : (e₁ * e₂) x = e₁ (e₂ x) :=\n rfl\n#align alg_equiv.mul_apply AlgEquiv.mul_apply\n\n/-- An algebra isomorphism induces a group isomorphism between automorphism groups.\n\nThis is a more bundled version of `AlgEquiv.equivCongr`. -/\n@[simps apply]\ndef autCongr (ϕ : A₁ ≃ₐ[R] A₂) : (A₁ ≃ₐ[R] A₁) ≃* A₂ ≃ₐ[R] A₂ where\n __ := equivCongr ϕ ϕ\n toFun ψ := ϕ.symm.trans (ψ.trans ϕ)\n invFun ψ := ϕ.trans (ψ.trans ϕ.symm)\n map_mul' ψ χ := by\n ext\n simp only [mul_apply, trans_apply, symm_apply_apply]\n#align alg_equiv.aut_congr AlgEquiv.autCongr\n\n@[simp]\ntheorem autCongr_refl : autCongr AlgEquiv.refl = MulEquiv.refl (A₁ ≃ₐ[R] A₁) := by\n ext\n rfl\n#align alg_equiv.aut_congr_refl AlgEquiv.autCongr_refl\n\n@[simp]\ntheorem autCongr_symm (ϕ : A₁ ≃ₐ[R] A₂) : (autCongr ϕ).symm = autCongr ϕ.symm :=\n rfl\n#align alg_equiv.aut_congr_symm AlgEquiv.autCongr_symm\n\n@[simp]\ntheorem autCongr_trans (ϕ : A₁ ≃ₐ[R] A₂) (ψ : A₂ ≃ₐ[R] A₃) :\n (autCongr ϕ).trans (autCongr ψ) = autCongr (ϕ.trans ψ) :=\n rfl\n#align alg_equiv.aut_congr_trans AlgEquiv.autCongr_trans\n\n/-- The tautological action by `A₁ ≃ₐ[R] A₁` on `A₁`.\n\nThis generalizes `Function.End.applyMulAction`. -/\ninstance applyMulSemiringAction : MulSemiringAction (A₁ ≃ₐ[R] A₁) A₁ where\n smul := (· <| ·)\n smul_zero := AlgEquiv.map_zero\n smul_add := AlgEquiv.map_add\n smul_one := AlgEquiv.map_one\n smul_mul := AlgEquiv.map_mul\n one_smul _ := rfl\n mul_smul _ _ _ := rfl\n#align alg_equiv.apply_mul_semiring_action AlgEquiv.applyMulSemiringAction\n\ninstance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul := fun f => Units.map f\n one_smul := fun x => by ext; rfl\n mul_smul := fun x y z => by ext; rfl\n smul_mul := fun x y z => by ext; exact x.map_mul _ _\n smul_one := fun x => by ","nextTactic":"ext","declUpToTactic":"instance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul := fun f => Units.map f\n one_smul := fun x => by ext; rfl\n mul_smul := fun x y z => by ext; rfl\n smul_mul := fun x y z => by ext; exact x.map_mul _ _\n smul_one := fun x => by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.761_0.gpEhvIDvcS3ZH5c","decl":"instance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul "} -{"state":"case a\nR : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne : A₁ ≃ₐ[R] A₂\nx : A₁ ≃ₐ[R] A₁\n⊢ ↑(x • 1) = ↑1","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ext\n simp_rw [trans_apply, apply_symm_apply]\n\n@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') := by\n ext\n rfl\n\n@[simp]\ntheorem equivCongr_symm (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') :\n (equivCongr e e').symm = equivCongr e.symm e'.symm :=\n rfl\n\n@[simp]\ntheorem equivCongr_trans (e₁₂ : A₁ ≃ₐ[R] A₂) (e₁₂' : A₁' ≃ₐ[R] A₂')\n (e₂₃ : A₂ ≃ₐ[R] A₃) (e₂₃' : A₂' ≃ₐ[R] A₃') :\n (equivCongr e₁₂ e₁₂').trans (equivCongr e₂₃ e₂₃') =\n equivCongr (e₁₂.trans e₂₃) (e₁₂'.trans e₂₃') :=\n rfl\n\n/-- If an algebra morphism has an inverse, it is an algebra isomorphism. -/\ndef ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ : f.comp g = AlgHom.id R A₂)\n (h₂ : g.comp f = AlgHom.id R A₁) : A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := g\n left_inv := AlgHom.ext_iff.1 h₂\n right_inv := AlgHom.ext_iff.1 h₁ }\n#align alg_equiv.of_alg_hom AlgEquiv.ofAlgHom\n\ntheorem coe_algHom_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ↑(ofAlgHom f g h₁ h₂) = f :=\n AlgHom.ext fun _ => rfl\n#align alg_equiv.coe_alg_hom_of_alg_hom AlgEquiv.coe_algHom_ofAlgHom\n\n@[simp]\ntheorem ofAlgHom_coe_algHom (f : A₁ ≃ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ofAlgHom (↑f) g h₁ h₂ = f :=\n ext fun _ => rfl\n#align alg_equiv.of_alg_hom_coe_alg_hom AlgEquiv.ofAlgHom_coe_algHom\n\ntheorem ofAlgHom_symm (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).symm = ofAlgHom g f h₂ h₁ :=\n rfl\n#align alg_equiv.of_alg_hom_symm AlgEquiv.ofAlgHom_symm\n\n/-- Promotes a bijective algebra homomorphism to an algebra equivalence. -/\nnoncomputable def ofBijective (f : A₁ →ₐ[R] A₂) (hf : Function.Bijective f) : A₁ ≃ₐ[R] A₂ :=\n { RingEquiv.ofBijective (f : A₁ →+* A₂) hf, f with }\n#align alg_equiv.of_bijective AlgEquiv.ofBijective\n\n@[simp]\ntheorem coe_ofBijective {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} :\n (AlgEquiv.ofBijective f hf : A₁ → A₂) = f :=\n rfl\n#align alg_equiv.coe_of_bijective AlgEquiv.coe_ofBijective\n\ntheorem ofBijective_apply {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} (a : A₁) :\n (AlgEquiv.ofBijective f hf) a = f a :=\n rfl\n#align alg_equiv.of_bijective_apply AlgEquiv.ofBijective_apply\n\n/-- Forgetting the multiplicative structures, an equivalence of algebras is a linear equivalence. -/\n@[simps apply]\ndef toLinearEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ₗ[R] A₂ :=\n { e with\n toFun := e\n map_smul' := e.map_smul\n invFun := e.symm }\n#align alg_equiv.to_linear_equiv AlgEquiv.toLinearEquiv\n#align alg_equiv.to_linear_equiv_apply AlgEquiv.toLinearEquiv_apply\n\n@[simp]\ntheorem toLinearEquiv_refl : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).toLinearEquiv = LinearEquiv.refl R A₁ :=\n rfl\n#align alg_equiv.to_linear_equiv_refl AlgEquiv.toLinearEquiv_refl\n\n@[simp]\ntheorem toLinearEquiv_symm (e : A₁ ≃ₐ[R] A₂) : e.toLinearEquiv.symm = e.symm.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_symm AlgEquiv.toLinearEquiv_symm\n\n@[simp]\ntheorem toLinearEquiv_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) :\n (e₁.trans e₂).toLinearEquiv = e₁.toLinearEquiv.trans e₂.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_trans AlgEquiv.toLinearEquiv_trans\n\ntheorem toLinearEquiv_injective : Function.Injective (toLinearEquiv : _ → A₁ ≃ₗ[R] A₂) :=\n fun _ _ h => ext <| LinearEquiv.congr_fun h\n#align alg_equiv.to_linear_equiv_injective AlgEquiv.toLinearEquiv_injective\n\n/-- Interpret an algebra equivalence as a linear map. -/\ndef toLinearMap : A₁ →ₗ[R] A₂ :=\n e.toAlgHom.toLinearMap\n#align alg_equiv.to_linear_map AlgEquiv.toLinearMap\n\n@[simp]\ntheorem toAlgHom_toLinearMap : (e : A₁ →ₐ[R] A₂).toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_alg_hom_to_linear_map AlgEquiv.toAlgHom_toLinearMap\n\ntheorem toLinearMap_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).toLinearMap = f.toLinearMap :=\n LinearMap.ext fun _ => rfl\n\n@[simp]\ntheorem toLinearEquiv_toLinearMap : e.toLinearEquiv.toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_linear_equiv_to_linear_map AlgEquiv.toLinearEquiv_toLinearMap\n\n@[simp]\ntheorem toLinearMap_apply (x : A₁) : e.toLinearMap x = e x :=\n rfl\n#align alg_equiv.to_linear_map_apply AlgEquiv.toLinearMap_apply\n\ntheorem toLinearMap_injective : Function.Injective (toLinearMap : _ → A₁ →ₗ[R] A₂) := fun _ _ h =>\n ext <| LinearMap.congr_fun h\n#align alg_equiv.to_linear_map_injective AlgEquiv.toLinearMap_injective\n\n@[simp]\ntheorem trans_toLinearMap (f : A₁ ≃ₐ[R] A₂) (g : A₂ ≃ₐ[R] A₃) :\n (f.trans g).toLinearMap = g.toLinearMap.comp f.toLinearMap :=\n rfl\n#align alg_equiv.trans_to_linear_map AlgEquiv.trans_toLinearMap\n\nsection OfLinearEquiv\n\nvariable (l : A₁ ≃ₗ[R] A₂) (map_one : l 1 = 1) (map_mul : ∀ x y : A₁, l (x * y) = l x * l y)\n\n/-- Upgrade a linear equivalence to an algebra equivalence,\ngiven that it distributes over multiplication and the identity\n-/\n@[simps apply]\ndef ofLinearEquiv : A₁ ≃ₐ[R] A₂ :=\n { l with\n toFun := l\n invFun := l.symm\n map_mul' := map_mul\n commutes' := (AlgHom.ofLinearMap l map_one map_mul : A₁ →ₐ[R] A₂).commutes }\n#align alg_equiv.of_linear_equiv AlgEquiv.ofLinearEquivₓ\n\n@[simp]\ntheorem ofLinearEquiv_symm :\n (ofLinearEquiv l map_one map_mul).symm =\n ofLinearEquiv l.symm (ofLinearEquiv l map_one map_mul).symm.map_one\n (ofLinearEquiv l map_one map_mul).symm.map_mul :=\n rfl\n#align alg_equiv.of_linear_equiv_symm AlgEquiv.ofLinearEquiv_symm\n\n@[simp]\ntheorem ofLinearEquiv_toLinearEquiv (map_mul) (map_one) :\n ofLinearEquiv e.toLinearEquiv map_mul map_one = e := by\n ext\n rfl\n#align alg_equiv.of_linear_equiv_to_linear_equiv AlgEquiv.ofLinearEquiv_toLinearEquiv\n\n@[simp]\ntheorem toLinearEquiv_ofLinearEquiv : toLinearEquiv (ofLinearEquiv l map_one map_mul) = l := by\n ext\n rfl\n#align alg_equiv.to_linear_equiv_of_linear_equiv AlgEquiv.toLinearEquiv_ofLinearEquiv\n\nend OfLinearEquiv\n\nsection OfRingEquiv\n\n/-- Promotes a linear ring_equiv to an AlgEquiv. -/\n@[simps apply symm_apply toEquiv] -- Porting note: don't want redundant `toEquiv_symm_apply` simps\ndef ofRingEquiv {f : A₁ ≃+* A₂} (hf : ∀ x, f (algebraMap R A₁ x) = algebraMap R A₂ x) :\n A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := f.symm\n commutes' := hf }\n#align alg_equiv.of_ring_equiv AlgEquiv.ofRingEquiv\n\nend OfRingEquiv\n\n-- Porting note: projections mul & one not found, removed [simps] and added theorems manually\n-- @[simps (config := .lemmasOnly) one]\ninstance aut : Group (A₁ ≃ₐ[R] A₁) where\n mul ϕ ψ := ψ.trans ϕ\n mul_assoc ϕ ψ χ := rfl\n one := refl\n one_mul ϕ := ext fun x => rfl\n mul_one ϕ := ext fun x => rfl\n inv := symm\n mul_left_inv ϕ := ext <| symm_apply_apply ϕ\n#align alg_equiv.aut AlgEquiv.aut\n\ntheorem aut_mul (ϕ ψ : A₁ ≃ₐ[R] A₁) : ϕ * ψ = ψ.trans ϕ :=\n rfl\n\ntheorem aut_one : 1 = AlgEquiv.refl (R := R) (A₁ := A₁) :=\n rfl\n\n@[simp]\ntheorem one_apply (x : A₁) : (1 : A₁ ≃ₐ[R] A₁) x = x :=\n rfl\n#align alg_equiv.one_apply AlgEquiv.one_apply\n\n@[simp]\ntheorem mul_apply (e₁ e₂ : A₁ ≃ₐ[R] A₁) (x : A₁) : (e₁ * e₂) x = e₁ (e₂ x) :=\n rfl\n#align alg_equiv.mul_apply AlgEquiv.mul_apply\n\n/-- An algebra isomorphism induces a group isomorphism between automorphism groups.\n\nThis is a more bundled version of `AlgEquiv.equivCongr`. -/\n@[simps apply]\ndef autCongr (ϕ : A₁ ≃ₐ[R] A₂) : (A₁ ≃ₐ[R] A₁) ≃* A₂ ≃ₐ[R] A₂ where\n __ := equivCongr ϕ ϕ\n toFun ψ := ϕ.symm.trans (ψ.trans ϕ)\n invFun ψ := ϕ.trans (ψ.trans ϕ.symm)\n map_mul' ψ χ := by\n ext\n simp only [mul_apply, trans_apply, symm_apply_apply]\n#align alg_equiv.aut_congr AlgEquiv.autCongr\n\n@[simp]\ntheorem autCongr_refl : autCongr AlgEquiv.refl = MulEquiv.refl (A₁ ≃ₐ[R] A₁) := by\n ext\n rfl\n#align alg_equiv.aut_congr_refl AlgEquiv.autCongr_refl\n\n@[simp]\ntheorem autCongr_symm (ϕ : A₁ ≃ₐ[R] A₂) : (autCongr ϕ).symm = autCongr ϕ.symm :=\n rfl\n#align alg_equiv.aut_congr_symm AlgEquiv.autCongr_symm\n\n@[simp]\ntheorem autCongr_trans (ϕ : A₁ ≃ₐ[R] A₂) (ψ : A₂ ≃ₐ[R] A₃) :\n (autCongr ϕ).trans (autCongr ψ) = autCongr (ϕ.trans ψ) :=\n rfl\n#align alg_equiv.aut_congr_trans AlgEquiv.autCongr_trans\n\n/-- The tautological action by `A₁ ≃ₐ[R] A₁` on `A₁`.\n\nThis generalizes `Function.End.applyMulAction`. -/\ninstance applyMulSemiringAction : MulSemiringAction (A₁ ≃ₐ[R] A₁) A₁ where\n smul := (· <| ·)\n smul_zero := AlgEquiv.map_zero\n smul_add := AlgEquiv.map_add\n smul_one := AlgEquiv.map_one\n smul_mul := AlgEquiv.map_mul\n one_smul _ := rfl\n mul_smul _ _ _ := rfl\n#align alg_equiv.apply_mul_semiring_action AlgEquiv.applyMulSemiringAction\n\ninstance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul := fun f => Units.map f\n one_smul := fun x => by ext; rfl\n mul_smul := fun x y z => by ext; rfl\n smul_mul := fun x y z => by ext; exact x.map_mul _ _\n smul_one := fun x => by ext; ","nextTactic":"exact x.map_one","declUpToTactic":"instance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul := fun f => Units.map f\n one_smul := fun x => by ext; rfl\n mul_smul := fun x y z => by ext; rfl\n smul_mul := fun x y z => by ext; exact x.map_mul _ _\n smul_one := fun x => by ext; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.761_0.gpEhvIDvcS3ZH5c","decl":"instance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul "} -{"state":"R : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹² : CommSemiring R\ninst✝¹¹ : Semiring A₁\ninst✝¹⁰ : Semiring A₂\ninst✝⁹ : Semiring A₃\ninst✝⁸ : Semiring A₁'\ninst✝⁷ : Semiring A₂'\ninst✝⁶ : Semiring A₃'\ninst✝⁵ : Algebra R A₁\ninst✝⁴ : Algebra R A₂\ninst✝³ : Algebra R A₃\ninst✝² : Algebra R A₁'\ninst✝¹ : Algebra R A₂'\ninst✝ : Algebra R A₃'\ne✝ e : A₁ ≃ₐ[R] A₂\ny : R\nx : A₁\nh : (algebraMap R A₂) y = e x\n⊢ (algebraMap R A₁) y = x","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e��).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ext\n simp_rw [trans_apply, apply_symm_apply]\n\n@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') := by\n ext\n rfl\n\n@[simp]\ntheorem equivCongr_symm (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') :\n (equivCongr e e').symm = equivCongr e.symm e'.symm :=\n rfl\n\n@[simp]\ntheorem equivCongr_trans (e₁₂ : A₁ ≃ₐ[R] A₂) (e₁₂' : A₁' ≃ₐ[R] A₂')\n (e₂₃ : A₂ ≃ₐ[R] A₃) (e₂₃' : A₂' ≃ₐ[R] A₃') :\n (equivCongr e₁₂ e₁₂').trans (equivCongr e₂₃ e₂₃') =\n equivCongr (e₁₂.trans e₂₃) (e₁₂'.trans e₂₃') :=\n rfl\n\n/-- If an algebra morphism has an inverse, it is an algebra isomorphism. -/\ndef ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ : f.comp g = AlgHom.id R A₂)\n (h₂ : g.comp f = AlgHom.id R A₁) : A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := g\n left_inv := AlgHom.ext_iff.1 h₂\n right_inv := AlgHom.ext_iff.1 h₁ }\n#align alg_equiv.of_alg_hom AlgEquiv.ofAlgHom\n\ntheorem coe_algHom_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ↑(ofAlgHom f g h₁ h₂) = f :=\n AlgHom.ext fun _ => rfl\n#align alg_equiv.coe_alg_hom_of_alg_hom AlgEquiv.coe_algHom_ofAlgHom\n\n@[simp]\ntheorem ofAlgHom_coe_algHom (f : A₁ ≃ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ofAlgHom (↑f) g h₁ h₂ = f :=\n ext fun _ => rfl\n#align alg_equiv.of_alg_hom_coe_alg_hom AlgEquiv.ofAlgHom_coe_algHom\n\ntheorem ofAlgHom_symm (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).symm = ofAlgHom g f h₂ h₁ :=\n rfl\n#align alg_equiv.of_alg_hom_symm AlgEquiv.ofAlgHom_symm\n\n/-- Promotes a bijective algebra homomorphism to an algebra equivalence. -/\nnoncomputable def ofBijective (f : A₁ →ₐ[R] A₂) (hf : Function.Bijective f) : A₁ ≃ₐ[R] A₂ :=\n { RingEquiv.ofBijective (f : A₁ →+* A₂) hf, f with }\n#align alg_equiv.of_bijective AlgEquiv.ofBijective\n\n@[simp]\ntheorem coe_ofBijective {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} :\n (AlgEquiv.ofBijective f hf : A₁ → A₂) = f :=\n rfl\n#align alg_equiv.coe_of_bijective AlgEquiv.coe_ofBijective\n\ntheorem ofBijective_apply {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} (a : A₁) :\n (AlgEquiv.ofBijective f hf) a = f a :=\n rfl\n#align alg_equiv.of_bijective_apply AlgEquiv.ofBijective_apply\n\n/-- Forgetting the multiplicative structures, an equivalence of algebras is a linear equivalence. -/\n@[simps apply]\ndef toLinearEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ₗ[R] A₂ :=\n { e with\n toFun := e\n map_smul' := e.map_smul\n invFun := e.symm }\n#align alg_equiv.to_linear_equiv AlgEquiv.toLinearEquiv\n#align alg_equiv.to_linear_equiv_apply AlgEquiv.toLinearEquiv_apply\n\n@[simp]\ntheorem toLinearEquiv_refl : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).toLinearEquiv = LinearEquiv.refl R A₁ :=\n rfl\n#align alg_equiv.to_linear_equiv_refl AlgEquiv.toLinearEquiv_refl\n\n@[simp]\ntheorem toLinearEquiv_symm (e : A₁ ≃ₐ[R] A₂) : e.toLinearEquiv.symm = e.symm.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_symm AlgEquiv.toLinearEquiv_symm\n\n@[simp]\ntheorem toLinearEquiv_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) :\n (e₁.trans e₂).toLinearEquiv = e₁.toLinearEquiv.trans e₂.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_trans AlgEquiv.toLinearEquiv_trans\n\ntheorem toLinearEquiv_injective : Function.Injective (toLinearEquiv : _ → A₁ ≃ₗ[R] A₂) :=\n fun _ _ h => ext <| LinearEquiv.congr_fun h\n#align alg_equiv.to_linear_equiv_injective AlgEquiv.toLinearEquiv_injective\n\n/-- Interpret an algebra equivalence as a linear map. -/\ndef toLinearMap : A₁ →ₗ[R] A₂ :=\n e.toAlgHom.toLinearMap\n#align alg_equiv.to_linear_map AlgEquiv.toLinearMap\n\n@[simp]\ntheorem toAlgHom_toLinearMap : (e : A₁ →ₐ[R] A₂).toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_alg_hom_to_linear_map AlgEquiv.toAlgHom_toLinearMap\n\ntheorem toLinearMap_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).toLinearMap = f.toLinearMap :=\n LinearMap.ext fun _ => rfl\n\n@[simp]\ntheorem toLinearEquiv_toLinearMap : e.toLinearEquiv.toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_linear_equiv_to_linear_map AlgEquiv.toLinearEquiv_toLinearMap\n\n@[simp]\ntheorem toLinearMap_apply (x : A₁) : e.toLinearMap x = e x :=\n rfl\n#align alg_equiv.to_linear_map_apply AlgEquiv.toLinearMap_apply\n\ntheorem toLinearMap_injective : Function.Injective (toLinearMap : _ → A₁ →ₗ[R] A₂) := fun _ _ h =>\n ext <| LinearMap.congr_fun h\n#align alg_equiv.to_linear_map_injective AlgEquiv.toLinearMap_injective\n\n@[simp]\ntheorem trans_toLinearMap (f : A₁ ≃ₐ[R] A₂) (g : A₂ ≃ₐ[R] A₃) :\n (f.trans g).toLinearMap = g.toLinearMap.comp f.toLinearMap :=\n rfl\n#align alg_equiv.trans_to_linear_map AlgEquiv.trans_toLinearMap\n\nsection OfLinearEquiv\n\nvariable (l : A₁ ≃ₗ[R] A₂) (map_one : l 1 = 1) (map_mul : ∀ x y : A₁, l (x * y) = l x * l y)\n\n/-- Upgrade a linear equivalence to an algebra equivalence,\ngiven that it distributes over multiplication and the identity\n-/\n@[simps apply]\ndef ofLinearEquiv : A₁ ≃ₐ[R] A₂ :=\n { l with\n toFun := l\n invFun := l.symm\n map_mul' := map_mul\n commutes' := (AlgHom.ofLinearMap l map_one map_mul : A₁ →ₐ[R] A₂).commutes }\n#align alg_equiv.of_linear_equiv AlgEquiv.ofLinearEquivₓ\n\n@[simp]\ntheorem ofLinearEquiv_symm :\n (ofLinearEquiv l map_one map_mul).symm =\n ofLinearEquiv l.symm (ofLinearEquiv l map_one map_mul).symm.map_one\n (ofLinearEquiv l map_one map_mul).symm.map_mul :=\n rfl\n#align alg_equiv.of_linear_equiv_symm AlgEquiv.ofLinearEquiv_symm\n\n@[simp]\ntheorem ofLinearEquiv_toLinearEquiv (map_mul) (map_one) :\n ofLinearEquiv e.toLinearEquiv map_mul map_one = e := by\n ext\n rfl\n#align alg_equiv.of_linear_equiv_to_linear_equiv AlgEquiv.ofLinearEquiv_toLinearEquiv\n\n@[simp]\ntheorem toLinearEquiv_ofLinearEquiv : toLinearEquiv (ofLinearEquiv l map_one map_mul) = l := by\n ext\n rfl\n#align alg_equiv.to_linear_equiv_of_linear_equiv AlgEquiv.toLinearEquiv_ofLinearEquiv\n\nend OfLinearEquiv\n\nsection OfRingEquiv\n\n/-- Promotes a linear ring_equiv to an AlgEquiv. -/\n@[simps apply symm_apply toEquiv] -- Porting note: don't want redundant `toEquiv_symm_apply` simps\ndef ofRingEquiv {f : A₁ ≃+* A₂} (hf : ∀ x, f (algebraMap R A₁ x) = algebraMap R A₂ x) :\n A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := f.symm\n commutes' := hf }\n#align alg_equiv.of_ring_equiv AlgEquiv.ofRingEquiv\n\nend OfRingEquiv\n\n-- Porting note: projections mul & one not found, removed [simps] and added theorems manually\n-- @[simps (config := .lemmasOnly) one]\ninstance aut : Group (A₁ ≃ₐ[R] A₁) where\n mul ϕ ψ := ψ.trans ϕ\n mul_assoc ϕ ψ χ := rfl\n one := refl\n one_mul ϕ := ext fun x => rfl\n mul_one ϕ := ext fun x => rfl\n inv := symm\n mul_left_inv ϕ := ext <| symm_apply_apply ϕ\n#align alg_equiv.aut AlgEquiv.aut\n\ntheorem aut_mul (ϕ ψ : A₁ ≃ₐ[R] A₁) : ϕ * ψ = ψ.trans ϕ :=\n rfl\n\ntheorem aut_one : 1 = AlgEquiv.refl (R := R) (A₁ := A₁) :=\n rfl\n\n@[simp]\ntheorem one_apply (x : A₁) : (1 : A₁ ≃ₐ[R] A₁) x = x :=\n rfl\n#align alg_equiv.one_apply AlgEquiv.one_apply\n\n@[simp]\ntheorem mul_apply (e₁ e₂ : A₁ ≃ₐ[R] A₁) (x : A₁) : (e₁ * e₂) x = e₁ (e₂ x) :=\n rfl\n#align alg_equiv.mul_apply AlgEquiv.mul_apply\n\n/-- An algebra isomorphism induces a group isomorphism between automorphism groups.\n\nThis is a more bundled version of `AlgEquiv.equivCongr`. -/\n@[simps apply]\ndef autCongr (ϕ : A₁ ≃ₐ[R] A₂) : (A₁ ≃ₐ[R] A₁) ≃* A₂ ≃ₐ[R] A₂ where\n __ := equivCongr ϕ ϕ\n toFun ψ := ϕ.symm.trans (ψ.trans ϕ)\n invFun ψ := ϕ.trans (ψ.trans ϕ.symm)\n map_mul' ψ χ := by\n ext\n simp only [mul_apply, trans_apply, symm_apply_apply]\n#align alg_equiv.aut_congr AlgEquiv.autCongr\n\n@[simp]\ntheorem autCongr_refl : autCongr AlgEquiv.refl = MulEquiv.refl (A₁ ≃ₐ[R] A₁) := by\n ext\n rfl\n#align alg_equiv.aut_congr_refl AlgEquiv.autCongr_refl\n\n@[simp]\ntheorem autCongr_symm (ϕ : A₁ ≃ₐ[R] A₂) : (autCongr ϕ).symm = autCongr ϕ.symm :=\n rfl\n#align alg_equiv.aut_congr_symm AlgEquiv.autCongr_symm\n\n@[simp]\ntheorem autCongr_trans (ϕ : A₁ ≃ₐ[R] A₂) (ψ : A₂ ≃ₐ[R] A₃) :\n (autCongr ϕ).trans (autCongr ψ) = autCongr (ϕ.trans ψ) :=\n rfl\n#align alg_equiv.aut_congr_trans AlgEquiv.autCongr_trans\n\n/-- The tautological action by `A₁ ≃ₐ[R] A₁` on `A₁`.\n\nThis generalizes `Function.End.applyMulAction`. -/\ninstance applyMulSemiringAction : MulSemiringAction (A₁ ≃ₐ[R] A₁) A₁ where\n smul := (· <| ·)\n smul_zero := AlgEquiv.map_zero\n smul_add := AlgEquiv.map_add\n smul_one := AlgEquiv.map_one\n smul_mul := AlgEquiv.map_mul\n one_smul _ := rfl\n mul_smul _ _ _ := rfl\n#align alg_equiv.apply_mul_semiring_action AlgEquiv.applyMulSemiringAction\n\ninstance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul := fun f => Units.map f\n one_smul := fun x => by ext; rfl\n mul_smul := fun x y z => by ext; rfl\n smul_mul := fun x y z => by ext; exact x.map_mul _ _\n smul_one := fun x => by ext; exact x.map_one\n\n@[simp]\nprotected theorem smul_def (f : A₁ ≃ₐ[R] A₁) (a : A₁) : f • a = f a :=\n rfl\n#align alg_equiv.smul_def AlgEquiv.smul_def\n\ninstance apply_faithfulSMul : FaithfulSMul (A₁ ≃ₐ[R] A₁) A₁ :=\n ⟨AlgEquiv.ext⟩\n#align alg_equiv.apply_has_faithful_smul AlgEquiv.apply_faithfulSMul\n\ninstance apply_smulCommClass : SMulCommClass R (A₁ ≃ₐ[R] A₁) A₁ where\n smul_comm r e a := (e.map_smul r a).symm\n#align alg_equiv.apply_smul_comm_class AlgEquiv.apply_smulCommClass\n\ninstance apply_smulCommClass' : SMulCommClass (A₁ ≃ₐ[R] A₁) R A₁ where\n smul_comm e r a := e.map_smul r a\n#align alg_equiv.apply_smul_comm_class' AlgEquiv.apply_smulCommClass'\n\n@[simp]\ntheorem algebraMap_eq_apply (e : A₁ ≃ₐ[R] A₂) {y : R} {x : A₁} :\n algebraMap R A₂ y = e x ↔ algebraMap R A₁ y = x :=\n ⟨fun h => by ","nextTactic":"simpa using e.symm.toAlgHom.algebraMap_eq_apply h","declUpToTactic":"@[simp]\ntheorem algebraMap_eq_apply (e : A₁ ≃ₐ[R] A₂) {y : R} {x : A₁} :\n algebraMap R A₂ y = e x ↔ algebraMap R A₁ y = x :=\n ⟨fun h => by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.785_0.gpEhvIDvcS3ZH5c","decl":"@[simp]\ntheorem algebraMap_eq_apply (e : A₁ ≃ₐ[R] A₂) {y : R} {x : A₁} :\n algebraMap R A₂ y = e x ↔ algebraMap R A₁ y = x "} -{"state":"R✝ : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹⁵ : CommSemiring R✝\ninst✝¹⁴ : Semiring A₁\ninst✝¹³ : Semiring A₂\ninst✝¹² : Semiring A₃\ninst✝¹¹ : Semiring A₁'\ninst✝¹⁰ : Semiring A₂'\ninst✝⁹ : Semiring A₃'\ninst✝⁸ : Algebra R✝ A₁\ninst✝⁷ : Algebra R✝ A₂\ninst✝⁶ : Algebra R✝ A₃\ninst✝⁵ : Algebra R✝ A₁'\ninst✝⁴ : Algebra R✝ A₂'\ninst✝³ : Algebra R✝ A₃'\ne : A₁ ≃ₐ[R✝] A₂\nR : Type u_1\nS : Type u_2\ninst✝² : CommSemiring R\ninst✝¹ : Semiring S\ninst✝ : Algebra R S\nf : (S →ₐ[R] S)ˣ\nsrc✝ : S →ₐ[R] S := ↑f\nx : S\n⊢ ↑(f⁻¹ * f) x = x","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ext\n simp_rw [trans_apply, apply_symm_apply]\n\n@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') := by\n ext\n rfl\n\n@[simp]\ntheorem equivCongr_symm (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') :\n (equivCongr e e').symm = equivCongr e.symm e'.symm :=\n rfl\n\n@[simp]\ntheorem equivCongr_trans (e₁₂ : A₁ ≃ₐ[R] A₂) (e₁₂' : A₁' ≃ₐ[R] A₂')\n (e₂₃ : A₂ ≃ₐ[R] A₃) (e₂₃' : A₂' ≃ₐ[R] A₃') :\n (equivCongr e₁₂ e₁₂').trans (equivCongr e₂₃ e₂₃') =\n equivCongr (e₁₂.trans e₂₃) (e₁₂'.trans e₂₃') :=\n rfl\n\n/-- If an algebra morphism has an inverse, it is an algebra isomorphism. -/\ndef ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ : f.comp g = AlgHom.id R A₂)\n (h₂ : g.comp f = AlgHom.id R A₁) : A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := g\n left_inv := AlgHom.ext_iff.1 h₂\n right_inv := AlgHom.ext_iff.1 h₁ }\n#align alg_equiv.of_alg_hom AlgEquiv.ofAlgHom\n\ntheorem coe_algHom_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ↑(ofAlgHom f g h₁ h₂) = f :=\n AlgHom.ext fun _ => rfl\n#align alg_equiv.coe_alg_hom_of_alg_hom AlgEquiv.coe_algHom_ofAlgHom\n\n@[simp]\ntheorem ofAlgHom_coe_algHom (f : A₁ ≃ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ofAlgHom (↑f) g h₁ h₂ = f :=\n ext fun _ => rfl\n#align alg_equiv.of_alg_hom_coe_alg_hom AlgEquiv.ofAlgHom_coe_algHom\n\ntheorem ofAlgHom_symm (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).symm = ofAlgHom g f h₂ h₁ :=\n rfl\n#align alg_equiv.of_alg_hom_symm AlgEquiv.ofAlgHom_symm\n\n/-- Promotes a bijective algebra homomorphism to an algebra equivalence. -/\nnoncomputable def ofBijective (f : A₁ →ₐ[R] A₂) (hf : Function.Bijective f) : A₁ ≃ₐ[R] A₂ :=\n { RingEquiv.ofBijective (f : A₁ →+* A₂) hf, f with }\n#align alg_equiv.of_bijective AlgEquiv.ofBijective\n\n@[simp]\ntheorem coe_ofBijective {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} :\n (AlgEquiv.ofBijective f hf : A₁ → A₂) = f :=\n rfl\n#align alg_equiv.coe_of_bijective AlgEquiv.coe_ofBijective\n\ntheorem ofBijective_apply {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} (a : A₁) :\n (AlgEquiv.ofBijective f hf) a = f a :=\n rfl\n#align alg_equiv.of_bijective_apply AlgEquiv.ofBijective_apply\n\n/-- Forgetting the multiplicative structures, an equivalence of algebras is a linear equivalence. -/\n@[simps apply]\ndef toLinearEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ₗ[R] A₂ :=\n { e with\n toFun := e\n map_smul' := e.map_smul\n invFun := e.symm }\n#align alg_equiv.to_linear_equiv AlgEquiv.toLinearEquiv\n#align alg_equiv.to_linear_equiv_apply AlgEquiv.toLinearEquiv_apply\n\n@[simp]\ntheorem toLinearEquiv_refl : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).toLinearEquiv = LinearEquiv.refl R A₁ :=\n rfl\n#align alg_equiv.to_linear_equiv_refl AlgEquiv.toLinearEquiv_refl\n\n@[simp]\ntheorem toLinearEquiv_symm (e : A₁ ≃ₐ[R] A₂) : e.toLinearEquiv.symm = e.symm.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_symm AlgEquiv.toLinearEquiv_symm\n\n@[simp]\ntheorem toLinearEquiv_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) :\n (e₁.trans e₂).toLinearEquiv = e₁.toLinearEquiv.trans e₂.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_trans AlgEquiv.toLinearEquiv_trans\n\ntheorem toLinearEquiv_injective : Function.Injective (toLinearEquiv : _ → A₁ ≃ₗ[R] A₂) :=\n fun _ _ h => ext <| LinearEquiv.congr_fun h\n#align alg_equiv.to_linear_equiv_injective AlgEquiv.toLinearEquiv_injective\n\n/-- Interpret an algebra equivalence as a linear map. -/\ndef toLinearMap : A₁ →ₗ[R] A₂ :=\n e.toAlgHom.toLinearMap\n#align alg_equiv.to_linear_map AlgEquiv.toLinearMap\n\n@[simp]\ntheorem toAlgHom_toLinearMap : (e : A₁ →ₐ[R] A₂).toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_alg_hom_to_linear_map AlgEquiv.toAlgHom_toLinearMap\n\ntheorem toLinearMap_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).toLinearMap = f.toLinearMap :=\n LinearMap.ext fun _ => rfl\n\n@[simp]\ntheorem toLinearEquiv_toLinearMap : e.toLinearEquiv.toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_linear_equiv_to_linear_map AlgEquiv.toLinearEquiv_toLinearMap\n\n@[simp]\ntheorem toLinearMap_apply (x : A₁) : e.toLinearMap x = e x :=\n rfl\n#align alg_equiv.to_linear_map_apply AlgEquiv.toLinearMap_apply\n\ntheorem toLinearMap_injective : Function.Injective (toLinearMap : _ → A₁ →ₗ[R] A₂) := fun _ _ h =>\n ext <| LinearMap.congr_fun h\n#align alg_equiv.to_linear_map_injective AlgEquiv.toLinearMap_injective\n\n@[simp]\ntheorem trans_toLinearMap (f : A₁ ≃ₐ[R] A₂) (g : A₂ ≃ₐ[R] A₃) :\n (f.trans g).toLinearMap = g.toLinearMap.comp f.toLinearMap :=\n rfl\n#align alg_equiv.trans_to_linear_map AlgEquiv.trans_toLinearMap\n\nsection OfLinearEquiv\n\nvariable (l : A₁ ≃ₗ[R] A₂) (map_one : l 1 = 1) (map_mul : ∀ x y : A₁, l (x * y) = l x * l y)\n\n/-- Upgrade a linear equivalence to an algebra equivalence,\ngiven that it distributes over multiplication and the identity\n-/\n@[simps apply]\ndef ofLinearEquiv : A₁ ≃ₐ[R] A₂ :=\n { l with\n toFun := l\n invFun := l.symm\n map_mul' := map_mul\n commutes' := (AlgHom.ofLinearMap l map_one map_mul : A₁ →ₐ[R] A₂).commutes }\n#align alg_equiv.of_linear_equiv AlgEquiv.ofLinearEquivₓ\n\n@[simp]\ntheorem ofLinearEquiv_symm :\n (ofLinearEquiv l map_one map_mul).symm =\n ofLinearEquiv l.symm (ofLinearEquiv l map_one map_mul).symm.map_one\n (ofLinearEquiv l map_one map_mul).symm.map_mul :=\n rfl\n#align alg_equiv.of_linear_equiv_symm AlgEquiv.ofLinearEquiv_symm\n\n@[simp]\ntheorem ofLinearEquiv_toLinearEquiv (map_mul) (map_one) :\n ofLinearEquiv e.toLinearEquiv map_mul map_one = e := by\n ext\n rfl\n#align alg_equiv.of_linear_equiv_to_linear_equiv AlgEquiv.ofLinearEquiv_toLinearEquiv\n\n@[simp]\ntheorem toLinearEquiv_ofLinearEquiv : toLinearEquiv (ofLinearEquiv l map_one map_mul) = l := by\n ext\n rfl\n#align alg_equiv.to_linear_equiv_of_linear_equiv AlgEquiv.toLinearEquiv_ofLinearEquiv\n\nend OfLinearEquiv\n\nsection OfRingEquiv\n\n/-- Promotes a linear ring_equiv to an AlgEquiv. -/\n@[simps apply symm_apply toEquiv] -- Porting note: don't want redundant `toEquiv_symm_apply` simps\ndef ofRingEquiv {f : A₁ ≃+* A₂} (hf : ∀ x, f (algebraMap R A₁ x) = algebraMap R A₂ x) :\n A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := f.symm\n commutes' := hf }\n#align alg_equiv.of_ring_equiv AlgEquiv.ofRingEquiv\n\nend OfRingEquiv\n\n-- Porting note: projections mul & one not found, removed [simps] and added theorems manually\n-- @[simps (config := .lemmasOnly) one]\ninstance aut : Group (A₁ ≃ₐ[R] A₁) where\n mul ϕ ψ := ψ.trans ϕ\n mul_assoc ϕ ψ χ := rfl\n one := refl\n one_mul ϕ := ext fun x => rfl\n mul_one ϕ := ext fun x => rfl\n inv := symm\n mul_left_inv ϕ := ext <| symm_apply_apply ϕ\n#align alg_equiv.aut AlgEquiv.aut\n\ntheorem aut_mul (ϕ ψ : A₁ ≃ₐ[R] A₁) : ϕ * ψ = ψ.trans ϕ :=\n rfl\n\ntheorem aut_one : 1 = AlgEquiv.refl (R := R) (A₁ := A₁) :=\n rfl\n\n@[simp]\ntheorem one_apply (x : A₁) : (1 : A₁ ≃ₐ[R] A₁) x = x :=\n rfl\n#align alg_equiv.one_apply AlgEquiv.one_apply\n\n@[simp]\ntheorem mul_apply (e₁ e₂ : A₁ ≃ₐ[R] A₁) (x : A₁) : (e₁ * e₂) x = e₁ (e₂ x) :=\n rfl\n#align alg_equiv.mul_apply AlgEquiv.mul_apply\n\n/-- An algebra isomorphism induces a group isomorphism between automorphism groups.\n\nThis is a more bundled version of `AlgEquiv.equivCongr`. -/\n@[simps apply]\ndef autCongr (ϕ : A₁ ≃ₐ[R] A₂) : (A₁ ≃ₐ[R] A₁) ≃* A₂ ≃ₐ[R] A₂ where\n __ := equivCongr ϕ ϕ\n toFun ψ := ϕ.symm.trans (ψ.trans ϕ)\n invFun ψ := ϕ.trans (ψ.trans ϕ.symm)\n map_mul' ψ χ := by\n ext\n simp only [mul_apply, trans_apply, symm_apply_apply]\n#align alg_equiv.aut_congr AlgEquiv.autCongr\n\n@[simp]\ntheorem autCongr_refl : autCongr AlgEquiv.refl = MulEquiv.refl (A₁ ≃ₐ[R] A₁) := by\n ext\n rfl\n#align alg_equiv.aut_congr_refl AlgEquiv.autCongr_refl\n\n@[simp]\ntheorem autCongr_symm (ϕ : A₁ ≃ₐ[R] A₂) : (autCongr ϕ).symm = autCongr ϕ.symm :=\n rfl\n#align alg_equiv.aut_congr_symm AlgEquiv.autCongr_symm\n\n@[simp]\ntheorem autCongr_trans (ϕ : A₁ ≃ₐ[R] A₂) (ψ : A₂ ≃ₐ[R] A₃) :\n (autCongr ϕ).trans (autCongr ψ) = autCongr (ϕ.trans ψ) :=\n rfl\n#align alg_equiv.aut_congr_trans AlgEquiv.autCongr_trans\n\n/-- The tautological action by `A₁ ≃ₐ[R] A₁` on `A₁`.\n\nThis generalizes `Function.End.applyMulAction`. -/\ninstance applyMulSemiringAction : MulSemiringAction (A₁ ≃ₐ[R] A₁) A₁ where\n smul := (· <| ·)\n smul_zero := AlgEquiv.map_zero\n smul_add := AlgEquiv.map_add\n smul_one := AlgEquiv.map_one\n smul_mul := AlgEquiv.map_mul\n one_smul _ := rfl\n mul_smul _ _ _ := rfl\n#align alg_equiv.apply_mul_semiring_action AlgEquiv.applyMulSemiringAction\n\ninstance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul := fun f => Units.map f\n one_smul := fun x => by ext; rfl\n mul_smul := fun x y z => by ext; rfl\n smul_mul := fun x y z => by ext; exact x.map_mul _ _\n smul_one := fun x => by ext; exact x.map_one\n\n@[simp]\nprotected theorem smul_def (f : A₁ ≃ₐ[R] A₁) (a : A₁) : f • a = f a :=\n rfl\n#align alg_equiv.smul_def AlgEquiv.smul_def\n\ninstance apply_faithfulSMul : FaithfulSMul (A₁ ≃ₐ[R] A₁) A₁ :=\n ⟨AlgEquiv.ext⟩\n#align alg_equiv.apply_has_faithful_smul AlgEquiv.apply_faithfulSMul\n\ninstance apply_smulCommClass : SMulCommClass R (A₁ ≃ₐ[R] A₁) A₁ where\n smul_comm r e a := (e.map_smul r a).symm\n#align alg_equiv.apply_smul_comm_class AlgEquiv.apply_smulCommClass\n\ninstance apply_smulCommClass' : SMulCommClass (A₁ ≃ₐ[R] A₁) R A₁ where\n smul_comm e r a := e.map_smul r a\n#align alg_equiv.apply_smul_comm_class' AlgEquiv.apply_smulCommClass'\n\n@[simp]\ntheorem algebraMap_eq_apply (e : A₁ ≃ₐ[R] A₂) {y : R} {x : A₁} :\n algebraMap R A₂ y = e x ↔ algebraMap R A₁ y = x :=\n ⟨fun h => by simpa using e.symm.toAlgHom.algebraMap_eq_apply h, fun h =>\n e.toAlgHom.algebraMap_eq_apply h⟩\n#align alg_equiv.algebra_map_eq_apply AlgEquiv.algebraMap_eq_apply\n\n/-- `AlgEquiv.toLinearMap` as a `MonoidHom`. -/\n@[simps]\ndef toLinearMapHom (R A) [CommSemiring R] [Semiring A] [Algebra R A] :\n (A ≃ₐ[R] A) →* A →ₗ[R] A where\n toFun := AlgEquiv.toLinearMap\n map_one' := rfl\n map_mul' := fun _ _ ↦ rfl\n\nlemma pow_toLinearMap (σ : A₁ ≃ₐ[R] A₁) (n : ℕ) :\n (σ ^ n).toLinearMap = σ.toLinearMap ^ n :=\n (AlgEquiv.toLinearMapHom R A₁).map_pow σ n\n\n@[simp]\nlemma one_toLinearMap :\n (1 : A₁ ≃ₐ[R] A₁).toLinearMap = 1 := rfl\n\n/-- The units group of `S →ₐ[R] S` is `S ≃ₐ[R] S`.\nSee `LinearMap.GeneralLinearGroup.generalLinearEquiv` for the linear map version. -/\n@[simps]\ndef algHomUnitsEquiv (R S : Type*) [CommSemiring R] [Semiring S] [Algebra R S] :\n (S →ₐ[R] S)ˣ ≃* (S ≃ₐ[R] S) where\n toFun := fun f ↦\n { (f : S →ₐ[R] S) with\n invFun := ↑(f⁻¹)\n left_inv := (fun x ↦ show (↑(f⁻¹ * f) : S →ₐ[R] S) x = x by ","nextTactic":"rw [inv_mul_self]","declUpToTactic":"/-- The units group of `S →ₐ[R] S` is `S ≃ₐ[R] S`.\nSee `LinearMap.GeneralLinearGroup.generalLinearEquiv` for the linear map version. -/\n@[simps]\ndef algHomUnitsEquiv (R S : Type*) [CommSemiring R] [Semiring S] [Algebra R S] :\n (S →ₐ[R] S)ˣ ≃* (S ≃ₐ[R] S) where\n toFun := fun f ↦\n { (f : S →ₐ[R] S) with\n invFun := ↑(f⁻¹)\n left_inv := (fun x ↦ show (↑(f⁻¹ * f) : S →ₐ[R] S) x = x by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.808_0.gpEhvIDvcS3ZH5c","decl":"/-- The units group of `S →ₐ[R] S` is `S ≃ₐ[R] S`.\nSee `LinearMap.GeneralLinearGroup.generalLinearEquiv` for the linear map version. -/\n@[simps]\ndef algHomUnitsEquiv (R S : Type*) [CommSemiring R] [Semiring S] [Algebra R S] :\n (S →ₐ[R] S)ˣ ≃* (S ≃ₐ[R] S) where\n toFun "} -{"state":"R✝ : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹⁵ : CommSemiring R✝\ninst✝¹⁴ : Semiring A₁\ninst✝¹³ : Semiring A₂\ninst✝¹² : Semiring A₃\ninst✝¹¹ : Semiring A₁'\ninst✝¹⁰ : Semiring A₂'\ninst✝⁹ : Semiring A₃'\ninst✝⁸ : Algebra R✝ A₁\ninst✝⁷ : Algebra R✝ A₂\ninst✝⁶ : Algebra R✝ A₃\ninst✝⁵ : Algebra R✝ A₁'\ninst✝⁴ : Algebra R✝ A₂'\ninst✝³ : Algebra R✝ A₃'\ne : A₁ ≃ₐ[R✝] A₂\nR : Type u_1\nS : Type u_2\ninst✝² : CommSemiring R\ninst✝¹ : Semiring S\ninst✝ : Algebra R S\nf : (S →ₐ[R] S)ˣ\nsrc✝ : S →ₐ[R] S := ↑f\nx : S\n⊢ ↑1 x = x","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ext\n simp_rw [trans_apply, apply_symm_apply]\n\n@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') := by\n ext\n rfl\n\n@[simp]\ntheorem equivCongr_symm (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') :\n (equivCongr e e').symm = equivCongr e.symm e'.symm :=\n rfl\n\n@[simp]\ntheorem equivCongr_trans (e₁₂ : A₁ ≃ₐ[R] A₂) (e₁₂' : A₁' ≃ₐ[R] A₂')\n (e₂₃ : A₂ ≃ₐ[R] A₃) (e₂₃' : A₂' ≃ₐ[R] A₃') :\n (equivCongr e₁₂ e₁₂').trans (equivCongr e₂₃ e₂₃') =\n equivCongr (e₁₂.trans e₂₃) (e₁₂'.trans e₂₃') :=\n rfl\n\n/-- If an algebra morphism has an inverse, it is an algebra isomorphism. -/\ndef ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ : f.comp g = AlgHom.id R A₂)\n (h₂ : g.comp f = AlgHom.id R A₁) : A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := g\n left_inv := AlgHom.ext_iff.1 h₂\n right_inv := AlgHom.ext_iff.1 h₁ }\n#align alg_equiv.of_alg_hom AlgEquiv.ofAlgHom\n\ntheorem coe_algHom_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ↑(ofAlgHom f g h₁ h₂) = f :=\n AlgHom.ext fun _ => rfl\n#align alg_equiv.coe_alg_hom_of_alg_hom AlgEquiv.coe_algHom_ofAlgHom\n\n@[simp]\ntheorem ofAlgHom_coe_algHom (f : A₁ ≃ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ofAlgHom (↑f) g h₁ h₂ = f :=\n ext fun _ => rfl\n#align alg_equiv.of_alg_hom_coe_alg_hom AlgEquiv.ofAlgHom_coe_algHom\n\ntheorem ofAlgHom_symm (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).symm = ofAlgHom g f h₂ h�� :=\n rfl\n#align alg_equiv.of_alg_hom_symm AlgEquiv.ofAlgHom_symm\n\n/-- Promotes a bijective algebra homomorphism to an algebra equivalence. -/\nnoncomputable def ofBijective (f : A₁ →ₐ[R] A₂) (hf : Function.Bijective f) : A₁ ≃ₐ[R] A₂ :=\n { RingEquiv.ofBijective (f : A₁ →+* A₂) hf, f with }\n#align alg_equiv.of_bijective AlgEquiv.ofBijective\n\n@[simp]\ntheorem coe_ofBijective {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} :\n (AlgEquiv.ofBijective f hf : A₁ → A₂) = f :=\n rfl\n#align alg_equiv.coe_of_bijective AlgEquiv.coe_ofBijective\n\ntheorem ofBijective_apply {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} (a : A₁) :\n (AlgEquiv.ofBijective f hf) a = f a :=\n rfl\n#align alg_equiv.of_bijective_apply AlgEquiv.ofBijective_apply\n\n/-- Forgetting the multiplicative structures, an equivalence of algebras is a linear equivalence. -/\n@[simps apply]\ndef toLinearEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ₗ[R] A₂ :=\n { e with\n toFun := e\n map_smul' := e.map_smul\n invFun := e.symm }\n#align alg_equiv.to_linear_equiv AlgEquiv.toLinearEquiv\n#align alg_equiv.to_linear_equiv_apply AlgEquiv.toLinearEquiv_apply\n\n@[simp]\ntheorem toLinearEquiv_refl : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).toLinearEquiv = LinearEquiv.refl R A₁ :=\n rfl\n#align alg_equiv.to_linear_equiv_refl AlgEquiv.toLinearEquiv_refl\n\n@[simp]\ntheorem toLinearEquiv_symm (e : A₁ ≃ₐ[R] A₂) : e.toLinearEquiv.symm = e.symm.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_symm AlgEquiv.toLinearEquiv_symm\n\n@[simp]\ntheorem toLinearEquiv_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) :\n (e₁.trans e₂).toLinearEquiv = e₁.toLinearEquiv.trans e₂.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_trans AlgEquiv.toLinearEquiv_trans\n\ntheorem toLinearEquiv_injective : Function.Injective (toLinearEquiv : _ → A₁ ≃ₗ[R] A₂) :=\n fun _ _ h => ext <| LinearEquiv.congr_fun h\n#align alg_equiv.to_linear_equiv_injective AlgEquiv.toLinearEquiv_injective\n\n/-- Interpret an algebra equivalence as a linear map. -/\ndef toLinearMap : A₁ →ₗ[R] A₂ :=\n e.toAlgHom.toLinearMap\n#align alg_equiv.to_linear_map AlgEquiv.toLinearMap\n\n@[simp]\ntheorem toAlgHom_toLinearMap : (e : A₁ →ₐ[R] A₂).toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_alg_hom_to_linear_map AlgEquiv.toAlgHom_toLinearMap\n\ntheorem toLinearMap_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).toLinearMap = f.toLinearMap :=\n LinearMap.ext fun _ => rfl\n\n@[simp]\ntheorem toLinearEquiv_toLinearMap : e.toLinearEquiv.toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_linear_equiv_to_linear_map AlgEquiv.toLinearEquiv_toLinearMap\n\n@[simp]\ntheorem toLinearMap_apply (x : A₁) : e.toLinearMap x = e x :=\n rfl\n#align alg_equiv.to_linear_map_apply AlgEquiv.toLinearMap_apply\n\ntheorem toLinearMap_injective : Function.Injective (toLinearMap : _ → A₁ →ₗ[R] A₂) := fun _ _ h =>\n ext <| LinearMap.congr_fun h\n#align alg_equiv.to_linear_map_injective AlgEquiv.toLinearMap_injective\n\n@[simp]\ntheorem trans_toLinearMap (f : A₁ ≃ₐ[R] A₂) (g : A₂ ≃ₐ[R] A₃) :\n (f.trans g).toLinearMap = g.toLinearMap.comp f.toLinearMap :=\n rfl\n#align alg_equiv.trans_to_linear_map AlgEquiv.trans_toLinearMap\n\nsection OfLinearEquiv\n\nvariable (l : A₁ ≃ₗ[R] A₂) (map_one : l 1 = 1) (map_mul : ∀ x y : A₁, l (x * y) = l x * l y)\n\n/-- Upgrade a linear equivalence to an algebra equivalence,\ngiven that it distributes over multiplication and the identity\n-/\n@[simps apply]\ndef ofLinearEquiv : A₁ ≃ₐ[R] A₂ :=\n { l with\n toFun := l\n invFun := l.symm\n map_mul' := map_mul\n commutes' := (AlgHom.ofLinearMap l map_one map_mul : A₁ →ₐ[R] A₂).commutes }\n#align alg_equiv.of_linear_equiv AlgEquiv.ofLinearEquivₓ\n\n@[simp]\ntheorem ofLinearEquiv_symm :\n (ofLinearEquiv l map_one map_mul).symm =\n ofLinearEquiv l.symm (ofLinearEquiv l map_one map_mul).symm.map_one\n (ofLinearEquiv l map_one map_mul).symm.map_mul :=\n rfl\n#align alg_equiv.of_linear_equiv_symm AlgEquiv.ofLinearEquiv_symm\n\n@[simp]\ntheorem ofLinearEquiv_toLinearEquiv (map_mul) (map_one) :\n ofLinearEquiv e.toLinearEquiv map_mul map_one = e := by\n ext\n rfl\n#align alg_equiv.of_linear_equiv_to_linear_equiv AlgEquiv.ofLinearEquiv_toLinearEquiv\n\n@[simp]\ntheorem toLinearEquiv_ofLinearEquiv : toLinearEquiv (ofLinearEquiv l map_one map_mul) = l := by\n ext\n rfl\n#align alg_equiv.to_linear_equiv_of_linear_equiv AlgEquiv.toLinearEquiv_ofLinearEquiv\n\nend OfLinearEquiv\n\nsection OfRingEquiv\n\n/-- Promotes a linear ring_equiv to an AlgEquiv. -/\n@[simps apply symm_apply toEquiv] -- Porting note: don't want redundant `toEquiv_symm_apply` simps\ndef ofRingEquiv {f : A₁ ≃+* A₂} (hf : ∀ x, f (algebraMap R A₁ x) = algebraMap R A₂ x) :\n A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := f.symm\n commutes' := hf }\n#align alg_equiv.of_ring_equiv AlgEquiv.ofRingEquiv\n\nend OfRingEquiv\n\n-- Porting note: projections mul & one not found, removed [simps] and added theorems manually\n-- @[simps (config := .lemmasOnly) one]\ninstance aut : Group (A₁ ≃ₐ[R] A₁) where\n mul ϕ ψ := ψ.trans ϕ\n mul_assoc ϕ ψ χ := rfl\n one := refl\n one_mul ϕ := ext fun x => rfl\n mul_one ϕ := ext fun x => rfl\n inv := symm\n mul_left_inv ϕ := ext <| symm_apply_apply ϕ\n#align alg_equiv.aut AlgEquiv.aut\n\ntheorem aut_mul (ϕ ψ : A₁ ≃ₐ[R] A₁) : ϕ * ψ = ψ.trans ϕ :=\n rfl\n\ntheorem aut_one : 1 = AlgEquiv.refl (R := R) (A₁ := A₁) :=\n rfl\n\n@[simp]\ntheorem one_apply (x : A₁) : (1 : A₁ ≃ₐ[R] A₁) x = x :=\n rfl\n#align alg_equiv.one_apply AlgEquiv.one_apply\n\n@[simp]\ntheorem mul_apply (e₁ e₂ : A₁ ≃ₐ[R] A₁) (x : A₁) : (e₁ * e₂) x = e₁ (e₂ x) :=\n rfl\n#align alg_equiv.mul_apply AlgEquiv.mul_apply\n\n/-- An algebra isomorphism induces a group isomorphism between automorphism groups.\n\nThis is a more bundled version of `AlgEquiv.equivCongr`. -/\n@[simps apply]\ndef autCongr (ϕ : A₁ ≃ₐ[R] A₂) : (A₁ ≃ₐ[R] A₁) ≃* A₂ ≃ₐ[R] A₂ where\n __ := equivCongr ϕ ϕ\n toFun ψ := ϕ.symm.trans (ψ.trans ϕ)\n invFun ψ := ϕ.trans (ψ.trans ϕ.symm)\n map_mul' ψ χ := by\n ext\n simp only [mul_apply, trans_apply, symm_apply_apply]\n#align alg_equiv.aut_congr AlgEquiv.autCongr\n\n@[simp]\ntheorem autCongr_refl : autCongr AlgEquiv.refl = MulEquiv.refl (A₁ ≃ₐ[R] A₁) := by\n ext\n rfl\n#align alg_equiv.aut_congr_refl AlgEquiv.autCongr_refl\n\n@[simp]\ntheorem autCongr_symm (ϕ : A₁ ≃ₐ[R] A₂) : (autCongr ϕ).symm = autCongr ϕ.symm :=\n rfl\n#align alg_equiv.aut_congr_symm AlgEquiv.autCongr_symm\n\n@[simp]\ntheorem autCongr_trans (ϕ : A₁ ≃ₐ[R] A₂) (ψ : A₂ ≃ₐ[R] A₃) :\n (autCongr ϕ).trans (autCongr ψ) = autCongr (ϕ.trans ψ) :=\n rfl\n#align alg_equiv.aut_congr_trans AlgEquiv.autCongr_trans\n\n/-- The tautological action by `A₁ ≃ₐ[R] A₁` on `A₁`.\n\nThis generalizes `Function.End.applyMulAction`. -/\ninstance applyMulSemiringAction : MulSemiringAction (A₁ ≃ₐ[R] A₁) A₁ where\n smul := (· <| ·)\n smul_zero := AlgEquiv.map_zero\n smul_add := AlgEquiv.map_add\n smul_one := AlgEquiv.map_one\n smul_mul := AlgEquiv.map_mul\n one_smul _ := rfl\n mul_smul _ _ _ := rfl\n#align alg_equiv.apply_mul_semiring_action AlgEquiv.applyMulSemiringAction\n\ninstance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul := fun f => Units.map f\n one_smul := fun x => by ext; rfl\n mul_smul := fun x y z => by ext; rfl\n smul_mul := fun x y z => by ext; exact x.map_mul _ _\n smul_one := fun x => by ext; exact x.map_one\n\n@[simp]\nprotected theorem smul_def (f : A₁ ≃ₐ[R] A₁) (a : A₁) : f • a = f a :=\n rfl\n#align alg_equiv.smul_def AlgEquiv.smul_def\n\ninstance apply_faithfulSMul : FaithfulSMul (A₁ ≃ₐ[R] A₁) A₁ :=\n ⟨AlgEquiv.ext⟩\n#align alg_equiv.apply_has_faithful_smul AlgEquiv.apply_faithfulSMul\n\ninstance apply_smulCommClass : SMulCommClass R (A₁ ≃ₐ[R] A₁) A₁ where\n smul_comm r e a := (e.map_smul r a).symm\n#align alg_equiv.apply_smul_comm_class AlgEquiv.apply_smulCommClass\n\ninstance apply_smulCommClass' : SMulCommClass (A₁ ≃ₐ[R] A₁) R A₁ where\n smul_comm e r a := e.map_smul r a\n#align alg_equiv.apply_smul_comm_class' AlgEquiv.apply_smulCommClass'\n\n@[simp]\ntheorem algebraMap_eq_apply (e : A₁ ≃ₐ[R] A₂) {y : R} {x : A₁} :\n algebraMap R A₂ y = e x ↔ algebraMap R A₁ y = x :=\n ⟨fun h => by simpa using e.symm.toAlgHom.algebraMap_eq_apply h, fun h =>\n e.toAlgHom.algebraMap_eq_apply h⟩\n#align alg_equiv.algebra_map_eq_apply AlgEquiv.algebraMap_eq_apply\n\n/-- `AlgEquiv.toLinearMap` as a `MonoidHom`. -/\n@[simps]\ndef toLinearMapHom (R A) [CommSemiring R] [Semiring A] [Algebra R A] :\n (A ≃ₐ[R] A) →* A →ₗ[R] A where\n toFun := AlgEquiv.toLinearMap\n map_one' := rfl\n map_mul' := fun _ _ ↦ rfl\n\nlemma pow_toLinearMap (σ : A₁ ≃ₐ[R] A₁) (n : ℕ) :\n (σ ^ n).toLinearMap = σ.toLinearMap ^ n :=\n (AlgEquiv.toLinearMapHom R A₁).map_pow σ n\n\n@[simp]\nlemma one_toLinearMap :\n (1 : A₁ ≃ₐ[R] A₁).toLinearMap = 1 := rfl\n\n/-- The units group of `S →ₐ[R] S` is `S ≃ₐ[R] S`.\nSee `LinearMap.GeneralLinearGroup.generalLinearEquiv` for the linear map version. -/\n@[simps]\ndef algHomUnitsEquiv (R S : Type*) [CommSemiring R] [Semiring S] [Algebra R S] :\n (S →ₐ[R] S)ˣ ≃* (S ≃ₐ[R] S) where\n toFun := fun f ↦\n { (f : S →ₐ[R] S) with\n invFun := ↑(f⁻¹)\n left_inv := (fun x ↦ show (↑(f⁻¹ * f) : S →ₐ[R] S) x = x by rw [inv_mul_self]; ","nextTactic":"rfl","declUpToTactic":"/-- The units group of `S →ₐ[R] S` is `S ≃ₐ[R] S`.\nSee `LinearMap.GeneralLinearGroup.generalLinearEquiv` for the linear map version. -/\n@[simps]\ndef algHomUnitsEquiv (R S : Type*) [CommSemiring R] [Semiring S] [Algebra R S] :\n (S →ₐ[R] S)ˣ ≃* (S ≃ₐ[R] S) where\n toFun := fun f ↦\n { (f : S →ₐ[R] S) with\n invFun := ↑(f⁻¹)\n left_inv := (fun x ↦ show (↑(f⁻¹ * f) : S →ₐ[R] S) x = x by rw [inv_mul_self]; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.808_0.gpEhvIDvcS3ZH5c","decl":"/-- The units group of `S →ₐ[R] S` is `S ≃ₐ[R] S`.\nSee `LinearMap.GeneralLinearGroup.generalLinearEquiv` for the linear map version. -/\n@[simps]\ndef algHomUnitsEquiv (R S : Type*) [CommSemiring R] [Semiring S] [Algebra R S] :\n (S →ₐ[R] S)ˣ ≃* (S ≃ₐ[R] S) where\n toFun "} -{"state":"R✝ : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹⁵ : CommSemiring R✝\ninst✝¹⁴ : Semiring A₁\ninst✝¹³ : Semiring A₂\ninst✝¹² : Semiring A₃\ninst✝¹¹ : Semiring A₁'\ninst✝¹⁰ : Semiring A₂'\ninst✝⁹ : Semiring A₃'\ninst✝⁸ : Algebra R✝ A₁\ninst✝⁷ : Algebra R✝ A₂\ninst✝⁶ : Algebra R✝ A₃\ninst✝⁵ : Algebra R✝ A₁'\ninst✝⁴ : Algebra R✝ A₂'\ninst✝³ : Algebra R✝ A₃'\ne : A₁ ≃ₐ[R✝] A₂\nR : Type u_1\nS : Type u_2\ninst✝² : CommSemiring R\ninst✝¹ : Semiring S\ninst✝ : Algebra R S\nf : (S →ₐ[R] S)ˣ\nsrc✝ : S →ₐ[R] S := ↑f\nx : S\n⊢ ↑(f * f⁻¹) x = x","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃ₐ[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ext\n simp_rw [trans_apply, apply_symm_apply]\n\n@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') := by\n ext\n rfl\n\n@[simp]\ntheorem equivCongr_symm (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') :\n (equivCongr e e').symm = equivCongr e.symm e'.symm :=\n rfl\n\n@[simp]\ntheorem equivCongr_trans (e₁₂ : A₁ ≃ₐ[R] A₂) (e₁₂' : A₁' ≃ₐ[R] A₂')\n (e₂₃ : A₂ ≃ₐ[R] A₃) (e₂₃' : A₂' ≃ₐ[R] A₃') :\n (equivCongr e₁₂ e₁₂').trans (equivCongr e₂₃ e₂₃') =\n equivCongr (e₁₂.trans e₂₃) (e₁₂'.trans e₂₃') :=\n rfl\n\n/-- If an algebra morphism has an inverse, it is an algebra isomorphism. -/\ndef ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ : f.comp g = AlgHom.id R A₂)\n (h₂ : g.comp f = AlgHom.id R A₁) : A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := g\n left_inv := AlgHom.ext_iff.1 h₂\n right_inv := AlgHom.ext_iff.1 h₁ }\n#align alg_equiv.of_alg_hom AlgEquiv.ofAlgHom\n\ntheorem coe_algHom_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ↑(ofAlgHom f g h₁ h₂) = f :=\n AlgHom.ext fun _ => rfl\n#align alg_equiv.coe_alg_hom_of_alg_hom AlgEquiv.coe_algHom_ofAlgHom\n\n@[simp]\ntheorem ofAlgHom_coe_algHom (f : A₁ ≃ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ofAlgHom (↑f) g h₁ h₂ = f :=\n ext fun _ => rfl\n#align alg_equiv.of_alg_hom_coe_alg_hom AlgEquiv.ofAlgHom_coe_algHom\n\ntheorem ofAlgHom_symm (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).symm = ofAlgHom g f h₂ h₁ :=\n rfl\n#align alg_equiv.of_alg_hom_symm AlgEquiv.ofAlgHom_symm\n\n/-- Promotes a bijective algebra homomorphism to an algebra equivalence. -/\nnoncomputable def ofBijective (f : A₁ →ₐ[R] A₂) (hf : Function.Bijective f) : A₁ ≃ₐ[R] A₂ :=\n { RingEquiv.ofBijective (f : A₁ →+* A₂) hf, f with }\n#align alg_equiv.of_bijective AlgEquiv.ofBijective\n\n@[simp]\ntheorem coe_ofBijective {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} :\n (AlgEquiv.ofBijective f hf : A₁ → A₂) = f :=\n rfl\n#align alg_equiv.coe_of_bijective AlgEquiv.coe_ofBijective\n\ntheorem ofBijective_apply {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} (a : A₁) :\n (AlgEquiv.ofBijective f hf) a = f a :=\n rfl\n#align alg_equiv.of_bijective_apply AlgEquiv.ofBijective_apply\n\n/-- Forgetting the multiplicative structures, an equivalence of algebras is a linear equivalence. -/\n@[simps apply]\ndef toLinearEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ₗ[R] A₂ :=\n { e with\n toFun := e\n map_smul' := e.map_smul\n invFun := e.symm }\n#align alg_equiv.to_linear_equiv AlgEquiv.toLinearEquiv\n#align alg_equiv.to_linear_equiv_apply AlgEquiv.toLinearEquiv_apply\n\n@[simp]\ntheorem toLinearEquiv_refl : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).toLinearEquiv = LinearEquiv.refl R A₁ :=\n rfl\n#align alg_equiv.to_linear_equiv_refl AlgEquiv.toLinearEquiv_refl\n\n@[simp]\ntheorem toLinearEquiv_symm (e : A₁ ≃ₐ[R] A₂) : e.toLinearEquiv.symm = e.symm.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_symm AlgEquiv.toLinearEquiv_symm\n\n@[simp]\ntheorem toLinearEquiv_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) :\n (e₁.trans e₂).toLinearEquiv = e₁.toLinearEquiv.trans e₂.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_trans AlgEquiv.toLinearEquiv_trans\n\ntheorem toLinearEquiv_injective : Function.Injective (toLinearEquiv : _ → A₁ ≃ₗ[R] A₂) :=\n fun _ _ h => ext <| LinearEquiv.congr_fun h\n#align alg_equiv.to_linear_equiv_injective AlgEquiv.toLinearEquiv_injective\n\n/-- Interpret an algebra equivalence as a linear map. -/\ndef toLinearMap : A₁ →ₗ[R] A₂ :=\n e.toAlgHom.toLinearMap\n#align alg_equiv.to_linear_map AlgEquiv.toLinearMap\n\n@[simp]\ntheorem toAlgHom_toLinearMap : (e : A₁ →ₐ[R] A₂).toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_alg_hom_to_linear_map AlgEquiv.toAlgHom_toLinearMap\n\ntheorem toLinearMap_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).toLinearMap = f.toLinearMap :=\n LinearMap.ext fun _ => rfl\n\n@[simp]\ntheorem toLinearEquiv_toLinearMap : e.toLinearEquiv.toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_linear_equiv_to_linear_map AlgEquiv.toLinearEquiv_toLinearMap\n\n@[simp]\ntheorem toLinearMap_apply (x : A₁) : e.toLinearMap x = e x :=\n rfl\n#align alg_equiv.to_linear_map_apply AlgEquiv.toLinearMap_apply\n\ntheorem toLinearMap_injective : Function.Injective (toLinearMap : _ → A₁ →ₗ[R] A₂) := fun _ _ h =>\n ext <| LinearMap.congr_fun h\n#align alg_equiv.to_linear_map_injective AlgEquiv.toLinearMap_injective\n\n@[simp]\ntheorem trans_toLinearMap (f : A₁ ≃ₐ[R] A₂) (g : A₂ ≃ₐ[R] A₃) :\n (f.trans g).toLinearMap = g.toLinearMap.comp f.toLinearMap :=\n rfl\n#align alg_equiv.trans_to_linear_map AlgEquiv.trans_toLinearMap\n\nsection OfLinearEquiv\n\nvariable (l : A₁ ≃ₗ[R] A₂) (map_one : l 1 = 1) (map_mul : ∀ x y : A₁, l (x * y) = l x * l y)\n\n/-- Upgrade a linear equivalence to an algebra equivalence,\ngiven that it distributes over multiplication and the identity\n-/\n@[simps apply]\ndef ofLinearEquiv : A₁ ≃ₐ[R] A₂ :=\n { l with\n toFun := l\n invFun := l.symm\n map_mul' := map_mul\n commutes' := (AlgHom.ofLinearMap l map_one map_mul : A₁ →ₐ[R] A₂).commutes }\n#align alg_equiv.of_linear_equiv AlgEquiv.ofLinearEquivₓ\n\n@[simp]\ntheorem ofLinearEquiv_symm :\n (ofLinearEquiv l map_one map_mul).symm =\n ofLinearEquiv l.symm (ofLinearEquiv l map_one map_mul).symm.map_one\n (ofLinearEquiv l map_one map_mul).symm.map_mul :=\n rfl\n#align alg_equiv.of_linear_equiv_symm AlgEquiv.ofLinearEquiv_symm\n\n@[simp]\ntheorem ofLinearEquiv_toLinearEquiv (map_mul) (map_one) :\n ofLinearEquiv e.toLinearEquiv map_mul map_one = e := by\n ext\n rfl\n#align alg_equiv.of_linear_equiv_to_linear_equiv AlgEquiv.ofLinearEquiv_toLinearEquiv\n\n@[simp]\ntheorem toLinearEquiv_ofLinearEquiv : toLinearEquiv (ofLinearEquiv l map_one map_mul) = l := by\n ext\n rfl\n#align alg_equiv.to_linear_equiv_of_linear_equiv AlgEquiv.toLinearEquiv_ofLinearEquiv\n\nend OfLinearEquiv\n\nsection OfRingEquiv\n\n/-- Promotes a linear ring_equiv to an AlgEquiv. -/\n@[simps apply symm_apply toEquiv] -- Porting note: don't want redundant `toEquiv_symm_apply` simps\ndef ofRingEquiv {f : A₁ ≃+* A₂} (hf : ∀ x, f (algebraMap R A₁ x) = algebraMap R A₂ x) :\n A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := f.symm\n commutes' := hf }\n#align alg_equiv.of_ring_equiv AlgEquiv.ofRingEquiv\n\nend OfRingEquiv\n\n-- Porting note: projections mul & one not found, removed [simps] and added theorems manually\n-- @[simps (config := .lemmasOnly) one]\ninstance aut : Group (A₁ ≃ₐ[R] A₁) where\n mul ϕ ψ := ψ.trans ϕ\n mul_assoc ϕ ψ χ := rfl\n one := refl\n one_mul ϕ := ext fun x => rfl\n mul_one ϕ := ext fun x => rfl\n inv := symm\n mul_left_inv ϕ := ext <| symm_apply_apply ϕ\n#align alg_equiv.aut AlgEquiv.aut\n\ntheorem aut_mul (ϕ ψ : A₁ ≃ₐ[R] A₁) : ϕ * ψ = ψ.trans ϕ :=\n rfl\n\ntheorem aut_one : 1 = AlgEquiv.refl (R := R) (A₁ := A₁) :=\n rfl\n\n@[simp]\ntheorem one_apply (x : A₁) : (1 : A₁ ≃ₐ[R] A₁) x = x :=\n rfl\n#align alg_equiv.one_apply AlgEquiv.one_apply\n\n@[simp]\ntheorem mul_apply (e₁ e₂ : A₁ ≃ₐ[R] A₁) (x : A₁) : (e₁ * e₂) x = e₁ (e₂ x) :=\n rfl\n#align alg_equiv.mul_apply AlgEquiv.mul_apply\n\n/-- An algebra isomorphism induces a group isomorphism between automorphism groups.\n\nThis is a more bundled version of `AlgEquiv.equivCongr`. -/\n@[simps apply]\ndef autCongr (ϕ : A₁ ≃ₐ[R] A₂) : (A₁ ≃ₐ[R] A₁) ≃* A₂ ≃ₐ[R] A₂ where\n __ := equivCongr ϕ ϕ\n toFun ψ := ϕ.symm.trans (ψ.trans ϕ)\n invFun ψ := ϕ.trans (ψ.trans ϕ.symm)\n map_mul' ψ χ := by\n ext\n simp only [mul_apply, trans_apply, symm_apply_apply]\n#align alg_equiv.aut_congr AlgEquiv.autCongr\n\n@[simp]\ntheorem autCongr_refl : autCongr AlgEquiv.refl = MulEquiv.refl (A₁ ≃ₐ[R] A₁) := by\n ext\n rfl\n#align alg_equiv.aut_congr_refl AlgEquiv.autCongr_refl\n\n@[simp]\ntheorem autCongr_symm (ϕ : A₁ ≃ₐ[R] A₂) : (autCongr ϕ).symm = autCongr ϕ.symm :=\n rfl\n#align alg_equiv.aut_congr_symm AlgEquiv.autCongr_symm\n\n@[simp]\ntheorem autCongr_trans (ϕ : A₁ ≃ₐ[R] A₂) (ψ : A₂ ≃ₐ[R] A₃) :\n (autCongr ϕ).trans (autCongr ψ) = autCongr (ϕ.trans ψ) :=\n rfl\n#align alg_equiv.aut_congr_trans AlgEquiv.autCongr_trans\n\n/-- The tautological action by `A₁ ≃ₐ[R] A₁` on `A₁`.\n\nThis generalizes `Function.End.applyMulAction`. -/\ninstance applyMulSemiringAction : MulSemiringAction (A₁ ≃ₐ[R] A₁) A₁ where\n smul := (· <| ·)\n smul_zero := AlgEquiv.map_zero\n smul_add := AlgEquiv.map_add\n smul_one := AlgEquiv.map_one\n smul_mul := AlgEquiv.map_mul\n one_smul _ := rfl\n mul_smul _ _ _ := rfl\n#align alg_equiv.apply_mul_semiring_action AlgEquiv.applyMulSemiringAction\n\ninstance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul := fun f => Units.map f\n one_smul := fun x => by ext; rfl\n mul_smul := fun x y z => by ext; rfl\n smul_mul := fun x y z => by ext; exact x.map_mul _ _\n smul_one := fun x => by ext; exact x.map_one\n\n@[simp]\nprotected theorem smul_def (f : A₁ ≃ₐ[R] A₁) (a : A₁) : f • a = f a :=\n rfl\n#align alg_equiv.smul_def AlgEquiv.smul_def\n\ninstance apply_faithfulSMul : FaithfulSMul (A₁ ≃ₐ[R] A₁) A₁ :=\n ⟨AlgEquiv.ext⟩\n#align alg_equiv.apply_has_faithful_smul AlgEquiv.apply_faithfulSMul\n\ninstance apply_smulCommClass : SMulCommClass R (A₁ ≃ₐ[R] A₁) A₁ where\n smul_comm r e a := (e.map_smul r a).symm\n#align alg_equiv.apply_smul_comm_class AlgEquiv.apply_smulCommClass\n\ninstance apply_smulCommClass' : SMulCommClass (A₁ ≃ₐ[R] A₁) R A₁ where\n smul_comm e r a := e.map_smul r a\n#align alg_equiv.apply_smul_comm_class' AlgEquiv.apply_smulCommClass'\n\n@[simp]\ntheorem algebraMap_eq_apply (e : A₁ ≃ₐ[R] A₂) {y : R} {x : A₁} :\n algebraMap R A₂ y = e x ↔ algebraMap R A₁ y = x :=\n ⟨fun h => by simpa using e.symm.toAlgHom.algebraMap_eq_apply h, fun h =>\n e.toAlgHom.algebraMap_eq_apply h⟩\n#align alg_equiv.algebra_map_eq_apply AlgEquiv.algebraMap_eq_apply\n\n/-- `AlgEquiv.toLinearMap` as a `MonoidHom`. -/\n@[simps]\ndef toLinearMapHom (R A) [CommSemiring R] [Semiring A] [Algebra R A] :\n (A ≃ₐ[R] A) →* A →ₗ[R] A where\n toFun := AlgEquiv.toLinearMap\n map_one' := rfl\n map_mul' := fun _ _ ↦ rfl\n\nlemma pow_toLinearMap (σ : A₁ ≃ₐ[R] A₁) (n : ℕ) :\n (σ ^ n).toLinearMap = σ.toLinearMap ^ n :=\n (AlgEquiv.toLinearMapHom R A₁).map_pow σ n\n\n@[simp]\nlemma one_toLinearMap :\n (1 : A₁ ≃ₐ[R] A₁).toLinearMap = 1 := rfl\n\n/-- The units group of `S →ₐ[R] S` is `S ≃ₐ[R] S`.\nSee `LinearMap.GeneralLinearGroup.generalLinearEquiv` for the linear map version. -/\n@[simps]\ndef algHomUnitsEquiv (R S : Type*) [CommSemiring R] [Semiring S] [Algebra R S] :\n (S →ₐ[R] S)ˣ ≃* (S ≃ₐ[R] S) where\n toFun := fun f ↦\n { (f : S →ₐ[R] S) with\n invFun := ↑(f⁻¹)\n left_inv := (fun x ↦ show (↑(f⁻¹ * f) : S →ₐ[R] S) x = x by rw [inv_mul_self]; rfl)\n right_inv := (fun x ↦ show (↑(f * f⁻¹) : S →ₐ[R] S) x = x by ","nextTactic":"rw [mul_inv_self]","declUpToTactic":"/-- The units group of `S →ₐ[R] S` is `S ≃ₐ[R] S`.\nSee `LinearMap.GeneralLinearGroup.generalLinearEquiv` for the linear map version. -/\n@[simps]\ndef algHomUnitsEquiv (R S : Type*) [CommSemiring R] [Semiring S] [Algebra R S] :\n (S →ₐ[R] S)ˣ ≃* (S ≃ₐ[R] S) where\n toFun := fun f ↦\n { (f : S →ₐ[R] S) with\n invFun := ↑(f⁻¹)\n left_inv := (fun x ↦ show (↑(f⁻¹ * f) : S →ₐ[R] S) x = x by rw [inv_mul_self]; rfl)\n right_inv := (fun x ↦ show (↑(f * f⁻¹) : S →ₐ[R] S) x = x by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.808_0.gpEhvIDvcS3ZH5c","decl":"/-- The units group of `S →ₐ[R] S` is `S ≃ₐ[R] S`.\nSee `LinearMap.GeneralLinearGroup.generalLinearEquiv` for the linear map version. -/\n@[simps]\ndef algHomUnitsEquiv (R S : Type*) [CommSemiring R] [Semiring S] [Algebra R S] :\n (S →ₐ[R] S)ˣ ≃* (S ≃ₐ[R] S) where\n toFun "} -{"state":"R✝ : Type uR\nA₁ : Type uA₁\nA₂ : Type uA₂\nA₃ : Type uA₃\nA₁' : Type uA₁'\nA₂' : Type uA₂'\nA₃' : Type uA₃'\ninst✝¹⁵ : CommSemiring R✝\ninst✝¹⁴ : Semiring A₁\ninst✝¹³ : Semiring A₂\ninst✝¹² : Semiring A₃\ninst✝¹¹ : Semiring A₁'\ninst✝¹⁰ : Semiring A₂'\ninst✝⁹ : Semiring A₃'\ninst✝⁸ : Algebra R✝ A₁\ninst✝⁷ : Algebra R✝ A₂\ninst✝⁶ : Algebra R✝ A₃\ninst✝⁵ : Algebra R✝ A₁'\ninst✝⁴ : Algebra R✝ A₂'\ninst✝³ : Algebra R✝ A₃'\ne : A₁ ≃ₐ[R✝] A₂\nR : Type u_1\nS : Type u_2\ninst✝² : CommSemiring R\ninst✝¹ : Semiring S\ninst✝ : Algebra R S\nf : (S →ₐ[R] S)ˣ\nsrc✝ : S →ₐ[R] S := ↑f\nx : S\n⊢ ↑1 x = x","srcUpToTactic":"/-\nCopyright (c) 2018 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau, Yury Kudryashov\n-/\nimport Mathlib.Algebra.Algebra.Hom\n\n#align_import algebra.algebra.equiv from \"leanprover-community/mathlib\"@\"bd9851ca476957ea4549eb19b40e7b5ade9428cc\"\n\n/-!\n# Isomorphisms of `R`-algebras\n\nThis file defines bundled isomorphisms of `R`-algebras.\n\n## Main definitions\n\n* `AlgEquiv R A B`: the type of `R`-algebra isomorphisms between `A` and `B`.\n\n## Notations\n\n* `A ≃ₐ[R] B` : `R`-algebra equivalence from `A` to `B`.\n-/\n\nset_option autoImplicit true\n\n\nopen BigOperators\n\nuniverse u v w u₁ v₁\n\n/-- An equivalence of algebras is an equivalence of rings commuting with the actions of scalars. -/\nstructure AlgEquiv (R : Type u) (A : Type v) (B : Type w) [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B] extends A ≃ B, A ≃* B, A ≃+ B, A ≃+* B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n protected commutes' : ∀ r : R, toFun (algebraMap R A r) = algebraMap R B r\n#align alg_equiv AlgEquiv\n\nattribute [nolint docBlame] AlgEquiv.toRingEquiv\nattribute [nolint docBlame] AlgEquiv.toEquiv\nattribute [nolint docBlame] AlgEquiv.toAddEquiv\nattribute [nolint docBlame] AlgEquiv.toMulEquiv\n\n@[inherit_doc]\nnotation:50 A \" ≃ₐ[\" R \"] \" A' => AlgEquiv R A A'\n\n/-- `AlgEquivClass F R A B` states that `F` is a type of algebra structure preserving\n equivalences. You should extend this class when you extend `AlgEquiv`. -/\nclass AlgEquivClass (F : Type*) (R A B : outParam (Type*)) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] extends RingEquivClass F A B where\n /-- An equivalence of algebras commutes with the action of scalars. -/\n commutes : ∀ (f : F) (r : R), f (algebraMap R A r) = algebraMap R B r\n#align alg_equiv_class AlgEquivClass\n\n-- Porting note: Removed nolint dangerousInstance from AlgEquivClass.toRingEquivClass\n\nnamespace AlgEquivClass\n\n-- See note [lower instance priority]\ninstance (priority := 100) toAlgHomClass (F R A B : Type*) [CommSemiring R] [Semiring A]\n [Semiring B] [Algebra R A] [Algebra R B] [h : AlgEquivClass F R A B] :\n AlgHomClass F R A B :=\n { h with\n coe := (⇑)\n coe_injective' := FunLike.coe_injective\n map_zero := map_zero\n map_one := map_one }\n#align alg_equiv_class.to_alg_hom_class AlgEquivClass.toAlgHomClass\n\ninstance (priority := 100) toLinearEquivClass (F R A B : Type*) [CommSemiring R]\n [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [h : AlgEquivClass F R A B] : LinearEquivClass F R A B :=\n { h with map_smulₛₗ := fun f => map_smulₛₗ f }\n#align alg_equiv_class.to_linear_equiv_class AlgEquivClass.toLinearEquivClass\n\n/-- Turn an element of a type `F` satisfying `AlgEquivClass F R A B` into an actual `AlgEquiv`.\nThis is declared as the default coercion from `F` to `A ≃ₐ[R] B`. -/\n@[coe]\ndef toAlgEquiv {F R A B : Type*} [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A]\n [Algebra R B] [AlgEquivClass F R A B] (f : F) : A ≃ₐ[R] B :=\n { (f : A ≃ B), (f : A ≃+* B) with commutes' := commutes f }\n\ninstance (F R A B : Type*) [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]\n [AlgEquivClass F R A B] : CoeTC F (A ≃ₐ[R] B) :=\n ⟨toAlgEquiv⟩\nend AlgEquivClass\n\nnamespace AlgEquiv\n\nuniverse uR uA₁ uA₂ uA₃ uA₁' uA₂' uA₃'\nvariable {R : Type uR}\nvariable {A₁ : Type uA₁} {A₂ : Type uA₂} {A₃ : Type uA₃}\nvariable {A₁' : Type uA₁'} {A₂' : Type uA₂'} {A₃' : Type uA₃'}\n\nsection Semiring\n\nvariable [CommSemiring R] [Semiring A₁] [Semiring A₂] [Semiring A₃]\nvariable [Semiring A₁'] [Semiring A₂'] [Semiring A₃']\n\nvariable [Algebra R A₁] [Algebra R A₂] [Algebra R A₃]\nvariable [Algebra R A₁'] [Algebra R A₂'] [Algebra R A₃']\n\nvariable (e : A₁ ≃ₐ[R] A₂)\n\ninstance : AlgEquivClass (A₁ ≃ₐ[R] A₂) R A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n map_add f := f.map_add'\n map_mul f := f.map_mul'\n commutes f := f.commutes'\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n\n-- Porting note: replaced with EquivLike instance\n-- /-- Helper instance for when there's too many metavariables to apply\n-- `fun_like.has_coe_to_fun` directly. -/\n-- instance : CoeFun (A₁ ≃ₐ[R] A₂) fun _ => A₁ → A₂ :=\n-- ⟨AlgEquiv.toFun⟩\n\ninstance : EquivLike (A₁ ≃ₐ[R] A₂) A₁ A₂ where\n coe f := f.toFun\n inv f := f.invFun\n left_inv f := f.left_inv\n right_inv f := f.right_inv\n coe_injective' f g h₁ h₂ := by\n obtain ⟨⟨f,_⟩,_⟩ := f\n obtain ⟨⟨g,_⟩,_⟩ := g\n congr\n\n-- Porting note: the default simps projection was `e.toEquiv.toFun`, it should be `FunLike.coe`\n/-- See Note [custom simps projection] -/\ndef Simps.apply (e : A₁ ≃ₐ[R] A₂) : A₁ → A₂ :=\n e\n\n-- Porting note: the default simps projection was `e.toEquiv`, it should be `EquivLike.toEquiv`\n/-- See Note [custom simps projection] -/\ndef Simps.toEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ A₂ :=\n e\n\n-- Porting note: `protected` used to be an attribute below\n@[simp]\nprotected theorem coe_coe {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) :\n ⇑(f : A₁ ≃ₐ[R] A₂) = f :=\n rfl\n#align alg_equiv.coe_coe AlgEquiv.coe_coe\n\n@[ext]\ntheorem ext {f g : A₁ ≃ₐ[R] A₂} (h : ∀ a, f a = g a) : f = g :=\n FunLike.ext f g h\n#align alg_equiv.ext AlgEquiv.ext\n\nprotected theorem congr_arg {f : A₁ ≃ₐ[R] A₂} {x x' : A₁} : x = x' → f x = f x' :=\n FunLike.congr_arg f\n#align alg_equiv.congr_arg AlgEquiv.congr_arg\n\nprotected theorem congr_fun {f g : A₁ ≃ₐ[R] A₂} (h : f = g) (x : A₁) : f x = g x :=\n FunLike.congr_fun h x\n#align alg_equiv.congr_fun AlgEquiv.congr_fun\n\nprotected theorem ext_iff {f g : A₁ ≃ₐ[R] A₂} : f = g ↔ ∀ x, f x = g x :=\n FunLike.ext_iff\n#align alg_equiv.ext_iff AlgEquiv.ext_iff\n\ntheorem coe_fun_injective : @Function.Injective (A₁ ≃ₐ[R] A₂) (A₁ → A₂) fun e => (e : A₁ → A₂) :=\n FunLike.coe_injective\n#align alg_equiv.coe_fun_injective AlgEquiv.coe_fun_injective\n\n-- Porting note: Made to CoeOut instance from Coe, not dangerous anymore\ninstance hasCoeToRingEquiv : CoeOut (A₁ ≃ₐ[R] A₂) (A₁ ≃+* A₂) :=\n ⟨AlgEquiv.toRingEquiv⟩\n#align alg_equiv.has_coe_to_ring_equiv AlgEquiv.hasCoeToRingEquiv\n\n@[simp]\ntheorem coe_mk {toFun invFun left_inv right_inv map_mul map_add commutes} :\n ⇑(⟨⟨toFun, invFun, left_inv, right_inv⟩, map_mul, map_add, commutes⟩ : A₁ ≃ₐ[R] A₂) = toFun :=\n rfl\n#align alg_equiv.coe_mk AlgEquiv.coe_mk\n\n@[simp]\ntheorem mk_coe (e : A₁ ≃ₐ[R] A₂) (e' h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨e, e', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂) = e :=\n ext fun _ => rfl\n#align alg_equiv.mk_coe AlgEquiv.mk_coe\n\n-- Porting note: `toFun_eq_coe` no longer needed in Lean4\n#noalign alg_equiv.to_fun_eq_coe\n\n@[simp]\ntheorem toEquiv_eq_coe : e.toEquiv = e :=\n rfl\n#align alg_equiv.to_equiv_eq_coe AlgEquiv.toEquiv_eq_coe\n\n@[simp]\ntheorem toRingEquiv_eq_coe : e.toRingEquiv = e :=\n rfl\n#align alg_equiv.to_ring_equiv_eq_coe AlgEquiv.toRingEquiv_eq_coe\n\n@[simp, norm_cast]\nlemma toRingEquiv_toRingHom : ((e : A₁ ≃+* A₂) : A₁ →+* A₂) = e :=\n rfl\n\n@[simp, norm_cast]\ntheorem coe_ringEquiv : ((e : A₁ ≃+* A₂) : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv AlgEquiv.coe_ringEquiv\n\ntheorem coe_ringEquiv' : (e.toRingEquiv : A₁ → A₂) = e :=\n rfl\n#align alg_equiv.coe_ring_equiv' AlgEquiv.coe_ringEquiv'\n\ntheorem coe_ringEquiv_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ ≃+* A₂) :=\n fun _ _ h => ext <| RingEquiv.congr_fun h\n#align alg_equiv.coe_ring_equiv_injective AlgEquiv.coe_ringEquiv_injective\n\nprotected theorem map_add : ∀ x y, e (x + y) = e x + e y :=\n map_add e\n#align alg_equiv.map_add AlgEquiv.map_add\n\nprotected theorem map_zero : e 0 = 0 :=\n map_zero e\n#align alg_equiv.map_zero AlgEquiv.map_zero\n\nprotected theorem map_mul : ∀ x y, e (x * y) = e x * e y :=\n map_mul e\n#align alg_equiv.map_mul AlgEquiv.map_mul\n\nprotected theorem map_one : e 1 = 1 :=\n map_one e\n#align alg_equiv.map_one AlgEquiv.map_one\n\n@[simp]\ntheorem commutes : ∀ r : R, e (algebraMap R A₁ r) = algebraMap R A₂ r :=\n e.commutes'\n#align alg_equiv.commutes AlgEquiv.commutes\n\n-- @[simp] -- Porting note: simp can prove this\ntheorem map_smul (r : R) (x : A₁) : e (r • x) = r • e x := by\n simp only [Algebra.smul_def, map_mul, commutes]\n#align alg_equiv.map_smul AlgEquiv.map_smul\n\ntheorem map_sum {ι : Type*} (f : ι → A₁) (s : Finset ι) : e (∑ x in s, f x) = ∑ x in s, e (f x) :=\n e.toAddEquiv.map_sum f s\n#align alg_equiv.map_sum AlgEquiv.map_sum\n\ntheorem map_finsupp_sum {α : Type*} [Zero α] {ι : Type*} (f : ι →₀ α) (g : ι → α → A₁) :\n e (f.sum g) = f.sum fun i b => e (g i b) :=\n e.map_sum _ _\n#align alg_equiv.map_finsupp_sum AlgEquiv.map_finsupp_sum\n\n-- Porting note: Added [coe] attribute\n/-- Interpret an algebra equivalence as an algebra homomorphism.\n\nThis definition is included for symmetry with the other `to*Hom` projections.\nThe `simp` normal form is to use the coercion of the `AlgHomClass.coeTC` instance. -/\n@[coe]\ndef toAlgHom : A₁ →ₐ[R] A₂ :=\n { e with\n map_one' := e.map_one\n map_zero' := e.map_zero }\n#align alg_equiv.to_alg_hom AlgEquiv.toAlgHom\n\n@[simp]\ntheorem toAlgHom_eq_coe : e.toAlgHom = e :=\n rfl\n#align alg_equiv.to_alg_hom_eq_coe AlgEquiv.toAlgHom_eq_coe\n\n@[simp, norm_cast]\ntheorem coe_algHom : FunLike.coe (e.toAlgHom) = FunLike.coe e :=\n rfl\n#align alg_equiv.coe_alg_hom AlgEquiv.coe_algHom\n\ntheorem coe_algHom_injective : Function.Injective ((↑) : (A₁ ≃ₐ[R] A₂) → A₁ →ₐ[R] A₂) :=\n fun _ _ h => ext <| AlgHom.congr_fun h\n#align alg_equiv.coe_alg_hom_injective AlgEquiv.coe_algHom_injective\n\n@[simp, norm_cast]\nlemma toAlgHom_toRingHom : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = e :=\n rfl\n\n/-- The two paths coercion can take to a `RingHom` are equivalent -/\ntheorem coe_ringHom_commutes : ((e : A₁ →ₐ[R] A₂) : A₁ →+* A₂) = ((e : A₁ ≃+* A₂) : A₁ →+* A₂) :=\n rfl\n#align alg_equiv.coe_ring_hom_commutes AlgEquiv.coe_ringHom_commutes\n\nprotected theorem map_pow : ∀ (x : A₁) (n : ℕ), e (x ^ n) = e x ^ n :=\n map_pow _\n#align alg_equiv.map_pow AlgEquiv.map_pow\n\nprotected theorem injective : Function.Injective e :=\n EquivLike.injective e\n#align alg_equiv.injective AlgEquiv.injective\n\nprotected theorem surjective : Function.Surjective e :=\n EquivLike.surjective e\n#align alg_equiv.surjective AlgEquiv.surjective\n\nprotected theorem bijective : Function.Bijective e :=\n EquivLike.bijective e\n#align alg_equiv.bijective AlgEquiv.bijective\n\n/-- Algebra equivalences are reflexive. -/\n@[refl]\ndef refl : A₁ ≃ₐ[R] A₁ :=\n { (1 : A₁ ≃+* A₁) with commutes' := fun _ => rfl }\n#align alg_equiv.refl AlgEquiv.refl\n\ninstance : Inhabited (A₁ ≃ₐ[R] A₁) :=\n ⟨refl⟩\n\n@[simp]\ntheorem refl_toAlgHom : ↑(refl : A₁ ≃ₐ[R] A₁) = AlgHom.id R A₁ :=\n rfl\n#align alg_equiv.refl_to_alg_hom AlgEquiv.refl_toAlgHom\n\n@[simp]\ntheorem coe_refl : ⇑(refl : A₁ ≃��[R] A₁) = id :=\n rfl\n#align alg_equiv.coe_refl AlgEquiv.coe_refl\n\n/-- Algebra equivalences are symmetric. -/\n@[symm]\ndef symm (e : A₁ ≃ₐ[R] A₂) : A₂ ≃ₐ[R] A₁ :=\n { e.toRingEquiv.symm with\n commutes' := fun r => by\n rw [← e.toRingEquiv.symm_apply_apply (algebraMap R A₁ r)]\n congr\n change _ = e _\n rw [e.commutes] }\n#align alg_equiv.symm AlgEquiv.symm\n\n/-- See Note [custom simps projection] -/\ndef Simps.symm_apply (e : A₁ ≃ₐ[R] A₂) : A₂ → A₁ :=\n e.symm\n#align alg_equiv.simps.symm_apply AlgEquiv.Simps.symm_apply\n\ninitialize_simps_projections AlgEquiv (toFun → apply, invFun → symm_apply)\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_apply_coe_coe_symm_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₂) :\n f ((f : A₁ ≃ₐ[R] A₂).symm x) = x :=\n EquivLike.right_inv f x\n#align alg_equiv.coe_apply_coe_coe_symm_apply AlgEquiv.coe_apply_coe_coe_symm_apply\n\n--@[simp] -- Porting note: simp can prove this once symm_mk is introduced\ntheorem coe_coe_symm_apply_coe_apply {F : Type*} [AlgEquivClass F R A₁ A₂] (f : F) (x : A₁) :\n (f : A₁ ≃ₐ[R] A₂).symm (f x) = x :=\n EquivLike.left_inv f x\n#align alg_equiv.coe_coe_symm_apply_coe_apply AlgEquiv.coe_coe_symm_apply_coe_apply\n\n-- Porting note: `simp` normal form of `invFun_eq_symm`\n@[simp]\ntheorem symm_toEquiv_eq_symm {e : A₁ ≃ₐ[R] A₂} : (e : A₁ ≃ A₂).symm = e.symm :=\n rfl\n\ntheorem invFun_eq_symm {e : A₁ ≃ₐ[R] A₂} : e.invFun = e.symm :=\n rfl\n#align alg_equiv.inv_fun_eq_symm AlgEquiv.invFun_eq_symm\n\n@[simp]\ntheorem symm_symm (e : A₁ ≃ₐ[R] A₂) : e.symm.symm = e := by\n ext\n rfl\n#align alg_equiv.symm_symm AlgEquiv.symm_symm\n\ntheorem symm_bijective : Function.Bijective (symm : (A₁ ≃ₐ[R] A₂) → A₂ ≃ₐ[R] A₁) :=\n Function.bijective_iff_has_inverse.mpr ⟨_, symm_symm, symm_symm⟩\n#align alg_equiv.symm_bijective AlgEquiv.symm_bijective\n\n@[simp]\ntheorem mk_coe' (e : A₁ ≃ₐ[R] A₂) (f h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, e, h₁, h₂⟩, h₃, h₄, h₅⟩ : A₂ ≃ₐ[R] A₁) = e.symm :=\n symm_bijective.injective <| ext fun _ => rfl\n#align alg_equiv.mk_coe' AlgEquiv.mk_coe'\n\n@[simp]\ntheorem symm_mk (f f') (h₁ h₂ h₃ h₄ h₅) :\n (⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm =\n {(⟨⟨f, f', h₁, h₂⟩, h₃, h₄, h₅⟩ : A₁ ≃ₐ[R] A₂).symm with\n toFun := f'\n invFun := f } :=\n rfl\n#align alg_equiv.symm_mk AlgEquiv.symm_mk\n\n@[simp]\ntheorem refl_symm : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).symm = AlgEquiv.refl :=\n rfl\n#align alg_equiv.refl_symm AlgEquiv.refl_symm\n\n--this should be a simp lemma but causes a lint timeout\ntheorem toRingEquiv_symm (f : A₁ ≃ₐ[R] A₁) : (f : A₁ ≃+* A₁).symm = f.symm :=\n rfl\n#align alg_equiv.to_ring_equiv_symm AlgEquiv.toRingEquiv_symm\n\n@[simp]\ntheorem symm_toRingEquiv : (e.symm : A₂ ≃+* A₁) = (e : A₁ ≃+* A₂).symm :=\n rfl\n#align alg_equiv.symm_to_ring_equiv AlgEquiv.symm_toRingEquiv\n\n/-- Algebra equivalences are transitive. -/\n@[trans]\ndef trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : A₁ ≃ₐ[R] A₃ :=\n { e₁.toRingEquiv.trans e₂.toRingEquiv with\n commutes' := fun r => show e₂.toFun (e₁.toFun _) = _ by rw [e₁.commutes', e₂.commutes'] }\n#align alg_equiv.trans AlgEquiv.trans\n\n@[simp]\ntheorem apply_symm_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e (e.symm x) = x :=\n e.toEquiv.apply_symm_apply\n#align alg_equiv.apply_symm_apply AlgEquiv.apply_symm_apply\n\n@[simp]\ntheorem symm_apply_apply (e : A₁ ≃ₐ[R] A₂) : ∀ x, e.symm (e x) = x :=\n e.toEquiv.symm_apply_apply\n#align alg_equiv.symm_apply_apply AlgEquiv.symm_apply_apply\n\n@[simp]\ntheorem symm_trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₃) :\n (e₁.trans e₂).symm x = e₁.symm (e₂.symm x) :=\n rfl\n#align alg_equiv.symm_trans_apply AlgEquiv.symm_trans_apply\n\n@[simp]\ntheorem coe_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) : ⇑(e₁.trans e₂) = e₂ ∘ e₁ :=\n rfl\n#align alg_equiv.coe_trans AlgEquiv.coe_trans\n\n@[simp]\ntheorem trans_apply (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) (x : A₁) : (e₁.trans e₂) x = e₂ (e₁ x) :=\n rfl\n#align alg_equiv.trans_apply AlgEquiv.trans_apply\n\n@[simp]\ntheorem comp_symm (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp (e : A₁ →ₐ[R] A₂) ↑e.symm = AlgHom.id R A₂ := by\n ext\n simp\n#align alg_equiv.comp_symm AlgEquiv.comp_symm\n\n@[simp]\ntheorem symm_comp (e : A₁ ≃ₐ[R] A₂) : AlgHom.comp ↑e.symm (e : A₁ →ₐ[R] A₂) = AlgHom.id R A₁ := by\n ext\n simp\n#align alg_equiv.symm_comp AlgEquiv.symm_comp\n\ntheorem leftInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.LeftInverse e.symm e :=\n e.left_inv\n#align alg_equiv.left_inverse_symm AlgEquiv.leftInverse_symm\n\ntheorem rightInverse_symm (e : A₁ ≃ₐ[R] A₂) : Function.RightInverse e.symm e :=\n e.right_inv\n#align alg_equiv.right_inverse_symm AlgEquiv.rightInverse_symm\n\n/-- If `A₁` is equivalent to `A₁'` and `A₂` is equivalent to `A₂'`, then the type of maps\n`A₁ →ₐ[R] A₂` is equivalent to the type of maps `A₁' →ₐ[R] A₂'`. -/\n@[simps apply]\ndef arrowCongr (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') : (A₁ →ₐ[R] A₂) ≃ (A₁' →ₐ[R] A₂') where\n toFun f := (e₂.toAlgHom.comp f).comp e₁.symm.toAlgHom\n invFun f := (e₂.symm.toAlgHom.comp f).comp e₁.toAlgHom\n left_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, symm_comp]\n simp only [← AlgHom.comp_assoc, symm_comp, AlgHom.id_comp, AlgHom.comp_id]\n right_inv f := by\n simp only [AlgHom.comp_assoc, toAlgHom_eq_coe, comp_symm]\n simp only [← AlgHom.comp_assoc, comp_symm, AlgHom.id_comp, AlgHom.comp_id]\n#align alg_equiv.arrow_congr AlgEquiv.arrowCongr\n\ntheorem arrowCongr_comp (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂')\n (e₃ : A₃ ≃ₐ[R] A₃') (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₃) :\n arrowCongr e₁ e₃ (g.comp f) = (arrowCongr e₂ e₃ g).comp (arrowCongr e₁ e₂ f) := by\n ext\n simp only [arrowCongr, Equiv.coe_fn_mk, AlgHom.comp_apply]\n congr\n exact (e₂.symm_apply_apply _).symm\n#align alg_equiv.arrow_congr_comp AlgEquiv.arrowCongr_comp\n\n@[simp]\ntheorem arrowCongr_refl : arrowCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ →ₐ[R] A₂) := by\n ext\n rfl\n#align alg_equiv.arrow_congr_refl AlgEquiv.arrowCongr_refl\n\n@[simp]\ntheorem arrowCongr_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₁' : A₁' ≃ₐ[R] A₂')\n (e₂ : A₂ ≃ₐ[R] A₃) (e₂' : A₂' ≃ₐ[R] A₃') :\n arrowCongr (e₁.trans e₂) (e₁'.trans e₂') = (arrowCongr e₁ e₁').trans (arrowCongr e₂ e₂') := by\n ext\n rfl\n#align alg_equiv.arrow_congr_trans AlgEquiv.arrowCongr_trans\n\n@[simp]\ntheorem arrowCongr_symm (e₁ : A₁ ≃ₐ[R] A₁') (e₂ : A₂ ≃ₐ[R] A₂') :\n (arrowCongr e₁ e₂).symm = arrowCongr e₁.symm e₂.symm := by\n ext\n rfl\n#align alg_equiv.arrow_congr_symm AlgEquiv.arrowCongr_symm\n\n/-- If `A₁` is equivalent to `A₂` and `A₁'` is equivalent to `A₂'`, then the type of maps\n`A₁ ≃ₐ[R] A₁'` is equivalent to the type of maps `A₂ ≃ ₐ[R] A₂'`.\n\nThis is the `AlgEquiv` version of `AlgEquiv.arrowCongr`. -/\n@[simps apply]\ndef equivCongr (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') : (A₁ ≃ₐ[R] A₁') ≃ A₂ ≃ₐ[R] A₂' where\n toFun ψ := e.symm.trans (ψ.trans e')\n invFun ψ := e.trans (ψ.trans e'.symm)\n left_inv ψ := by\n ext\n simp_rw [trans_apply, symm_apply_apply]\n right_inv ψ := by\n ext\n simp_rw [trans_apply, apply_symm_apply]\n\n@[simp]\ntheorem equivCongr_refl : equivCongr AlgEquiv.refl AlgEquiv.refl = Equiv.refl (A₁ ≃ₐ[R] A₁') := by\n ext\n rfl\n\n@[simp]\ntheorem equivCongr_symm (e : A₁ ≃ₐ[R] A₂) (e' : A₁' ≃ₐ[R] A₂') :\n (equivCongr e e').symm = equivCongr e.symm e'.symm :=\n rfl\n\n@[simp]\ntheorem equivCongr_trans (e₁₂ : A₁ ≃ₐ[R] A₂) (e₁₂' : A₁' ≃ₐ[R] A₂')\n (e₂₃ : A₂ ≃ₐ[R] A₃) (e₂₃' : A₂' ≃ₐ[R] A₃') :\n (equivCongr e₁₂ e₁₂').trans (equivCongr e₂₃ e₂₃') =\n equivCongr (e₁₂.trans e₂₃) (e₁₂'.trans e₂₃') :=\n rfl\n\n/-- If an algebra morphism has an inverse, it is an algebra isomorphism. -/\ndef ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ : f.comp g = AlgHom.id R A₂)\n (h₂ : g.comp f = AlgHom.id R A₁) : A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := g\n left_inv := AlgHom.ext_iff.1 h₂\n right_inv := AlgHom.ext_iff.1 h₁ }\n#align alg_equiv.of_alg_hom AlgEquiv.ofAlgHom\n\ntheorem coe_algHom_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ↑(ofAlgHom f g h₁ h₂) = f :=\n AlgHom.ext fun _ => rfl\n#align alg_equiv.coe_alg_hom_of_alg_hom AlgEquiv.coe_algHom_ofAlgHom\n\n@[simp]\ntheorem ofAlgHom_coe_algHom (f : A₁ ≃ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n ofAlgHom (↑f) g h₁ h₂ = f :=\n ext fun _ => rfl\n#align alg_equiv.of_alg_hom_coe_alg_hom AlgEquiv.ofAlgHom_coe_algHom\n\ntheorem ofAlgHom_symm (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).symm = ofAlgHom g f h₂ h₁ :=\n rfl\n#align alg_equiv.of_alg_hom_symm AlgEquiv.ofAlgHom_symm\n\n/-- Promotes a bijective algebra homomorphism to an algebra equivalence. -/\nnoncomputable def ofBijective (f : A₁ →ₐ[R] A₂) (hf : Function.Bijective f) : A₁ ≃ₐ[R] A₂ :=\n { RingEquiv.ofBijective (f : A₁ →+* A₂) hf, f with }\n#align alg_equiv.of_bijective AlgEquiv.ofBijective\n\n@[simp]\ntheorem coe_ofBijective {f : A₁ →ₐ[R] A₂} {hf : Function.Bijective f} :\n (AlgEquiv.ofBijective f hf : A₁ → A₂) = f :=\n rfl\n#align alg_equiv.coe_of_bijective AlgEquiv.coe_ofBijective\n\ntheorem ofBijective_apply {f : A₁ →ₐ[R] A��} {hf : Function.Bijective f} (a : A₁) :\n (AlgEquiv.ofBijective f hf) a = f a :=\n rfl\n#align alg_equiv.of_bijective_apply AlgEquiv.ofBijective_apply\n\n/-- Forgetting the multiplicative structures, an equivalence of algebras is a linear equivalence. -/\n@[simps apply]\ndef toLinearEquiv (e : A₁ ≃ₐ[R] A₂) : A₁ ≃ₗ[R] A₂ :=\n { e with\n toFun := e\n map_smul' := e.map_smul\n invFun := e.symm }\n#align alg_equiv.to_linear_equiv AlgEquiv.toLinearEquiv\n#align alg_equiv.to_linear_equiv_apply AlgEquiv.toLinearEquiv_apply\n\n@[simp]\ntheorem toLinearEquiv_refl : (AlgEquiv.refl : A₁ ≃ₐ[R] A₁).toLinearEquiv = LinearEquiv.refl R A₁ :=\n rfl\n#align alg_equiv.to_linear_equiv_refl AlgEquiv.toLinearEquiv_refl\n\n@[simp]\ntheorem toLinearEquiv_symm (e : A₁ ≃ₐ[R] A₂) : e.toLinearEquiv.symm = e.symm.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_symm AlgEquiv.toLinearEquiv_symm\n\n@[simp]\ntheorem toLinearEquiv_trans (e₁ : A₁ ≃ₐ[R] A₂) (e₂ : A₂ ≃ₐ[R] A₃) :\n (e₁.trans e₂).toLinearEquiv = e₁.toLinearEquiv.trans e₂.toLinearEquiv :=\n rfl\n#align alg_equiv.to_linear_equiv_trans AlgEquiv.toLinearEquiv_trans\n\ntheorem toLinearEquiv_injective : Function.Injective (toLinearEquiv : _ → A₁ ≃ₗ[R] A₂) :=\n fun _ _ h => ext <| LinearEquiv.congr_fun h\n#align alg_equiv.to_linear_equiv_injective AlgEquiv.toLinearEquiv_injective\n\n/-- Interpret an algebra equivalence as a linear map. -/\ndef toLinearMap : A₁ →ₗ[R] A₂ :=\n e.toAlgHom.toLinearMap\n#align alg_equiv.to_linear_map AlgEquiv.toLinearMap\n\n@[simp]\ntheorem toAlgHom_toLinearMap : (e : A₁ →ₐ[R] A₂).toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_alg_hom_to_linear_map AlgEquiv.toAlgHom_toLinearMap\n\ntheorem toLinearMap_ofAlgHom (f : A₁ →ₐ[R] A₂) (g : A₂ →ₐ[R] A₁) (h₁ h₂) :\n (ofAlgHom f g h₁ h₂).toLinearMap = f.toLinearMap :=\n LinearMap.ext fun _ => rfl\n\n@[simp]\ntheorem toLinearEquiv_toLinearMap : e.toLinearEquiv.toLinearMap = e.toLinearMap :=\n rfl\n#align alg_equiv.to_linear_equiv_to_linear_map AlgEquiv.toLinearEquiv_toLinearMap\n\n@[simp]\ntheorem toLinearMap_apply (x : A₁) : e.toLinearMap x = e x :=\n rfl\n#align alg_equiv.to_linear_map_apply AlgEquiv.toLinearMap_apply\n\ntheorem toLinearMap_injective : Function.Injective (toLinearMap : _ → A₁ →ₗ[R] A₂) := fun _ _ h =>\n ext <| LinearMap.congr_fun h\n#align alg_equiv.to_linear_map_injective AlgEquiv.toLinearMap_injective\n\n@[simp]\ntheorem trans_toLinearMap (f : A₁ ≃ₐ[R] A₂) (g : A₂ ≃ₐ[R] A₃) :\n (f.trans g).toLinearMap = g.toLinearMap.comp f.toLinearMap :=\n rfl\n#align alg_equiv.trans_to_linear_map AlgEquiv.trans_toLinearMap\n\nsection OfLinearEquiv\n\nvariable (l : A₁ ≃ₗ[R] A₂) (map_one : l 1 = 1) (map_mul : ∀ x y : A₁, l (x * y) = l x * l y)\n\n/-- Upgrade a linear equivalence to an algebra equivalence,\ngiven that it distributes over multiplication and the identity\n-/\n@[simps apply]\ndef ofLinearEquiv : A₁ ≃ₐ[R] A₂ :=\n { l with\n toFun := l\n invFun := l.symm\n map_mul' := map_mul\n commutes' := (AlgHom.ofLinearMap l map_one map_mul : A₁ →ₐ[R] A₂).commutes }\n#align alg_equiv.of_linear_equiv AlgEquiv.ofLinearEquivₓ\n\n@[simp]\ntheorem ofLinearEquiv_symm :\n (ofLinearEquiv l map_one map_mul).symm =\n ofLinearEquiv l.symm (ofLinearEquiv l map_one map_mul).symm.map_one\n (ofLinearEquiv l map_one map_mul).symm.map_mul :=\n rfl\n#align alg_equiv.of_linear_equiv_symm AlgEquiv.ofLinearEquiv_symm\n\n@[simp]\ntheorem ofLinearEquiv_toLinearEquiv (map_mul) (map_one) :\n ofLinearEquiv e.toLinearEquiv map_mul map_one = e := by\n ext\n rfl\n#align alg_equiv.of_linear_equiv_to_linear_equiv AlgEquiv.ofLinearEquiv_toLinearEquiv\n\n@[simp]\ntheorem toLinearEquiv_ofLinearEquiv : toLinearEquiv (ofLinearEquiv l map_one map_mul) = l := by\n ext\n rfl\n#align alg_equiv.to_linear_equiv_of_linear_equiv AlgEquiv.toLinearEquiv_ofLinearEquiv\n\nend OfLinearEquiv\n\nsection OfRingEquiv\n\n/-- Promotes a linear ring_equiv to an AlgEquiv. -/\n@[simps apply symm_apply toEquiv] -- Porting note: don't want redundant `toEquiv_symm_apply` simps\ndef ofRingEquiv {f : A₁ ≃+* A₂} (hf : ∀ x, f (algebraMap R A₁ x) = algebraMap R A₂ x) :\n A₁ ≃ₐ[R] A₂ :=\n { f with\n toFun := f\n invFun := f.symm\n commutes' := hf }\n#align alg_equiv.of_ring_equiv AlgEquiv.ofRingEquiv\n\nend OfRingEquiv\n\n-- Porting note: projections mul & one not found, removed [simps] and added theorems manually\n-- @[simps (config := .lemmasOnly) one]\ninstance aut : Group (A₁ ≃ₐ[R] A₁) where\n mul ϕ ψ := ψ.trans ϕ\n mul_assoc ϕ ψ χ := rfl\n one := refl\n one_mul ϕ := ext fun x => rfl\n mul_one ϕ := ext fun x => rfl\n inv := symm\n mul_left_inv ϕ := ext <| symm_apply_apply ϕ\n#align alg_equiv.aut AlgEquiv.aut\n\ntheorem aut_mul (ϕ ψ : A₁ ≃ₐ[R] A₁) : ϕ * ψ = ψ.trans ϕ :=\n rfl\n\ntheorem aut_one : 1 = AlgEquiv.refl (R := R) (A₁ := A₁) :=\n rfl\n\n@[simp]\ntheorem one_apply (x : A₁) : (1 : A₁ ≃ₐ[R] A₁) x = x :=\n rfl\n#align alg_equiv.one_apply AlgEquiv.one_apply\n\n@[simp]\ntheorem mul_apply (e₁ e₂ : A₁ ≃ₐ[R] A₁) (x : A₁) : (e₁ * e₂) x = e₁ (e₂ x) :=\n rfl\n#align alg_equiv.mul_apply AlgEquiv.mul_apply\n\n/-- An algebra isomorphism induces a group isomorphism between automorphism groups.\n\nThis is a more bundled version of `AlgEquiv.equivCongr`. -/\n@[simps apply]\ndef autCongr (ϕ : A₁ ≃ₐ[R] A₂) : (A₁ ≃ₐ[R] A₁) ≃* A₂ ≃ₐ[R] A₂ where\n __ := equivCongr ϕ ϕ\n toFun ψ := ϕ.symm.trans (ψ.trans ϕ)\n invFun ψ := ϕ.trans (ψ.trans ϕ.symm)\n map_mul' ψ χ := by\n ext\n simp only [mul_apply, trans_apply, symm_apply_apply]\n#align alg_equiv.aut_congr AlgEquiv.autCongr\n\n@[simp]\ntheorem autCongr_refl : autCongr AlgEquiv.refl = MulEquiv.refl (A₁ ≃ₐ[R] A₁) := by\n ext\n rfl\n#align alg_equiv.aut_congr_refl AlgEquiv.autCongr_refl\n\n@[simp]\ntheorem autCongr_symm (ϕ : A₁ ≃ₐ[R] A₂) : (autCongr ϕ).symm = autCongr ϕ.symm :=\n rfl\n#align alg_equiv.aut_congr_symm AlgEquiv.autCongr_symm\n\n@[simp]\ntheorem autCongr_trans (ϕ : A₁ ≃ₐ[R] A₂) (ψ : A₂ ≃ₐ[R] A₃) :\n (autCongr ϕ).trans (autCongr ψ) = autCongr (ϕ.trans ψ) :=\n rfl\n#align alg_equiv.aut_congr_trans AlgEquiv.autCongr_trans\n\n/-- The tautological action by `A₁ ≃ₐ[R] A₁` on `A₁`.\n\nThis generalizes `Function.End.applyMulAction`. -/\ninstance applyMulSemiringAction : MulSemiringAction (A₁ ≃ₐ[R] A₁) A₁ where\n smul := (· <| ·)\n smul_zero := AlgEquiv.map_zero\n smul_add := AlgEquiv.map_add\n smul_one := AlgEquiv.map_one\n smul_mul := AlgEquiv.map_mul\n one_smul _ := rfl\n mul_smul _ _ _ := rfl\n#align alg_equiv.apply_mul_semiring_action AlgEquiv.applyMulSemiringAction\n\ninstance : MulDistribMulAction (A₁ ≃ₐ[R] A₁) A₁ˣ where\n smul := fun f => Units.map f\n one_smul := fun x => by ext; rfl\n mul_smul := fun x y z => by ext; rfl\n smul_mul := fun x y z => by ext; exact x.map_mul _ _\n smul_one := fun x => by ext; exact x.map_one\n\n@[simp]\nprotected theorem smul_def (f : A₁ ≃ₐ[R] A₁) (a : A₁) : f • a = f a :=\n rfl\n#align alg_equiv.smul_def AlgEquiv.smul_def\n\ninstance apply_faithfulSMul : FaithfulSMul (A₁ ≃ₐ[R] A₁) A₁ :=\n ⟨AlgEquiv.ext⟩\n#align alg_equiv.apply_has_faithful_smul AlgEquiv.apply_faithfulSMul\n\ninstance apply_smulCommClass : SMulCommClass R (A₁ ≃ₐ[R] A₁) A₁ where\n smul_comm r e a := (e.map_smul r a).symm\n#align alg_equiv.apply_smul_comm_class AlgEquiv.apply_smulCommClass\n\ninstance apply_smulCommClass' : SMulCommClass (A₁ ≃ₐ[R] A₁) R A₁ where\n smul_comm e r a := e.map_smul r a\n#align alg_equiv.apply_smul_comm_class' AlgEquiv.apply_smulCommClass'\n\n@[simp]\ntheorem algebraMap_eq_apply (e : A₁ ≃ₐ[R] A₂) {y : R} {x : A₁} :\n algebraMap R A₂ y = e x ↔ algebraMap R A₁ y = x :=\n ⟨fun h => by simpa using e.symm.toAlgHom.algebraMap_eq_apply h, fun h =>\n e.toAlgHom.algebraMap_eq_apply h⟩\n#align alg_equiv.algebra_map_eq_apply AlgEquiv.algebraMap_eq_apply\n\n/-- `AlgEquiv.toLinearMap` as a `MonoidHom`. -/\n@[simps]\ndef toLinearMapHom (R A) [CommSemiring R] [Semiring A] [Algebra R A] :\n (A ≃ₐ[R] A) →* A →ₗ[R] A where\n toFun := AlgEquiv.toLinearMap\n map_one' := rfl\n map_mul' := fun _ _ ↦ rfl\n\nlemma pow_toLinearMap (σ : A₁ ≃ₐ[R] A₁) (n : ℕ) :\n (σ ^ n).toLinearMap = σ.toLinearMap ^ n :=\n (AlgEquiv.toLinearMapHom R A₁).map_pow σ n\n\n@[simp]\nlemma one_toLinearMap :\n (1 : A₁ ≃ₐ[R] A₁).toLinearMap = 1 := rfl\n\n/-- The units group of `S →ₐ[R] S` is `S ≃ₐ[R] S`.\nSee `LinearMap.GeneralLinearGroup.generalLinearEquiv` for the linear map version. -/\n@[simps]\ndef algHomUnitsEquiv (R S : Type*) [CommSemiring R] [Semiring S] [Algebra R S] :\n (S →ₐ[R] S)ˣ ≃* (S ≃ₐ[R] S) where\n toFun := fun f ↦\n { (f : S →ₐ[R] S) with\n invFun := ↑(f⁻¹)\n left_inv := (fun x ↦ show (↑(f⁻¹ * f) : S →ₐ[R] S) x = x by rw [inv_mul_self]; rfl)\n right_inv := (fun x ↦ show (↑(f * f⁻¹) : S →ₐ[R] S) x = x by rw [mul_inv_self]; ","nextTactic":"rfl","declUpToTactic":"/-- The units group of `S →ₐ[R] S` is `S ≃ₐ[R] S`.\nSee `LinearMap.GeneralLinearGroup.generalLinearEquiv` for the linear map version. -/\n@[simps]\ndef algHomUnitsEquiv (R S : Type*) [CommSemiring R] [Semiring S] [Algebra R S] :\n (S →ₐ[R] S)ˣ ≃* (S ≃ₐ[R] S) where\n toFun := fun f ↦\n { (f : S →ₐ[R] S) with\n invFun := ↑(f⁻¹)\n left_inv := (fun x ↦ show (↑(f⁻¹ * f) : S →ₐ[R] S) x = x by rw [inv_mul_self]; rfl)\n right_inv := (fun x ↦ show (↑(f * f⁻¹) : S →ₐ[R] S) x = x by rw [mul_inv_self]; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Algebra_Equiv.808_0.gpEhvIDvcS3ZH5c","decl":"/-- The units group of `S →ₐ[R] S` is `S ≃ₐ[R] S`.\nSee `LinearMap.GeneralLinearGroup.generalLinearEquiv` for the linear map version. -/\n@[simps]\ndef algHomUnitsEquiv (R S : Type*) [CommSemiring R] [Semiring S] [Algebra R S] :\n (S →ₐ[R] S)ˣ ≃* (S ≃ₐ[R] S) where\n toFun "}