{"completion":"by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x","context_contains_namespace":true,"context_suffix":"end AddConstMapClass","dependency_ids":["import:Mathlib.Algebra.Group.Action.Pi","import:Mathlib.Algebra.Group.End","import:Mathlib.Algebra.Module.NatInt","import:Mathlib.Algebra.Order.Archimedean.Basic","import:Mathlib.Algebra.Order.Group.Basic"],"family_id":"map_add_nsmul","file_id":"mathlib/Mathlib/Algebra/AddConstMap/Basic.lean","imports":["public import Mathlib.Algebra.Group.Action.Pi","public import Mathlib.Algebra.Group.End","public import Mathlib.Algebra.Module.NatInt","public import Mathlib.Algebra.Order.Archimedean.Basic","import Mathlib.Algebra.Order.Group.Basic"],"local_context":"/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]","module_header":true,"namespace":"AddConstMapClass","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Action.Pi\npublic import Mathlib.Algebra.Group.End\npublic import Mathlib.Algebra.Module.NatInt\npublic import Mathlib.Algebra.Order.Archimedean.Basic\nimport Mathlib.Algebra.Order.Group.Basic\n\nNamespace:\nAddConstMapClass\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\n\nTarget:\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b :=\n\nProof body:\n","proof_body":"by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x","provenance":{"declaration_index":0,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"976709af1494098e2290d3c3a6a052dad499a43ec44c3bd6016d3ce147bb9165","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/AddConstMap/Basic.lean"},"sample_id":"8f5d0fb5ee184967c74d1416fe52fd9434ff3e69ab0bdf3beb03a62dd7931a28","schema_version":1,"split":"train","theorem_statement":"theorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b :="} {"completion":"by simp [← map_add_nsmul]","context_contains_namespace":true,"context_suffix":"end AddConstMapClass","dependency_ids":["import:Mathlib.Algebra.Group.Action.Pi","import:Mathlib.Algebra.Group.End","import:Mathlib.Algebra.Module.NatInt","import:Mathlib.Algebra.Order.Archimedean.Basic","import:Mathlib.Algebra.Order.Group.Basic"],"family_id":"map_add_nat","file_id":"mathlib/Mathlib/Algebra/AddConstMap/Basic.lean","imports":["public import Mathlib.Algebra.Group.Action.Pi","public import Mathlib.Algebra.Group.End","public import Mathlib.Algebra.Module.NatInt","public import Mathlib.Algebra.Order.Archimedean.Basic","import Mathlib.Algebra.Order.Group.Basic"],"local_context":"/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]","module_header":true,"namespace":"AddConstMapClass","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Action.Pi\npublic import Mathlib.Algebra.Group.End\npublic import Mathlib.Algebra.Module.NatInt\npublic import Mathlib.Algebra.Order.Archimedean.Basic\nimport Mathlib.Algebra.Order.Group.Basic\n\nNamespace:\nAddConstMapClass\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\n\nTarget:\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b :=\n\nProof body:\n","proof_body":"by simp [← map_add_nsmul]","provenance":{"declaration_index":1,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"976709af1494098e2290d3c3a6a052dad499a43ec44c3bd6016d3ce147bb9165","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/AddConstMap/Basic.lean"},"sample_id":"88028fe960711abbe78d9cd121a3847ced7f6f3ceb4b909684ff5c48eb55882e","schema_version":1,"split":"train","theorem_statement":"theorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b :="} {"completion":"by simp","context_contains_namespace":true,"context_suffix":"end AddConstMapClass","dependency_ids":["import:Mathlib.Algebra.Group.Action.Pi","import:Mathlib.Algebra.Group.End","import:Mathlib.Algebra.Module.NatInt","import:Mathlib.Algebra.Order.Archimedean.Basic","import:Mathlib.Algebra.Order.Group.Basic"],"family_id":"map_add_nat","file_id":"mathlib/Mathlib/Algebra/AddConstMap/Basic.lean","imports":["public import Mathlib.Algebra.Group.Action.Pi","public import Mathlib.Algebra.Group.End","public import Mathlib.Algebra.Module.NatInt","public import Mathlib.Algebra.Order.Archimedean.Basic","import Mathlib.Algebra.Order.Group.Basic"],"local_context":"/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n","module_header":true,"namespace":"AddConstMapClass","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Action.Pi\npublic import Mathlib.Algebra.Group.End\npublic import Mathlib.Algebra.Module.NatInt\npublic import Mathlib.Algebra.Order.Archimedean.Basic\nimport Mathlib.Algebra.Order.Group.Basic\n\nNamespace:\nAddConstMapClass\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\nTarget:\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n :=\n\nProof body:\n","proof_body":"by simp","provenance":{"declaration_index":4,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"976709af1494098e2290d3c3a6a052dad499a43ec44c3bd6016d3ce147bb9165","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/AddConstMap/Basic.lean"},"sample_id":"90ac524b67ba794bdeda25e1bf5bd4e7170084f56fbca8941b94cab60b3d0f99","schema_version":1,"split":"train","theorem_statement":"theorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n :="} {"completion":"by\n simpa using map_add_const f 0","context_contains_namespace":true,"context_suffix":"end AddConstMapClass","dependency_ids":["import:Mathlib.Algebra.Group.Action.Pi","import:Mathlib.Algebra.Group.End","import:Mathlib.Algebra.Module.NatInt","import:Mathlib.Algebra.Order.Archimedean.Basic","import:Mathlib.Algebra.Order.Group.Basic"],"family_id":"map_const","file_id":"mathlib/Mathlib/Algebra/AddConstMap/Basic.lean","imports":["public import Mathlib.Algebra.Group.Action.Pi","public import Mathlib.Algebra.Group.End","public import Mathlib.Algebra.Module.NatInt","public import Mathlib.Algebra.Order.Archimedean.Basic","import Mathlib.Algebra.Order.Group.Basic"],"local_context":"/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]","module_header":true,"namespace":"AddConstMapClass","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Action.Pi\npublic import Mathlib.Algebra.Group.End\npublic import Mathlib.Algebra.Module.NatInt\npublic import Mathlib.Algebra.Order.Archimedean.Basic\nimport Mathlib.Algebra.Order.Group.Basic\n\nNamespace:\nAddConstMapClass\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\n\nTarget:\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b :=\n\nProof body:\n","proof_body":"by\n simpa using map_add_const f 0","provenance":{"declaration_index":6,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"976709af1494098e2290d3c3a6a052dad499a43ec44c3bd6016d3ce147bb9165","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/AddConstMap/Basic.lean"},"sample_id":"904f710a6c6ce01af024995afce9c6abbb5632fe5c568c37485c7040e18aabb6","schema_version":1,"split":"train","theorem_statement":"theorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b :="} {"completion":"by\n simpa using map_add_nsmul f 0 n","context_contains_namespace":true,"context_suffix":"end AddConstMapClass","dependency_ids":["import:Mathlib.Algebra.Group.Action.Pi","import:Mathlib.Algebra.Group.End","import:Mathlib.Algebra.Module.NatInt","import:Mathlib.Algebra.Order.Archimedean.Basic","import:Mathlib.Algebra.Order.Group.Basic"],"family_id":"map_nsmul_const","file_id":"mathlib/Mathlib/Algebra/AddConstMap/Basic.lean","imports":["public import Mathlib.Algebra.Group.Action.Pi","public import Mathlib.Algebra.Group.End","public import Mathlib.Algebra.Module.NatInt","public import Mathlib.Algebra.Order.Archimedean.Basic","import Mathlib.Algebra.Order.Group.Basic"],"local_context":"/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]","module_header":true,"namespace":"AddConstMapClass","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Action.Pi\npublic import Mathlib.Algebra.Group.End\npublic import Mathlib.Algebra.Module.NatInt\npublic import Mathlib.Algebra.Order.Archimedean.Basic\nimport Mathlib.Algebra.Order.Group.Basic\n\nNamespace:\nAddConstMapClass\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\n\nTarget:\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b :=\n\nProof body:\n","proof_body":"by\n simpa using map_add_nsmul f 0 n","provenance":{"declaration_index":8,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"976709af1494098e2290d3c3a6a052dad499a43ec44c3bd6016d3ce147bb9165","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/AddConstMap/Basic.lean"},"sample_id":"03b4139fc309b69f394b3ac43a62c81e4f757fbfa4f12db46669775874ed8403","schema_version":1,"split":"train","theorem_statement":"theorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b :="} {"completion":"by\n simpa using map_add_nat' f 0 n","context_contains_namespace":true,"context_suffix":"end AddConstMapClass","dependency_ids":["import:Mathlib.Algebra.Group.Action.Pi","import:Mathlib.Algebra.Group.End","import:Mathlib.Algebra.Module.NatInt","import:Mathlib.Algebra.Order.Archimedean.Basic","import:Mathlib.Algebra.Order.Group.Basic"],"family_id":"map_nat","file_id":"mathlib/Mathlib/Algebra/AddConstMap/Basic.lean","imports":["public import Mathlib.Algebra.Group.Action.Pi","public import Mathlib.Algebra.Group.End","public import Mathlib.Algebra.Module.NatInt","public import Mathlib.Algebra.Order.Archimedean.Basic","import Mathlib.Algebra.Order.Group.Basic"],"local_context":"/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]","module_header":true,"namespace":"AddConstMapClass","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Action.Pi\npublic import Mathlib.Algebra.Group.End\npublic import Mathlib.Algebra.Module.NatInt\npublic import Mathlib.Algebra.Order.Archimedean.Basic\nimport Mathlib.Algebra.Order.Group.Basic\n\nNamespace:\nAddConstMapClass\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\n\nTarget:\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b :=\n\nProof body:\n","proof_body":"by\n simpa using map_add_nat' f 0 n","provenance":{"declaration_index":9,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"976709af1494098e2290d3c3a6a052dad499a43ec44c3bd6016d3ce147bb9165","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/AddConstMap/Basic.lean"},"sample_id":"56cb6bd2ec907ef5d04db8daaa1bb9dc566f9d59fd4f426007ca29328660030f","schema_version":1,"split":"train","theorem_statement":"theorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b :="} {"completion":"by simp","context_contains_namespace":true,"context_suffix":"end AddConstMapClass","dependency_ids":["import:Mathlib.Algebra.Group.Action.Pi","import:Mathlib.Algebra.Group.End","import:Mathlib.Algebra.Module.NatInt","import:Mathlib.Algebra.Order.Archimedean.Basic","import:Mathlib.Algebra.Order.Group.Basic"],"family_id":"map_nat","file_id":"mathlib/Mathlib/Algebra/AddConstMap/Basic.lean","imports":["public import Mathlib.Algebra.Group.Action.Pi","public import Mathlib.Algebra.Group.End","public import Mathlib.Algebra.Module.NatInt","public import Mathlib.Algebra.Order.Archimedean.Basic","import Mathlib.Algebra.Order.Group.Basic"],"local_context":"/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n","module_header":true,"namespace":"AddConstMapClass","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Action.Pi\npublic import Mathlib.Algebra.Group.End\npublic import Mathlib.Algebra.Module.NatInt\npublic import Mathlib.Algebra.Order.Archimedean.Basic\nimport Mathlib.Algebra.Order.Group.Basic\n\nNamespace:\nAddConstMapClass\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\nTarget:\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n :=\n\nProof body:\n","proof_body":"by simp","provenance":{"declaration_index":11,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"976709af1494098e2290d3c3a6a052dad499a43ec44c3bd6016d3ce147bb9165","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/AddConstMap/Basic.lean"},"sample_id":"c3382c197a7a0c41e1d9279f8590f228949c4cd58004b17836c484966f20cd7f","schema_version":1,"split":"train","theorem_statement":"theorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n :="} {"completion":"by\n rw [add_comm, map_add_const]","context_contains_namespace":true,"context_suffix":"end AddConstMapClass","dependency_ids":["import:Mathlib.Algebra.Group.Action.Pi","import:Mathlib.Algebra.Group.End","import:Mathlib.Algebra.Module.NatInt","import:Mathlib.Algebra.Order.Archimedean.Basic","import:Mathlib.Algebra.Order.Group.Basic"],"family_id":"map_const_add","file_id":"mathlib/Mathlib/Algebra/AddConstMap/Basic.lean","imports":["public import Mathlib.Algebra.Group.Action.Pi","public import Mathlib.Algebra.Group.End","public import Mathlib.Algebra.Module.NatInt","public import Mathlib.Algebra.Order.Archimedean.Basic","import Mathlib.Algebra.Order.Group.Basic"],"local_context":"/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]","module_header":true,"namespace":"AddConstMapClass","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Action.Pi\npublic import Mathlib.Algebra.Group.End\npublic import Mathlib.Algebra.Module.NatInt\npublic import Mathlib.Algebra.Order.Archimedean.Basic\nimport Mathlib.Algebra.Order.Group.Basic\n\nNamespace:\nAddConstMapClass\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\n\nTarget:\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b :=\n\nProof body:\n","proof_body":"by\n rw [add_comm, map_add_const]","provenance":{"declaration_index":13,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"976709af1494098e2290d3c3a6a052dad499a43ec44c3bd6016d3ce147bb9165","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/AddConstMap/Basic.lean"},"sample_id":"6c07fa58250f5e99d44b0693cb3957749a4051b4e28c8c8f2eaf57ee249d6b33","schema_version":1,"split":"train","theorem_statement":"theorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b :="} {"completion":"by\n rw [add_comm, map_add_nsmul]","context_contains_namespace":true,"context_suffix":"end AddConstMapClass","dependency_ids":["import:Mathlib.Algebra.Group.Action.Pi","import:Mathlib.Algebra.Group.End","import:Mathlib.Algebra.Module.NatInt","import:Mathlib.Algebra.Order.Archimedean.Basic","import:Mathlib.Algebra.Order.Group.Basic"],"family_id":"map_nsmul_add","file_id":"mathlib/Mathlib/Algebra/AddConstMap/Basic.lean","imports":["public import Mathlib.Algebra.Group.Action.Pi","public import Mathlib.Algebra.Group.End","public import Mathlib.Algebra.Module.NatInt","public import Mathlib.Algebra.Order.Archimedean.Basic","import Mathlib.Algebra.Order.Group.Basic"],"local_context":"/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]","module_header":true,"namespace":"AddConstMapClass","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Action.Pi\npublic import Mathlib.Algebra.Group.End\npublic import Mathlib.Algebra.Module.NatInt\npublic import Mathlib.Algebra.Order.Archimedean.Basic\nimport Mathlib.Algebra.Order.Group.Basic\n\nNamespace:\nAddConstMapClass\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\n\nTarget:\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b :=\n\nProof body:\n","proof_body":"by\n rw [add_comm, map_add_nsmul]","provenance":{"declaration_index":15,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"976709af1494098e2290d3c3a6a052dad499a43ec44c3bd6016d3ce147bb9165","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/AddConstMap/Basic.lean"},"sample_id":"88d3636d40035e7af0e522964e6d1240f5820f7b1d4913acf9c820b8e6a52d94","schema_version":1,"split":"train","theorem_statement":"theorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b :="} {"completion":"by\n simpa using map_nsmul_add f n x","context_contains_namespace":true,"context_suffix":"end AddConstMapClass","dependency_ids":["import:Mathlib.Algebra.Group.Action.Pi","import:Mathlib.Algebra.Group.End","import:Mathlib.Algebra.Module.NatInt","import:Mathlib.Algebra.Order.Archimedean.Basic","import:Mathlib.Algebra.Order.Group.Basic"],"family_id":"map_nat_add","file_id":"mathlib/Mathlib/Algebra/AddConstMap/Basic.lean","imports":["public import Mathlib.Algebra.Group.Action.Pi","public import Mathlib.Algebra.Group.End","public import Mathlib.Algebra.Module.NatInt","public import Mathlib.Algebra.Order.Archimedean.Basic","import Mathlib.Algebra.Order.Group.Basic"],"local_context":"/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]","module_header":true,"namespace":"AddConstMapClass","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Action.Pi\npublic import Mathlib.Algebra.Group.End\npublic import Mathlib.Algebra.Module.NatInt\npublic import Mathlib.Algebra.Order.Archimedean.Basic\nimport Mathlib.Algebra.Order.Group.Basic\n\nNamespace:\nAddConstMapClass\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\n\nTarget:\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b :=\n\nProof body:\n","proof_body":"by\n simpa using map_nsmul_add f n x","provenance":{"declaration_index":16,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"976709af1494098e2290d3c3a6a052dad499a43ec44c3bd6016d3ce147bb9165","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/AddConstMap/Basic.lean"},"sample_id":"28a6d70f7b1311e027a564c4c4f98efe84375e6f3dea9137f796e086929b7313","schema_version":1,"split":"train","theorem_statement":"theorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b :="} {"completion":"by simp","context_contains_namespace":true,"context_suffix":"end AddConstMapClass","dependency_ids":["import:Mathlib.Algebra.Group.Action.Pi","import:Mathlib.Algebra.Group.End","import:Mathlib.Algebra.Module.NatInt","import:Mathlib.Algebra.Order.Archimedean.Basic","import:Mathlib.Algebra.Order.Group.Basic"],"family_id":"map_nat_add","file_id":"mathlib/Mathlib/Algebra/AddConstMap/Basic.lean","imports":["public import Mathlib.Algebra.Group.Action.Pi","public import Mathlib.Algebra.Group.End","public import Mathlib.Algebra.Module.NatInt","public import Mathlib.Algebra.Order.Archimedean.Basic","import Mathlib.Algebra.Order.Group.Basic"],"local_context":"/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x","module_header":true,"namespace":"AddConstMapClass","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Action.Pi\npublic import Mathlib.Algebra.Group.End\npublic import Mathlib.Algebra.Module.NatInt\npublic import Mathlib.Algebra.Order.Archimedean.Basic\nimport Mathlib.Algebra.Order.Group.Basic\n\nNamespace:\nAddConstMapClass\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\nTarget:\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n :=\n\nProof body:\n","proof_body":"by simp","provenance":{"declaration_index":18,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"976709af1494098e2290d3c3a6a052dad499a43ec44c3bd6016d3ce147bb9165","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/AddConstMap/Basic.lean"},"sample_id":"5383592007b4917662f473edb1d699fb0a1619354ad752251cb17e64c4640de8","schema_version":1,"split":"train","theorem_statement":"theorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n :="} {"completion":"by\n conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]","context_contains_namespace":true,"context_suffix":"end AddConstMapClass","dependency_ids":["import:Mathlib.Algebra.Group.Action.Pi","import:Mathlib.Algebra.Group.End","import:Mathlib.Algebra.Module.NatInt","import:Mathlib.Algebra.Order.Archimedean.Basic","import:Mathlib.Algebra.Order.Group.Basic"],"family_id":"map_sub_nsmul","file_id":"mathlib/Mathlib/Algebra/AddConstMap/Basic.lean","imports":["public import Mathlib.Algebra.Group.Action.Pi","public import Mathlib.Algebra.Group.End","public import Mathlib.Algebra.Module.NatInt","public import Mathlib.Algebra.Order.Archimedean.Basic","import Mathlib.Algebra.Order.Group.Basic"],"local_context":"/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n := by simp\n\ntheorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) :=\n map_nat_add f n x\n\n@[scoped simp]","module_header":true,"namespace":"AddConstMapClass","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Action.Pi\npublic import Mathlib.Algebra.Group.End\npublic import Mathlib.Algebra.Module.NatInt\npublic import Mathlib.Algebra.Order.Archimedean.Basic\nimport Mathlib.Algebra.Order.Group.Basic\n\nNamespace:\nAddConstMapClass\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n := by simp\n\ntheorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) :=\n map_nat_add f n x\n\n@[scoped simp]\n\nTarget:\ntheorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b :=\n\nProof body:\n","proof_body":"by\n conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]","provenance":{"declaration_index":20,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"976709af1494098e2290d3c3a6a052dad499a43ec44c3bd6016d3ce147bb9165","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/AddConstMap/Basic.lean"},"sample_id":"cd2c471052012440570c4f6b6946334948c19f6b3a413ebd495c649897b758f9","schema_version":1,"split":"train","theorem_statement":"theorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b :="} {"completion":"by\n simpa using map_sub_nsmul f x 1","context_contains_namespace":true,"context_suffix":"end AddConstMapClass","dependency_ids":["import:Mathlib.Algebra.Group.Action.Pi","import:Mathlib.Algebra.Group.End","import:Mathlib.Algebra.Module.NatInt","import:Mathlib.Algebra.Order.Archimedean.Basic","import:Mathlib.Algebra.Order.Group.Basic"],"family_id":"map_sub_const","file_id":"mathlib/Mathlib/Algebra/AddConstMap/Basic.lean","imports":["public import Mathlib.Algebra.Group.Action.Pi","public import Mathlib.Algebra.Group.End","public import Mathlib.Algebra.Module.NatInt","public import Mathlib.Algebra.Order.Archimedean.Basic","import Mathlib.Algebra.Order.Group.Basic"],"local_context":"/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n := by simp\n\ntheorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) :=\n map_nat_add f n x\n\n@[scoped simp]\ntheorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b := by\n conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]\n\n@[scoped simp]","module_header":true,"namespace":"AddConstMapClass","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Action.Pi\npublic import Mathlib.Algebra.Group.End\npublic import Mathlib.Algebra.Module.NatInt\npublic import Mathlib.Algebra.Order.Archimedean.Basic\nimport Mathlib.Algebra.Order.Group.Basic\n\nNamespace:\nAddConstMapClass\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n := by simp\n\ntheorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) :=\n map_nat_add f n x\n\n@[scoped simp]\ntheorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b := by\n conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]\n\n@[scoped simp]\n\nTarget:\ntheorem map_sub_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (x - a) = f x - b :=\n\nProof body:\n","proof_body":"by\n simpa using map_sub_nsmul f x 1","provenance":{"declaration_index":21,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"976709af1494098e2290d3c3a6a052dad499a43ec44c3bd6016d3ce147bb9165","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/AddConstMap/Basic.lean"},"sample_id":"3efcf6520edc081e9ba78577d4d332a8c788e126f10be7bedcd61626b49a458f","schema_version":1,"split":"train","theorem_statement":"theorem map_sub_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (x - a) = f x - b :="} {"completion":"by\n simpa using map_sub_nsmul f x n","context_contains_namespace":true,"context_suffix":"end AddConstMapClass","dependency_ids":["import:Mathlib.Algebra.Group.Action.Pi","import:Mathlib.Algebra.Group.End","import:Mathlib.Algebra.Module.NatInt","import:Mathlib.Algebra.Order.Archimedean.Basic","import:Mathlib.Algebra.Order.Group.Basic"],"family_id":"map_sub_nat","file_id":"mathlib/Mathlib/Algebra/AddConstMap/Basic.lean","imports":["public import Mathlib.Algebra.Group.Action.Pi","public import Mathlib.Algebra.Group.End","public import Mathlib.Algebra.Module.NatInt","public import Mathlib.Algebra.Order.Archimedean.Basic","import Mathlib.Algebra.Order.Group.Basic"],"local_context":"/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n := by simp\n\ntheorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) :=\n map_nat_add f n x\n\n@[scoped simp]\ntheorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b := by\n conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]\n\n@[scoped simp]\ntheorem map_sub_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (x - a) = f x - b := by\n simpa using map_sub_nsmul f x 1\n\ntheorem map_sub_one [AddGroup G] [One G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x - 1) = f x - b :=\n map_sub_const f x\n\n@[scoped simp]","module_header":true,"namespace":"AddConstMapClass","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Action.Pi\npublic import Mathlib.Algebra.Group.End\npublic import Mathlib.Algebra.Module.NatInt\npublic import Mathlib.Algebra.Order.Archimedean.Basic\nimport Mathlib.Algebra.Order.Group.Basic\n\nNamespace:\nAddConstMapClass\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n := by simp\n\ntheorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) :=\n map_nat_add f n x\n\n@[scoped simp]\ntheorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b := by\n conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]\n\n@[scoped simp]\ntheorem map_sub_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (x - a) = f x - b := by\n simpa using map_sub_nsmul f x 1\n\ntheorem map_sub_one [AddGroup G] [One G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x - 1) = f x - b :=\n map_sub_const f x\n\n@[scoped simp]\n\nTarget:\ntheorem map_sub_nat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x - n) = f x - n • b :=\n\nProof body:\n","proof_body":"by\n simpa using map_sub_nsmul f x n","provenance":{"declaration_index":23,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"976709af1494098e2290d3c3a6a052dad499a43ec44c3bd6016d3ce147bb9165","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/AddConstMap/Basic.lean"},"sample_id":"64167df448ec128230637762e0ee437d692829d193fa83ee06c6c7940a8738e8","schema_version":1,"split":"train","theorem_statement":"theorem map_sub_nat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x - n) = f x - n • b :="} {"completion":"by\n simpa using map_add_zsmul f 0 n","context_contains_namespace":true,"context_suffix":"end AddConstMapClass","dependency_ids":["import:Mathlib.Algebra.Group.Action.Pi","import:Mathlib.Algebra.Group.End","import:Mathlib.Algebra.Module.NatInt","import:Mathlib.Algebra.Order.Archimedean.Basic","import:Mathlib.Algebra.Order.Group.Basic"],"family_id":"map_add_zsmul","file_id":"mathlib/Mathlib/Algebra/AddConstMap/Basic.lean","imports":["public import Mathlib.Algebra.Group.Action.Pi","public import Mathlib.Algebra.Group.End","public import Mathlib.Algebra.Module.NatInt","public import Mathlib.Algebra.Order.Archimedean.Basic","import Mathlib.Algebra.Order.Group.Basic"],"local_context":"/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n := by simp\n\ntheorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) :=\n map_nat_add f n x\n\n@[scoped simp]\ntheorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b := by\n conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]\n\n@[scoped simp]\ntheorem map_sub_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (x - a) = f x - b := by\n simpa using map_sub_nsmul f x 1\n\ntheorem map_sub_one [AddGroup G] [One G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x - 1) = f x - b :=\n map_sub_const f x\n\n@[scoped simp]\ntheorem map_sub_nat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x - n) = f x - n • b := by\n simpa using map_sub_nsmul f x n\n\n@[scoped simp]\ntheorem map_sub_ofNat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x - ofNat(n)) = f x - ofNat(n) • b :=\n map_sub_nat' f x n\n\n@[scoped simp]","module_header":true,"namespace":"AddConstMapClass","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Action.Pi\npublic import Mathlib.Algebra.Group.End\npublic import Mathlib.Algebra.Module.NatInt\npublic import Mathlib.Algebra.Order.Archimedean.Basic\nimport Mathlib.Algebra.Order.Group.Basic\n\nNamespace:\nAddConstMapClass\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n := by simp\n\ntheorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) :=\n map_nat_add f n x\n\n@[scoped simp]\ntheorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b := by\n conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]\n\n@[scoped simp]\ntheorem map_sub_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (x - a) = f x - b := by\n simpa using map_sub_nsmul f x 1\n\ntheorem map_sub_one [AddGroup G] [One G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x - 1) = f x - b :=\n map_sub_const f x\n\n@[scoped simp]\ntheorem map_sub_nat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x - n) = f x - n • b := by\n simpa using map_sub_nsmul f x n\n\n@[scoped simp]\ntheorem map_sub_ofNat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x - ofNat(n)) = f x - ofNat(n) • b :=\n map_sub_nat' f x n\n\n@[scoped simp]\n\nTarget:\ntheorem map_add_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : ∀ n : ℤ, f (x + n • a) = f x + n • b\n | (n : ℕ) => by simp\n | .negSucc n => by simp [← sub_eq_add_neg]\n\n@[scoped simp]\ntheorem map_zsmul_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (n : ℤ) : f (n • a) = f 0 + n • b :=\n\nProof body:\n","proof_body":"by\n simpa using map_add_zsmul f 0 n","provenance":{"declaration_index":25,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"976709af1494098e2290d3c3a6a052dad499a43ec44c3bd6016d3ce147bb9165","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/AddConstMap/Basic.lean"},"sample_id":"33a11f91cd343e22a5c1d2d35fd0daaff316f7b5da6b1b5b9850d963375dea15","schema_version":1,"split":"train","theorem_statement":"theorem map_add_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : ∀ n : ℤ, f (x + n • a) = f x + n • b\n | (n : ℕ) => by simp\n | .negSucc n => by simp [← sub_eq_add_neg]\n\n@[scoped simp]\ntheorem map_zsmul_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (n : ℤ) : f (n • a) = f 0 + n • b :="} {"completion":"by\n simpa using map_add_zsmul f 0 n","context_contains_namespace":true,"context_suffix":"end AddConstMapClass","dependency_ids":["import:Mathlib.Algebra.Group.Action.Pi","import:Mathlib.Algebra.Group.End","import:Mathlib.Algebra.Module.NatInt","import:Mathlib.Algebra.Order.Archimedean.Basic","import:Mathlib.Algebra.Order.Group.Basic"],"family_id":"map_zsmul_const","file_id":"mathlib/Mathlib/Algebra/AddConstMap/Basic.lean","imports":["public import Mathlib.Algebra.Group.Action.Pi","public import Mathlib.Algebra.Group.End","public import Mathlib.Algebra.Module.NatInt","public import Mathlib.Algebra.Order.Archimedean.Basic","import Mathlib.Algebra.Order.Group.Basic"],"local_context":"/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n := by simp\n\ntheorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) :=\n map_nat_add f n x\n\n@[scoped simp]\ntheorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b := by\n conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]\n\n@[scoped simp]\ntheorem map_sub_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (x - a) = f x - b := by\n simpa using map_sub_nsmul f x 1\n\ntheorem map_sub_one [AddGroup G] [One G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x - 1) = f x - b :=\n map_sub_const f x\n\n@[scoped simp]\ntheorem map_sub_nat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x - n) = f x - n • b := by\n simpa using map_sub_nsmul f x n\n\n@[scoped simp]\ntheorem map_sub_ofNat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x - ofNat(n)) = f x - ofNat(n) • b :=\n map_sub_nat' f x n\n\n@[scoped simp]\ntheorem map_add_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : ∀ n : ℤ, f (x + n • a) = f x + n • b\n | (n : ℕ) => by simp\n | .negSucc n => by simp [← sub_eq_add_neg]\n\n@[scoped simp]","module_header":true,"namespace":"AddConstMapClass","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Action.Pi\npublic import Mathlib.Algebra.Group.End\npublic import Mathlib.Algebra.Module.NatInt\npublic import Mathlib.Algebra.Order.Archimedean.Basic\nimport Mathlib.Algebra.Order.Group.Basic\n\nNamespace:\nAddConstMapClass\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n := by simp\n\ntheorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) :=\n map_nat_add f n x\n\n@[scoped simp]\ntheorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b := by\n conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]\n\n@[scoped simp]\ntheorem map_sub_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (x - a) = f x - b := by\n simpa using map_sub_nsmul f x 1\n\ntheorem map_sub_one [AddGroup G] [One G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x - 1) = f x - b :=\n map_sub_const f x\n\n@[scoped simp]\ntheorem map_sub_nat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x - n) = f x - n • b := by\n simpa using map_sub_nsmul f x n\n\n@[scoped simp]\ntheorem map_sub_ofNat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x - ofNat(n)) = f x - ofNat(n) • b :=\n map_sub_nat' f x n\n\n@[scoped simp]\ntheorem map_add_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : ∀ n : ℤ, f (x + n • a) = f x + n • b\n | (n : ℕ) => by simp\n | .negSucc n => by simp [← sub_eq_add_neg]\n\n@[scoped simp]\n\nTarget:\ntheorem map_zsmul_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (n : ℤ) : f (n • a) = f 0 + n • b :=\n\nProof body:\n","proof_body":"by\n simpa using map_add_zsmul f 0 n","provenance":{"declaration_index":26,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"976709af1494098e2290d3c3a6a052dad499a43ec44c3bd6016d3ce147bb9165","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/AddConstMap/Basic.lean"},"sample_id":"c7b53bccd0666a27bb59bab747e9544e461f711b770fde767b06f16786e2a042","schema_version":1,"split":"train","theorem_statement":"theorem map_zsmul_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (n : ℤ) : f (n • a) = f 0 + n • b :="} {"completion":"by\n rw [← map_add_zsmul f x n, zsmul_one]","context_contains_namespace":true,"context_suffix":"end AddConstMapClass","dependency_ids":["import:Mathlib.Algebra.Group.Action.Pi","import:Mathlib.Algebra.Group.End","import:Mathlib.Algebra.Module.NatInt","import:Mathlib.Algebra.Order.Archimedean.Basic","import:Mathlib.Algebra.Order.Group.Basic"],"family_id":"map_add_int","file_id":"mathlib/Mathlib/Algebra/AddConstMap/Basic.lean","imports":["public import Mathlib.Algebra.Group.Action.Pi","public import Mathlib.Algebra.Group.End","public import Mathlib.Algebra.Module.NatInt","public import Mathlib.Algebra.Order.Archimedean.Basic","import Mathlib.Algebra.Order.Group.Basic"],"local_context":"/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n := by simp\n\ntheorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) :=\n map_nat_add f n x\n\n@[scoped simp]\ntheorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b := by\n conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]\n\n@[scoped simp]\ntheorem map_sub_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (x - a) = f x - b := by\n simpa using map_sub_nsmul f x 1\n\ntheorem map_sub_one [AddGroup G] [One G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x - 1) = f x - b :=\n map_sub_const f x\n\n@[scoped simp]\ntheorem map_sub_nat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x - n) = f x - n • b := by\n simpa using map_sub_nsmul f x n\n\n@[scoped simp]\ntheorem map_sub_ofNat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x - ofNat(n)) = f x - ofNat(n) • b :=\n map_sub_nat' f x n\n\n@[scoped simp]\ntheorem map_add_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : ∀ n : ℤ, f (x + n • a) = f x + n • b\n | (n : ℕ) => by simp\n | .negSucc n => by simp [← sub_eq_add_neg]\n\n@[scoped simp]\ntheorem map_zsmul_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (n : ℤ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_zsmul f 0 n\n\n@[scoped simp]","module_header":true,"namespace":"AddConstMapClass","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Action.Pi\npublic import Mathlib.Algebra.Group.End\npublic import Mathlib.Algebra.Module.NatInt\npublic import Mathlib.Algebra.Order.Archimedean.Basic\nimport Mathlib.Algebra.Order.Group.Basic\n\nNamespace:\nAddConstMapClass\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n := by simp\n\ntheorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) :=\n map_nat_add f n x\n\n@[scoped simp]\ntheorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b := by\n conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]\n\n@[scoped simp]\ntheorem map_sub_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (x - a) = f x - b := by\n simpa using map_sub_nsmul f x 1\n\ntheorem map_sub_one [AddGroup G] [One G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x - 1) = f x - b :=\n map_sub_const f x\n\n@[scoped simp]\ntheorem map_sub_nat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x - n) = f x - n • b := by\n simpa using map_sub_nsmul f x n\n\n@[scoped simp]\ntheorem map_sub_ofNat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x - ofNat(n)) = f x - ofNat(n) • b :=\n map_sub_nat' f x n\n\n@[scoped simp]\ntheorem map_add_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : ∀ n : ℤ, f (x + n • a) = f x + n • b\n | (n : ℕ) => by simp\n | .negSucc n => by simp [← sub_eq_add_neg]\n\n@[scoped simp]\ntheorem map_zsmul_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (n : ℤ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_zsmul f 0 n\n\n@[scoped simp]\n\nTarget:\ntheorem map_add_int' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n • b :=\n\nProof body:\n","proof_body":"by\n rw [← map_add_zsmul f x n, zsmul_one]","provenance":{"declaration_index":27,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"976709af1494098e2290d3c3a6a052dad499a43ec44c3bd6016d3ce147bb9165","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/AddConstMap/Basic.lean"},"sample_id":"ba998e5b175c1fb2bc5298a867b85773ba1d5320d9b6c8718be1644fd5ca2ebe","schema_version":1,"split":"train","theorem_statement":"theorem map_add_int' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n • b :="} {"completion":"by simp","context_contains_namespace":true,"context_suffix":"end AddConstMapClass","dependency_ids":["import:Mathlib.Algebra.Group.Action.Pi","import:Mathlib.Algebra.Group.End","import:Mathlib.Algebra.Module.NatInt","import:Mathlib.Algebra.Order.Archimedean.Basic","import:Mathlib.Algebra.Order.Group.Basic"],"family_id":"map_add_int","file_id":"mathlib/Mathlib/Algebra/AddConstMap/Basic.lean","imports":["public import Mathlib.Algebra.Group.Action.Pi","public import Mathlib.Algebra.Group.End","public import Mathlib.Algebra.Module.NatInt","public import Mathlib.Algebra.Order.Archimedean.Basic","import Mathlib.Algebra.Order.Group.Basic"],"local_context":"/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n := by simp\n\ntheorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) :=\n map_nat_add f n x\n\n@[scoped simp]\ntheorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b := by\n conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]\n\n@[scoped simp]\ntheorem map_sub_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (x - a) = f x - b := by\n simpa using map_sub_nsmul f x 1\n\ntheorem map_sub_one [AddGroup G] [One G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x - 1) = f x - b :=\n map_sub_const f x\n\n@[scoped simp]\ntheorem map_sub_nat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x - n) = f x - n • b := by\n simpa using map_sub_nsmul f x n\n\n@[scoped simp]\ntheorem map_sub_ofNat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x - ofNat(n)) = f x - ofNat(n) • b :=\n map_sub_nat' f x n\n\n@[scoped simp]\ntheorem map_add_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : ∀ n : ℤ, f (x + n • a) = f x + n • b\n | (n : ℕ) => by simp\n | .negSucc n => by simp [← sub_eq_add_neg]\n\n@[scoped simp]\ntheorem map_zsmul_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (n : ℤ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_zsmul f 0 n\n\n@[scoped simp]\ntheorem map_add_int' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n • b := by\n rw [← map_add_zsmul f x n, zsmul_one]","module_header":true,"namespace":"AddConstMapClass","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Action.Pi\npublic import Mathlib.Algebra.Group.End\npublic import Mathlib.Algebra.Module.NatInt\npublic import Mathlib.Algebra.Order.Archimedean.Basic\nimport Mathlib.Algebra.Order.Group.Basic\n\nNamespace:\nAddConstMapClass\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n := by simp\n\ntheorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) :=\n map_nat_add f n x\n\n@[scoped simp]\ntheorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b := by\n conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]\n\n@[scoped simp]\ntheorem map_sub_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (x - a) = f x - b := by\n simpa using map_sub_nsmul f x 1\n\ntheorem map_sub_one [AddGroup G] [One G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x - 1) = f x - b :=\n map_sub_const f x\n\n@[scoped simp]\ntheorem map_sub_nat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x - n) = f x - n • b := by\n simpa using map_sub_nsmul f x n\n\n@[scoped simp]\ntheorem map_sub_ofNat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x - ofNat(n)) = f x - ofNat(n) • b :=\n map_sub_nat' f x n\n\n@[scoped simp]\ntheorem map_add_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : ∀ n : ℤ, f (x + n • a) = f x + n • b\n | (n : ℕ) => by simp\n | .negSucc n => by simp [← sub_eq_add_neg]\n\n@[scoped simp]\ntheorem map_zsmul_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (n : ℤ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_zsmul f 0 n\n\n@[scoped simp]\ntheorem map_add_int' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n • b := by\n rw [← map_add_zsmul f x n, zsmul_one]\n\nTarget:\ntheorem map_add_int [AddGroupWithOne G] [AddGroupWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n :=\n\nProof body:\n","proof_body":"by simp","provenance":{"declaration_index":28,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"976709af1494098e2290d3c3a6a052dad499a43ec44c3bd6016d3ce147bb9165","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/AddConstMap/Basic.lean"},"sample_id":"e7d8c064297b792eaacdf34977f6f94826f12d85f00e4f869f443014914f8e77","schema_version":1,"split":"train","theorem_statement":"theorem map_add_int [AddGroupWithOne G] [AddGroupWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n :="} {"completion":"by\n simpa [sub_eq_add_neg] using map_add_zsmul f x (-n)","context_contains_namespace":true,"context_suffix":"end AddConstMapClass","dependency_ids":["import:Mathlib.Algebra.Group.Action.Pi","import:Mathlib.Algebra.Group.End","import:Mathlib.Algebra.Module.NatInt","import:Mathlib.Algebra.Order.Archimedean.Basic","import:Mathlib.Algebra.Order.Group.Basic"],"family_id":"map_sub_zsmul","file_id":"mathlib/Mathlib/Algebra/AddConstMap/Basic.lean","imports":["public import Mathlib.Algebra.Group.Action.Pi","public import Mathlib.Algebra.Group.End","public import Mathlib.Algebra.Module.NatInt","public import Mathlib.Algebra.Order.Archimedean.Basic","import Mathlib.Algebra.Order.Group.Basic"],"local_context":"/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n := by simp\n\ntheorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) :=\n map_nat_add f n x\n\n@[scoped simp]\ntheorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b := by\n conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]\n\n@[scoped simp]\ntheorem map_sub_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (x - a) = f x - b := by\n simpa using map_sub_nsmul f x 1\n\ntheorem map_sub_one [AddGroup G] [One G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x - 1) = f x - b :=\n map_sub_const f x\n\n@[scoped simp]\ntheorem map_sub_nat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x - n) = f x - n • b := by\n simpa using map_sub_nsmul f x n\n\n@[scoped simp]\ntheorem map_sub_ofNat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x - ofNat(n)) = f x - ofNat(n) • b :=\n map_sub_nat' f x n\n\n@[scoped simp]\ntheorem map_add_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : ∀ n : ℤ, f (x + n • a) = f x + n • b\n | (n : ℕ) => by simp\n | .negSucc n => by simp [← sub_eq_add_neg]\n\n@[scoped simp]\ntheorem map_zsmul_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (n : ℤ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_zsmul f 0 n\n\n@[scoped simp]\ntheorem map_add_int' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n • b := by\n rw [← map_add_zsmul f x n, zsmul_one]\n\ntheorem map_add_int [AddGroupWithOne G] [AddGroupWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n := by simp\n\n@[scoped simp]","module_header":true,"namespace":"AddConstMapClass","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Action.Pi\npublic import Mathlib.Algebra.Group.End\npublic import Mathlib.Algebra.Module.NatInt\npublic import Mathlib.Algebra.Order.Archimedean.Basic\nimport Mathlib.Algebra.Order.Group.Basic\n\nNamespace:\nAddConstMapClass\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n := by simp\n\ntheorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) :=\n map_nat_add f n x\n\n@[scoped simp]\ntheorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b := by\n conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]\n\n@[scoped simp]\ntheorem map_sub_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (x - a) = f x - b := by\n simpa using map_sub_nsmul f x 1\n\ntheorem map_sub_one [AddGroup G] [One G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x - 1) = f x - b :=\n map_sub_const f x\n\n@[scoped simp]\ntheorem map_sub_nat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x - n) = f x - n • b := by\n simpa using map_sub_nsmul f x n\n\n@[scoped simp]\ntheorem map_sub_ofNat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x - ofNat(n)) = f x - ofNat(n) • b :=\n map_sub_nat' f x n\n\n@[scoped simp]\ntheorem map_add_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : ∀ n : ℤ, f (x + n • a) = f x + n • b\n | (n : ℕ) => by simp\n | .negSucc n => by simp [← sub_eq_add_neg]\n\n@[scoped simp]\ntheorem map_zsmul_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (n : ℤ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_zsmul f 0 n\n\n@[scoped simp]\ntheorem map_add_int' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n • b := by\n rw [← map_add_zsmul f x n, zsmul_one]\n\ntheorem map_add_int [AddGroupWithOne G] [AddGroupWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n := by simp\n\n@[scoped simp]\n\nTarget:\ntheorem map_sub_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℤ) : f (x - n • a) = f x - n • b :=\n\nProof body:\n","proof_body":"by\n simpa [sub_eq_add_neg] using map_add_zsmul f x (-n)","provenance":{"declaration_index":29,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"976709af1494098e2290d3c3a6a052dad499a43ec44c3bd6016d3ce147bb9165","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/AddConstMap/Basic.lean"},"sample_id":"7f4b4bcb2823f43ccc8e74f987f4a4a96a937ef62af67cd4033c8d865542d6f5","schema_version":1,"split":"train","theorem_statement":"theorem map_sub_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℤ) : f (x - n • a) = f x - n • b :="} {"completion":"by\n rw [← map_sub_zsmul, zsmul_one]","context_contains_namespace":true,"context_suffix":"end AddConstMapClass","dependency_ids":["import:Mathlib.Algebra.Group.Action.Pi","import:Mathlib.Algebra.Group.End","import:Mathlib.Algebra.Module.NatInt","import:Mathlib.Algebra.Order.Archimedean.Basic","import:Mathlib.Algebra.Order.Group.Basic"],"family_id":"map_sub_int","file_id":"mathlib/Mathlib/Algebra/AddConstMap/Basic.lean","imports":["public import Mathlib.Algebra.Group.Action.Pi","public import Mathlib.Algebra.Group.End","public import Mathlib.Algebra.Module.NatInt","public import Mathlib.Algebra.Order.Archimedean.Basic","import Mathlib.Algebra.Order.Group.Basic"],"local_context":"/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n := by simp\n\ntheorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) :=\n map_nat_add f n x\n\n@[scoped simp]\ntheorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b := by\n conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]\n\n@[scoped simp]\ntheorem map_sub_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (x - a) = f x - b := by\n simpa using map_sub_nsmul f x 1\n\ntheorem map_sub_one [AddGroup G] [One G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x - 1) = f x - b :=\n map_sub_const f x\n\n@[scoped simp]\ntheorem map_sub_nat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x - n) = f x - n • b := by\n simpa using map_sub_nsmul f x n\n\n@[scoped simp]\ntheorem map_sub_ofNat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x - ofNat(n)) = f x - ofNat(n) • b :=\n map_sub_nat' f x n\n\n@[scoped simp]\ntheorem map_add_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : ∀ n : ℤ, f (x + n • a) = f x + n • b\n | (n : ℕ) => by simp\n | .negSucc n => by simp [← sub_eq_add_neg]\n\n@[scoped simp]\ntheorem map_zsmul_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (n : ℤ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_zsmul f 0 n\n\n@[scoped simp]\ntheorem map_add_int' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n • b := by\n rw [← map_add_zsmul f x n, zsmul_one]\n\ntheorem map_add_int [AddGroupWithOne G] [AddGroupWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n := by simp\n\n@[scoped simp]\ntheorem map_sub_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℤ) : f (x - n • a) = f x - n • b := by\n simpa [sub_eq_add_neg] using map_add_zsmul f x (-n)\n\n@[scoped simp]","module_header":true,"namespace":"AddConstMapClass","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Action.Pi\npublic import Mathlib.Algebra.Group.End\npublic import Mathlib.Algebra.Module.NatInt\npublic import Mathlib.Algebra.Order.Archimedean.Basic\nimport Mathlib.Algebra.Order.Group.Basic\n\nNamespace:\nAddConstMapClass\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n := by simp\n\ntheorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) :=\n map_nat_add f n x\n\n@[scoped simp]\ntheorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b := by\n conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]\n\n@[scoped simp]\ntheorem map_sub_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (x - a) = f x - b := by\n simpa using map_sub_nsmul f x 1\n\ntheorem map_sub_one [AddGroup G] [One G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x - 1) = f x - b :=\n map_sub_const f x\n\n@[scoped simp]\ntheorem map_sub_nat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x - n) = f x - n • b := by\n simpa using map_sub_nsmul f x n\n\n@[scoped simp]\ntheorem map_sub_ofNat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x - ofNat(n)) = f x - ofNat(n) • b :=\n map_sub_nat' f x n\n\n@[scoped simp]\ntheorem map_add_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : ∀ n : ℤ, f (x + n • a) = f x + n • b\n | (n : ℕ) => by simp\n | .negSucc n => by simp [← sub_eq_add_neg]\n\n@[scoped simp]\ntheorem map_zsmul_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (n : ℤ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_zsmul f 0 n\n\n@[scoped simp]\ntheorem map_add_int' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n • b := by\n rw [← map_add_zsmul f x n, zsmul_one]\n\ntheorem map_add_int [AddGroupWithOne G] [AddGroupWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n := by simp\n\n@[scoped simp]\ntheorem map_sub_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℤ) : f (x - n • a) = f x - n • b := by\n simpa [sub_eq_add_neg] using map_add_zsmul f x (-n)\n\n@[scoped simp]\n\nTarget:\ntheorem map_sub_int' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℤ) : f (x - n) = f x - n • b :=\n\nProof body:\n","proof_body":"by\n rw [← map_sub_zsmul, zsmul_one]","provenance":{"declaration_index":30,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"976709af1494098e2290d3c3a6a052dad499a43ec44c3bd6016d3ce147bb9165","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/AddConstMap/Basic.lean"},"sample_id":"96701466619236e71d82355609e2ce791fb7b340812f53d77e7869ba94fff08f","schema_version":1,"split":"train","theorem_statement":"theorem map_sub_int' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℤ) : f (x - n) = f x - n • b :="} {"completion":"by simp","context_contains_namespace":true,"context_suffix":"end AddConstMapClass","dependency_ids":["import:Mathlib.Algebra.Group.Action.Pi","import:Mathlib.Algebra.Group.End","import:Mathlib.Algebra.Module.NatInt","import:Mathlib.Algebra.Order.Archimedean.Basic","import:Mathlib.Algebra.Order.Group.Basic"],"family_id":"map_sub_int","file_id":"mathlib/Mathlib/Algebra/AddConstMap/Basic.lean","imports":["public import Mathlib.Algebra.Group.Action.Pi","public import Mathlib.Algebra.Group.End","public import Mathlib.Algebra.Module.NatInt","public import Mathlib.Algebra.Order.Archimedean.Basic","import Mathlib.Algebra.Order.Group.Basic"],"local_context":"/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n := by simp\n\ntheorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) :=\n map_nat_add f n x\n\n@[scoped simp]\ntheorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b := by\n conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]\n\n@[scoped simp]\ntheorem map_sub_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (x - a) = f x - b := by\n simpa using map_sub_nsmul f x 1\n\ntheorem map_sub_one [AddGroup G] [One G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x - 1) = f x - b :=\n map_sub_const f x\n\n@[scoped simp]\ntheorem map_sub_nat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x - n) = f x - n • b := by\n simpa using map_sub_nsmul f x n\n\n@[scoped simp]\ntheorem map_sub_ofNat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x - ofNat(n)) = f x - ofNat(n) • b :=\n map_sub_nat' f x n\n\n@[scoped simp]\ntheorem map_add_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : ∀ n : ℤ, f (x + n • a) = f x + n • b\n | (n : ℕ) => by simp\n | .negSucc n => by simp [← sub_eq_add_neg]\n\n@[scoped simp]\ntheorem map_zsmul_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (n : ℤ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_zsmul f 0 n\n\n@[scoped simp]\ntheorem map_add_int' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n • b := by\n rw [← map_add_zsmul f x n, zsmul_one]\n\ntheorem map_add_int [AddGroupWithOne G] [AddGroupWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n := by simp\n\n@[scoped simp]\ntheorem map_sub_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℤ) : f (x - n • a) = f x - n • b := by\n simpa [sub_eq_add_neg] using map_add_zsmul f x (-n)\n\n@[scoped simp]\ntheorem map_sub_int' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℤ) : f (x - n) = f x - n • b := by\n rw [← map_sub_zsmul, zsmul_one]","module_header":true,"namespace":"AddConstMapClass","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Action.Pi\npublic import Mathlib.Algebra.Group.End\npublic import Mathlib.Algebra.Module.NatInt\npublic import Mathlib.Algebra.Order.Archimedean.Basic\nimport Mathlib.Algebra.Order.Group.Basic\n\nNamespace:\nAddConstMapClass\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n := by simp\n\ntheorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) :=\n map_nat_add f n x\n\n@[scoped simp]\ntheorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b := by\n conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]\n\n@[scoped simp]\ntheorem map_sub_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (x - a) = f x - b := by\n simpa using map_sub_nsmul f x 1\n\ntheorem map_sub_one [AddGroup G] [One G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x - 1) = f x - b :=\n map_sub_const f x\n\n@[scoped simp]\ntheorem map_sub_nat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x - n) = f x - n • b := by\n simpa using map_sub_nsmul f x n\n\n@[scoped simp]\ntheorem map_sub_ofNat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x - ofNat(n)) = f x - ofNat(n) • b :=\n map_sub_nat' f x n\n\n@[scoped simp]\ntheorem map_add_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : ∀ n : ℤ, f (x + n • a) = f x + n • b\n | (n : ℕ) => by simp\n | .negSucc n => by simp [← sub_eq_add_neg]\n\n@[scoped simp]\ntheorem map_zsmul_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (n : ℤ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_zsmul f 0 n\n\n@[scoped simp]\ntheorem map_add_int' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n • b := by\n rw [← map_add_zsmul f x n, zsmul_one]\n\ntheorem map_add_int [AddGroupWithOne G] [AddGroupWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n := by simp\n\n@[scoped simp]\ntheorem map_sub_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℤ) : f (x - n • a) = f x - n • b := by\n simpa [sub_eq_add_neg] using map_add_zsmul f x (-n)\n\n@[scoped simp]\ntheorem map_sub_int' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℤ) : f (x - n) = f x - n • b := by\n rw [← map_sub_zsmul, zsmul_one]\n\nTarget:\ntheorem map_sub_int [AddGroupWithOne G] [AddGroupWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℤ) : f (x - n) = f x - n :=\n\nProof body:\n","proof_body":"by simp","provenance":{"declaration_index":31,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"976709af1494098e2290d3c3a6a052dad499a43ec44c3bd6016d3ce147bb9165","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/AddConstMap/Basic.lean"},"sample_id":"096e45d574e5fdccd52e6da73dc0ce051466b6871d1ac4757ec0ec301c36f9a3","schema_version":1,"split":"train","theorem_statement":"theorem map_sub_int [AddGroupWithOne G] [AddGroupWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℤ) : f (x - n) = f x - n :="} {"completion":"by\n rw [add_comm, map_add_zsmul]","context_contains_namespace":true,"context_suffix":"end AddConstMapClass","dependency_ids":["import:Mathlib.Algebra.Group.Action.Pi","import:Mathlib.Algebra.Group.End","import:Mathlib.Algebra.Module.NatInt","import:Mathlib.Algebra.Order.Archimedean.Basic","import:Mathlib.Algebra.Order.Group.Basic"],"family_id":"map_zsmul_add","file_id":"mathlib/Mathlib/Algebra/AddConstMap/Basic.lean","imports":["public import Mathlib.Algebra.Group.Action.Pi","public import Mathlib.Algebra.Group.End","public import Mathlib.Algebra.Module.NatInt","public import Mathlib.Algebra.Order.Archimedean.Basic","import Mathlib.Algebra.Order.Group.Basic"],"local_context":"/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n := by simp\n\ntheorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) :=\n map_nat_add f n x\n\n@[scoped simp]\ntheorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b := by\n conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]\n\n@[scoped simp]\ntheorem map_sub_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (x - a) = f x - b := by\n simpa using map_sub_nsmul f x 1\n\ntheorem map_sub_one [AddGroup G] [One G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x - 1) = f x - b :=\n map_sub_const f x\n\n@[scoped simp]\ntheorem map_sub_nat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x - n) = f x - n • b := by\n simpa using map_sub_nsmul f x n\n\n@[scoped simp]\ntheorem map_sub_ofNat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x - ofNat(n)) = f x - ofNat(n) • b :=\n map_sub_nat' f x n\n\n@[scoped simp]\ntheorem map_add_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : ∀ n : ℤ, f (x + n • a) = f x + n • b\n | (n : ℕ) => by simp\n | .negSucc n => by simp [← sub_eq_add_neg]\n\n@[scoped simp]\ntheorem map_zsmul_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (n : ℤ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_zsmul f 0 n\n\n@[scoped simp]\ntheorem map_add_int' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n • b := by\n rw [← map_add_zsmul f x n, zsmul_one]\n\ntheorem map_add_int [AddGroupWithOne G] [AddGroupWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n := by simp\n\n@[scoped simp]\ntheorem map_sub_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℤ) : f (x - n • a) = f x - n • b := by\n simpa [sub_eq_add_neg] using map_add_zsmul f x (-n)\n\n@[scoped simp]\ntheorem map_sub_int' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℤ) : f (x - n) = f x - n • b := by\n rw [← map_sub_zsmul, zsmul_one]\n\ntheorem map_sub_int [AddGroupWithOne G] [AddGroupWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℤ) : f (x - n) = f x - n := by simp\n\n@[scoped simp]","module_header":true,"namespace":"AddConstMapClass","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Action.Pi\npublic import Mathlib.Algebra.Group.End\npublic import Mathlib.Algebra.Module.NatInt\npublic import Mathlib.Algebra.Order.Archimedean.Basic\nimport Mathlib.Algebra.Order.Group.Basic\n\nNamespace:\nAddConstMapClass\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n := by simp\n\ntheorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) :=\n map_nat_add f n x\n\n@[scoped simp]\ntheorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b := by\n conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]\n\n@[scoped simp]\ntheorem map_sub_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (x - a) = f x - b := by\n simpa using map_sub_nsmul f x 1\n\ntheorem map_sub_one [AddGroup G] [One G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x - 1) = f x - b :=\n map_sub_const f x\n\n@[scoped simp]\ntheorem map_sub_nat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x - n) = f x - n • b := by\n simpa using map_sub_nsmul f x n\n\n@[scoped simp]\ntheorem map_sub_ofNat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x - ofNat(n)) = f x - ofNat(n) • b :=\n map_sub_nat' f x n\n\n@[scoped simp]\ntheorem map_add_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : ∀ n : ℤ, f (x + n • a) = f x + n • b\n | (n : ℕ) => by simp\n | .negSucc n => by simp [← sub_eq_add_neg]\n\n@[scoped simp]\ntheorem map_zsmul_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (n : ℤ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_zsmul f 0 n\n\n@[scoped simp]\ntheorem map_add_int' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n • b := by\n rw [← map_add_zsmul f x n, zsmul_one]\n\ntheorem map_add_int [AddGroupWithOne G] [AddGroupWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n := by simp\n\n@[scoped simp]\ntheorem map_sub_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℤ) : f (x - n • a) = f x - n • b := by\n simpa [sub_eq_add_neg] using map_add_zsmul f x (-n)\n\n@[scoped simp]\ntheorem map_sub_int' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℤ) : f (x - n) = f x - n • b := by\n rw [← map_sub_zsmul, zsmul_one]\n\ntheorem map_sub_int [AddGroupWithOne G] [AddGroupWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℤ) : f (x - n) = f x - n := by simp\n\n@[scoped simp]\n\nTarget:\ntheorem map_zsmul_add [AddCommGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (n : ℤ) (x : G) : f (n • a + x) = f x + n • b :=\n\nProof body:\n","proof_body":"by\n rw [add_comm, map_add_zsmul]","provenance":{"declaration_index":32,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"976709af1494098e2290d3c3a6a052dad499a43ec44c3bd6016d3ce147bb9165","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/AddConstMap/Basic.lean"},"sample_id":"319bb0f54101e2a3d0d01be6903b19186afab73b8a6399b1d95b3513ae867a75","schema_version":1,"split":"train","theorem_statement":"theorem map_zsmul_add [AddCommGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (n : ℤ) (x : G) : f (n • a + x) = f x + n • b :="} {"completion":"by\n rw [← map_zsmul_add, zsmul_one]","context_contains_namespace":true,"context_suffix":"end AddConstMapClass","dependency_ids":["import:Mathlib.Algebra.Group.Action.Pi","import:Mathlib.Algebra.Group.End","import:Mathlib.Algebra.Module.NatInt","import:Mathlib.Algebra.Order.Archimedean.Basic","import:Mathlib.Algebra.Order.Group.Basic"],"family_id":"map_int_add","file_id":"mathlib/Mathlib/Algebra/AddConstMap/Basic.lean","imports":["public import Mathlib.Algebra.Group.Action.Pi","public import Mathlib.Algebra.Group.End","public import Mathlib.Algebra.Module.NatInt","public import Mathlib.Algebra.Order.Archimedean.Basic","import Mathlib.Algebra.Order.Group.Basic"],"local_context":"/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n := by simp\n\ntheorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) :=\n map_nat_add f n x\n\n@[scoped simp]\ntheorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b := by\n conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]\n\n@[scoped simp]\ntheorem map_sub_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (x - a) = f x - b := by\n simpa using map_sub_nsmul f x 1\n\ntheorem map_sub_one [AddGroup G] [One G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x - 1) = f x - b :=\n map_sub_const f x\n\n@[scoped simp]\ntheorem map_sub_nat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x - n) = f x - n • b := by\n simpa using map_sub_nsmul f x n\n\n@[scoped simp]\ntheorem map_sub_ofNat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x - ofNat(n)) = f x - ofNat(n) • b :=\n map_sub_nat' f x n\n\n@[scoped simp]\ntheorem map_add_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : ∀ n : ℤ, f (x + n • a) = f x + n • b\n | (n : ℕ) => by simp\n | .negSucc n => by simp [← sub_eq_add_neg]\n\n@[scoped simp]\ntheorem map_zsmul_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (n : ℤ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_zsmul f 0 n\n\n@[scoped simp]\ntheorem map_add_int' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n • b := by\n rw [← map_add_zsmul f x n, zsmul_one]\n\ntheorem map_add_int [AddGroupWithOne G] [AddGroupWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n := by simp\n\n@[scoped simp]\ntheorem map_sub_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℤ) : f (x - n • a) = f x - n • b := by\n simpa [sub_eq_add_neg] using map_add_zsmul f x (-n)\n\n@[scoped simp]\ntheorem map_sub_int' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℤ) : f (x - n) = f x - n • b := by\n rw [← map_sub_zsmul, zsmul_one]\n\ntheorem map_sub_int [AddGroupWithOne G] [AddGroupWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℤ) : f (x - n) = f x - n := by simp\n\n@[scoped simp]\ntheorem map_zsmul_add [AddCommGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (n : ℤ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_zsmul]\n\n@[scoped simp]","module_header":true,"namespace":"AddConstMapClass","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Action.Pi\npublic import Mathlib.Algebra.Group.End\npublic import Mathlib.Algebra.Module.NatInt\npublic import Mathlib.Algebra.Order.Archimedean.Basic\nimport Mathlib.Algebra.Order.Group.Basic\n\nNamespace:\nAddConstMapClass\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n := by simp\n\ntheorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) :=\n map_nat_add f n x\n\n@[scoped simp]\ntheorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b := by\n conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]\n\n@[scoped simp]\ntheorem map_sub_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (x - a) = f x - b := by\n simpa using map_sub_nsmul f x 1\n\ntheorem map_sub_one [AddGroup G] [One G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x - 1) = f x - b :=\n map_sub_const f x\n\n@[scoped simp]\ntheorem map_sub_nat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x - n) = f x - n • b := by\n simpa using map_sub_nsmul f x n\n\n@[scoped simp]\ntheorem map_sub_ofNat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x - ofNat(n)) = f x - ofNat(n) • b :=\n map_sub_nat' f x n\n\n@[scoped simp]\ntheorem map_add_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : ∀ n : ℤ, f (x + n • a) = f x + n • b\n | (n : ℕ) => by simp\n | .negSucc n => by simp [← sub_eq_add_neg]\n\n@[scoped simp]\ntheorem map_zsmul_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (n : ℤ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_zsmul f 0 n\n\n@[scoped simp]\ntheorem map_add_int' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n • b := by\n rw [← map_add_zsmul f x n, zsmul_one]\n\ntheorem map_add_int [AddGroupWithOne G] [AddGroupWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n := by simp\n\n@[scoped simp]\ntheorem map_sub_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℤ) : f (x - n • a) = f x - n • b := by\n simpa [sub_eq_add_neg] using map_add_zsmul f x (-n)\n\n@[scoped simp]\ntheorem map_sub_int' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℤ) : f (x - n) = f x - n • b := by\n rw [← map_sub_zsmul, zsmul_one]\n\ntheorem map_sub_int [AddGroupWithOne G] [AddGroupWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℤ) : f (x - n) = f x - n := by simp\n\n@[scoped simp]\ntheorem map_zsmul_add [AddCommGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (n : ℤ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_zsmul]\n\n@[scoped simp]\n\nTarget:\ntheorem map_int_add' [AddCommGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℤ) (x : G) : f (↑n + x) = f x + n • b :=\n\nProof body:\n","proof_body":"by\n rw [← map_zsmul_add, zsmul_one]","provenance":{"declaration_index":33,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"976709af1494098e2290d3c3a6a052dad499a43ec44c3bd6016d3ce147bb9165","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/AddConstMap/Basic.lean"},"sample_id":"277b0c12c1066077dd7e80e99b0a587f8a91fba7ac5455a831e41c676275cce6","schema_version":1,"split":"train","theorem_statement":"theorem map_int_add' [AddCommGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℤ) (x : G) : f (↑n + x) = f x + n • b :="} {"completion":"by simp","context_contains_namespace":true,"context_suffix":"end AddConstMapClass","dependency_ids":["import:Mathlib.Algebra.Group.Action.Pi","import:Mathlib.Algebra.Group.End","import:Mathlib.Algebra.Module.NatInt","import:Mathlib.Algebra.Order.Archimedean.Basic","import:Mathlib.Algebra.Order.Group.Basic"],"family_id":"map_int_add","file_id":"mathlib/Mathlib/Algebra/AddConstMap/Basic.lean","imports":["public import Mathlib.Algebra.Group.Action.Pi","public import Mathlib.Algebra.Group.End","public import Mathlib.Algebra.Module.NatInt","public import Mathlib.Algebra.Order.Archimedean.Basic","import Mathlib.Algebra.Order.Group.Basic"],"local_context":"/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n := by simp\n\ntheorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) :=\n map_nat_add f n x\n\n@[scoped simp]\ntheorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b := by\n conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]\n\n@[scoped simp]\ntheorem map_sub_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (x - a) = f x - b := by\n simpa using map_sub_nsmul f x 1\n\ntheorem map_sub_one [AddGroup G] [One G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x - 1) = f x - b :=\n map_sub_const f x\n\n@[scoped simp]\ntheorem map_sub_nat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x - n) = f x - n • b := by\n simpa using map_sub_nsmul f x n\n\n@[scoped simp]\ntheorem map_sub_ofNat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x - ofNat(n)) = f x - ofNat(n) • b :=\n map_sub_nat' f x n\n\n@[scoped simp]\ntheorem map_add_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : ∀ n : ℤ, f (x + n • a) = f x + n • b\n | (n : ℕ) => by simp\n | .negSucc n => by simp [← sub_eq_add_neg]\n\n@[scoped simp]\ntheorem map_zsmul_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (n : ℤ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_zsmul f 0 n\n\n@[scoped simp]\ntheorem map_add_int' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n • b := by\n rw [← map_add_zsmul f x n, zsmul_one]\n\ntheorem map_add_int [AddGroupWithOne G] [AddGroupWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n := by simp\n\n@[scoped simp]\ntheorem map_sub_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℤ) : f (x - n • a) = f x - n • b := by\n simpa [sub_eq_add_neg] using map_add_zsmul f x (-n)\n\n@[scoped simp]\ntheorem map_sub_int' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℤ) : f (x - n) = f x - n • b := by\n rw [← map_sub_zsmul, zsmul_one]\n\ntheorem map_sub_int [AddGroupWithOne G] [AddGroupWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℤ) : f (x - n) = f x - n := by simp\n\n@[scoped simp]\ntheorem map_zsmul_add [AddCommGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (n : ℤ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_zsmul]\n\n@[scoped simp]\ntheorem map_int_add' [AddCommGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℤ) (x : G) : f (↑n + x) = f x + n • b := by\n rw [← map_zsmul_add, zsmul_one]","module_header":true,"namespace":"AddConstMapClass","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Group.Action.Pi\npublic import Mathlib.Algebra.Group.End\npublic import Mathlib.Algebra.Module.NatInt\npublic import Mathlib.Algebra.Order.Archimedean.Basic\nimport Mathlib.Algebra.Order.Group.Basic\n\nNamespace:\nAddConstMapClass\n\nLocal context:\n/-\nCopyright (c) 2024 Yury Kudryashov. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yury Kudryashov\n-/\n/-!\n# Maps (semi)conjugating a shift to a shift\n\nDenote by $S^1$ the unit circle `UnitAddCircle`.\nA common way to study a self-map $f\\colon S^1\\to S^1$ of degree `1`\nis to lift it to a map $\\tilde f\\colon \\mathbb R\\to \\mathbb R$\nsuch that $\\tilde f(x + 1) = \\tilde f(x)+1$ for all `x`.\n\nIn this file we define a structure and a typeclass\nfor bundled maps satisfying `f (x + a) = f x + b`.\n\nWe use parameters `a` and `b` instead of `1` to accommodate for two use cases:\n\n- maps between circles of different lengths;\n- self-maps $f\\colon S^1\\to S^1$ of degree other than one,\n including orientation-reversing maps.\n-/\n\n@[expose] public section\n\nassert_not_exists Finset\n\nopen Function Set\n\n/-- A bundled map `f : G → H` such that `f (x + a) = f x + b` for all `x`,\ndenoted as `f : G →+c[a, b] H`.\n\nOne can think about `f` as a lift to `G` of a map between two `AddCircle`s. -/\nstructure AddConstMap (G H : Type*) [Add G] [Add H] (a : G) (b : H) where\n /-- The underlying function of an `AddConstMap`.\n Use automatic coercion to function instead. -/\n protected toFun : G → H\n /-- An `AddConstMap` satisfies `f (x + a) = f x + b`. Use `map_add_const` instead. -/\n map_add_const' (x : G) : toFun (x + a) = toFun x + b\n\n@[inherit_doc]\nscoped[AddConstMap] notation:25 G \" →+c[\" a \", \" b \"] \" H => AddConstMap G H a b\n\n/-- Typeclass for maps satisfying `f (x + a) = f x + b`.\n\nNote that `a` and `b` are `outParam`s,\nso one should not add instances like\n`[AddConstMapClass F G H a b] : AddConstMapClass F G H (-a) (-b)`. -/\nclass AddConstMapClass (F : Type*) (G H : outParam Type*) [Add G] [Add H]\n (a : outParam G) (b : outParam H) [FunLike F G H] : Prop where\n /-- A map of `AddConstMapClass` class semiconjugates shift by `a` to the shift by `b`:\n `∀ x, f (x + a) = f x + b`. -/\n map_add_const (f : F) (x : G) : f (x + a) = f x + b\n\nnamespace AddConstMapClass\n\n/-!\n### Properties of `AddConstMapClass` maps\n\nIn this section we prove properties like `f (x + n • a) = f x + n • b`.\n-/\n\nscoped[AddConstMapClass] attribute [simp] map_add_const\n\nvariable {F G H : Type*} [FunLike F G H] {a : G} {b : H}\n\nprotected theorem semiconj [Add G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n Semiconj f (· + a) (· + b) :=\n map_add_const f\n\n@[scoped simp]\ntheorem map_add_nsmul [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x + n • a) = f x + n • b := by\n simpa using (AddConstMapClass.semiconj f).iterate_right n x\n\n@[scoped simp]\ntheorem map_add_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n • b := by simp [← map_add_nsmul]\n\ntheorem map_add_one [AddMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x + 1) = f x + b := map_add_const f x\n\n@[scoped simp]\ntheorem map_add_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + (ofNat(n) : ℕ) • b :=\n map_add_nat' f x n\n\ntheorem map_add_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) : f (x + n) = f x + n := by simp\n\ntheorem map_add_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x + ofNat(n)) = f x + ofNat(n) := map_add_nat f x n\n\n@[scoped simp]\ntheorem map_const [AddZeroClass G] [Add H] [AddConstMapClass F G H a b] (f : F) :\n f a = f 0 + b := by\n simpa using map_add_const f 0\n\ntheorem map_one [AddZeroClass G] [One G] [Add H] [AddConstMapClass F G H 1 b] (f : F) :\n f 1 = f 0 + b :=\n map_const f\n\n@[scoped simp]\ntheorem map_nsmul_const [AddMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_nsmul f 0 n\n\n@[scoped simp]\ntheorem map_nat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) : f n = f 0 + n • b := by\n simpa using map_add_nat' f 0 n\n\ntheorem map_ofNat' [AddMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f (ofNat(n)) = f 0 + (ofNat(n) : ℕ) • b :=\n map_nat' f n\n\ntheorem map_nat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) : f n = f 0 + n := by simp\n\ntheorem map_ofNat [AddMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] :\n f ofNat(n) = f 0 + ofNat(n) := map_nat f n\n\n@[scoped simp]\ntheorem map_const_add [AddCommMagma G] [Add H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (a + x) = f x + b := by\n rw [add_comm, map_add_const]\n\ntheorem map_one_add [AddCommMonoidWithOne G] [Add H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (1 + x) = f x + b := map_const_add f x\n\n@[scoped simp]\ntheorem map_nsmul_add [AddCommMonoid G] [AddMonoid H] [AddConstMapClass F G H a b]\n (f : F) (n : ℕ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_nsmul]\n\n@[scoped simp]\ntheorem map_nat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n • b := by\n simpa using map_nsmul_add f n x\n\ntheorem map_ofNat_add' [AddCommMonoidWithOne G] [AddMonoid H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) • b :=\n map_nat_add' f n x\n\ntheorem map_nat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) (x : G) : f (↑n + x) = f x + n := by simp\n\ntheorem map_ofNat_add [AddCommMonoidWithOne G] [AddMonoidWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℕ) [n.AtLeastTwo] (x : G) :\n f (ofNat(n) + x) = f x + ofNat(n) :=\n map_nat_add f n x\n\n@[scoped simp]\ntheorem map_sub_nsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℕ) : f (x - n • a) = f x - n • b := by\n conv_rhs => rw [← sub_add_cancel x (n • a), map_add_nsmul, add_sub_cancel_right]\n\n@[scoped simp]\ntheorem map_sub_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : f (x - a) = f x - b := by\n simpa using map_sub_nsmul f x 1\n\ntheorem map_sub_one [AddGroup G] [One G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) : f (x - 1) = f x - b :=\n map_sub_const f x\n\n@[scoped simp]\ntheorem map_sub_nat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) : f (x - n) = f x - n • b := by\n simpa using map_sub_nsmul f x n\n\n@[scoped simp]\ntheorem map_sub_ofNat' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℕ) [n.AtLeastTwo] :\n f (x - ofNat(n)) = f x - ofNat(n) • b :=\n map_sub_nat' f x n\n\n@[scoped simp]\ntheorem map_add_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) : ∀ n : ℤ, f (x + n • a) = f x + n • b\n | (n : ℕ) => by simp\n | .negSucc n => by simp [← sub_eq_add_neg]\n\n@[scoped simp]\ntheorem map_zsmul_const [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (n : ℤ) : f (n • a) = f 0 + n • b := by\n simpa using map_add_zsmul f 0 n\n\n@[scoped simp]\ntheorem map_add_int' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n • b := by\n rw [← map_add_zsmul f x n, zsmul_one]\n\ntheorem map_add_int [AddGroupWithOne G] [AddGroupWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℤ) : f (x + n) = f x + n := by simp\n\n@[scoped simp]\ntheorem map_sub_zsmul [AddGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (x : G) (n : ℤ) : f (x - n • a) = f x - n • b := by\n simpa [sub_eq_add_neg] using map_add_zsmul f x (-n)\n\n@[scoped simp]\ntheorem map_sub_int' [AddGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (x : G) (n : ℤ) : f (x - n) = f x - n • b := by\n rw [← map_sub_zsmul, zsmul_one]\n\ntheorem map_sub_int [AddGroupWithOne G] [AddGroupWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (x : G) (n : ℤ) : f (x - n) = f x - n := by simp\n\n@[scoped simp]\ntheorem map_zsmul_add [AddCommGroup G] [AddGroup H] [AddConstMapClass F G H a b]\n (f : F) (n : ℤ) (x : G) : f (n • a + x) = f x + n • b := by\n rw [add_comm, map_add_zsmul]\n\n@[scoped simp]\ntheorem map_int_add' [AddCommGroupWithOne G] [AddGroup H] [AddConstMapClass F G H 1 b]\n (f : F) (n : ℤ) (x : G) : f (↑n + x) = f x + n • b := by\n rw [← map_zsmul_add, zsmul_one]\n\nTarget:\ntheorem map_int_add [AddCommGroupWithOne G] [AddGroupWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℤ) (x : G) : f (↑n + x) = f x + n :=\n\nProof body:\n","proof_body":"by simp","provenance":{"declaration_index":34,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"976709af1494098e2290d3c3a6a052dad499a43ec44c3bd6016d3ce147bb9165","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/AddConstMap/Basic.lean"},"sample_id":"271bfc5c7587a649c6ac47dc07fc8077840e5a1fc456625eafa7d5b3e4606ec9","schema_version":1,"split":"train","theorem_statement":"theorem map_int_add [AddCommGroupWithOne G] [AddGroupWithOne H] [AddConstMapClass F G H 1 1]\n (f : F) (n : ℤ) (x : G) : f (↑n + x) = f x + n :="} {"completion":"by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]","context_contains_namespace":true,"context_suffix":"end ScalarSemiring\nend spectrum","dependency_ids":["import:Mathlib.Algebra.Algebra.Subalgebra.Basic","import:Mathlib.Algebra.Star.Pointwise","import:Mathlib.RingTheory.Ideal.Maps","import:Mathlib.RingTheory.Ideal.Nonunits","import:Mathlib.Tactic.NoncommRing"],"family_id":"mem_spectrum_iff_resolvent_zero","file_id":"mathlib/Mathlib/Algebra/Algebra/Spectrum/Basic.lean","imports":["public import Mathlib.Algebra.Algebra.Subalgebra.Basic","public import Mathlib.Algebra.Star.Pointwise","public import Mathlib.RingTheory.Ideal.Maps","public import Mathlib.RingTheory.Ideal.Nonunits","public import Mathlib.Tactic.NoncommRing"],"local_context":"/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)","module_header":true,"namespace":"spectrum","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Subalgebra.Basic\npublic import Mathlib.Algebra.Star.Pointwise\npublic import Mathlib.RingTheory.Ideal.Maps\npublic import Mathlib.RingTheory.Ideal.Nonunits\npublic import Mathlib.Tactic.NoncommRing\n\nNamespace:\nspectrum\n\nLocal context:\n/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\nTarget:\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 :=\n\nProof body:\n","proof_body":"by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]","provenance":{"declaration_index":2,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"6b8fb038fd170d1558b267f1b54fd6e008c9c0d4a0e402756920688d7daa0427","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Spectrum/Basic.lean"},"sample_id":"bf8d1d57d2a12f0b3d853688d7aa16de16a8be3a0552d463ae43468eb42ac7a1","schema_version":1,"split":"train","theorem_statement":"theorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 :="} {"completion":"by\n simp [mem_iff]\n\nvariable (R)","context_contains_namespace":true,"context_suffix":"end ScalarSemiring\nend spectrum","dependency_ids":["import:Mathlib.Algebra.Algebra.Subalgebra.Basic","import:Mathlib.Algebra.Star.Pointwise","import:Mathlib.RingTheory.Ideal.Maps","import:Mathlib.RingTheory.Ideal.Nonunits","import:Mathlib.Tactic.NoncommRing"],"family_id":"notmem_iff","file_id":"mathlib/Mathlib/Algebra/Algebra/Spectrum/Basic.lean","imports":["public import Mathlib.Algebra.Algebra.Subalgebra.Basic","public import Mathlib.Algebra.Star.Pointwise","public import Mathlib.RingTheory.Ideal.Maps","public import Mathlib.RingTheory.Ideal.Nonunits","public import Mathlib.Tactic.NoncommRing"],"local_context":"/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]","module_header":true,"namespace":"spectrum","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Subalgebra.Basic\npublic import Mathlib.Algebra.Star.Pointwise\npublic import Mathlib.RingTheory.Ideal.Maps\npublic import Mathlib.RingTheory.Ideal.Nonunits\npublic import Mathlib.Tactic.NoncommRing\n\nNamespace:\nspectrum\n\nLocal context:\n/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\nTarget:\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) :=\n\nProof body:\n","proof_body":"by\n simp [mem_iff]\n\nvariable (R)","provenance":{"declaration_index":3,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"6b8fb038fd170d1558b267f1b54fd6e008c9c0d4a0e402756920688d7daa0427","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Spectrum/Basic.lean"},"sample_id":"26749c159fe1e8683e694c40f6bd7827c019b8c3e534b53483c1a714f2874ae9","schema_version":1,"split":"train","theorem_statement":"theorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) :="} {"completion":"by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff","context_contains_namespace":true,"context_suffix":"end ScalarSemiring\nend spectrum","dependency_ids":["import:Mathlib.Algebra.Algebra.Subalgebra.Basic","import:Mathlib.Algebra.Star.Pointwise","import:Mathlib.RingTheory.Ideal.Maps","import:Mathlib.RingTheory.Ideal.Nonunits","import:Mathlib.Tactic.NoncommRing"],"family_id":"zero_mem_iff","file_id":"mathlib/Mathlib/Algebra/Algebra/Spectrum/Basic.lean","imports":["public import Mathlib.Algebra.Algebra.Subalgebra.Basic","public import Mathlib.Algebra.Star.Pointwise","public import Mathlib.RingTheory.Ideal.Maps","public import Mathlib.RingTheory.Ideal.Nonunits","public import Mathlib.Tactic.NoncommRing"],"local_context":"/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)","module_header":true,"namespace":"spectrum","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Subalgebra.Basic\npublic import Mathlib.Algebra.Star.Pointwise\npublic import Mathlib.RingTheory.Ideal.Maps\npublic import Mathlib.RingTheory.Ideal.Nonunits\npublic import Mathlib.Tactic.NoncommRing\n\nNamespace:\nspectrum\n\nLocal context:\n/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\nTarget:\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a :=\n\nProof body:\n","proof_body":"by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff","provenance":{"declaration_index":4,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"6b8fb038fd170d1558b267f1b54fd6e008c9c0d4a0e402756920688d7daa0427","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Spectrum/Basic.lean"},"sample_id":"a2787c55a81c73be8658cf1c3eb18fa9a2b3b6c3e33aa1136ffe9f80edd8979d","schema_version":1,"split":"train","theorem_statement":"theorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a :="} {"completion":"by\n rw [zero_mem_iff, Classical.not_not]\n\nalias ⟨isUnit_of_zero_notMem, zero_notMem⟩ := spectrum.zero_notMem_iff","context_contains_namespace":true,"context_suffix":"end ScalarSemiring\nend spectrum","dependency_ids":["import:Mathlib.Algebra.Algebra.Subalgebra.Basic","import:Mathlib.Algebra.Star.Pointwise","import:Mathlib.RingTheory.Ideal.Maps","import:Mathlib.RingTheory.Ideal.Nonunits","import:Mathlib.Tactic.NoncommRing"],"family_id":"zero_notmem_iff","file_id":"mathlib/Mathlib/Algebra/Algebra/Spectrum/Basic.lean","imports":["public import Mathlib.Algebra.Algebra.Subalgebra.Basic","public import Mathlib.Algebra.Star.Pointwise","public import Mathlib.RingTheory.Ideal.Maps","public import Mathlib.RingTheory.Ideal.Nonunits","public import Mathlib.Tactic.NoncommRing"],"local_context":"/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a := by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff","module_header":true,"namespace":"spectrum","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Subalgebra.Basic\npublic import Mathlib.Algebra.Star.Pointwise\npublic import Mathlib.RingTheory.Ideal.Maps\npublic import Mathlib.RingTheory.Ideal.Nonunits\npublic import Mathlib.Tactic.NoncommRing\n\nNamespace:\nspectrum\n\nLocal context:\n/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a := by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff\n\nTarget:\ntheorem zero_notMem_iff {a : A} : (0 : R) ∉ σ a ↔ IsUnit a :=\n\nProof body:\n","proof_body":"by\n rw [zero_mem_iff, Classical.not_not]\n\nalias ⟨isUnit_of_zero_notMem, zero_notMem⟩ := spectrum.zero_notMem_iff","provenance":{"declaration_index":5,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"6b8fb038fd170d1558b267f1b54fd6e008c9c0d4a0e402756920688d7daa0427","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Spectrum/Basic.lean"},"sample_id":"f1effe2ec03e1c974923405c548a659d01040b3a4382902893a449dfb27de8c3","schema_version":1,"split":"train","theorem_statement":"theorem zero_notMem_iff {a : A} : (0 : R) ∉ σ a ↔ IsUnit a :="} {"completion":"by\n simp only [spectrum.mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]\n\nprotected alias ⟨of_algebraMap_mem, algebraMap_mem⟩ := spectrum.algebraMap_mem_iff","context_contains_namespace":true,"context_suffix":"end ScalarSemiring\nend spectrum","dependency_ids":["import:Mathlib.Algebra.Algebra.Subalgebra.Basic","import:Mathlib.Algebra.Star.Pointwise","import:Mathlib.RingTheory.Ideal.Maps","import:Mathlib.RingTheory.Ideal.Nonunits","import:Mathlib.Tactic.NoncommRing"],"family_id":"algebramap_mem_iff","file_id":"mathlib/Mathlib/Algebra/Algebra/Spectrum/Basic.lean","imports":["public import Mathlib.Algebra.Algebra.Subalgebra.Basic","public import Mathlib.Algebra.Star.Pointwise","public import Mathlib.RingTheory.Ideal.Maps","public import Mathlib.RingTheory.Ideal.Nonunits","public import Mathlib.Tactic.NoncommRing"],"local_context":"/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a := by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff\n\ntheorem zero_notMem_iff {a : A} : (0 : R) ∉ σ a ↔ IsUnit a := by\n rw [zero_mem_iff, Classical.not_not]\n\nalias ⟨isUnit_of_zero_notMem, zero_notMem⟩ := spectrum.zero_notMem_iff\n\n@[simp]\nlemma _root_.Units.zero_notMem_spectrum (a : Aˣ) : 0 ∉ spectrum R (a : A) :=\n spectrum.zero_notMem R a.isUnit\n\nlemma subset_singleton_zero_compl {a : A} (ha : IsUnit a) : spectrum R a ⊆ {0}ᶜ :=\n Set.subset_compl_singleton_iff.mpr <| spectrum.zero_notMem R ha\n\nvariable {R}\n\ntheorem mem_resolventSet_of_left_right_inverse {r : R} {a b c : A} (h₁ : (↑ₐ r - a) * b = 1)\n (h₂ : c * (↑ₐ r - a) = 1) : r ∈ resolventSet R a :=\n Units.isUnit ⟨↑ₐ r - a, b, h₁, by rwa [← left_inv_eq_right_inv h₂ h₁]⟩\n\ntheorem mem_resolventSet_iff {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]","module_header":true,"namespace":"spectrum","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Subalgebra.Basic\npublic import Mathlib.Algebra.Star.Pointwise\npublic import Mathlib.RingTheory.Ideal.Maps\npublic import Mathlib.RingTheory.Ideal.Nonunits\npublic import Mathlib.Tactic.NoncommRing\n\nNamespace:\nspectrum\n\nLocal context:\n/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a := by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff\n\ntheorem zero_notMem_iff {a : A} : (0 : R) ∉ σ a ↔ IsUnit a := by\n rw [zero_mem_iff, Classical.not_not]\n\nalias ⟨isUnit_of_zero_notMem, zero_notMem⟩ := spectrum.zero_notMem_iff\n\n@[simp]\nlemma _root_.Units.zero_notMem_spectrum (a : Aˣ) : 0 ∉ spectrum R (a : A) :=\n spectrum.zero_notMem R a.isUnit\n\nlemma subset_singleton_zero_compl {a : A} (ha : IsUnit a) : spectrum R a ⊆ {0}ᶜ :=\n Set.subset_compl_singleton_iff.mpr <| spectrum.zero_notMem R ha\n\nvariable {R}\n\ntheorem mem_resolventSet_of_left_right_inverse {r : R} {a b c : A} (h₁ : (↑ₐ r - a) * b = 1)\n (h₂ : c * (↑ₐ r - a) = 1) : r ∈ resolventSet R a :=\n Units.isUnit ⟨↑ₐ r - a, b, h₁, by rwa [← left_inv_eq_right_inv h₂ h₁]⟩\n\ntheorem mem_resolventSet_iff {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\n\nTarget:\ntheorem algebraMap_mem_iff (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} {r : R} :\n algebraMap R S r ∈ spectrum S a ↔ r ∈ spectrum R a :=\n\nProof body:\n","proof_body":"by\n simp only [spectrum.mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]\n\nprotected alias ⟨of_algebraMap_mem, algebraMap_mem⟩ := spectrum.algebraMap_mem_iff","provenance":{"declaration_index":10,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"6b8fb038fd170d1558b267f1b54fd6e008c9c0d4a0e402756920688d7daa0427","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Spectrum/Basic.lean"},"sample_id":"01214ca315ceb1f1f2f29d7b3778efe5fcc426865e9a12290cf3e9c2778421ef","schema_version":1,"split":"train","theorem_statement":"theorem algebraMap_mem_iff (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} {r : R} :\n algebraMap R S r ∈ spectrum S a ↔ r ∈ spectrum R a :="} {"completion":"by\n simp_rw [resolventSet, Subsingleton.elim (algebraMap R A _ - a) 1, isUnit_one, Set.setOf_true]","context_contains_namespace":true,"context_suffix":"end ScalarSemiring\nend spectrum","dependency_ids":["import:Mathlib.Algebra.Algebra.Subalgebra.Basic","import:Mathlib.Algebra.Star.Pointwise","import:Mathlib.RingTheory.Ideal.Maps","import:Mathlib.RingTheory.Ideal.Nonunits","import:Mathlib.Tactic.NoncommRing"],"family_id":"resolventset_of_subsingleton","file_id":"mathlib/Mathlib/Algebra/Algebra/Spectrum/Basic.lean","imports":["public import Mathlib.Algebra.Algebra.Subalgebra.Basic","public import Mathlib.Algebra.Star.Pointwise","public import Mathlib.RingTheory.Ideal.Maps","public import Mathlib.RingTheory.Ideal.Nonunits","public import Mathlib.Tactic.NoncommRing"],"local_context":"/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a := by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff\n\ntheorem zero_notMem_iff {a : A} : (0 : R) ∉ σ a ↔ IsUnit a := by\n rw [zero_mem_iff, Classical.not_not]\n\nalias ⟨isUnit_of_zero_notMem, zero_notMem⟩ := spectrum.zero_notMem_iff\n\n@[simp]\nlemma _root_.Units.zero_notMem_spectrum (a : Aˣ) : 0 ∉ spectrum R (a : A) :=\n spectrum.zero_notMem R a.isUnit\n\nlemma subset_singleton_zero_compl {a : A} (ha : IsUnit a) : spectrum R a ⊆ {0}ᶜ :=\n Set.subset_compl_singleton_iff.mpr <| spectrum.zero_notMem R ha\n\nvariable {R}\n\ntheorem mem_resolventSet_of_left_right_inverse {r : R} {a b c : A} (h₁ : (↑ₐ r - a) * b = 1)\n (h₂ : c * (↑ₐ r - a) = 1) : r ∈ resolventSet R a :=\n Units.isUnit ⟨↑ₐ r - a, b, h₁, by rwa [← left_inv_eq_right_inv h₂ h₁]⟩\n\ntheorem mem_resolventSet_iff {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem algebraMap_mem_iff (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} {r : R} :\n algebraMap R S r ∈ spectrum S a ↔ r ∈ spectrum R a := by\n simp only [spectrum.mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]\n\nprotected alias ⟨of_algebraMap_mem, algebraMap_mem⟩ := spectrum.algebraMap_mem_iff\n\n@[simp]\ntheorem preimage_algebraMap (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} :\n algebraMap R S ⁻¹' spectrum S a = spectrum R a :=\n Set.ext fun _ => spectrum.algebraMap_mem_iff _\n\n@[simp]","module_header":true,"namespace":"spectrum","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Subalgebra.Basic\npublic import Mathlib.Algebra.Star.Pointwise\npublic import Mathlib.RingTheory.Ideal.Maps\npublic import Mathlib.RingTheory.Ideal.Nonunits\npublic import Mathlib.Tactic.NoncommRing\n\nNamespace:\nspectrum\n\nLocal context:\n/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a := by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff\n\ntheorem zero_notMem_iff {a : A} : (0 : R) ∉ σ a ↔ IsUnit a := by\n rw [zero_mem_iff, Classical.not_not]\n\nalias ⟨isUnit_of_zero_notMem, zero_notMem⟩ := spectrum.zero_notMem_iff\n\n@[simp]\nlemma _root_.Units.zero_notMem_spectrum (a : Aˣ) : 0 ∉ spectrum R (a : A) :=\n spectrum.zero_notMem R a.isUnit\n\nlemma subset_singleton_zero_compl {a : A} (ha : IsUnit a) : spectrum R a ⊆ {0}ᶜ :=\n Set.subset_compl_singleton_iff.mpr <| spectrum.zero_notMem R ha\n\nvariable {R}\n\ntheorem mem_resolventSet_of_left_right_inverse {r : R} {a b c : A} (h₁ : (↑ₐ r - a) * b = 1)\n (h₂ : c * (↑ₐ r - a) = 1) : r ∈ resolventSet R a :=\n Units.isUnit ⟨↑ₐ r - a, b, h₁, by rwa [← left_inv_eq_right_inv h₂ h₁]⟩\n\ntheorem mem_resolventSet_iff {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem algebraMap_mem_iff (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} {r : R} :\n algebraMap R S r ∈ spectrum S a ↔ r ∈ spectrum R a := by\n simp only [spectrum.mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]\n\nprotected alias ⟨of_algebraMap_mem, algebraMap_mem⟩ := spectrum.algebraMap_mem_iff\n\n@[simp]\ntheorem preimage_algebraMap (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} :\n algebraMap R S ⁻¹' spectrum S a = spectrum R a :=\n Set.ext fun _ => spectrum.algebraMap_mem_iff _\n\n@[simp]\n\nTarget:\ntheorem resolventSet_of_subsingleton [Subsingleton A] (a : A) : resolventSet R a = Set.univ :=\n\nProof body:\n","proof_body":"by\n simp_rw [resolventSet, Subsingleton.elim (algebraMap R A _ - a) 1, isUnit_one, Set.setOf_true]","provenance":{"declaration_index":12,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"6b8fb038fd170d1558b267f1b54fd6e008c9c0d4a0e402756920688d7daa0427","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Spectrum/Basic.lean"},"sample_id":"f7e7f8ca278f2fe29fbd1051aee49901b19c0a03c526446aa6e9bf474fb45044","schema_version":1,"split":"train","theorem_statement":"theorem resolventSet_of_subsingleton [Subsingleton A] (a : A) : resolventSet R a = Set.univ :="} {"completion":"by\n rw [spectrum, resolventSet_of_subsingleton, Set.compl_univ]","context_contains_namespace":true,"context_suffix":"end ScalarSemiring\nend spectrum","dependency_ids":["import:Mathlib.Algebra.Algebra.Subalgebra.Basic","import:Mathlib.Algebra.Star.Pointwise","import:Mathlib.RingTheory.Ideal.Maps","import:Mathlib.RingTheory.Ideal.Nonunits","import:Mathlib.Tactic.NoncommRing"],"family_id":"of_subsingleton","file_id":"mathlib/Mathlib/Algebra/Algebra/Spectrum/Basic.lean","imports":["public import Mathlib.Algebra.Algebra.Subalgebra.Basic","public import Mathlib.Algebra.Star.Pointwise","public import Mathlib.RingTheory.Ideal.Maps","public import Mathlib.RingTheory.Ideal.Nonunits","public import Mathlib.Tactic.NoncommRing"],"local_context":"/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a := by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff\n\ntheorem zero_notMem_iff {a : A} : (0 : R) ∉ σ a ↔ IsUnit a := by\n rw [zero_mem_iff, Classical.not_not]\n\nalias ⟨isUnit_of_zero_notMem, zero_notMem⟩ := spectrum.zero_notMem_iff\n\n@[simp]\nlemma _root_.Units.zero_notMem_spectrum (a : Aˣ) : 0 ∉ spectrum R (a : A) :=\n spectrum.zero_notMem R a.isUnit\n\nlemma subset_singleton_zero_compl {a : A} (ha : IsUnit a) : spectrum R a ⊆ {0}ᶜ :=\n Set.subset_compl_singleton_iff.mpr <| spectrum.zero_notMem R ha\n\nvariable {R}\n\ntheorem mem_resolventSet_of_left_right_inverse {r : R} {a b c : A} (h₁ : (↑ₐ r - a) * b = 1)\n (h₂ : c * (↑ₐ r - a) = 1) : r ∈ resolventSet R a :=\n Units.isUnit ⟨↑ₐ r - a, b, h₁, by rwa [← left_inv_eq_right_inv h₂ h₁]⟩\n\ntheorem mem_resolventSet_iff {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem algebraMap_mem_iff (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} {r : R} :\n algebraMap R S r ∈ spectrum S a ↔ r ∈ spectrum R a := by\n simp only [spectrum.mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]\n\nprotected alias ⟨of_algebraMap_mem, algebraMap_mem⟩ := spectrum.algebraMap_mem_iff\n\n@[simp]\ntheorem preimage_algebraMap (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} :\n algebraMap R S ⁻¹' spectrum S a = spectrum R a :=\n Set.ext fun _ => spectrum.algebraMap_mem_iff _\n\n@[simp]\ntheorem resolventSet_of_subsingleton [Subsingleton A] (a : A) : resolventSet R a = Set.univ := by\n simp_rw [resolventSet, Subsingleton.elim (algebraMap R A _ - a) 1, isUnit_one, Set.setOf_true]\n\n@[simp]","module_header":true,"namespace":"spectrum","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Subalgebra.Basic\npublic import Mathlib.Algebra.Star.Pointwise\npublic import Mathlib.RingTheory.Ideal.Maps\npublic import Mathlib.RingTheory.Ideal.Nonunits\npublic import Mathlib.Tactic.NoncommRing\n\nNamespace:\nspectrum\n\nLocal context:\n/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a := by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff\n\ntheorem zero_notMem_iff {a : A} : (0 : R) ∉ σ a ↔ IsUnit a := by\n rw [zero_mem_iff, Classical.not_not]\n\nalias ⟨isUnit_of_zero_notMem, zero_notMem⟩ := spectrum.zero_notMem_iff\n\n@[simp]\nlemma _root_.Units.zero_notMem_spectrum (a : Aˣ) : 0 ∉ spectrum R (a : A) :=\n spectrum.zero_notMem R a.isUnit\n\nlemma subset_singleton_zero_compl {a : A} (ha : IsUnit a) : spectrum R a ⊆ {0}ᶜ :=\n Set.subset_compl_singleton_iff.mpr <| spectrum.zero_notMem R ha\n\nvariable {R}\n\ntheorem mem_resolventSet_of_left_right_inverse {r : R} {a b c : A} (h₁ : (↑ₐ r - a) * b = 1)\n (h₂ : c * (↑ₐ r - a) = 1) : r ∈ resolventSet R a :=\n Units.isUnit ⟨↑ₐ r - a, b, h₁, by rwa [← left_inv_eq_right_inv h₂ h₁]⟩\n\ntheorem mem_resolventSet_iff {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem algebraMap_mem_iff (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} {r : R} :\n algebraMap R S r ∈ spectrum S a ↔ r ∈ spectrum R a := by\n simp only [spectrum.mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]\n\nprotected alias ⟨of_algebraMap_mem, algebraMap_mem⟩ := spectrum.algebraMap_mem_iff\n\n@[simp]\ntheorem preimage_algebraMap (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} :\n algebraMap R S ⁻¹' spectrum S a = spectrum R a :=\n Set.ext fun _ => spectrum.algebraMap_mem_iff _\n\n@[simp]\ntheorem resolventSet_of_subsingleton [Subsingleton A] (a : A) : resolventSet R a = Set.univ := by\n simp_rw [resolventSet, Subsingleton.elim (algebraMap R A _ - a) 1, isUnit_one, Set.setOf_true]\n\n@[simp]\n\nTarget:\ntheorem of_subsingleton [Subsingleton A] (a : A) : spectrum R a = ∅ :=\n\nProof body:\n","proof_body":"by\n rw [spectrum, resolventSet_of_subsingleton, Set.compl_univ]","provenance":{"declaration_index":13,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"6b8fb038fd170d1558b267f1b54fd6e008c9c0d4a0e402756920688d7daa0427","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Spectrum/Basic.lean"},"sample_id":"acc7982a3c89d4583e33aa0883284924bfd6a2a82b8e47ddc6a6baa4c526f346","schema_version":1,"split":"train","theorem_statement":"theorem of_subsingleton [Subsingleton A] (a : A) : spectrum R a = ∅ :="} {"completion":"by\n by_cases h : s ∈ spectrum R a\n · rw [mem_iff] at h\n simp only [resolvent, Algebra.algebraMap_eq_smul_one] at *\n rw [smul_assoc, ← smul_sub]\n have h' : ¬IsUnit (r⁻¹ • (s • (1 : A) - a)) := fun hu =>\n h (by simpa only [smul_inv_smul] using IsUnit.smul r hu)\n simp only [Ring.inverse_non_unit _ h, Ring.inverse_non_unit _ h', smul_zero]\n · simp only [resolvent]\n have h' : IsUnit (r • algebraMap R A (r⁻¹ • s) - a) := by\n simpa [Algebra.algebraMap_eq_smul_one, smul_assoc] using notMem_iff.mp h\n rw [← h'.val_subInvSMul, ← (notMem_iff.mp h).unit_spec, Ring.inverse_unit, Ring.inverse_unit,\n h'.val_inv_subInvSMul]\n simp only [Algebra.algebraMap_eq_smul_one, smul_assoc, smul_inv_smul]","context_contains_namespace":true,"context_suffix":"end ScalarSemiring\nend spectrum","dependency_ids":["import:Mathlib.Algebra.Algebra.Subalgebra.Basic","import:Mathlib.Algebra.Star.Pointwise","import:Mathlib.RingTheory.Ideal.Maps","import:Mathlib.RingTheory.Ideal.Nonunits","import:Mathlib.Tactic.NoncommRing"],"family_id":"units_smul_resolvent","file_id":"mathlib/Mathlib/Algebra/Algebra/Spectrum/Basic.lean","imports":["public import Mathlib.Algebra.Algebra.Subalgebra.Basic","public import Mathlib.Algebra.Star.Pointwise","public import Mathlib.RingTheory.Ideal.Maps","public import Mathlib.RingTheory.Ideal.Nonunits","public import Mathlib.Tactic.NoncommRing"],"local_context":"/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a := by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff\n\ntheorem zero_notMem_iff {a : A} : (0 : R) ∉ σ a ↔ IsUnit a := by\n rw [zero_mem_iff, Classical.not_not]\n\nalias ⟨isUnit_of_zero_notMem, zero_notMem⟩ := spectrum.zero_notMem_iff\n\n@[simp]\nlemma _root_.Units.zero_notMem_spectrum (a : Aˣ) : 0 ∉ spectrum R (a : A) :=\n spectrum.zero_notMem R a.isUnit\n\nlemma subset_singleton_zero_compl {a : A} (ha : IsUnit a) : spectrum R a ⊆ {0}ᶜ :=\n Set.subset_compl_singleton_iff.mpr <| spectrum.zero_notMem R ha\n\nvariable {R}\n\ntheorem mem_resolventSet_of_left_right_inverse {r : R} {a b c : A} (h₁ : (↑ₐ r - a) * b = 1)\n (h₂ : c * (↑ₐ r - a) = 1) : r ∈ resolventSet R a :=\n Units.isUnit ⟨↑ₐ r - a, b, h₁, by rwa [← left_inv_eq_right_inv h₂ h₁]⟩\n\ntheorem mem_resolventSet_iff {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem algebraMap_mem_iff (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} {r : R} :\n algebraMap R S r ∈ spectrum S a ↔ r ∈ spectrum R a := by\n simp only [spectrum.mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]\n\nprotected alias ⟨of_algebraMap_mem, algebraMap_mem⟩ := spectrum.algebraMap_mem_iff\n\n@[simp]\ntheorem preimage_algebraMap (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} :\n algebraMap R S ⁻¹' spectrum S a = spectrum R a :=\n Set.ext fun _ => spectrum.algebraMap_mem_iff _\n\n@[simp]\ntheorem resolventSet_of_subsingleton [Subsingleton A] (a : A) : resolventSet R a = Set.univ := by\n simp_rw [resolventSet, Subsingleton.elim (algebraMap R A _ - a) 1, isUnit_one, Set.setOf_true]\n\n@[simp]\ntheorem of_subsingleton [Subsingleton A] (a : A) : spectrum R a = ∅ := by\n rw [spectrum, resolventSet_of_subsingleton, Set.compl_univ]\n\ntheorem resolvent_eq {a : A} {r : R} (h : r ∈ resolventSet R a) : resolvent a r = ↑h.unit⁻¹ :=\n Ring.inverse_unit h.unit","module_header":true,"namespace":"spectrum","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Subalgebra.Basic\npublic import Mathlib.Algebra.Star.Pointwise\npublic import Mathlib.RingTheory.Ideal.Maps\npublic import Mathlib.RingTheory.Ideal.Nonunits\npublic import Mathlib.Tactic.NoncommRing\n\nNamespace:\nspectrum\n\nLocal context:\n/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a := by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff\n\ntheorem zero_notMem_iff {a : A} : (0 : R) ∉ σ a ↔ IsUnit a := by\n rw [zero_mem_iff, Classical.not_not]\n\nalias ⟨isUnit_of_zero_notMem, zero_notMem⟩ := spectrum.zero_notMem_iff\n\n@[simp]\nlemma _root_.Units.zero_notMem_spectrum (a : Aˣ) : 0 ∉ spectrum R (a : A) :=\n spectrum.zero_notMem R a.isUnit\n\nlemma subset_singleton_zero_compl {a : A} (ha : IsUnit a) : spectrum R a ⊆ {0}ᶜ :=\n Set.subset_compl_singleton_iff.mpr <| spectrum.zero_notMem R ha\n\nvariable {R}\n\ntheorem mem_resolventSet_of_left_right_inverse {r : R} {a b c : A} (h₁ : (↑ₐ r - a) * b = 1)\n (h₂ : c * (↑ₐ r - a) = 1) : r ∈ resolventSet R a :=\n Units.isUnit ⟨↑ₐ r - a, b, h₁, by rwa [← left_inv_eq_right_inv h₂ h₁]⟩\n\ntheorem mem_resolventSet_iff {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem algebraMap_mem_iff (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} {r : R} :\n algebraMap R S r ∈ spectrum S a ↔ r ∈ spectrum R a := by\n simp only [spectrum.mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]\n\nprotected alias ⟨of_algebraMap_mem, algebraMap_mem⟩ := spectrum.algebraMap_mem_iff\n\n@[simp]\ntheorem preimage_algebraMap (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} :\n algebraMap R S ⁻¹' spectrum S a = spectrum R a :=\n Set.ext fun _ => spectrum.algebraMap_mem_iff _\n\n@[simp]\ntheorem resolventSet_of_subsingleton [Subsingleton A] (a : A) : resolventSet R a = Set.univ := by\n simp_rw [resolventSet, Subsingleton.elim (algebraMap R A _ - a) 1, isUnit_one, Set.setOf_true]\n\n@[simp]\ntheorem of_subsingleton [Subsingleton A] (a : A) : spectrum R a = ∅ := by\n rw [spectrum, resolventSet_of_subsingleton, Set.compl_univ]\n\ntheorem resolvent_eq {a : A} {r : R} (h : r ∈ resolventSet R a) : resolvent a r = ↑h.unit⁻¹ :=\n Ring.inverse_unit h.unit\n\nTarget:\ntheorem units_smul_resolvent {r : Rˣ} {s : R} {a : A} :\n r • resolvent a (s : R) = resolvent (r⁻¹ • a) (r⁻¹ • s : R) :=\n\nProof body:\n","proof_body":"by\n by_cases h : s ∈ spectrum R a\n · rw [mem_iff] at h\n simp only [resolvent, Algebra.algebraMap_eq_smul_one] at *\n rw [smul_assoc, ← smul_sub]\n have h' : ¬IsUnit (r⁻¹ • (s • (1 : A) - a)) := fun hu =>\n h (by simpa only [smul_inv_smul] using IsUnit.smul r hu)\n simp only [Ring.inverse_non_unit _ h, Ring.inverse_non_unit _ h', smul_zero]\n · simp only [resolvent]\n have h' : IsUnit (r • algebraMap R A (r⁻¹ • s) - a) := by\n simpa [Algebra.algebraMap_eq_smul_one, smul_assoc] using notMem_iff.mp h\n rw [← h'.val_subInvSMul, ← (notMem_iff.mp h).unit_spec, Ring.inverse_unit, Ring.inverse_unit,\n h'.val_inv_subInvSMul]\n simp only [Algebra.algebraMap_eq_smul_one, smul_assoc, smul_inv_smul]","provenance":{"declaration_index":15,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"6b8fb038fd170d1558b267f1b54fd6e008c9c0d4a0e402756920688d7daa0427","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Spectrum/Basic.lean"},"sample_id":"63281e533c0f2554fdf209001b8f4f4c3c242a157d5b4989690139bc27f6dc9c","schema_version":1,"split":"train","theorem_statement":"theorem units_smul_resolvent {r : Rˣ} {s : R} {a : A} :\n r • resolvent a (s : R) = resolvent (r⁻¹ • a) (r⁻¹ • s : R) :="} {"completion":"by\n rw [mem_resolventSet_iff, Algebra.algebraMap_eq_smul_one, ← Units.smul_def] at h ⊢\n rw [IsUnit.smul_sub_iff_sub_inv_smul, inv_inv, IsUnit.sub_iff]\n have h₁ : (a : A) * (r • (↑a⁻¹ : A) - 1) = r • (1 : A) - a := by\n rw [mul_sub, mul_smul_comm, a.mul_inv, mul_one]\n have h₂ : (r • (↑a⁻¹ : A) - 1) * a = r • (1 : A) - a := by\n rw [sub_mul, smul_mul_assoc, a.inv_mul, one_mul]\n have hcomm : Commute (a : A) (r • (↑a⁻¹ : A) - 1) := by rwa [← h₂] at h₁\n exact (hcomm.isUnit_mul_iff.mp (h₁.symm ▸ h)).2","context_contains_namespace":true,"context_suffix":"end ScalarSemiring\nend spectrum","dependency_ids":["import:Mathlib.Algebra.Algebra.Subalgebra.Basic","import:Mathlib.Algebra.Star.Pointwise","import:Mathlib.RingTheory.Ideal.Maps","import:Mathlib.RingTheory.Ideal.Nonunits","import:Mathlib.Tactic.NoncommRing"],"family_id":"inv_mem_resolventset","file_id":"mathlib/Mathlib/Algebra/Algebra/Spectrum/Basic.lean","imports":["public import Mathlib.Algebra.Algebra.Subalgebra.Basic","public import Mathlib.Algebra.Star.Pointwise","public import Mathlib.RingTheory.Ideal.Maps","public import Mathlib.RingTheory.Ideal.Nonunits","public import Mathlib.Tactic.NoncommRing"],"local_context":"/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a := by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff\n\ntheorem zero_notMem_iff {a : A} : (0 : R) ∉ σ a ↔ IsUnit a := by\n rw [zero_mem_iff, Classical.not_not]\n\nalias ⟨isUnit_of_zero_notMem, zero_notMem⟩ := spectrum.zero_notMem_iff\n\n@[simp]\nlemma _root_.Units.zero_notMem_spectrum (a : Aˣ) : 0 ∉ spectrum R (a : A) :=\n spectrum.zero_notMem R a.isUnit\n\nlemma subset_singleton_zero_compl {a : A} (ha : IsUnit a) : spectrum R a ⊆ {0}ᶜ :=\n Set.subset_compl_singleton_iff.mpr <| spectrum.zero_notMem R ha\n\nvariable {R}\n\ntheorem mem_resolventSet_of_left_right_inverse {r : R} {a b c : A} (h₁ : (↑ₐ r - a) * b = 1)\n (h₂ : c * (↑ₐ r - a) = 1) : r ∈ resolventSet R a :=\n Units.isUnit ⟨↑ₐ r - a, b, h₁, by rwa [← left_inv_eq_right_inv h₂ h₁]⟩\n\ntheorem mem_resolventSet_iff {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem algebraMap_mem_iff (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} {r : R} :\n algebraMap R S r ∈ spectrum S a ↔ r ∈ spectrum R a := by\n simp only [spectrum.mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]\n\nprotected alias ⟨of_algebraMap_mem, algebraMap_mem⟩ := spectrum.algebraMap_mem_iff\n\n@[simp]\ntheorem preimage_algebraMap (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} :\n algebraMap R S ⁻¹' spectrum S a = spectrum R a :=\n Set.ext fun _ => spectrum.algebraMap_mem_iff _\n\n@[simp]\ntheorem resolventSet_of_subsingleton [Subsingleton A] (a : A) : resolventSet R a = Set.univ := by\n simp_rw [resolventSet, Subsingleton.elim (algebraMap R A _ - a) 1, isUnit_one, Set.setOf_true]\n\n@[simp]\ntheorem of_subsingleton [Subsingleton A] (a : A) : spectrum R a = ∅ := by\n rw [spectrum, resolventSet_of_subsingleton, Set.compl_univ]\n\ntheorem resolvent_eq {a : A} {r : R} (h : r ∈ resolventSet R a) : resolvent a r = ↑h.unit⁻¹ :=\n Ring.inverse_unit h.unit\n\ntheorem units_smul_resolvent {r : Rˣ} {s : R} {a : A} :\n r • resolvent a (s : R) = resolvent (r⁻¹ • a) (r⁻¹ • s : R) := by\n by_cases h : s ∈ spectrum R a\n · rw [mem_iff] at h\n simp only [resolvent, Algebra.algebraMap_eq_smul_one] at *\n rw [smul_assoc, ← smul_sub]\n have h' : ¬IsUnit (r⁻¹ • (s • (1 : A) - a)) := fun hu =>\n h (by simpa only [smul_inv_smul] using IsUnit.smul r hu)\n simp only [Ring.inverse_non_unit _ h, Ring.inverse_non_unit _ h', smul_zero]\n · simp only [resolvent]\n have h' : IsUnit (r • algebraMap R A (r⁻¹ • s) - a) := by\n simpa [Algebra.algebraMap_eq_smul_one, smul_assoc] using notMem_iff.mp h\n rw [← h'.val_subInvSMul, ← (notMem_iff.mp h).unit_spec, Ring.inverse_unit, Ring.inverse_unit,\n h'.val_inv_subInvSMul]\n simp only [Algebra.algebraMap_eq_smul_one, smul_assoc, smul_inv_smul]\n\ntheorem units_smul_resolvent_self {r : Rˣ} {a : A} :\n r • resolvent a (r : R) = resolvent (r⁻¹ • a) (1 : R) := by\n simpa only [Units.smul_def, smul_eq_mul, Units.inv_mul] using\n @units_smul_resolvent _ _ _ _ _ r r a\n\n/-- The resolvent is a unit when the argument is in the resolvent set. -/\ntheorem isUnit_resolvent {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (resolvent a r) :=\n isUnit_ringInverse.symm","module_header":true,"namespace":"spectrum","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Subalgebra.Basic\npublic import Mathlib.Algebra.Star.Pointwise\npublic import Mathlib.RingTheory.Ideal.Maps\npublic import Mathlib.RingTheory.Ideal.Nonunits\npublic import Mathlib.Tactic.NoncommRing\n\nNamespace:\nspectrum\n\nLocal context:\n/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a := by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff\n\ntheorem zero_notMem_iff {a : A} : (0 : R) ∉ σ a ↔ IsUnit a := by\n rw [zero_mem_iff, Classical.not_not]\n\nalias ⟨isUnit_of_zero_notMem, zero_notMem⟩ := spectrum.zero_notMem_iff\n\n@[simp]\nlemma _root_.Units.zero_notMem_spectrum (a : Aˣ) : 0 ∉ spectrum R (a : A) :=\n spectrum.zero_notMem R a.isUnit\n\nlemma subset_singleton_zero_compl {a : A} (ha : IsUnit a) : spectrum R a ⊆ {0}ᶜ :=\n Set.subset_compl_singleton_iff.mpr <| spectrum.zero_notMem R ha\n\nvariable {R}\n\ntheorem mem_resolventSet_of_left_right_inverse {r : R} {a b c : A} (h₁ : (↑ₐ r - a) * b = 1)\n (h₂ : c * (↑ₐ r - a) = 1) : r ∈ resolventSet R a :=\n Units.isUnit ⟨↑ₐ r - a, b, h₁, by rwa [← left_inv_eq_right_inv h₂ h₁]⟩\n\ntheorem mem_resolventSet_iff {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem algebraMap_mem_iff (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} {r : R} :\n algebraMap R S r ∈ spectrum S a ↔ r ∈ spectrum R a := by\n simp only [spectrum.mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]\n\nprotected alias ⟨of_algebraMap_mem, algebraMap_mem⟩ := spectrum.algebraMap_mem_iff\n\n@[simp]\ntheorem preimage_algebraMap (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} :\n algebraMap R S ⁻¹' spectrum S a = spectrum R a :=\n Set.ext fun _ => spectrum.algebraMap_mem_iff _\n\n@[simp]\ntheorem resolventSet_of_subsingleton [Subsingleton A] (a : A) : resolventSet R a = Set.univ := by\n simp_rw [resolventSet, Subsingleton.elim (algebraMap R A _ - a) 1, isUnit_one, Set.setOf_true]\n\n@[simp]\ntheorem of_subsingleton [Subsingleton A] (a : A) : spectrum R a = ∅ := by\n rw [spectrum, resolventSet_of_subsingleton, Set.compl_univ]\n\ntheorem resolvent_eq {a : A} {r : R} (h : r ∈ resolventSet R a) : resolvent a r = ↑h.unit⁻¹ :=\n Ring.inverse_unit h.unit\n\ntheorem units_smul_resolvent {r : Rˣ} {s : R} {a : A} :\n r • resolvent a (s : R) = resolvent (r⁻¹ • a) (r⁻¹ • s : R) := by\n by_cases h : s ∈ spectrum R a\n · rw [mem_iff] at h\n simp only [resolvent, Algebra.algebraMap_eq_smul_one] at *\n rw [smul_assoc, ← smul_sub]\n have h' : ¬IsUnit (r⁻¹ • (s • (1 : A) - a)) := fun hu =>\n h (by simpa only [smul_inv_smul] using IsUnit.smul r hu)\n simp only [Ring.inverse_non_unit _ h, Ring.inverse_non_unit _ h', smul_zero]\n · simp only [resolvent]\n have h' : IsUnit (r • algebraMap R A (r⁻¹ • s) - a) := by\n simpa [Algebra.algebraMap_eq_smul_one, smul_assoc] using notMem_iff.mp h\n rw [← h'.val_subInvSMul, ← (notMem_iff.mp h).unit_spec, Ring.inverse_unit, Ring.inverse_unit,\n h'.val_inv_subInvSMul]\n simp only [Algebra.algebraMap_eq_smul_one, smul_assoc, smul_inv_smul]\n\ntheorem units_smul_resolvent_self {r : Rˣ} {a : A} :\n r • resolvent a (r : R) = resolvent (r⁻¹ • a) (1 : R) := by\n simpa only [Units.smul_def, smul_eq_mul, Units.inv_mul] using\n @units_smul_resolvent _ _ _ _ _ r r a\n\n/-- The resolvent is a unit when the argument is in the resolvent set. -/\ntheorem isUnit_resolvent {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (resolvent a r) :=\n isUnit_ringInverse.symm\n\nTarget:\ntheorem inv_mem_resolventSet {r : Rˣ} {a : Aˣ} (h : (r : R) ∈ resolventSet R (a : A)) :\n (↑r⁻¹ : R) ∈ resolventSet R (↑a⁻¹ : A) :=\n\nProof body:\n","proof_body":"by\n rw [mem_resolventSet_iff, Algebra.algebraMap_eq_smul_one, ← Units.smul_def] at h ⊢\n rw [IsUnit.smul_sub_iff_sub_inv_smul, inv_inv, IsUnit.sub_iff]\n have h₁ : (a : A) * (r • (↑a⁻¹ : A) - 1) = r • (1 : A) - a := by\n rw [mul_sub, mul_smul_comm, a.mul_inv, mul_one]\n have h₂ : (r • (↑a⁻¹ : A) - 1) * a = r • (1 : A) - a := by\n rw [sub_mul, smul_mul_assoc, a.inv_mul, one_mul]\n have hcomm : Commute (a : A) (r • (↑a⁻¹ : A) - 1) := by rwa [← h₂] at h₁\n exact (hcomm.isUnit_mul_iff.mp (h₁.symm ▸ h)).2","provenance":{"declaration_index":18,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"6b8fb038fd170d1558b267f1b54fd6e008c9c0d4a0e402756920688d7daa0427","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Spectrum/Basic.lean"},"sample_id":"d51f3aecbe6941b791021065a7326d20c8fc076d084bcd6a7c72e93b083da78f","schema_version":1,"split":"train","theorem_statement":"theorem inv_mem_resolventSet {r : Rˣ} {a : Aˣ} (h : (r : R) ∈ resolventSet R (a : A)) :\n (↑r⁻¹ : R) ∈ resolventSet R (↑a⁻¹ : A) :="} {"completion":"by\n simpa only [mem_resolventSet_iff, ← notMem_iff, zero_notMem_iff] using a.isUnit","context_contains_namespace":true,"context_suffix":"end ScalarSemiring\nend spectrum","dependency_ids":["import:Mathlib.Algebra.Algebra.Subalgebra.Basic","import:Mathlib.Algebra.Star.Pointwise","import:Mathlib.RingTheory.Ideal.Maps","import:Mathlib.RingTheory.Ideal.Nonunits","import:Mathlib.Tactic.NoncommRing"],"family_id":"zero_mem_resolventset_of_unit","file_id":"mathlib/Mathlib/Algebra/Algebra/Spectrum/Basic.lean","imports":["public import Mathlib.Algebra.Algebra.Subalgebra.Basic","public import Mathlib.Algebra.Star.Pointwise","public import Mathlib.RingTheory.Ideal.Maps","public import Mathlib.RingTheory.Ideal.Nonunits","public import Mathlib.Tactic.NoncommRing"],"local_context":"/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a := by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff\n\ntheorem zero_notMem_iff {a : A} : (0 : R) ∉ σ a ↔ IsUnit a := by\n rw [zero_mem_iff, Classical.not_not]\n\nalias ⟨isUnit_of_zero_notMem, zero_notMem⟩ := spectrum.zero_notMem_iff\n\n@[simp]\nlemma _root_.Units.zero_notMem_spectrum (a : Aˣ) : 0 ∉ spectrum R (a : A) :=\n spectrum.zero_notMem R a.isUnit\n\nlemma subset_singleton_zero_compl {a : A} (ha : IsUnit a) : spectrum R a ⊆ {0}ᶜ :=\n Set.subset_compl_singleton_iff.mpr <| spectrum.zero_notMem R ha\n\nvariable {R}\n\ntheorem mem_resolventSet_of_left_right_inverse {r : R} {a b c : A} (h₁ : (↑ₐ r - a) * b = 1)\n (h₂ : c * (↑ₐ r - a) = 1) : r ∈ resolventSet R a :=\n Units.isUnit ⟨↑ₐ r - a, b, h₁, by rwa [← left_inv_eq_right_inv h₂ h₁]⟩\n\ntheorem mem_resolventSet_iff {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem algebraMap_mem_iff (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} {r : R} :\n algebraMap R S r ∈ spectrum S a ↔ r ∈ spectrum R a := by\n simp only [spectrum.mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]\n\nprotected alias ⟨of_algebraMap_mem, algebraMap_mem⟩ := spectrum.algebraMap_mem_iff\n\n@[simp]\ntheorem preimage_algebraMap (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} :\n algebraMap R S ⁻¹' spectrum S a = spectrum R a :=\n Set.ext fun _ => spectrum.algebraMap_mem_iff _\n\n@[simp]\ntheorem resolventSet_of_subsingleton [Subsingleton A] (a : A) : resolventSet R a = Set.univ := by\n simp_rw [resolventSet, Subsingleton.elim (algebraMap R A _ - a) 1, isUnit_one, Set.setOf_true]\n\n@[simp]\ntheorem of_subsingleton [Subsingleton A] (a : A) : spectrum R a = ∅ := by\n rw [spectrum, resolventSet_of_subsingleton, Set.compl_univ]\n\ntheorem resolvent_eq {a : A} {r : R} (h : r ∈ resolventSet R a) : resolvent a r = ↑h.unit⁻¹ :=\n Ring.inverse_unit h.unit\n\ntheorem units_smul_resolvent {r : Rˣ} {s : R} {a : A} :\n r • resolvent a (s : R) = resolvent (r⁻¹ • a) (r⁻¹ • s : R) := by\n by_cases h : s ∈ spectrum R a\n · rw [mem_iff] at h\n simp only [resolvent, Algebra.algebraMap_eq_smul_one] at *\n rw [smul_assoc, ← smul_sub]\n have h' : ¬IsUnit (r⁻¹ • (s • (1 : A) - a)) := fun hu =>\n h (by simpa only [smul_inv_smul] using IsUnit.smul r hu)\n simp only [Ring.inverse_non_unit _ h, Ring.inverse_non_unit _ h', smul_zero]\n · simp only [resolvent]\n have h' : IsUnit (r • algebraMap R A (r⁻¹ • s) - a) := by\n simpa [Algebra.algebraMap_eq_smul_one, smul_assoc] using notMem_iff.mp h\n rw [← h'.val_subInvSMul, ← (notMem_iff.mp h).unit_spec, Ring.inverse_unit, Ring.inverse_unit,\n h'.val_inv_subInvSMul]\n simp only [Algebra.algebraMap_eq_smul_one, smul_assoc, smul_inv_smul]\n\ntheorem units_smul_resolvent_self {r : Rˣ} {a : A} :\n r • resolvent a (r : R) = resolvent (r⁻¹ • a) (1 : R) := by\n simpa only [Units.smul_def, smul_eq_mul, Units.inv_mul] using\n @units_smul_resolvent _ _ _ _ _ r r a\n\n/-- The resolvent is a unit when the argument is in the resolvent set. -/\ntheorem isUnit_resolvent {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (resolvent a r) :=\n isUnit_ringInverse.symm\n\ntheorem inv_mem_resolventSet {r : Rˣ} {a : Aˣ} (h : (r : R) ∈ resolventSet R (a : A)) :\n (↑r⁻¹ : R) ∈ resolventSet R (↑a⁻¹ : A) := by\n rw [mem_resolventSet_iff, Algebra.algebraMap_eq_smul_one, ← Units.smul_def] at h ⊢\n rw [IsUnit.smul_sub_iff_sub_inv_smul, inv_inv, IsUnit.sub_iff]\n have h₁ : (a : A) * (r • (↑a⁻¹ : A) - 1) = r • (1 : A) - a := by\n rw [mul_sub, mul_smul_comm, a.mul_inv, mul_one]\n have h₂ : (r • (↑a⁻¹ : A) - 1) * a = r • (1 : A) - a := by\n rw [sub_mul, smul_mul_assoc, a.inv_mul, one_mul]\n have hcomm : Commute (a : A) (r • (↑a⁻¹ : A) - 1) := by rwa [← h₂] at h₁\n exact (hcomm.isUnit_mul_iff.mp (h₁.symm ▸ h)).2\n\ntheorem inv_mem_iff {r : Rˣ} {a : Aˣ} : (r : R) ∈ σ (a : A) ↔ (↑r⁻¹ : R) ∈ σ (↑a⁻¹ : A) :=\n not_iff_not.2 <| ⟨inv_mem_resolventSet, inv_mem_resolventSet⟩","module_header":true,"namespace":"spectrum","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Subalgebra.Basic\npublic import Mathlib.Algebra.Star.Pointwise\npublic import Mathlib.RingTheory.Ideal.Maps\npublic import Mathlib.RingTheory.Ideal.Nonunits\npublic import Mathlib.Tactic.NoncommRing\n\nNamespace:\nspectrum\n\nLocal context:\n/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a := by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff\n\ntheorem zero_notMem_iff {a : A} : (0 : R) ∉ σ a ↔ IsUnit a := by\n rw [zero_mem_iff, Classical.not_not]\n\nalias ⟨isUnit_of_zero_notMem, zero_notMem⟩ := spectrum.zero_notMem_iff\n\n@[simp]\nlemma _root_.Units.zero_notMem_spectrum (a : Aˣ) : 0 ∉ spectrum R (a : A) :=\n spectrum.zero_notMem R a.isUnit\n\nlemma subset_singleton_zero_compl {a : A} (ha : IsUnit a) : spectrum R a ⊆ {0}ᶜ :=\n Set.subset_compl_singleton_iff.mpr <| spectrum.zero_notMem R ha\n\nvariable {R}\n\ntheorem mem_resolventSet_of_left_right_inverse {r : R} {a b c : A} (h₁ : (↑ₐ r - a) * b = 1)\n (h₂ : c * (↑ₐ r - a) = 1) : r ∈ resolventSet R a :=\n Units.isUnit ⟨↑ₐ r - a, b, h₁, by rwa [← left_inv_eq_right_inv h₂ h₁]⟩\n\ntheorem mem_resolventSet_iff {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem algebraMap_mem_iff (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} {r : R} :\n algebraMap R S r ∈ spectrum S a ↔ r ∈ spectrum R a := by\n simp only [spectrum.mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]\n\nprotected alias ⟨of_algebraMap_mem, algebraMap_mem⟩ := spectrum.algebraMap_mem_iff\n\n@[simp]\ntheorem preimage_algebraMap (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} :\n algebraMap R S ⁻¹' spectrum S a = spectrum R a :=\n Set.ext fun _ => spectrum.algebraMap_mem_iff _\n\n@[simp]\ntheorem resolventSet_of_subsingleton [Subsingleton A] (a : A) : resolventSet R a = Set.univ := by\n simp_rw [resolventSet, Subsingleton.elim (algebraMap R A _ - a) 1, isUnit_one, Set.setOf_true]\n\n@[simp]\ntheorem of_subsingleton [Subsingleton A] (a : A) : spectrum R a = ∅ := by\n rw [spectrum, resolventSet_of_subsingleton, Set.compl_univ]\n\ntheorem resolvent_eq {a : A} {r : R} (h : r ∈ resolventSet R a) : resolvent a r = ↑h.unit⁻¹ :=\n Ring.inverse_unit h.unit\n\ntheorem units_smul_resolvent {r : Rˣ} {s : R} {a : A} :\n r • resolvent a (s : R) = resolvent (r⁻¹ • a) (r⁻¹ • s : R) := by\n by_cases h : s ∈ spectrum R a\n · rw [mem_iff] at h\n simp only [resolvent, Algebra.algebraMap_eq_smul_one] at *\n rw [smul_assoc, ← smul_sub]\n have h' : ¬IsUnit (r⁻¹ • (s • (1 : A) - a)) := fun hu =>\n h (by simpa only [smul_inv_smul] using IsUnit.smul r hu)\n simp only [Ring.inverse_non_unit _ h, Ring.inverse_non_unit _ h', smul_zero]\n · simp only [resolvent]\n have h' : IsUnit (r • algebraMap R A (r⁻¹ • s) - a) := by\n simpa [Algebra.algebraMap_eq_smul_one, smul_assoc] using notMem_iff.mp h\n rw [← h'.val_subInvSMul, ← (notMem_iff.mp h).unit_spec, Ring.inverse_unit, Ring.inverse_unit,\n h'.val_inv_subInvSMul]\n simp only [Algebra.algebraMap_eq_smul_one, smul_assoc, smul_inv_smul]\n\ntheorem units_smul_resolvent_self {r : Rˣ} {a : A} :\n r • resolvent a (r : R) = resolvent (r⁻¹ • a) (1 : R) := by\n simpa only [Units.smul_def, smul_eq_mul, Units.inv_mul] using\n @units_smul_resolvent _ _ _ _ _ r r a\n\n/-- The resolvent is a unit when the argument is in the resolvent set. -/\ntheorem isUnit_resolvent {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (resolvent a r) :=\n isUnit_ringInverse.symm\n\ntheorem inv_mem_resolventSet {r : Rˣ} {a : Aˣ} (h : (r : R) ∈ resolventSet R (a : A)) :\n (↑r⁻¹ : R) ∈ resolventSet R (↑a⁻¹ : A) := by\n rw [mem_resolventSet_iff, Algebra.algebraMap_eq_smul_one, ← Units.smul_def] at h ⊢\n rw [IsUnit.smul_sub_iff_sub_inv_smul, inv_inv, IsUnit.sub_iff]\n have h₁ : (a : A) * (r • (↑a⁻¹ : A) - 1) = r • (1 : A) - a := by\n rw [mul_sub, mul_smul_comm, a.mul_inv, mul_one]\n have h₂ : (r • (↑a⁻¹ : A) - 1) * a = r • (1 : A) - a := by\n rw [sub_mul, smul_mul_assoc, a.inv_mul, one_mul]\n have hcomm : Commute (a : A) (r • (↑a⁻¹ : A) - 1) := by rwa [← h₂] at h₁\n exact (hcomm.isUnit_mul_iff.mp (h₁.symm ▸ h)).2\n\ntheorem inv_mem_iff {r : Rˣ} {a : Aˣ} : (r : R) ∈ σ (a : A) ↔ (↑r⁻¹ : R) ∈ σ (↑a⁻¹ : A) :=\n not_iff_not.2 <| ⟨inv_mem_resolventSet, inv_mem_resolventSet⟩\n\nTarget:\ntheorem zero_mem_resolventSet_of_unit (a : Aˣ) : 0 ∈ resolventSet R (a : A) :=\n\nProof body:\n","proof_body":"by\n simpa only [mem_resolventSet_iff, ← notMem_iff, zero_notMem_iff] using a.isUnit","provenance":{"declaration_index":20,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"6b8fb038fd170d1558b267f1b54fd6e008c9c0d4a0e402756920688d7daa0427","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Spectrum/Basic.lean"},"sample_id":"cdec4d4b22ca79defecdffc7132119c971664f8ae503420bd1179b2f30366ca3","schema_version":1,"split":"train","theorem_statement":"theorem zero_mem_resolventSet_of_unit (a : Aˣ) : 0 ∈ resolventSet R (a : A) :="} {"completion":"by\n simp only [mem_iff, sub_neg_eq_add, ← sub_sub, map_add]","context_contains_namespace":true,"context_suffix":"end ScalarSemiring\nend spectrum","dependency_ids":["import:Mathlib.Algebra.Algebra.Subalgebra.Basic","import:Mathlib.Algebra.Star.Pointwise","import:Mathlib.RingTheory.Ideal.Maps","import:Mathlib.RingTheory.Ideal.Nonunits","import:Mathlib.Tactic.NoncommRing"],"family_id":"add_mem_iff","file_id":"mathlib/Mathlib/Algebra/Algebra/Spectrum/Basic.lean","imports":["public import Mathlib.Algebra.Algebra.Subalgebra.Basic","public import Mathlib.Algebra.Star.Pointwise","public import Mathlib.RingTheory.Ideal.Maps","public import Mathlib.RingTheory.Ideal.Nonunits","public import Mathlib.Tactic.NoncommRing"],"local_context":"/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a := by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff\n\ntheorem zero_notMem_iff {a : A} : (0 : R) ∉ σ a ↔ IsUnit a := by\n rw [zero_mem_iff, Classical.not_not]\n\nalias ⟨isUnit_of_zero_notMem, zero_notMem⟩ := spectrum.zero_notMem_iff\n\n@[simp]\nlemma _root_.Units.zero_notMem_spectrum (a : Aˣ) : 0 ∉ spectrum R (a : A) :=\n spectrum.zero_notMem R a.isUnit\n\nlemma subset_singleton_zero_compl {a : A} (ha : IsUnit a) : spectrum R a ⊆ {0}ᶜ :=\n Set.subset_compl_singleton_iff.mpr <| spectrum.zero_notMem R ha\n\nvariable {R}\n\ntheorem mem_resolventSet_of_left_right_inverse {r : R} {a b c : A} (h₁ : (↑ₐ r - a) * b = 1)\n (h₂ : c * (↑ₐ r - a) = 1) : r ∈ resolventSet R a :=\n Units.isUnit ⟨↑ₐ r - a, b, h₁, by rwa [← left_inv_eq_right_inv h₂ h₁]⟩\n\ntheorem mem_resolventSet_iff {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem algebraMap_mem_iff (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} {r : R} :\n algebraMap R S r ∈ spectrum S a ↔ r ∈ spectrum R a := by\n simp only [spectrum.mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]\n\nprotected alias ⟨of_algebraMap_mem, algebraMap_mem⟩ := spectrum.algebraMap_mem_iff\n\n@[simp]\ntheorem preimage_algebraMap (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} :\n algebraMap R S ⁻¹' spectrum S a = spectrum R a :=\n Set.ext fun _ => spectrum.algebraMap_mem_iff _\n\n@[simp]\ntheorem resolventSet_of_subsingleton [Subsingleton A] (a : A) : resolventSet R a = Set.univ := by\n simp_rw [resolventSet, Subsingleton.elim (algebraMap R A _ - a) 1, isUnit_one, Set.setOf_true]\n\n@[simp]\ntheorem of_subsingleton [Subsingleton A] (a : A) : spectrum R a = ∅ := by\n rw [spectrum, resolventSet_of_subsingleton, Set.compl_univ]\n\ntheorem resolvent_eq {a : A} {r : R} (h : r ∈ resolventSet R a) : resolvent a r = ↑h.unit⁻¹ :=\n Ring.inverse_unit h.unit\n\ntheorem units_smul_resolvent {r : Rˣ} {s : R} {a : A} :\n r • resolvent a (s : R) = resolvent (r⁻¹ • a) (r⁻¹ • s : R) := by\n by_cases h : s ∈ spectrum R a\n · rw [mem_iff] at h\n simp only [resolvent, Algebra.algebraMap_eq_smul_one] at *\n rw [smul_assoc, ← smul_sub]\n have h' : ¬IsUnit (r⁻¹ • (s • (1 : A) - a)) := fun hu =>\n h (by simpa only [smul_inv_smul] using IsUnit.smul r hu)\n simp only [Ring.inverse_non_unit _ h, Ring.inverse_non_unit _ h', smul_zero]\n · simp only [resolvent]\n have h' : IsUnit (r • algebraMap R A (r⁻¹ • s) - a) := by\n simpa [Algebra.algebraMap_eq_smul_one, smul_assoc] using notMem_iff.mp h\n rw [← h'.val_subInvSMul, ← (notMem_iff.mp h).unit_spec, Ring.inverse_unit, Ring.inverse_unit,\n h'.val_inv_subInvSMul]\n simp only [Algebra.algebraMap_eq_smul_one, smul_assoc, smul_inv_smul]\n\ntheorem units_smul_resolvent_self {r : Rˣ} {a : A} :\n r • resolvent a (r : R) = resolvent (r⁻¹ • a) (1 : R) := by\n simpa only [Units.smul_def, smul_eq_mul, Units.inv_mul] using\n @units_smul_resolvent _ _ _ _ _ r r a\n\n/-- The resolvent is a unit when the argument is in the resolvent set. -/\ntheorem isUnit_resolvent {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (resolvent a r) :=\n isUnit_ringInverse.symm\n\ntheorem inv_mem_resolventSet {r : Rˣ} {a : Aˣ} (h : (r : R) ∈ resolventSet R (a : A)) :\n (↑r⁻¹ : R) ∈ resolventSet R (↑a⁻¹ : A) := by\n rw [mem_resolventSet_iff, Algebra.algebraMap_eq_smul_one, ← Units.smul_def] at h ⊢\n rw [IsUnit.smul_sub_iff_sub_inv_smul, inv_inv, IsUnit.sub_iff]\n have h₁ : (a : A) * (r • (↑a⁻¹ : A) - 1) = r • (1 : A) - a := by\n rw [mul_sub, mul_smul_comm, a.mul_inv, mul_one]\n have h₂ : (r • (↑a⁻¹ : A) - 1) * a = r • (1 : A) - a := by\n rw [sub_mul, smul_mul_assoc, a.inv_mul, one_mul]\n have hcomm : Commute (a : A) (r • (↑a⁻¹ : A) - 1) := by rwa [← h₂] at h₁\n exact (hcomm.isUnit_mul_iff.mp (h₁.symm ▸ h)).2\n\ntheorem inv_mem_iff {r : Rˣ} {a : Aˣ} : (r : R) ∈ σ (a : A) ↔ (↑r⁻¹ : R) ∈ σ (↑a⁻¹ : A) :=\n not_iff_not.2 <| ⟨inv_mem_resolventSet, inv_mem_resolventSet⟩\n\ntheorem zero_mem_resolventSet_of_unit (a : Aˣ) : 0 ∈ resolventSet R (a : A) := by\n simpa only [mem_resolventSet_iff, ← notMem_iff, zero_notMem_iff] using a.isUnit\n\ntheorem ne_zero_of_mem_of_unit {a : Aˣ} {r : R} (hr : r ∈ σ (a : A)) : r ≠ 0 := fun hn =>\n (hn ▸ hr) (zero_mem_resolventSet_of_unit a)","module_header":true,"namespace":"spectrum","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Subalgebra.Basic\npublic import Mathlib.Algebra.Star.Pointwise\npublic import Mathlib.RingTheory.Ideal.Maps\npublic import Mathlib.RingTheory.Ideal.Nonunits\npublic import Mathlib.Tactic.NoncommRing\n\nNamespace:\nspectrum\n\nLocal context:\n/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a := by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff\n\ntheorem zero_notMem_iff {a : A} : (0 : R) ∉ σ a ↔ IsUnit a := by\n rw [zero_mem_iff, Classical.not_not]\n\nalias ⟨isUnit_of_zero_notMem, zero_notMem⟩ := spectrum.zero_notMem_iff\n\n@[simp]\nlemma _root_.Units.zero_notMem_spectrum (a : Aˣ) : 0 ∉ spectrum R (a : A) :=\n spectrum.zero_notMem R a.isUnit\n\nlemma subset_singleton_zero_compl {a : A} (ha : IsUnit a) : spectrum R a ⊆ {0}ᶜ :=\n Set.subset_compl_singleton_iff.mpr <| spectrum.zero_notMem R ha\n\nvariable {R}\n\ntheorem mem_resolventSet_of_left_right_inverse {r : R} {a b c : A} (h₁ : (↑ₐ r - a) * b = 1)\n (h₂ : c * (↑ₐ r - a) = 1) : r ∈ resolventSet R a :=\n Units.isUnit ⟨↑ₐ r - a, b, h₁, by rwa [← left_inv_eq_right_inv h₂ h₁]⟩\n\ntheorem mem_resolventSet_iff {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem algebraMap_mem_iff (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} {r : R} :\n algebraMap R S r ∈ spectrum S a ↔ r ∈ spectrum R a := by\n simp only [spectrum.mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]\n\nprotected alias ⟨of_algebraMap_mem, algebraMap_mem⟩ := spectrum.algebraMap_mem_iff\n\n@[simp]\ntheorem preimage_algebraMap (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} :\n algebraMap R S ⁻¹' spectrum S a = spectrum R a :=\n Set.ext fun _ => spectrum.algebraMap_mem_iff _\n\n@[simp]\ntheorem resolventSet_of_subsingleton [Subsingleton A] (a : A) : resolventSet R a = Set.univ := by\n simp_rw [resolventSet, Subsingleton.elim (algebraMap R A _ - a) 1, isUnit_one, Set.setOf_true]\n\n@[simp]\ntheorem of_subsingleton [Subsingleton A] (a : A) : spectrum R a = ∅ := by\n rw [spectrum, resolventSet_of_subsingleton, Set.compl_univ]\n\ntheorem resolvent_eq {a : A} {r : R} (h : r ∈ resolventSet R a) : resolvent a r = ↑h.unit⁻¹ :=\n Ring.inverse_unit h.unit\n\ntheorem units_smul_resolvent {r : Rˣ} {s : R} {a : A} :\n r • resolvent a (s : R) = resolvent (r⁻¹ • a) (r⁻¹ • s : R) := by\n by_cases h : s ∈ spectrum R a\n · rw [mem_iff] at h\n simp only [resolvent, Algebra.algebraMap_eq_smul_one] at *\n rw [smul_assoc, ← smul_sub]\n have h' : ¬IsUnit (r⁻¹ • (s • (1 : A) - a)) := fun hu =>\n h (by simpa only [smul_inv_smul] using IsUnit.smul r hu)\n simp only [Ring.inverse_non_unit _ h, Ring.inverse_non_unit _ h', smul_zero]\n · simp only [resolvent]\n have h' : IsUnit (r • algebraMap R A (r⁻¹ • s) - a) := by\n simpa [Algebra.algebraMap_eq_smul_one, smul_assoc] using notMem_iff.mp h\n rw [← h'.val_subInvSMul, ← (notMem_iff.mp h).unit_spec, Ring.inverse_unit, Ring.inverse_unit,\n h'.val_inv_subInvSMul]\n simp only [Algebra.algebraMap_eq_smul_one, smul_assoc, smul_inv_smul]\n\ntheorem units_smul_resolvent_self {r : Rˣ} {a : A} :\n r • resolvent a (r : R) = resolvent (r⁻¹ • a) (1 : R) := by\n simpa only [Units.smul_def, smul_eq_mul, Units.inv_mul] using\n @units_smul_resolvent _ _ _ _ _ r r a\n\n/-- The resolvent is a unit when the argument is in the resolvent set. -/\ntheorem isUnit_resolvent {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (resolvent a r) :=\n isUnit_ringInverse.symm\n\ntheorem inv_mem_resolventSet {r : Rˣ} {a : Aˣ} (h : (r : R) ∈ resolventSet R (a : A)) :\n (↑r⁻¹ : R) ∈ resolventSet R (↑a⁻¹ : A) := by\n rw [mem_resolventSet_iff, Algebra.algebraMap_eq_smul_one, ← Units.smul_def] at h ⊢\n rw [IsUnit.smul_sub_iff_sub_inv_smul, inv_inv, IsUnit.sub_iff]\n have h₁ : (a : A) * (r • (↑a⁻¹ : A) - 1) = r • (1 : A) - a := by\n rw [mul_sub, mul_smul_comm, a.mul_inv, mul_one]\n have h₂ : (r • (↑a⁻¹ : A) - 1) * a = r • (1 : A) - a := by\n rw [sub_mul, smul_mul_assoc, a.inv_mul, one_mul]\n have hcomm : Commute (a : A) (r • (↑a⁻¹ : A) - 1) := by rwa [← h₂] at h₁\n exact (hcomm.isUnit_mul_iff.mp (h₁.symm ▸ h)).2\n\ntheorem inv_mem_iff {r : Rˣ} {a : Aˣ} : (r : R) ∈ σ (a : A) ↔ (↑r⁻¹ : R) ∈ σ (↑a⁻¹ : A) :=\n not_iff_not.2 <| ⟨inv_mem_resolventSet, inv_mem_resolventSet⟩\n\ntheorem zero_mem_resolventSet_of_unit (a : Aˣ) : 0 ∈ resolventSet R (a : A) := by\n simpa only [mem_resolventSet_iff, ← notMem_iff, zero_notMem_iff] using a.isUnit\n\ntheorem ne_zero_of_mem_of_unit {a : Aˣ} {r : R} (hr : r ∈ σ (a : A)) : r ≠ 0 := fun hn =>\n (hn ▸ hr) (zero_mem_resolventSet_of_unit a)\n\nTarget:\ntheorem add_mem_iff {a : A} {r s : R} : r + s ∈ σ a ↔ r ∈ σ (-↑ₐ s + a) :=\n\nProof body:\n","proof_body":"by\n simp only [mem_iff, sub_neg_eq_add, ← sub_sub, map_add]","provenance":{"declaration_index":22,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"6b8fb038fd170d1558b267f1b54fd6e008c9c0d4a0e402756920688d7daa0427","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Spectrum/Basic.lean"},"sample_id":"a734e0f1153c3492f7ece7ed415dc089f9e43f8916a3da138c4d84071c5a3d42","schema_version":1,"split":"train","theorem_statement":"theorem add_mem_iff {a : A} {r s : R} : r + s ∈ σ a ↔ r ∈ σ (-↑ₐ s + a) :="} {"completion":"by\n rw [add_mem_iff, neg_add_cancel_left]","context_contains_namespace":true,"context_suffix":"end ScalarSemiring\nend spectrum","dependency_ids":["import:Mathlib.Algebra.Algebra.Subalgebra.Basic","import:Mathlib.Algebra.Star.Pointwise","import:Mathlib.RingTheory.Ideal.Maps","import:Mathlib.RingTheory.Ideal.Nonunits","import:Mathlib.Tactic.NoncommRing"],"family_id":"add_mem_add_iff","file_id":"mathlib/Mathlib/Algebra/Algebra/Spectrum/Basic.lean","imports":["public import Mathlib.Algebra.Algebra.Subalgebra.Basic","public import Mathlib.Algebra.Star.Pointwise","public import Mathlib.RingTheory.Ideal.Maps","public import Mathlib.RingTheory.Ideal.Nonunits","public import Mathlib.Tactic.NoncommRing"],"local_context":"/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a := by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff\n\ntheorem zero_notMem_iff {a : A} : (0 : R) ∉ σ a ↔ IsUnit a := by\n rw [zero_mem_iff, Classical.not_not]\n\nalias ⟨isUnit_of_zero_notMem, zero_notMem⟩ := spectrum.zero_notMem_iff\n\n@[simp]\nlemma _root_.Units.zero_notMem_spectrum (a : Aˣ) : 0 ∉ spectrum R (a : A) :=\n spectrum.zero_notMem R a.isUnit\n\nlemma subset_singleton_zero_compl {a : A} (ha : IsUnit a) : spectrum R a ⊆ {0}ᶜ :=\n Set.subset_compl_singleton_iff.mpr <| spectrum.zero_notMem R ha\n\nvariable {R}\n\ntheorem mem_resolventSet_of_left_right_inverse {r : R} {a b c : A} (h₁ : (↑ₐ r - a) * b = 1)\n (h₂ : c * (↑ₐ r - a) = 1) : r ∈ resolventSet R a :=\n Units.isUnit ⟨↑ₐ r - a, b, h₁, by rwa [← left_inv_eq_right_inv h₂ h₁]⟩\n\ntheorem mem_resolventSet_iff {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem algebraMap_mem_iff (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} {r : R} :\n algebraMap R S r ∈ spectrum S a ↔ r ∈ spectrum R a := by\n simp only [spectrum.mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]\n\nprotected alias ⟨of_algebraMap_mem, algebraMap_mem⟩ := spectrum.algebraMap_mem_iff\n\n@[simp]\ntheorem preimage_algebraMap (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} :\n algebraMap R S ⁻¹' spectrum S a = spectrum R a :=\n Set.ext fun _ => spectrum.algebraMap_mem_iff _\n\n@[simp]\ntheorem resolventSet_of_subsingleton [Subsingleton A] (a : A) : resolventSet R a = Set.univ := by\n simp_rw [resolventSet, Subsingleton.elim (algebraMap R A _ - a) 1, isUnit_one, Set.setOf_true]\n\n@[simp]\ntheorem of_subsingleton [Subsingleton A] (a : A) : spectrum R a = ∅ := by\n rw [spectrum, resolventSet_of_subsingleton, Set.compl_univ]\n\ntheorem resolvent_eq {a : A} {r : R} (h : r ∈ resolventSet R a) : resolvent a r = ↑h.unit⁻¹ :=\n Ring.inverse_unit h.unit\n\ntheorem units_smul_resolvent {r : Rˣ} {s : R} {a : A} :\n r • resolvent a (s : R) = resolvent (r⁻¹ • a) (r⁻¹ • s : R) := by\n by_cases h : s ∈ spectrum R a\n · rw [mem_iff] at h\n simp only [resolvent, Algebra.algebraMap_eq_smul_one] at *\n rw [smul_assoc, ← smul_sub]\n have h' : ¬IsUnit (r⁻¹ • (s • (1 : A) - a)) := fun hu =>\n h (by simpa only [smul_inv_smul] using IsUnit.smul r hu)\n simp only [Ring.inverse_non_unit _ h, Ring.inverse_non_unit _ h', smul_zero]\n · simp only [resolvent]\n have h' : IsUnit (r • algebraMap R A (r⁻¹ • s) - a) := by\n simpa [Algebra.algebraMap_eq_smul_one, smul_assoc] using notMem_iff.mp h\n rw [← h'.val_subInvSMul, ← (notMem_iff.mp h).unit_spec, Ring.inverse_unit, Ring.inverse_unit,\n h'.val_inv_subInvSMul]\n simp only [Algebra.algebraMap_eq_smul_one, smul_assoc, smul_inv_smul]\n\ntheorem units_smul_resolvent_self {r : Rˣ} {a : A} :\n r • resolvent a (r : R) = resolvent (r⁻¹ • a) (1 : R) := by\n simpa only [Units.smul_def, smul_eq_mul, Units.inv_mul] using\n @units_smul_resolvent _ _ _ _ _ r r a\n\n/-- The resolvent is a unit when the argument is in the resolvent set. -/\ntheorem isUnit_resolvent {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (resolvent a r) :=\n isUnit_ringInverse.symm\n\ntheorem inv_mem_resolventSet {r : Rˣ} {a : Aˣ} (h : (r : R) ∈ resolventSet R (a : A)) :\n (↑r⁻¹ : R) ∈ resolventSet R (↑a⁻¹ : A) := by\n rw [mem_resolventSet_iff, Algebra.algebraMap_eq_smul_one, ← Units.smul_def] at h ⊢\n rw [IsUnit.smul_sub_iff_sub_inv_smul, inv_inv, IsUnit.sub_iff]\n have h₁ : (a : A) * (r • (↑a⁻¹ : A) - 1) = r • (1 : A) - a := by\n rw [mul_sub, mul_smul_comm, a.mul_inv, mul_one]\n have h₂ : (r • (↑a⁻¹ : A) - 1) * a = r • (1 : A) - a := by\n rw [sub_mul, smul_mul_assoc, a.inv_mul, one_mul]\n have hcomm : Commute (a : A) (r • (↑a⁻¹ : A) - 1) := by rwa [← h₂] at h₁\n exact (hcomm.isUnit_mul_iff.mp (h₁.symm ▸ h)).2\n\ntheorem inv_mem_iff {r : Rˣ} {a : Aˣ} : (r : R) ∈ σ (a : A) ↔ (↑r⁻¹ : R) ∈ σ (↑a⁻¹ : A) :=\n not_iff_not.2 <| ⟨inv_mem_resolventSet, inv_mem_resolventSet⟩\n\ntheorem zero_mem_resolventSet_of_unit (a : Aˣ) : 0 ∈ resolventSet R (a : A) := by\n simpa only [mem_resolventSet_iff, ← notMem_iff, zero_notMem_iff] using a.isUnit\n\ntheorem ne_zero_of_mem_of_unit {a : Aˣ} {r : R} (hr : r ∈ σ (a : A)) : r ≠ 0 := fun hn =>\n (hn ▸ hr) (zero_mem_resolventSet_of_unit a)\n\ntheorem add_mem_iff {a : A} {r s : R} : r + s ∈ σ a ↔ r ∈ σ (-↑ₐ s + a) := by\n simp only [mem_iff, sub_neg_eq_add, ← sub_sub, map_add]","module_header":true,"namespace":"spectrum","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Subalgebra.Basic\npublic import Mathlib.Algebra.Star.Pointwise\npublic import Mathlib.RingTheory.Ideal.Maps\npublic import Mathlib.RingTheory.Ideal.Nonunits\npublic import Mathlib.Tactic.NoncommRing\n\nNamespace:\nspectrum\n\nLocal context:\n/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a := by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff\n\ntheorem zero_notMem_iff {a : A} : (0 : R) ∉ σ a ↔ IsUnit a := by\n rw [zero_mem_iff, Classical.not_not]\n\nalias ⟨isUnit_of_zero_notMem, zero_notMem⟩ := spectrum.zero_notMem_iff\n\n@[simp]\nlemma _root_.Units.zero_notMem_spectrum (a : Aˣ) : 0 ∉ spectrum R (a : A) :=\n spectrum.zero_notMem R a.isUnit\n\nlemma subset_singleton_zero_compl {a : A} (ha : IsUnit a) : spectrum R a ⊆ {0}ᶜ :=\n Set.subset_compl_singleton_iff.mpr <| spectrum.zero_notMem R ha\n\nvariable {R}\n\ntheorem mem_resolventSet_of_left_right_inverse {r : R} {a b c : A} (h₁ : (↑ₐ r - a) * b = 1)\n (h₂ : c * (↑ₐ r - a) = 1) : r ∈ resolventSet R a :=\n Units.isUnit ⟨↑ₐ r - a, b, h₁, by rwa [← left_inv_eq_right_inv h₂ h₁]⟩\n\ntheorem mem_resolventSet_iff {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem algebraMap_mem_iff (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} {r : R} :\n algebraMap R S r ∈ spectrum S a ↔ r ∈ spectrum R a := by\n simp only [spectrum.mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]\n\nprotected alias ⟨of_algebraMap_mem, algebraMap_mem⟩ := spectrum.algebraMap_mem_iff\n\n@[simp]\ntheorem preimage_algebraMap (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} :\n algebraMap R S ⁻¹' spectrum S a = spectrum R a :=\n Set.ext fun _ => spectrum.algebraMap_mem_iff _\n\n@[simp]\ntheorem resolventSet_of_subsingleton [Subsingleton A] (a : A) : resolventSet R a = Set.univ := by\n simp_rw [resolventSet, Subsingleton.elim (algebraMap R A _ - a) 1, isUnit_one, Set.setOf_true]\n\n@[simp]\ntheorem of_subsingleton [Subsingleton A] (a : A) : spectrum R a = ∅ := by\n rw [spectrum, resolventSet_of_subsingleton, Set.compl_univ]\n\ntheorem resolvent_eq {a : A} {r : R} (h : r ∈ resolventSet R a) : resolvent a r = ↑h.unit⁻¹ :=\n Ring.inverse_unit h.unit\n\ntheorem units_smul_resolvent {r : Rˣ} {s : R} {a : A} :\n r • resolvent a (s : R) = resolvent (r⁻¹ • a) (r⁻¹ • s : R) := by\n by_cases h : s ∈ spectrum R a\n · rw [mem_iff] at h\n simp only [resolvent, Algebra.algebraMap_eq_smul_one] at *\n rw [smul_assoc, ← smul_sub]\n have h' : ¬IsUnit (r⁻¹ • (s • (1 : A) - a)) := fun hu =>\n h (by simpa only [smul_inv_smul] using IsUnit.smul r hu)\n simp only [Ring.inverse_non_unit _ h, Ring.inverse_non_unit _ h', smul_zero]\n · simp only [resolvent]\n have h' : IsUnit (r • algebraMap R A (r⁻¹ • s) - a) := by\n simpa [Algebra.algebraMap_eq_smul_one, smul_assoc] using notMem_iff.mp h\n rw [← h'.val_subInvSMul, ← (notMem_iff.mp h).unit_spec, Ring.inverse_unit, Ring.inverse_unit,\n h'.val_inv_subInvSMul]\n simp only [Algebra.algebraMap_eq_smul_one, smul_assoc, smul_inv_smul]\n\ntheorem units_smul_resolvent_self {r : Rˣ} {a : A} :\n r • resolvent a (r : R) = resolvent (r⁻¹ • a) (1 : R) := by\n simpa only [Units.smul_def, smul_eq_mul, Units.inv_mul] using\n @units_smul_resolvent _ _ _ _ _ r r a\n\n/-- The resolvent is a unit when the argument is in the resolvent set. -/\ntheorem isUnit_resolvent {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (resolvent a r) :=\n isUnit_ringInverse.symm\n\ntheorem inv_mem_resolventSet {r : Rˣ} {a : Aˣ} (h : (r : R) ∈ resolventSet R (a : A)) :\n (↑r⁻¹ : R) ∈ resolventSet R (↑a⁻¹ : A) := by\n rw [mem_resolventSet_iff, Algebra.algebraMap_eq_smul_one, ← Units.smul_def] at h ⊢\n rw [IsUnit.smul_sub_iff_sub_inv_smul, inv_inv, IsUnit.sub_iff]\n have h₁ : (a : A) * (r • (↑a⁻¹ : A) - 1) = r • (1 : A) - a := by\n rw [mul_sub, mul_smul_comm, a.mul_inv, mul_one]\n have h₂ : (r • (↑a⁻¹ : A) - 1) * a = r • (1 : A) - a := by\n rw [sub_mul, smul_mul_assoc, a.inv_mul, one_mul]\n have hcomm : Commute (a : A) (r • (↑a⁻¹ : A) - 1) := by rwa [← h₂] at h₁\n exact (hcomm.isUnit_mul_iff.mp (h₁.symm ▸ h)).2\n\ntheorem inv_mem_iff {r : Rˣ} {a : Aˣ} : (r : R) ∈ σ (a : A) ↔ (↑r⁻¹ : R) ∈ σ (↑a⁻¹ : A) :=\n not_iff_not.2 <| ⟨inv_mem_resolventSet, inv_mem_resolventSet⟩\n\ntheorem zero_mem_resolventSet_of_unit (a : Aˣ) : 0 ∈ resolventSet R (a : A) := by\n simpa only [mem_resolventSet_iff, ← notMem_iff, zero_notMem_iff] using a.isUnit\n\ntheorem ne_zero_of_mem_of_unit {a : Aˣ} {r : R} (hr : r ∈ σ (a : A)) : r ≠ 0 := fun hn =>\n (hn ▸ hr) (zero_mem_resolventSet_of_unit a)\n\ntheorem add_mem_iff {a : A} {r s : R} : r + s ∈ σ a ↔ r ∈ σ (-↑ₐ s + a) := by\n simp only [mem_iff, sub_neg_eq_add, ← sub_sub, map_add]\n\nTarget:\ntheorem add_mem_add_iff {a : A} {r s : R} : r + s ∈ σ (↑ₐ s + a) ↔ r ∈ σ a :=\n\nProof body:\n","proof_body":"by\n rw [add_mem_iff, neg_add_cancel_left]","provenance":{"declaration_index":23,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"6b8fb038fd170d1558b267f1b54fd6e008c9c0d4a0e402756920688d7daa0427","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Spectrum/Basic.lean"},"sample_id":"70e175ead41c0d299c6e5bf3c9aefd0693b1bd7ad0fc28413710a325f252deb1","schema_version":1,"split":"train","theorem_statement":"theorem add_mem_add_iff {a : A} {r s : R} : r + s ∈ σ (↑ₐ s + a) ↔ r ∈ σ a :="} {"completion":"by\n simp only [mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, ← smul_sub, isUnit_smul_iff]","context_contains_namespace":true,"context_suffix":"end ScalarSemiring\nend spectrum","dependency_ids":["import:Mathlib.Algebra.Algebra.Subalgebra.Basic","import:Mathlib.Algebra.Star.Pointwise","import:Mathlib.RingTheory.Ideal.Maps","import:Mathlib.RingTheory.Ideal.Nonunits","import:Mathlib.Tactic.NoncommRing"],"family_id":"smul_mem_smul_iff","file_id":"mathlib/Mathlib/Algebra/Algebra/Spectrum/Basic.lean","imports":["public import Mathlib.Algebra.Algebra.Subalgebra.Basic","public import Mathlib.Algebra.Star.Pointwise","public import Mathlib.RingTheory.Ideal.Maps","public import Mathlib.RingTheory.Ideal.Nonunits","public import Mathlib.Tactic.NoncommRing"],"local_context":"/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a := by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff\n\ntheorem zero_notMem_iff {a : A} : (0 : R) ∉ σ a ↔ IsUnit a := by\n rw [zero_mem_iff, Classical.not_not]\n\nalias ⟨isUnit_of_zero_notMem, zero_notMem⟩ := spectrum.zero_notMem_iff\n\n@[simp]\nlemma _root_.Units.zero_notMem_spectrum (a : Aˣ) : 0 ∉ spectrum R (a : A) :=\n spectrum.zero_notMem R a.isUnit\n\nlemma subset_singleton_zero_compl {a : A} (ha : IsUnit a) : spectrum R a ⊆ {0}ᶜ :=\n Set.subset_compl_singleton_iff.mpr <| spectrum.zero_notMem R ha\n\nvariable {R}\n\ntheorem mem_resolventSet_of_left_right_inverse {r : R} {a b c : A} (h₁ : (↑ₐ r - a) * b = 1)\n (h₂ : c * (↑ₐ r - a) = 1) : r ∈ resolventSet R a :=\n Units.isUnit ⟨↑ₐ r - a, b, h₁, by rwa [← left_inv_eq_right_inv h₂ h₁]⟩\n\ntheorem mem_resolventSet_iff {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem algebraMap_mem_iff (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} {r : R} :\n algebraMap R S r ∈ spectrum S a ↔ r ∈ spectrum R a := by\n simp only [spectrum.mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]\n\nprotected alias ⟨of_algebraMap_mem, algebraMap_mem⟩ := spectrum.algebraMap_mem_iff\n\n@[simp]\ntheorem preimage_algebraMap (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} :\n algebraMap R S ⁻¹' spectrum S a = spectrum R a :=\n Set.ext fun _ => spectrum.algebraMap_mem_iff _\n\n@[simp]\ntheorem resolventSet_of_subsingleton [Subsingleton A] (a : A) : resolventSet R a = Set.univ := by\n simp_rw [resolventSet, Subsingleton.elim (algebraMap R A _ - a) 1, isUnit_one, Set.setOf_true]\n\n@[simp]\ntheorem of_subsingleton [Subsingleton A] (a : A) : spectrum R a = ∅ := by\n rw [spectrum, resolventSet_of_subsingleton, Set.compl_univ]\n\ntheorem resolvent_eq {a : A} {r : R} (h : r ∈ resolventSet R a) : resolvent a r = ↑h.unit⁻¹ :=\n Ring.inverse_unit h.unit\n\ntheorem units_smul_resolvent {r : Rˣ} {s : R} {a : A} :\n r • resolvent a (s : R) = resolvent (r⁻¹ • a) (r⁻¹ • s : R) := by\n by_cases h : s ∈ spectrum R a\n · rw [mem_iff] at h\n simp only [resolvent, Algebra.algebraMap_eq_smul_one] at *\n rw [smul_assoc, ← smul_sub]\n have h' : ¬IsUnit (r⁻¹ • (s • (1 : A) - a)) := fun hu =>\n h (by simpa only [smul_inv_smul] using IsUnit.smul r hu)\n simp only [Ring.inverse_non_unit _ h, Ring.inverse_non_unit _ h', smul_zero]\n · simp only [resolvent]\n have h' : IsUnit (r • algebraMap R A (r⁻¹ • s) - a) := by\n simpa [Algebra.algebraMap_eq_smul_one, smul_assoc] using notMem_iff.mp h\n rw [← h'.val_subInvSMul, ← (notMem_iff.mp h).unit_spec, Ring.inverse_unit, Ring.inverse_unit,\n h'.val_inv_subInvSMul]\n simp only [Algebra.algebraMap_eq_smul_one, smul_assoc, smul_inv_smul]\n\ntheorem units_smul_resolvent_self {r : Rˣ} {a : A} :\n r • resolvent a (r : R) = resolvent (r⁻¹ • a) (1 : R) := by\n simpa only [Units.smul_def, smul_eq_mul, Units.inv_mul] using\n @units_smul_resolvent _ _ _ _ _ r r a\n\n/-- The resolvent is a unit when the argument is in the resolvent set. -/\ntheorem isUnit_resolvent {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (resolvent a r) :=\n isUnit_ringInverse.symm\n\ntheorem inv_mem_resolventSet {r : Rˣ} {a : Aˣ} (h : (r : R) ∈ resolventSet R (a : A)) :\n (↑r⁻¹ : R) ∈ resolventSet R (↑a⁻¹ : A) := by\n rw [mem_resolventSet_iff, Algebra.algebraMap_eq_smul_one, ← Units.smul_def] at h ⊢\n rw [IsUnit.smul_sub_iff_sub_inv_smul, inv_inv, IsUnit.sub_iff]\n have h₁ : (a : A) * (r • (↑a⁻¹ : A) - 1) = r • (1 : A) - a := by\n rw [mul_sub, mul_smul_comm, a.mul_inv, mul_one]\n have h₂ : (r • (↑a⁻¹ : A) - 1) * a = r • (1 : A) - a := by\n rw [sub_mul, smul_mul_assoc, a.inv_mul, one_mul]\n have hcomm : Commute (a : A) (r • (↑a⁻¹ : A) - 1) := by rwa [← h₂] at h₁\n exact (hcomm.isUnit_mul_iff.mp (h₁.symm ▸ h)).2\n\ntheorem inv_mem_iff {r : Rˣ} {a : Aˣ} : (r : R) ∈ σ (a : A) ↔ (↑r⁻¹ : R) ∈ σ (↑a⁻¹ : A) :=\n not_iff_not.2 <| ⟨inv_mem_resolventSet, inv_mem_resolventSet⟩\n\ntheorem zero_mem_resolventSet_of_unit (a : Aˣ) : 0 ∈ resolventSet R (a : A) := by\n simpa only [mem_resolventSet_iff, ← notMem_iff, zero_notMem_iff] using a.isUnit\n\ntheorem ne_zero_of_mem_of_unit {a : Aˣ} {r : R} (hr : r ∈ σ (a : A)) : r ≠ 0 := fun hn =>\n (hn ▸ hr) (zero_mem_resolventSet_of_unit a)\n\ntheorem add_mem_iff {a : A} {r s : R} : r + s ∈ σ a ↔ r ∈ σ (-↑ₐ s + a) := by\n simp only [mem_iff, sub_neg_eq_add, ← sub_sub, map_add]\n\ntheorem add_mem_add_iff {a : A} {r s : R} : r + s ∈ σ (↑ₐ s + a) ↔ r ∈ σ a := by\n rw [add_mem_iff, neg_add_cancel_left]","module_header":true,"namespace":"spectrum","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Subalgebra.Basic\npublic import Mathlib.Algebra.Star.Pointwise\npublic import Mathlib.RingTheory.Ideal.Maps\npublic import Mathlib.RingTheory.Ideal.Nonunits\npublic import Mathlib.Tactic.NoncommRing\n\nNamespace:\nspectrum\n\nLocal context:\n/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a := by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff\n\ntheorem zero_notMem_iff {a : A} : (0 : R) ∉ σ a ↔ IsUnit a := by\n rw [zero_mem_iff, Classical.not_not]\n\nalias ⟨isUnit_of_zero_notMem, zero_notMem⟩ := spectrum.zero_notMem_iff\n\n@[simp]\nlemma _root_.Units.zero_notMem_spectrum (a : Aˣ) : 0 ∉ spectrum R (a : A) :=\n spectrum.zero_notMem R a.isUnit\n\nlemma subset_singleton_zero_compl {a : A} (ha : IsUnit a) : spectrum R a ⊆ {0}ᶜ :=\n Set.subset_compl_singleton_iff.mpr <| spectrum.zero_notMem R ha\n\nvariable {R}\n\ntheorem mem_resolventSet_of_left_right_inverse {r : R} {a b c : A} (h₁ : (↑ₐ r - a) * b = 1)\n (h₂ : c * (↑ₐ r - a) = 1) : r ∈ resolventSet R a :=\n Units.isUnit ⟨↑ₐ r - a, b, h₁, by rwa [← left_inv_eq_right_inv h₂ h₁]⟩\n\ntheorem mem_resolventSet_iff {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem algebraMap_mem_iff (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} {r : R} :\n algebraMap R S r ∈ spectrum S a ↔ r ∈ spectrum R a := by\n simp only [spectrum.mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]\n\nprotected alias ⟨of_algebraMap_mem, algebraMap_mem⟩ := spectrum.algebraMap_mem_iff\n\n@[simp]\ntheorem preimage_algebraMap (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} :\n algebraMap R S ⁻¹' spectrum S a = spectrum R a :=\n Set.ext fun _ => spectrum.algebraMap_mem_iff _\n\n@[simp]\ntheorem resolventSet_of_subsingleton [Subsingleton A] (a : A) : resolventSet R a = Set.univ := by\n simp_rw [resolventSet, Subsingleton.elim (algebraMap R A _ - a) 1, isUnit_one, Set.setOf_true]\n\n@[simp]\ntheorem of_subsingleton [Subsingleton A] (a : A) : spectrum R a = ∅ := by\n rw [spectrum, resolventSet_of_subsingleton, Set.compl_univ]\n\ntheorem resolvent_eq {a : A} {r : R} (h : r ∈ resolventSet R a) : resolvent a r = ↑h.unit⁻¹ :=\n Ring.inverse_unit h.unit\n\ntheorem units_smul_resolvent {r : Rˣ} {s : R} {a : A} :\n r • resolvent a (s : R) = resolvent (r⁻¹ • a) (r⁻¹ • s : R) := by\n by_cases h : s ∈ spectrum R a\n · rw [mem_iff] at h\n simp only [resolvent, Algebra.algebraMap_eq_smul_one] at *\n rw [smul_assoc, ← smul_sub]\n have h' : ¬IsUnit (r⁻¹ • (s • (1 : A) - a)) := fun hu =>\n h (by simpa only [smul_inv_smul] using IsUnit.smul r hu)\n simp only [Ring.inverse_non_unit _ h, Ring.inverse_non_unit _ h', smul_zero]\n · simp only [resolvent]\n have h' : IsUnit (r • algebraMap R A (r⁻¹ • s) - a) := by\n simpa [Algebra.algebraMap_eq_smul_one, smul_assoc] using notMem_iff.mp h\n rw [← h'.val_subInvSMul, ← (notMem_iff.mp h).unit_spec, Ring.inverse_unit, Ring.inverse_unit,\n h'.val_inv_subInvSMul]\n simp only [Algebra.algebraMap_eq_smul_one, smul_assoc, smul_inv_smul]\n\ntheorem units_smul_resolvent_self {r : Rˣ} {a : A} :\n r • resolvent a (r : R) = resolvent (r⁻¹ • a) (1 : R) := by\n simpa only [Units.smul_def, smul_eq_mul, Units.inv_mul] using\n @units_smul_resolvent _ _ _ _ _ r r a\n\n/-- The resolvent is a unit when the argument is in the resolvent set. -/\ntheorem isUnit_resolvent {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (resolvent a r) :=\n isUnit_ringInverse.symm\n\ntheorem inv_mem_resolventSet {r : Rˣ} {a : Aˣ} (h : (r : R) ∈ resolventSet R (a : A)) :\n (↑r⁻¹ : R) ∈ resolventSet R (↑a⁻¹ : A) := by\n rw [mem_resolventSet_iff, Algebra.algebraMap_eq_smul_one, ← Units.smul_def] at h ⊢\n rw [IsUnit.smul_sub_iff_sub_inv_smul, inv_inv, IsUnit.sub_iff]\n have h₁ : (a : A) * (r • (↑a⁻¹ : A) - 1) = r • (1 : A) - a := by\n rw [mul_sub, mul_smul_comm, a.mul_inv, mul_one]\n have h₂ : (r • (↑a⁻¹ : A) - 1) * a = r • (1 : A) - a := by\n rw [sub_mul, smul_mul_assoc, a.inv_mul, one_mul]\n have hcomm : Commute (a : A) (r • (↑a⁻¹ : A) - 1) := by rwa [← h₂] at h₁\n exact (hcomm.isUnit_mul_iff.mp (h₁.symm ▸ h)).2\n\ntheorem inv_mem_iff {r : Rˣ} {a : Aˣ} : (r : R) ∈ σ (a : A) ↔ (↑r⁻¹ : R) ∈ σ (↑a⁻¹ : A) :=\n not_iff_not.2 <| ⟨inv_mem_resolventSet, inv_mem_resolventSet⟩\n\ntheorem zero_mem_resolventSet_of_unit (a : Aˣ) : 0 ∈ resolventSet R (a : A) := by\n simpa only [mem_resolventSet_iff, ← notMem_iff, zero_notMem_iff] using a.isUnit\n\ntheorem ne_zero_of_mem_of_unit {a : Aˣ} {r : R} (hr : r ∈ σ (a : A)) : r ≠ 0 := fun hn =>\n (hn ▸ hr) (zero_mem_resolventSet_of_unit a)\n\ntheorem add_mem_iff {a : A} {r s : R} : r + s ∈ σ a ↔ r ∈ σ (-↑ₐ s + a) := by\n simp only [mem_iff, sub_neg_eq_add, ← sub_sub, map_add]\n\ntheorem add_mem_add_iff {a : A} {r s : R} : r + s ∈ σ (↑ₐ s + a) ↔ r ∈ σ a := by\n rw [add_mem_iff, neg_add_cancel_left]\n\nTarget:\ntheorem smul_mem_smul_iff {a : A} {s : R} {r : Rˣ} : r • s ∈ σ (r • a) ↔ s ∈ σ a :=\n\nProof body:\n","proof_body":"by\n simp only [mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, ← smul_sub, isUnit_smul_iff]","provenance":{"declaration_index":24,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"6b8fb038fd170d1558b267f1b54fd6e008c9c0d4a0e402756920688d7daa0427","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Spectrum/Basic.lean"},"sample_id":"107babcb0134f218135f4da99daaef910bb10ae569adc6d41cf8a5dc1ee0ae41","schema_version":1,"split":"train","theorem_statement":"theorem smul_mem_smul_iff {a : A} {s : R} {r : Rˣ} : r • s ∈ σ (r • a) ↔ s ∈ σ a :="} {"completion":"by\n ext x\n have x_eq : x = r • r⁻¹ • x := by simp\n nth_rw 1 [x_eq]\n rw [smul_mem_smul_iff]\n constructor\n · exact fun h => ⟨r⁻¹ • x, ⟨h, show r • r⁻¹ • x = x by simp⟩⟩\n · rintro ⟨w, _, (x'_eq : r • w = x)⟩\n simpa [← x'_eq]\n\n-- `r ∈ σ(a*b) ↔ r ∈ σ(b*a)` for any `r : Rˣ`","context_contains_namespace":true,"context_suffix":"end ScalarSemiring\nend spectrum","dependency_ids":["import:Mathlib.Algebra.Algebra.Subalgebra.Basic","import:Mathlib.Algebra.Star.Pointwise","import:Mathlib.RingTheory.Ideal.Maps","import:Mathlib.RingTheory.Ideal.Nonunits","import:Mathlib.Tactic.NoncommRing"],"family_id":"unit_smul_eq_smul","file_id":"mathlib/Mathlib/Algebra/Algebra/Spectrum/Basic.lean","imports":["public import Mathlib.Algebra.Algebra.Subalgebra.Basic","public import Mathlib.Algebra.Star.Pointwise","public import Mathlib.RingTheory.Ideal.Maps","public import Mathlib.RingTheory.Ideal.Nonunits","public import Mathlib.Tactic.NoncommRing"],"local_context":"/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a := by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff\n\ntheorem zero_notMem_iff {a : A} : (0 : R) ∉ σ a ↔ IsUnit a := by\n rw [zero_mem_iff, Classical.not_not]\n\nalias ⟨isUnit_of_zero_notMem, zero_notMem⟩ := spectrum.zero_notMem_iff\n\n@[simp]\nlemma _root_.Units.zero_notMem_spectrum (a : Aˣ) : 0 ∉ spectrum R (a : A) :=\n spectrum.zero_notMem R a.isUnit\n\nlemma subset_singleton_zero_compl {a : A} (ha : IsUnit a) : spectrum R a ⊆ {0}ᶜ :=\n Set.subset_compl_singleton_iff.mpr <| spectrum.zero_notMem R ha\n\nvariable {R}\n\ntheorem mem_resolventSet_of_left_right_inverse {r : R} {a b c : A} (h₁ : (↑ₐ r - a) * b = 1)\n (h₂ : c * (↑ₐ r - a) = 1) : r ∈ resolventSet R a :=\n Units.isUnit ⟨↑ₐ r - a, b, h₁, by rwa [← left_inv_eq_right_inv h₂ h₁]⟩\n\ntheorem mem_resolventSet_iff {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem algebraMap_mem_iff (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} {r : R} :\n algebraMap R S r ∈ spectrum S a ↔ r ∈ spectrum R a := by\n simp only [spectrum.mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]\n\nprotected alias ⟨of_algebraMap_mem, algebraMap_mem⟩ := spectrum.algebraMap_mem_iff\n\n@[simp]\ntheorem preimage_algebraMap (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} :\n algebraMap R S ⁻¹' spectrum S a = spectrum R a :=\n Set.ext fun _ => spectrum.algebraMap_mem_iff _\n\n@[simp]\ntheorem resolventSet_of_subsingleton [Subsingleton A] (a : A) : resolventSet R a = Set.univ := by\n simp_rw [resolventSet, Subsingleton.elim (algebraMap R A _ - a) 1, isUnit_one, Set.setOf_true]\n\n@[simp]\ntheorem of_subsingleton [Subsingleton A] (a : A) : spectrum R a = ∅ := by\n rw [spectrum, resolventSet_of_subsingleton, Set.compl_univ]\n\ntheorem resolvent_eq {a : A} {r : R} (h : r ∈ resolventSet R a) : resolvent a r = ↑h.unit⁻¹ :=\n Ring.inverse_unit h.unit\n\ntheorem units_smul_resolvent {r : Rˣ} {s : R} {a : A} :\n r • resolvent a (s : R) = resolvent (r⁻¹ • a) (r⁻¹ • s : R) := by\n by_cases h : s ∈ spectrum R a\n · rw [mem_iff] at h\n simp only [resolvent, Algebra.algebraMap_eq_smul_one] at *\n rw [smul_assoc, ← smul_sub]\n have h' : ¬IsUnit (r⁻¹ • (s • (1 : A) - a)) := fun hu =>\n h (by simpa only [smul_inv_smul] using IsUnit.smul r hu)\n simp only [Ring.inverse_non_unit _ h, Ring.inverse_non_unit _ h', smul_zero]\n · simp only [resolvent]\n have h' : IsUnit (r • algebraMap R A (r⁻¹ • s) - a) := by\n simpa [Algebra.algebraMap_eq_smul_one, smul_assoc] using notMem_iff.mp h\n rw [← h'.val_subInvSMul, ← (notMem_iff.mp h).unit_spec, Ring.inverse_unit, Ring.inverse_unit,\n h'.val_inv_subInvSMul]\n simp only [Algebra.algebraMap_eq_smul_one, smul_assoc, smul_inv_smul]\n\ntheorem units_smul_resolvent_self {r : Rˣ} {a : A} :\n r • resolvent a (r : R) = resolvent (r⁻¹ • a) (1 : R) := by\n simpa only [Units.smul_def, smul_eq_mul, Units.inv_mul] using\n @units_smul_resolvent _ _ _ _ _ r r a\n\n/-- The resolvent is a unit when the argument is in the resolvent set. -/\ntheorem isUnit_resolvent {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (resolvent a r) :=\n isUnit_ringInverse.symm\n\ntheorem inv_mem_resolventSet {r : Rˣ} {a : Aˣ} (h : (r : R) ∈ resolventSet R (a : A)) :\n (↑r⁻¹ : R) ∈ resolventSet R (↑a⁻¹ : A) := by\n rw [mem_resolventSet_iff, Algebra.algebraMap_eq_smul_one, ← Units.smul_def] at h ⊢\n rw [IsUnit.smul_sub_iff_sub_inv_smul, inv_inv, IsUnit.sub_iff]\n have h₁ : (a : A) * (r • (↑a⁻¹ : A) - 1) = r • (1 : A) - a := by\n rw [mul_sub, mul_smul_comm, a.mul_inv, mul_one]\n have h₂ : (r • (↑a⁻¹ : A) - 1) * a = r • (1 : A) - a := by\n rw [sub_mul, smul_mul_assoc, a.inv_mul, one_mul]\n have hcomm : Commute (a : A) (r • (↑a⁻¹ : A) - 1) := by rwa [← h₂] at h₁\n exact (hcomm.isUnit_mul_iff.mp (h₁.symm ▸ h)).2\n\ntheorem inv_mem_iff {r : Rˣ} {a : Aˣ} : (r : R) ∈ σ (a : A) ↔ (↑r⁻¹ : R) ∈ σ (↑a⁻¹ : A) :=\n not_iff_not.2 <| ⟨inv_mem_resolventSet, inv_mem_resolventSet⟩\n\ntheorem zero_mem_resolventSet_of_unit (a : Aˣ) : 0 ∈ resolventSet R (a : A) := by\n simpa only [mem_resolventSet_iff, ← notMem_iff, zero_notMem_iff] using a.isUnit\n\ntheorem ne_zero_of_mem_of_unit {a : Aˣ} {r : R} (hr : r ∈ σ (a : A)) : r ≠ 0 := fun hn =>\n (hn ▸ hr) (zero_mem_resolventSet_of_unit a)\n\ntheorem add_mem_iff {a : A} {r s : R} : r + s ∈ σ a ↔ r ∈ σ (-↑ₐ s + a) := by\n simp only [mem_iff, sub_neg_eq_add, ← sub_sub, map_add]\n\ntheorem add_mem_add_iff {a : A} {r s : R} : r + s ∈ σ (↑ₐ s + a) ↔ r ∈ σ a := by\n rw [add_mem_iff, neg_add_cancel_left]\n\ntheorem smul_mem_smul_iff {a : A} {s : R} {r : Rˣ} : r • s ∈ σ (r • a) ↔ s ∈ σ a := by\n simp only [mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, ← smul_sub, isUnit_smul_iff]","module_header":true,"namespace":"spectrum","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Subalgebra.Basic\npublic import Mathlib.Algebra.Star.Pointwise\npublic import Mathlib.RingTheory.Ideal.Maps\npublic import Mathlib.RingTheory.Ideal.Nonunits\npublic import Mathlib.Tactic.NoncommRing\n\nNamespace:\nspectrum\n\nLocal context:\n/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a := by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff\n\ntheorem zero_notMem_iff {a : A} : (0 : R) ∉ σ a ↔ IsUnit a := by\n rw [zero_mem_iff, Classical.not_not]\n\nalias ⟨isUnit_of_zero_notMem, zero_notMem⟩ := spectrum.zero_notMem_iff\n\n@[simp]\nlemma _root_.Units.zero_notMem_spectrum (a : Aˣ) : 0 ∉ spectrum R (a : A) :=\n spectrum.zero_notMem R a.isUnit\n\nlemma subset_singleton_zero_compl {a : A} (ha : IsUnit a) : spectrum R a ⊆ {0}ᶜ :=\n Set.subset_compl_singleton_iff.mpr <| spectrum.zero_notMem R ha\n\nvariable {R}\n\ntheorem mem_resolventSet_of_left_right_inverse {r : R} {a b c : A} (h₁ : (↑ₐ r - a) * b = 1)\n (h₂ : c * (↑ₐ r - a) = 1) : r ∈ resolventSet R a :=\n Units.isUnit ⟨↑ₐ r - a, b, h₁, by rwa [← left_inv_eq_right_inv h₂ h₁]⟩\n\ntheorem mem_resolventSet_iff {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem algebraMap_mem_iff (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} {r : R} :\n algebraMap R S r ∈ spectrum S a ↔ r ∈ spectrum R a := by\n simp only [spectrum.mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]\n\nprotected alias ⟨of_algebraMap_mem, algebraMap_mem⟩ := spectrum.algebraMap_mem_iff\n\n@[simp]\ntheorem preimage_algebraMap (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} :\n algebraMap R S ⁻¹' spectrum S a = spectrum R a :=\n Set.ext fun _ => spectrum.algebraMap_mem_iff _\n\n@[simp]\ntheorem resolventSet_of_subsingleton [Subsingleton A] (a : A) : resolventSet R a = Set.univ := by\n simp_rw [resolventSet, Subsingleton.elim (algebraMap R A _ - a) 1, isUnit_one, Set.setOf_true]\n\n@[simp]\ntheorem of_subsingleton [Subsingleton A] (a : A) : spectrum R a = ∅ := by\n rw [spectrum, resolventSet_of_subsingleton, Set.compl_univ]\n\ntheorem resolvent_eq {a : A} {r : R} (h : r ∈ resolventSet R a) : resolvent a r = ↑h.unit⁻¹ :=\n Ring.inverse_unit h.unit\n\ntheorem units_smul_resolvent {r : Rˣ} {s : R} {a : A} :\n r • resolvent a (s : R) = resolvent (r⁻¹ • a) (r⁻¹ • s : R) := by\n by_cases h : s ∈ spectrum R a\n · rw [mem_iff] at h\n simp only [resolvent, Algebra.algebraMap_eq_smul_one] at *\n rw [smul_assoc, ← smul_sub]\n have h' : ¬IsUnit (r⁻¹ • (s • (1 : A) - a)) := fun hu =>\n h (by simpa only [smul_inv_smul] using IsUnit.smul r hu)\n simp only [Ring.inverse_non_unit _ h, Ring.inverse_non_unit _ h', smul_zero]\n · simp only [resolvent]\n have h' : IsUnit (r • algebraMap R A (r⁻¹ • s) - a) := by\n simpa [Algebra.algebraMap_eq_smul_one, smul_assoc] using notMem_iff.mp h\n rw [← h'.val_subInvSMul, ← (notMem_iff.mp h).unit_spec, Ring.inverse_unit, Ring.inverse_unit,\n h'.val_inv_subInvSMul]\n simp only [Algebra.algebraMap_eq_smul_one, smul_assoc, smul_inv_smul]\n\ntheorem units_smul_resolvent_self {r : Rˣ} {a : A} :\n r • resolvent a (r : R) = resolvent (r⁻¹ • a) (1 : R) := by\n simpa only [Units.smul_def, smul_eq_mul, Units.inv_mul] using\n @units_smul_resolvent _ _ _ _ _ r r a\n\n/-- The resolvent is a unit when the argument is in the resolvent set. -/\ntheorem isUnit_resolvent {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (resolvent a r) :=\n isUnit_ringInverse.symm\n\ntheorem inv_mem_resolventSet {r : Rˣ} {a : Aˣ} (h : (r : R) ∈ resolventSet R (a : A)) :\n (↑r⁻¹ : R) ∈ resolventSet R (↑a⁻¹ : A) := by\n rw [mem_resolventSet_iff, Algebra.algebraMap_eq_smul_one, ← Units.smul_def] at h ⊢\n rw [IsUnit.smul_sub_iff_sub_inv_smul, inv_inv, IsUnit.sub_iff]\n have h₁ : (a : A) * (r • (↑a⁻¹ : A) - 1) = r • (1 : A) - a := by\n rw [mul_sub, mul_smul_comm, a.mul_inv, mul_one]\n have h₂ : (r • (↑a⁻¹ : A) - 1) * a = r • (1 : A) - a := by\n rw [sub_mul, smul_mul_assoc, a.inv_mul, one_mul]\n have hcomm : Commute (a : A) (r • (↑a⁻¹ : A) - 1) := by rwa [← h₂] at h₁\n exact (hcomm.isUnit_mul_iff.mp (h₁.symm ▸ h)).2\n\ntheorem inv_mem_iff {r : Rˣ} {a : Aˣ} : (r : R) ∈ σ (a : A) ↔ (↑r⁻¹ : R) ∈ σ (↑a⁻¹ : A) :=\n not_iff_not.2 <| ⟨inv_mem_resolventSet, inv_mem_resolventSet⟩\n\ntheorem zero_mem_resolventSet_of_unit (a : Aˣ) : 0 ∈ resolventSet R (a : A) := by\n simpa only [mem_resolventSet_iff, ← notMem_iff, zero_notMem_iff] using a.isUnit\n\ntheorem ne_zero_of_mem_of_unit {a : Aˣ} {r : R} (hr : r ∈ σ (a : A)) : r ≠ 0 := fun hn =>\n (hn ▸ hr) (zero_mem_resolventSet_of_unit a)\n\ntheorem add_mem_iff {a : A} {r s : R} : r + s ∈ σ a ↔ r ∈ σ (-↑ₐ s + a) := by\n simp only [mem_iff, sub_neg_eq_add, ← sub_sub, map_add]\n\ntheorem add_mem_add_iff {a : A} {r s : R} : r + s ∈ σ (↑ₐ s + a) ↔ r ∈ σ a := by\n rw [add_mem_iff, neg_add_cancel_left]\n\ntheorem smul_mem_smul_iff {a : A} {s : R} {r : Rˣ} : r • s ∈ σ (r • a) ↔ s ∈ σ a := by\n simp only [mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, ← smul_sub, isUnit_smul_iff]\n\nTarget:\ntheorem unit_smul_eq_smul (a : A) (r : Rˣ) : σ (r • a) = r • σ a :=\n\nProof body:\n","proof_body":"by\n ext x\n have x_eq : x = r • r⁻¹ • x := by simp\n nth_rw 1 [x_eq]\n rw [smul_mem_smul_iff]\n constructor\n · exact fun h => ⟨r⁻¹ • x, ⟨h, show r • r⁻¹ • x = x by simp⟩⟩\n · rintro ⟨w, _, (x'_eq : r • w = x)⟩\n simpa [← x'_eq]\n\n-- `r ∈ σ(a*b) ↔ r ∈ σ(b*a)` for any `r : Rˣ`","provenance":{"declaration_index":25,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"6b8fb038fd170d1558b267f1b54fd6e008c9c0d4a0e402756920688d7daa0427","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Spectrum/Basic.lean"},"sample_id":"b6c811571522c598639a5801e6ce35235d0dfe22831ca7e53c9dc2a0a2d7d160","schema_version":1,"split":"train","theorem_statement":"theorem unit_smul_eq_smul (a : A) (r : Rˣ) : σ (r • a) = r • σ a :="} {"completion":"by\n have h₁ : ∀ x y : A, IsUnit (1 - x * y) → IsUnit (1 - y * x) := by\n refine fun x y h => ⟨⟨1 - y * x, 1 + y * h.unit.inv * x, ?_, ?_⟩, rfl⟩\n · calc\n (1 - y * x) * (1 + y * (IsUnit.unit h).inv * x) =\n 1 - y * x + y * ((1 - x * y) * h.unit.inv) * x := by noncomm_ring\n _ = 1 := by simp only [Units.inv_eq_val_inv, IsUnit.mul_val_inv, mul_one, sub_add_cancel]\n · calc\n (1 + y * (IsUnit.unit h).inv * x) * (1 - y * x) =\n 1 - y * x + y * (h.unit.inv * (1 - x * y)) * x := by noncomm_ring\n _ = 1 := by simp only [Units.inv_eq_val_inv, IsUnit.val_inv_mul, mul_one, sub_add_cancel]\n have := Iff.intro (h₁ (r⁻¹ • a) b) (h₁ b (r⁻¹ • a))\n rw [mul_smul_comm r⁻¹ b a] at this\n simpa only [mem_iff, not_iff_not, Algebra.algebraMap_eq_smul_one, ← Units.smul_def,\n IsUnit.smul_sub_iff_sub_inv_smul, smul_mul_assoc]","context_contains_namespace":true,"context_suffix":"end ScalarSemiring\nend spectrum","dependency_ids":["import:Mathlib.Algebra.Algebra.Subalgebra.Basic","import:Mathlib.Algebra.Star.Pointwise","import:Mathlib.RingTheory.Ideal.Maps","import:Mathlib.RingTheory.Ideal.Nonunits","import:Mathlib.Tactic.NoncommRing"],"family_id":"unit_mem_mul_comm","file_id":"mathlib/Mathlib/Algebra/Algebra/Spectrum/Basic.lean","imports":["public import Mathlib.Algebra.Algebra.Subalgebra.Basic","public import Mathlib.Algebra.Star.Pointwise","public import Mathlib.RingTheory.Ideal.Maps","public import Mathlib.RingTheory.Ideal.Nonunits","public import Mathlib.Tactic.NoncommRing"],"local_context":"/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a := by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff\n\ntheorem zero_notMem_iff {a : A} : (0 : R) ∉ σ a ↔ IsUnit a := by\n rw [zero_mem_iff, Classical.not_not]\n\nalias ⟨isUnit_of_zero_notMem, zero_notMem⟩ := spectrum.zero_notMem_iff\n\n@[simp]\nlemma _root_.Units.zero_notMem_spectrum (a : Aˣ) : 0 ∉ spectrum R (a : A) :=\n spectrum.zero_notMem R a.isUnit\n\nlemma subset_singleton_zero_compl {a : A} (ha : IsUnit a) : spectrum R a ⊆ {0}ᶜ :=\n Set.subset_compl_singleton_iff.mpr <| spectrum.zero_notMem R ha\n\nvariable {R}\n\ntheorem mem_resolventSet_of_left_right_inverse {r : R} {a b c : A} (h₁ : (↑ₐ r - a) * b = 1)\n (h₂ : c * (↑ₐ r - a) = 1) : r ∈ resolventSet R a :=\n Units.isUnit ⟨↑ₐ r - a, b, h₁, by rwa [← left_inv_eq_right_inv h₂ h₁]⟩\n\ntheorem mem_resolventSet_iff {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem algebraMap_mem_iff (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} {r : R} :\n algebraMap R S r ∈ spectrum S a ↔ r ∈ spectrum R a := by\n simp only [spectrum.mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]\n\nprotected alias ⟨of_algebraMap_mem, algebraMap_mem⟩ := spectrum.algebraMap_mem_iff\n\n@[simp]\ntheorem preimage_algebraMap (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} :\n algebraMap R S ⁻¹' spectrum S a = spectrum R a :=\n Set.ext fun _ => spectrum.algebraMap_mem_iff _\n\n@[simp]\ntheorem resolventSet_of_subsingleton [Subsingleton A] (a : A) : resolventSet R a = Set.univ := by\n simp_rw [resolventSet, Subsingleton.elim (algebraMap R A _ - a) 1, isUnit_one, Set.setOf_true]\n\n@[simp]\ntheorem of_subsingleton [Subsingleton A] (a : A) : spectrum R a = ∅ := by\n rw [spectrum, resolventSet_of_subsingleton, Set.compl_univ]\n\ntheorem resolvent_eq {a : A} {r : R} (h : r ∈ resolventSet R a) : resolvent a r = ↑h.unit⁻¹ :=\n Ring.inverse_unit h.unit\n\ntheorem units_smul_resolvent {r : Rˣ} {s : R} {a : A} :\n r • resolvent a (s : R) = resolvent (r⁻¹ • a) (r⁻¹ • s : R) := by\n by_cases h : s ∈ spectrum R a\n · rw [mem_iff] at h\n simp only [resolvent, Algebra.algebraMap_eq_smul_one] at *\n rw [smul_assoc, ← smul_sub]\n have h' : ¬IsUnit (r⁻¹ • (s • (1 : A) - a)) := fun hu =>\n h (by simpa only [smul_inv_smul] using IsUnit.smul r hu)\n simp only [Ring.inverse_non_unit _ h, Ring.inverse_non_unit _ h', smul_zero]\n · simp only [resolvent]\n have h' : IsUnit (r • algebraMap R A (r⁻¹ • s) - a) := by\n simpa [Algebra.algebraMap_eq_smul_one, smul_assoc] using notMem_iff.mp h\n rw [← h'.val_subInvSMul, ← (notMem_iff.mp h).unit_spec, Ring.inverse_unit, Ring.inverse_unit,\n h'.val_inv_subInvSMul]\n simp only [Algebra.algebraMap_eq_smul_one, smul_assoc, smul_inv_smul]\n\ntheorem units_smul_resolvent_self {r : Rˣ} {a : A} :\n r • resolvent a (r : R) = resolvent (r⁻¹ • a) (1 : R) := by\n simpa only [Units.smul_def, smul_eq_mul, Units.inv_mul] using\n @units_smul_resolvent _ _ _ _ _ r r a\n\n/-- The resolvent is a unit when the argument is in the resolvent set. -/\ntheorem isUnit_resolvent {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (resolvent a r) :=\n isUnit_ringInverse.symm\n\ntheorem inv_mem_resolventSet {r : Rˣ} {a : Aˣ} (h : (r : R) ∈ resolventSet R (a : A)) :\n (↑r⁻¹ : R) ∈ resolventSet R (↑a⁻¹ : A) := by\n rw [mem_resolventSet_iff, Algebra.algebraMap_eq_smul_one, ← Units.smul_def] at h ⊢\n rw [IsUnit.smul_sub_iff_sub_inv_smul, inv_inv, IsUnit.sub_iff]\n have h₁ : (a : A) * (r • (↑a⁻¹ : A) - 1) = r • (1 : A) - a := by\n rw [mul_sub, mul_smul_comm, a.mul_inv, mul_one]\n have h₂ : (r • (↑a⁻¹ : A) - 1) * a = r • (1 : A) - a := by\n rw [sub_mul, smul_mul_assoc, a.inv_mul, one_mul]\n have hcomm : Commute (a : A) (r • (↑a⁻¹ : A) - 1) := by rwa [← h₂] at h₁\n exact (hcomm.isUnit_mul_iff.mp (h₁.symm ▸ h)).2\n\ntheorem inv_mem_iff {r : Rˣ} {a : Aˣ} : (r : R) ∈ σ (a : A) ↔ (↑r⁻¹ : R) ∈ σ (↑a⁻¹ : A) :=\n not_iff_not.2 <| ⟨inv_mem_resolventSet, inv_mem_resolventSet⟩\n\ntheorem zero_mem_resolventSet_of_unit (a : Aˣ) : 0 ∈ resolventSet R (a : A) := by\n simpa only [mem_resolventSet_iff, ← notMem_iff, zero_notMem_iff] using a.isUnit\n\ntheorem ne_zero_of_mem_of_unit {a : Aˣ} {r : R} (hr : r ∈ σ (a : A)) : r ≠ 0 := fun hn =>\n (hn ▸ hr) (zero_mem_resolventSet_of_unit a)\n\ntheorem add_mem_iff {a : A} {r s : R} : r + s ∈ σ a ↔ r ∈ σ (-↑ₐ s + a) := by\n simp only [mem_iff, sub_neg_eq_add, ← sub_sub, map_add]\n\ntheorem add_mem_add_iff {a : A} {r s : R} : r + s ∈ σ (↑ₐ s + a) ↔ r ∈ σ a := by\n rw [add_mem_iff, neg_add_cancel_left]\n\ntheorem smul_mem_smul_iff {a : A} {s : R} {r : Rˣ} : r • s ∈ σ (r • a) ↔ s ∈ σ a := by\n simp only [mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, ← smul_sub, isUnit_smul_iff]\n\ntheorem unit_smul_eq_smul (a : A) (r : Rˣ) : σ (r • a) = r • σ a := by\n ext x\n have x_eq : x = r • r⁻¹ • x := by simp\n nth_rw 1 [x_eq]\n rw [smul_mem_smul_iff]\n constructor\n · exact fun h => ⟨r⁻¹ • x, ⟨h, show r • r⁻¹ • x = x by simp⟩⟩\n · rintro ⟨w, _, (x'_eq : r • w = x)⟩\n simpa [← x'_eq]\n\n-- `r ∈ σ(a*b) ↔ r ∈ σ(b*a)` for any `r : Rˣ`","module_header":true,"namespace":"spectrum","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Subalgebra.Basic\npublic import Mathlib.Algebra.Star.Pointwise\npublic import Mathlib.RingTheory.Ideal.Maps\npublic import Mathlib.RingTheory.Ideal.Nonunits\npublic import Mathlib.Tactic.NoncommRing\n\nNamespace:\nspectrum\n\nLocal context:\n/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a := by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff\n\ntheorem zero_notMem_iff {a : A} : (0 : R) ∉ σ a ↔ IsUnit a := by\n rw [zero_mem_iff, Classical.not_not]\n\nalias ⟨isUnit_of_zero_notMem, zero_notMem⟩ := spectrum.zero_notMem_iff\n\n@[simp]\nlemma _root_.Units.zero_notMem_spectrum (a : Aˣ) : 0 ∉ spectrum R (a : A) :=\n spectrum.zero_notMem R a.isUnit\n\nlemma subset_singleton_zero_compl {a : A} (ha : IsUnit a) : spectrum R a ⊆ {0}ᶜ :=\n Set.subset_compl_singleton_iff.mpr <| spectrum.zero_notMem R ha\n\nvariable {R}\n\ntheorem mem_resolventSet_of_left_right_inverse {r : R} {a b c : A} (h₁ : (↑ₐ r - a) * b = 1)\n (h₂ : c * (↑ₐ r - a) = 1) : r ∈ resolventSet R a :=\n Units.isUnit ⟨↑ₐ r - a, b, h₁, by rwa [← left_inv_eq_right_inv h₂ h₁]⟩\n\ntheorem mem_resolventSet_iff {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem algebraMap_mem_iff (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} {r : R} :\n algebraMap R S r ∈ spectrum S a ↔ r ∈ spectrum R a := by\n simp only [spectrum.mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]\n\nprotected alias ⟨of_algebraMap_mem, algebraMap_mem⟩ := spectrum.algebraMap_mem_iff\n\n@[simp]\ntheorem preimage_algebraMap (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} :\n algebraMap R S ⁻¹' spectrum S a = spectrum R a :=\n Set.ext fun _ => spectrum.algebraMap_mem_iff _\n\n@[simp]\ntheorem resolventSet_of_subsingleton [Subsingleton A] (a : A) : resolventSet R a = Set.univ := by\n simp_rw [resolventSet, Subsingleton.elim (algebraMap R A _ - a) 1, isUnit_one, Set.setOf_true]\n\n@[simp]\ntheorem of_subsingleton [Subsingleton A] (a : A) : spectrum R a = ∅ := by\n rw [spectrum, resolventSet_of_subsingleton, Set.compl_univ]\n\ntheorem resolvent_eq {a : A} {r : R} (h : r ∈ resolventSet R a) : resolvent a r = ↑h.unit⁻¹ :=\n Ring.inverse_unit h.unit\n\ntheorem units_smul_resolvent {r : Rˣ} {s : R} {a : A} :\n r • resolvent a (s : R) = resolvent (r⁻¹ • a) (r⁻¹ • s : R) := by\n by_cases h : s ∈ spectrum R a\n · rw [mem_iff] at h\n simp only [resolvent, Algebra.algebraMap_eq_smul_one] at *\n rw [smul_assoc, ← smul_sub]\n have h' : ¬IsUnit (r⁻¹ • (s • (1 : A) - a)) := fun hu =>\n h (by simpa only [smul_inv_smul] using IsUnit.smul r hu)\n simp only [Ring.inverse_non_unit _ h, Ring.inverse_non_unit _ h', smul_zero]\n · simp only [resolvent]\n have h' : IsUnit (r • algebraMap R A (r⁻¹ • s) - a) := by\n simpa [Algebra.algebraMap_eq_smul_one, smul_assoc] using notMem_iff.mp h\n rw [← h'.val_subInvSMul, ← (notMem_iff.mp h).unit_spec, Ring.inverse_unit, Ring.inverse_unit,\n h'.val_inv_subInvSMul]\n simp only [Algebra.algebraMap_eq_smul_one, smul_assoc, smul_inv_smul]\n\ntheorem units_smul_resolvent_self {r : Rˣ} {a : A} :\n r • resolvent a (r : R) = resolvent (r⁻¹ • a) (1 : R) := by\n simpa only [Units.smul_def, smul_eq_mul, Units.inv_mul] using\n @units_smul_resolvent _ _ _ _ _ r r a\n\n/-- The resolvent is a unit when the argument is in the resolvent set. -/\ntheorem isUnit_resolvent {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (resolvent a r) :=\n isUnit_ringInverse.symm\n\ntheorem inv_mem_resolventSet {r : Rˣ} {a : Aˣ} (h : (r : R) ∈ resolventSet R (a : A)) :\n (↑r⁻¹ : R) ∈ resolventSet R (↑a⁻¹ : A) := by\n rw [mem_resolventSet_iff, Algebra.algebraMap_eq_smul_one, ← Units.smul_def] at h ⊢\n rw [IsUnit.smul_sub_iff_sub_inv_smul, inv_inv, IsUnit.sub_iff]\n have h₁ : (a : A) * (r • (↑a⁻¹ : A) - 1) = r • (1 : A) - a := by\n rw [mul_sub, mul_smul_comm, a.mul_inv, mul_one]\n have h₂ : (r • (↑a⁻¹ : A) - 1) * a = r • (1 : A) - a := by\n rw [sub_mul, smul_mul_assoc, a.inv_mul, one_mul]\n have hcomm : Commute (a : A) (r • (↑a⁻¹ : A) - 1) := by rwa [← h₂] at h₁\n exact (hcomm.isUnit_mul_iff.mp (h₁.symm ▸ h)).2\n\ntheorem inv_mem_iff {r : Rˣ} {a : Aˣ} : (r : R) ∈ σ (a : A) ↔ (↑r⁻¹ : R) ∈ σ (↑a⁻¹ : A) :=\n not_iff_not.2 <| ⟨inv_mem_resolventSet, inv_mem_resolventSet⟩\n\ntheorem zero_mem_resolventSet_of_unit (a : Aˣ) : 0 ∈ resolventSet R (a : A) := by\n simpa only [mem_resolventSet_iff, ← notMem_iff, zero_notMem_iff] using a.isUnit\n\ntheorem ne_zero_of_mem_of_unit {a : Aˣ} {r : R} (hr : r ∈ σ (a : A)) : r ≠ 0 := fun hn =>\n (hn ▸ hr) (zero_mem_resolventSet_of_unit a)\n\ntheorem add_mem_iff {a : A} {r s : R} : r + s ∈ σ a ↔ r ∈ σ (-↑ₐ s + a) := by\n simp only [mem_iff, sub_neg_eq_add, ← sub_sub, map_add]\n\ntheorem add_mem_add_iff {a : A} {r s : R} : r + s ∈ σ (↑ₐ s + a) ↔ r ∈ σ a := by\n rw [add_mem_iff, neg_add_cancel_left]\n\ntheorem smul_mem_smul_iff {a : A} {s : R} {r : Rˣ} : r • s ∈ σ (r • a) ↔ s ∈ σ a := by\n simp only [mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, ← smul_sub, isUnit_smul_iff]\n\ntheorem unit_smul_eq_smul (a : A) (r : Rˣ) : σ (r • a) = r • σ a := by\n ext x\n have x_eq : x = r • r⁻¹ • x := by simp\n nth_rw 1 [x_eq]\n rw [smul_mem_smul_iff]\n constructor\n · exact fun h => ⟨r⁻¹ • x, ⟨h, show r • r⁻¹ • x = x by simp⟩⟩\n · rintro ⟨w, _, (x'_eq : r • w = x)⟩\n simpa [← x'_eq]\n\n-- `r ∈ σ(a*b) ↔ r ∈ σ(b*a)` for any `r : Rˣ`\n\nTarget:\ntheorem unit_mem_mul_comm {a b : A} {r : Rˣ} : ↑r ∈ σ (a * b) ↔ ↑r ∈ σ (b * a) :=\n\nProof body:\n","proof_body":"by\n have h₁ : ∀ x y : A, IsUnit (1 - x * y) → IsUnit (1 - y * x) := by\n refine fun x y h => ⟨⟨1 - y * x, 1 + y * h.unit.inv * x, ?_, ?_⟩, rfl⟩\n · calc\n (1 - y * x) * (1 + y * (IsUnit.unit h).inv * x) =\n 1 - y * x + y * ((1 - x * y) * h.unit.inv) * x := by noncomm_ring\n _ = 1 := by simp only [Units.inv_eq_val_inv, IsUnit.mul_val_inv, mul_one, sub_add_cancel]\n · calc\n (1 + y * (IsUnit.unit h).inv * x) * (1 - y * x) =\n 1 - y * x + y * (h.unit.inv * (1 - x * y)) * x := by noncomm_ring\n _ = 1 := by simp only [Units.inv_eq_val_inv, IsUnit.val_inv_mul, mul_one, sub_add_cancel]\n have := Iff.intro (h₁ (r⁻¹ • a) b) (h₁ b (r⁻¹ • a))\n rw [mul_smul_comm r⁻¹ b a] at this\n simpa only [mem_iff, not_iff_not, Algebra.algebraMap_eq_smul_one, ← Units.smul_def,\n IsUnit.smul_sub_iff_sub_inv_smul, smul_mul_assoc]","provenance":{"declaration_index":26,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"6b8fb038fd170d1558b267f1b54fd6e008c9c0d4a0e402756920688d7daa0427","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Spectrum/Basic.lean"},"sample_id":"ec82ecd1987f2aefd18e4c0da3a81b7f3a50474d646ddc3efc233ef185e9ea1f","schema_version":1,"split":"train","theorem_statement":"theorem unit_mem_mul_comm {a b : A} {r : Rˣ} : ↑r ∈ σ (a * b) ↔ ↑r ∈ σ (b * a) :="} {"completion":"by\n ext r\n simpa using fun hr : IsUnit r ↦ unit_mem_mul_comm (r := hr.unit)","context_contains_namespace":true,"context_suffix":"end ScalarSemiring\nend spectrum","dependency_ids":["import:Mathlib.Algebra.Algebra.Subalgebra.Basic","import:Mathlib.Algebra.Star.Pointwise","import:Mathlib.RingTheory.Ideal.Maps","import:Mathlib.RingTheory.Ideal.Nonunits","import:Mathlib.Tactic.NoncommRing"],"family_id":"setof_isunit_inter_mul_comm","file_id":"mathlib/Mathlib/Algebra/Algebra/Spectrum/Basic.lean","imports":["public import Mathlib.Algebra.Algebra.Subalgebra.Basic","public import Mathlib.Algebra.Star.Pointwise","public import Mathlib.RingTheory.Ideal.Maps","public import Mathlib.RingTheory.Ideal.Nonunits","public import Mathlib.Tactic.NoncommRing"],"local_context":"/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a := by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff\n\ntheorem zero_notMem_iff {a : A} : (0 : R) ∉ σ a ↔ IsUnit a := by\n rw [zero_mem_iff, Classical.not_not]\n\nalias ⟨isUnit_of_zero_notMem, zero_notMem⟩ := spectrum.zero_notMem_iff\n\n@[simp]\nlemma _root_.Units.zero_notMem_spectrum (a : Aˣ) : 0 ∉ spectrum R (a : A) :=\n spectrum.zero_notMem R a.isUnit\n\nlemma subset_singleton_zero_compl {a : A} (ha : IsUnit a) : spectrum R a ⊆ {0}ᶜ :=\n Set.subset_compl_singleton_iff.mpr <| spectrum.zero_notMem R ha\n\nvariable {R}\n\ntheorem mem_resolventSet_of_left_right_inverse {r : R} {a b c : A} (h₁ : (↑ₐ r - a) * b = 1)\n (h₂ : c * (↑ₐ r - a) = 1) : r ∈ resolventSet R a :=\n Units.isUnit ⟨↑ₐ r - a, b, h₁, by rwa [← left_inv_eq_right_inv h₂ h₁]⟩\n\ntheorem mem_resolventSet_iff {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem algebraMap_mem_iff (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} {r : R} :\n algebraMap R S r ∈ spectrum S a ↔ r ∈ spectrum R a := by\n simp only [spectrum.mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]\n\nprotected alias ⟨of_algebraMap_mem, algebraMap_mem⟩ := spectrum.algebraMap_mem_iff\n\n@[simp]\ntheorem preimage_algebraMap (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} :\n algebraMap R S ⁻¹' spectrum S a = spectrum R a :=\n Set.ext fun _ => spectrum.algebraMap_mem_iff _\n\n@[simp]\ntheorem resolventSet_of_subsingleton [Subsingleton A] (a : A) : resolventSet R a = Set.univ := by\n simp_rw [resolventSet, Subsingleton.elim (algebraMap R A _ - a) 1, isUnit_one, Set.setOf_true]\n\n@[simp]\ntheorem of_subsingleton [Subsingleton A] (a : A) : spectrum R a = ∅ := by\n rw [spectrum, resolventSet_of_subsingleton, Set.compl_univ]\n\ntheorem resolvent_eq {a : A} {r : R} (h : r ∈ resolventSet R a) : resolvent a r = ↑h.unit⁻¹ :=\n Ring.inverse_unit h.unit\n\ntheorem units_smul_resolvent {r : Rˣ} {s : R} {a : A} :\n r • resolvent a (s : R) = resolvent (r⁻¹ • a) (r⁻¹ • s : R) := by\n by_cases h : s ∈ spectrum R a\n · rw [mem_iff] at h\n simp only [resolvent, Algebra.algebraMap_eq_smul_one] at *\n rw [smul_assoc, ← smul_sub]\n have h' : ¬IsUnit (r⁻¹ • (s • (1 : A) - a)) := fun hu =>\n h (by simpa only [smul_inv_smul] using IsUnit.smul r hu)\n simp only [Ring.inverse_non_unit _ h, Ring.inverse_non_unit _ h', smul_zero]\n · simp only [resolvent]\n have h' : IsUnit (r • algebraMap R A (r⁻¹ • s) - a) := by\n simpa [Algebra.algebraMap_eq_smul_one, smul_assoc] using notMem_iff.mp h\n rw [← h'.val_subInvSMul, ← (notMem_iff.mp h).unit_spec, Ring.inverse_unit, Ring.inverse_unit,\n h'.val_inv_subInvSMul]\n simp only [Algebra.algebraMap_eq_smul_one, smul_assoc, smul_inv_smul]\n\ntheorem units_smul_resolvent_self {r : Rˣ} {a : A} :\n r • resolvent a (r : R) = resolvent (r⁻¹ • a) (1 : R) := by\n simpa only [Units.smul_def, smul_eq_mul, Units.inv_mul] using\n @units_smul_resolvent _ _ _ _ _ r r a\n\n/-- The resolvent is a unit when the argument is in the resolvent set. -/\ntheorem isUnit_resolvent {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (resolvent a r) :=\n isUnit_ringInverse.symm\n\ntheorem inv_mem_resolventSet {r : Rˣ} {a : Aˣ} (h : (r : R) ∈ resolventSet R (a : A)) :\n (↑r⁻¹ : R) ∈ resolventSet R (↑a⁻¹ : A) := by\n rw [mem_resolventSet_iff, Algebra.algebraMap_eq_smul_one, ← Units.smul_def] at h ⊢\n rw [IsUnit.smul_sub_iff_sub_inv_smul, inv_inv, IsUnit.sub_iff]\n have h₁ : (a : A) * (r • (↑a⁻¹ : A) - 1) = r • (1 : A) - a := by\n rw [mul_sub, mul_smul_comm, a.mul_inv, mul_one]\n have h₂ : (r • (↑a⁻¹ : A) - 1) * a = r • (1 : A) - a := by\n rw [sub_mul, smul_mul_assoc, a.inv_mul, one_mul]\n have hcomm : Commute (a : A) (r • (↑a⁻¹ : A) - 1) := by rwa [← h₂] at h₁\n exact (hcomm.isUnit_mul_iff.mp (h₁.symm ▸ h)).2\n\ntheorem inv_mem_iff {r : Rˣ} {a : Aˣ} : (r : R) ∈ σ (a : A) ↔ (↑r⁻¹ : R) ∈ σ (↑a⁻¹ : A) :=\n not_iff_not.2 <| ⟨inv_mem_resolventSet, inv_mem_resolventSet⟩\n\ntheorem zero_mem_resolventSet_of_unit (a : Aˣ) : 0 ∈ resolventSet R (a : A) := by\n simpa only [mem_resolventSet_iff, ← notMem_iff, zero_notMem_iff] using a.isUnit\n\ntheorem ne_zero_of_mem_of_unit {a : Aˣ} {r : R} (hr : r ∈ σ (a : A)) : r ≠ 0 := fun hn =>\n (hn ▸ hr) (zero_mem_resolventSet_of_unit a)\n\ntheorem add_mem_iff {a : A} {r s : R} : r + s ∈ σ a ↔ r ∈ σ (-↑ₐ s + a) := by\n simp only [mem_iff, sub_neg_eq_add, ← sub_sub, map_add]\n\ntheorem add_mem_add_iff {a : A} {r s : R} : r + s ∈ σ (↑ₐ s + a) ↔ r ∈ σ a := by\n rw [add_mem_iff, neg_add_cancel_left]\n\ntheorem smul_mem_smul_iff {a : A} {s : R} {r : Rˣ} : r • s ∈ σ (r • a) ↔ s ∈ σ a := by\n simp only [mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, ← smul_sub, isUnit_smul_iff]\n\ntheorem unit_smul_eq_smul (a : A) (r : Rˣ) : σ (r • a) = r • σ a := by\n ext x\n have x_eq : x = r • r⁻¹ • x := by simp\n nth_rw 1 [x_eq]\n rw [smul_mem_smul_iff]\n constructor\n · exact fun h => ⟨r⁻¹ • x, ⟨h, show r • r⁻¹ • x = x by simp⟩⟩\n · rintro ⟨w, _, (x'_eq : r • w = x)⟩\n simpa [← x'_eq]\n\n-- `r ∈ σ(a*b) ↔ r ∈ σ(b*a)` for any `r : Rˣ`\ntheorem unit_mem_mul_comm {a b : A} {r : Rˣ} : ↑r ∈ σ (a * b) ↔ ↑r ∈ σ (b * a) := by\n have h₁ : ∀ x y : A, IsUnit (1 - x * y) → IsUnit (1 - y * x) := by\n refine fun x y h => ⟨⟨1 - y * x, 1 + y * h.unit.inv * x, ?_, ?_⟩, rfl⟩\n · calc\n (1 - y * x) * (1 + y * (IsUnit.unit h).inv * x) =\n 1 - y * x + y * ((1 - x * y) * h.unit.inv) * x := by noncomm_ring\n _ = 1 := by simp only [Units.inv_eq_val_inv, IsUnit.mul_val_inv, mul_one, sub_add_cancel]\n · calc\n (1 + y * (IsUnit.unit h).inv * x) * (1 - y * x) =\n 1 - y * x + y * (h.unit.inv * (1 - x * y)) * x := by noncomm_ring\n _ = 1 := by simp only [Units.inv_eq_val_inv, IsUnit.val_inv_mul, mul_one, sub_add_cancel]\n have := Iff.intro (h₁ (r⁻¹ • a) b) (h₁ b (r⁻¹ • a))\n rw [mul_smul_comm r⁻¹ b a] at this\n simpa only [mem_iff, not_iff_not, Algebra.algebraMap_eq_smul_one, ← Units.smul_def,\n IsUnit.smul_sub_iff_sub_inv_smul, smul_mul_assoc]\n\ntheorem preimage_units_mul_comm (a b : A) :\n ((↑) : Rˣ → R) ⁻¹' σ (a * b) = (↑) ⁻¹' σ (b * a) :=\n Set.ext fun _ => unit_mem_mul_comm","module_header":true,"namespace":"spectrum","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Subalgebra.Basic\npublic import Mathlib.Algebra.Star.Pointwise\npublic import Mathlib.RingTheory.Ideal.Maps\npublic import Mathlib.RingTheory.Ideal.Nonunits\npublic import Mathlib.Tactic.NoncommRing\n\nNamespace:\nspectrum\n\nLocal context:\n/-\nCopyright (c) 2021 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Spectrum of an element in an algebra\nThis file develops the basic theory of the spectrum of an element of an algebra.\nThis theory will serve as the foundation for spectral theory in Banach algebras.\n\n## Main definitions\n\n* `resolventSet a : Set R`: the resolvent set of an element `a : A` where\n `A` is an `R`-algebra.\n* `spectrum a : Set R`: the spectrum of an element `a : A` where\n `A` is an `R`-algebra.\n* `resolvent : R → A`: the resolvent function is `fun r ↦ (↑ₐ r - a)⁻¹ʳ`, and hence\n when `r ∈ resolvent R A`, it is actually the inverse of the unit `(↑ₐ r - a)`.\n\n## Main statements\n\n* `spectrum.unit_smul_eq_smul` and `spectrum.smul_eq_smul`: units in the scalar ring commute\n (multiplication) with the spectrum, and over a field even `0` commutes with the spectrum.\n* `spectrum.left_add_coset_eq`: elements of the scalar ring commute (addition) with the spectrum.\n* `spectrum.unit_mem_mul_comm` and `spectrum.preimage_units_mul_comm`: the\n units (of `R`) in `σ (a*b)` coincide with those in `σ (b*a)`.\n* `spectrum.scalar_eq`: in a nontrivial algebra over a field, the spectrum of a scalar is\n a singleton.\n\n## Notation\n\n* `σ a` : `spectrum R a` of `a : A`\n-/\n\n@[expose] public section\n\nopen Set\n\nopen scoped Pointwise Ring\n\nuniverse u v\n\nsection Defs\n\nvariable (R : Type u) {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\n-- definition and basic properties\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *resolvent set* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is a unit of the\nalgebra `A`. -/\ndef resolventSet (a : A) : Set R :=\n {r : R | IsUnit (↑ₐ r - a)}\n\n/-- Given a commutative ring `R` and an `R`-algebra `A`, the *spectrum* of `a : A`\nis the `Set R` consisting of those `r : R` for which `r•1 - a` is not a unit of the\nalgebra `A`.\n\nThe spectrum is simply the complement of the resolvent set. -/\ndef spectrum (a : A) : Set R :=\n (resolventSet R a)ᶜ\n\nvariable {R}\n\n/-- Given an `a : A` where `A` is an `R`-algebra, the *resolvent* is\n a map `R → A` which sends `r : R` to `(algebraMap R A r - a)⁻¹` when\n `r ∈ resolvent R A` and `0` when `r ∈ spectrum R A`. -/\nnoncomputable def resolvent (a : A) (r : R) : A := (↑ₐ r - a)⁻¹ʳ\n\n/-- The unit `1 - r⁻¹ • a` constructed from `r • 1 - a` when the latter is a unit. -/\n@[simps]\nnoncomputable def IsUnit.subInvSMul {r : Rˣ} {s : R} {a : A} (h : IsUnit <| r • ↑ₐ s - a) : Aˣ where\n val := ↑ₐ s - r⁻¹ • a\n inv := r • ↑h.unit⁻¹\n val_inv := by rw [mul_smul_comm, ← smul_mul_assoc, smul_sub, smul_inv_smul, h.mul_val_inv]\n inv_val := by rw [smul_mul_assoc, ← mul_smul_comm, smul_sub, smul_inv_smul, h.val_inv_mul]\n\nend Defs\n\nnamespace spectrum\n\nsection ScalarSemiring\n\nvariable {R : Type u} {A : Type v}\nvariable [CommSemiring R] [Ring A] [Algebra R A]\n\nlocal notation \"σ\" => spectrum R\n\nlocal notation \"↑ₐ\" => algebraMap R A\n\ntheorem mem_iff {r : R} {a : A} : r ∈ σ a ↔ ¬IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem resolvent_zero_of_mem_spectrum {r : R} {a : A} (hr : r ∈ σ a) :\n resolvent a r = 0 := Ring.inverse_non_unit _ (mem_iff.mp hr)\n\ntheorem mem_spectrum_iff_resolvent_zero [Nontrivial A] {r : R} {a : A} :\n r ∈ σ a ↔ resolvent a r = 0 := by\n refine ⟨resolvent_zero_of_mem_spectrum, fun hr ↦ ?_⟩\n simpa [mem_iff, Ring.not_isUnit_iff_inverse_eq_zero]\n\ntheorem notMem_iff {r : R} {a : A} : r ∉ σ a ↔ IsUnit (↑ₐ r - a) := by\n simp [mem_iff]\n\nvariable (R)\n\ntheorem zero_mem_iff {a : A} : (0 : R) ∈ σ a ↔ ¬IsUnit a := by\n rw [mem_iff, map_zero, zero_sub, IsUnit.neg_iff]\n\nalias ⟨not_isUnit_of_zero_mem, zero_mem⟩ := spectrum.zero_mem_iff\n\ntheorem zero_notMem_iff {a : A} : (0 : R) ∉ σ a ↔ IsUnit a := by\n rw [zero_mem_iff, Classical.not_not]\n\nalias ⟨isUnit_of_zero_notMem, zero_notMem⟩ := spectrum.zero_notMem_iff\n\n@[simp]\nlemma _root_.Units.zero_notMem_spectrum (a : Aˣ) : 0 ∉ spectrum R (a : A) :=\n spectrum.zero_notMem R a.isUnit\n\nlemma subset_singleton_zero_compl {a : A} (ha : IsUnit a) : spectrum R a ⊆ {0}ᶜ :=\n Set.subset_compl_singleton_iff.mpr <| spectrum.zero_notMem R ha\n\nvariable {R}\n\ntheorem mem_resolventSet_of_left_right_inverse {r : R} {a b c : A} (h₁ : (↑ₐ r - a) * b = 1)\n (h₂ : c * (↑ₐ r - a) = 1) : r ∈ resolventSet R a :=\n Units.isUnit ⟨↑ₐ r - a, b, h₁, by rwa [← left_inv_eq_right_inv h₂ h₁]⟩\n\ntheorem mem_resolventSet_iff {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (↑ₐ r - a) :=\n Iff.rfl\n\n@[simp]\ntheorem algebraMap_mem_iff (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} {r : R} :\n algebraMap R S r ∈ spectrum S a ↔ r ∈ spectrum R a := by\n simp only [spectrum.mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, one_smul]\n\nprotected alias ⟨of_algebraMap_mem, algebraMap_mem⟩ := spectrum.algebraMap_mem_iff\n\n@[simp]\ntheorem preimage_algebraMap (S : Type*) {R A : Type*} [CommSemiring R] [CommSemiring S]\n [Ring A] [Algebra R S] [Algebra R A] [Algebra S A] [IsScalarTower R S A] {a : A} :\n algebraMap R S ⁻¹' spectrum S a = spectrum R a :=\n Set.ext fun _ => spectrum.algebraMap_mem_iff _\n\n@[simp]\ntheorem resolventSet_of_subsingleton [Subsingleton A] (a : A) : resolventSet R a = Set.univ := by\n simp_rw [resolventSet, Subsingleton.elim (algebraMap R A _ - a) 1, isUnit_one, Set.setOf_true]\n\n@[simp]\ntheorem of_subsingleton [Subsingleton A] (a : A) : spectrum R a = ∅ := by\n rw [spectrum, resolventSet_of_subsingleton, Set.compl_univ]\n\ntheorem resolvent_eq {a : A} {r : R} (h : r ∈ resolventSet R a) : resolvent a r = ↑h.unit⁻¹ :=\n Ring.inverse_unit h.unit\n\ntheorem units_smul_resolvent {r : Rˣ} {s : R} {a : A} :\n r • resolvent a (s : R) = resolvent (r⁻¹ • a) (r⁻¹ • s : R) := by\n by_cases h : s ∈ spectrum R a\n · rw [mem_iff] at h\n simp only [resolvent, Algebra.algebraMap_eq_smul_one] at *\n rw [smul_assoc, ← smul_sub]\n have h' : ¬IsUnit (r⁻¹ • (s • (1 : A) - a)) := fun hu =>\n h (by simpa only [smul_inv_smul] using IsUnit.smul r hu)\n simp only [Ring.inverse_non_unit _ h, Ring.inverse_non_unit _ h', smul_zero]\n · simp only [resolvent]\n have h' : IsUnit (r • algebraMap R A (r⁻¹ • s) - a) := by\n simpa [Algebra.algebraMap_eq_smul_one, smul_assoc] using notMem_iff.mp h\n rw [← h'.val_subInvSMul, ← (notMem_iff.mp h).unit_spec, Ring.inverse_unit, Ring.inverse_unit,\n h'.val_inv_subInvSMul]\n simp only [Algebra.algebraMap_eq_smul_one, smul_assoc, smul_inv_smul]\n\ntheorem units_smul_resolvent_self {r : Rˣ} {a : A} :\n r • resolvent a (r : R) = resolvent (r⁻¹ • a) (1 : R) := by\n simpa only [Units.smul_def, smul_eq_mul, Units.inv_mul] using\n @units_smul_resolvent _ _ _ _ _ r r a\n\n/-- The resolvent is a unit when the argument is in the resolvent set. -/\ntheorem isUnit_resolvent {r : R} {a : A} : r ∈ resolventSet R a ↔ IsUnit (resolvent a r) :=\n isUnit_ringInverse.symm\n\ntheorem inv_mem_resolventSet {r : Rˣ} {a : Aˣ} (h : (r : R) ∈ resolventSet R (a : A)) :\n (↑r⁻¹ : R) ∈ resolventSet R (↑a⁻¹ : A) := by\n rw [mem_resolventSet_iff, Algebra.algebraMap_eq_smul_one, ← Units.smul_def] at h ⊢\n rw [IsUnit.smul_sub_iff_sub_inv_smul, inv_inv, IsUnit.sub_iff]\n have h₁ : (a : A) * (r • (↑a⁻¹ : A) - 1) = r • (1 : A) - a := by\n rw [mul_sub, mul_smul_comm, a.mul_inv, mul_one]\n have h₂ : (r • (↑a⁻¹ : A) - 1) * a = r • (1 : A) - a := by\n rw [sub_mul, smul_mul_assoc, a.inv_mul, one_mul]\n have hcomm : Commute (a : A) (r • (↑a⁻¹ : A) - 1) := by rwa [← h₂] at h₁\n exact (hcomm.isUnit_mul_iff.mp (h₁.symm ▸ h)).2\n\ntheorem inv_mem_iff {r : Rˣ} {a : Aˣ} : (r : R) ∈ σ (a : A) ↔ (↑r⁻¹ : R) ∈ σ (↑a⁻¹ : A) :=\n not_iff_not.2 <| ⟨inv_mem_resolventSet, inv_mem_resolventSet⟩\n\ntheorem zero_mem_resolventSet_of_unit (a : Aˣ) : 0 ∈ resolventSet R (a : A) := by\n simpa only [mem_resolventSet_iff, ← notMem_iff, zero_notMem_iff] using a.isUnit\n\ntheorem ne_zero_of_mem_of_unit {a : Aˣ} {r : R} (hr : r ∈ σ (a : A)) : r ≠ 0 := fun hn =>\n (hn ▸ hr) (zero_mem_resolventSet_of_unit a)\n\ntheorem add_mem_iff {a : A} {r s : R} : r + s ∈ σ a ↔ r ∈ σ (-↑ₐ s + a) := by\n simp only [mem_iff, sub_neg_eq_add, ← sub_sub, map_add]\n\ntheorem add_mem_add_iff {a : A} {r s : R} : r + s ∈ σ (↑ₐ s + a) ↔ r ∈ σ a := by\n rw [add_mem_iff, neg_add_cancel_left]\n\ntheorem smul_mem_smul_iff {a : A} {s : R} {r : Rˣ} : r • s ∈ σ (r • a) ↔ s ∈ σ a := by\n simp only [mem_iff, Algebra.algebraMap_eq_smul_one, smul_assoc, ← smul_sub, isUnit_smul_iff]\n\ntheorem unit_smul_eq_smul (a : A) (r : Rˣ) : σ (r • a) = r • σ a := by\n ext x\n have x_eq : x = r • r⁻¹ • x := by simp\n nth_rw 1 [x_eq]\n rw [smul_mem_smul_iff]\n constructor\n · exact fun h => ⟨r⁻¹ • x, ⟨h, show r • r⁻¹ • x = x by simp⟩⟩\n · rintro ⟨w, _, (x'_eq : r • w = x)⟩\n simpa [← x'_eq]\n\n-- `r ∈ σ(a*b) ↔ r ∈ σ(b*a)` for any `r : Rˣ`\ntheorem unit_mem_mul_comm {a b : A} {r : Rˣ} : ↑r ∈ σ (a * b) ↔ ↑r ∈ σ (b * a) := by\n have h₁ : ∀ x y : A, IsUnit (1 - x * y) → IsUnit (1 - y * x) := by\n refine fun x y h => ⟨⟨1 - y * x, 1 + y * h.unit.inv * x, ?_, ?_⟩, rfl⟩\n · calc\n (1 - y * x) * (1 + y * (IsUnit.unit h).inv * x) =\n 1 - y * x + y * ((1 - x * y) * h.unit.inv) * x := by noncomm_ring\n _ = 1 := by simp only [Units.inv_eq_val_inv, IsUnit.mul_val_inv, mul_one, sub_add_cancel]\n · calc\n (1 + y * (IsUnit.unit h).inv * x) * (1 - y * x) =\n 1 - y * x + y * (h.unit.inv * (1 - x * y)) * x := by noncomm_ring\n _ = 1 := by simp only [Units.inv_eq_val_inv, IsUnit.val_inv_mul, mul_one, sub_add_cancel]\n have := Iff.intro (h₁ (r⁻¹ • a) b) (h₁ b (r⁻¹ • a))\n rw [mul_smul_comm r⁻¹ b a] at this\n simpa only [mem_iff, not_iff_not, Algebra.algebraMap_eq_smul_one, ← Units.smul_def,\n IsUnit.smul_sub_iff_sub_inv_smul, smul_mul_assoc]\n\ntheorem preimage_units_mul_comm (a b : A) :\n ((↑) : Rˣ → R) ⁻¹' σ (a * b) = (↑) ⁻¹' σ (b * a) :=\n Set.ext fun _ => unit_mem_mul_comm\n\nTarget:\ntheorem setOf_isUnit_inter_mul_comm (a b : A) :\n {r | IsUnit r} ∩ σ (a * b) = {r | IsUnit r} ∩ σ (b * a) :=\n\nProof body:\n","proof_body":"by\n ext r\n simpa using fun hr : IsUnit r ↦ unit_mem_mul_comm (r := hr.unit)","provenance":{"declaration_index":28,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"6b8fb038fd170d1558b267f1b54fd6e008c9c0d4a0e402756920688d7daa0427","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Spectrum/Basic.lean"},"sample_id":"842a349f8084a1e0a563cc3260bd5498abfb55665a0a22517da182637dca5d2a","schema_version":1,"split":"train","theorem_statement":"theorem setOf_isUnit_inter_mul_comm (a b : A) :\n {r | IsUnit r} ∩ σ (a * b) = {r | IsUnit r} ∩ σ (b * a) :="} {"completion":"by\n simp [Algebra.algebraMapSubmonoid]","context_contains_namespace":true,"context_suffix":"end Semiring\nend Algebra","dependency_ids":["import:Mathlib.Algebra.Algebra.Defs","import:Mathlib.Algebra.Module.Equiv.Basic","import:Mathlib.Algebra.Module.Submodule.Ker","import:Mathlib.Algebra.Module.Submodule.RestrictScalars","import:Mathlib.Algebra.Module.ULift","import:Mathlib.Algebra.Ring.CharZero","import:Mathlib.Algebra.Ring.Subring.Basic","import:Mathlib.Data.Nat.Cast.Order.Basic","import:Mathlib.Data.Int.CharZero","import:Mathlib.Algebra.Ring.Hom.InjSurj"],"family_id":"algebramapsubmonoid_powers","file_id":"mathlib/Mathlib/Algebra/Algebra/Basic.lean","imports":["public import Mathlib.Algebra.Algebra.Defs","public import Mathlib.Algebra.Module.Equiv.Basic","public import Mathlib.Algebra.Module.Submodule.Ker","public import Mathlib.Algebra.Module.Submodule.RestrictScalars","public import Mathlib.Algebra.Module.ULift","public import Mathlib.Algebra.Ring.CharZero","public import Mathlib.Algebra.Ring.Subring.Basic","public import Mathlib.Data.Nat.Cast.Order.Basic","public import Mathlib.Data.Int.CharZero","import Mathlib.Algebra.Ring.Hom.InjSurj"],"local_context":"/-\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-/\n/-!\n# Further basic results about `Algebra`.\n\nThis file could usefully be split further.\n-/\n\n@[expose] public section\n\nuniverse u v w u₁ v₁\n\nopen Function Module\n\nnamespace Algebra\n\nvariable {R A M : Type*}\n\nsection Semiring\n\nvariable [CommSemiring R]\nvariable [Semiring A] [Algebra R A]\n\nsection PUnit\n\ninstance _root_.PUnit.algebra : Algebra R PUnit.{v + 1} where\n algebraMap :=\n { toFun _ := PUnit.unit\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' _ _ := rfl\n smul_def' _ _ := rfl\n\n@[simp]\ntheorem algebraMap_pUnit (r : R) : algebraMap R PUnit r = PUnit.unit :=\n rfl\n\nend PUnit\n\nsection ULift\n\ninstance _root_.ULift.algebra : Algebra R (ULift A) :=\n { ULift.module' with\n algebraMap :=\n { (ULift.ringEquiv : ULift A ≃+* A).symm.toRingHom.comp (algebraMap R A) with\n toFun := fun r => ULift.up (algebraMap R A r) }\n commutes' := fun r x => ULift.down_injective <| Algebra.commutes r x.down\n smul_def' := fun r x => ULift.down_injective <| Algebra.smul_def' r x.down }\n\ntheorem _root_.ULift.algebraMap_eq (r : R) :\n algebraMap R (ULift A) r = ULift.up (algebraMap R A r) :=\n rfl\n\n@[simp]\ntheorem _root_.ULift.down_algebraMap (r : R) : (algebraMap R (ULift A) r).down = algebraMap R A r :=\n rfl\n\nvariable (R A) in\n/-- If `A` is an `R`-algebra, it is also a `ULift R`-algebra. In particular, `Ulift A` is a\n`ULift R` algebra. This is not an instance, because it causes a non-reducible diamond in the case\nwhere `A = Ulift R`. -/\n@[instance_reducible]\ndef _root_.ULift.algebra' : Algebra (ULift.{u} R) A where\n __ := ULift.module\n algebraMap := (algebraMap R A).comp ULift.ringEquiv.toRingHom\n commutes' _ _ := Algebra.commutes ..\n smul_def' _ _ := Algebra.smul_def' ..\n\nattribute [local instance] ULift.algebra' in\n/-- This references the `ULift.algebra'` instance. -/\n@[simp]\nlemma _root_.ULift.algebraMap_apply' (r : ULift R) :\n algebraMap (ULift R) A r = algebraMap R A r.down := rfl\n\nend ULift\n\nsection SubsemiringAlgebra\n\nvariable {C : Type*} [SetLike C R] [SubsemiringClass C R]\n\n/-- Algebra over a subsemiring. This builds upon `Subsemiring.module`. -/\ninstance (priority := 900) ofSubsemiring (S : C) : Algebra S A where\n algebraMap := (algebraMap R A).comp (Subsemiring.subtype <| .ofClass S)\n commutes' r x := Algebra.commutes (r : R) x\n smul_def' r x := Algebra.smul_def (r : R) x\n\ntheorem algebraMap_ofSubsemiring (S : Subsemiring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\ntheorem coe_algebraMap_ofSubsemiring (S : C) : (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\ntheorem algebraMap_ofSubsemiring_apply (S : C) (x : S) : algebraMap S R x = x :=\n rfl\n\n/-- Algebra over a subring. This builds upon `Subring.module`. -/\ninstance ofSubring {R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : Subring R) :\n Algebra S A := inferInstance\n\ntheorem algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\n@[deprecated coe_algebraMap_ofSubsemiring (since := \"2025-11-23\")]\ntheorem coe_algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\n@[deprecated algebraMap_ofSubsemiring_apply (since := \"2025-11-23\")]\ntheorem algebraMap_ofSubring_apply {R : Type*} [CommRing R] (S : Subring R) (x : S) :\n algebraMap S R x = x :=\n rfl\n\nend SubsemiringAlgebra\n\n/-- Explicit characterization of the submonoid map in the case of an algebra.\n`S` is made explicit to help with type inference -/\ndef algebraMapSubmonoid (S : Type*) [Semiring S] [Algebra R S] (M : Submonoid R) : Submonoid S :=\n M.map (algebraMap R S)\n\nvariable {S : Type*} [Semiring S] [Algebra R S]\n\ntheorem mem_algebraMapSubmonoid_of_mem {M : Submonoid R}\n (x : M) : algebraMap R S x ∈ algebraMapSubmonoid S M :=\n Set.mem_image_of_mem (algebraMap R S) x.2\n\n@[simp]\nlemma algebraMapSubmonoid_self (M : Submonoid R) : Algebra.algebraMapSubmonoid R M = M :=\n Submonoid.map_id M\n\n@[simp]","module_header":true,"namespace":"Algebra","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Defs\npublic import Mathlib.Algebra.Module.Equiv.Basic\npublic import Mathlib.Algebra.Module.Submodule.Ker\npublic import Mathlib.Algebra.Module.Submodule.RestrictScalars\npublic import Mathlib.Algebra.Module.ULift\npublic import Mathlib.Algebra.Ring.CharZero\npublic import Mathlib.Algebra.Ring.Subring.Basic\npublic import Mathlib.Data.Nat.Cast.Order.Basic\npublic import Mathlib.Data.Int.CharZero\nimport Mathlib.Algebra.Ring.Hom.InjSurj\n\nNamespace:\nAlgebra\n\nLocal context:\n/-\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-/\n/-!\n# Further basic results about `Algebra`.\n\nThis file could usefully be split further.\n-/\n\n@[expose] public section\n\nuniverse u v w u₁ v₁\n\nopen Function Module\n\nnamespace Algebra\n\nvariable {R A M : Type*}\n\nsection Semiring\n\nvariable [CommSemiring R]\nvariable [Semiring A] [Algebra R A]\n\nsection PUnit\n\ninstance _root_.PUnit.algebra : Algebra R PUnit.{v + 1} where\n algebraMap :=\n { toFun _ := PUnit.unit\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' _ _ := rfl\n smul_def' _ _ := rfl\n\n@[simp]\ntheorem algebraMap_pUnit (r : R) : algebraMap R PUnit r = PUnit.unit :=\n rfl\n\nend PUnit\n\nsection ULift\n\ninstance _root_.ULift.algebra : Algebra R (ULift A) :=\n { ULift.module' with\n algebraMap :=\n { (ULift.ringEquiv : ULift A ≃+* A).symm.toRingHom.comp (algebraMap R A) with\n toFun := fun r => ULift.up (algebraMap R A r) }\n commutes' := fun r x => ULift.down_injective <| Algebra.commutes r x.down\n smul_def' := fun r x => ULift.down_injective <| Algebra.smul_def' r x.down }\n\ntheorem _root_.ULift.algebraMap_eq (r : R) :\n algebraMap R (ULift A) r = ULift.up (algebraMap R A r) :=\n rfl\n\n@[simp]\ntheorem _root_.ULift.down_algebraMap (r : R) : (algebraMap R (ULift A) r).down = algebraMap R A r :=\n rfl\n\nvariable (R A) in\n/-- If `A` is an `R`-algebra, it is also a `ULift R`-algebra. In particular, `Ulift A` is a\n`ULift R` algebra. This is not an instance, because it causes a non-reducible diamond in the case\nwhere `A = Ulift R`. -/\n@[instance_reducible]\ndef _root_.ULift.algebra' : Algebra (ULift.{u} R) A where\n __ := ULift.module\n algebraMap := (algebraMap R A).comp ULift.ringEquiv.toRingHom\n commutes' _ _ := Algebra.commutes ..\n smul_def' _ _ := Algebra.smul_def' ..\n\nattribute [local instance] ULift.algebra' in\n/-- This references the `ULift.algebra'` instance. -/\n@[simp]\nlemma _root_.ULift.algebraMap_apply' (r : ULift R) :\n algebraMap (ULift R) A r = algebraMap R A r.down := rfl\n\nend ULift\n\nsection SubsemiringAlgebra\n\nvariable {C : Type*} [SetLike C R] [SubsemiringClass C R]\n\n/-- Algebra over a subsemiring. This builds upon `Subsemiring.module`. -/\ninstance (priority := 900) ofSubsemiring (S : C) : Algebra S A where\n algebraMap := (algebraMap R A).comp (Subsemiring.subtype <| .ofClass S)\n commutes' r x := Algebra.commutes (r : R) x\n smul_def' r x := Algebra.smul_def (r : R) x\n\ntheorem algebraMap_ofSubsemiring (S : Subsemiring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\ntheorem coe_algebraMap_ofSubsemiring (S : C) : (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\ntheorem algebraMap_ofSubsemiring_apply (S : C) (x : S) : algebraMap S R x = x :=\n rfl\n\n/-- Algebra over a subring. This builds upon `Subring.module`. -/\ninstance ofSubring {R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : Subring R) :\n Algebra S A := inferInstance\n\ntheorem algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\n@[deprecated coe_algebraMap_ofSubsemiring (since := \"2025-11-23\")]\ntheorem coe_algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\n@[deprecated algebraMap_ofSubsemiring_apply (since := \"2025-11-23\")]\ntheorem algebraMap_ofSubring_apply {R : Type*} [CommRing R] (S : Subring R) (x : S) :\n algebraMap S R x = x :=\n rfl\n\nend SubsemiringAlgebra\n\n/-- Explicit characterization of the submonoid map in the case of an algebra.\n`S` is made explicit to help with type inference -/\ndef algebraMapSubmonoid (S : Type*) [Semiring S] [Algebra R S] (M : Submonoid R) : Submonoid S :=\n M.map (algebraMap R S)\n\nvariable {S : Type*} [Semiring S] [Algebra R S]\n\ntheorem mem_algebraMapSubmonoid_of_mem {M : Submonoid R}\n (x : M) : algebraMap R S x ∈ algebraMapSubmonoid S M :=\n Set.mem_image_of_mem (algebraMap R S) x.2\n\n@[simp]\nlemma algebraMapSubmonoid_self (M : Submonoid R) : Algebra.algebraMapSubmonoid R M = M :=\n Submonoid.map_id M\n\n@[simp]\n\nTarget:\nlemma algebraMapSubmonoid_powers (r : R) :\n Algebra.algebraMapSubmonoid S (.powers r) = Submonoid.powers (algebraMap R S r) :=\n\nProof body:\n","proof_body":"by\n simp [Algebra.algebraMapSubmonoid]","provenance":{"declaration_index":12,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"d81d29e01f64ac82099070062ec2011a0ac2599a5411d5c30b031029566d2429","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Basic.lean"},"sample_id":"41a3156f6af85f0279009f3b311134218f9195d2ec3a8cb02aba4e3e6a93a015","schema_version":1,"split":"train","theorem_statement":"lemma algebraMapSubmonoid_powers (r : R) :\n Algebra.algebraMapSubmonoid S (.powers r) = Submonoid.powers (algebraMap R S r) :="} {"completion":"by\n rintro x ⟨y, hy, rfl⟩\n exact hy.map _","context_contains_namespace":true,"context_suffix":"end Semiring\nend Algebra","dependency_ids":["import:Mathlib.Algebra.Algebra.Defs","import:Mathlib.Algebra.Module.Equiv.Basic","import:Mathlib.Algebra.Module.Submodule.Ker","import:Mathlib.Algebra.Module.Submodule.RestrictScalars","import:Mathlib.Algebra.Module.ULift","import:Mathlib.Algebra.Ring.CharZero","import:Mathlib.Algebra.Ring.Subring.Basic","import:Mathlib.Data.Nat.Cast.Order.Basic","import:Mathlib.Data.Int.CharZero","import:Mathlib.Algebra.Ring.Hom.InjSurj"],"family_id":"algebramapsubmonoid_isunit_le","file_id":"mathlib/Mathlib/Algebra/Algebra/Basic.lean","imports":["public import Mathlib.Algebra.Algebra.Defs","public import Mathlib.Algebra.Module.Equiv.Basic","public import Mathlib.Algebra.Module.Submodule.Ker","public import Mathlib.Algebra.Module.Submodule.RestrictScalars","public import Mathlib.Algebra.Module.ULift","public import Mathlib.Algebra.Ring.CharZero","public import Mathlib.Algebra.Ring.Subring.Basic","public import Mathlib.Data.Nat.Cast.Order.Basic","public import Mathlib.Data.Int.CharZero","import Mathlib.Algebra.Ring.Hom.InjSurj"],"local_context":"/-\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-/\n/-!\n# Further basic results about `Algebra`.\n\nThis file could usefully be split further.\n-/\n\n@[expose] public section\n\nuniverse u v w u₁ v₁\n\nopen Function Module\n\nnamespace Algebra\n\nvariable {R A M : Type*}\n\nsection Semiring\n\nvariable [CommSemiring R]\nvariable [Semiring A] [Algebra R A]\n\nsection PUnit\n\ninstance _root_.PUnit.algebra : Algebra R PUnit.{v + 1} where\n algebraMap :=\n { toFun _ := PUnit.unit\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' _ _ := rfl\n smul_def' _ _ := rfl\n\n@[simp]\ntheorem algebraMap_pUnit (r : R) : algebraMap R PUnit r = PUnit.unit :=\n rfl\n\nend PUnit\n\nsection ULift\n\ninstance _root_.ULift.algebra : Algebra R (ULift A) :=\n { ULift.module' with\n algebraMap :=\n { (ULift.ringEquiv : ULift A ≃+* A).symm.toRingHom.comp (algebraMap R A) with\n toFun := fun r => ULift.up (algebraMap R A r) }\n commutes' := fun r x => ULift.down_injective <| Algebra.commutes r x.down\n smul_def' := fun r x => ULift.down_injective <| Algebra.smul_def' r x.down }\n\ntheorem _root_.ULift.algebraMap_eq (r : R) :\n algebraMap R (ULift A) r = ULift.up (algebraMap R A r) :=\n rfl\n\n@[simp]\ntheorem _root_.ULift.down_algebraMap (r : R) : (algebraMap R (ULift A) r).down = algebraMap R A r :=\n rfl\n\nvariable (R A) in\n/-- If `A` is an `R`-algebra, it is also a `ULift R`-algebra. In particular, `Ulift A` is a\n`ULift R` algebra. This is not an instance, because it causes a non-reducible diamond in the case\nwhere `A = Ulift R`. -/\n@[instance_reducible]\ndef _root_.ULift.algebra' : Algebra (ULift.{u} R) A where\n __ := ULift.module\n algebraMap := (algebraMap R A).comp ULift.ringEquiv.toRingHom\n commutes' _ _ := Algebra.commutes ..\n smul_def' _ _ := Algebra.smul_def' ..\n\nattribute [local instance] ULift.algebra' in\n/-- This references the `ULift.algebra'` instance. -/\n@[simp]\nlemma _root_.ULift.algebraMap_apply' (r : ULift R) :\n algebraMap (ULift R) A r = algebraMap R A r.down := rfl\n\nend ULift\n\nsection SubsemiringAlgebra\n\nvariable {C : Type*} [SetLike C R] [SubsemiringClass C R]\n\n/-- Algebra over a subsemiring. This builds upon `Subsemiring.module`. -/\ninstance (priority := 900) ofSubsemiring (S : C) : Algebra S A where\n algebraMap := (algebraMap R A).comp (Subsemiring.subtype <| .ofClass S)\n commutes' r x := Algebra.commutes (r : R) x\n smul_def' r x := Algebra.smul_def (r : R) x\n\ntheorem algebraMap_ofSubsemiring (S : Subsemiring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\ntheorem coe_algebraMap_ofSubsemiring (S : C) : (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\ntheorem algebraMap_ofSubsemiring_apply (S : C) (x : S) : algebraMap S R x = x :=\n rfl\n\n/-- Algebra over a subring. This builds upon `Subring.module`. -/\ninstance ofSubring {R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : Subring R) :\n Algebra S A := inferInstance\n\ntheorem algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\n@[deprecated coe_algebraMap_ofSubsemiring (since := \"2025-11-23\")]\ntheorem coe_algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\n@[deprecated algebraMap_ofSubsemiring_apply (since := \"2025-11-23\")]\ntheorem algebraMap_ofSubring_apply {R : Type*} [CommRing R] (S : Subring R) (x : S) :\n algebraMap S R x = x :=\n rfl\n\nend SubsemiringAlgebra\n\n/-- Explicit characterization of the submonoid map in the case of an algebra.\n`S` is made explicit to help with type inference -/\ndef algebraMapSubmonoid (S : Type*) [Semiring S] [Algebra R S] (M : Submonoid R) : Submonoid S :=\n M.map (algebraMap R S)\n\nvariable {S : Type*} [Semiring S] [Algebra R S]\n\ntheorem mem_algebraMapSubmonoid_of_mem {M : Submonoid R}\n (x : M) : algebraMap R S x ∈ algebraMapSubmonoid S M :=\n Set.mem_image_of_mem (algebraMap R S) x.2\n\n@[simp]\nlemma algebraMapSubmonoid_self (M : Submonoid R) : Algebra.algebraMapSubmonoid R M = M :=\n Submonoid.map_id M\n\n@[simp]\nlemma algebraMapSubmonoid_powers (r : R) :\n Algebra.algebraMapSubmonoid S (.powers r) = Submonoid.powers (algebraMap R S r) := by\n simp [Algebra.algebraMapSubmonoid]","module_header":true,"namespace":"Algebra","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Defs\npublic import Mathlib.Algebra.Module.Equiv.Basic\npublic import Mathlib.Algebra.Module.Submodule.Ker\npublic import Mathlib.Algebra.Module.Submodule.RestrictScalars\npublic import Mathlib.Algebra.Module.ULift\npublic import Mathlib.Algebra.Ring.CharZero\npublic import Mathlib.Algebra.Ring.Subring.Basic\npublic import Mathlib.Data.Nat.Cast.Order.Basic\npublic import Mathlib.Data.Int.CharZero\nimport Mathlib.Algebra.Ring.Hom.InjSurj\n\nNamespace:\nAlgebra\n\nLocal context:\n/-\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-/\n/-!\n# Further basic results about `Algebra`.\n\nThis file could usefully be split further.\n-/\n\n@[expose] public section\n\nuniverse u v w u₁ v₁\n\nopen Function Module\n\nnamespace Algebra\n\nvariable {R A M : Type*}\n\nsection Semiring\n\nvariable [CommSemiring R]\nvariable [Semiring A] [Algebra R A]\n\nsection PUnit\n\ninstance _root_.PUnit.algebra : Algebra R PUnit.{v + 1} where\n algebraMap :=\n { toFun _ := PUnit.unit\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' _ _ := rfl\n smul_def' _ _ := rfl\n\n@[simp]\ntheorem algebraMap_pUnit (r : R) : algebraMap R PUnit r = PUnit.unit :=\n rfl\n\nend PUnit\n\nsection ULift\n\ninstance _root_.ULift.algebra : Algebra R (ULift A) :=\n { ULift.module' with\n algebraMap :=\n { (ULift.ringEquiv : ULift A ≃+* A).symm.toRingHom.comp (algebraMap R A) with\n toFun := fun r => ULift.up (algebraMap R A r) }\n commutes' := fun r x => ULift.down_injective <| Algebra.commutes r x.down\n smul_def' := fun r x => ULift.down_injective <| Algebra.smul_def' r x.down }\n\ntheorem _root_.ULift.algebraMap_eq (r : R) :\n algebraMap R (ULift A) r = ULift.up (algebraMap R A r) :=\n rfl\n\n@[simp]\ntheorem _root_.ULift.down_algebraMap (r : R) : (algebraMap R (ULift A) r).down = algebraMap R A r :=\n rfl\n\nvariable (R A) in\n/-- If `A` is an `R`-algebra, it is also a `ULift R`-algebra. In particular, `Ulift A` is a\n`ULift R` algebra. This is not an instance, because it causes a non-reducible diamond in the case\nwhere `A = Ulift R`. -/\n@[instance_reducible]\ndef _root_.ULift.algebra' : Algebra (ULift.{u} R) A where\n __ := ULift.module\n algebraMap := (algebraMap R A).comp ULift.ringEquiv.toRingHom\n commutes' _ _ := Algebra.commutes ..\n smul_def' _ _ := Algebra.smul_def' ..\n\nattribute [local instance] ULift.algebra' in\n/-- This references the `ULift.algebra'` instance. -/\n@[simp]\nlemma _root_.ULift.algebraMap_apply' (r : ULift R) :\n algebraMap (ULift R) A r = algebraMap R A r.down := rfl\n\nend ULift\n\nsection SubsemiringAlgebra\n\nvariable {C : Type*} [SetLike C R] [SubsemiringClass C R]\n\n/-- Algebra over a subsemiring. This builds upon `Subsemiring.module`. -/\ninstance (priority := 900) ofSubsemiring (S : C) : Algebra S A where\n algebraMap := (algebraMap R A).comp (Subsemiring.subtype <| .ofClass S)\n commutes' r x := Algebra.commutes (r : R) x\n smul_def' r x := Algebra.smul_def (r : R) x\n\ntheorem algebraMap_ofSubsemiring (S : Subsemiring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\ntheorem coe_algebraMap_ofSubsemiring (S : C) : (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\ntheorem algebraMap_ofSubsemiring_apply (S : C) (x : S) : algebraMap S R x = x :=\n rfl\n\n/-- Algebra over a subring. This builds upon `Subring.module`. -/\ninstance ofSubring {R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : Subring R) :\n Algebra S A := inferInstance\n\ntheorem algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\n@[deprecated coe_algebraMap_ofSubsemiring (since := \"2025-11-23\")]\ntheorem coe_algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\n@[deprecated algebraMap_ofSubsemiring_apply (since := \"2025-11-23\")]\ntheorem algebraMap_ofSubring_apply {R : Type*} [CommRing R] (S : Subring R) (x : S) :\n algebraMap S R x = x :=\n rfl\n\nend SubsemiringAlgebra\n\n/-- Explicit characterization of the submonoid map in the case of an algebra.\n`S` is made explicit to help with type inference -/\ndef algebraMapSubmonoid (S : Type*) [Semiring S] [Algebra R S] (M : Submonoid R) : Submonoid S :=\n M.map (algebraMap R S)\n\nvariable {S : Type*} [Semiring S] [Algebra R S]\n\ntheorem mem_algebraMapSubmonoid_of_mem {M : Submonoid R}\n (x : M) : algebraMap R S x ∈ algebraMapSubmonoid S M :=\n Set.mem_image_of_mem (algebraMap R S) x.2\n\n@[simp]\nlemma algebraMapSubmonoid_self (M : Submonoid R) : Algebra.algebraMapSubmonoid R M = M :=\n Submonoid.map_id M\n\n@[simp]\nlemma algebraMapSubmonoid_powers (r : R) :\n Algebra.algebraMapSubmonoid S (.powers r) = Submonoid.powers (algebraMap R S r) := by\n simp [Algebra.algebraMapSubmonoid]\n\nTarget:\nlemma algebraMapSubmonoid_isUnit_le :\n algebraMapSubmonoid S (IsUnit.submonoid R) ≤ IsUnit.submonoid S :=\n\nProof body:\n","proof_body":"by\n rintro x ⟨y, hy, rfl⟩\n exact hy.map _","provenance":{"declaration_index":13,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"d81d29e01f64ac82099070062ec2011a0ac2599a5411d5c30b031029566d2429","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Basic.lean"},"sample_id":"516e410104e41f46e38ad3e8019b5636d939754db7f72c921c242c60815b80de","schema_version":1,"split":"train","theorem_statement":"lemma algebraMapSubmonoid_isUnit_le :\n algebraMapSubmonoid S (IsUnit.submonoid R) ≤ IsUnit.submonoid S :="} {"completion":"by rw [mul_sub, ← commutes, sub_mul]","context_contains_namespace":true,"context_suffix":"end CommSemiring\nend Algebra","dependency_ids":["import:Mathlib.Algebra.Algebra.Defs","import:Mathlib.Algebra.Module.Equiv.Basic","import:Mathlib.Algebra.Module.Submodule.Ker","import:Mathlib.Algebra.Module.Submodule.RestrictScalars","import:Mathlib.Algebra.Module.ULift","import:Mathlib.Algebra.Ring.CharZero","import:Mathlib.Algebra.Ring.Subring.Basic","import:Mathlib.Data.Nat.Cast.Order.Basic","import:Mathlib.Data.Int.CharZero","import:Mathlib.Algebra.Ring.Hom.InjSurj"],"family_id":"mul_sub_algebramap_commutes","file_id":"mathlib/Mathlib/Algebra/Algebra/Basic.lean","imports":["public import Mathlib.Algebra.Algebra.Defs","public import Mathlib.Algebra.Module.Equiv.Basic","public import Mathlib.Algebra.Module.Submodule.Ker","public import Mathlib.Algebra.Module.Submodule.RestrictScalars","public import Mathlib.Algebra.Module.ULift","public import Mathlib.Algebra.Ring.CharZero","public import Mathlib.Algebra.Ring.Subring.Basic","public import Mathlib.Data.Nat.Cast.Order.Basic","public import Mathlib.Data.Int.CharZero","import Mathlib.Algebra.Ring.Hom.InjSurj"],"local_context":"/-\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-/\n/-!\n# Further basic results about `Algebra`.\n\nThis file could usefully be split further.\n-/\n\n@[expose] public section\n\nuniverse u v w u₁ v₁\n\nopen Function Module\n\nnamespace Algebra\n\nvariable {R A M : Type*}\n\nsection Semiring\n\nvariable [CommSemiring R]\nvariable [Semiring A] [Algebra R A]\n\nsection PUnit\n\ninstance _root_.PUnit.algebra : Algebra R PUnit.{v + 1} where\n algebraMap :=\n { toFun _ := PUnit.unit\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' _ _ := rfl\n smul_def' _ _ := rfl\n\n@[simp]\ntheorem algebraMap_pUnit (r : R) : algebraMap R PUnit r = PUnit.unit :=\n rfl\n\nend PUnit\n\nsection ULift\n\ninstance _root_.ULift.algebra : Algebra R (ULift A) :=\n { ULift.module' with\n algebraMap :=\n { (ULift.ringEquiv : ULift A ≃+* A).symm.toRingHom.comp (algebraMap R A) with\n toFun := fun r => ULift.up (algebraMap R A r) }\n commutes' := fun r x => ULift.down_injective <| Algebra.commutes r x.down\n smul_def' := fun r x => ULift.down_injective <| Algebra.smul_def' r x.down }\n\ntheorem _root_.ULift.algebraMap_eq (r : R) :\n algebraMap R (ULift A) r = ULift.up (algebraMap R A r) :=\n rfl\n\n@[simp]\ntheorem _root_.ULift.down_algebraMap (r : R) : (algebraMap R (ULift A) r).down = algebraMap R A r :=\n rfl\n\nvariable (R A) in\n/-- If `A` is an `R`-algebra, it is also a `ULift R`-algebra. In particular, `Ulift A` is a\n`ULift R` algebra. This is not an instance, because it causes a non-reducible diamond in the case\nwhere `A = Ulift R`. -/\n@[instance_reducible]\ndef _root_.ULift.algebra' : Algebra (ULift.{u} R) A where\n __ := ULift.module\n algebraMap := (algebraMap R A).comp ULift.ringEquiv.toRingHom\n commutes' _ _ := Algebra.commutes ..\n smul_def' _ _ := Algebra.smul_def' ..\n\nattribute [local instance] ULift.algebra' in\n/-- This references the `ULift.algebra'` instance. -/\n@[simp]\nlemma _root_.ULift.algebraMap_apply' (r : ULift R) :\n algebraMap (ULift R) A r = algebraMap R A r.down := rfl\n\nend ULift\n\nsection SubsemiringAlgebra\n\nvariable {C : Type*} [SetLike C R] [SubsemiringClass C R]\n\n/-- Algebra over a subsemiring. This builds upon `Subsemiring.module`. -/\ninstance (priority := 900) ofSubsemiring (S : C) : Algebra S A where\n algebraMap := (algebraMap R A).comp (Subsemiring.subtype <| .ofClass S)\n commutes' r x := Algebra.commutes (r : R) x\n smul_def' r x := Algebra.smul_def (r : R) x\n\ntheorem algebraMap_ofSubsemiring (S : Subsemiring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\ntheorem coe_algebraMap_ofSubsemiring (S : C) : (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\ntheorem algebraMap_ofSubsemiring_apply (S : C) (x : S) : algebraMap S R x = x :=\n rfl\n\n/-- Algebra over a subring. This builds upon `Subring.module`. -/\ninstance ofSubring {R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : Subring R) :\n Algebra S A := inferInstance\n\ntheorem algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\n@[deprecated coe_algebraMap_ofSubsemiring (since := \"2025-11-23\")]\ntheorem coe_algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\n@[deprecated algebraMap_ofSubsemiring_apply (since := \"2025-11-23\")]\ntheorem algebraMap_ofSubring_apply {R : Type*} [CommRing R] (S : Subring R) (x : S) :\n algebraMap S R x = x :=\n rfl\n\nend SubsemiringAlgebra\n\n/-- Explicit characterization of the submonoid map in the case of an algebra.\n`S` is made explicit to help with type inference -/\ndef algebraMapSubmonoid (S : Type*) [Semiring S] [Algebra R S] (M : Submonoid R) : Submonoid S :=\n M.map (algebraMap R S)\n\nvariable {S : Type*} [Semiring S] [Algebra R S]\n\ntheorem mem_algebraMapSubmonoid_of_mem {M : Submonoid R}\n (x : M) : algebraMap R S x ∈ algebraMapSubmonoid S M :=\n Set.mem_image_of_mem (algebraMap R S) x.2\n\n@[simp]\nlemma algebraMapSubmonoid_self (M : Submonoid R) : Algebra.algebraMapSubmonoid R M = M :=\n Submonoid.map_id M\n\n@[simp]\nlemma algebraMapSubmonoid_powers (r : R) :\n Algebra.algebraMapSubmonoid S (.powers r) = Submonoid.powers (algebraMap R S r) := by\n simp [Algebra.algebraMapSubmonoid]\n\nlemma algebraMapSubmonoid_isUnit_le :\n algebraMapSubmonoid S (IsUnit.submonoid R) ≤ IsUnit.submonoid S := by\n rintro x ⟨y, hy, rfl⟩\n exact hy.map _\n\nend Semiring\n\nsection CommSemiring\n\nvariable [CommSemiring R]","module_header":true,"namespace":"Algebra","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Defs\npublic import Mathlib.Algebra.Module.Equiv.Basic\npublic import Mathlib.Algebra.Module.Submodule.Ker\npublic import Mathlib.Algebra.Module.Submodule.RestrictScalars\npublic import Mathlib.Algebra.Module.ULift\npublic import Mathlib.Algebra.Ring.CharZero\npublic import Mathlib.Algebra.Ring.Subring.Basic\npublic import Mathlib.Data.Nat.Cast.Order.Basic\npublic import Mathlib.Data.Int.CharZero\nimport Mathlib.Algebra.Ring.Hom.InjSurj\n\nNamespace:\nAlgebra\n\nLocal context:\n/-\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-/\n/-!\n# Further basic results about `Algebra`.\n\nThis file could usefully be split further.\n-/\n\n@[expose] public section\n\nuniverse u v w u₁ v₁\n\nopen Function Module\n\nnamespace Algebra\n\nvariable {R A M : Type*}\n\nsection Semiring\n\nvariable [CommSemiring R]\nvariable [Semiring A] [Algebra R A]\n\nsection PUnit\n\ninstance _root_.PUnit.algebra : Algebra R PUnit.{v + 1} where\n algebraMap :=\n { toFun _ := PUnit.unit\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' _ _ := rfl\n smul_def' _ _ := rfl\n\n@[simp]\ntheorem algebraMap_pUnit (r : R) : algebraMap R PUnit r = PUnit.unit :=\n rfl\n\nend PUnit\n\nsection ULift\n\ninstance _root_.ULift.algebra : Algebra R (ULift A) :=\n { ULift.module' with\n algebraMap :=\n { (ULift.ringEquiv : ULift A ≃+* A).symm.toRingHom.comp (algebraMap R A) with\n toFun := fun r => ULift.up (algebraMap R A r) }\n commutes' := fun r x => ULift.down_injective <| Algebra.commutes r x.down\n smul_def' := fun r x => ULift.down_injective <| Algebra.smul_def' r x.down }\n\ntheorem _root_.ULift.algebraMap_eq (r : R) :\n algebraMap R (ULift A) r = ULift.up (algebraMap R A r) :=\n rfl\n\n@[simp]\ntheorem _root_.ULift.down_algebraMap (r : R) : (algebraMap R (ULift A) r).down = algebraMap R A r :=\n rfl\n\nvariable (R A) in\n/-- If `A` is an `R`-algebra, it is also a `ULift R`-algebra. In particular, `Ulift A` is a\n`ULift R` algebra. This is not an instance, because it causes a non-reducible diamond in the case\nwhere `A = Ulift R`. -/\n@[instance_reducible]\ndef _root_.ULift.algebra' : Algebra (ULift.{u} R) A where\n __ := ULift.module\n algebraMap := (algebraMap R A).comp ULift.ringEquiv.toRingHom\n commutes' _ _ := Algebra.commutes ..\n smul_def' _ _ := Algebra.smul_def' ..\n\nattribute [local instance] ULift.algebra' in\n/-- This references the `ULift.algebra'` instance. -/\n@[simp]\nlemma _root_.ULift.algebraMap_apply' (r : ULift R) :\n algebraMap (ULift R) A r = algebraMap R A r.down := rfl\n\nend ULift\n\nsection SubsemiringAlgebra\n\nvariable {C : Type*} [SetLike C R] [SubsemiringClass C R]\n\n/-- Algebra over a subsemiring. This builds upon `Subsemiring.module`. -/\ninstance (priority := 900) ofSubsemiring (S : C) : Algebra S A where\n algebraMap := (algebraMap R A).comp (Subsemiring.subtype <| .ofClass S)\n commutes' r x := Algebra.commutes (r : R) x\n smul_def' r x := Algebra.smul_def (r : R) x\n\ntheorem algebraMap_ofSubsemiring (S : Subsemiring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\ntheorem coe_algebraMap_ofSubsemiring (S : C) : (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\ntheorem algebraMap_ofSubsemiring_apply (S : C) (x : S) : algebraMap S R x = x :=\n rfl\n\n/-- Algebra over a subring. This builds upon `Subring.module`. -/\ninstance ofSubring {R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : Subring R) :\n Algebra S A := inferInstance\n\ntheorem algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\n@[deprecated coe_algebraMap_ofSubsemiring (since := \"2025-11-23\")]\ntheorem coe_algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\n@[deprecated algebraMap_ofSubsemiring_apply (since := \"2025-11-23\")]\ntheorem algebraMap_ofSubring_apply {R : Type*} [CommRing R] (S : Subring R) (x : S) :\n algebraMap S R x = x :=\n rfl\n\nend SubsemiringAlgebra\n\n/-- Explicit characterization of the submonoid map in the case of an algebra.\n`S` is made explicit to help with type inference -/\ndef algebraMapSubmonoid (S : Type*) [Semiring S] [Algebra R S] (M : Submonoid R) : Submonoid S :=\n M.map (algebraMap R S)\n\nvariable {S : Type*} [Semiring S] [Algebra R S]\n\ntheorem mem_algebraMapSubmonoid_of_mem {M : Submonoid R}\n (x : M) : algebraMap R S x ∈ algebraMapSubmonoid S M :=\n Set.mem_image_of_mem (algebraMap R S) x.2\n\n@[simp]\nlemma algebraMapSubmonoid_self (M : Submonoid R) : Algebra.algebraMapSubmonoid R M = M :=\n Submonoid.map_id M\n\n@[simp]\nlemma algebraMapSubmonoid_powers (r : R) :\n Algebra.algebraMapSubmonoid S (.powers r) = Submonoid.powers (algebraMap R S r) := by\n simp [Algebra.algebraMapSubmonoid]\n\nlemma algebraMapSubmonoid_isUnit_le :\n algebraMapSubmonoid S (IsUnit.submonoid R) ≤ IsUnit.submonoid S := by\n rintro x ⟨y, hy, rfl⟩\n exact hy.map _\n\nend Semiring\n\nsection CommSemiring\n\nvariable [CommSemiring R]\n\nTarget:\ntheorem mul_sub_algebraMap_commutes [Ring A] [Algebra R A] (x : A) (r : R) :\n x * (x - algebraMap R A r) = (x - algebraMap R A r) * x :=\n\nProof body:\n","proof_body":"by rw [mul_sub, ← commutes, sub_mul]","provenance":{"declaration_index":14,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"d81d29e01f64ac82099070062ec2011a0ac2599a5411d5c30b031029566d2429","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Basic.lean"},"sample_id":"713b25ef5affcea82ccd6f2d104cee98a01526f70a48e47cad07346b049d5f4c","schema_version":1,"split":"train","theorem_statement":"theorem mul_sub_algebraMap_commutes [Ring A] [Algebra R A] (x : A) (r : R) :\n x * (x - algebraMap R A r) = (x - algebraMap R A r) * x :="} {"completion":"by\n induction n with\n | zero => simp\n | succ n ih =>\n rw [pow_succ', ← mul_assoc, mul_sub_algebraMap_commutes, mul_assoc, ih, ← mul_assoc]","context_contains_namespace":true,"context_suffix":"end CommSemiring\nend Algebra","dependency_ids":["import:Mathlib.Algebra.Algebra.Defs","import:Mathlib.Algebra.Module.Equiv.Basic","import:Mathlib.Algebra.Module.Submodule.Ker","import:Mathlib.Algebra.Module.Submodule.RestrictScalars","import:Mathlib.Algebra.Module.ULift","import:Mathlib.Algebra.Ring.CharZero","import:Mathlib.Algebra.Ring.Subring.Basic","import:Mathlib.Data.Nat.Cast.Order.Basic","import:Mathlib.Data.Int.CharZero","import:Mathlib.Algebra.Ring.Hom.InjSurj"],"family_id":"mul_sub_algebramap_pow_commutes","file_id":"mathlib/Mathlib/Algebra/Algebra/Basic.lean","imports":["public import Mathlib.Algebra.Algebra.Defs","public import Mathlib.Algebra.Module.Equiv.Basic","public import Mathlib.Algebra.Module.Submodule.Ker","public import Mathlib.Algebra.Module.Submodule.RestrictScalars","public import Mathlib.Algebra.Module.ULift","public import Mathlib.Algebra.Ring.CharZero","public import Mathlib.Algebra.Ring.Subring.Basic","public import Mathlib.Data.Nat.Cast.Order.Basic","public import Mathlib.Data.Int.CharZero","import Mathlib.Algebra.Ring.Hom.InjSurj"],"local_context":"/-\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-/\n/-!\n# Further basic results about `Algebra`.\n\nThis file could usefully be split further.\n-/\n\n@[expose] public section\n\nuniverse u v w u₁ v₁\n\nopen Function Module\n\nnamespace Algebra\n\nvariable {R A M : Type*}\n\nsection Semiring\n\nvariable [CommSemiring R]\nvariable [Semiring A] [Algebra R A]\n\nsection PUnit\n\ninstance _root_.PUnit.algebra : Algebra R PUnit.{v + 1} where\n algebraMap :=\n { toFun _ := PUnit.unit\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' _ _ := rfl\n smul_def' _ _ := rfl\n\n@[simp]\ntheorem algebraMap_pUnit (r : R) : algebraMap R PUnit r = PUnit.unit :=\n rfl\n\nend PUnit\n\nsection ULift\n\ninstance _root_.ULift.algebra : Algebra R (ULift A) :=\n { ULift.module' with\n algebraMap :=\n { (ULift.ringEquiv : ULift A ≃+* A).symm.toRingHom.comp (algebraMap R A) with\n toFun := fun r => ULift.up (algebraMap R A r) }\n commutes' := fun r x => ULift.down_injective <| Algebra.commutes r x.down\n smul_def' := fun r x => ULift.down_injective <| Algebra.smul_def' r x.down }\n\ntheorem _root_.ULift.algebraMap_eq (r : R) :\n algebraMap R (ULift A) r = ULift.up (algebraMap R A r) :=\n rfl\n\n@[simp]\ntheorem _root_.ULift.down_algebraMap (r : R) : (algebraMap R (ULift A) r).down = algebraMap R A r :=\n rfl\n\nvariable (R A) in\n/-- If `A` is an `R`-algebra, it is also a `ULift R`-algebra. In particular, `Ulift A` is a\n`ULift R` algebra. This is not an instance, because it causes a non-reducible diamond in the case\nwhere `A = Ulift R`. -/\n@[instance_reducible]\ndef _root_.ULift.algebra' : Algebra (ULift.{u} R) A where\n __ := ULift.module\n algebraMap := (algebraMap R A).comp ULift.ringEquiv.toRingHom\n commutes' _ _ := Algebra.commutes ..\n smul_def' _ _ := Algebra.smul_def' ..\n\nattribute [local instance] ULift.algebra' in\n/-- This references the `ULift.algebra'` instance. -/\n@[simp]\nlemma _root_.ULift.algebraMap_apply' (r : ULift R) :\n algebraMap (ULift R) A r = algebraMap R A r.down := rfl\n\nend ULift\n\nsection SubsemiringAlgebra\n\nvariable {C : Type*} [SetLike C R] [SubsemiringClass C R]\n\n/-- Algebra over a subsemiring. This builds upon `Subsemiring.module`. -/\ninstance (priority := 900) ofSubsemiring (S : C) : Algebra S A where\n algebraMap := (algebraMap R A).comp (Subsemiring.subtype <| .ofClass S)\n commutes' r x := Algebra.commutes (r : R) x\n smul_def' r x := Algebra.smul_def (r : R) x\n\ntheorem algebraMap_ofSubsemiring (S : Subsemiring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\ntheorem coe_algebraMap_ofSubsemiring (S : C) : (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\ntheorem algebraMap_ofSubsemiring_apply (S : C) (x : S) : algebraMap S R x = x :=\n rfl\n\n/-- Algebra over a subring. This builds upon `Subring.module`. -/\ninstance ofSubring {R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : Subring R) :\n Algebra S A := inferInstance\n\ntheorem algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\n@[deprecated coe_algebraMap_ofSubsemiring (since := \"2025-11-23\")]\ntheorem coe_algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\n@[deprecated algebraMap_ofSubsemiring_apply (since := \"2025-11-23\")]\ntheorem algebraMap_ofSubring_apply {R : Type*} [CommRing R] (S : Subring R) (x : S) :\n algebraMap S R x = x :=\n rfl\n\nend SubsemiringAlgebra\n\n/-- Explicit characterization of the submonoid map in the case of an algebra.\n`S` is made explicit to help with type inference -/\ndef algebraMapSubmonoid (S : Type*) [Semiring S] [Algebra R S] (M : Submonoid R) : Submonoid S :=\n M.map (algebraMap R S)\n\nvariable {S : Type*} [Semiring S] [Algebra R S]\n\ntheorem mem_algebraMapSubmonoid_of_mem {M : Submonoid R}\n (x : M) : algebraMap R S x ∈ algebraMapSubmonoid S M :=\n Set.mem_image_of_mem (algebraMap R S) x.2\n\n@[simp]\nlemma algebraMapSubmonoid_self (M : Submonoid R) : Algebra.algebraMapSubmonoid R M = M :=\n Submonoid.map_id M\n\n@[simp]\nlemma algebraMapSubmonoid_powers (r : R) :\n Algebra.algebraMapSubmonoid S (.powers r) = Submonoid.powers (algebraMap R S r) := by\n simp [Algebra.algebraMapSubmonoid]\n\nlemma algebraMapSubmonoid_isUnit_le :\n algebraMapSubmonoid S (IsUnit.submonoid R) ≤ IsUnit.submonoid S := by\n rintro x ⟨y, hy, rfl⟩\n exact hy.map _\n\nend Semiring\n\nsection CommSemiring\n\nvariable [CommSemiring R]\n\ntheorem mul_sub_algebraMap_commutes [Ring A] [Algebra R A] (x : A) (r : R) :\n x * (x - algebraMap R A r) = (x - algebraMap R A r) * x := by rw [mul_sub, ← commutes, sub_mul]","module_header":true,"namespace":"Algebra","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Defs\npublic import Mathlib.Algebra.Module.Equiv.Basic\npublic import Mathlib.Algebra.Module.Submodule.Ker\npublic import Mathlib.Algebra.Module.Submodule.RestrictScalars\npublic import Mathlib.Algebra.Module.ULift\npublic import Mathlib.Algebra.Ring.CharZero\npublic import Mathlib.Algebra.Ring.Subring.Basic\npublic import Mathlib.Data.Nat.Cast.Order.Basic\npublic import Mathlib.Data.Int.CharZero\nimport Mathlib.Algebra.Ring.Hom.InjSurj\n\nNamespace:\nAlgebra\n\nLocal context:\n/-\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-/\n/-!\n# Further basic results about `Algebra`.\n\nThis file could usefully be split further.\n-/\n\n@[expose] public section\n\nuniverse u v w u₁ v₁\n\nopen Function Module\n\nnamespace Algebra\n\nvariable {R A M : Type*}\n\nsection Semiring\n\nvariable [CommSemiring R]\nvariable [Semiring A] [Algebra R A]\n\nsection PUnit\n\ninstance _root_.PUnit.algebra : Algebra R PUnit.{v + 1} where\n algebraMap :=\n { toFun _ := PUnit.unit\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' _ _ := rfl\n smul_def' _ _ := rfl\n\n@[simp]\ntheorem algebraMap_pUnit (r : R) : algebraMap R PUnit r = PUnit.unit :=\n rfl\n\nend PUnit\n\nsection ULift\n\ninstance _root_.ULift.algebra : Algebra R (ULift A) :=\n { ULift.module' with\n algebraMap :=\n { (ULift.ringEquiv : ULift A ≃+* A).symm.toRingHom.comp (algebraMap R A) with\n toFun := fun r => ULift.up (algebraMap R A r) }\n commutes' := fun r x => ULift.down_injective <| Algebra.commutes r x.down\n smul_def' := fun r x => ULift.down_injective <| Algebra.smul_def' r x.down }\n\ntheorem _root_.ULift.algebraMap_eq (r : R) :\n algebraMap R (ULift A) r = ULift.up (algebraMap R A r) :=\n rfl\n\n@[simp]\ntheorem _root_.ULift.down_algebraMap (r : R) : (algebraMap R (ULift A) r).down = algebraMap R A r :=\n rfl\n\nvariable (R A) in\n/-- If `A` is an `R`-algebra, it is also a `ULift R`-algebra. In particular, `Ulift A` is a\n`ULift R` algebra. This is not an instance, because it causes a non-reducible diamond in the case\nwhere `A = Ulift R`. -/\n@[instance_reducible]\ndef _root_.ULift.algebra' : Algebra (ULift.{u} R) A where\n __ := ULift.module\n algebraMap := (algebraMap R A).comp ULift.ringEquiv.toRingHom\n commutes' _ _ := Algebra.commutes ..\n smul_def' _ _ := Algebra.smul_def' ..\n\nattribute [local instance] ULift.algebra' in\n/-- This references the `ULift.algebra'` instance. -/\n@[simp]\nlemma _root_.ULift.algebraMap_apply' (r : ULift R) :\n algebraMap (ULift R) A r = algebraMap R A r.down := rfl\n\nend ULift\n\nsection SubsemiringAlgebra\n\nvariable {C : Type*} [SetLike C R] [SubsemiringClass C R]\n\n/-- Algebra over a subsemiring. This builds upon `Subsemiring.module`. -/\ninstance (priority := 900) ofSubsemiring (S : C) : Algebra S A where\n algebraMap := (algebraMap R A).comp (Subsemiring.subtype <| .ofClass S)\n commutes' r x := Algebra.commutes (r : R) x\n smul_def' r x := Algebra.smul_def (r : R) x\n\ntheorem algebraMap_ofSubsemiring (S : Subsemiring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\ntheorem coe_algebraMap_ofSubsemiring (S : C) : (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\ntheorem algebraMap_ofSubsemiring_apply (S : C) (x : S) : algebraMap S R x = x :=\n rfl\n\n/-- Algebra over a subring. This builds upon `Subring.module`. -/\ninstance ofSubring {R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : Subring R) :\n Algebra S A := inferInstance\n\ntheorem algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\n@[deprecated coe_algebraMap_ofSubsemiring (since := \"2025-11-23\")]\ntheorem coe_algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\n@[deprecated algebraMap_ofSubsemiring_apply (since := \"2025-11-23\")]\ntheorem algebraMap_ofSubring_apply {R : Type*} [CommRing R] (S : Subring R) (x : S) :\n algebraMap S R x = x :=\n rfl\n\nend SubsemiringAlgebra\n\n/-- Explicit characterization of the submonoid map in the case of an algebra.\n`S` is made explicit to help with type inference -/\ndef algebraMapSubmonoid (S : Type*) [Semiring S] [Algebra R S] (M : Submonoid R) : Submonoid S :=\n M.map (algebraMap R S)\n\nvariable {S : Type*} [Semiring S] [Algebra R S]\n\ntheorem mem_algebraMapSubmonoid_of_mem {M : Submonoid R}\n (x : M) : algebraMap R S x ∈ algebraMapSubmonoid S M :=\n Set.mem_image_of_mem (algebraMap R S) x.2\n\n@[simp]\nlemma algebraMapSubmonoid_self (M : Submonoid R) : Algebra.algebraMapSubmonoid R M = M :=\n Submonoid.map_id M\n\n@[simp]\nlemma algebraMapSubmonoid_powers (r : R) :\n Algebra.algebraMapSubmonoid S (.powers r) = Submonoid.powers (algebraMap R S r) := by\n simp [Algebra.algebraMapSubmonoid]\n\nlemma algebraMapSubmonoid_isUnit_le :\n algebraMapSubmonoid S (IsUnit.submonoid R) ≤ IsUnit.submonoid S := by\n rintro x ⟨y, hy, rfl⟩\n exact hy.map _\n\nend Semiring\n\nsection CommSemiring\n\nvariable [CommSemiring R]\n\ntheorem mul_sub_algebraMap_commutes [Ring A] [Algebra R A] (x : A) (r : R) :\n x * (x - algebraMap R A r) = (x - algebraMap R A r) * x := by rw [mul_sub, ← commutes, sub_mul]\n\nTarget:\ntheorem mul_sub_algebraMap_pow_commutes [Ring A] [Algebra R A] (x : A) (r : R) (n : ℕ) :\n x * (x - algebraMap R A r) ^ n = (x - algebraMap R A r) ^ n * x :=\n\nProof body:\n","proof_body":"by\n induction n with\n | zero => simp\n | succ n ih =>\n rw [pow_succ', ← mul_assoc, mul_sub_algebraMap_commutes, mul_assoc, ih, ← mul_assoc]","provenance":{"declaration_index":15,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"d81d29e01f64ac82099070062ec2011a0ac2599a5411d5c30b031029566d2429","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Basic.lean"},"sample_id":"81dc2e329d9f05c949fed929efec6f7c1c5d2288169379b9ce8de7bfeae290a3","schema_version":1,"split":"train","theorem_statement":"theorem mul_sub_algebraMap_pow_commutes [Ring A] [Algebra R A] (x : A) (r : R) (n : ℕ) :\n x * (x - algebraMap R A r) ^ n = (x - algebraMap R A r) ^ n * x :="} {"completion":"by\n rw [← Algebra.smul_def, ← Algebra.smul_def, map_smul]","context_contains_namespace":true,"context_suffix":"end LinearMap","dependency_ids":["import:Mathlib.Algebra.Algebra.Defs","import:Mathlib.Algebra.Module.Equiv.Basic","import:Mathlib.Algebra.Module.Submodule.Ker","import:Mathlib.Algebra.Module.Submodule.RestrictScalars","import:Mathlib.Algebra.Module.ULift","import:Mathlib.Algebra.Ring.CharZero","import:Mathlib.Algebra.Ring.Subring.Basic","import:Mathlib.Data.Nat.Cast.Order.Basic","import:Mathlib.Data.Int.CharZero","import:Mathlib.Algebra.Ring.Hom.InjSurj"],"family_id":"map_algebramap_mul","file_id":"mathlib/Mathlib/Algebra/Algebra/Basic.lean","imports":["public import Mathlib.Algebra.Algebra.Defs","public import Mathlib.Algebra.Module.Equiv.Basic","public import Mathlib.Algebra.Module.Submodule.Ker","public import Mathlib.Algebra.Module.Submodule.RestrictScalars","public import Mathlib.Algebra.Module.ULift","public import Mathlib.Algebra.Ring.CharZero","public import Mathlib.Algebra.Ring.Subring.Basic","public import Mathlib.Data.Nat.Cast.Order.Basic","public import Mathlib.Data.Int.CharZero","import Mathlib.Algebra.Ring.Hom.InjSurj"],"local_context":"/-\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-/\n/-!\n# Further basic results about `Algebra`.\n\nThis file could usefully be split further.\n-/\n\n@[expose] public section\n\nuniverse u v w u₁ v₁\n\nopen Function Module\n\nnamespace Algebra\n\nvariable {R A M : Type*}\n\nsection Semiring\n\nvariable [CommSemiring R]\nvariable [Semiring A] [Algebra R A]\n\nsection PUnit\n\ninstance _root_.PUnit.algebra : Algebra R PUnit.{v + 1} where\n algebraMap :=\n { toFun _ := PUnit.unit\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' _ _ := rfl\n smul_def' _ _ := rfl\n\n@[simp]\ntheorem algebraMap_pUnit (r : R) : algebraMap R PUnit r = PUnit.unit :=\n rfl\n\nend PUnit\n\nsection ULift\n\ninstance _root_.ULift.algebra : Algebra R (ULift A) :=\n { ULift.module' with\n algebraMap :=\n { (ULift.ringEquiv : ULift A ≃+* A).symm.toRingHom.comp (algebraMap R A) with\n toFun := fun r => ULift.up (algebraMap R A r) }\n commutes' := fun r x => ULift.down_injective <| Algebra.commutes r x.down\n smul_def' := fun r x => ULift.down_injective <| Algebra.smul_def' r x.down }\n\ntheorem _root_.ULift.algebraMap_eq (r : R) :\n algebraMap R (ULift A) r = ULift.up (algebraMap R A r) :=\n rfl\n\n@[simp]\ntheorem _root_.ULift.down_algebraMap (r : R) : (algebraMap R (ULift A) r).down = algebraMap R A r :=\n rfl\n\nvariable (R A) in\n/-- If `A` is an `R`-algebra, it is also a `ULift R`-algebra. In particular, `Ulift A` is a\n`ULift R` algebra. This is not an instance, because it causes a non-reducible diamond in the case\nwhere `A = Ulift R`. -/\n@[instance_reducible]\ndef _root_.ULift.algebra' : Algebra (ULift.{u} R) A where\n __ := ULift.module\n algebraMap := (algebraMap R A).comp ULift.ringEquiv.toRingHom\n commutes' _ _ := Algebra.commutes ..\n smul_def' _ _ := Algebra.smul_def' ..\n\nattribute [local instance] ULift.algebra' in\n/-- This references the `ULift.algebra'` instance. -/\n@[simp]\nlemma _root_.ULift.algebraMap_apply' (r : ULift R) :\n algebraMap (ULift R) A r = algebraMap R A r.down := rfl\n\nend ULift\n\nsection SubsemiringAlgebra\n\nvariable {C : Type*} [SetLike C R] [SubsemiringClass C R]\n\n/-- Algebra over a subsemiring. This builds upon `Subsemiring.module`. -/\ninstance (priority := 900) ofSubsemiring (S : C) : Algebra S A where\n algebraMap := (algebraMap R A).comp (Subsemiring.subtype <| .ofClass S)\n commutes' r x := Algebra.commutes (r : R) x\n smul_def' r x := Algebra.smul_def (r : R) x\n\ntheorem algebraMap_ofSubsemiring (S : Subsemiring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\ntheorem coe_algebraMap_ofSubsemiring (S : C) : (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\ntheorem algebraMap_ofSubsemiring_apply (S : C) (x : S) : algebraMap S R x = x :=\n rfl\n\n/-- Algebra over a subring. This builds upon `Subring.module`. -/\ninstance ofSubring {R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : Subring R) :\n Algebra S A := inferInstance\n\ntheorem algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\n@[deprecated coe_algebraMap_ofSubsemiring (since := \"2025-11-23\")]\ntheorem coe_algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\n@[deprecated algebraMap_ofSubsemiring_apply (since := \"2025-11-23\")]\ntheorem algebraMap_ofSubring_apply {R : Type*} [CommRing R] (S : Subring R) (x : S) :\n algebraMap S R x = x :=\n rfl\n\nend SubsemiringAlgebra\n\n/-- Explicit characterization of the submonoid map in the case of an algebra.\n`S` is made explicit to help with type inference -/\ndef algebraMapSubmonoid (S : Type*) [Semiring S] [Algebra R S] (M : Submonoid R) : Submonoid S :=\n M.map (algebraMap R S)\n\nvariable {S : Type*} [Semiring S] [Algebra R S]\n\ntheorem mem_algebraMapSubmonoid_of_mem {M : Submonoid R}\n (x : M) : algebraMap R S x ∈ algebraMapSubmonoid S M :=\n Set.mem_image_of_mem (algebraMap R S) x.2\n\n@[simp]\nlemma algebraMapSubmonoid_self (M : Submonoid R) : Algebra.algebraMapSubmonoid R M = M :=\n Submonoid.map_id M\n\n@[simp]\nlemma algebraMapSubmonoid_powers (r : R) :\n Algebra.algebraMapSubmonoid S (.powers r) = Submonoid.powers (algebraMap R S r) := by\n simp [Algebra.algebraMapSubmonoid]\n\nlemma algebraMapSubmonoid_isUnit_le :\n algebraMapSubmonoid S (IsUnit.submonoid R) ≤ IsUnit.submonoid S := by\n rintro x ⟨y, hy, rfl⟩\n exact hy.map _\n\nend Semiring\n\nsection CommSemiring\n\nvariable [CommSemiring R]\n\ntheorem mul_sub_algebraMap_commutes [Ring A] [Algebra R A] (x : A) (r : R) :\n x * (x - algebraMap R A r) = (x - algebraMap R A r) * x := by rw [mul_sub, ← commutes, sub_mul]\n\ntheorem mul_sub_algebraMap_pow_commutes [Ring A] [Algebra R A] (x : A) (r : R) (n : ℕ) :\n x * (x - algebraMap R A r) ^ n = (x - algebraMap R A r) ^ n * x := by\n induction n with\n | zero => simp\n | succ n ih =>\n rw [pow_succ', ← mul_assoc, mul_sub_algebraMap_commutes, mul_assoc, ih, ← mul_assoc]\n\nend CommSemiring\n\nsection Ring\n\n/-- A `Semiring` that is an `Algebra` over a commutative ring carries a natural `Ring` structure.\nSee note [reducible non-instances]. -/\nabbrev semiringToRing (R : Type*) [CommRing R] [Semiring A] [Algebra R A] : Ring A :=\n { __ := (inferInstance : Semiring A)\n __ := Module.addCommMonoidToAddCommGroup R\n intCast := fun z => algebraMap R A z\n intCast_ofNat := fun z => by simp only [Int.cast_natCast, map_natCast]\n intCast_negSucc := fun z => by simp }\n\n/-- The `CommRing` structure on a `CommSemiring` induced by a ring morphism from a `CommRing`. -/\nabbrev _root_.RingHom.commSemiringToCommRing {R A : Type*} [CommRing R] [CommSemiring A]\n (φ : R →+* A) : CommRing A :=\n let _ : Algebra R A := RingHom.toAlgebra φ\n { __ := Algebra.semiringToRing R\n mul_comm := CommMonoid.mul_comm }\n\ninstance {R : Type*} [Ring R] : Algebra (Subring.center R) R where\n algebraMap :=\n { toFun := Subtype.val\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' r x := (Subring.mem_center_iff.1 r.2 x).symm\n smul_def' _ _ := rfl\n\nend Ring\n\nend Algebra\n\nopen scoped Algebra\n\nnamespace Module\n\nvariable (R : Type u) (S : Type v) (M : Type w)\nvariable [CommSemiring R] [Semiring S] [AddCommMonoid M] [Module R M] [Module S M]\nvariable [SMulCommClass S R M] [SMul R S] [IsScalarTower R S M]\n\ninstance End.instAlgebra : Algebra R (Module.End S M) :=\n Algebra.ofModule smul_mul_assoc fun r f g => (smul_comm r f g).symm\n\n-- to prove this is a special case of the above\nexample : Algebra R (Module.End R M) := End.instAlgebra _ _ _\n\ntheorem algebraMap_end_eq_smul_id (a : R) : algebraMap R (End S M) a = a • LinearMap.id :=\n rfl\n\n@[simp]\ntheorem algebraMap_end_apply (a : R) (m : M) : algebraMap R (End S M) a m = a • m :=\n rfl\n\n@[simp]\ntheorem ker_algebraMap_end (K : Type u) (V : Type v) [Semifield K] [AddCommMonoid V] [Module K V]\n (a : K) (ha : a ≠ 0) : LinearMap.ker ((algebraMap K (End K V)) a) = ⊥ :=\n LinearMap.ker_smul _ _ ha\n\nsection\n\nvariable {R M}\n\ntheorem End.algebraMap_isUnit_inv_apply_eq_iff {x : R}\n (h : IsUnit (algebraMap R (Module.End S M) x)) (m m' : M) :\n (↑(h.unit⁻¹) : Module.End S M) m = m' ↔ m = x • m' where\n mp H := H ▸ (isUnit_apply_inv_apply_of_isUnit h m).symm\n mpr H := by\n apply_fun ⇑h.unit.val using ((isUnit_iff _).mp h).injective\n rw [H]\n simpa using Module.End.isUnit_apply_inv_apply_of_isUnit h (x • m')\n\ntheorem End.algebraMap_isUnit_inv_apply_eq_iff' {x : R}\n (h : IsUnit (algebraMap R (Module.End S M) x)) (m m' : M) :\n m' = (↑h.unit⁻¹ : Module.End S M) m ↔ m = x • m' where\n mp H := H ▸ (isUnit_apply_inv_apply_of_isUnit h m).symm\n mpr H := by\n apply_fun (↑h.unit : M → M) using ((isUnit_iff _).mp h).injective\n rw [H]\n simpa using isUnit_apply_inv_apply_of_isUnit h (x • m') |>.symm\n\nend\n\nend Module\n\nnamespace LinearMap\n\nvariable {R : Type*} {A : Type*} {B : Type*} [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B]\n\n/-- An alternate statement of `LinearMap.map_smul` for when `algebraMap` is more convenient to\nwork with than `•`. -/","module_header":true,"namespace":"LinearMap","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Defs\npublic import Mathlib.Algebra.Module.Equiv.Basic\npublic import Mathlib.Algebra.Module.Submodule.Ker\npublic import Mathlib.Algebra.Module.Submodule.RestrictScalars\npublic import Mathlib.Algebra.Module.ULift\npublic import Mathlib.Algebra.Ring.CharZero\npublic import Mathlib.Algebra.Ring.Subring.Basic\npublic import Mathlib.Data.Nat.Cast.Order.Basic\npublic import Mathlib.Data.Int.CharZero\nimport Mathlib.Algebra.Ring.Hom.InjSurj\n\nNamespace:\nLinearMap\n\nLocal context:\n/-\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-/\n/-!\n# Further basic results about `Algebra`.\n\nThis file could usefully be split further.\n-/\n\n@[expose] public section\n\nuniverse u v w u₁ v₁\n\nopen Function Module\n\nnamespace Algebra\n\nvariable {R A M : Type*}\n\nsection Semiring\n\nvariable [CommSemiring R]\nvariable [Semiring A] [Algebra R A]\n\nsection PUnit\n\ninstance _root_.PUnit.algebra : Algebra R PUnit.{v + 1} where\n algebraMap :=\n { toFun _ := PUnit.unit\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' _ _ := rfl\n smul_def' _ _ := rfl\n\n@[simp]\ntheorem algebraMap_pUnit (r : R) : algebraMap R PUnit r = PUnit.unit :=\n rfl\n\nend PUnit\n\nsection ULift\n\ninstance _root_.ULift.algebra : Algebra R (ULift A) :=\n { ULift.module' with\n algebraMap :=\n { (ULift.ringEquiv : ULift A ≃+* A).symm.toRingHom.comp (algebraMap R A) with\n toFun := fun r => ULift.up (algebraMap R A r) }\n commutes' := fun r x => ULift.down_injective <| Algebra.commutes r x.down\n smul_def' := fun r x => ULift.down_injective <| Algebra.smul_def' r x.down }\n\ntheorem _root_.ULift.algebraMap_eq (r : R) :\n algebraMap R (ULift A) r = ULift.up (algebraMap R A r) :=\n rfl\n\n@[simp]\ntheorem _root_.ULift.down_algebraMap (r : R) : (algebraMap R (ULift A) r).down = algebraMap R A r :=\n rfl\n\nvariable (R A) in\n/-- If `A` is an `R`-algebra, it is also a `ULift R`-algebra. In particular, `Ulift A` is a\n`ULift R` algebra. This is not an instance, because it causes a non-reducible diamond in the case\nwhere `A = Ulift R`. -/\n@[instance_reducible]\ndef _root_.ULift.algebra' : Algebra (ULift.{u} R) A where\n __ := ULift.module\n algebraMap := (algebraMap R A).comp ULift.ringEquiv.toRingHom\n commutes' _ _ := Algebra.commutes ..\n smul_def' _ _ := Algebra.smul_def' ..\n\nattribute [local instance] ULift.algebra' in\n/-- This references the `ULift.algebra'` instance. -/\n@[simp]\nlemma _root_.ULift.algebraMap_apply' (r : ULift R) :\n algebraMap (ULift R) A r = algebraMap R A r.down := rfl\n\nend ULift\n\nsection SubsemiringAlgebra\n\nvariable {C : Type*} [SetLike C R] [SubsemiringClass C R]\n\n/-- Algebra over a subsemiring. This builds upon `Subsemiring.module`. -/\ninstance (priority := 900) ofSubsemiring (S : C) : Algebra S A where\n algebraMap := (algebraMap R A).comp (Subsemiring.subtype <| .ofClass S)\n commutes' r x := Algebra.commutes (r : R) x\n smul_def' r x := Algebra.smul_def (r : R) x\n\ntheorem algebraMap_ofSubsemiring (S : Subsemiring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\ntheorem coe_algebraMap_ofSubsemiring (S : C) : (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\ntheorem algebraMap_ofSubsemiring_apply (S : C) (x : S) : algebraMap S R x = x :=\n rfl\n\n/-- Algebra over a subring. This builds upon `Subring.module`. -/\ninstance ofSubring {R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : Subring R) :\n Algebra S A := inferInstance\n\ntheorem algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\n@[deprecated coe_algebraMap_ofSubsemiring (since := \"2025-11-23\")]\ntheorem coe_algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\n@[deprecated algebraMap_ofSubsemiring_apply (since := \"2025-11-23\")]\ntheorem algebraMap_ofSubring_apply {R : Type*} [CommRing R] (S : Subring R) (x : S) :\n algebraMap S R x = x :=\n rfl\n\nend SubsemiringAlgebra\n\n/-- Explicit characterization of the submonoid map in the case of an algebra.\n`S` is made explicit to help with type inference -/\ndef algebraMapSubmonoid (S : Type*) [Semiring S] [Algebra R S] (M : Submonoid R) : Submonoid S :=\n M.map (algebraMap R S)\n\nvariable {S : Type*} [Semiring S] [Algebra R S]\n\ntheorem mem_algebraMapSubmonoid_of_mem {M : Submonoid R}\n (x : M) : algebraMap R S x ∈ algebraMapSubmonoid S M :=\n Set.mem_image_of_mem (algebraMap R S) x.2\n\n@[simp]\nlemma algebraMapSubmonoid_self (M : Submonoid R) : Algebra.algebraMapSubmonoid R M = M :=\n Submonoid.map_id M\n\n@[simp]\nlemma algebraMapSubmonoid_powers (r : R) :\n Algebra.algebraMapSubmonoid S (.powers r) = Submonoid.powers (algebraMap R S r) := by\n simp [Algebra.algebraMapSubmonoid]\n\nlemma algebraMapSubmonoid_isUnit_le :\n algebraMapSubmonoid S (IsUnit.submonoid R) ≤ IsUnit.submonoid S := by\n rintro x ⟨y, hy, rfl⟩\n exact hy.map _\n\nend Semiring\n\nsection CommSemiring\n\nvariable [CommSemiring R]\n\ntheorem mul_sub_algebraMap_commutes [Ring A] [Algebra R A] (x : A) (r : R) :\n x * (x - algebraMap R A r) = (x - algebraMap R A r) * x := by rw [mul_sub, ← commutes, sub_mul]\n\ntheorem mul_sub_algebraMap_pow_commutes [Ring A] [Algebra R A] (x : A) (r : R) (n : ℕ) :\n x * (x - algebraMap R A r) ^ n = (x - algebraMap R A r) ^ n * x := by\n induction n with\n | zero => simp\n | succ n ih =>\n rw [pow_succ', ← mul_assoc, mul_sub_algebraMap_commutes, mul_assoc, ih, ← mul_assoc]\n\nend CommSemiring\n\nsection Ring\n\n/-- A `Semiring` that is an `Algebra` over a commutative ring carries a natural `Ring` structure.\nSee note [reducible non-instances]. -/\nabbrev semiringToRing (R : Type*) [CommRing R] [Semiring A] [Algebra R A] : Ring A :=\n { __ := (inferInstance : Semiring A)\n __ := Module.addCommMonoidToAddCommGroup R\n intCast := fun z => algebraMap R A z\n intCast_ofNat := fun z => by simp only [Int.cast_natCast, map_natCast]\n intCast_negSucc := fun z => by simp }\n\n/-- The `CommRing` structure on a `CommSemiring` induced by a ring morphism from a `CommRing`. -/\nabbrev _root_.RingHom.commSemiringToCommRing {R A : Type*} [CommRing R] [CommSemiring A]\n (φ : R →+* A) : CommRing A :=\n let _ : Algebra R A := RingHom.toAlgebra φ\n { __ := Algebra.semiringToRing R\n mul_comm := CommMonoid.mul_comm }\n\ninstance {R : Type*} [Ring R] : Algebra (Subring.center R) R where\n algebraMap :=\n { toFun := Subtype.val\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' r x := (Subring.mem_center_iff.1 r.2 x).symm\n smul_def' _ _ := rfl\n\nend Ring\n\nend Algebra\n\nopen scoped Algebra\n\nnamespace Module\n\nvariable (R : Type u) (S : Type v) (M : Type w)\nvariable [CommSemiring R] [Semiring S] [AddCommMonoid M] [Module R M] [Module S M]\nvariable [SMulCommClass S R M] [SMul R S] [IsScalarTower R S M]\n\ninstance End.instAlgebra : Algebra R (Module.End S M) :=\n Algebra.ofModule smul_mul_assoc fun r f g => (smul_comm r f g).symm\n\n-- to prove this is a special case of the above\nexample : Algebra R (Module.End R M) := End.instAlgebra _ _ _\n\ntheorem algebraMap_end_eq_smul_id (a : R) : algebraMap R (End S M) a = a • LinearMap.id :=\n rfl\n\n@[simp]\ntheorem algebraMap_end_apply (a : R) (m : M) : algebraMap R (End S M) a m = a • m :=\n rfl\n\n@[simp]\ntheorem ker_algebraMap_end (K : Type u) (V : Type v) [Semifield K] [AddCommMonoid V] [Module K V]\n (a : K) (ha : a ≠ 0) : LinearMap.ker ((algebraMap K (End K V)) a) = ⊥ :=\n LinearMap.ker_smul _ _ ha\n\nsection\n\nvariable {R M}\n\ntheorem End.algebraMap_isUnit_inv_apply_eq_iff {x : R}\n (h : IsUnit (algebraMap R (Module.End S M) x)) (m m' : M) :\n (↑(h.unit⁻¹) : Module.End S M) m = m' ↔ m = x • m' where\n mp H := H ▸ (isUnit_apply_inv_apply_of_isUnit h m).symm\n mpr H := by\n apply_fun ⇑h.unit.val using ((isUnit_iff _).mp h).injective\n rw [H]\n simpa using Module.End.isUnit_apply_inv_apply_of_isUnit h (x • m')\n\ntheorem End.algebraMap_isUnit_inv_apply_eq_iff' {x : R}\n (h : IsUnit (algebraMap R (Module.End S M) x)) (m m' : M) :\n m' = (↑h.unit⁻¹ : Module.End S M) m ↔ m = x • m' where\n mp H := H ▸ (isUnit_apply_inv_apply_of_isUnit h m).symm\n mpr H := by\n apply_fun (↑h.unit : M → M) using ((isUnit_iff _).mp h).injective\n rw [H]\n simpa using isUnit_apply_inv_apply_of_isUnit h (x • m') |>.symm\n\nend\n\nend Module\n\nnamespace LinearMap\n\nvariable {R : Type*} {A : Type*} {B : Type*} [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B]\n\n/-- An alternate statement of `LinearMap.map_smul` for when `algebraMap` is more convenient to\nwork with than `•`. -/\n\nTarget:\ntheorem map_algebraMap_mul (f : A →ₗ[R] B) (a : A) (r : R) :\n f (algebraMap R A r * a) = algebraMap R B r * f a :=\n\nProof body:\n","proof_body":"by\n rw [← Algebra.smul_def, ← Algebra.smul_def, map_smul]","provenance":{"declaration_index":21,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"d81d29e01f64ac82099070062ec2011a0ac2599a5411d5c30b031029566d2429","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Basic.lean"},"sample_id":"3c74f0545aa5cc63d725074586e5042d214929c52d9abc2514d02df0de4a9a3f","schema_version":1,"split":"train","theorem_statement":"theorem map_algebraMap_mul (f : A →ₗ[R] B) (a : A) (r : R) :\n f (algebraMap R A r * a) = algebraMap R B r * f a :="} {"completion":"by\n rw [← Algebra.commutes, ← Algebra.commutes, map_algebraMap_mul]","context_contains_namespace":true,"context_suffix":"end LinearMap","dependency_ids":["import:Mathlib.Algebra.Algebra.Defs","import:Mathlib.Algebra.Module.Equiv.Basic","import:Mathlib.Algebra.Module.Submodule.Ker","import:Mathlib.Algebra.Module.Submodule.RestrictScalars","import:Mathlib.Algebra.Module.ULift","import:Mathlib.Algebra.Ring.CharZero","import:Mathlib.Algebra.Ring.Subring.Basic","import:Mathlib.Data.Nat.Cast.Order.Basic","import:Mathlib.Data.Int.CharZero","import:Mathlib.Algebra.Ring.Hom.InjSurj"],"family_id":"map_mul_algebramap","file_id":"mathlib/Mathlib/Algebra/Algebra/Basic.lean","imports":["public import Mathlib.Algebra.Algebra.Defs","public import Mathlib.Algebra.Module.Equiv.Basic","public import Mathlib.Algebra.Module.Submodule.Ker","public import Mathlib.Algebra.Module.Submodule.RestrictScalars","public import Mathlib.Algebra.Module.ULift","public import Mathlib.Algebra.Ring.CharZero","public import Mathlib.Algebra.Ring.Subring.Basic","public import Mathlib.Data.Nat.Cast.Order.Basic","public import Mathlib.Data.Int.CharZero","import Mathlib.Algebra.Ring.Hom.InjSurj"],"local_context":"/-\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-/\n/-!\n# Further basic results about `Algebra`.\n\nThis file could usefully be split further.\n-/\n\n@[expose] public section\n\nuniverse u v w u₁ v₁\n\nopen Function Module\n\nnamespace Algebra\n\nvariable {R A M : Type*}\n\nsection Semiring\n\nvariable [CommSemiring R]\nvariable [Semiring A] [Algebra R A]\n\nsection PUnit\n\ninstance _root_.PUnit.algebra : Algebra R PUnit.{v + 1} where\n algebraMap :=\n { toFun _ := PUnit.unit\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' _ _ := rfl\n smul_def' _ _ := rfl\n\n@[simp]\ntheorem algebraMap_pUnit (r : R) : algebraMap R PUnit r = PUnit.unit :=\n rfl\n\nend PUnit\n\nsection ULift\n\ninstance _root_.ULift.algebra : Algebra R (ULift A) :=\n { ULift.module' with\n algebraMap :=\n { (ULift.ringEquiv : ULift A ≃+* A).symm.toRingHom.comp (algebraMap R A) with\n toFun := fun r => ULift.up (algebraMap R A r) }\n commutes' := fun r x => ULift.down_injective <| Algebra.commutes r x.down\n smul_def' := fun r x => ULift.down_injective <| Algebra.smul_def' r x.down }\n\ntheorem _root_.ULift.algebraMap_eq (r : R) :\n algebraMap R (ULift A) r = ULift.up (algebraMap R A r) :=\n rfl\n\n@[simp]\ntheorem _root_.ULift.down_algebraMap (r : R) : (algebraMap R (ULift A) r).down = algebraMap R A r :=\n rfl\n\nvariable (R A) in\n/-- If `A` is an `R`-algebra, it is also a `ULift R`-algebra. In particular, `Ulift A` is a\n`ULift R` algebra. This is not an instance, because it causes a non-reducible diamond in the case\nwhere `A = Ulift R`. -/\n@[instance_reducible]\ndef _root_.ULift.algebra' : Algebra (ULift.{u} R) A where\n __ := ULift.module\n algebraMap := (algebraMap R A).comp ULift.ringEquiv.toRingHom\n commutes' _ _ := Algebra.commutes ..\n smul_def' _ _ := Algebra.smul_def' ..\n\nattribute [local instance] ULift.algebra' in\n/-- This references the `ULift.algebra'` instance. -/\n@[simp]\nlemma _root_.ULift.algebraMap_apply' (r : ULift R) :\n algebraMap (ULift R) A r = algebraMap R A r.down := rfl\n\nend ULift\n\nsection SubsemiringAlgebra\n\nvariable {C : Type*} [SetLike C R] [SubsemiringClass C R]\n\n/-- Algebra over a subsemiring. This builds upon `Subsemiring.module`. -/\ninstance (priority := 900) ofSubsemiring (S : C) : Algebra S A where\n algebraMap := (algebraMap R A).comp (Subsemiring.subtype <| .ofClass S)\n commutes' r x := Algebra.commutes (r : R) x\n smul_def' r x := Algebra.smul_def (r : R) x\n\ntheorem algebraMap_ofSubsemiring (S : Subsemiring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\ntheorem coe_algebraMap_ofSubsemiring (S : C) : (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\ntheorem algebraMap_ofSubsemiring_apply (S : C) (x : S) : algebraMap S R x = x :=\n rfl\n\n/-- Algebra over a subring. This builds upon `Subring.module`. -/\ninstance ofSubring {R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : Subring R) :\n Algebra S A := inferInstance\n\ntheorem algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\n@[deprecated coe_algebraMap_ofSubsemiring (since := \"2025-11-23\")]\ntheorem coe_algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\n@[deprecated algebraMap_ofSubsemiring_apply (since := \"2025-11-23\")]\ntheorem algebraMap_ofSubring_apply {R : Type*} [CommRing R] (S : Subring R) (x : S) :\n algebraMap S R x = x :=\n rfl\n\nend SubsemiringAlgebra\n\n/-- Explicit characterization of the submonoid map in the case of an algebra.\n`S` is made explicit to help with type inference -/\ndef algebraMapSubmonoid (S : Type*) [Semiring S] [Algebra R S] (M : Submonoid R) : Submonoid S :=\n M.map (algebraMap R S)\n\nvariable {S : Type*} [Semiring S] [Algebra R S]\n\ntheorem mem_algebraMapSubmonoid_of_mem {M : Submonoid R}\n (x : M) : algebraMap R S x ∈ algebraMapSubmonoid S M :=\n Set.mem_image_of_mem (algebraMap R S) x.2\n\n@[simp]\nlemma algebraMapSubmonoid_self (M : Submonoid R) : Algebra.algebraMapSubmonoid R M = M :=\n Submonoid.map_id M\n\n@[simp]\nlemma algebraMapSubmonoid_powers (r : R) :\n Algebra.algebraMapSubmonoid S (.powers r) = Submonoid.powers (algebraMap R S r) := by\n simp [Algebra.algebraMapSubmonoid]\n\nlemma algebraMapSubmonoid_isUnit_le :\n algebraMapSubmonoid S (IsUnit.submonoid R) ≤ IsUnit.submonoid S := by\n rintro x ⟨y, hy, rfl⟩\n exact hy.map _\n\nend Semiring\n\nsection CommSemiring\n\nvariable [CommSemiring R]\n\ntheorem mul_sub_algebraMap_commutes [Ring A] [Algebra R A] (x : A) (r : R) :\n x * (x - algebraMap R A r) = (x - algebraMap R A r) * x := by rw [mul_sub, ← commutes, sub_mul]\n\ntheorem mul_sub_algebraMap_pow_commutes [Ring A] [Algebra R A] (x : A) (r : R) (n : ℕ) :\n x * (x - algebraMap R A r) ^ n = (x - algebraMap R A r) ^ n * x := by\n induction n with\n | zero => simp\n | succ n ih =>\n rw [pow_succ', ← mul_assoc, mul_sub_algebraMap_commutes, mul_assoc, ih, ← mul_assoc]\n\nend CommSemiring\n\nsection Ring\n\n/-- A `Semiring` that is an `Algebra` over a commutative ring carries a natural `Ring` structure.\nSee note [reducible non-instances]. -/\nabbrev semiringToRing (R : Type*) [CommRing R] [Semiring A] [Algebra R A] : Ring A :=\n { __ := (inferInstance : Semiring A)\n __ := Module.addCommMonoidToAddCommGroup R\n intCast := fun z => algebraMap R A z\n intCast_ofNat := fun z => by simp only [Int.cast_natCast, map_natCast]\n intCast_negSucc := fun z => by simp }\n\n/-- The `CommRing` structure on a `CommSemiring` induced by a ring morphism from a `CommRing`. -/\nabbrev _root_.RingHom.commSemiringToCommRing {R A : Type*} [CommRing R] [CommSemiring A]\n (φ : R →+* A) : CommRing A :=\n let _ : Algebra R A := RingHom.toAlgebra φ\n { __ := Algebra.semiringToRing R\n mul_comm := CommMonoid.mul_comm }\n\ninstance {R : Type*} [Ring R] : Algebra (Subring.center R) R where\n algebraMap :=\n { toFun := Subtype.val\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' r x := (Subring.mem_center_iff.1 r.2 x).symm\n smul_def' _ _ := rfl\n\nend Ring\n\nend Algebra\n\nopen scoped Algebra\n\nnamespace Module\n\nvariable (R : Type u) (S : Type v) (M : Type w)\nvariable [CommSemiring R] [Semiring S] [AddCommMonoid M] [Module R M] [Module S M]\nvariable [SMulCommClass S R M] [SMul R S] [IsScalarTower R S M]\n\ninstance End.instAlgebra : Algebra R (Module.End S M) :=\n Algebra.ofModule smul_mul_assoc fun r f g => (smul_comm r f g).symm\n\n-- to prove this is a special case of the above\nexample : Algebra R (Module.End R M) := End.instAlgebra _ _ _\n\ntheorem algebraMap_end_eq_smul_id (a : R) : algebraMap R (End S M) a = a • LinearMap.id :=\n rfl\n\n@[simp]\ntheorem algebraMap_end_apply (a : R) (m : M) : algebraMap R (End S M) a m = a • m :=\n rfl\n\n@[simp]\ntheorem ker_algebraMap_end (K : Type u) (V : Type v) [Semifield K] [AddCommMonoid V] [Module K V]\n (a : K) (ha : a ≠ 0) : LinearMap.ker ((algebraMap K (End K V)) a) = ⊥ :=\n LinearMap.ker_smul _ _ ha\n\nsection\n\nvariable {R M}\n\ntheorem End.algebraMap_isUnit_inv_apply_eq_iff {x : R}\n (h : IsUnit (algebraMap R (Module.End S M) x)) (m m' : M) :\n (↑(h.unit⁻¹) : Module.End S M) m = m' ↔ m = x • m' where\n mp H := H ▸ (isUnit_apply_inv_apply_of_isUnit h m).symm\n mpr H := by\n apply_fun ⇑h.unit.val using ((isUnit_iff _).mp h).injective\n rw [H]\n simpa using Module.End.isUnit_apply_inv_apply_of_isUnit h (x • m')\n\ntheorem End.algebraMap_isUnit_inv_apply_eq_iff' {x : R}\n (h : IsUnit (algebraMap R (Module.End S M) x)) (m m' : M) :\n m' = (↑h.unit⁻¹ : Module.End S M) m ↔ m = x • m' where\n mp H := H ▸ (isUnit_apply_inv_apply_of_isUnit h m).symm\n mpr H := by\n apply_fun (↑h.unit : M → M) using ((isUnit_iff _).mp h).injective\n rw [H]\n simpa using isUnit_apply_inv_apply_of_isUnit h (x • m') |>.symm\n\nend\n\nend Module\n\nnamespace LinearMap\n\nvariable {R : Type*} {A : Type*} {B : Type*} [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B]\n\n/-- An alternate statement of `LinearMap.map_smul` for when `algebraMap` is more convenient to\nwork with than `•`. -/\ntheorem map_algebraMap_mul (f : A →ₗ[R] B) (a : A) (r : R) :\n f (algebraMap R A r * a) = algebraMap R B r * f a := by\n rw [← Algebra.smul_def, ← Algebra.smul_def, map_smul]","module_header":true,"namespace":"LinearMap","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Defs\npublic import Mathlib.Algebra.Module.Equiv.Basic\npublic import Mathlib.Algebra.Module.Submodule.Ker\npublic import Mathlib.Algebra.Module.Submodule.RestrictScalars\npublic import Mathlib.Algebra.Module.ULift\npublic import Mathlib.Algebra.Ring.CharZero\npublic import Mathlib.Algebra.Ring.Subring.Basic\npublic import Mathlib.Data.Nat.Cast.Order.Basic\npublic import Mathlib.Data.Int.CharZero\nimport Mathlib.Algebra.Ring.Hom.InjSurj\n\nNamespace:\nLinearMap\n\nLocal context:\n/-\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-/\n/-!\n# Further basic results about `Algebra`.\n\nThis file could usefully be split further.\n-/\n\n@[expose] public section\n\nuniverse u v w u₁ v₁\n\nopen Function Module\n\nnamespace Algebra\n\nvariable {R A M : Type*}\n\nsection Semiring\n\nvariable [CommSemiring R]\nvariable [Semiring A] [Algebra R A]\n\nsection PUnit\n\ninstance _root_.PUnit.algebra : Algebra R PUnit.{v + 1} where\n algebraMap :=\n { toFun _ := PUnit.unit\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' _ _ := rfl\n smul_def' _ _ := rfl\n\n@[simp]\ntheorem algebraMap_pUnit (r : R) : algebraMap R PUnit r = PUnit.unit :=\n rfl\n\nend PUnit\n\nsection ULift\n\ninstance _root_.ULift.algebra : Algebra R (ULift A) :=\n { ULift.module' with\n algebraMap :=\n { (ULift.ringEquiv : ULift A ≃+* A).symm.toRingHom.comp (algebraMap R A) with\n toFun := fun r => ULift.up (algebraMap R A r) }\n commutes' := fun r x => ULift.down_injective <| Algebra.commutes r x.down\n smul_def' := fun r x => ULift.down_injective <| Algebra.smul_def' r x.down }\n\ntheorem _root_.ULift.algebraMap_eq (r : R) :\n algebraMap R (ULift A) r = ULift.up (algebraMap R A r) :=\n rfl\n\n@[simp]\ntheorem _root_.ULift.down_algebraMap (r : R) : (algebraMap R (ULift A) r).down = algebraMap R A r :=\n rfl\n\nvariable (R A) in\n/-- If `A` is an `R`-algebra, it is also a `ULift R`-algebra. In particular, `Ulift A` is a\n`ULift R` algebra. This is not an instance, because it causes a non-reducible diamond in the case\nwhere `A = Ulift R`. -/\n@[instance_reducible]\ndef _root_.ULift.algebra' : Algebra (ULift.{u} R) A where\n __ := ULift.module\n algebraMap := (algebraMap R A).comp ULift.ringEquiv.toRingHom\n commutes' _ _ := Algebra.commutes ..\n smul_def' _ _ := Algebra.smul_def' ..\n\nattribute [local instance] ULift.algebra' in\n/-- This references the `ULift.algebra'` instance. -/\n@[simp]\nlemma _root_.ULift.algebraMap_apply' (r : ULift R) :\n algebraMap (ULift R) A r = algebraMap R A r.down := rfl\n\nend ULift\n\nsection SubsemiringAlgebra\n\nvariable {C : Type*} [SetLike C R] [SubsemiringClass C R]\n\n/-- Algebra over a subsemiring. This builds upon `Subsemiring.module`. -/\ninstance (priority := 900) ofSubsemiring (S : C) : Algebra S A where\n algebraMap := (algebraMap R A).comp (Subsemiring.subtype <| .ofClass S)\n commutes' r x := Algebra.commutes (r : R) x\n smul_def' r x := Algebra.smul_def (r : R) x\n\ntheorem algebraMap_ofSubsemiring (S : Subsemiring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\ntheorem coe_algebraMap_ofSubsemiring (S : C) : (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\ntheorem algebraMap_ofSubsemiring_apply (S : C) (x : S) : algebraMap S R x = x :=\n rfl\n\n/-- Algebra over a subring. This builds upon `Subring.module`. -/\ninstance ofSubring {R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : Subring R) :\n Algebra S A := inferInstance\n\ntheorem algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\n@[deprecated coe_algebraMap_ofSubsemiring (since := \"2025-11-23\")]\ntheorem coe_algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\n@[deprecated algebraMap_ofSubsemiring_apply (since := \"2025-11-23\")]\ntheorem algebraMap_ofSubring_apply {R : Type*} [CommRing R] (S : Subring R) (x : S) :\n algebraMap S R x = x :=\n rfl\n\nend SubsemiringAlgebra\n\n/-- Explicit characterization of the submonoid map in the case of an algebra.\n`S` is made explicit to help with type inference -/\ndef algebraMapSubmonoid (S : Type*) [Semiring S] [Algebra R S] (M : Submonoid R) : Submonoid S :=\n M.map (algebraMap R S)\n\nvariable {S : Type*} [Semiring S] [Algebra R S]\n\ntheorem mem_algebraMapSubmonoid_of_mem {M : Submonoid R}\n (x : M) : algebraMap R S x ∈ algebraMapSubmonoid S M :=\n Set.mem_image_of_mem (algebraMap R S) x.2\n\n@[simp]\nlemma algebraMapSubmonoid_self (M : Submonoid R) : Algebra.algebraMapSubmonoid R M = M :=\n Submonoid.map_id M\n\n@[simp]\nlemma algebraMapSubmonoid_powers (r : R) :\n Algebra.algebraMapSubmonoid S (.powers r) = Submonoid.powers (algebraMap R S r) := by\n simp [Algebra.algebraMapSubmonoid]\n\nlemma algebraMapSubmonoid_isUnit_le :\n algebraMapSubmonoid S (IsUnit.submonoid R) ≤ IsUnit.submonoid S := by\n rintro x ⟨y, hy, rfl⟩\n exact hy.map _\n\nend Semiring\n\nsection CommSemiring\n\nvariable [CommSemiring R]\n\ntheorem mul_sub_algebraMap_commutes [Ring A] [Algebra R A] (x : A) (r : R) :\n x * (x - algebraMap R A r) = (x - algebraMap R A r) * x := by rw [mul_sub, ← commutes, sub_mul]\n\ntheorem mul_sub_algebraMap_pow_commutes [Ring A] [Algebra R A] (x : A) (r : R) (n : ℕ) :\n x * (x - algebraMap R A r) ^ n = (x - algebraMap R A r) ^ n * x := by\n induction n with\n | zero => simp\n | succ n ih =>\n rw [pow_succ', ← mul_assoc, mul_sub_algebraMap_commutes, mul_assoc, ih, ← mul_assoc]\n\nend CommSemiring\n\nsection Ring\n\n/-- A `Semiring` that is an `Algebra` over a commutative ring carries a natural `Ring` structure.\nSee note [reducible non-instances]. -/\nabbrev semiringToRing (R : Type*) [CommRing R] [Semiring A] [Algebra R A] : Ring A :=\n { __ := (inferInstance : Semiring A)\n __ := Module.addCommMonoidToAddCommGroup R\n intCast := fun z => algebraMap R A z\n intCast_ofNat := fun z => by simp only [Int.cast_natCast, map_natCast]\n intCast_negSucc := fun z => by simp }\n\n/-- The `CommRing` structure on a `CommSemiring` induced by a ring morphism from a `CommRing`. -/\nabbrev _root_.RingHom.commSemiringToCommRing {R A : Type*} [CommRing R] [CommSemiring A]\n (φ : R →+* A) : CommRing A :=\n let _ : Algebra R A := RingHom.toAlgebra φ\n { __ := Algebra.semiringToRing R\n mul_comm := CommMonoid.mul_comm }\n\ninstance {R : Type*} [Ring R] : Algebra (Subring.center R) R where\n algebraMap :=\n { toFun := Subtype.val\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' r x := (Subring.mem_center_iff.1 r.2 x).symm\n smul_def' _ _ := rfl\n\nend Ring\n\nend Algebra\n\nopen scoped Algebra\n\nnamespace Module\n\nvariable (R : Type u) (S : Type v) (M : Type w)\nvariable [CommSemiring R] [Semiring S] [AddCommMonoid M] [Module R M] [Module S M]\nvariable [SMulCommClass S R M] [SMul R S] [IsScalarTower R S M]\n\ninstance End.instAlgebra : Algebra R (Module.End S M) :=\n Algebra.ofModule smul_mul_assoc fun r f g => (smul_comm r f g).symm\n\n-- to prove this is a special case of the above\nexample : Algebra R (Module.End R M) := End.instAlgebra _ _ _\n\ntheorem algebraMap_end_eq_smul_id (a : R) : algebraMap R (End S M) a = a • LinearMap.id :=\n rfl\n\n@[simp]\ntheorem algebraMap_end_apply (a : R) (m : M) : algebraMap R (End S M) a m = a • m :=\n rfl\n\n@[simp]\ntheorem ker_algebraMap_end (K : Type u) (V : Type v) [Semifield K] [AddCommMonoid V] [Module K V]\n (a : K) (ha : a ≠ 0) : LinearMap.ker ((algebraMap K (End K V)) a) = ⊥ :=\n LinearMap.ker_smul _ _ ha\n\nsection\n\nvariable {R M}\n\ntheorem End.algebraMap_isUnit_inv_apply_eq_iff {x : R}\n (h : IsUnit (algebraMap R (Module.End S M) x)) (m m' : M) :\n (↑(h.unit⁻¹) : Module.End S M) m = m' ↔ m = x • m' where\n mp H := H ▸ (isUnit_apply_inv_apply_of_isUnit h m).symm\n mpr H := by\n apply_fun ⇑h.unit.val using ((isUnit_iff _).mp h).injective\n rw [H]\n simpa using Module.End.isUnit_apply_inv_apply_of_isUnit h (x • m')\n\ntheorem End.algebraMap_isUnit_inv_apply_eq_iff' {x : R}\n (h : IsUnit (algebraMap R (Module.End S M) x)) (m m' : M) :\n m' = (↑h.unit⁻¹ : Module.End S M) m ↔ m = x • m' where\n mp H := H ▸ (isUnit_apply_inv_apply_of_isUnit h m).symm\n mpr H := by\n apply_fun (↑h.unit : M → M) using ((isUnit_iff _).mp h).injective\n rw [H]\n simpa using isUnit_apply_inv_apply_of_isUnit h (x • m') |>.symm\n\nend\n\nend Module\n\nnamespace LinearMap\n\nvariable {R : Type*} {A : Type*} {B : Type*} [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B]\n\n/-- An alternate statement of `LinearMap.map_smul` for when `algebraMap` is more convenient to\nwork with than `•`. -/\ntheorem map_algebraMap_mul (f : A →ₗ[R] B) (a : A) (r : R) :\n f (algebraMap R A r * a) = algebraMap R B r * f a := by\n rw [← Algebra.smul_def, ← Algebra.smul_def, map_smul]\n\nTarget:\ntheorem map_mul_algebraMap (f : A →ₗ[R] B) (a : A) (r : R) :\n f (a * algebraMap R A r) = f a * algebraMap R B r :=\n\nProof body:\n","proof_body":"by\n rw [← Algebra.commutes, ← Algebra.commutes, map_algebraMap_mul]","provenance":{"declaration_index":22,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"d81d29e01f64ac82099070062ec2011a0ac2599a5411d5c30b031029566d2429","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Basic.lean"},"sample_id":"35b39e401c75e2f2ddfebfb62e50ced71e0b1a5ae8df53b19c4bfa297d1fccf4","schema_version":1,"split":"train","theorem_statement":"theorem map_mul_algebraMap (f : A →ₗ[R] B) (a : A) (r : R) :\n f (a * algebraMap R A r) = f a * algebraMap R B r :="} {"completion":"by\n ext; simp","context_contains_namespace":false,"context_suffix":"end Nat","dependency_ids":["import:Mathlib.Algebra.Algebra.Defs","import:Mathlib.Algebra.Module.Equiv.Basic","import:Mathlib.Algebra.Module.Submodule.Ker","import:Mathlib.Algebra.Module.Submodule.RestrictScalars","import:Mathlib.Algebra.Module.ULift","import:Mathlib.Algebra.Ring.CharZero","import:Mathlib.Algebra.Ring.Subring.Basic","import:Mathlib.Data.Nat.Cast.Order.Basic","import:Mathlib.Data.Int.CharZero","import:Mathlib.Algebra.Ring.Hom.InjSurj"],"family_id":"algebramap_comp_natcast","file_id":"mathlib/Mathlib/Algebra/Algebra/Basic.lean","imports":["public import Mathlib.Algebra.Algebra.Defs","public import Mathlib.Algebra.Module.Equiv.Basic","public import Mathlib.Algebra.Module.Submodule.Ker","public import Mathlib.Algebra.Module.Submodule.RestrictScalars","public import Mathlib.Algebra.Module.ULift","public import Mathlib.Algebra.Ring.CharZero","public import Mathlib.Algebra.Ring.Subring.Basic","public import Mathlib.Data.Nat.Cast.Order.Basic","public import Mathlib.Data.Int.CharZero","import Mathlib.Algebra.Ring.Hom.InjSurj"],"local_context":"/-\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-/\n/-!\n# Further basic results about `Algebra`.\n\nThis file could usefully be split further.\n-/\n\n@[expose] public section\n\nuniverse u v w u₁ v₁\n\nopen Function Module\n\nnamespace Algebra\n\nvariable {R A M : Type*}\n\nsection Semiring\n\nvariable [CommSemiring R]\nvariable [Semiring A] [Algebra R A]\n\nsection PUnit\n\ninstance _root_.PUnit.algebra : Algebra R PUnit.{v + 1} where\n algebraMap :=\n { toFun _ := PUnit.unit\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' _ _ := rfl\n smul_def' _ _ := rfl\n\n@[simp]\ntheorem algebraMap_pUnit (r : R) : algebraMap R PUnit r = PUnit.unit :=\n rfl\n\nend PUnit\n\nsection ULift\n\ninstance _root_.ULift.algebra : Algebra R (ULift A) :=\n { ULift.module' with\n algebraMap :=\n { (ULift.ringEquiv : ULift A ≃+* A).symm.toRingHom.comp (algebraMap R A) with\n toFun := fun r => ULift.up (algebraMap R A r) }\n commutes' := fun r x => ULift.down_injective <| Algebra.commutes r x.down\n smul_def' := fun r x => ULift.down_injective <| Algebra.smul_def' r x.down }\n\ntheorem _root_.ULift.algebraMap_eq (r : R) :\n algebraMap R (ULift A) r = ULift.up (algebraMap R A r) :=\n rfl\n\n@[simp]\ntheorem _root_.ULift.down_algebraMap (r : R) : (algebraMap R (ULift A) r).down = algebraMap R A r :=\n rfl\n\nvariable (R A) in\n/-- If `A` is an `R`-algebra, it is also a `ULift R`-algebra. In particular, `Ulift A` is a\n`ULift R` algebra. This is not an instance, because it causes a non-reducible diamond in the case\nwhere `A = Ulift R`. -/\n@[instance_reducible]\ndef _root_.ULift.algebra' : Algebra (ULift.{u} R) A where\n __ := ULift.module\n algebraMap := (algebraMap R A).comp ULift.ringEquiv.toRingHom\n commutes' _ _ := Algebra.commutes ..\n smul_def' _ _ := Algebra.smul_def' ..\n\nattribute [local instance] ULift.algebra' in\n/-- This references the `ULift.algebra'` instance. -/\n@[simp]\nlemma _root_.ULift.algebraMap_apply' (r : ULift R) :\n algebraMap (ULift R) A r = algebraMap R A r.down := rfl\n\nend ULift\n\nsection SubsemiringAlgebra\n\nvariable {C : Type*} [SetLike C R] [SubsemiringClass C R]\n\n/-- Algebra over a subsemiring. This builds upon `Subsemiring.module`. -/\ninstance (priority := 900) ofSubsemiring (S : C) : Algebra S A where\n algebraMap := (algebraMap R A).comp (Subsemiring.subtype <| .ofClass S)\n commutes' r x := Algebra.commutes (r : R) x\n smul_def' r x := Algebra.smul_def (r : R) x\n\ntheorem algebraMap_ofSubsemiring (S : Subsemiring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\ntheorem coe_algebraMap_ofSubsemiring (S : C) : (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\ntheorem algebraMap_ofSubsemiring_apply (S : C) (x : S) : algebraMap S R x = x :=\n rfl\n\n/-- Algebra over a subring. This builds upon `Subring.module`. -/\ninstance ofSubring {R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : Subring R) :\n Algebra S A := inferInstance\n\ntheorem algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\n@[deprecated coe_algebraMap_ofSubsemiring (since := \"2025-11-23\")]\ntheorem coe_algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\n@[deprecated algebraMap_ofSubsemiring_apply (since := \"2025-11-23\")]\ntheorem algebraMap_ofSubring_apply {R : Type*} [CommRing R] (S : Subring R) (x : S) :\n algebraMap S R x = x :=\n rfl\n\nend SubsemiringAlgebra\n\n/-- Explicit characterization of the submonoid map in the case of an algebra.\n`S` is made explicit to help with type inference -/\ndef algebraMapSubmonoid (S : Type*) [Semiring S] [Algebra R S] (M : Submonoid R) : Submonoid S :=\n M.map (algebraMap R S)\n\nvariable {S : Type*} [Semiring S] [Algebra R S]\n\ntheorem mem_algebraMapSubmonoid_of_mem {M : Submonoid R}\n (x : M) : algebraMap R S x ∈ algebraMapSubmonoid S M :=\n Set.mem_image_of_mem (algebraMap R S) x.2\n\n@[simp]\nlemma algebraMapSubmonoid_self (M : Submonoid R) : Algebra.algebraMapSubmonoid R M = M :=\n Submonoid.map_id M\n\n@[simp]\nlemma algebraMapSubmonoid_powers (r : R) :\n Algebra.algebraMapSubmonoid S (.powers r) = Submonoid.powers (algebraMap R S r) := by\n simp [Algebra.algebraMapSubmonoid]\n\nlemma algebraMapSubmonoid_isUnit_le :\n algebraMapSubmonoid S (IsUnit.submonoid R) ≤ IsUnit.submonoid S := by\n rintro x ⟨y, hy, rfl⟩\n exact hy.map _\n\nend Semiring\n\nsection CommSemiring\n\nvariable [CommSemiring R]\n\ntheorem mul_sub_algebraMap_commutes [Ring A] [Algebra R A] (x : A) (r : R) :\n x * (x - algebraMap R A r) = (x - algebraMap R A r) * x := by rw [mul_sub, ← commutes, sub_mul]\n\ntheorem mul_sub_algebraMap_pow_commutes [Ring A] [Algebra R A] (x : A) (r : R) (n : ℕ) :\n x * (x - algebraMap R A r) ^ n = (x - algebraMap R A r) ^ n * x := by\n induction n with\n | zero => simp\n | succ n ih =>\n rw [pow_succ', ← mul_assoc, mul_sub_algebraMap_commutes, mul_assoc, ih, ← mul_assoc]\n\nend CommSemiring\n\nsection Ring\n\n/-- A `Semiring` that is an `Algebra` over a commutative ring carries a natural `Ring` structure.\nSee note [reducible non-instances]. -/\nabbrev semiringToRing (R : Type*) [CommRing R] [Semiring A] [Algebra R A] : Ring A :=\n { __ := (inferInstance : Semiring A)\n __ := Module.addCommMonoidToAddCommGroup R\n intCast := fun z => algebraMap R A z\n intCast_ofNat := fun z => by simp only [Int.cast_natCast, map_natCast]\n intCast_negSucc := fun z => by simp }\n\n/-- The `CommRing` structure on a `CommSemiring` induced by a ring morphism from a `CommRing`. -/\nabbrev _root_.RingHom.commSemiringToCommRing {R A : Type*} [CommRing R] [CommSemiring A]\n (φ : R →+* A) : CommRing A :=\n let _ : Algebra R A := RingHom.toAlgebra φ\n { __ := Algebra.semiringToRing R\n mul_comm := CommMonoid.mul_comm }\n\ninstance {R : Type*} [Ring R] : Algebra (Subring.center R) R where\n algebraMap :=\n { toFun := Subtype.val\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' r x := (Subring.mem_center_iff.1 r.2 x).symm\n smul_def' _ _ := rfl\n\nend Ring\n\nend Algebra\n\nopen scoped Algebra\n\nnamespace Module\n\nvariable (R : Type u) (S : Type v) (M : Type w)\nvariable [CommSemiring R] [Semiring S] [AddCommMonoid M] [Module R M] [Module S M]\nvariable [SMulCommClass S R M] [SMul R S] [IsScalarTower R S M]\n\ninstance End.instAlgebra : Algebra R (Module.End S M) :=\n Algebra.ofModule smul_mul_assoc fun r f g => (smul_comm r f g).symm\n\n-- to prove this is a special case of the above\nexample : Algebra R (Module.End R M) := End.instAlgebra _ _ _\n\ntheorem algebraMap_end_eq_smul_id (a : R) : algebraMap R (End S M) a = a • LinearMap.id :=\n rfl\n\n@[simp]\ntheorem algebraMap_end_apply (a : R) (m : M) : algebraMap R (End S M) a m = a • m :=\n rfl\n\n@[simp]\ntheorem ker_algebraMap_end (K : Type u) (V : Type v) [Semifield K] [AddCommMonoid V] [Module K V]\n (a : K) (ha : a ≠ 0) : LinearMap.ker ((algebraMap K (End K V)) a) = ⊥ :=\n LinearMap.ker_smul _ _ ha\n\nsection\n\nvariable {R M}\n\ntheorem End.algebraMap_isUnit_inv_apply_eq_iff {x : R}\n (h : IsUnit (algebraMap R (Module.End S M) x)) (m m' : M) :\n (↑(h.unit⁻¹) : Module.End S M) m = m' ↔ m = x • m' where\n mp H := H ▸ (isUnit_apply_inv_apply_of_isUnit h m).symm\n mpr H := by\n apply_fun ⇑h.unit.val using ((isUnit_iff _).mp h).injective\n rw [H]\n simpa using Module.End.isUnit_apply_inv_apply_of_isUnit h (x • m')\n\ntheorem End.algebraMap_isUnit_inv_apply_eq_iff' {x : R}\n (h : IsUnit (algebraMap R (Module.End S M) x)) (m m' : M) :\n m' = (↑h.unit⁻¹ : Module.End S M) m ↔ m = x • m' where\n mp H := H ▸ (isUnit_apply_inv_apply_of_isUnit h m).symm\n mpr H := by\n apply_fun (↑h.unit : M → M) using ((isUnit_iff _).mp h).injective\n rw [H]\n simpa using isUnit_apply_inv_apply_of_isUnit h (x • m') |>.symm\n\nend\n\nend Module\n\nnamespace LinearMap\n\nvariable {R : Type*} {A : Type*} {B : Type*} [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B]\n\n/-- An alternate statement of `LinearMap.map_smul` for when `algebraMap` is more convenient to\nwork with than `•`. -/\ntheorem map_algebraMap_mul (f : A →ₗ[R] B) (a : A) (r : R) :\n f (algebraMap R A r * a) = algebraMap R B r * f a := by\n rw [← Algebra.smul_def, ← Algebra.smul_def, map_smul]\n\ntheorem map_mul_algebraMap (f : A →ₗ[R] B) (a : A) (r : R) :\n f (a * algebraMap R A r) = f a * algebraMap R B r := by\n rw [← Algebra.commutes, ← Algebra.commutes, map_algebraMap_mul]\n\nend LinearMap\n\nsection Nat\n\nvariable {R : Type*} [Semiring R]\n\n-- Lower the priority so that `Algebra.id` is picked most of the time when working with\n-- `ℕ`-algebras.\n-- TODO: is this still needed?\n/-- Semiring ⥤ ℕ-Alg -/\ninstance (priority := 99) Semiring.toNatAlgebra : Algebra ℕ R where\n commutes' := Nat.cast_commute\n smul_def' _ _ := nsmul_eq_mul _ _\n algebraMap := Nat.castRingHom R\n\ninstance nat_algebra_subsingleton : Subsingleton (Algebra ℕ R) :=\n ⟨fun P Q => by ext; simp⟩\n\n@[simp]","module_header":true,"namespace":"","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Defs\npublic import Mathlib.Algebra.Module.Equiv.Basic\npublic import Mathlib.Algebra.Module.Submodule.Ker\npublic import Mathlib.Algebra.Module.Submodule.RestrictScalars\npublic import Mathlib.Algebra.Module.ULift\npublic import Mathlib.Algebra.Ring.CharZero\npublic import Mathlib.Algebra.Ring.Subring.Basic\npublic import Mathlib.Data.Nat.Cast.Order.Basic\npublic import Mathlib.Data.Int.CharZero\nimport Mathlib.Algebra.Ring.Hom.InjSurj\n\nNamespace:\n(root)\n\nLocal context:\n/-\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-/\n/-!\n# Further basic results about `Algebra`.\n\nThis file could usefully be split further.\n-/\n\n@[expose] public section\n\nuniverse u v w u₁ v₁\n\nopen Function Module\n\nnamespace Algebra\n\nvariable {R A M : Type*}\n\nsection Semiring\n\nvariable [CommSemiring R]\nvariable [Semiring A] [Algebra R A]\n\nsection PUnit\n\ninstance _root_.PUnit.algebra : Algebra R PUnit.{v + 1} where\n algebraMap :=\n { toFun _ := PUnit.unit\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' _ _ := rfl\n smul_def' _ _ := rfl\n\n@[simp]\ntheorem algebraMap_pUnit (r : R) : algebraMap R PUnit r = PUnit.unit :=\n rfl\n\nend PUnit\n\nsection ULift\n\ninstance _root_.ULift.algebra : Algebra R (ULift A) :=\n { ULift.module' with\n algebraMap :=\n { (ULift.ringEquiv : ULift A ≃+* A).symm.toRingHom.comp (algebraMap R A) with\n toFun := fun r => ULift.up (algebraMap R A r) }\n commutes' := fun r x => ULift.down_injective <| Algebra.commutes r x.down\n smul_def' := fun r x => ULift.down_injective <| Algebra.smul_def' r x.down }\n\ntheorem _root_.ULift.algebraMap_eq (r : R) :\n algebraMap R (ULift A) r = ULift.up (algebraMap R A r) :=\n rfl\n\n@[simp]\ntheorem _root_.ULift.down_algebraMap (r : R) : (algebraMap R (ULift A) r).down = algebraMap R A r :=\n rfl\n\nvariable (R A) in\n/-- If `A` is an `R`-algebra, it is also a `ULift R`-algebra. In particular, `Ulift A` is a\n`ULift R` algebra. This is not an instance, because it causes a non-reducible diamond in the case\nwhere `A = Ulift R`. -/\n@[instance_reducible]\ndef _root_.ULift.algebra' : Algebra (ULift.{u} R) A where\n __ := ULift.module\n algebraMap := (algebraMap R A).comp ULift.ringEquiv.toRingHom\n commutes' _ _ := Algebra.commutes ..\n smul_def' _ _ := Algebra.smul_def' ..\n\nattribute [local instance] ULift.algebra' in\n/-- This references the `ULift.algebra'` instance. -/\n@[simp]\nlemma _root_.ULift.algebraMap_apply' (r : ULift R) :\n algebraMap (ULift R) A r = algebraMap R A r.down := rfl\n\nend ULift\n\nsection SubsemiringAlgebra\n\nvariable {C : Type*} [SetLike C R] [SubsemiringClass C R]\n\n/-- Algebra over a subsemiring. This builds upon `Subsemiring.module`. -/\ninstance (priority := 900) ofSubsemiring (S : C) : Algebra S A where\n algebraMap := (algebraMap R A).comp (Subsemiring.subtype <| .ofClass S)\n commutes' r x := Algebra.commutes (r : R) x\n smul_def' r x := Algebra.smul_def (r : R) x\n\ntheorem algebraMap_ofSubsemiring (S : Subsemiring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\ntheorem coe_algebraMap_ofSubsemiring (S : C) : (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\ntheorem algebraMap_ofSubsemiring_apply (S : C) (x : S) : algebraMap S R x = x :=\n rfl\n\n/-- Algebra over a subring. This builds upon `Subring.module`. -/\ninstance ofSubring {R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : Subring R) :\n Algebra S A := inferInstance\n\ntheorem algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\n@[deprecated coe_algebraMap_ofSubsemiring (since := \"2025-11-23\")]\ntheorem coe_algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\n@[deprecated algebraMap_ofSubsemiring_apply (since := \"2025-11-23\")]\ntheorem algebraMap_ofSubring_apply {R : Type*} [CommRing R] (S : Subring R) (x : S) :\n algebraMap S R x = x :=\n rfl\n\nend SubsemiringAlgebra\n\n/-- Explicit characterization of the submonoid map in the case of an algebra.\n`S` is made explicit to help with type inference -/\ndef algebraMapSubmonoid (S : Type*) [Semiring S] [Algebra R S] (M : Submonoid R) : Submonoid S :=\n M.map (algebraMap R S)\n\nvariable {S : Type*} [Semiring S] [Algebra R S]\n\ntheorem mem_algebraMapSubmonoid_of_mem {M : Submonoid R}\n (x : M) : algebraMap R S x ∈ algebraMapSubmonoid S M :=\n Set.mem_image_of_mem (algebraMap R S) x.2\n\n@[simp]\nlemma algebraMapSubmonoid_self (M : Submonoid R) : Algebra.algebraMapSubmonoid R M = M :=\n Submonoid.map_id M\n\n@[simp]\nlemma algebraMapSubmonoid_powers (r : R) :\n Algebra.algebraMapSubmonoid S (.powers r) = Submonoid.powers (algebraMap R S r) := by\n simp [Algebra.algebraMapSubmonoid]\n\nlemma algebraMapSubmonoid_isUnit_le :\n algebraMapSubmonoid S (IsUnit.submonoid R) ≤ IsUnit.submonoid S := by\n rintro x ⟨y, hy, rfl⟩\n exact hy.map _\n\nend Semiring\n\nsection CommSemiring\n\nvariable [CommSemiring R]\n\ntheorem mul_sub_algebraMap_commutes [Ring A] [Algebra R A] (x : A) (r : R) :\n x * (x - algebraMap R A r) = (x - algebraMap R A r) * x := by rw [mul_sub, ← commutes, sub_mul]\n\ntheorem mul_sub_algebraMap_pow_commutes [Ring A] [Algebra R A] (x : A) (r : R) (n : ℕ) :\n x * (x - algebraMap R A r) ^ n = (x - algebraMap R A r) ^ n * x := by\n induction n with\n | zero => simp\n | succ n ih =>\n rw [pow_succ', ← mul_assoc, mul_sub_algebraMap_commutes, mul_assoc, ih, ← mul_assoc]\n\nend CommSemiring\n\nsection Ring\n\n/-- A `Semiring` that is an `Algebra` over a commutative ring carries a natural `Ring` structure.\nSee note [reducible non-instances]. -/\nabbrev semiringToRing (R : Type*) [CommRing R] [Semiring A] [Algebra R A] : Ring A :=\n { __ := (inferInstance : Semiring A)\n __ := Module.addCommMonoidToAddCommGroup R\n intCast := fun z => algebraMap R A z\n intCast_ofNat := fun z => by simp only [Int.cast_natCast, map_natCast]\n intCast_negSucc := fun z => by simp }\n\n/-- The `CommRing` structure on a `CommSemiring` induced by a ring morphism from a `CommRing`. -/\nabbrev _root_.RingHom.commSemiringToCommRing {R A : Type*} [CommRing R] [CommSemiring A]\n (φ : R →+* A) : CommRing A :=\n let _ : Algebra R A := RingHom.toAlgebra φ\n { __ := Algebra.semiringToRing R\n mul_comm := CommMonoid.mul_comm }\n\ninstance {R : Type*} [Ring R] : Algebra (Subring.center R) R where\n algebraMap :=\n { toFun := Subtype.val\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' r x := (Subring.mem_center_iff.1 r.2 x).symm\n smul_def' _ _ := rfl\n\nend Ring\n\nend Algebra\n\nopen scoped Algebra\n\nnamespace Module\n\nvariable (R : Type u) (S : Type v) (M : Type w)\nvariable [CommSemiring R] [Semiring S] [AddCommMonoid M] [Module R M] [Module S M]\nvariable [SMulCommClass S R M] [SMul R S] [IsScalarTower R S M]\n\ninstance End.instAlgebra : Algebra R (Module.End S M) :=\n Algebra.ofModule smul_mul_assoc fun r f g => (smul_comm r f g).symm\n\n-- to prove this is a special case of the above\nexample : Algebra R (Module.End R M) := End.instAlgebra _ _ _\n\ntheorem algebraMap_end_eq_smul_id (a : R) : algebraMap R (End S M) a = a • LinearMap.id :=\n rfl\n\n@[simp]\ntheorem algebraMap_end_apply (a : R) (m : M) : algebraMap R (End S M) a m = a • m :=\n rfl\n\n@[simp]\ntheorem ker_algebraMap_end (K : Type u) (V : Type v) [Semifield K] [AddCommMonoid V] [Module K V]\n (a : K) (ha : a ≠ 0) : LinearMap.ker ((algebraMap K (End K V)) a) = ⊥ :=\n LinearMap.ker_smul _ _ ha\n\nsection\n\nvariable {R M}\n\ntheorem End.algebraMap_isUnit_inv_apply_eq_iff {x : R}\n (h : IsUnit (algebraMap R (Module.End S M) x)) (m m' : M) :\n (↑(h.unit⁻¹) : Module.End S M) m = m' ↔ m = x • m' where\n mp H := H ▸ (isUnit_apply_inv_apply_of_isUnit h m).symm\n mpr H := by\n apply_fun ⇑h.unit.val using ((isUnit_iff _).mp h).injective\n rw [H]\n simpa using Module.End.isUnit_apply_inv_apply_of_isUnit h (x • m')\n\ntheorem End.algebraMap_isUnit_inv_apply_eq_iff' {x : R}\n (h : IsUnit (algebraMap R (Module.End S M) x)) (m m' : M) :\n m' = (↑h.unit⁻¹ : Module.End S M) m ↔ m = x • m' where\n mp H := H ▸ (isUnit_apply_inv_apply_of_isUnit h m).symm\n mpr H := by\n apply_fun (↑h.unit : M → M) using ((isUnit_iff _).mp h).injective\n rw [H]\n simpa using isUnit_apply_inv_apply_of_isUnit h (x • m') |>.symm\n\nend\n\nend Module\n\nnamespace LinearMap\n\nvariable {R : Type*} {A : Type*} {B : Type*} [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B]\n\n/-- An alternate statement of `LinearMap.map_smul` for when `algebraMap` is more convenient to\nwork with than `•`. -/\ntheorem map_algebraMap_mul (f : A →ₗ[R] B) (a : A) (r : R) :\n f (algebraMap R A r * a) = algebraMap R B r * f a := by\n rw [← Algebra.smul_def, ← Algebra.smul_def, map_smul]\n\ntheorem map_mul_algebraMap (f : A →ₗ[R] B) (a : A) (r : R) :\n f (a * algebraMap R A r) = f a * algebraMap R B r := by\n rw [← Algebra.commutes, ← Algebra.commutes, map_algebraMap_mul]\n\nend LinearMap\n\nsection Nat\n\nvariable {R : Type*} [Semiring R]\n\n-- Lower the priority so that `Algebra.id` is picked most of the time when working with\n-- `ℕ`-algebras.\n-- TODO: is this still needed?\n/-- Semiring ⥤ ℕ-Alg -/\ninstance (priority := 99) Semiring.toNatAlgebra : Algebra ℕ R where\n commutes' := Nat.cast_commute\n smul_def' _ _ := nsmul_eq_mul _ _\n algebraMap := Nat.castRingHom R\n\ninstance nat_algebra_subsingleton : Subsingleton (Algebra ℕ R) :=\n ⟨fun P Q => by ext; simp⟩\n\n@[simp]\n\nTarget:\nlemma algebraMap_comp_natCast (R A : Type*) [CommSemiring R] [Semiring A] [Algebra R A] :\n algebraMap R A ∘ Nat.cast = Nat.cast :=\n\nProof body:\n","proof_body":"by\n ext; simp","provenance":{"declaration_index":23,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"d81d29e01f64ac82099070062ec2011a0ac2599a5411d5c30b031029566d2429","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Basic.lean"},"sample_id":"102b06cc8a6209b70e8cfcfa63eae0ea67bac63c77d289567e2d4b43f40a60c8","schema_version":1,"split":"train","theorem_statement":"lemma algebraMap_comp_natCast (R A : Type*) [CommSemiring R] [Semiring A] [Algebra R A] :\n algebraMap R A ∘ Nat.cast = Nat.cast :="} {"completion":"by\n ext; simp","context_contains_namespace":false,"context_suffix":"end Int","dependency_ids":["import:Mathlib.Algebra.Algebra.Defs","import:Mathlib.Algebra.Module.Equiv.Basic","import:Mathlib.Algebra.Module.Submodule.Ker","import:Mathlib.Algebra.Module.Submodule.RestrictScalars","import:Mathlib.Algebra.Module.ULift","import:Mathlib.Algebra.Ring.CharZero","import:Mathlib.Algebra.Ring.Subring.Basic","import:Mathlib.Data.Nat.Cast.Order.Basic","import:Mathlib.Data.Int.CharZero","import:Mathlib.Algebra.Ring.Hom.InjSurj"],"family_id":"algebramap_comp_intcast","file_id":"mathlib/Mathlib/Algebra/Algebra/Basic.lean","imports":["public import Mathlib.Algebra.Algebra.Defs","public import Mathlib.Algebra.Module.Equiv.Basic","public import Mathlib.Algebra.Module.Submodule.Ker","public import Mathlib.Algebra.Module.Submodule.RestrictScalars","public import Mathlib.Algebra.Module.ULift","public import Mathlib.Algebra.Ring.CharZero","public import Mathlib.Algebra.Ring.Subring.Basic","public import Mathlib.Data.Nat.Cast.Order.Basic","public import Mathlib.Data.Int.CharZero","import Mathlib.Algebra.Ring.Hom.InjSurj"],"local_context":"/-\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-/\n/-!\n# Further basic results about `Algebra`.\n\nThis file could usefully be split further.\n-/\n\n@[expose] public section\n\nuniverse u v w u₁ v₁\n\nopen Function Module\n\nnamespace Algebra\n\nvariable {R A M : Type*}\n\nsection Semiring\n\nvariable [CommSemiring R]\nvariable [Semiring A] [Algebra R A]\n\nsection PUnit\n\ninstance _root_.PUnit.algebra : Algebra R PUnit.{v + 1} where\n algebraMap :=\n { toFun _ := PUnit.unit\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' _ _ := rfl\n smul_def' _ _ := rfl\n\n@[simp]\ntheorem algebraMap_pUnit (r : R) : algebraMap R PUnit r = PUnit.unit :=\n rfl\n\nend PUnit\n\nsection ULift\n\ninstance _root_.ULift.algebra : Algebra R (ULift A) :=\n { ULift.module' with\n algebraMap :=\n { (ULift.ringEquiv : ULift A ≃+* A).symm.toRingHom.comp (algebraMap R A) with\n toFun := fun r => ULift.up (algebraMap R A r) }\n commutes' := fun r x => ULift.down_injective <| Algebra.commutes r x.down\n smul_def' := fun r x => ULift.down_injective <| Algebra.smul_def' r x.down }\n\ntheorem _root_.ULift.algebraMap_eq (r : R) :\n algebraMap R (ULift A) r = ULift.up (algebraMap R A r) :=\n rfl\n\n@[simp]\ntheorem _root_.ULift.down_algebraMap (r : R) : (algebraMap R (ULift A) r).down = algebraMap R A r :=\n rfl\n\nvariable (R A) in\n/-- If `A` is an `R`-algebra, it is also a `ULift R`-algebra. In particular, `Ulift A` is a\n`ULift R` algebra. This is not an instance, because it causes a non-reducible diamond in the case\nwhere `A = Ulift R`. -/\n@[instance_reducible]\ndef _root_.ULift.algebra' : Algebra (ULift.{u} R) A where\n __ := ULift.module\n algebraMap := (algebraMap R A).comp ULift.ringEquiv.toRingHom\n commutes' _ _ := Algebra.commutes ..\n smul_def' _ _ := Algebra.smul_def' ..\n\nattribute [local instance] ULift.algebra' in\n/-- This references the `ULift.algebra'` instance. -/\n@[simp]\nlemma _root_.ULift.algebraMap_apply' (r : ULift R) :\n algebraMap (ULift R) A r = algebraMap R A r.down := rfl\n\nend ULift\n\nsection SubsemiringAlgebra\n\nvariable {C : Type*} [SetLike C R] [SubsemiringClass C R]\n\n/-- Algebra over a subsemiring. This builds upon `Subsemiring.module`. -/\ninstance (priority := 900) ofSubsemiring (S : C) : Algebra S A where\n algebraMap := (algebraMap R A).comp (Subsemiring.subtype <| .ofClass S)\n commutes' r x := Algebra.commutes (r : R) x\n smul_def' r x := Algebra.smul_def (r : R) x\n\ntheorem algebraMap_ofSubsemiring (S : Subsemiring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\ntheorem coe_algebraMap_ofSubsemiring (S : C) : (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\ntheorem algebraMap_ofSubsemiring_apply (S : C) (x : S) : algebraMap S R x = x :=\n rfl\n\n/-- Algebra over a subring. This builds upon `Subring.module`. -/\ninstance ofSubring {R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : Subring R) :\n Algebra S A := inferInstance\n\ntheorem algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\n@[deprecated coe_algebraMap_ofSubsemiring (since := \"2025-11-23\")]\ntheorem coe_algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\n@[deprecated algebraMap_ofSubsemiring_apply (since := \"2025-11-23\")]\ntheorem algebraMap_ofSubring_apply {R : Type*} [CommRing R] (S : Subring R) (x : S) :\n algebraMap S R x = x :=\n rfl\n\nend SubsemiringAlgebra\n\n/-- Explicit characterization of the submonoid map in the case of an algebra.\n`S` is made explicit to help with type inference -/\ndef algebraMapSubmonoid (S : Type*) [Semiring S] [Algebra R S] (M : Submonoid R) : Submonoid S :=\n M.map (algebraMap R S)\n\nvariable {S : Type*} [Semiring S] [Algebra R S]\n\ntheorem mem_algebraMapSubmonoid_of_mem {M : Submonoid R}\n (x : M) : algebraMap R S x ∈ algebraMapSubmonoid S M :=\n Set.mem_image_of_mem (algebraMap R S) x.2\n\n@[simp]\nlemma algebraMapSubmonoid_self (M : Submonoid R) : Algebra.algebraMapSubmonoid R M = M :=\n Submonoid.map_id M\n\n@[simp]\nlemma algebraMapSubmonoid_powers (r : R) :\n Algebra.algebraMapSubmonoid S (.powers r) = Submonoid.powers (algebraMap R S r) := by\n simp [Algebra.algebraMapSubmonoid]\n\nlemma algebraMapSubmonoid_isUnit_le :\n algebraMapSubmonoid S (IsUnit.submonoid R) ≤ IsUnit.submonoid S := by\n rintro x ⟨y, hy, rfl⟩\n exact hy.map _\n\nend Semiring\n\nsection CommSemiring\n\nvariable [CommSemiring R]\n\ntheorem mul_sub_algebraMap_commutes [Ring A] [Algebra R A] (x : A) (r : R) :\n x * (x - algebraMap R A r) = (x - algebraMap R A r) * x := by rw [mul_sub, ← commutes, sub_mul]\n\ntheorem mul_sub_algebraMap_pow_commutes [Ring A] [Algebra R A] (x : A) (r : R) (n : ℕ) :\n x * (x - algebraMap R A r) ^ n = (x - algebraMap R A r) ^ n * x := by\n induction n with\n | zero => simp\n | succ n ih =>\n rw [pow_succ', ← mul_assoc, mul_sub_algebraMap_commutes, mul_assoc, ih, ← mul_assoc]\n\nend CommSemiring\n\nsection Ring\n\n/-- A `Semiring` that is an `Algebra` over a commutative ring carries a natural `Ring` structure.\nSee note [reducible non-instances]. -/\nabbrev semiringToRing (R : Type*) [CommRing R] [Semiring A] [Algebra R A] : Ring A :=\n { __ := (inferInstance : Semiring A)\n __ := Module.addCommMonoidToAddCommGroup R\n intCast := fun z => algebraMap R A z\n intCast_ofNat := fun z => by simp only [Int.cast_natCast, map_natCast]\n intCast_negSucc := fun z => by simp }\n\n/-- The `CommRing` structure on a `CommSemiring` induced by a ring morphism from a `CommRing`. -/\nabbrev _root_.RingHom.commSemiringToCommRing {R A : Type*} [CommRing R] [CommSemiring A]\n (φ : R →+* A) : CommRing A :=\n let _ : Algebra R A := RingHom.toAlgebra φ\n { __ := Algebra.semiringToRing R\n mul_comm := CommMonoid.mul_comm }\n\ninstance {R : Type*} [Ring R] : Algebra (Subring.center R) R where\n algebraMap :=\n { toFun := Subtype.val\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' r x := (Subring.mem_center_iff.1 r.2 x).symm\n smul_def' _ _ := rfl\n\nend Ring\n\nend Algebra\n\nopen scoped Algebra\n\nnamespace Module\n\nvariable (R : Type u) (S : Type v) (M : Type w)\nvariable [CommSemiring R] [Semiring S] [AddCommMonoid M] [Module R M] [Module S M]\nvariable [SMulCommClass S R M] [SMul R S] [IsScalarTower R S M]\n\ninstance End.instAlgebra : Algebra R (Module.End S M) :=\n Algebra.ofModule smul_mul_assoc fun r f g => (smul_comm r f g).symm\n\n-- to prove this is a special case of the above\nexample : Algebra R (Module.End R M) := End.instAlgebra _ _ _\n\ntheorem algebraMap_end_eq_smul_id (a : R) : algebraMap R (End S M) a = a • LinearMap.id :=\n rfl\n\n@[simp]\ntheorem algebraMap_end_apply (a : R) (m : M) : algebraMap R (End S M) a m = a • m :=\n rfl\n\n@[simp]\ntheorem ker_algebraMap_end (K : Type u) (V : Type v) [Semifield K] [AddCommMonoid V] [Module K V]\n (a : K) (ha : a ≠ 0) : LinearMap.ker ((algebraMap K (End K V)) a) = ⊥ :=\n LinearMap.ker_smul _ _ ha\n\nsection\n\nvariable {R M}\n\ntheorem End.algebraMap_isUnit_inv_apply_eq_iff {x : R}\n (h : IsUnit (algebraMap R (Module.End S M) x)) (m m' : M) :\n (↑(h.unit⁻¹) : Module.End S M) m = m' ↔ m = x • m' where\n mp H := H ▸ (isUnit_apply_inv_apply_of_isUnit h m).symm\n mpr H := by\n apply_fun ⇑h.unit.val using ((isUnit_iff _).mp h).injective\n rw [H]\n simpa using Module.End.isUnit_apply_inv_apply_of_isUnit h (x • m')\n\ntheorem End.algebraMap_isUnit_inv_apply_eq_iff' {x : R}\n (h : IsUnit (algebraMap R (Module.End S M) x)) (m m' : M) :\n m' = (↑h.unit⁻¹ : Module.End S M) m ↔ m = x • m' where\n mp H := H ▸ (isUnit_apply_inv_apply_of_isUnit h m).symm\n mpr H := by\n apply_fun (↑h.unit : M → M) using ((isUnit_iff _).mp h).injective\n rw [H]\n simpa using isUnit_apply_inv_apply_of_isUnit h (x • m') |>.symm\n\nend\n\nend Module\n\nnamespace LinearMap\n\nvariable {R : Type*} {A : Type*} {B : Type*} [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B]\n\n/-- An alternate statement of `LinearMap.map_smul` for when `algebraMap` is more convenient to\nwork with than `•`. -/\ntheorem map_algebraMap_mul (f : A →ₗ[R] B) (a : A) (r : R) :\n f (algebraMap R A r * a) = algebraMap R B r * f a := by\n rw [← Algebra.smul_def, ← Algebra.smul_def, map_smul]\n\ntheorem map_mul_algebraMap (f : A →ₗ[R] B) (a : A) (r : R) :\n f (a * algebraMap R A r) = f a * algebraMap R B r := by\n rw [← Algebra.commutes, ← Algebra.commutes, map_algebraMap_mul]\n\nend LinearMap\n\nsection Nat\n\nvariable {R : Type*} [Semiring R]\n\n-- Lower the priority so that `Algebra.id` is picked most of the time when working with\n-- `ℕ`-algebras.\n-- TODO: is this still needed?\n/-- Semiring ⥤ ℕ-Alg -/\ninstance (priority := 99) Semiring.toNatAlgebra : Algebra ℕ R where\n commutes' := Nat.cast_commute\n smul_def' _ _ := nsmul_eq_mul _ _\n algebraMap := Nat.castRingHom R\n\ninstance nat_algebra_subsingleton : Subsingleton (Algebra ℕ R) :=\n ⟨fun P Q => by ext; simp⟩\n\n@[simp]\nlemma algebraMap_comp_natCast (R A : Type*) [CommSemiring R] [Semiring A] [Algebra R A] :\n algebraMap R A ∘ Nat.cast = Nat.cast := by\n ext; simp\n\nend Nat\n\nsection Int\n\nvariable (R : Type*) [Ring R]\n\n-- Lower the priority so that `Algebra.id` is picked most of the time when working with\n-- `ℤ`-algebras.\n-- TODO: is this still needed?\n/-- Ring ⥤ ℤ-Alg -/\ninstance (priority := 99) Ring.toIntAlgebra : Algebra ℤ R where\n commutes' := Int.cast_commute\n smul_def' _ _ := zsmul_eq_mul _ _\n algebraMap := Int.castRingHom R\n\n/-- A special case of `eq_intCast'` that happens to be true definitionally -/\n@[simp]\ntheorem algebraMap_int_eq : algebraMap ℤ R = Int.castRingHom R :=\n rfl\n\nvariable {R}\n\ninstance int_algebra_subsingleton : Subsingleton (Algebra ℤ R) :=\n ⟨fun P Q => Algebra.algebra_ext P Q <| RingHom.congr_fun <| Subsingleton.elim _ _⟩\n\n@[simp]","module_header":true,"namespace":"","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Defs\npublic import Mathlib.Algebra.Module.Equiv.Basic\npublic import Mathlib.Algebra.Module.Submodule.Ker\npublic import Mathlib.Algebra.Module.Submodule.RestrictScalars\npublic import Mathlib.Algebra.Module.ULift\npublic import Mathlib.Algebra.Ring.CharZero\npublic import Mathlib.Algebra.Ring.Subring.Basic\npublic import Mathlib.Data.Nat.Cast.Order.Basic\npublic import Mathlib.Data.Int.CharZero\nimport Mathlib.Algebra.Ring.Hom.InjSurj\n\nNamespace:\n(root)\n\nLocal context:\n/-\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-/\n/-!\n# Further basic results about `Algebra`.\n\nThis file could usefully be split further.\n-/\n\n@[expose] public section\n\nuniverse u v w u₁ v₁\n\nopen Function Module\n\nnamespace Algebra\n\nvariable {R A M : Type*}\n\nsection Semiring\n\nvariable [CommSemiring R]\nvariable [Semiring A] [Algebra R A]\n\nsection PUnit\n\ninstance _root_.PUnit.algebra : Algebra R PUnit.{v + 1} where\n algebraMap :=\n { toFun _ := PUnit.unit\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' _ _ := rfl\n smul_def' _ _ := rfl\n\n@[simp]\ntheorem algebraMap_pUnit (r : R) : algebraMap R PUnit r = PUnit.unit :=\n rfl\n\nend PUnit\n\nsection ULift\n\ninstance _root_.ULift.algebra : Algebra R (ULift A) :=\n { ULift.module' with\n algebraMap :=\n { (ULift.ringEquiv : ULift A ≃+* A).symm.toRingHom.comp (algebraMap R A) with\n toFun := fun r => ULift.up (algebraMap R A r) }\n commutes' := fun r x => ULift.down_injective <| Algebra.commutes r x.down\n smul_def' := fun r x => ULift.down_injective <| Algebra.smul_def' r x.down }\n\ntheorem _root_.ULift.algebraMap_eq (r : R) :\n algebraMap R (ULift A) r = ULift.up (algebraMap R A r) :=\n rfl\n\n@[simp]\ntheorem _root_.ULift.down_algebraMap (r : R) : (algebraMap R (ULift A) r).down = algebraMap R A r :=\n rfl\n\nvariable (R A) in\n/-- If `A` is an `R`-algebra, it is also a `ULift R`-algebra. In particular, `Ulift A` is a\n`ULift R` algebra. This is not an instance, because it causes a non-reducible diamond in the case\nwhere `A = Ulift R`. -/\n@[instance_reducible]\ndef _root_.ULift.algebra' : Algebra (ULift.{u} R) A where\n __ := ULift.module\n algebraMap := (algebraMap R A).comp ULift.ringEquiv.toRingHom\n commutes' _ _ := Algebra.commutes ..\n smul_def' _ _ := Algebra.smul_def' ..\n\nattribute [local instance] ULift.algebra' in\n/-- This references the `ULift.algebra'` instance. -/\n@[simp]\nlemma _root_.ULift.algebraMap_apply' (r : ULift R) :\n algebraMap (ULift R) A r = algebraMap R A r.down := rfl\n\nend ULift\n\nsection SubsemiringAlgebra\n\nvariable {C : Type*} [SetLike C R] [SubsemiringClass C R]\n\n/-- Algebra over a subsemiring. This builds upon `Subsemiring.module`. -/\ninstance (priority := 900) ofSubsemiring (S : C) : Algebra S A where\n algebraMap := (algebraMap R A).comp (Subsemiring.subtype <| .ofClass S)\n commutes' r x := Algebra.commutes (r : R) x\n smul_def' r x := Algebra.smul_def (r : R) x\n\ntheorem algebraMap_ofSubsemiring (S : Subsemiring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\ntheorem coe_algebraMap_ofSubsemiring (S : C) : (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\ntheorem algebraMap_ofSubsemiring_apply (S : C) (x : S) : algebraMap S R x = x :=\n rfl\n\n/-- Algebra over a subring. This builds upon `Subring.module`. -/\ninstance ofSubring {R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : Subring R) :\n Algebra S A := inferInstance\n\ntheorem algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\n@[deprecated coe_algebraMap_ofSubsemiring (since := \"2025-11-23\")]\ntheorem coe_algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\n@[deprecated algebraMap_ofSubsemiring_apply (since := \"2025-11-23\")]\ntheorem algebraMap_ofSubring_apply {R : Type*} [CommRing R] (S : Subring R) (x : S) :\n algebraMap S R x = x :=\n rfl\n\nend SubsemiringAlgebra\n\n/-- Explicit characterization of the submonoid map in the case of an algebra.\n`S` is made explicit to help with type inference -/\ndef algebraMapSubmonoid (S : Type*) [Semiring S] [Algebra R S] (M : Submonoid R) : Submonoid S :=\n M.map (algebraMap R S)\n\nvariable {S : Type*} [Semiring S] [Algebra R S]\n\ntheorem mem_algebraMapSubmonoid_of_mem {M : Submonoid R}\n (x : M) : algebraMap R S x ∈ algebraMapSubmonoid S M :=\n Set.mem_image_of_mem (algebraMap R S) x.2\n\n@[simp]\nlemma algebraMapSubmonoid_self (M : Submonoid R) : Algebra.algebraMapSubmonoid R M = M :=\n Submonoid.map_id M\n\n@[simp]\nlemma algebraMapSubmonoid_powers (r : R) :\n Algebra.algebraMapSubmonoid S (.powers r) = Submonoid.powers (algebraMap R S r) := by\n simp [Algebra.algebraMapSubmonoid]\n\nlemma algebraMapSubmonoid_isUnit_le :\n algebraMapSubmonoid S (IsUnit.submonoid R) ≤ IsUnit.submonoid S := by\n rintro x ⟨y, hy, rfl⟩\n exact hy.map _\n\nend Semiring\n\nsection CommSemiring\n\nvariable [CommSemiring R]\n\ntheorem mul_sub_algebraMap_commutes [Ring A] [Algebra R A] (x : A) (r : R) :\n x * (x - algebraMap R A r) = (x - algebraMap R A r) * x := by rw [mul_sub, ← commutes, sub_mul]\n\ntheorem mul_sub_algebraMap_pow_commutes [Ring A] [Algebra R A] (x : A) (r : R) (n : ℕ) :\n x * (x - algebraMap R A r) ^ n = (x - algebraMap R A r) ^ n * x := by\n induction n with\n | zero => simp\n | succ n ih =>\n rw [pow_succ', ← mul_assoc, mul_sub_algebraMap_commutes, mul_assoc, ih, ← mul_assoc]\n\nend CommSemiring\n\nsection Ring\n\n/-- A `Semiring` that is an `Algebra` over a commutative ring carries a natural `Ring` structure.\nSee note [reducible non-instances]. -/\nabbrev semiringToRing (R : Type*) [CommRing R] [Semiring A] [Algebra R A] : Ring A :=\n { __ := (inferInstance : Semiring A)\n __ := Module.addCommMonoidToAddCommGroup R\n intCast := fun z => algebraMap R A z\n intCast_ofNat := fun z => by simp only [Int.cast_natCast, map_natCast]\n intCast_negSucc := fun z => by simp }\n\n/-- The `CommRing` structure on a `CommSemiring` induced by a ring morphism from a `CommRing`. -/\nabbrev _root_.RingHom.commSemiringToCommRing {R A : Type*} [CommRing R] [CommSemiring A]\n (φ : R →+* A) : CommRing A :=\n let _ : Algebra R A := RingHom.toAlgebra φ\n { __ := Algebra.semiringToRing R\n mul_comm := CommMonoid.mul_comm }\n\ninstance {R : Type*} [Ring R] : Algebra (Subring.center R) R where\n algebraMap :=\n { toFun := Subtype.val\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' r x := (Subring.mem_center_iff.1 r.2 x).symm\n smul_def' _ _ := rfl\n\nend Ring\n\nend Algebra\n\nopen scoped Algebra\n\nnamespace Module\n\nvariable (R : Type u) (S : Type v) (M : Type w)\nvariable [CommSemiring R] [Semiring S] [AddCommMonoid M] [Module R M] [Module S M]\nvariable [SMulCommClass S R M] [SMul R S] [IsScalarTower R S M]\n\ninstance End.instAlgebra : Algebra R (Module.End S M) :=\n Algebra.ofModule smul_mul_assoc fun r f g => (smul_comm r f g).symm\n\n-- to prove this is a special case of the above\nexample : Algebra R (Module.End R M) := End.instAlgebra _ _ _\n\ntheorem algebraMap_end_eq_smul_id (a : R) : algebraMap R (End S M) a = a • LinearMap.id :=\n rfl\n\n@[simp]\ntheorem algebraMap_end_apply (a : R) (m : M) : algebraMap R (End S M) a m = a • m :=\n rfl\n\n@[simp]\ntheorem ker_algebraMap_end (K : Type u) (V : Type v) [Semifield K] [AddCommMonoid V] [Module K V]\n (a : K) (ha : a ≠ 0) : LinearMap.ker ((algebraMap K (End K V)) a) = ⊥ :=\n LinearMap.ker_smul _ _ ha\n\nsection\n\nvariable {R M}\n\ntheorem End.algebraMap_isUnit_inv_apply_eq_iff {x : R}\n (h : IsUnit (algebraMap R (Module.End S M) x)) (m m' : M) :\n (↑(h.unit⁻¹) : Module.End S M) m = m' ↔ m = x • m' where\n mp H := H ▸ (isUnit_apply_inv_apply_of_isUnit h m).symm\n mpr H := by\n apply_fun ⇑h.unit.val using ((isUnit_iff _).mp h).injective\n rw [H]\n simpa using Module.End.isUnit_apply_inv_apply_of_isUnit h (x • m')\n\ntheorem End.algebraMap_isUnit_inv_apply_eq_iff' {x : R}\n (h : IsUnit (algebraMap R (Module.End S M) x)) (m m' : M) :\n m' = (↑h.unit⁻¹ : Module.End S M) m ↔ m = x • m' where\n mp H := H ▸ (isUnit_apply_inv_apply_of_isUnit h m).symm\n mpr H := by\n apply_fun (↑h.unit : M → M) using ((isUnit_iff _).mp h).injective\n rw [H]\n simpa using isUnit_apply_inv_apply_of_isUnit h (x • m') |>.symm\n\nend\n\nend Module\n\nnamespace LinearMap\n\nvariable {R : Type*} {A : Type*} {B : Type*} [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B]\n\n/-- An alternate statement of `LinearMap.map_smul` for when `algebraMap` is more convenient to\nwork with than `•`. -/\ntheorem map_algebraMap_mul (f : A →ₗ[R] B) (a : A) (r : R) :\n f (algebraMap R A r * a) = algebraMap R B r * f a := by\n rw [← Algebra.smul_def, ← Algebra.smul_def, map_smul]\n\ntheorem map_mul_algebraMap (f : A →ₗ[R] B) (a : A) (r : R) :\n f (a * algebraMap R A r) = f a * algebraMap R B r := by\n rw [← Algebra.commutes, ← Algebra.commutes, map_algebraMap_mul]\n\nend LinearMap\n\nsection Nat\n\nvariable {R : Type*} [Semiring R]\n\n-- Lower the priority so that `Algebra.id` is picked most of the time when working with\n-- `ℕ`-algebras.\n-- TODO: is this still needed?\n/-- Semiring ⥤ ℕ-Alg -/\ninstance (priority := 99) Semiring.toNatAlgebra : Algebra ℕ R where\n commutes' := Nat.cast_commute\n smul_def' _ _ := nsmul_eq_mul _ _\n algebraMap := Nat.castRingHom R\n\ninstance nat_algebra_subsingleton : Subsingleton (Algebra ℕ R) :=\n ⟨fun P Q => by ext; simp⟩\n\n@[simp]\nlemma algebraMap_comp_natCast (R A : Type*) [CommSemiring R] [Semiring A] [Algebra R A] :\n algebraMap R A ∘ Nat.cast = Nat.cast := by\n ext; simp\n\nend Nat\n\nsection Int\n\nvariable (R : Type*) [Ring R]\n\n-- Lower the priority so that `Algebra.id` is picked most of the time when working with\n-- `ℤ`-algebras.\n-- TODO: is this still needed?\n/-- Ring ⥤ ℤ-Alg -/\ninstance (priority := 99) Ring.toIntAlgebra : Algebra ℤ R where\n commutes' := Int.cast_commute\n smul_def' _ _ := zsmul_eq_mul _ _\n algebraMap := Int.castRingHom R\n\n/-- A special case of `eq_intCast'` that happens to be true definitionally -/\n@[simp]\ntheorem algebraMap_int_eq : algebraMap ℤ R = Int.castRingHom R :=\n rfl\n\nvariable {R}\n\ninstance int_algebra_subsingleton : Subsingleton (Algebra ℤ R) :=\n ⟨fun P Q => Algebra.algebra_ext P Q <| RingHom.congr_fun <| Subsingleton.elim _ _⟩\n\n@[simp]\n\nTarget:\nlemma algebraMap_comp_intCast (R A : Type*) [CommRing R] [Ring A] [Algebra R A] :\n algebraMap R A ∘ Int.cast = Int.cast :=\n\nProof body:\n","proof_body":"by\n ext; simp","provenance":{"declaration_index":25,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"d81d29e01f64ac82099070062ec2011a0ac2599a5411d5c30b031029566d2429","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Basic.lean"},"sample_id":"65bb67b85083e8258e11e50ebd1852349d8b6cac8c6a4ddc2d615fe879e1b161","schema_version":1,"split":"train","theorem_statement":"lemma algebraMap_comp_intCast (R A : Type*) [CommRing R] [Ring A] [Algebra R A] :\n algebraMap R A ∘ Int.cast = Int.cast :="} {"completion":"by\n rw [faithfulSMul_iff_injective_smul_one, Algebra.algebraMap_eq_smul_one']\n\nvariable [FaithfulSMul R A]","context_contains_namespace":false,"context_suffix":"end FaithfulSMul","dependency_ids":["import:Mathlib.Algebra.Algebra.Defs","import:Mathlib.Algebra.Module.Equiv.Basic","import:Mathlib.Algebra.Module.Submodule.Ker","import:Mathlib.Algebra.Module.Submodule.RestrictScalars","import:Mathlib.Algebra.Module.ULift","import:Mathlib.Algebra.Ring.CharZero","import:Mathlib.Algebra.Ring.Subring.Basic","import:Mathlib.Data.Nat.Cast.Order.Basic","import:Mathlib.Data.Int.CharZero","import:Mathlib.Algebra.Ring.Hom.InjSurj"],"family_id":"faithfulsmul_iff_algebramap_injective","file_id":"mathlib/Mathlib/Algebra/Algebra/Basic.lean","imports":["public import Mathlib.Algebra.Algebra.Defs","public import Mathlib.Algebra.Module.Equiv.Basic","public import Mathlib.Algebra.Module.Submodule.Ker","public import Mathlib.Algebra.Module.Submodule.RestrictScalars","public import Mathlib.Algebra.Module.ULift","public import Mathlib.Algebra.Ring.CharZero","public import Mathlib.Algebra.Ring.Subring.Basic","public import Mathlib.Data.Nat.Cast.Order.Basic","public import Mathlib.Data.Int.CharZero","import Mathlib.Algebra.Ring.Hom.InjSurj"],"local_context":"/-\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-/\n/-!\n# Further basic results about `Algebra`.\n\nThis file could usefully be split further.\n-/\n\n@[expose] public section\n\nuniverse u v w u₁ v₁\n\nopen Function Module\n\nnamespace Algebra\n\nvariable {R A M : Type*}\n\nsection Semiring\n\nvariable [CommSemiring R]\nvariable [Semiring A] [Algebra R A]\n\nsection PUnit\n\ninstance _root_.PUnit.algebra : Algebra R PUnit.{v + 1} where\n algebraMap :=\n { toFun _ := PUnit.unit\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' _ _ := rfl\n smul_def' _ _ := rfl\n\n@[simp]\ntheorem algebraMap_pUnit (r : R) : algebraMap R PUnit r = PUnit.unit :=\n rfl\n\nend PUnit\n\nsection ULift\n\ninstance _root_.ULift.algebra : Algebra R (ULift A) :=\n { ULift.module' with\n algebraMap :=\n { (ULift.ringEquiv : ULift A ≃+* A).symm.toRingHom.comp (algebraMap R A) with\n toFun := fun r => ULift.up (algebraMap R A r) }\n commutes' := fun r x => ULift.down_injective <| Algebra.commutes r x.down\n smul_def' := fun r x => ULift.down_injective <| Algebra.smul_def' r x.down }\n\ntheorem _root_.ULift.algebraMap_eq (r : R) :\n algebraMap R (ULift A) r = ULift.up (algebraMap R A r) :=\n rfl\n\n@[simp]\ntheorem _root_.ULift.down_algebraMap (r : R) : (algebraMap R (ULift A) r).down = algebraMap R A r :=\n rfl\n\nvariable (R A) in\n/-- If `A` is an `R`-algebra, it is also a `ULift R`-algebra. In particular, `Ulift A` is a\n`ULift R` algebra. This is not an instance, because it causes a non-reducible diamond in the case\nwhere `A = Ulift R`. -/\n@[instance_reducible]\ndef _root_.ULift.algebra' : Algebra (ULift.{u} R) A where\n __ := ULift.module\n algebraMap := (algebraMap R A).comp ULift.ringEquiv.toRingHom\n commutes' _ _ := Algebra.commutes ..\n smul_def' _ _ := Algebra.smul_def' ..\n\nattribute [local instance] ULift.algebra' in\n/-- This references the `ULift.algebra'` instance. -/\n@[simp]\nlemma _root_.ULift.algebraMap_apply' (r : ULift R) :\n algebraMap (ULift R) A r = algebraMap R A r.down := rfl\n\nend ULift\n\nsection SubsemiringAlgebra\n\nvariable {C : Type*} [SetLike C R] [SubsemiringClass C R]\n\n/-- Algebra over a subsemiring. This builds upon `Subsemiring.module`. -/\ninstance (priority := 900) ofSubsemiring (S : C) : Algebra S A where\n algebraMap := (algebraMap R A).comp (Subsemiring.subtype <| .ofClass S)\n commutes' r x := Algebra.commutes (r : R) x\n smul_def' r x := Algebra.smul_def (r : R) x\n\ntheorem algebraMap_ofSubsemiring (S : Subsemiring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\ntheorem coe_algebraMap_ofSubsemiring (S : C) : (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\ntheorem algebraMap_ofSubsemiring_apply (S : C) (x : S) : algebraMap S R x = x :=\n rfl\n\n/-- Algebra over a subring. This builds upon `Subring.module`. -/\ninstance ofSubring {R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : Subring R) :\n Algebra S A := inferInstance\n\ntheorem algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\n@[deprecated coe_algebraMap_ofSubsemiring (since := \"2025-11-23\")]\ntheorem coe_algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\n@[deprecated algebraMap_ofSubsemiring_apply (since := \"2025-11-23\")]\ntheorem algebraMap_ofSubring_apply {R : Type*} [CommRing R] (S : Subring R) (x : S) :\n algebraMap S R x = x :=\n rfl\n\nend SubsemiringAlgebra\n\n/-- Explicit characterization of the submonoid map in the case of an algebra.\n`S` is made explicit to help with type inference -/\ndef algebraMapSubmonoid (S : Type*) [Semiring S] [Algebra R S] (M : Submonoid R) : Submonoid S :=\n M.map (algebraMap R S)\n\nvariable {S : Type*} [Semiring S] [Algebra R S]\n\ntheorem mem_algebraMapSubmonoid_of_mem {M : Submonoid R}\n (x : M) : algebraMap R S x ∈ algebraMapSubmonoid S M :=\n Set.mem_image_of_mem (algebraMap R S) x.2\n\n@[simp]\nlemma algebraMapSubmonoid_self (M : Submonoid R) : Algebra.algebraMapSubmonoid R M = M :=\n Submonoid.map_id M\n\n@[simp]\nlemma algebraMapSubmonoid_powers (r : R) :\n Algebra.algebraMapSubmonoid S (.powers r) = Submonoid.powers (algebraMap R S r) := by\n simp [Algebra.algebraMapSubmonoid]\n\nlemma algebraMapSubmonoid_isUnit_le :\n algebraMapSubmonoid S (IsUnit.submonoid R) ≤ IsUnit.submonoid S := by\n rintro x ⟨y, hy, rfl⟩\n exact hy.map _\n\nend Semiring\n\nsection CommSemiring\n\nvariable [CommSemiring R]\n\ntheorem mul_sub_algebraMap_commutes [Ring A] [Algebra R A] (x : A) (r : R) :\n x * (x - algebraMap R A r) = (x - algebraMap R A r) * x := by rw [mul_sub, ← commutes, sub_mul]\n\ntheorem mul_sub_algebraMap_pow_commutes [Ring A] [Algebra R A] (x : A) (r : R) (n : ℕ) :\n x * (x - algebraMap R A r) ^ n = (x - algebraMap R A r) ^ n * x := by\n induction n with\n | zero => simp\n | succ n ih =>\n rw [pow_succ', ← mul_assoc, mul_sub_algebraMap_commutes, mul_assoc, ih, ← mul_assoc]\n\nend CommSemiring\n\nsection Ring\n\n/-- A `Semiring` that is an `Algebra` over a commutative ring carries a natural `Ring` structure.\nSee note [reducible non-instances]. -/\nabbrev semiringToRing (R : Type*) [CommRing R] [Semiring A] [Algebra R A] : Ring A :=\n { __ := (inferInstance : Semiring A)\n __ := Module.addCommMonoidToAddCommGroup R\n intCast := fun z => algebraMap R A z\n intCast_ofNat := fun z => by simp only [Int.cast_natCast, map_natCast]\n intCast_negSucc := fun z => by simp }\n\n/-- The `CommRing` structure on a `CommSemiring` induced by a ring morphism from a `CommRing`. -/\nabbrev _root_.RingHom.commSemiringToCommRing {R A : Type*} [CommRing R] [CommSemiring A]\n (φ : R →+* A) : CommRing A :=\n let _ : Algebra R A := RingHom.toAlgebra φ\n { __ := Algebra.semiringToRing R\n mul_comm := CommMonoid.mul_comm }\n\ninstance {R : Type*} [Ring R] : Algebra (Subring.center R) R where\n algebraMap :=\n { toFun := Subtype.val\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' r x := (Subring.mem_center_iff.1 r.2 x).symm\n smul_def' _ _ := rfl\n\nend Ring\n\nend Algebra\n\nopen scoped Algebra\n\nnamespace Module\n\nvariable (R : Type u) (S : Type v) (M : Type w)\nvariable [CommSemiring R] [Semiring S] [AddCommMonoid M] [Module R M] [Module S M]\nvariable [SMulCommClass S R M] [SMul R S] [IsScalarTower R S M]\n\ninstance End.instAlgebra : Algebra R (Module.End S M) :=\n Algebra.ofModule smul_mul_assoc fun r f g => (smul_comm r f g).symm\n\n-- to prove this is a special case of the above\nexample : Algebra R (Module.End R M) := End.instAlgebra _ _ _\n\ntheorem algebraMap_end_eq_smul_id (a : R) : algebraMap R (End S M) a = a • LinearMap.id :=\n rfl\n\n@[simp]\ntheorem algebraMap_end_apply (a : R) (m : M) : algebraMap R (End S M) a m = a • m :=\n rfl\n\n@[simp]\ntheorem ker_algebraMap_end (K : Type u) (V : Type v) [Semifield K] [AddCommMonoid V] [Module K V]\n (a : K) (ha : a ≠ 0) : LinearMap.ker ((algebraMap K (End K V)) a) = ⊥ :=\n LinearMap.ker_smul _ _ ha\n\nsection\n\nvariable {R M}\n\ntheorem End.algebraMap_isUnit_inv_apply_eq_iff {x : R}\n (h : IsUnit (algebraMap R (Module.End S M) x)) (m m' : M) :\n (↑(h.unit⁻¹) : Module.End S M) m = m' ↔ m = x • m' where\n mp H := H ▸ (isUnit_apply_inv_apply_of_isUnit h m).symm\n mpr H := by\n apply_fun ⇑h.unit.val using ((isUnit_iff _).mp h).injective\n rw [H]\n simpa using Module.End.isUnit_apply_inv_apply_of_isUnit h (x • m')\n\ntheorem End.algebraMap_isUnit_inv_apply_eq_iff' {x : R}\n (h : IsUnit (algebraMap R (Module.End S M) x)) (m m' : M) :\n m' = (↑h.unit⁻¹ : Module.End S M) m ↔ m = x • m' where\n mp H := H ▸ (isUnit_apply_inv_apply_of_isUnit h m).symm\n mpr H := by\n apply_fun (↑h.unit : M → M) using ((isUnit_iff _).mp h).injective\n rw [H]\n simpa using isUnit_apply_inv_apply_of_isUnit h (x • m') |>.symm\n\nend\n\nend Module\n\nnamespace LinearMap\n\nvariable {R : Type*} {A : Type*} {B : Type*} [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B]\n\n/-- An alternate statement of `LinearMap.map_smul` for when `algebraMap` is more convenient to\nwork with than `•`. -/\ntheorem map_algebraMap_mul (f : A →ₗ[R] B) (a : A) (r : R) :\n f (algebraMap R A r * a) = algebraMap R B r * f a := by\n rw [← Algebra.smul_def, ← Algebra.smul_def, map_smul]\n\ntheorem map_mul_algebraMap (f : A →ₗ[R] B) (a : A) (r : R) :\n f (a * algebraMap R A r) = f a * algebraMap R B r := by\n rw [← Algebra.commutes, ← Algebra.commutes, map_algebraMap_mul]\n\nend LinearMap\n\nsection Nat\n\nvariable {R : Type*} [Semiring R]\n\n-- Lower the priority so that `Algebra.id` is picked most of the time when working with\n-- `ℕ`-algebras.\n-- TODO: is this still needed?\n/-- Semiring ⥤ ℕ-Alg -/\ninstance (priority := 99) Semiring.toNatAlgebra : Algebra ℕ R where\n commutes' := Nat.cast_commute\n smul_def' _ _ := nsmul_eq_mul _ _\n algebraMap := Nat.castRingHom R\n\ninstance nat_algebra_subsingleton : Subsingleton (Algebra ℕ R) :=\n ⟨fun P Q => by ext; simp⟩\n\n@[simp]\nlemma algebraMap_comp_natCast (R A : Type*) [CommSemiring R] [Semiring A] [Algebra R A] :\n algebraMap R A ∘ Nat.cast = Nat.cast := by\n ext; simp\n\nend Nat\n\nsection Int\n\nvariable (R : Type*) [Ring R]\n\n-- Lower the priority so that `Algebra.id` is picked most of the time when working with\n-- `ℤ`-algebras.\n-- TODO: is this still needed?\n/-- Ring ⥤ ℤ-Alg -/\ninstance (priority := 99) Ring.toIntAlgebra : Algebra ℤ R where\n commutes' := Int.cast_commute\n smul_def' _ _ := zsmul_eq_mul _ _\n algebraMap := Int.castRingHom R\n\n/-- A special case of `eq_intCast'` that happens to be true definitionally -/\n@[simp]\ntheorem algebraMap_int_eq : algebraMap ℤ R = Int.castRingHom R :=\n rfl\n\nvariable {R}\n\ninstance int_algebra_subsingleton : Subsingleton (Algebra ℤ R) :=\n ⟨fun P Q => Algebra.algebra_ext P Q <| RingHom.congr_fun <| Subsingleton.elim _ _⟩\n\n@[simp]\nlemma algebraMap_comp_intCast (R A : Type*) [CommRing R] [Ring A] [Algebra R A] :\n algebraMap R A ∘ Int.cast = Int.cast := by\n ext; simp\n\nend Int\n\nsection FaithfulSMul\n\ntheorem _root_.NeZero.of_faithfulSMul (R A : Type*) [Semiring R] [Semiring A] [Module R A]\n [IsScalarTower R A A] [FaithfulSMul R A] (n : ℕ) [NeZero (n : R)] :\n NeZero (n : A) :=\n NeZero.nat_of_injective (f := ringHomEquivModuleIsScalarTower.symm ⟨_, ‹_›⟩) <|\n (faithfulSMul_iff_injective_smul_one R A).mp ‹_›\n\nvariable (R A : Type*) [CommSemiring R] [Semiring A] [Algebra R A]","module_header":true,"namespace":"","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Defs\npublic import Mathlib.Algebra.Module.Equiv.Basic\npublic import Mathlib.Algebra.Module.Submodule.Ker\npublic import Mathlib.Algebra.Module.Submodule.RestrictScalars\npublic import Mathlib.Algebra.Module.ULift\npublic import Mathlib.Algebra.Ring.CharZero\npublic import Mathlib.Algebra.Ring.Subring.Basic\npublic import Mathlib.Data.Nat.Cast.Order.Basic\npublic import Mathlib.Data.Int.CharZero\nimport Mathlib.Algebra.Ring.Hom.InjSurj\n\nNamespace:\n(root)\n\nLocal context:\n/-\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-/\n/-!\n# Further basic results about `Algebra`.\n\nThis file could usefully be split further.\n-/\n\n@[expose] public section\n\nuniverse u v w u₁ v₁\n\nopen Function Module\n\nnamespace Algebra\n\nvariable {R A M : Type*}\n\nsection Semiring\n\nvariable [CommSemiring R]\nvariable [Semiring A] [Algebra R A]\n\nsection PUnit\n\ninstance _root_.PUnit.algebra : Algebra R PUnit.{v + 1} where\n algebraMap :=\n { toFun _ := PUnit.unit\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' _ _ := rfl\n smul_def' _ _ := rfl\n\n@[simp]\ntheorem algebraMap_pUnit (r : R) : algebraMap R PUnit r = PUnit.unit :=\n rfl\n\nend PUnit\n\nsection ULift\n\ninstance _root_.ULift.algebra : Algebra R (ULift A) :=\n { ULift.module' with\n algebraMap :=\n { (ULift.ringEquiv : ULift A ≃+* A).symm.toRingHom.comp (algebraMap R A) with\n toFun := fun r => ULift.up (algebraMap R A r) }\n commutes' := fun r x => ULift.down_injective <| Algebra.commutes r x.down\n smul_def' := fun r x => ULift.down_injective <| Algebra.smul_def' r x.down }\n\ntheorem _root_.ULift.algebraMap_eq (r : R) :\n algebraMap R (ULift A) r = ULift.up (algebraMap R A r) :=\n rfl\n\n@[simp]\ntheorem _root_.ULift.down_algebraMap (r : R) : (algebraMap R (ULift A) r).down = algebraMap R A r :=\n rfl\n\nvariable (R A) in\n/-- If `A` is an `R`-algebra, it is also a `ULift R`-algebra. In particular, `Ulift A` is a\n`ULift R` algebra. This is not an instance, because it causes a non-reducible diamond in the case\nwhere `A = Ulift R`. -/\n@[instance_reducible]\ndef _root_.ULift.algebra' : Algebra (ULift.{u} R) A where\n __ := ULift.module\n algebraMap := (algebraMap R A).comp ULift.ringEquiv.toRingHom\n commutes' _ _ := Algebra.commutes ..\n smul_def' _ _ := Algebra.smul_def' ..\n\nattribute [local instance] ULift.algebra' in\n/-- This references the `ULift.algebra'` instance. -/\n@[simp]\nlemma _root_.ULift.algebraMap_apply' (r : ULift R) :\n algebraMap (ULift R) A r = algebraMap R A r.down := rfl\n\nend ULift\n\nsection SubsemiringAlgebra\n\nvariable {C : Type*} [SetLike C R] [SubsemiringClass C R]\n\n/-- Algebra over a subsemiring. This builds upon `Subsemiring.module`. -/\ninstance (priority := 900) ofSubsemiring (S : C) : Algebra S A where\n algebraMap := (algebraMap R A).comp (Subsemiring.subtype <| .ofClass S)\n commutes' r x := Algebra.commutes (r : R) x\n smul_def' r x := Algebra.smul_def (r : R) x\n\ntheorem algebraMap_ofSubsemiring (S : Subsemiring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\ntheorem coe_algebraMap_ofSubsemiring (S : C) : (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\ntheorem algebraMap_ofSubsemiring_apply (S : C) (x : S) : algebraMap S R x = x :=\n rfl\n\n/-- Algebra over a subring. This builds upon `Subring.module`. -/\ninstance ofSubring {R A : Type*} [CommRing R] [Ring A] [Algebra R A] (S : Subring R) :\n Algebra S A := inferInstance\n\ntheorem algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S →+* R) = S.subtype :=\n rfl\n\n@[deprecated coe_algebraMap_ofSubsemiring (since := \"2025-11-23\")]\ntheorem coe_algebraMap_ofSubring {R : Type*} [CommRing R] (S : Subring R) :\n (algebraMap S R : S → R) = Subtype.val :=\n rfl\n\n@[deprecated algebraMap_ofSubsemiring_apply (since := \"2025-11-23\")]\ntheorem algebraMap_ofSubring_apply {R : Type*} [CommRing R] (S : Subring R) (x : S) :\n algebraMap S R x = x :=\n rfl\n\nend SubsemiringAlgebra\n\n/-- Explicit characterization of the submonoid map in the case of an algebra.\n`S` is made explicit to help with type inference -/\ndef algebraMapSubmonoid (S : Type*) [Semiring S] [Algebra R S] (M : Submonoid R) : Submonoid S :=\n M.map (algebraMap R S)\n\nvariable {S : Type*} [Semiring S] [Algebra R S]\n\ntheorem mem_algebraMapSubmonoid_of_mem {M : Submonoid R}\n (x : M) : algebraMap R S x ∈ algebraMapSubmonoid S M :=\n Set.mem_image_of_mem (algebraMap R S) x.2\n\n@[simp]\nlemma algebraMapSubmonoid_self (M : Submonoid R) : Algebra.algebraMapSubmonoid R M = M :=\n Submonoid.map_id M\n\n@[simp]\nlemma algebraMapSubmonoid_powers (r : R) :\n Algebra.algebraMapSubmonoid S (.powers r) = Submonoid.powers (algebraMap R S r) := by\n simp [Algebra.algebraMapSubmonoid]\n\nlemma algebraMapSubmonoid_isUnit_le :\n algebraMapSubmonoid S (IsUnit.submonoid R) ≤ IsUnit.submonoid S := by\n rintro x ⟨y, hy, rfl⟩\n exact hy.map _\n\nend Semiring\n\nsection CommSemiring\n\nvariable [CommSemiring R]\n\ntheorem mul_sub_algebraMap_commutes [Ring A] [Algebra R A] (x : A) (r : R) :\n x * (x - algebraMap R A r) = (x - algebraMap R A r) * x := by rw [mul_sub, ← commutes, sub_mul]\n\ntheorem mul_sub_algebraMap_pow_commutes [Ring A] [Algebra R A] (x : A) (r : R) (n : ℕ) :\n x * (x - algebraMap R A r) ^ n = (x - algebraMap R A r) ^ n * x := by\n induction n with\n | zero => simp\n | succ n ih =>\n rw [pow_succ', ← mul_assoc, mul_sub_algebraMap_commutes, mul_assoc, ih, ← mul_assoc]\n\nend CommSemiring\n\nsection Ring\n\n/-- A `Semiring` that is an `Algebra` over a commutative ring carries a natural `Ring` structure.\nSee note [reducible non-instances]. -/\nabbrev semiringToRing (R : Type*) [CommRing R] [Semiring A] [Algebra R A] : Ring A :=\n { __ := (inferInstance : Semiring A)\n __ := Module.addCommMonoidToAddCommGroup R\n intCast := fun z => algebraMap R A z\n intCast_ofNat := fun z => by simp only [Int.cast_natCast, map_natCast]\n intCast_negSucc := fun z => by simp }\n\n/-- The `CommRing` structure on a `CommSemiring` induced by a ring morphism from a `CommRing`. -/\nabbrev _root_.RingHom.commSemiringToCommRing {R A : Type*} [CommRing R] [CommSemiring A]\n (φ : R →+* A) : CommRing A :=\n let _ : Algebra R A := RingHom.toAlgebra φ\n { __ := Algebra.semiringToRing R\n mul_comm := CommMonoid.mul_comm }\n\ninstance {R : Type*} [Ring R] : Algebra (Subring.center R) R where\n algebraMap :=\n { toFun := Subtype.val\n map_one' := rfl\n map_mul' _ _ := rfl\n map_zero' := rfl\n map_add' _ _ := rfl }\n commutes' r x := (Subring.mem_center_iff.1 r.2 x).symm\n smul_def' _ _ := rfl\n\nend Ring\n\nend Algebra\n\nopen scoped Algebra\n\nnamespace Module\n\nvariable (R : Type u) (S : Type v) (M : Type w)\nvariable [CommSemiring R] [Semiring S] [AddCommMonoid M] [Module R M] [Module S M]\nvariable [SMulCommClass S R M] [SMul R S] [IsScalarTower R S M]\n\ninstance End.instAlgebra : Algebra R (Module.End S M) :=\n Algebra.ofModule smul_mul_assoc fun r f g => (smul_comm r f g).symm\n\n-- to prove this is a special case of the above\nexample : Algebra R (Module.End R M) := End.instAlgebra _ _ _\n\ntheorem algebraMap_end_eq_smul_id (a : R) : algebraMap R (End S M) a = a • LinearMap.id :=\n rfl\n\n@[simp]\ntheorem algebraMap_end_apply (a : R) (m : M) : algebraMap R (End S M) a m = a • m :=\n rfl\n\n@[simp]\ntheorem ker_algebraMap_end (K : Type u) (V : Type v) [Semifield K] [AddCommMonoid V] [Module K V]\n (a : K) (ha : a ≠ 0) : LinearMap.ker ((algebraMap K (End K V)) a) = ⊥ :=\n LinearMap.ker_smul _ _ ha\n\nsection\n\nvariable {R M}\n\ntheorem End.algebraMap_isUnit_inv_apply_eq_iff {x : R}\n (h : IsUnit (algebraMap R (Module.End S M) x)) (m m' : M) :\n (↑(h.unit⁻¹) : Module.End S M) m = m' ↔ m = x • m' where\n mp H := H ▸ (isUnit_apply_inv_apply_of_isUnit h m).symm\n mpr H := by\n apply_fun ⇑h.unit.val using ((isUnit_iff _).mp h).injective\n rw [H]\n simpa using Module.End.isUnit_apply_inv_apply_of_isUnit h (x • m')\n\ntheorem End.algebraMap_isUnit_inv_apply_eq_iff' {x : R}\n (h : IsUnit (algebraMap R (Module.End S M) x)) (m m' : M) :\n m' = (↑h.unit⁻¹ : Module.End S M) m ↔ m = x • m' where\n mp H := H ▸ (isUnit_apply_inv_apply_of_isUnit h m).symm\n mpr H := by\n apply_fun (↑h.unit : M → M) using ((isUnit_iff _).mp h).injective\n rw [H]\n simpa using isUnit_apply_inv_apply_of_isUnit h (x • m') |>.symm\n\nend\n\nend Module\n\nnamespace LinearMap\n\nvariable {R : Type*} {A : Type*} {B : Type*} [CommSemiring R] [Semiring A] [Semiring B]\n [Algebra R A] [Algebra R B]\n\n/-- An alternate statement of `LinearMap.map_smul` for when `algebraMap` is more convenient to\nwork with than `•`. -/\ntheorem map_algebraMap_mul (f : A →ₗ[R] B) (a : A) (r : R) :\n f (algebraMap R A r * a) = algebraMap R B r * f a := by\n rw [← Algebra.smul_def, ← Algebra.smul_def, map_smul]\n\ntheorem map_mul_algebraMap (f : A →ₗ[R] B) (a : A) (r : R) :\n f (a * algebraMap R A r) = f a * algebraMap R B r := by\n rw [← Algebra.commutes, ← Algebra.commutes, map_algebraMap_mul]\n\nend LinearMap\n\nsection Nat\n\nvariable {R : Type*} [Semiring R]\n\n-- Lower the priority so that `Algebra.id` is picked most of the time when working with\n-- `ℕ`-algebras.\n-- TODO: is this still needed?\n/-- Semiring ⥤ ℕ-Alg -/\ninstance (priority := 99) Semiring.toNatAlgebra : Algebra ℕ R where\n commutes' := Nat.cast_commute\n smul_def' _ _ := nsmul_eq_mul _ _\n algebraMap := Nat.castRingHom R\n\ninstance nat_algebra_subsingleton : Subsingleton (Algebra ℕ R) :=\n ⟨fun P Q => by ext; simp⟩\n\n@[simp]\nlemma algebraMap_comp_natCast (R A : Type*) [CommSemiring R] [Semiring A] [Algebra R A] :\n algebraMap R A ∘ Nat.cast = Nat.cast := by\n ext; simp\n\nend Nat\n\nsection Int\n\nvariable (R : Type*) [Ring R]\n\n-- Lower the priority so that `Algebra.id` is picked most of the time when working with\n-- `ℤ`-algebras.\n-- TODO: is this still needed?\n/-- Ring ⥤ ℤ-Alg -/\ninstance (priority := 99) Ring.toIntAlgebra : Algebra ℤ R where\n commutes' := Int.cast_commute\n smul_def' _ _ := zsmul_eq_mul _ _\n algebraMap := Int.castRingHom R\n\n/-- A special case of `eq_intCast'` that happens to be true definitionally -/\n@[simp]\ntheorem algebraMap_int_eq : algebraMap ℤ R = Int.castRingHom R :=\n rfl\n\nvariable {R}\n\ninstance int_algebra_subsingleton : Subsingleton (Algebra ℤ R) :=\n ⟨fun P Q => Algebra.algebra_ext P Q <| RingHom.congr_fun <| Subsingleton.elim _ _⟩\n\n@[simp]\nlemma algebraMap_comp_intCast (R A : Type*) [CommRing R] [Ring A] [Algebra R A] :\n algebraMap R A ∘ Int.cast = Int.cast := by\n ext; simp\n\nend Int\n\nsection FaithfulSMul\n\ntheorem _root_.NeZero.of_faithfulSMul (R A : Type*) [Semiring R] [Semiring A] [Module R A]\n [IsScalarTower R A A] [FaithfulSMul R A] (n : ℕ) [NeZero (n : R)] :\n NeZero (n : A) :=\n NeZero.nat_of_injective (f := ringHomEquivModuleIsScalarTower.symm ⟨_, ‹_›⟩) <|\n (faithfulSMul_iff_injective_smul_one R A).mp ‹_›\n\nvariable (R A : Type*) [CommSemiring R] [Semiring A] [Algebra R A]\n\nTarget:\nlemma faithfulSMul_iff_algebraMap_injective : FaithfulSMul R A ↔ Injective (algebraMap R A) :=\n\nProof body:\n","proof_body":"by\n rw [faithfulSMul_iff_injective_smul_one, Algebra.algebraMap_eq_smul_one']\n\nvariable [FaithfulSMul R A]","provenance":{"declaration_index":27,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"d81d29e01f64ac82099070062ec2011a0ac2599a5411d5c30b031029566d2429","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Basic.lean"},"sample_id":"6d62194d947311bce8afacd1d113ffbda853c33c4fa04a24ebd2364dca0175ba","schema_version":1,"split":"train","theorem_statement":"lemma faithfulSMul_iff_algebraMap_injective : FaithfulSMul R A ↔ Injective (algebraMap R A) :="} {"completion":"by\n simpa [-Units.mul_inv] using congr($(u.mul_inv).val)","context_contains_namespace":true,"context_suffix":"end PreQuasiregular","dependency_ids":["import:Mathlib.Algebra.Algebra.Spectrum.Basic","import:Mathlib.Algebra.Algebra.Tower","import:Mathlib.Algebra.Algebra.Unitization"],"family_id":"inv_add_add_mul_eq_zero","file_id":"mathlib/Mathlib/Algebra/Algebra/Spectrum/Quasispectrum.lean","imports":["public import Mathlib.Algebra.Algebra.Spectrum.Basic","public import Mathlib.Algebra.Algebra.Tower","public import Mathlib.Algebra.Algebra.Unitization"],"local_context":"/-\nCopyright (c) 2024 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Quasiregularity and quasispectrum\n\nFor a non-unital ring `R`, an element `r : R` is *quasiregular* if it is invertible in the monoid\n`(R, ∘)` where `x ∘ y := y + x + x * y` with identity `0 : R`. We implement this both as a type\nsynonym `PreQuasiregular` which has an associated `Monoid` instance (note: *not* an `AddMonoid`\ninstance despite the fact that `0 : R` is the identity in this monoid) so that one may access\nthe quasiregular elements of `R` as `(PreQuasiregular R)ˣ`, but also as a predicate\n`IsQuasiregular`.\n\nQuasiregularity is closely tied to invertibility. Indeed, `(PreQuasiregular A)ˣ` is isomorphic to\nthe subgroup of `Unitization R A` whose scalar part is `1`, whenever `A` is a non-unital\n`R`-algebra, and moreover this isomorphism is implemented by the map\n`(x : A) ↦ (1 + x : Unitization R A)`. It is because of this isomorphism, and the associated ties\nwith multiplicative invertibility, that we choose a `Monoid` (as opposed to an `AddMonoid`)\nstructure on `PreQuasiregular`. In addition, in unital rings, we even have\n`IsQuasiregular x ↔ IsUnit (1 + x)`.\n\nThe *quasispectrum* of `a : A` (with respect to `R`) is defined in terms of quasiregularity, and\nthis is the natural analogue of the `spectrum` for non-unital rings. Indeed, it is true that\n`quasispectrum R a = spectrum R a ∪ {0}` when `A` is unital.\n\nIn Mathlib, the quasispectrum is the domain of the continuous functions associated to the\n*non-unital* continuous functional calculus.\n\n## Main definitions\n\n+ `PreQuasiregular R`: a structure wrapping `R` that inherits a distinct `Monoid` instance when `R`\n is a non-unital semiring.\n+ `Unitization.unitsFstOne`: the subgroup with carrier `{ x : (Unitization R A)ˣ | x.fst = 1 }`.\n+ `unitsFstOne_mulEquiv_quasiregular`: the group isomorphism between\n `Unitization.unitsFstOne` and the units of `PreQuasiregular` (i.e., the quasiregular elements)\n which sends `(1, x) ↦ x`.\n+ `IsQuasiregular x`: the proposition that `x : R` is a unit with respect to the monoid structure on\n `PreQuasiregular R`, i.e., there is some `u : (PreQuasiregular R)ˣ` such that `u.val` is\n identified with `x` (via the natural equivalence between `R` and `PreQuasiregular R`).\n+ `quasispectrum R a`: in an algebra over the semifield `R`, this is the set\n `{r : R | (hr : IsUnit r) → ¬ IsQuasiregular (-(hr.unit⁻¹ • a))}`, which should be thought of\n as a version of the `spectrum` which is applicable in non-unital algebras.\n\n## Main theorems\n\n+ `isQuasiregular_iff_isUnit`: in a unital ring, `x` is quasiregular if and only if `1 + x` is\n a unit.\n+ `quasispectrum_eq_spectrum_union_zero`: in a unital algebra `A` over a semifield `R`, the\n quasispectrum of `a : A` is the `spectrum` with zero added.\n+ `Unitization.isQuasiregular_inr_iff`: `a : A` is quasiregular if and only if it is quasiregular\n in `Unitization R A` (via the coercion `Unitization.inr`).\n+ `Unitization.quasispectrum_eq_spectrum_inr`: the quasispectrum of `a` in a non-unital `R`-algebra\n `A` is precisely the spectrum of `a` in `Unitization R A` (via the coercion `Unitization.inr`).\n-/\n\n@[expose] public section\n\n/-- A type synonym for non-unital rings where an alternative monoid structure is introduced.\nIf `R` is a non-unital semiring, then `PreQuasiregular R` is equipped with the monoid structure\nwith binary operation `fun x y ↦ y + x + x * y` and identity `0`. Elements of `R` which are\ninvertible in this monoid satisfy the predicate `IsQuasiregular`. -/\nstructure PreQuasiregular (R : Type*) where\n /-- The value wrapped into a term of `PreQuasiregular`. -/\n val : R\n\nnamespace PreQuasiregular\n\nvariable {R : Type*} [NonUnitalSemiring R]\n\n/-- The identity map between `R` and `PreQuasiregular R`. -/\n@[simps]\ndef equiv : R ≃ PreQuasiregular R where\n toFun := .mk\n invFun := PreQuasiregular.val\n\ninstance instOne : One (PreQuasiregular R) where\n one := equiv 0\n\n@[simp]\nlemma val_one : (1 : PreQuasiregular R).val = 0 := rfl\n\ninstance instMul : Mul (PreQuasiregular R) where\n mul x y := .mk (y.val + x.val + x.val * y.val)\n\n@[simp]\nlemma val_mul (x y : PreQuasiregular R) : (x * y).val = y.val + x.val + x.val * y.val := rfl\n\ninstance instMonoid : Monoid (PreQuasiregular R) where\n one := equiv 0\n mul x y := .mk (y.val + x.val + x.val * y.val)\n mul_one _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n one_mul _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n mul_assoc x y z := equiv.symm.injective <| by simp [mul_add, add_mul, mul_assoc]; abel\n\n@[simp]","module_header":true,"namespace":"PreQuasiregular","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Spectrum.Basic\npublic import Mathlib.Algebra.Algebra.Tower\npublic import Mathlib.Algebra.Algebra.Unitization\n\nNamespace:\nPreQuasiregular\n\nLocal context:\n/-\nCopyright (c) 2024 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Quasiregularity and quasispectrum\n\nFor a non-unital ring `R`, an element `r : R` is *quasiregular* if it is invertible in the monoid\n`(R, ∘)` where `x ∘ y := y + x + x * y` with identity `0 : R`. We implement this both as a type\nsynonym `PreQuasiregular` which has an associated `Monoid` instance (note: *not* an `AddMonoid`\ninstance despite the fact that `0 : R` is the identity in this monoid) so that one may access\nthe quasiregular elements of `R` as `(PreQuasiregular R)ˣ`, but also as a predicate\n`IsQuasiregular`.\n\nQuasiregularity is closely tied to invertibility. Indeed, `(PreQuasiregular A)ˣ` is isomorphic to\nthe subgroup of `Unitization R A` whose scalar part is `1`, whenever `A` is a non-unital\n`R`-algebra, and moreover this isomorphism is implemented by the map\n`(x : A) ↦ (1 + x : Unitization R A)`. It is because of this isomorphism, and the associated ties\nwith multiplicative invertibility, that we choose a `Monoid` (as opposed to an `AddMonoid`)\nstructure on `PreQuasiregular`. In addition, in unital rings, we even have\n`IsQuasiregular x ↔ IsUnit (1 + x)`.\n\nThe *quasispectrum* of `a : A` (with respect to `R`) is defined in terms of quasiregularity, and\nthis is the natural analogue of the `spectrum` for non-unital rings. Indeed, it is true that\n`quasispectrum R a = spectrum R a ∪ {0}` when `A` is unital.\n\nIn Mathlib, the quasispectrum is the domain of the continuous functions associated to the\n*non-unital* continuous functional calculus.\n\n## Main definitions\n\n+ `PreQuasiregular R`: a structure wrapping `R` that inherits a distinct `Monoid` instance when `R`\n is a non-unital semiring.\n+ `Unitization.unitsFstOne`: the subgroup with carrier `{ x : (Unitization R A)ˣ | x.fst = 1 }`.\n+ `unitsFstOne_mulEquiv_quasiregular`: the group isomorphism between\n `Unitization.unitsFstOne` and the units of `PreQuasiregular` (i.e., the quasiregular elements)\n which sends `(1, x) ↦ x`.\n+ `IsQuasiregular x`: the proposition that `x : R` is a unit with respect to the monoid structure on\n `PreQuasiregular R`, i.e., there is some `u : (PreQuasiregular R)ˣ` such that `u.val` is\n identified with `x` (via the natural equivalence between `R` and `PreQuasiregular R`).\n+ `quasispectrum R a`: in an algebra over the semifield `R`, this is the set\n `{r : R | (hr : IsUnit r) → ¬ IsQuasiregular (-(hr.unit⁻¹ • a))}`, which should be thought of\n as a version of the `spectrum` which is applicable in non-unital algebras.\n\n## Main theorems\n\n+ `isQuasiregular_iff_isUnit`: in a unital ring, `x` is quasiregular if and only if `1 + x` is\n a unit.\n+ `quasispectrum_eq_spectrum_union_zero`: in a unital algebra `A` over a semifield `R`, the\n quasispectrum of `a : A` is the `spectrum` with zero added.\n+ `Unitization.isQuasiregular_inr_iff`: `a : A` is quasiregular if and only if it is quasiregular\n in `Unitization R A` (via the coercion `Unitization.inr`).\n+ `Unitization.quasispectrum_eq_spectrum_inr`: the quasispectrum of `a` in a non-unital `R`-algebra\n `A` is precisely the spectrum of `a` in `Unitization R A` (via the coercion `Unitization.inr`).\n-/\n\n@[expose] public section\n\n/-- A type synonym for non-unital rings where an alternative monoid structure is introduced.\nIf `R` is a non-unital semiring, then `PreQuasiregular R` is equipped with the monoid structure\nwith binary operation `fun x y ↦ y + x + x * y` and identity `0`. Elements of `R` which are\ninvertible in this monoid satisfy the predicate `IsQuasiregular`. -/\nstructure PreQuasiregular (R : Type*) where\n /-- The value wrapped into a term of `PreQuasiregular`. -/\n val : R\n\nnamespace PreQuasiregular\n\nvariable {R : Type*} [NonUnitalSemiring R]\n\n/-- The identity map between `R` and `PreQuasiregular R`. -/\n@[simps]\ndef equiv : R ≃ PreQuasiregular R where\n toFun := .mk\n invFun := PreQuasiregular.val\n\ninstance instOne : One (PreQuasiregular R) where\n one := equiv 0\n\n@[simp]\nlemma val_one : (1 : PreQuasiregular R).val = 0 := rfl\n\ninstance instMul : Mul (PreQuasiregular R) where\n mul x y := .mk (y.val + x.val + x.val * y.val)\n\n@[simp]\nlemma val_mul (x y : PreQuasiregular R) : (x * y).val = y.val + x.val + x.val * y.val := rfl\n\ninstance instMonoid : Monoid (PreQuasiregular R) where\n one := equiv 0\n mul x y := .mk (y.val + x.val + x.val * y.val)\n mul_one _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n one_mul _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n mul_assoc x y z := equiv.symm.injective <| by simp [mul_add, add_mul, mul_assoc]; abel\n\n@[simp]\n\nTarget:\nlemma inv_add_add_mul_eq_zero (u : (PreQuasiregular R)ˣ) :\n u⁻¹.val.val + u.val.val + u.val.val * u⁻¹.val.val = 0 :=\n\nProof body:\n","proof_body":"by\n simpa [-Units.mul_inv] using congr($(u.mul_inv).val)","provenance":{"declaration_index":2,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"86daaff4a1e1ed9d97d7dcf185be7df0da41c9b2ae049e4a852eeedca7f99791","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Spectrum/Quasispectrum.lean"},"sample_id":"96023915a507a930d4da1ba6a2f4e3ba39e81aedff9ba7cf6c05a89ab491994c","schema_version":1,"split":"train","theorem_statement":"lemma inv_add_add_mul_eq_zero (u : (PreQuasiregular R)ˣ) :\n u⁻¹.val.val + u.val.val + u.val.val * u⁻¹.val.val = 0 :="} {"completion":"by\n simpa [-Units.inv_mul] using congr($(u.inv_mul).val)","context_contains_namespace":true,"context_suffix":"end PreQuasiregular","dependency_ids":["import:Mathlib.Algebra.Algebra.Spectrum.Basic","import:Mathlib.Algebra.Algebra.Tower","import:Mathlib.Algebra.Algebra.Unitization"],"family_id":"add_inv_add_mul_eq_zero","file_id":"mathlib/Mathlib/Algebra/Algebra/Spectrum/Quasispectrum.lean","imports":["public import Mathlib.Algebra.Algebra.Spectrum.Basic","public import Mathlib.Algebra.Algebra.Tower","public import Mathlib.Algebra.Algebra.Unitization"],"local_context":"/-\nCopyright (c) 2024 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Quasiregularity and quasispectrum\n\nFor a non-unital ring `R`, an element `r : R` is *quasiregular* if it is invertible in the monoid\n`(R, ∘)` where `x ∘ y := y + x + x * y` with identity `0 : R`. We implement this both as a type\nsynonym `PreQuasiregular` which has an associated `Monoid` instance (note: *not* an `AddMonoid`\ninstance despite the fact that `0 : R` is the identity in this monoid) so that one may access\nthe quasiregular elements of `R` as `(PreQuasiregular R)ˣ`, but also as a predicate\n`IsQuasiregular`.\n\nQuasiregularity is closely tied to invertibility. Indeed, `(PreQuasiregular A)ˣ` is isomorphic to\nthe subgroup of `Unitization R A` whose scalar part is `1`, whenever `A` is a non-unital\n`R`-algebra, and moreover this isomorphism is implemented by the map\n`(x : A) ↦ (1 + x : Unitization R A)`. It is because of this isomorphism, and the associated ties\nwith multiplicative invertibility, that we choose a `Monoid` (as opposed to an `AddMonoid`)\nstructure on `PreQuasiregular`. In addition, in unital rings, we even have\n`IsQuasiregular x ↔ IsUnit (1 + x)`.\n\nThe *quasispectrum* of `a : A` (with respect to `R`) is defined in terms of quasiregularity, and\nthis is the natural analogue of the `spectrum` for non-unital rings. Indeed, it is true that\n`quasispectrum R a = spectrum R a ∪ {0}` when `A` is unital.\n\nIn Mathlib, the quasispectrum is the domain of the continuous functions associated to the\n*non-unital* continuous functional calculus.\n\n## Main definitions\n\n+ `PreQuasiregular R`: a structure wrapping `R` that inherits a distinct `Monoid` instance when `R`\n is a non-unital semiring.\n+ `Unitization.unitsFstOne`: the subgroup with carrier `{ x : (Unitization R A)ˣ | x.fst = 1 }`.\n+ `unitsFstOne_mulEquiv_quasiregular`: the group isomorphism between\n `Unitization.unitsFstOne` and the units of `PreQuasiregular` (i.e., the quasiregular elements)\n which sends `(1, x) ↦ x`.\n+ `IsQuasiregular x`: the proposition that `x : R` is a unit with respect to the monoid structure on\n `PreQuasiregular R`, i.e., there is some `u : (PreQuasiregular R)ˣ` such that `u.val` is\n identified with `x` (via the natural equivalence between `R` and `PreQuasiregular R`).\n+ `quasispectrum R a`: in an algebra over the semifield `R`, this is the set\n `{r : R | (hr : IsUnit r) → ¬ IsQuasiregular (-(hr.unit⁻¹ • a))}`, which should be thought of\n as a version of the `spectrum` which is applicable in non-unital algebras.\n\n## Main theorems\n\n+ `isQuasiregular_iff_isUnit`: in a unital ring, `x` is quasiregular if and only if `1 + x` is\n a unit.\n+ `quasispectrum_eq_spectrum_union_zero`: in a unital algebra `A` over a semifield `R`, the\n quasispectrum of `a : A` is the `spectrum` with zero added.\n+ `Unitization.isQuasiregular_inr_iff`: `a : A` is quasiregular if and only if it is quasiregular\n in `Unitization R A` (via the coercion `Unitization.inr`).\n+ `Unitization.quasispectrum_eq_spectrum_inr`: the quasispectrum of `a` in a non-unital `R`-algebra\n `A` is precisely the spectrum of `a` in `Unitization R A` (via the coercion `Unitization.inr`).\n-/\n\n@[expose] public section\n\n/-- A type synonym for non-unital rings where an alternative monoid structure is introduced.\nIf `R` is a non-unital semiring, then `PreQuasiregular R` is equipped with the monoid structure\nwith binary operation `fun x y ↦ y + x + x * y` and identity `0`. Elements of `R` which are\ninvertible in this monoid satisfy the predicate `IsQuasiregular`. -/\nstructure PreQuasiregular (R : Type*) where\n /-- The value wrapped into a term of `PreQuasiregular`. -/\n val : R\n\nnamespace PreQuasiregular\n\nvariable {R : Type*} [NonUnitalSemiring R]\n\n/-- The identity map between `R` and `PreQuasiregular R`. -/\n@[simps]\ndef equiv : R ≃ PreQuasiregular R where\n toFun := .mk\n invFun := PreQuasiregular.val\n\ninstance instOne : One (PreQuasiregular R) where\n one := equiv 0\n\n@[simp]\nlemma val_one : (1 : PreQuasiregular R).val = 0 := rfl\n\ninstance instMul : Mul (PreQuasiregular R) where\n mul x y := .mk (y.val + x.val + x.val * y.val)\n\n@[simp]\nlemma val_mul (x y : PreQuasiregular R) : (x * y).val = y.val + x.val + x.val * y.val := rfl\n\ninstance instMonoid : Monoid (PreQuasiregular R) where\n one := equiv 0\n mul x y := .mk (y.val + x.val + x.val * y.val)\n mul_one _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n one_mul _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n mul_assoc x y z := equiv.symm.injective <| by simp [mul_add, add_mul, mul_assoc]; abel\n\n@[simp]\nlemma inv_add_add_mul_eq_zero (u : (PreQuasiregular R)ˣ) :\n u⁻¹.val.val + u.val.val + u.val.val * u⁻¹.val.val = 0 := by\n simpa [-Units.mul_inv] using congr($(u.mul_inv).val)\n\n@[simp]","module_header":true,"namespace":"PreQuasiregular","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Spectrum.Basic\npublic import Mathlib.Algebra.Algebra.Tower\npublic import Mathlib.Algebra.Algebra.Unitization\n\nNamespace:\nPreQuasiregular\n\nLocal context:\n/-\nCopyright (c) 2024 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Quasiregularity and quasispectrum\n\nFor a non-unital ring `R`, an element `r : R` is *quasiregular* if it is invertible in the monoid\n`(R, ∘)` where `x ∘ y := y + x + x * y` with identity `0 : R`. We implement this both as a type\nsynonym `PreQuasiregular` which has an associated `Monoid` instance (note: *not* an `AddMonoid`\ninstance despite the fact that `0 : R` is the identity in this monoid) so that one may access\nthe quasiregular elements of `R` as `(PreQuasiregular R)ˣ`, but also as a predicate\n`IsQuasiregular`.\n\nQuasiregularity is closely tied to invertibility. Indeed, `(PreQuasiregular A)ˣ` is isomorphic to\nthe subgroup of `Unitization R A` whose scalar part is `1`, whenever `A` is a non-unital\n`R`-algebra, and moreover this isomorphism is implemented by the map\n`(x : A) ↦ (1 + x : Unitization R A)`. It is because of this isomorphism, and the associated ties\nwith multiplicative invertibility, that we choose a `Monoid` (as opposed to an `AddMonoid`)\nstructure on `PreQuasiregular`. In addition, in unital rings, we even have\n`IsQuasiregular x ↔ IsUnit (1 + x)`.\n\nThe *quasispectrum* of `a : A` (with respect to `R`) is defined in terms of quasiregularity, and\nthis is the natural analogue of the `spectrum` for non-unital rings. Indeed, it is true that\n`quasispectrum R a = spectrum R a ∪ {0}` when `A` is unital.\n\nIn Mathlib, the quasispectrum is the domain of the continuous functions associated to the\n*non-unital* continuous functional calculus.\n\n## Main definitions\n\n+ `PreQuasiregular R`: a structure wrapping `R` that inherits a distinct `Monoid` instance when `R`\n is a non-unital semiring.\n+ `Unitization.unitsFstOne`: the subgroup with carrier `{ x : (Unitization R A)ˣ | x.fst = 1 }`.\n+ `unitsFstOne_mulEquiv_quasiregular`: the group isomorphism between\n `Unitization.unitsFstOne` and the units of `PreQuasiregular` (i.e., the quasiregular elements)\n which sends `(1, x) ↦ x`.\n+ `IsQuasiregular x`: the proposition that `x : R` is a unit with respect to the monoid structure on\n `PreQuasiregular R`, i.e., there is some `u : (PreQuasiregular R)ˣ` such that `u.val` is\n identified with `x` (via the natural equivalence between `R` and `PreQuasiregular R`).\n+ `quasispectrum R a`: in an algebra over the semifield `R`, this is the set\n `{r : R | (hr : IsUnit r) → ¬ IsQuasiregular (-(hr.unit⁻¹ • a))}`, which should be thought of\n as a version of the `spectrum` which is applicable in non-unital algebras.\n\n## Main theorems\n\n+ `isQuasiregular_iff_isUnit`: in a unital ring, `x` is quasiregular if and only if `1 + x` is\n a unit.\n+ `quasispectrum_eq_spectrum_union_zero`: in a unital algebra `A` over a semifield `R`, the\n quasispectrum of `a : A` is the `spectrum` with zero added.\n+ `Unitization.isQuasiregular_inr_iff`: `a : A` is quasiregular if and only if it is quasiregular\n in `Unitization R A` (via the coercion `Unitization.inr`).\n+ `Unitization.quasispectrum_eq_spectrum_inr`: the quasispectrum of `a` in a non-unital `R`-algebra\n `A` is precisely the spectrum of `a` in `Unitization R A` (via the coercion `Unitization.inr`).\n-/\n\n@[expose] public section\n\n/-- A type synonym for non-unital rings where an alternative monoid structure is introduced.\nIf `R` is a non-unital semiring, then `PreQuasiregular R` is equipped with the monoid structure\nwith binary operation `fun x y ↦ y + x + x * y` and identity `0`. Elements of `R` which are\ninvertible in this monoid satisfy the predicate `IsQuasiregular`. -/\nstructure PreQuasiregular (R : Type*) where\n /-- The value wrapped into a term of `PreQuasiregular`. -/\n val : R\n\nnamespace PreQuasiregular\n\nvariable {R : Type*} [NonUnitalSemiring R]\n\n/-- The identity map between `R` and `PreQuasiregular R`. -/\n@[simps]\ndef equiv : R ≃ PreQuasiregular R where\n toFun := .mk\n invFun := PreQuasiregular.val\n\ninstance instOne : One (PreQuasiregular R) where\n one := equiv 0\n\n@[simp]\nlemma val_one : (1 : PreQuasiregular R).val = 0 := rfl\n\ninstance instMul : Mul (PreQuasiregular R) where\n mul x y := .mk (y.val + x.val + x.val * y.val)\n\n@[simp]\nlemma val_mul (x y : PreQuasiregular R) : (x * y).val = y.val + x.val + x.val * y.val := rfl\n\ninstance instMonoid : Monoid (PreQuasiregular R) where\n one := equiv 0\n mul x y := .mk (y.val + x.val + x.val * y.val)\n mul_one _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n one_mul _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n mul_assoc x y z := equiv.symm.injective <| by simp [mul_add, add_mul, mul_assoc]; abel\n\n@[simp]\nlemma inv_add_add_mul_eq_zero (u : (PreQuasiregular R)ˣ) :\n u⁻¹.val.val + u.val.val + u.val.val * u⁻¹.val.val = 0 := by\n simpa [-Units.mul_inv] using congr($(u.mul_inv).val)\n\n@[simp]\n\nTarget:\nlemma add_inv_add_mul_eq_zero (u : (PreQuasiregular R)ˣ) :\n u.val.val + u⁻¹.val.val + u⁻¹.val.val * u.val.val = 0 :=\n\nProof body:\n","proof_body":"by\n simpa [-Units.inv_mul] using congr($(u.inv_mul).val)","provenance":{"declaration_index":3,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"86daaff4a1e1ed9d97d7dcf185be7df0da41c9b2ae049e4a852eeedca7f99791","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Spectrum/Quasispectrum.lean"},"sample_id":"1b2775b5f5febcc43efa274519126d63822460912ad3927f590eabde8a588659","schema_version":1,"split":"train","theorem_statement":"lemma add_inv_add_mul_eq_zero (u : (PreQuasiregular R)ˣ) :\n u.val.val + u⁻¹.val.val + u⁻¹.val.val * u.val.val = 0 :="} {"completion":"by\n constructor\n · rintro ⟨u, rfl⟩\n exact ⟨equiv.symm u⁻¹.val, by simp⟩\n · rintro ⟨y, hy₁, hy₂⟩\n refine ⟨⟨equiv x, equiv y, ?_, ?_⟩, rfl⟩\n all_goals\n apply equiv.symm.injective\n assumption","context_contains_namespace":false,"context_suffix":"end PreQuasiregular","dependency_ids":["import:Mathlib.Algebra.Algebra.Spectrum.Basic","import:Mathlib.Algebra.Algebra.Tower","import:Mathlib.Algebra.Algebra.Unitization"],"family_id":"isquasiregular_iff","file_id":"mathlib/Mathlib/Algebra/Algebra/Spectrum/Quasispectrum.lean","imports":["public import Mathlib.Algebra.Algebra.Spectrum.Basic","public import Mathlib.Algebra.Algebra.Tower","public import Mathlib.Algebra.Algebra.Unitization"],"local_context":"/-\nCopyright (c) 2024 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Quasiregularity and quasispectrum\n\nFor a non-unital ring `R`, an element `r : R` is *quasiregular* if it is invertible in the monoid\n`(R, ∘)` where `x ∘ y := y + x + x * y` with identity `0 : R`. We implement this both as a type\nsynonym `PreQuasiregular` which has an associated `Monoid` instance (note: *not* an `AddMonoid`\ninstance despite the fact that `0 : R` is the identity in this monoid) so that one may access\nthe quasiregular elements of `R` as `(PreQuasiregular R)ˣ`, but also as a predicate\n`IsQuasiregular`.\n\nQuasiregularity is closely tied to invertibility. Indeed, `(PreQuasiregular A)ˣ` is isomorphic to\nthe subgroup of `Unitization R A` whose scalar part is `1`, whenever `A` is a non-unital\n`R`-algebra, and moreover this isomorphism is implemented by the map\n`(x : A) ↦ (1 + x : Unitization R A)`. It is because of this isomorphism, and the associated ties\nwith multiplicative invertibility, that we choose a `Monoid` (as opposed to an `AddMonoid`)\nstructure on `PreQuasiregular`. In addition, in unital rings, we even have\n`IsQuasiregular x ↔ IsUnit (1 + x)`.\n\nThe *quasispectrum* of `a : A` (with respect to `R`) is defined in terms of quasiregularity, and\nthis is the natural analogue of the `spectrum` for non-unital rings. Indeed, it is true that\n`quasispectrum R a = spectrum R a ∪ {0}` when `A` is unital.\n\nIn Mathlib, the quasispectrum is the domain of the continuous functions associated to the\n*non-unital* continuous functional calculus.\n\n## Main definitions\n\n+ `PreQuasiregular R`: a structure wrapping `R` that inherits a distinct `Monoid` instance when `R`\n is a non-unital semiring.\n+ `Unitization.unitsFstOne`: the subgroup with carrier `{ x : (Unitization R A)ˣ | x.fst = 1 }`.\n+ `unitsFstOne_mulEquiv_quasiregular`: the group isomorphism between\n `Unitization.unitsFstOne` and the units of `PreQuasiregular` (i.e., the quasiregular elements)\n which sends `(1, x) ↦ x`.\n+ `IsQuasiregular x`: the proposition that `x : R` is a unit with respect to the monoid structure on\n `PreQuasiregular R`, i.e., there is some `u : (PreQuasiregular R)ˣ` such that `u.val` is\n identified with `x` (via the natural equivalence between `R` and `PreQuasiregular R`).\n+ `quasispectrum R a`: in an algebra over the semifield `R`, this is the set\n `{r : R | (hr : IsUnit r) → ¬ IsQuasiregular (-(hr.unit⁻¹ • a))}`, which should be thought of\n as a version of the `spectrum` which is applicable in non-unital algebras.\n\n## Main theorems\n\n+ `isQuasiregular_iff_isUnit`: in a unital ring, `x` is quasiregular if and only if `1 + x` is\n a unit.\n+ `quasispectrum_eq_spectrum_union_zero`: in a unital algebra `A` over a semifield `R`, the\n quasispectrum of `a : A` is the `spectrum` with zero added.\n+ `Unitization.isQuasiregular_inr_iff`: `a : A` is quasiregular if and only if it is quasiregular\n in `Unitization R A` (via the coercion `Unitization.inr`).\n+ `Unitization.quasispectrum_eq_spectrum_inr`: the quasispectrum of `a` in a non-unital `R`-algebra\n `A` is precisely the spectrum of `a` in `Unitization R A` (via the coercion `Unitization.inr`).\n-/\n\n@[expose] public section\n\n/-- A type synonym for non-unital rings where an alternative monoid structure is introduced.\nIf `R` is a non-unital semiring, then `PreQuasiregular R` is equipped with the monoid structure\nwith binary operation `fun x y ↦ y + x + x * y` and identity `0`. Elements of `R` which are\ninvertible in this monoid satisfy the predicate `IsQuasiregular`. -/\nstructure PreQuasiregular (R : Type*) where\n /-- The value wrapped into a term of `PreQuasiregular`. -/\n val : R\n\nnamespace PreQuasiregular\n\nvariable {R : Type*} [NonUnitalSemiring R]\n\n/-- The identity map between `R` and `PreQuasiregular R`. -/\n@[simps]\ndef equiv : R ≃ PreQuasiregular R where\n toFun := .mk\n invFun := PreQuasiregular.val\n\ninstance instOne : One (PreQuasiregular R) where\n one := equiv 0\n\n@[simp]\nlemma val_one : (1 : PreQuasiregular R).val = 0 := rfl\n\ninstance instMul : Mul (PreQuasiregular R) where\n mul x y := .mk (y.val + x.val + x.val * y.val)\n\n@[simp]\nlemma val_mul (x y : PreQuasiregular R) : (x * y).val = y.val + x.val + x.val * y.val := rfl\n\ninstance instMonoid : Monoid (PreQuasiregular R) where\n one := equiv 0\n mul x y := .mk (y.val + x.val + x.val * y.val)\n mul_one _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n one_mul _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n mul_assoc x y z := equiv.symm.injective <| by simp [mul_add, add_mul, mul_assoc]; abel\n\n@[simp]\nlemma inv_add_add_mul_eq_zero (u : (PreQuasiregular R)ˣ) :\n u⁻¹.val.val + u.val.val + u.val.val * u⁻¹.val.val = 0 := by\n simpa [-Units.mul_inv] using congr($(u.mul_inv).val)\n\n@[simp]\nlemma add_inv_add_mul_eq_zero (u : (PreQuasiregular R)ˣ) :\n u.val.val + u⁻¹.val.val + u⁻¹.val.val * u.val.val = 0 := by\n simpa [-Units.inv_mul] using congr($(u.inv_mul).val)\n\nend PreQuasiregular\n\nnamespace Unitization\nopen PreQuasiregular\n\nvariable {R A : Type*} [CommSemiring R] [NonUnitalSemiring A] [Module R A] [IsScalarTower R A A]\n [SMulCommClass R A A]\n\nvariable (R A) in\n/-- The subgroup of the units of `Unitization R A` whose scalar part is `1`. -/\ndef unitsFstOne : Subgroup (Unitization R A)ˣ where\n carrier := {x | x.val.fst = 1}\n one_mem' := rfl\n mul_mem' {x} {y} (hx : x.val.fst = 1) (hy : y.val.fst = 1) := by simp [hx, hy]\n inv_mem' {x} (hx : x.val.fst = 1) := by\n simpa [-Units.mul_inv, hx] using congr(fstHom R A $(x.mul_inv))\n\n@[simp]\nlemma mem_unitsFstOne {x : (Unitization R A)ˣ} : x ∈ unitsFstOne R A ↔ x.val.fst = 1 := Iff.rfl\n\n@[simp]\nlemma unitsFstOne_val_val_fst (x : (unitsFstOne R A)) : x.val.val.fst = 1 :=\n mem_unitsFstOne.mp x.property\n\n@[simp]\nlemma unitsFstOne_val_inv_val_fst (x : (unitsFstOne R A)) : x.val⁻¹.val.fst = 1 :=\n mem_unitsFstOne.mp x⁻¹.property\n\nvariable (R) in\n/-- If `A` is a non-unital `R`-algebra, then the subgroup of units of `Unitization R A` whose\nscalar part is `1 : R` (i.e., `Unitization.unitsFstOne`) is isomorphic to the group of units of\n`PreQuasiregular A`. -/\n@[simps]\ndef unitsFstOne_mulEquiv_quasiregular : unitsFstOne R A ≃* (PreQuasiregular A)ˣ where\n toFun x :=\n { val := PreQuasiregular.equiv x.val.val.snd\n inv := PreQuasiregular.equiv x⁻¹.val.val.snd\n val_inv := PreQuasiregular.equiv.symm.injective <| by\n simpa [-Units.mul_inv] using congr($(x.val.mul_inv).snd)\n inv_val := PreQuasiregular.equiv.symm.injective <| by\n simpa [-Units.inv_mul] using congr($(x.val.inv_mul).snd) }\n invFun x :=\n { val :=\n { val := 1 + PreQuasiregular.equiv.symm x.val\n inv := 1 + PreQuasiregular.equiv.symm x⁻¹.val\n val_inv := by\n convert congr((1 + $(inv_add_add_mul_eq_zero x) : Unitization R A))\n · simp only [mul_one, PreQuasiregular.equiv_symm_apply, one_mul, mul_add,\n add_mul, inr_add, inr_mul]\n abel\n · simp only [inr_zero, add_zero]\n inv_val := by\n convert congr((1 + $(add_inv_add_mul_eq_zero x) : Unitization R A))\n · simp only [mul_one, PreQuasiregular.equiv_symm_apply, one_mul, mul_add,\n add_mul, inr_add, inr_mul]\n abel\n · simp only [inr_zero, add_zero] }\n property := by simp }\n left_inv x := Subtype.ext <| Units.ext <| by simpa using x.val.val.inl_fst_add_inr_snd_eq\n right_inv x := Units.ext <| by simp [-PreQuasiregular.equiv_symm_apply]\n map_mul' x y := Units.ext <| PreQuasiregular.equiv.symm.injective <| by simp\n\nend Unitization\n\nsection PreQuasiregular\n\nopen PreQuasiregular\n\nvariable {R : Type*} [NonUnitalSemiring R]\n\n/-- In a non-unital semiring `R`, an element `x : R` satisfies `IsQuasiregular` if it is a unit\nunder the monoid operation `fun x y ↦ y + x + x * y`. -/\ndef IsQuasiregular (x : R) : Prop :=\n ∃ u : (PreQuasiregular R)ˣ, equiv.symm u.val = x\n\n@[simp]\nlemma isQuasiregular_zero : IsQuasiregular 0 := ⟨1, rfl⟩","module_header":true,"namespace":"","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Spectrum.Basic\npublic import Mathlib.Algebra.Algebra.Tower\npublic import Mathlib.Algebra.Algebra.Unitization\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2024 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Quasiregularity and quasispectrum\n\nFor a non-unital ring `R`, an element `r : R` is *quasiregular* if it is invertible in the monoid\n`(R, ∘)` where `x ∘ y := y + x + x * y` with identity `0 : R`. We implement this both as a type\nsynonym `PreQuasiregular` which has an associated `Monoid` instance (note: *not* an `AddMonoid`\ninstance despite the fact that `0 : R` is the identity in this monoid) so that one may access\nthe quasiregular elements of `R` as `(PreQuasiregular R)ˣ`, but also as a predicate\n`IsQuasiregular`.\n\nQuasiregularity is closely tied to invertibility. Indeed, `(PreQuasiregular A)ˣ` is isomorphic to\nthe subgroup of `Unitization R A` whose scalar part is `1`, whenever `A` is a non-unital\n`R`-algebra, and moreover this isomorphism is implemented by the map\n`(x : A) ↦ (1 + x : Unitization R A)`. It is because of this isomorphism, and the associated ties\nwith multiplicative invertibility, that we choose a `Monoid` (as opposed to an `AddMonoid`)\nstructure on `PreQuasiregular`. In addition, in unital rings, we even have\n`IsQuasiregular x ↔ IsUnit (1 + x)`.\n\nThe *quasispectrum* of `a : A` (with respect to `R`) is defined in terms of quasiregularity, and\nthis is the natural analogue of the `spectrum` for non-unital rings. Indeed, it is true that\n`quasispectrum R a = spectrum R a ∪ {0}` when `A` is unital.\n\nIn Mathlib, the quasispectrum is the domain of the continuous functions associated to the\n*non-unital* continuous functional calculus.\n\n## Main definitions\n\n+ `PreQuasiregular R`: a structure wrapping `R` that inherits a distinct `Monoid` instance when `R`\n is a non-unital semiring.\n+ `Unitization.unitsFstOne`: the subgroup with carrier `{ x : (Unitization R A)ˣ | x.fst = 1 }`.\n+ `unitsFstOne_mulEquiv_quasiregular`: the group isomorphism between\n `Unitization.unitsFstOne` and the units of `PreQuasiregular` (i.e., the quasiregular elements)\n which sends `(1, x) ↦ x`.\n+ `IsQuasiregular x`: the proposition that `x : R` is a unit with respect to the monoid structure on\n `PreQuasiregular R`, i.e., there is some `u : (PreQuasiregular R)ˣ` such that `u.val` is\n identified with `x` (via the natural equivalence between `R` and `PreQuasiregular R`).\n+ `quasispectrum R a`: in an algebra over the semifield `R`, this is the set\n `{r : R | (hr : IsUnit r) → ¬ IsQuasiregular (-(hr.unit⁻¹ • a))}`, which should be thought of\n as a version of the `spectrum` which is applicable in non-unital algebras.\n\n## Main theorems\n\n+ `isQuasiregular_iff_isUnit`: in a unital ring, `x` is quasiregular if and only if `1 + x` is\n a unit.\n+ `quasispectrum_eq_spectrum_union_zero`: in a unital algebra `A` over a semifield `R`, the\n quasispectrum of `a : A` is the `spectrum` with zero added.\n+ `Unitization.isQuasiregular_inr_iff`: `a : A` is quasiregular if and only if it is quasiregular\n in `Unitization R A` (via the coercion `Unitization.inr`).\n+ `Unitization.quasispectrum_eq_spectrum_inr`: the quasispectrum of `a` in a non-unital `R`-algebra\n `A` is precisely the spectrum of `a` in `Unitization R A` (via the coercion `Unitization.inr`).\n-/\n\n@[expose] public section\n\n/-- A type synonym for non-unital rings where an alternative monoid structure is introduced.\nIf `R` is a non-unital semiring, then `PreQuasiregular R` is equipped with the monoid structure\nwith binary operation `fun x y ↦ y + x + x * y` and identity `0`. Elements of `R` which are\ninvertible in this monoid satisfy the predicate `IsQuasiregular`. -/\nstructure PreQuasiregular (R : Type*) where\n /-- The value wrapped into a term of `PreQuasiregular`. -/\n val : R\n\nnamespace PreQuasiregular\n\nvariable {R : Type*} [NonUnitalSemiring R]\n\n/-- The identity map between `R` and `PreQuasiregular R`. -/\n@[simps]\ndef equiv : R ≃ PreQuasiregular R where\n toFun := .mk\n invFun := PreQuasiregular.val\n\ninstance instOne : One (PreQuasiregular R) where\n one := equiv 0\n\n@[simp]\nlemma val_one : (1 : PreQuasiregular R).val = 0 := rfl\n\ninstance instMul : Mul (PreQuasiregular R) where\n mul x y := .mk (y.val + x.val + x.val * y.val)\n\n@[simp]\nlemma val_mul (x y : PreQuasiregular R) : (x * y).val = y.val + x.val + x.val * y.val := rfl\n\ninstance instMonoid : Monoid (PreQuasiregular R) where\n one := equiv 0\n mul x y := .mk (y.val + x.val + x.val * y.val)\n mul_one _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n one_mul _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n mul_assoc x y z := equiv.symm.injective <| by simp [mul_add, add_mul, mul_assoc]; abel\n\n@[simp]\nlemma inv_add_add_mul_eq_zero (u : (PreQuasiregular R)ˣ) :\n u⁻¹.val.val + u.val.val + u.val.val * u⁻¹.val.val = 0 := by\n simpa [-Units.mul_inv] using congr($(u.mul_inv).val)\n\n@[simp]\nlemma add_inv_add_mul_eq_zero (u : (PreQuasiregular R)ˣ) :\n u.val.val + u⁻¹.val.val + u⁻¹.val.val * u.val.val = 0 := by\n simpa [-Units.inv_mul] using congr($(u.inv_mul).val)\n\nend PreQuasiregular\n\nnamespace Unitization\nopen PreQuasiregular\n\nvariable {R A : Type*} [CommSemiring R] [NonUnitalSemiring A] [Module R A] [IsScalarTower R A A]\n [SMulCommClass R A A]\n\nvariable (R A) in\n/-- The subgroup of the units of `Unitization R A` whose scalar part is `1`. -/\ndef unitsFstOne : Subgroup (Unitization R A)ˣ where\n carrier := {x | x.val.fst = 1}\n one_mem' := rfl\n mul_mem' {x} {y} (hx : x.val.fst = 1) (hy : y.val.fst = 1) := by simp [hx, hy]\n inv_mem' {x} (hx : x.val.fst = 1) := by\n simpa [-Units.mul_inv, hx] using congr(fstHom R A $(x.mul_inv))\n\n@[simp]\nlemma mem_unitsFstOne {x : (Unitization R A)ˣ} : x ∈ unitsFstOne R A ↔ x.val.fst = 1 := Iff.rfl\n\n@[simp]\nlemma unitsFstOne_val_val_fst (x : (unitsFstOne R A)) : x.val.val.fst = 1 :=\n mem_unitsFstOne.mp x.property\n\n@[simp]\nlemma unitsFstOne_val_inv_val_fst (x : (unitsFstOne R A)) : x.val⁻¹.val.fst = 1 :=\n mem_unitsFstOne.mp x⁻¹.property\n\nvariable (R) in\n/-- If `A` is a non-unital `R`-algebra, then the subgroup of units of `Unitization R A` whose\nscalar part is `1 : R` (i.e., `Unitization.unitsFstOne`) is isomorphic to the group of units of\n`PreQuasiregular A`. -/\n@[simps]\ndef unitsFstOne_mulEquiv_quasiregular : unitsFstOne R A ≃* (PreQuasiregular A)ˣ where\n toFun x :=\n { val := PreQuasiregular.equiv x.val.val.snd\n inv := PreQuasiregular.equiv x⁻¹.val.val.snd\n val_inv := PreQuasiregular.equiv.symm.injective <| by\n simpa [-Units.mul_inv] using congr($(x.val.mul_inv).snd)\n inv_val := PreQuasiregular.equiv.symm.injective <| by\n simpa [-Units.inv_mul] using congr($(x.val.inv_mul).snd) }\n invFun x :=\n { val :=\n { val := 1 + PreQuasiregular.equiv.symm x.val\n inv := 1 + PreQuasiregular.equiv.symm x⁻¹.val\n val_inv := by\n convert congr((1 + $(inv_add_add_mul_eq_zero x) : Unitization R A))\n · simp only [mul_one, PreQuasiregular.equiv_symm_apply, one_mul, mul_add,\n add_mul, inr_add, inr_mul]\n abel\n · simp only [inr_zero, add_zero]\n inv_val := by\n convert congr((1 + $(add_inv_add_mul_eq_zero x) : Unitization R A))\n · simp only [mul_one, PreQuasiregular.equiv_symm_apply, one_mul, mul_add,\n add_mul, inr_add, inr_mul]\n abel\n · simp only [inr_zero, add_zero] }\n property := by simp }\n left_inv x := Subtype.ext <| Units.ext <| by simpa using x.val.val.inl_fst_add_inr_snd_eq\n right_inv x := Units.ext <| by simp [-PreQuasiregular.equiv_symm_apply]\n map_mul' x y := Units.ext <| PreQuasiregular.equiv.symm.injective <| by simp\n\nend Unitization\n\nsection PreQuasiregular\n\nopen PreQuasiregular\n\nvariable {R : Type*} [NonUnitalSemiring R]\n\n/-- In a non-unital semiring `R`, an element `x : R` satisfies `IsQuasiregular` if it is a unit\nunder the monoid operation `fun x y ↦ y + x + x * y`. -/\ndef IsQuasiregular (x : R) : Prop :=\n ∃ u : (PreQuasiregular R)ˣ, equiv.symm u.val = x\n\n@[simp]\nlemma isQuasiregular_zero : IsQuasiregular 0 := ⟨1, rfl⟩\n\nTarget:\nlemma isQuasiregular_iff {x : R} :\n IsQuasiregular x ↔ ∃ y, y + x + x * y = 0 ∧ x + y + y * x = 0 :=\n\nProof body:\n","proof_body":"by\n constructor\n · rintro ⟨u, rfl⟩\n exact ⟨equiv.symm u⁻¹.val, by simp⟩\n · rintro ⟨y, hy₁, hy₂⟩\n refine ⟨⟨equiv x, equiv y, ?_, ?_⟩, rfl⟩\n all_goals\n apply equiv.symm.injective\n assumption","provenance":{"declaration_index":8,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"86daaff4a1e1ed9d97d7dcf185be7df0da41c9b2ae049e4a852eeedca7f99791","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Spectrum/Quasispectrum.lean"},"sample_id":"c576695d67d599bac5c2f317df533dcc8f26540d39fd4594f2beff57c844204b","schema_version":1,"split":"train","theorem_statement":"lemma isQuasiregular_iff {x : R} :\n IsQuasiregular x ↔ ∃ y, y + x + x * y = 0 ∧ x + y + y * x = 0 :="} {"completion":"by\n simp only [IsQuasiregular, IsUnit, Equiv.apply_symm_apply,\n ← PreQuasiregular.equiv (R := R).injective.eq_iff]","context_contains_namespace":false,"context_suffix":"end PreQuasiregular","dependency_ids":["import:Mathlib.Algebra.Algebra.Spectrum.Basic","import:Mathlib.Algebra.Algebra.Tower","import:Mathlib.Algebra.Algebra.Unitization"],"family_id":"isquasiregular_iff","file_id":"mathlib/Mathlib/Algebra/Algebra/Spectrum/Quasispectrum.lean","imports":["public import Mathlib.Algebra.Algebra.Spectrum.Basic","public import Mathlib.Algebra.Algebra.Tower","public import Mathlib.Algebra.Algebra.Unitization"],"local_context":"/-\nCopyright (c) 2024 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Quasiregularity and quasispectrum\n\nFor a non-unital ring `R`, an element `r : R` is *quasiregular* if it is invertible in the monoid\n`(R, ∘)` where `x ∘ y := y + x + x * y` with identity `0 : R`. We implement this both as a type\nsynonym `PreQuasiregular` which has an associated `Monoid` instance (note: *not* an `AddMonoid`\ninstance despite the fact that `0 : R` is the identity in this monoid) so that one may access\nthe quasiregular elements of `R` as `(PreQuasiregular R)ˣ`, but also as a predicate\n`IsQuasiregular`.\n\nQuasiregularity is closely tied to invertibility. Indeed, `(PreQuasiregular A)ˣ` is isomorphic to\nthe subgroup of `Unitization R A` whose scalar part is `1`, whenever `A` is a non-unital\n`R`-algebra, and moreover this isomorphism is implemented by the map\n`(x : A) ↦ (1 + x : Unitization R A)`. It is because of this isomorphism, and the associated ties\nwith multiplicative invertibility, that we choose a `Monoid` (as opposed to an `AddMonoid`)\nstructure on `PreQuasiregular`. In addition, in unital rings, we even have\n`IsQuasiregular x ↔ IsUnit (1 + x)`.\n\nThe *quasispectrum* of `a : A` (with respect to `R`) is defined in terms of quasiregularity, and\nthis is the natural analogue of the `spectrum` for non-unital rings. Indeed, it is true that\n`quasispectrum R a = spectrum R a ∪ {0}` when `A` is unital.\n\nIn Mathlib, the quasispectrum is the domain of the continuous functions associated to the\n*non-unital* continuous functional calculus.\n\n## Main definitions\n\n+ `PreQuasiregular R`: a structure wrapping `R` that inherits a distinct `Monoid` instance when `R`\n is a non-unital semiring.\n+ `Unitization.unitsFstOne`: the subgroup with carrier `{ x : (Unitization R A)ˣ | x.fst = 1 }`.\n+ `unitsFstOne_mulEquiv_quasiregular`: the group isomorphism between\n `Unitization.unitsFstOne` and the units of `PreQuasiregular` (i.e., the quasiregular elements)\n which sends `(1, x) ↦ x`.\n+ `IsQuasiregular x`: the proposition that `x : R` is a unit with respect to the monoid structure on\n `PreQuasiregular R`, i.e., there is some `u : (PreQuasiregular R)ˣ` such that `u.val` is\n identified with `x` (via the natural equivalence between `R` and `PreQuasiregular R`).\n+ `quasispectrum R a`: in an algebra over the semifield `R`, this is the set\n `{r : R | (hr : IsUnit r) → ¬ IsQuasiregular (-(hr.unit⁻¹ • a))}`, which should be thought of\n as a version of the `spectrum` which is applicable in non-unital algebras.\n\n## Main theorems\n\n+ `isQuasiregular_iff_isUnit`: in a unital ring, `x` is quasiregular if and only if `1 + x` is\n a unit.\n+ `quasispectrum_eq_spectrum_union_zero`: in a unital algebra `A` over a semifield `R`, the\n quasispectrum of `a : A` is the `spectrum` with zero added.\n+ `Unitization.isQuasiregular_inr_iff`: `a : A` is quasiregular if and only if it is quasiregular\n in `Unitization R A` (via the coercion `Unitization.inr`).\n+ `Unitization.quasispectrum_eq_spectrum_inr`: the quasispectrum of `a` in a non-unital `R`-algebra\n `A` is precisely the spectrum of `a` in `Unitization R A` (via the coercion `Unitization.inr`).\n-/\n\n@[expose] public section\n\n/-- A type synonym for non-unital rings where an alternative monoid structure is introduced.\nIf `R` is a non-unital semiring, then `PreQuasiregular R` is equipped with the monoid structure\nwith binary operation `fun x y ↦ y + x + x * y` and identity `0`. Elements of `R` which are\ninvertible in this monoid satisfy the predicate `IsQuasiregular`. -/\nstructure PreQuasiregular (R : Type*) where\n /-- The value wrapped into a term of `PreQuasiregular`. -/\n val : R\n\nnamespace PreQuasiregular\n\nvariable {R : Type*} [NonUnitalSemiring R]\n\n/-- The identity map between `R` and `PreQuasiregular R`. -/\n@[simps]\ndef equiv : R ≃ PreQuasiregular R where\n toFun := .mk\n invFun := PreQuasiregular.val\n\ninstance instOne : One (PreQuasiregular R) where\n one := equiv 0\n\n@[simp]\nlemma val_one : (1 : PreQuasiregular R).val = 0 := rfl\n\ninstance instMul : Mul (PreQuasiregular R) where\n mul x y := .mk (y.val + x.val + x.val * y.val)\n\n@[simp]\nlemma val_mul (x y : PreQuasiregular R) : (x * y).val = y.val + x.val + x.val * y.val := rfl\n\ninstance instMonoid : Monoid (PreQuasiregular R) where\n one := equiv 0\n mul x y := .mk (y.val + x.val + x.val * y.val)\n mul_one _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n one_mul _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n mul_assoc x y z := equiv.symm.injective <| by simp [mul_add, add_mul, mul_assoc]; abel\n\n@[simp]\nlemma inv_add_add_mul_eq_zero (u : (PreQuasiregular R)ˣ) :\n u⁻¹.val.val + u.val.val + u.val.val * u⁻¹.val.val = 0 := by\n simpa [-Units.mul_inv] using congr($(u.mul_inv).val)\n\n@[simp]\nlemma add_inv_add_mul_eq_zero (u : (PreQuasiregular R)ˣ) :\n u.val.val + u⁻¹.val.val + u⁻¹.val.val * u.val.val = 0 := by\n simpa [-Units.inv_mul] using congr($(u.inv_mul).val)\n\nend PreQuasiregular\n\nnamespace Unitization\nopen PreQuasiregular\n\nvariable {R A : Type*} [CommSemiring R] [NonUnitalSemiring A] [Module R A] [IsScalarTower R A A]\n [SMulCommClass R A A]\n\nvariable (R A) in\n/-- The subgroup of the units of `Unitization R A` whose scalar part is `1`. -/\ndef unitsFstOne : Subgroup (Unitization R A)ˣ where\n carrier := {x | x.val.fst = 1}\n one_mem' := rfl\n mul_mem' {x} {y} (hx : x.val.fst = 1) (hy : y.val.fst = 1) := by simp [hx, hy]\n inv_mem' {x} (hx : x.val.fst = 1) := by\n simpa [-Units.mul_inv, hx] using congr(fstHom R A $(x.mul_inv))\n\n@[simp]\nlemma mem_unitsFstOne {x : (Unitization R A)ˣ} : x ∈ unitsFstOne R A ↔ x.val.fst = 1 := Iff.rfl\n\n@[simp]\nlemma unitsFstOne_val_val_fst (x : (unitsFstOne R A)) : x.val.val.fst = 1 :=\n mem_unitsFstOne.mp x.property\n\n@[simp]\nlemma unitsFstOne_val_inv_val_fst (x : (unitsFstOne R A)) : x.val⁻¹.val.fst = 1 :=\n mem_unitsFstOne.mp x⁻¹.property\n\nvariable (R) in\n/-- If `A` is a non-unital `R`-algebra, then the subgroup of units of `Unitization R A` whose\nscalar part is `1 : R` (i.e., `Unitization.unitsFstOne`) is isomorphic to the group of units of\n`PreQuasiregular A`. -/\n@[simps]\ndef unitsFstOne_mulEquiv_quasiregular : unitsFstOne R A ≃* (PreQuasiregular A)ˣ where\n toFun x :=\n { val := PreQuasiregular.equiv x.val.val.snd\n inv := PreQuasiregular.equiv x⁻¹.val.val.snd\n val_inv := PreQuasiregular.equiv.symm.injective <| by\n simpa [-Units.mul_inv] using congr($(x.val.mul_inv).snd)\n inv_val := PreQuasiregular.equiv.symm.injective <| by\n simpa [-Units.inv_mul] using congr($(x.val.inv_mul).snd) }\n invFun x :=\n { val :=\n { val := 1 + PreQuasiregular.equiv.symm x.val\n inv := 1 + PreQuasiregular.equiv.symm x⁻¹.val\n val_inv := by\n convert congr((1 + $(inv_add_add_mul_eq_zero x) : Unitization R A))\n · simp only [mul_one, PreQuasiregular.equiv_symm_apply, one_mul, mul_add,\n add_mul, inr_add, inr_mul]\n abel\n · simp only [inr_zero, add_zero]\n inv_val := by\n convert congr((1 + $(add_inv_add_mul_eq_zero x) : Unitization R A))\n · simp only [mul_one, PreQuasiregular.equiv_symm_apply, one_mul, mul_add,\n add_mul, inr_add, inr_mul]\n abel\n · simp only [inr_zero, add_zero] }\n property := by simp }\n left_inv x := Subtype.ext <| Units.ext <| by simpa using x.val.val.inl_fst_add_inr_snd_eq\n right_inv x := Units.ext <| by simp [-PreQuasiregular.equiv_symm_apply]\n map_mul' x y := Units.ext <| PreQuasiregular.equiv.symm.injective <| by simp\n\nend Unitization\n\nsection PreQuasiregular\n\nopen PreQuasiregular\n\nvariable {R : Type*} [NonUnitalSemiring R]\n\n/-- In a non-unital semiring `R`, an element `x : R` satisfies `IsQuasiregular` if it is a unit\nunder the monoid operation `fun x y ↦ y + x + x * y`. -/\ndef IsQuasiregular (x : R) : Prop :=\n ∃ u : (PreQuasiregular R)ˣ, equiv.symm u.val = x\n\n@[simp]\nlemma isQuasiregular_zero : IsQuasiregular 0 := ⟨1, rfl⟩\n\nlemma isQuasiregular_iff {x : R} :\n IsQuasiregular x ↔ ∃ y, y + x + x * y = 0 ∧ x + y + y * x = 0 := by\n constructor\n · rintro ⟨u, rfl⟩\n exact ⟨equiv.symm u⁻¹.val, by simp⟩\n · rintro ⟨y, hy₁, hy₂⟩\n refine ⟨⟨equiv x, equiv y, ?_, ?_⟩, rfl⟩\n all_goals\n apply equiv.symm.injective\n assumption","module_header":true,"namespace":"","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Spectrum.Basic\npublic import Mathlib.Algebra.Algebra.Tower\npublic import Mathlib.Algebra.Algebra.Unitization\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2024 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Quasiregularity and quasispectrum\n\nFor a non-unital ring `R`, an element `r : R` is *quasiregular* if it is invertible in the monoid\n`(R, ∘)` where `x ∘ y := y + x + x * y` with identity `0 : R`. We implement this both as a type\nsynonym `PreQuasiregular` which has an associated `Monoid` instance (note: *not* an `AddMonoid`\ninstance despite the fact that `0 : R` is the identity in this monoid) so that one may access\nthe quasiregular elements of `R` as `(PreQuasiregular R)ˣ`, but also as a predicate\n`IsQuasiregular`.\n\nQuasiregularity is closely tied to invertibility. Indeed, `(PreQuasiregular A)ˣ` is isomorphic to\nthe subgroup of `Unitization R A` whose scalar part is `1`, whenever `A` is a non-unital\n`R`-algebra, and moreover this isomorphism is implemented by the map\n`(x : A) ↦ (1 + x : Unitization R A)`. It is because of this isomorphism, and the associated ties\nwith multiplicative invertibility, that we choose a `Monoid` (as opposed to an `AddMonoid`)\nstructure on `PreQuasiregular`. In addition, in unital rings, we even have\n`IsQuasiregular x ↔ IsUnit (1 + x)`.\n\nThe *quasispectrum* of `a : A` (with respect to `R`) is defined in terms of quasiregularity, and\nthis is the natural analogue of the `spectrum` for non-unital rings. Indeed, it is true that\n`quasispectrum R a = spectrum R a ∪ {0}` when `A` is unital.\n\nIn Mathlib, the quasispectrum is the domain of the continuous functions associated to the\n*non-unital* continuous functional calculus.\n\n## Main definitions\n\n+ `PreQuasiregular R`: a structure wrapping `R` that inherits a distinct `Monoid` instance when `R`\n is a non-unital semiring.\n+ `Unitization.unitsFstOne`: the subgroup with carrier `{ x : (Unitization R A)ˣ | x.fst = 1 }`.\n+ `unitsFstOne_mulEquiv_quasiregular`: the group isomorphism between\n `Unitization.unitsFstOne` and the units of `PreQuasiregular` (i.e., the quasiregular elements)\n which sends `(1, x) ↦ x`.\n+ `IsQuasiregular x`: the proposition that `x : R` is a unit with respect to the monoid structure on\n `PreQuasiregular R`, i.e., there is some `u : (PreQuasiregular R)ˣ` such that `u.val` is\n identified with `x` (via the natural equivalence between `R` and `PreQuasiregular R`).\n+ `quasispectrum R a`: in an algebra over the semifield `R`, this is the set\n `{r : R | (hr : IsUnit r) → ¬ IsQuasiregular (-(hr.unit⁻¹ • a))}`, which should be thought of\n as a version of the `spectrum` which is applicable in non-unital algebras.\n\n## Main theorems\n\n+ `isQuasiregular_iff_isUnit`: in a unital ring, `x` is quasiregular if and only if `1 + x` is\n a unit.\n+ `quasispectrum_eq_spectrum_union_zero`: in a unital algebra `A` over a semifield `R`, the\n quasispectrum of `a : A` is the `spectrum` with zero added.\n+ `Unitization.isQuasiregular_inr_iff`: `a : A` is quasiregular if and only if it is quasiregular\n in `Unitization R A` (via the coercion `Unitization.inr`).\n+ `Unitization.quasispectrum_eq_spectrum_inr`: the quasispectrum of `a` in a non-unital `R`-algebra\n `A` is precisely the spectrum of `a` in `Unitization R A` (via the coercion `Unitization.inr`).\n-/\n\n@[expose] public section\n\n/-- A type synonym for non-unital rings where an alternative monoid structure is introduced.\nIf `R` is a non-unital semiring, then `PreQuasiregular R` is equipped with the monoid structure\nwith binary operation `fun x y ↦ y + x + x * y` and identity `0`. Elements of `R` which are\ninvertible in this monoid satisfy the predicate `IsQuasiregular`. -/\nstructure PreQuasiregular (R : Type*) where\n /-- The value wrapped into a term of `PreQuasiregular`. -/\n val : R\n\nnamespace PreQuasiregular\n\nvariable {R : Type*} [NonUnitalSemiring R]\n\n/-- The identity map between `R` and `PreQuasiregular R`. -/\n@[simps]\ndef equiv : R ≃ PreQuasiregular R where\n toFun := .mk\n invFun := PreQuasiregular.val\n\ninstance instOne : One (PreQuasiregular R) where\n one := equiv 0\n\n@[simp]\nlemma val_one : (1 : PreQuasiregular R).val = 0 := rfl\n\ninstance instMul : Mul (PreQuasiregular R) where\n mul x y := .mk (y.val + x.val + x.val * y.val)\n\n@[simp]\nlemma val_mul (x y : PreQuasiregular R) : (x * y).val = y.val + x.val + x.val * y.val := rfl\n\ninstance instMonoid : Monoid (PreQuasiregular R) where\n one := equiv 0\n mul x y := .mk (y.val + x.val + x.val * y.val)\n mul_one _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n one_mul _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n mul_assoc x y z := equiv.symm.injective <| by simp [mul_add, add_mul, mul_assoc]; abel\n\n@[simp]\nlemma inv_add_add_mul_eq_zero (u : (PreQuasiregular R)ˣ) :\n u⁻¹.val.val + u.val.val + u.val.val * u⁻¹.val.val = 0 := by\n simpa [-Units.mul_inv] using congr($(u.mul_inv).val)\n\n@[simp]\nlemma add_inv_add_mul_eq_zero (u : (PreQuasiregular R)ˣ) :\n u.val.val + u⁻¹.val.val + u⁻¹.val.val * u.val.val = 0 := by\n simpa [-Units.inv_mul] using congr($(u.inv_mul).val)\n\nend PreQuasiregular\n\nnamespace Unitization\nopen PreQuasiregular\n\nvariable {R A : Type*} [CommSemiring R] [NonUnitalSemiring A] [Module R A] [IsScalarTower R A A]\n [SMulCommClass R A A]\n\nvariable (R A) in\n/-- The subgroup of the units of `Unitization R A` whose scalar part is `1`. -/\ndef unitsFstOne : Subgroup (Unitization R A)ˣ where\n carrier := {x | x.val.fst = 1}\n one_mem' := rfl\n mul_mem' {x} {y} (hx : x.val.fst = 1) (hy : y.val.fst = 1) := by simp [hx, hy]\n inv_mem' {x} (hx : x.val.fst = 1) := by\n simpa [-Units.mul_inv, hx] using congr(fstHom R A $(x.mul_inv))\n\n@[simp]\nlemma mem_unitsFstOne {x : (Unitization R A)ˣ} : x ∈ unitsFstOne R A ↔ x.val.fst = 1 := Iff.rfl\n\n@[simp]\nlemma unitsFstOne_val_val_fst (x : (unitsFstOne R A)) : x.val.val.fst = 1 :=\n mem_unitsFstOne.mp x.property\n\n@[simp]\nlemma unitsFstOne_val_inv_val_fst (x : (unitsFstOne R A)) : x.val⁻¹.val.fst = 1 :=\n mem_unitsFstOne.mp x⁻¹.property\n\nvariable (R) in\n/-- If `A` is a non-unital `R`-algebra, then the subgroup of units of `Unitization R A` whose\nscalar part is `1 : R` (i.e., `Unitization.unitsFstOne`) is isomorphic to the group of units of\n`PreQuasiregular A`. -/\n@[simps]\ndef unitsFstOne_mulEquiv_quasiregular : unitsFstOne R A ≃* (PreQuasiregular A)ˣ where\n toFun x :=\n { val := PreQuasiregular.equiv x.val.val.snd\n inv := PreQuasiregular.equiv x⁻¹.val.val.snd\n val_inv := PreQuasiregular.equiv.symm.injective <| by\n simpa [-Units.mul_inv] using congr($(x.val.mul_inv).snd)\n inv_val := PreQuasiregular.equiv.symm.injective <| by\n simpa [-Units.inv_mul] using congr($(x.val.inv_mul).snd) }\n invFun x :=\n { val :=\n { val := 1 + PreQuasiregular.equiv.symm x.val\n inv := 1 + PreQuasiregular.equiv.symm x⁻¹.val\n val_inv := by\n convert congr((1 + $(inv_add_add_mul_eq_zero x) : Unitization R A))\n · simp only [mul_one, PreQuasiregular.equiv_symm_apply, one_mul, mul_add,\n add_mul, inr_add, inr_mul]\n abel\n · simp only [inr_zero, add_zero]\n inv_val := by\n convert congr((1 + $(add_inv_add_mul_eq_zero x) : Unitization R A))\n · simp only [mul_one, PreQuasiregular.equiv_symm_apply, one_mul, mul_add,\n add_mul, inr_add, inr_mul]\n abel\n · simp only [inr_zero, add_zero] }\n property := by simp }\n left_inv x := Subtype.ext <| Units.ext <| by simpa using x.val.val.inl_fst_add_inr_snd_eq\n right_inv x := Units.ext <| by simp [-PreQuasiregular.equiv_symm_apply]\n map_mul' x y := Units.ext <| PreQuasiregular.equiv.symm.injective <| by simp\n\nend Unitization\n\nsection PreQuasiregular\n\nopen PreQuasiregular\n\nvariable {R : Type*} [NonUnitalSemiring R]\n\n/-- In a non-unital semiring `R`, an element `x : R` satisfies `IsQuasiregular` if it is a unit\nunder the monoid operation `fun x y ↦ y + x + x * y`. -/\ndef IsQuasiregular (x : R) : Prop :=\n ∃ u : (PreQuasiregular R)ˣ, equiv.symm u.val = x\n\n@[simp]\nlemma isQuasiregular_zero : IsQuasiregular 0 := ⟨1, rfl⟩\n\nlemma isQuasiregular_iff {x : R} :\n IsQuasiregular x ↔ ∃ y, y + x + x * y = 0 ∧ x + y + y * x = 0 := by\n constructor\n · rintro ⟨u, rfl⟩\n exact ⟨equiv.symm u⁻¹.val, by simp⟩\n · rintro ⟨y, hy₁, hy₂⟩\n refine ⟨⟨equiv x, equiv y, ?_, ?_⟩, rfl⟩\n all_goals\n apply equiv.symm.injective\n assumption\n\nTarget:\nlemma isQuasiregular_iff' {x : R} : IsQuasiregular x ↔ IsUnit (PreQuasiregular.equiv x) :=\n\nProof body:\n","proof_body":"by\n simp only [IsQuasiregular, IsUnit, Equiv.apply_symm_apply,\n ← PreQuasiregular.equiv (R := R).injective.eq_iff]","provenance":{"declaration_index":9,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"86daaff4a1e1ed9d97d7dcf185be7df0da41c9b2ae049e4a852eeedca7f99791","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Spectrum/Quasispectrum.lean"},"sample_id":"d368671c6e41c00cc60d6ba518ad405dee3e6340258f020338088bdc575aa12e","schema_version":1,"split":"train","theorem_statement":"lemma isQuasiregular_iff' {x : R} : IsQuasiregular x ↔ IsUnit (PreQuasiregular.equiv x) :="} {"completion":"by\n rw [isQuasiregular_iff] at hx ⊢\n obtain ⟨y, hy₁, hy₂⟩ := hx\n exact ⟨f y, by simpa using And.intro congr(f $(hy₁)) congr(f $(hy₂))⟩","context_contains_namespace":false,"context_suffix":"","dependency_ids":["import:Mathlib.Algebra.Algebra.Spectrum.Basic","import:Mathlib.Algebra.Algebra.Tower","import:Mathlib.Algebra.Algebra.Unitization"],"family_id":"isquasiregular","file_id":"mathlib/Mathlib/Algebra/Algebra/Spectrum/Quasispectrum.lean","imports":["public import Mathlib.Algebra.Algebra.Spectrum.Basic","public import Mathlib.Algebra.Algebra.Tower","public import Mathlib.Algebra.Algebra.Unitization"],"local_context":"/-\nCopyright (c) 2024 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Quasiregularity and quasispectrum\n\nFor a non-unital ring `R`, an element `r : R` is *quasiregular* if it is invertible in the monoid\n`(R, ∘)` where `x ∘ y := y + x + x * y` with identity `0 : R`. We implement this both as a type\nsynonym `PreQuasiregular` which has an associated `Monoid` instance (note: *not* an `AddMonoid`\ninstance despite the fact that `0 : R` is the identity in this monoid) so that one may access\nthe quasiregular elements of `R` as `(PreQuasiregular R)ˣ`, but also as a predicate\n`IsQuasiregular`.\n\nQuasiregularity is closely tied to invertibility. Indeed, `(PreQuasiregular A)ˣ` is isomorphic to\nthe subgroup of `Unitization R A` whose scalar part is `1`, whenever `A` is a non-unital\n`R`-algebra, and moreover this isomorphism is implemented by the map\n`(x : A) ↦ (1 + x : Unitization R A)`. It is because of this isomorphism, and the associated ties\nwith multiplicative invertibility, that we choose a `Monoid` (as opposed to an `AddMonoid`)\nstructure on `PreQuasiregular`. In addition, in unital rings, we even have\n`IsQuasiregular x ↔ IsUnit (1 + x)`.\n\nThe *quasispectrum* of `a : A` (with respect to `R`) is defined in terms of quasiregularity, and\nthis is the natural analogue of the `spectrum` for non-unital rings. Indeed, it is true that\n`quasispectrum R a = spectrum R a ∪ {0}` when `A` is unital.\n\nIn Mathlib, the quasispectrum is the domain of the continuous functions associated to the\n*non-unital* continuous functional calculus.\n\n## Main definitions\n\n+ `PreQuasiregular R`: a structure wrapping `R` that inherits a distinct `Monoid` instance when `R`\n is a non-unital semiring.\n+ `Unitization.unitsFstOne`: the subgroup with carrier `{ x : (Unitization R A)ˣ | x.fst = 1 }`.\n+ `unitsFstOne_mulEquiv_quasiregular`: the group isomorphism between\n `Unitization.unitsFstOne` and the units of `PreQuasiregular` (i.e., the quasiregular elements)\n which sends `(1, x) ↦ x`.\n+ `IsQuasiregular x`: the proposition that `x : R` is a unit with respect to the monoid structure on\n `PreQuasiregular R`, i.e., there is some `u : (PreQuasiregular R)ˣ` such that `u.val` is\n identified with `x` (via the natural equivalence between `R` and `PreQuasiregular R`).\n+ `quasispectrum R a`: in an algebra over the semifield `R`, this is the set\n `{r : R | (hr : IsUnit r) → ¬ IsQuasiregular (-(hr.unit⁻¹ • a))}`, which should be thought of\n as a version of the `spectrum` which is applicable in non-unital algebras.\n\n## Main theorems\n\n+ `isQuasiregular_iff_isUnit`: in a unital ring, `x` is quasiregular if and only if `1 + x` is\n a unit.\n+ `quasispectrum_eq_spectrum_union_zero`: in a unital algebra `A` over a semifield `R`, the\n quasispectrum of `a : A` is the `spectrum` with zero added.\n+ `Unitization.isQuasiregular_inr_iff`: `a : A` is quasiregular if and only if it is quasiregular\n in `Unitization R A` (via the coercion `Unitization.inr`).\n+ `Unitization.quasispectrum_eq_spectrum_inr`: the quasispectrum of `a` in a non-unital `R`-algebra\n `A` is precisely the spectrum of `a` in `Unitization R A` (via the coercion `Unitization.inr`).\n-/\n\n@[expose] public section\n\n/-- A type synonym for non-unital rings where an alternative monoid structure is introduced.\nIf `R` is a non-unital semiring, then `PreQuasiregular R` is equipped with the monoid structure\nwith binary operation `fun x y ↦ y + x + x * y` and identity `0`. Elements of `R` which are\ninvertible in this monoid satisfy the predicate `IsQuasiregular`. -/\nstructure PreQuasiregular (R : Type*) where\n /-- The value wrapped into a term of `PreQuasiregular`. -/\n val : R\n\nnamespace PreQuasiregular\n\nvariable {R : Type*} [NonUnitalSemiring R]\n\n/-- The identity map between `R` and `PreQuasiregular R`. -/\n@[simps]\ndef equiv : R ≃ PreQuasiregular R where\n toFun := .mk\n invFun := PreQuasiregular.val\n\ninstance instOne : One (PreQuasiregular R) where\n one := equiv 0\n\n@[simp]\nlemma val_one : (1 : PreQuasiregular R).val = 0 := rfl\n\ninstance instMul : Mul (PreQuasiregular R) where\n mul x y := .mk (y.val + x.val + x.val * y.val)\n\n@[simp]\nlemma val_mul (x y : PreQuasiregular R) : (x * y).val = y.val + x.val + x.val * y.val := rfl\n\ninstance instMonoid : Monoid (PreQuasiregular R) where\n one := equiv 0\n mul x y := .mk (y.val + x.val + x.val * y.val)\n mul_one _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n one_mul _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n mul_assoc x y z := equiv.symm.injective <| by simp [mul_add, add_mul, mul_assoc]; abel\n\n@[simp]\nlemma inv_add_add_mul_eq_zero (u : (PreQuasiregular R)ˣ) :\n u⁻¹.val.val + u.val.val + u.val.val * u⁻¹.val.val = 0 := by\n simpa [-Units.mul_inv] using congr($(u.mul_inv).val)\n\n@[simp]\nlemma add_inv_add_mul_eq_zero (u : (PreQuasiregular R)ˣ) :\n u.val.val + u⁻¹.val.val + u⁻¹.val.val * u.val.val = 0 := by\n simpa [-Units.inv_mul] using congr($(u.inv_mul).val)\n\nend PreQuasiregular\n\nnamespace Unitization\nopen PreQuasiregular\n\nvariable {R A : Type*} [CommSemiring R] [NonUnitalSemiring A] [Module R A] [IsScalarTower R A A]\n [SMulCommClass R A A]\n\nvariable (R A) in\n/-- The subgroup of the units of `Unitization R A` whose scalar part is `1`. -/\ndef unitsFstOne : Subgroup (Unitization R A)ˣ where\n carrier := {x | x.val.fst = 1}\n one_mem' := rfl\n mul_mem' {x} {y} (hx : x.val.fst = 1) (hy : y.val.fst = 1) := by simp [hx, hy]\n inv_mem' {x} (hx : x.val.fst = 1) := by\n simpa [-Units.mul_inv, hx] using congr(fstHom R A $(x.mul_inv))\n\n@[simp]\nlemma mem_unitsFstOne {x : (Unitization R A)ˣ} : x ∈ unitsFstOne R A ↔ x.val.fst = 1 := Iff.rfl\n\n@[simp]\nlemma unitsFstOne_val_val_fst (x : (unitsFstOne R A)) : x.val.val.fst = 1 :=\n mem_unitsFstOne.mp x.property\n\n@[simp]\nlemma unitsFstOne_val_inv_val_fst (x : (unitsFstOne R A)) : x.val⁻¹.val.fst = 1 :=\n mem_unitsFstOne.mp x⁻¹.property\n\nvariable (R) in\n/-- If `A` is a non-unital `R`-algebra, then the subgroup of units of `Unitization R A` whose\nscalar part is `1 : R` (i.e., `Unitization.unitsFstOne`) is isomorphic to the group of units of\n`PreQuasiregular A`. -/\n@[simps]\ndef unitsFstOne_mulEquiv_quasiregular : unitsFstOne R A ≃* (PreQuasiregular A)ˣ where\n toFun x :=\n { val := PreQuasiregular.equiv x.val.val.snd\n inv := PreQuasiregular.equiv x⁻¹.val.val.snd\n val_inv := PreQuasiregular.equiv.symm.injective <| by\n simpa [-Units.mul_inv] using congr($(x.val.mul_inv).snd)\n inv_val := PreQuasiregular.equiv.symm.injective <| by\n simpa [-Units.inv_mul] using congr($(x.val.inv_mul).snd) }\n invFun x :=\n { val :=\n { val := 1 + PreQuasiregular.equiv.symm x.val\n inv := 1 + PreQuasiregular.equiv.symm x⁻¹.val\n val_inv := by\n convert congr((1 + $(inv_add_add_mul_eq_zero x) : Unitization R A))\n · simp only [mul_one, PreQuasiregular.equiv_symm_apply, one_mul, mul_add,\n add_mul, inr_add, inr_mul]\n abel\n · simp only [inr_zero, add_zero]\n inv_val := by\n convert congr((1 + $(add_inv_add_mul_eq_zero x) : Unitization R A))\n · simp only [mul_one, PreQuasiregular.equiv_symm_apply, one_mul, mul_add,\n add_mul, inr_add, inr_mul]\n abel\n · simp only [inr_zero, add_zero] }\n property := by simp }\n left_inv x := Subtype.ext <| Units.ext <| by simpa using x.val.val.inl_fst_add_inr_snd_eq\n right_inv x := Units.ext <| by simp [-PreQuasiregular.equiv_symm_apply]\n map_mul' x y := Units.ext <| PreQuasiregular.equiv.symm.injective <| by simp\n\nend Unitization\n\nsection PreQuasiregular\n\nopen PreQuasiregular\n\nvariable {R : Type*} [NonUnitalSemiring R]\n\n/-- In a non-unital semiring `R`, an element `x : R` satisfies `IsQuasiregular` if it is a unit\nunder the monoid operation `fun x y ↦ y + x + x * y`. -/\ndef IsQuasiregular (x : R) : Prop :=\n ∃ u : (PreQuasiregular R)ˣ, equiv.symm u.val = x\n\n@[simp]\nlemma isQuasiregular_zero : IsQuasiregular 0 := ⟨1, rfl⟩\n\nlemma isQuasiregular_iff {x : R} :\n IsQuasiregular x ↔ ∃ y, y + x + x * y = 0 ∧ x + y + y * x = 0 := by\n constructor\n · rintro ⟨u, rfl⟩\n exact ⟨equiv.symm u⁻¹.val, by simp⟩\n · rintro ⟨y, hy₁, hy₂⟩\n refine ⟨⟨equiv x, equiv y, ?_, ?_⟩, rfl⟩\n all_goals\n apply equiv.symm.injective\n assumption\n\nlemma isQuasiregular_iff' {x : R} : IsQuasiregular x ↔ IsUnit (PreQuasiregular.equiv x) := by\n simp only [IsQuasiregular, IsUnit, Equiv.apply_symm_apply,\n ← PreQuasiregular.equiv (R := R).injective.eq_iff]\n\nend PreQuasiregular","module_header":true,"namespace":"","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Spectrum.Basic\npublic import Mathlib.Algebra.Algebra.Tower\npublic import Mathlib.Algebra.Algebra.Unitization\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2024 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Quasiregularity and quasispectrum\n\nFor a non-unital ring `R`, an element `r : R` is *quasiregular* if it is invertible in the monoid\n`(R, ∘)` where `x ∘ y := y + x + x * y` with identity `0 : R`. We implement this both as a type\nsynonym `PreQuasiregular` which has an associated `Monoid` instance (note: *not* an `AddMonoid`\ninstance despite the fact that `0 : R` is the identity in this monoid) so that one may access\nthe quasiregular elements of `R` as `(PreQuasiregular R)ˣ`, but also as a predicate\n`IsQuasiregular`.\n\nQuasiregularity is closely tied to invertibility. Indeed, `(PreQuasiregular A)ˣ` is isomorphic to\nthe subgroup of `Unitization R A` whose scalar part is `1`, whenever `A` is a non-unital\n`R`-algebra, and moreover this isomorphism is implemented by the map\n`(x : A) ↦ (1 + x : Unitization R A)`. It is because of this isomorphism, and the associated ties\nwith multiplicative invertibility, that we choose a `Monoid` (as opposed to an `AddMonoid`)\nstructure on `PreQuasiregular`. In addition, in unital rings, we even have\n`IsQuasiregular x ↔ IsUnit (1 + x)`.\n\nThe *quasispectrum* of `a : A` (with respect to `R`) is defined in terms of quasiregularity, and\nthis is the natural analogue of the `spectrum` for non-unital rings. Indeed, it is true that\n`quasispectrum R a = spectrum R a ∪ {0}` when `A` is unital.\n\nIn Mathlib, the quasispectrum is the domain of the continuous functions associated to the\n*non-unital* continuous functional calculus.\n\n## Main definitions\n\n+ `PreQuasiregular R`: a structure wrapping `R` that inherits a distinct `Monoid` instance when `R`\n is a non-unital semiring.\n+ `Unitization.unitsFstOne`: the subgroup with carrier `{ x : (Unitization R A)ˣ | x.fst = 1 }`.\n+ `unitsFstOne_mulEquiv_quasiregular`: the group isomorphism between\n `Unitization.unitsFstOne` and the units of `PreQuasiregular` (i.e., the quasiregular elements)\n which sends `(1, x) ↦ x`.\n+ `IsQuasiregular x`: the proposition that `x : R` is a unit with respect to the monoid structure on\n `PreQuasiregular R`, i.e., there is some `u : (PreQuasiregular R)ˣ` such that `u.val` is\n identified with `x` (via the natural equivalence between `R` and `PreQuasiregular R`).\n+ `quasispectrum R a`: in an algebra over the semifield `R`, this is the set\n `{r : R | (hr : IsUnit r) → ¬ IsQuasiregular (-(hr.unit⁻¹ • a))}`, which should be thought of\n as a version of the `spectrum` which is applicable in non-unital algebras.\n\n## Main theorems\n\n+ `isQuasiregular_iff_isUnit`: in a unital ring, `x` is quasiregular if and only if `1 + x` is\n a unit.\n+ `quasispectrum_eq_spectrum_union_zero`: in a unital algebra `A` over a semifield `R`, the\n quasispectrum of `a : A` is the `spectrum` with zero added.\n+ `Unitization.isQuasiregular_inr_iff`: `a : A` is quasiregular if and only if it is quasiregular\n in `Unitization R A` (via the coercion `Unitization.inr`).\n+ `Unitization.quasispectrum_eq_spectrum_inr`: the quasispectrum of `a` in a non-unital `R`-algebra\n `A` is precisely the spectrum of `a` in `Unitization R A` (via the coercion `Unitization.inr`).\n-/\n\n@[expose] public section\n\n/-- A type synonym for non-unital rings where an alternative monoid structure is introduced.\nIf `R` is a non-unital semiring, then `PreQuasiregular R` is equipped with the monoid structure\nwith binary operation `fun x y ↦ y + x + x * y` and identity `0`. Elements of `R` which are\ninvertible in this monoid satisfy the predicate `IsQuasiregular`. -/\nstructure PreQuasiregular (R : Type*) where\n /-- The value wrapped into a term of `PreQuasiregular`. -/\n val : R\n\nnamespace PreQuasiregular\n\nvariable {R : Type*} [NonUnitalSemiring R]\n\n/-- The identity map between `R` and `PreQuasiregular R`. -/\n@[simps]\ndef equiv : R ≃ PreQuasiregular R where\n toFun := .mk\n invFun := PreQuasiregular.val\n\ninstance instOne : One (PreQuasiregular R) where\n one := equiv 0\n\n@[simp]\nlemma val_one : (1 : PreQuasiregular R).val = 0 := rfl\n\ninstance instMul : Mul (PreQuasiregular R) where\n mul x y := .mk (y.val + x.val + x.val * y.val)\n\n@[simp]\nlemma val_mul (x y : PreQuasiregular R) : (x * y).val = y.val + x.val + x.val * y.val := rfl\n\ninstance instMonoid : Monoid (PreQuasiregular R) where\n one := equiv 0\n mul x y := .mk (y.val + x.val + x.val * y.val)\n mul_one _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n one_mul _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n mul_assoc x y z := equiv.symm.injective <| by simp [mul_add, add_mul, mul_assoc]; abel\n\n@[simp]\nlemma inv_add_add_mul_eq_zero (u : (PreQuasiregular R)ˣ) :\n u⁻¹.val.val + u.val.val + u.val.val * u⁻¹.val.val = 0 := by\n simpa [-Units.mul_inv] using congr($(u.mul_inv).val)\n\n@[simp]\nlemma add_inv_add_mul_eq_zero (u : (PreQuasiregular R)ˣ) :\n u.val.val + u⁻¹.val.val + u⁻¹.val.val * u.val.val = 0 := by\n simpa [-Units.inv_mul] using congr($(u.inv_mul).val)\n\nend PreQuasiregular\n\nnamespace Unitization\nopen PreQuasiregular\n\nvariable {R A : Type*} [CommSemiring R] [NonUnitalSemiring A] [Module R A] [IsScalarTower R A A]\n [SMulCommClass R A A]\n\nvariable (R A) in\n/-- The subgroup of the units of `Unitization R A` whose scalar part is `1`. -/\ndef unitsFstOne : Subgroup (Unitization R A)ˣ where\n carrier := {x | x.val.fst = 1}\n one_mem' := rfl\n mul_mem' {x} {y} (hx : x.val.fst = 1) (hy : y.val.fst = 1) := by simp [hx, hy]\n inv_mem' {x} (hx : x.val.fst = 1) := by\n simpa [-Units.mul_inv, hx] using congr(fstHom R A $(x.mul_inv))\n\n@[simp]\nlemma mem_unitsFstOne {x : (Unitization R A)ˣ} : x ∈ unitsFstOne R A ↔ x.val.fst = 1 := Iff.rfl\n\n@[simp]\nlemma unitsFstOne_val_val_fst (x : (unitsFstOne R A)) : x.val.val.fst = 1 :=\n mem_unitsFstOne.mp x.property\n\n@[simp]\nlemma unitsFstOne_val_inv_val_fst (x : (unitsFstOne R A)) : x.val⁻¹.val.fst = 1 :=\n mem_unitsFstOne.mp x⁻¹.property\n\nvariable (R) in\n/-- If `A` is a non-unital `R`-algebra, then the subgroup of units of `Unitization R A` whose\nscalar part is `1 : R` (i.e., `Unitization.unitsFstOne`) is isomorphic to the group of units of\n`PreQuasiregular A`. -/\n@[simps]\ndef unitsFstOne_mulEquiv_quasiregular : unitsFstOne R A ≃* (PreQuasiregular A)ˣ where\n toFun x :=\n { val := PreQuasiregular.equiv x.val.val.snd\n inv := PreQuasiregular.equiv x⁻¹.val.val.snd\n val_inv := PreQuasiregular.equiv.symm.injective <| by\n simpa [-Units.mul_inv] using congr($(x.val.mul_inv).snd)\n inv_val := PreQuasiregular.equiv.symm.injective <| by\n simpa [-Units.inv_mul] using congr($(x.val.inv_mul).snd) }\n invFun x :=\n { val :=\n { val := 1 + PreQuasiregular.equiv.symm x.val\n inv := 1 + PreQuasiregular.equiv.symm x⁻¹.val\n val_inv := by\n convert congr((1 + $(inv_add_add_mul_eq_zero x) : Unitization R A))\n · simp only [mul_one, PreQuasiregular.equiv_symm_apply, one_mul, mul_add,\n add_mul, inr_add, inr_mul]\n abel\n · simp only [inr_zero, add_zero]\n inv_val := by\n convert congr((1 + $(add_inv_add_mul_eq_zero x) : Unitization R A))\n · simp only [mul_one, PreQuasiregular.equiv_symm_apply, one_mul, mul_add,\n add_mul, inr_add, inr_mul]\n abel\n · simp only [inr_zero, add_zero] }\n property := by simp }\n left_inv x := Subtype.ext <| Units.ext <| by simpa using x.val.val.inl_fst_add_inr_snd_eq\n right_inv x := Units.ext <| by simp [-PreQuasiregular.equiv_symm_apply]\n map_mul' x y := Units.ext <| PreQuasiregular.equiv.symm.injective <| by simp\n\nend Unitization\n\nsection PreQuasiregular\n\nopen PreQuasiregular\n\nvariable {R : Type*} [NonUnitalSemiring R]\n\n/-- In a non-unital semiring `R`, an element `x : R` satisfies `IsQuasiregular` if it is a unit\nunder the monoid operation `fun x y ↦ y + x + x * y`. -/\ndef IsQuasiregular (x : R) : Prop :=\n ∃ u : (PreQuasiregular R)ˣ, equiv.symm u.val = x\n\n@[simp]\nlemma isQuasiregular_zero : IsQuasiregular 0 := ⟨1, rfl⟩\n\nlemma isQuasiregular_iff {x : R} :\n IsQuasiregular x ↔ ∃ y, y + x + x * y = 0 ∧ x + y + y * x = 0 := by\n constructor\n · rintro ⟨u, rfl⟩\n exact ⟨equiv.symm u⁻¹.val, by simp⟩\n · rintro ⟨y, hy₁, hy₂⟩\n refine ⟨⟨equiv x, equiv y, ?_, ?_⟩, rfl⟩\n all_goals\n apply equiv.symm.injective\n assumption\n\nlemma isQuasiregular_iff' {x : R} : IsQuasiregular x ↔ IsUnit (PreQuasiregular.equiv x) := by\n simp only [IsQuasiregular, IsUnit, Equiv.apply_symm_apply,\n ← PreQuasiregular.equiv (R := R).injective.eq_iff]\n\nend PreQuasiregular\n\nTarget:\nlemma IsQuasiregular.map {F R S : Type*} [NonUnitalSemiring R] [NonUnitalSemiring S]\n [FunLike F R S] [NonUnitalRingHomClass F R S] (f : F) {x : R} (hx : IsQuasiregular x) :\n IsQuasiregular (f x) :=\n\nProof body:\n","proof_body":"by\n rw [isQuasiregular_iff] at hx ⊢\n obtain ⟨y, hy₁, hy₂⟩ := hx\n exact ⟨f y, by simpa using And.intro congr(f $(hy₁)) congr(f $(hy₂))⟩","provenance":{"declaration_index":10,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"86daaff4a1e1ed9d97d7dcf185be7df0da41c9b2ae049e4a852eeedca7f99791","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Spectrum/Quasispectrum.lean"},"sample_id":"a2429b00d5d381fccaa1fbccf4e7bf60a79206bf284ecaa371846c7d80aba9a1","schema_version":1,"split":"train","theorem_statement":"lemma IsQuasiregular.map {F R S : Type*} [NonUnitalSemiring R] [NonUnitalSemiring S]\n [FunLike F R S] [NonUnitalRingHomClass F R S] (f : F) {x : R} (hx : IsQuasiregular x) :\n IsQuasiregular (f x) :="} {"completion":"by\n obtain ⟨y, hy₁, hy₂⟩ := isQuasiregular_iff.mp hx\n refine ⟨⟨1 + x, 1 + y, ?_, ?_⟩, rfl⟩\n · convert congr(1 + $(hy₁)) <;> [noncomm_ring; simp]\n · convert congr(1 + $(hy₂)) <;> [noncomm_ring; simp]","context_contains_namespace":false,"context_suffix":"","dependency_ids":["import:Mathlib.Algebra.Algebra.Spectrum.Basic","import:Mathlib.Algebra.Algebra.Tower","import:Mathlib.Algebra.Algebra.Unitization"],"family_id":"isquasiregular","file_id":"mathlib/Mathlib/Algebra/Algebra/Spectrum/Quasispectrum.lean","imports":["public import Mathlib.Algebra.Algebra.Spectrum.Basic","public import Mathlib.Algebra.Algebra.Tower","public import Mathlib.Algebra.Algebra.Unitization"],"local_context":"/-\nCopyright (c) 2024 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Quasiregularity and quasispectrum\n\nFor a non-unital ring `R`, an element `r : R` is *quasiregular* if it is invertible in the monoid\n`(R, ∘)` where `x ∘ y := y + x + x * y` with identity `0 : R`. We implement this both as a type\nsynonym `PreQuasiregular` which has an associated `Monoid` instance (note: *not* an `AddMonoid`\ninstance despite the fact that `0 : R` is the identity in this monoid) so that one may access\nthe quasiregular elements of `R` as `(PreQuasiregular R)ˣ`, but also as a predicate\n`IsQuasiregular`.\n\nQuasiregularity is closely tied to invertibility. Indeed, `(PreQuasiregular A)ˣ` is isomorphic to\nthe subgroup of `Unitization R A` whose scalar part is `1`, whenever `A` is a non-unital\n`R`-algebra, and moreover this isomorphism is implemented by the map\n`(x : A) ↦ (1 + x : Unitization R A)`. It is because of this isomorphism, and the associated ties\nwith multiplicative invertibility, that we choose a `Monoid` (as opposed to an `AddMonoid`)\nstructure on `PreQuasiregular`. In addition, in unital rings, we even have\n`IsQuasiregular x ↔ IsUnit (1 + x)`.\n\nThe *quasispectrum* of `a : A` (with respect to `R`) is defined in terms of quasiregularity, and\nthis is the natural analogue of the `spectrum` for non-unital rings. Indeed, it is true that\n`quasispectrum R a = spectrum R a ∪ {0}` when `A` is unital.\n\nIn Mathlib, the quasispectrum is the domain of the continuous functions associated to the\n*non-unital* continuous functional calculus.\n\n## Main definitions\n\n+ `PreQuasiregular R`: a structure wrapping `R` that inherits a distinct `Monoid` instance when `R`\n is a non-unital semiring.\n+ `Unitization.unitsFstOne`: the subgroup with carrier `{ x : (Unitization R A)ˣ | x.fst = 1 }`.\n+ `unitsFstOne_mulEquiv_quasiregular`: the group isomorphism between\n `Unitization.unitsFstOne` and the units of `PreQuasiregular` (i.e., the quasiregular elements)\n which sends `(1, x) ↦ x`.\n+ `IsQuasiregular x`: the proposition that `x : R` is a unit with respect to the monoid structure on\n `PreQuasiregular R`, i.e., there is some `u : (PreQuasiregular R)ˣ` such that `u.val` is\n identified with `x` (via the natural equivalence between `R` and `PreQuasiregular R`).\n+ `quasispectrum R a`: in an algebra over the semifield `R`, this is the set\n `{r : R | (hr : IsUnit r) → ¬ IsQuasiregular (-(hr.unit⁻¹ • a))}`, which should be thought of\n as a version of the `spectrum` which is applicable in non-unital algebras.\n\n## Main theorems\n\n+ `isQuasiregular_iff_isUnit`: in a unital ring, `x` is quasiregular if and only if `1 + x` is\n a unit.\n+ `quasispectrum_eq_spectrum_union_zero`: in a unital algebra `A` over a semifield `R`, the\n quasispectrum of `a : A` is the `spectrum` with zero added.\n+ `Unitization.isQuasiregular_inr_iff`: `a : A` is quasiregular if and only if it is quasiregular\n in `Unitization R A` (via the coercion `Unitization.inr`).\n+ `Unitization.quasispectrum_eq_spectrum_inr`: the quasispectrum of `a` in a non-unital `R`-algebra\n `A` is precisely the spectrum of `a` in `Unitization R A` (via the coercion `Unitization.inr`).\n-/\n\n@[expose] public section\n\n/-- A type synonym for non-unital rings where an alternative monoid structure is introduced.\nIf `R` is a non-unital semiring, then `PreQuasiregular R` is equipped with the monoid structure\nwith binary operation `fun x y ↦ y + x + x * y` and identity `0`. Elements of `R` which are\ninvertible in this monoid satisfy the predicate `IsQuasiregular`. -/\nstructure PreQuasiregular (R : Type*) where\n /-- The value wrapped into a term of `PreQuasiregular`. -/\n val : R\n\nnamespace PreQuasiregular\n\nvariable {R : Type*} [NonUnitalSemiring R]\n\n/-- The identity map between `R` and `PreQuasiregular R`. -/\n@[simps]\ndef equiv : R ≃ PreQuasiregular R where\n toFun := .mk\n invFun := PreQuasiregular.val\n\ninstance instOne : One (PreQuasiregular R) where\n one := equiv 0\n\n@[simp]\nlemma val_one : (1 : PreQuasiregular R).val = 0 := rfl\n\ninstance instMul : Mul (PreQuasiregular R) where\n mul x y := .mk (y.val + x.val + x.val * y.val)\n\n@[simp]\nlemma val_mul (x y : PreQuasiregular R) : (x * y).val = y.val + x.val + x.val * y.val := rfl\n\ninstance instMonoid : Monoid (PreQuasiregular R) where\n one := equiv 0\n mul x y := .mk (y.val + x.val + x.val * y.val)\n mul_one _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n one_mul _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n mul_assoc x y z := equiv.symm.injective <| by simp [mul_add, add_mul, mul_assoc]; abel\n\n@[simp]\nlemma inv_add_add_mul_eq_zero (u : (PreQuasiregular R)ˣ) :\n u⁻¹.val.val + u.val.val + u.val.val * u⁻¹.val.val = 0 := by\n simpa [-Units.mul_inv] using congr($(u.mul_inv).val)\n\n@[simp]\nlemma add_inv_add_mul_eq_zero (u : (PreQuasiregular R)ˣ) :\n u.val.val + u⁻¹.val.val + u⁻¹.val.val * u.val.val = 0 := by\n simpa [-Units.inv_mul] using congr($(u.inv_mul).val)\n\nend PreQuasiregular\n\nnamespace Unitization\nopen PreQuasiregular\n\nvariable {R A : Type*} [CommSemiring R] [NonUnitalSemiring A] [Module R A] [IsScalarTower R A A]\n [SMulCommClass R A A]\n\nvariable (R A) in\n/-- The subgroup of the units of `Unitization R A` whose scalar part is `1`. -/\ndef unitsFstOne : Subgroup (Unitization R A)ˣ where\n carrier := {x | x.val.fst = 1}\n one_mem' := rfl\n mul_mem' {x} {y} (hx : x.val.fst = 1) (hy : y.val.fst = 1) := by simp [hx, hy]\n inv_mem' {x} (hx : x.val.fst = 1) := by\n simpa [-Units.mul_inv, hx] using congr(fstHom R A $(x.mul_inv))\n\n@[simp]\nlemma mem_unitsFstOne {x : (Unitization R A)ˣ} : x ∈ unitsFstOne R A ↔ x.val.fst = 1 := Iff.rfl\n\n@[simp]\nlemma unitsFstOne_val_val_fst (x : (unitsFstOne R A)) : x.val.val.fst = 1 :=\n mem_unitsFstOne.mp x.property\n\n@[simp]\nlemma unitsFstOne_val_inv_val_fst (x : (unitsFstOne R A)) : x.val⁻¹.val.fst = 1 :=\n mem_unitsFstOne.mp x⁻¹.property\n\nvariable (R) in\n/-- If `A` is a non-unital `R`-algebra, then the subgroup of units of `Unitization R A` whose\nscalar part is `1 : R` (i.e., `Unitization.unitsFstOne`) is isomorphic to the group of units of\n`PreQuasiregular A`. -/\n@[simps]\ndef unitsFstOne_mulEquiv_quasiregular : unitsFstOne R A ≃* (PreQuasiregular A)ˣ where\n toFun x :=\n { val := PreQuasiregular.equiv x.val.val.snd\n inv := PreQuasiregular.equiv x⁻¹.val.val.snd\n val_inv := PreQuasiregular.equiv.symm.injective <| by\n simpa [-Units.mul_inv] using congr($(x.val.mul_inv).snd)\n inv_val := PreQuasiregular.equiv.symm.injective <| by\n simpa [-Units.inv_mul] using congr($(x.val.inv_mul).snd) }\n invFun x :=\n { val :=\n { val := 1 + PreQuasiregular.equiv.symm x.val\n inv := 1 + PreQuasiregular.equiv.symm x⁻¹.val\n val_inv := by\n convert congr((1 + $(inv_add_add_mul_eq_zero x) : Unitization R A))\n · simp only [mul_one, PreQuasiregular.equiv_symm_apply, one_mul, mul_add,\n add_mul, inr_add, inr_mul]\n abel\n · simp only [inr_zero, add_zero]\n inv_val := by\n convert congr((1 + $(add_inv_add_mul_eq_zero x) : Unitization R A))\n · simp only [mul_one, PreQuasiregular.equiv_symm_apply, one_mul, mul_add,\n add_mul, inr_add, inr_mul]\n abel\n · simp only [inr_zero, add_zero] }\n property := by simp }\n left_inv x := Subtype.ext <| Units.ext <| by simpa using x.val.val.inl_fst_add_inr_snd_eq\n right_inv x := Units.ext <| by simp [-PreQuasiregular.equiv_symm_apply]\n map_mul' x y := Units.ext <| PreQuasiregular.equiv.symm.injective <| by simp\n\nend Unitization\n\nsection PreQuasiregular\n\nopen PreQuasiregular\n\nvariable {R : Type*} [NonUnitalSemiring R]\n\n/-- In a non-unital semiring `R`, an element `x : R` satisfies `IsQuasiregular` if it is a unit\nunder the monoid operation `fun x y ↦ y + x + x * y`. -/\ndef IsQuasiregular (x : R) : Prop :=\n ∃ u : (PreQuasiregular R)ˣ, equiv.symm u.val = x\n\n@[simp]\nlemma isQuasiregular_zero : IsQuasiregular 0 := ⟨1, rfl⟩\n\nlemma isQuasiregular_iff {x : R} :\n IsQuasiregular x ↔ ∃ y, y + x + x * y = 0 ∧ x + y + y * x = 0 := by\n constructor\n · rintro ⟨u, rfl⟩\n exact ⟨equiv.symm u⁻¹.val, by simp⟩\n · rintro ⟨y, hy₁, hy₂⟩\n refine ⟨⟨equiv x, equiv y, ?_, ?_⟩, rfl⟩\n all_goals\n apply equiv.symm.injective\n assumption\n\nlemma isQuasiregular_iff' {x : R} : IsQuasiregular x ↔ IsUnit (PreQuasiregular.equiv x) := by\n simp only [IsQuasiregular, IsUnit, Equiv.apply_symm_apply,\n ← PreQuasiregular.equiv (R := R).injective.eq_iff]\n\nend PreQuasiregular\n\nlemma IsQuasiregular.map {F R S : Type*} [NonUnitalSemiring R] [NonUnitalSemiring S]\n [FunLike F R S] [NonUnitalRingHomClass F R S] (f : F) {x : R} (hx : IsQuasiregular x) :\n IsQuasiregular (f x) := by\n rw [isQuasiregular_iff] at hx ⊢\n obtain ⟨y, hy₁, hy₂⟩ := hx\n exact ⟨f y, by simpa using And.intro congr(f $(hy₁)) congr(f $(hy₂))⟩","module_header":true,"namespace":"","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Spectrum.Basic\npublic import Mathlib.Algebra.Algebra.Tower\npublic import Mathlib.Algebra.Algebra.Unitization\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2024 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Quasiregularity and quasispectrum\n\nFor a non-unital ring `R`, an element `r : R` is *quasiregular* if it is invertible in the monoid\n`(R, ∘)` where `x ∘ y := y + x + x * y` with identity `0 : R`. We implement this both as a type\nsynonym `PreQuasiregular` which has an associated `Monoid` instance (note: *not* an `AddMonoid`\ninstance despite the fact that `0 : R` is the identity in this monoid) so that one may access\nthe quasiregular elements of `R` as `(PreQuasiregular R)ˣ`, but also as a predicate\n`IsQuasiregular`.\n\nQuasiregularity is closely tied to invertibility. Indeed, `(PreQuasiregular A)ˣ` is isomorphic to\nthe subgroup of `Unitization R A` whose scalar part is `1`, whenever `A` is a non-unital\n`R`-algebra, and moreover this isomorphism is implemented by the map\n`(x : A) ↦ (1 + x : Unitization R A)`. It is because of this isomorphism, and the associated ties\nwith multiplicative invertibility, that we choose a `Monoid` (as opposed to an `AddMonoid`)\nstructure on `PreQuasiregular`. In addition, in unital rings, we even have\n`IsQuasiregular x ↔ IsUnit (1 + x)`.\n\nThe *quasispectrum* of `a : A` (with respect to `R`) is defined in terms of quasiregularity, and\nthis is the natural analogue of the `spectrum` for non-unital rings. Indeed, it is true that\n`quasispectrum R a = spectrum R a ∪ {0}` when `A` is unital.\n\nIn Mathlib, the quasispectrum is the domain of the continuous functions associated to the\n*non-unital* continuous functional calculus.\n\n## Main definitions\n\n+ `PreQuasiregular R`: a structure wrapping `R` that inherits a distinct `Monoid` instance when `R`\n is a non-unital semiring.\n+ `Unitization.unitsFstOne`: the subgroup with carrier `{ x : (Unitization R A)ˣ | x.fst = 1 }`.\n+ `unitsFstOne_mulEquiv_quasiregular`: the group isomorphism between\n `Unitization.unitsFstOne` and the units of `PreQuasiregular` (i.e., the quasiregular elements)\n which sends `(1, x) ↦ x`.\n+ `IsQuasiregular x`: the proposition that `x : R` is a unit with respect to the monoid structure on\n `PreQuasiregular R`, i.e., there is some `u : (PreQuasiregular R)ˣ` such that `u.val` is\n identified with `x` (via the natural equivalence between `R` and `PreQuasiregular R`).\n+ `quasispectrum R a`: in an algebra over the semifield `R`, this is the set\n `{r : R | (hr : IsUnit r) → ¬ IsQuasiregular (-(hr.unit⁻¹ • a))}`, which should be thought of\n as a version of the `spectrum` which is applicable in non-unital algebras.\n\n## Main theorems\n\n+ `isQuasiregular_iff_isUnit`: in a unital ring, `x` is quasiregular if and only if `1 + x` is\n a unit.\n+ `quasispectrum_eq_spectrum_union_zero`: in a unital algebra `A` over a semifield `R`, the\n quasispectrum of `a : A` is the `spectrum` with zero added.\n+ `Unitization.isQuasiregular_inr_iff`: `a : A` is quasiregular if and only if it is quasiregular\n in `Unitization R A` (via the coercion `Unitization.inr`).\n+ `Unitization.quasispectrum_eq_spectrum_inr`: the quasispectrum of `a` in a non-unital `R`-algebra\n `A` is precisely the spectrum of `a` in `Unitization R A` (via the coercion `Unitization.inr`).\n-/\n\n@[expose] public section\n\n/-- A type synonym for non-unital rings where an alternative monoid structure is introduced.\nIf `R` is a non-unital semiring, then `PreQuasiregular R` is equipped with the monoid structure\nwith binary operation `fun x y ↦ y + x + x * y` and identity `0`. Elements of `R` which are\ninvertible in this monoid satisfy the predicate `IsQuasiregular`. -/\nstructure PreQuasiregular (R : Type*) where\n /-- The value wrapped into a term of `PreQuasiregular`. -/\n val : R\n\nnamespace PreQuasiregular\n\nvariable {R : Type*} [NonUnitalSemiring R]\n\n/-- The identity map between `R` and `PreQuasiregular R`. -/\n@[simps]\ndef equiv : R ≃ PreQuasiregular R where\n toFun := .mk\n invFun := PreQuasiregular.val\n\ninstance instOne : One (PreQuasiregular R) where\n one := equiv 0\n\n@[simp]\nlemma val_one : (1 : PreQuasiregular R).val = 0 := rfl\n\ninstance instMul : Mul (PreQuasiregular R) where\n mul x y := .mk (y.val + x.val + x.val * y.val)\n\n@[simp]\nlemma val_mul (x y : PreQuasiregular R) : (x * y).val = y.val + x.val + x.val * y.val := rfl\n\ninstance instMonoid : Monoid (PreQuasiregular R) where\n one := equiv 0\n mul x y := .mk (y.val + x.val + x.val * y.val)\n mul_one _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n one_mul _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n mul_assoc x y z := equiv.symm.injective <| by simp [mul_add, add_mul, mul_assoc]; abel\n\n@[simp]\nlemma inv_add_add_mul_eq_zero (u : (PreQuasiregular R)ˣ) :\n u⁻¹.val.val + u.val.val + u.val.val * u⁻¹.val.val = 0 := by\n simpa [-Units.mul_inv] using congr($(u.mul_inv).val)\n\n@[simp]\nlemma add_inv_add_mul_eq_zero (u : (PreQuasiregular R)ˣ) :\n u.val.val + u⁻¹.val.val + u⁻¹.val.val * u.val.val = 0 := by\n simpa [-Units.inv_mul] using congr($(u.inv_mul).val)\n\nend PreQuasiregular\n\nnamespace Unitization\nopen PreQuasiregular\n\nvariable {R A : Type*} [CommSemiring R] [NonUnitalSemiring A] [Module R A] [IsScalarTower R A A]\n [SMulCommClass R A A]\n\nvariable (R A) in\n/-- The subgroup of the units of `Unitization R A` whose scalar part is `1`. -/\ndef unitsFstOne : Subgroup (Unitization R A)ˣ where\n carrier := {x | x.val.fst = 1}\n one_mem' := rfl\n mul_mem' {x} {y} (hx : x.val.fst = 1) (hy : y.val.fst = 1) := by simp [hx, hy]\n inv_mem' {x} (hx : x.val.fst = 1) := by\n simpa [-Units.mul_inv, hx] using congr(fstHom R A $(x.mul_inv))\n\n@[simp]\nlemma mem_unitsFstOne {x : (Unitization R A)ˣ} : x ∈ unitsFstOne R A ↔ x.val.fst = 1 := Iff.rfl\n\n@[simp]\nlemma unitsFstOne_val_val_fst (x : (unitsFstOne R A)) : x.val.val.fst = 1 :=\n mem_unitsFstOne.mp x.property\n\n@[simp]\nlemma unitsFstOne_val_inv_val_fst (x : (unitsFstOne R A)) : x.val⁻¹.val.fst = 1 :=\n mem_unitsFstOne.mp x⁻¹.property\n\nvariable (R) in\n/-- If `A` is a non-unital `R`-algebra, then the subgroup of units of `Unitization R A` whose\nscalar part is `1 : R` (i.e., `Unitization.unitsFstOne`) is isomorphic to the group of units of\n`PreQuasiregular A`. -/\n@[simps]\ndef unitsFstOne_mulEquiv_quasiregular : unitsFstOne R A ≃* (PreQuasiregular A)ˣ where\n toFun x :=\n { val := PreQuasiregular.equiv x.val.val.snd\n inv := PreQuasiregular.equiv x⁻¹.val.val.snd\n val_inv := PreQuasiregular.equiv.symm.injective <| by\n simpa [-Units.mul_inv] using congr($(x.val.mul_inv).snd)\n inv_val := PreQuasiregular.equiv.symm.injective <| by\n simpa [-Units.inv_mul] using congr($(x.val.inv_mul).snd) }\n invFun x :=\n { val :=\n { val := 1 + PreQuasiregular.equiv.symm x.val\n inv := 1 + PreQuasiregular.equiv.symm x⁻¹.val\n val_inv := by\n convert congr((1 + $(inv_add_add_mul_eq_zero x) : Unitization R A))\n · simp only [mul_one, PreQuasiregular.equiv_symm_apply, one_mul, mul_add,\n add_mul, inr_add, inr_mul]\n abel\n · simp only [inr_zero, add_zero]\n inv_val := by\n convert congr((1 + $(add_inv_add_mul_eq_zero x) : Unitization R A))\n · simp only [mul_one, PreQuasiregular.equiv_symm_apply, one_mul, mul_add,\n add_mul, inr_add, inr_mul]\n abel\n · simp only [inr_zero, add_zero] }\n property := by simp }\n left_inv x := Subtype.ext <| Units.ext <| by simpa using x.val.val.inl_fst_add_inr_snd_eq\n right_inv x := Units.ext <| by simp [-PreQuasiregular.equiv_symm_apply]\n map_mul' x y := Units.ext <| PreQuasiregular.equiv.symm.injective <| by simp\n\nend Unitization\n\nsection PreQuasiregular\n\nopen PreQuasiregular\n\nvariable {R : Type*} [NonUnitalSemiring R]\n\n/-- In a non-unital semiring `R`, an element `x : R` satisfies `IsQuasiregular` if it is a unit\nunder the monoid operation `fun x y ↦ y + x + x * y`. -/\ndef IsQuasiregular (x : R) : Prop :=\n ∃ u : (PreQuasiregular R)ˣ, equiv.symm u.val = x\n\n@[simp]\nlemma isQuasiregular_zero : IsQuasiregular 0 := ⟨1, rfl⟩\n\nlemma isQuasiregular_iff {x : R} :\n IsQuasiregular x ↔ ∃ y, y + x + x * y = 0 ∧ x + y + y * x = 0 := by\n constructor\n · rintro ⟨u, rfl⟩\n exact ⟨equiv.symm u⁻¹.val, by simp⟩\n · rintro ⟨y, hy₁, hy₂⟩\n refine ⟨⟨equiv x, equiv y, ?_, ?_⟩, rfl⟩\n all_goals\n apply equiv.symm.injective\n assumption\n\nlemma isQuasiregular_iff' {x : R} : IsQuasiregular x ↔ IsUnit (PreQuasiregular.equiv x) := by\n simp only [IsQuasiregular, IsUnit, Equiv.apply_symm_apply,\n ← PreQuasiregular.equiv (R := R).injective.eq_iff]\n\nend PreQuasiregular\n\nlemma IsQuasiregular.map {F R S : Type*} [NonUnitalSemiring R] [NonUnitalSemiring S]\n [FunLike F R S] [NonUnitalRingHomClass F R S] (f : F) {x : R} (hx : IsQuasiregular x) :\n IsQuasiregular (f x) := by\n rw [isQuasiregular_iff] at hx ⊢\n obtain ⟨y, hy₁, hy₂⟩ := hx\n exact ⟨f y, by simpa using And.intro congr(f $(hy₁)) congr(f $(hy₂))⟩\n\nTarget:\nlemma IsQuasiregular.isUnit_one_add {R : Type*} [Semiring R] {x : R} (hx : IsQuasiregular x) :\n IsUnit (1 + x) :=\n\nProof body:\n","proof_body":"by\n obtain ⟨y, hy₁, hy₂⟩ := isQuasiregular_iff.mp hx\n refine ⟨⟨1 + x, 1 + y, ?_, ?_⟩, rfl⟩\n · convert congr(1 + $(hy₁)) <;> [noncomm_ring; simp]\n · convert congr(1 + $(hy₂)) <;> [noncomm_ring; simp]","provenance":{"declaration_index":11,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"86daaff4a1e1ed9d97d7dcf185be7df0da41c9b2ae049e4a852eeedca7f99791","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Spectrum/Quasispectrum.lean"},"sample_id":"3c38f36a9e3285e65e84f066f3646fd4e7d8c72115dc82c2fa433698d416fe0f","schema_version":1,"split":"train","theorem_statement":"lemma IsQuasiregular.isUnit_one_add {R : Type*} [Semiring R] {x : R} (hx : IsQuasiregular x) :\n IsUnit (1 + x) :="} {"completion":"by\n refine ⟨IsQuasiregular.isUnit_one_add, fun hx ↦ ?_⟩\n rw [isQuasiregular_iff]\n use hx.unit⁻¹ - 1\n constructor\n case' h.left => have := congr($(hx.mul_val_inv) - 1)\n case' h.right => have := congr($(hx.val_inv_mul) - 1)\n all_goals\n rw [← sub_add_cancel (↑hx.unit⁻¹ : R) 1, sub_self] at this\n convert this\n noncomm_ring\n\n-- interestingly, this holds even in the semiring case.","context_contains_namespace":false,"context_suffix":"","dependency_ids":["import:Mathlib.Algebra.Algebra.Spectrum.Basic","import:Mathlib.Algebra.Algebra.Tower","import:Mathlib.Algebra.Algebra.Unitization"],"family_id":"isquasiregular_iff_isunit","file_id":"mathlib/Mathlib/Algebra/Algebra/Spectrum/Quasispectrum.lean","imports":["public import Mathlib.Algebra.Algebra.Spectrum.Basic","public import Mathlib.Algebra.Algebra.Tower","public import Mathlib.Algebra.Algebra.Unitization"],"local_context":"/-\nCopyright (c) 2024 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Quasiregularity and quasispectrum\n\nFor a non-unital ring `R`, an element `r : R` is *quasiregular* if it is invertible in the monoid\n`(R, ∘)` where `x ∘ y := y + x + x * y` with identity `0 : R`. We implement this both as a type\nsynonym `PreQuasiregular` which has an associated `Monoid` instance (note: *not* an `AddMonoid`\ninstance despite the fact that `0 : R` is the identity in this monoid) so that one may access\nthe quasiregular elements of `R` as `(PreQuasiregular R)ˣ`, but also as a predicate\n`IsQuasiregular`.\n\nQuasiregularity is closely tied to invertibility. Indeed, `(PreQuasiregular A)ˣ` is isomorphic to\nthe subgroup of `Unitization R A` whose scalar part is `1`, whenever `A` is a non-unital\n`R`-algebra, and moreover this isomorphism is implemented by the map\n`(x : A) ↦ (1 + x : Unitization R A)`. It is because of this isomorphism, and the associated ties\nwith multiplicative invertibility, that we choose a `Monoid` (as opposed to an `AddMonoid`)\nstructure on `PreQuasiregular`. In addition, in unital rings, we even have\n`IsQuasiregular x ↔ IsUnit (1 + x)`.\n\nThe *quasispectrum* of `a : A` (with respect to `R`) is defined in terms of quasiregularity, and\nthis is the natural analogue of the `spectrum` for non-unital rings. Indeed, it is true that\n`quasispectrum R a = spectrum R a ∪ {0}` when `A` is unital.\n\nIn Mathlib, the quasispectrum is the domain of the continuous functions associated to the\n*non-unital* continuous functional calculus.\n\n## Main definitions\n\n+ `PreQuasiregular R`: a structure wrapping `R` that inherits a distinct `Monoid` instance when `R`\n is a non-unital semiring.\n+ `Unitization.unitsFstOne`: the subgroup with carrier `{ x : (Unitization R A)ˣ | x.fst = 1 }`.\n+ `unitsFstOne_mulEquiv_quasiregular`: the group isomorphism between\n `Unitization.unitsFstOne` and the units of `PreQuasiregular` (i.e., the quasiregular elements)\n which sends `(1, x) ↦ x`.\n+ `IsQuasiregular x`: the proposition that `x : R` is a unit with respect to the monoid structure on\n `PreQuasiregular R`, i.e., there is some `u : (PreQuasiregular R)ˣ` such that `u.val` is\n identified with `x` (via the natural equivalence between `R` and `PreQuasiregular R`).\n+ `quasispectrum R a`: in an algebra over the semifield `R`, this is the set\n `{r : R | (hr : IsUnit r) → ¬ IsQuasiregular (-(hr.unit⁻¹ • a))}`, which should be thought of\n as a version of the `spectrum` which is applicable in non-unital algebras.\n\n## Main theorems\n\n+ `isQuasiregular_iff_isUnit`: in a unital ring, `x` is quasiregular if and only if `1 + x` is\n a unit.\n+ `quasispectrum_eq_spectrum_union_zero`: in a unital algebra `A` over a semifield `R`, the\n quasispectrum of `a : A` is the `spectrum` with zero added.\n+ `Unitization.isQuasiregular_inr_iff`: `a : A` is quasiregular if and only if it is quasiregular\n in `Unitization R A` (via the coercion `Unitization.inr`).\n+ `Unitization.quasispectrum_eq_spectrum_inr`: the quasispectrum of `a` in a non-unital `R`-algebra\n `A` is precisely the spectrum of `a` in `Unitization R A` (via the coercion `Unitization.inr`).\n-/\n\n@[expose] public section\n\n/-- A type synonym for non-unital rings where an alternative monoid structure is introduced.\nIf `R` is a non-unital semiring, then `PreQuasiregular R` is equipped with the monoid structure\nwith binary operation `fun x y ↦ y + x + x * y` and identity `0`. Elements of `R` which are\ninvertible in this monoid satisfy the predicate `IsQuasiregular`. -/\nstructure PreQuasiregular (R : Type*) where\n /-- The value wrapped into a term of `PreQuasiregular`. -/\n val : R\n\nnamespace PreQuasiregular\n\nvariable {R : Type*} [NonUnitalSemiring R]\n\n/-- The identity map between `R` and `PreQuasiregular R`. -/\n@[simps]\ndef equiv : R ≃ PreQuasiregular R where\n toFun := .mk\n invFun := PreQuasiregular.val\n\ninstance instOne : One (PreQuasiregular R) where\n one := equiv 0\n\n@[simp]\nlemma val_one : (1 : PreQuasiregular R).val = 0 := rfl\n\ninstance instMul : Mul (PreQuasiregular R) where\n mul x y := .mk (y.val + x.val + x.val * y.val)\n\n@[simp]\nlemma val_mul (x y : PreQuasiregular R) : (x * y).val = y.val + x.val + x.val * y.val := rfl\n\ninstance instMonoid : Monoid (PreQuasiregular R) where\n one := equiv 0\n mul x y := .mk (y.val + x.val + x.val * y.val)\n mul_one _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n one_mul _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n mul_assoc x y z := equiv.symm.injective <| by simp [mul_add, add_mul, mul_assoc]; abel\n\n@[simp]\nlemma inv_add_add_mul_eq_zero (u : (PreQuasiregular R)ˣ) :\n u⁻¹.val.val + u.val.val + u.val.val * u⁻¹.val.val = 0 := by\n simpa [-Units.mul_inv] using congr($(u.mul_inv).val)\n\n@[simp]\nlemma add_inv_add_mul_eq_zero (u : (PreQuasiregular R)ˣ) :\n u.val.val + u⁻¹.val.val + u⁻¹.val.val * u.val.val = 0 := by\n simpa [-Units.inv_mul] using congr($(u.inv_mul).val)\n\nend PreQuasiregular\n\nnamespace Unitization\nopen PreQuasiregular\n\nvariable {R A : Type*} [CommSemiring R] [NonUnitalSemiring A] [Module R A] [IsScalarTower R A A]\n [SMulCommClass R A A]\n\nvariable (R A) in\n/-- The subgroup of the units of `Unitization R A` whose scalar part is `1`. -/\ndef unitsFstOne : Subgroup (Unitization R A)ˣ where\n carrier := {x | x.val.fst = 1}\n one_mem' := rfl\n mul_mem' {x} {y} (hx : x.val.fst = 1) (hy : y.val.fst = 1) := by simp [hx, hy]\n inv_mem' {x} (hx : x.val.fst = 1) := by\n simpa [-Units.mul_inv, hx] using congr(fstHom R A $(x.mul_inv))\n\n@[simp]\nlemma mem_unitsFstOne {x : (Unitization R A)ˣ} : x ∈ unitsFstOne R A ↔ x.val.fst = 1 := Iff.rfl\n\n@[simp]\nlemma unitsFstOne_val_val_fst (x : (unitsFstOne R A)) : x.val.val.fst = 1 :=\n mem_unitsFstOne.mp x.property\n\n@[simp]\nlemma unitsFstOne_val_inv_val_fst (x : (unitsFstOne R A)) : x.val⁻¹.val.fst = 1 :=\n mem_unitsFstOne.mp x⁻¹.property\n\nvariable (R) in\n/-- If `A` is a non-unital `R`-algebra, then the subgroup of units of `Unitization R A` whose\nscalar part is `1 : R` (i.e., `Unitization.unitsFstOne`) is isomorphic to the group of units of\n`PreQuasiregular A`. -/\n@[simps]\ndef unitsFstOne_mulEquiv_quasiregular : unitsFstOne R A ≃* (PreQuasiregular A)ˣ where\n toFun x :=\n { val := PreQuasiregular.equiv x.val.val.snd\n inv := PreQuasiregular.equiv x⁻¹.val.val.snd\n val_inv := PreQuasiregular.equiv.symm.injective <| by\n simpa [-Units.mul_inv] using congr($(x.val.mul_inv).snd)\n inv_val := PreQuasiregular.equiv.symm.injective <| by\n simpa [-Units.inv_mul] using congr($(x.val.inv_mul).snd) }\n invFun x :=\n { val :=\n { val := 1 + PreQuasiregular.equiv.symm x.val\n inv := 1 + PreQuasiregular.equiv.symm x⁻¹.val\n val_inv := by\n convert congr((1 + $(inv_add_add_mul_eq_zero x) : Unitization R A))\n · simp only [mul_one, PreQuasiregular.equiv_symm_apply, one_mul, mul_add,\n add_mul, inr_add, inr_mul]\n abel\n · simp only [inr_zero, add_zero]\n inv_val := by\n convert congr((1 + $(add_inv_add_mul_eq_zero x) : Unitization R A))\n · simp only [mul_one, PreQuasiregular.equiv_symm_apply, one_mul, mul_add,\n add_mul, inr_add, inr_mul]\n abel\n · simp only [inr_zero, add_zero] }\n property := by simp }\n left_inv x := Subtype.ext <| Units.ext <| by simpa using x.val.val.inl_fst_add_inr_snd_eq\n right_inv x := Units.ext <| by simp [-PreQuasiregular.equiv_symm_apply]\n map_mul' x y := Units.ext <| PreQuasiregular.equiv.symm.injective <| by simp\n\nend Unitization\n\nsection PreQuasiregular\n\nopen PreQuasiregular\n\nvariable {R : Type*} [NonUnitalSemiring R]\n\n/-- In a non-unital semiring `R`, an element `x : R` satisfies `IsQuasiregular` if it is a unit\nunder the monoid operation `fun x y ↦ y + x + x * y`. -/\ndef IsQuasiregular (x : R) : Prop :=\n ∃ u : (PreQuasiregular R)ˣ, equiv.symm u.val = x\n\n@[simp]\nlemma isQuasiregular_zero : IsQuasiregular 0 := ⟨1, rfl⟩\n\nlemma isQuasiregular_iff {x : R} :\n IsQuasiregular x ↔ ∃ y, y + x + x * y = 0 ∧ x + y + y * x = 0 := by\n constructor\n · rintro ⟨u, rfl⟩\n exact ⟨equiv.symm u⁻¹.val, by simp⟩\n · rintro ⟨y, hy₁, hy₂⟩\n refine ⟨⟨equiv x, equiv y, ?_, ?_⟩, rfl⟩\n all_goals\n apply equiv.symm.injective\n assumption\n\nlemma isQuasiregular_iff' {x : R} : IsQuasiregular x ↔ IsUnit (PreQuasiregular.equiv x) := by\n simp only [IsQuasiregular, IsUnit, Equiv.apply_symm_apply,\n ← PreQuasiregular.equiv (R := R).injective.eq_iff]\n\nend PreQuasiregular\n\nlemma IsQuasiregular.map {F R S : Type*} [NonUnitalSemiring R] [NonUnitalSemiring S]\n [FunLike F R S] [NonUnitalRingHomClass F R S] (f : F) {x : R} (hx : IsQuasiregular x) :\n IsQuasiregular (f x) := by\n rw [isQuasiregular_iff] at hx ⊢\n obtain ⟨y, hy₁, hy₂⟩ := hx\n exact ⟨f y, by simpa using And.intro congr(f $(hy₁)) congr(f $(hy₂))⟩\n\nlemma IsQuasiregular.isUnit_one_add {R : Type*} [Semiring R] {x : R} (hx : IsQuasiregular x) :\n IsUnit (1 + x) := by\n obtain ⟨y, hy₁, hy₂⟩ := isQuasiregular_iff.mp hx\n refine ⟨⟨1 + x, 1 + y, ?_, ?_⟩, rfl⟩\n · convert congr(1 + $(hy₁)) <;> [noncomm_ring; simp]\n · convert congr(1 + $(hy₂)) <;> [noncomm_ring; simp]","module_header":true,"namespace":"","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Spectrum.Basic\npublic import Mathlib.Algebra.Algebra.Tower\npublic import Mathlib.Algebra.Algebra.Unitization\n\nNamespace:\n(root)\n\nLocal context:\n/-\nCopyright (c) 2024 Jireh Loreaux. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Jireh Loreaux\n-/\n/-!\n# Quasiregularity and quasispectrum\n\nFor a non-unital ring `R`, an element `r : R` is *quasiregular* if it is invertible in the monoid\n`(R, ∘)` where `x ∘ y := y + x + x * y` with identity `0 : R`. We implement this both as a type\nsynonym `PreQuasiregular` which has an associated `Monoid` instance (note: *not* an `AddMonoid`\ninstance despite the fact that `0 : R` is the identity in this monoid) so that one may access\nthe quasiregular elements of `R` as `(PreQuasiregular R)ˣ`, but also as a predicate\n`IsQuasiregular`.\n\nQuasiregularity is closely tied to invertibility. Indeed, `(PreQuasiregular A)ˣ` is isomorphic to\nthe subgroup of `Unitization R A` whose scalar part is `1`, whenever `A` is a non-unital\n`R`-algebra, and moreover this isomorphism is implemented by the map\n`(x : A) ↦ (1 + x : Unitization R A)`. It is because of this isomorphism, and the associated ties\nwith multiplicative invertibility, that we choose a `Monoid` (as opposed to an `AddMonoid`)\nstructure on `PreQuasiregular`. In addition, in unital rings, we even have\n`IsQuasiregular x ↔ IsUnit (1 + x)`.\n\nThe *quasispectrum* of `a : A` (with respect to `R`) is defined in terms of quasiregularity, and\nthis is the natural analogue of the `spectrum` for non-unital rings. Indeed, it is true that\n`quasispectrum R a = spectrum R a ∪ {0}` when `A` is unital.\n\nIn Mathlib, the quasispectrum is the domain of the continuous functions associated to the\n*non-unital* continuous functional calculus.\n\n## Main definitions\n\n+ `PreQuasiregular R`: a structure wrapping `R` that inherits a distinct `Monoid` instance when `R`\n is a non-unital semiring.\n+ `Unitization.unitsFstOne`: the subgroup with carrier `{ x : (Unitization R A)ˣ | x.fst = 1 }`.\n+ `unitsFstOne_mulEquiv_quasiregular`: the group isomorphism between\n `Unitization.unitsFstOne` and the units of `PreQuasiregular` (i.e., the quasiregular elements)\n which sends `(1, x) ↦ x`.\n+ `IsQuasiregular x`: the proposition that `x : R` is a unit with respect to the monoid structure on\n `PreQuasiregular R`, i.e., there is some `u : (PreQuasiregular R)ˣ` such that `u.val` is\n identified with `x` (via the natural equivalence between `R` and `PreQuasiregular R`).\n+ `quasispectrum R a`: in an algebra over the semifield `R`, this is the set\n `{r : R | (hr : IsUnit r) → ¬ IsQuasiregular (-(hr.unit⁻¹ • a))}`, which should be thought of\n as a version of the `spectrum` which is applicable in non-unital algebras.\n\n## Main theorems\n\n+ `isQuasiregular_iff_isUnit`: in a unital ring, `x` is quasiregular if and only if `1 + x` is\n a unit.\n+ `quasispectrum_eq_spectrum_union_zero`: in a unital algebra `A` over a semifield `R`, the\n quasispectrum of `a : A` is the `spectrum` with zero added.\n+ `Unitization.isQuasiregular_inr_iff`: `a : A` is quasiregular if and only if it is quasiregular\n in `Unitization R A` (via the coercion `Unitization.inr`).\n+ `Unitization.quasispectrum_eq_spectrum_inr`: the quasispectrum of `a` in a non-unital `R`-algebra\n `A` is precisely the spectrum of `a` in `Unitization R A` (via the coercion `Unitization.inr`).\n-/\n\n@[expose] public section\n\n/-- A type synonym for non-unital rings where an alternative monoid structure is introduced.\nIf `R` is a non-unital semiring, then `PreQuasiregular R` is equipped with the monoid structure\nwith binary operation `fun x y ↦ y + x + x * y` and identity `0`. Elements of `R` which are\ninvertible in this monoid satisfy the predicate `IsQuasiregular`. -/\nstructure PreQuasiregular (R : Type*) where\n /-- The value wrapped into a term of `PreQuasiregular`. -/\n val : R\n\nnamespace PreQuasiregular\n\nvariable {R : Type*} [NonUnitalSemiring R]\n\n/-- The identity map between `R` and `PreQuasiregular R`. -/\n@[simps]\ndef equiv : R ≃ PreQuasiregular R where\n toFun := .mk\n invFun := PreQuasiregular.val\n\ninstance instOne : One (PreQuasiregular R) where\n one := equiv 0\n\n@[simp]\nlemma val_one : (1 : PreQuasiregular R).val = 0 := rfl\n\ninstance instMul : Mul (PreQuasiregular R) where\n mul x y := .mk (y.val + x.val + x.val * y.val)\n\n@[simp]\nlemma val_mul (x y : PreQuasiregular R) : (x * y).val = y.val + x.val + x.val * y.val := rfl\n\ninstance instMonoid : Monoid (PreQuasiregular R) where\n one := equiv 0\n mul x y := .mk (y.val + x.val + x.val * y.val)\n mul_one _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n one_mul _ := equiv.symm.injective <| by simp [-EmbeddingLike.apply_eq_iff_eq]\n mul_assoc x y z := equiv.symm.injective <| by simp [mul_add, add_mul, mul_assoc]; abel\n\n@[simp]\nlemma inv_add_add_mul_eq_zero (u : (PreQuasiregular R)ˣ) :\n u⁻¹.val.val + u.val.val + u.val.val * u⁻¹.val.val = 0 := by\n simpa [-Units.mul_inv] using congr($(u.mul_inv).val)\n\n@[simp]\nlemma add_inv_add_mul_eq_zero (u : (PreQuasiregular R)ˣ) :\n u.val.val + u⁻¹.val.val + u⁻¹.val.val * u.val.val = 0 := by\n simpa [-Units.inv_mul] using congr($(u.inv_mul).val)\n\nend PreQuasiregular\n\nnamespace Unitization\nopen PreQuasiregular\n\nvariable {R A : Type*} [CommSemiring R] [NonUnitalSemiring A] [Module R A] [IsScalarTower R A A]\n [SMulCommClass R A A]\n\nvariable (R A) in\n/-- The subgroup of the units of `Unitization R A` whose scalar part is `1`. -/\ndef unitsFstOne : Subgroup (Unitization R A)ˣ where\n carrier := {x | x.val.fst = 1}\n one_mem' := rfl\n mul_mem' {x} {y} (hx : x.val.fst = 1) (hy : y.val.fst = 1) := by simp [hx, hy]\n inv_mem' {x} (hx : x.val.fst = 1) := by\n simpa [-Units.mul_inv, hx] using congr(fstHom R A $(x.mul_inv))\n\n@[simp]\nlemma mem_unitsFstOne {x : (Unitization R A)ˣ} : x ∈ unitsFstOne R A ↔ x.val.fst = 1 := Iff.rfl\n\n@[simp]\nlemma unitsFstOne_val_val_fst (x : (unitsFstOne R A)) : x.val.val.fst = 1 :=\n mem_unitsFstOne.mp x.property\n\n@[simp]\nlemma unitsFstOne_val_inv_val_fst (x : (unitsFstOne R A)) : x.val⁻¹.val.fst = 1 :=\n mem_unitsFstOne.mp x⁻¹.property\n\nvariable (R) in\n/-- If `A` is a non-unital `R`-algebra, then the subgroup of units of `Unitization R A` whose\nscalar part is `1 : R` (i.e., `Unitization.unitsFstOne`) is isomorphic to the group of units of\n`PreQuasiregular A`. -/\n@[simps]\ndef unitsFstOne_mulEquiv_quasiregular : unitsFstOne R A ≃* (PreQuasiregular A)ˣ where\n toFun x :=\n { val := PreQuasiregular.equiv x.val.val.snd\n inv := PreQuasiregular.equiv x⁻¹.val.val.snd\n val_inv := PreQuasiregular.equiv.symm.injective <| by\n simpa [-Units.mul_inv] using congr($(x.val.mul_inv).snd)\n inv_val := PreQuasiregular.equiv.symm.injective <| by\n simpa [-Units.inv_mul] using congr($(x.val.inv_mul).snd) }\n invFun x :=\n { val :=\n { val := 1 + PreQuasiregular.equiv.symm x.val\n inv := 1 + PreQuasiregular.equiv.symm x⁻¹.val\n val_inv := by\n convert congr((1 + $(inv_add_add_mul_eq_zero x) : Unitization R A))\n · simp only [mul_one, PreQuasiregular.equiv_symm_apply, one_mul, mul_add,\n add_mul, inr_add, inr_mul]\n abel\n · simp only [inr_zero, add_zero]\n inv_val := by\n convert congr((1 + $(add_inv_add_mul_eq_zero x) : Unitization R A))\n · simp only [mul_one, PreQuasiregular.equiv_symm_apply, one_mul, mul_add,\n add_mul, inr_add, inr_mul]\n abel\n · simp only [inr_zero, add_zero] }\n property := by simp }\n left_inv x := Subtype.ext <| Units.ext <| by simpa using x.val.val.inl_fst_add_inr_snd_eq\n right_inv x := Units.ext <| by simp [-PreQuasiregular.equiv_symm_apply]\n map_mul' x y := Units.ext <| PreQuasiregular.equiv.symm.injective <| by simp\n\nend Unitization\n\nsection PreQuasiregular\n\nopen PreQuasiregular\n\nvariable {R : Type*} [NonUnitalSemiring R]\n\n/-- In a non-unital semiring `R`, an element `x : R` satisfies `IsQuasiregular` if it is a unit\nunder the monoid operation `fun x y ↦ y + x + x * y`. -/\ndef IsQuasiregular (x : R) : Prop :=\n ∃ u : (PreQuasiregular R)ˣ, equiv.symm u.val = x\n\n@[simp]\nlemma isQuasiregular_zero : IsQuasiregular 0 := ⟨1, rfl⟩\n\nlemma isQuasiregular_iff {x : R} :\n IsQuasiregular x ↔ ∃ y, y + x + x * y = 0 ∧ x + y + y * x = 0 := by\n constructor\n · rintro ⟨u, rfl⟩\n exact ⟨equiv.symm u⁻¹.val, by simp⟩\n · rintro ⟨y, hy₁, hy₂⟩\n refine ⟨⟨equiv x, equiv y, ?_, ?_⟩, rfl⟩\n all_goals\n apply equiv.symm.injective\n assumption\n\nlemma isQuasiregular_iff' {x : R} : IsQuasiregular x ↔ IsUnit (PreQuasiregular.equiv x) := by\n simp only [IsQuasiregular, IsUnit, Equiv.apply_symm_apply,\n ← PreQuasiregular.equiv (R := R).injective.eq_iff]\n\nend PreQuasiregular\n\nlemma IsQuasiregular.map {F R S : Type*} [NonUnitalSemiring R] [NonUnitalSemiring S]\n [FunLike F R S] [NonUnitalRingHomClass F R S] (f : F) {x : R} (hx : IsQuasiregular x) :\n IsQuasiregular (f x) := by\n rw [isQuasiregular_iff] at hx ⊢\n obtain ⟨y, hy₁, hy₂⟩ := hx\n exact ⟨f y, by simpa using And.intro congr(f $(hy₁)) congr(f $(hy₂))⟩\n\nlemma IsQuasiregular.isUnit_one_add {R : Type*} [Semiring R] {x : R} (hx : IsQuasiregular x) :\n IsUnit (1 + x) := by\n obtain ⟨y, hy₁, hy₂⟩ := isQuasiregular_iff.mp hx\n refine ⟨⟨1 + x, 1 + y, ?_, ?_⟩, rfl⟩\n · convert congr(1 + $(hy₁)) <;> [noncomm_ring; simp]\n · convert congr(1 + $(hy₂)) <;> [noncomm_ring; simp]\n\nTarget:\nlemma isQuasiregular_iff_isUnit {R : Type*} [Ring R] {x : R} :\n IsQuasiregular x ↔ IsUnit (1 + x) :=\n\nProof body:\n","proof_body":"by\n refine ⟨IsQuasiregular.isUnit_one_add, fun hx ↦ ?_⟩\n rw [isQuasiregular_iff]\n use hx.unit⁻¹ - 1\n constructor\n case' h.left => have := congr($(hx.mul_val_inv) - 1)\n case' h.right => have := congr($(hx.val_inv_mul) - 1)\n all_goals\n rw [← sub_add_cancel (↑hx.unit⁻¹ : R) 1, sub_self] at this\n convert this\n noncomm_ring\n\n-- interestingly, this holds even in the semiring case.","provenance":{"declaration_index":12,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"86daaff4a1e1ed9d97d7dcf185be7df0da41c9b2ae049e4a852eeedca7f99791","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Spectrum/Quasispectrum.lean"},"sample_id":"576ed8be4eacbe0d97a08ade6ec57986bd9a40a0b6891a2c152a585088232984","schema_version":1,"split":"train","theorem_statement":"lemma isQuasiregular_iff_isUnit {R : Type*} [Ring R] {x : R} :\n IsQuasiregular x ↔ IsUnit (1 + x) :="} {"completion":"by\n rintro x ⟨n, rfl⟩\n exact ⟨n, show (n : R) • (1 : A) = n by rw [Nat.cast_smul_eq_nsmul, nsmul_one]⟩","context_contains_namespace":true,"context_suffix":"end Module\nend Submodule","dependency_ids":["import:Mathlib.Algebra.Algebra.Bilinear","import:Mathlib.Algebra.Algebra.Opposite","import:Mathlib.Algebra.Group.Pointwise.Finset.Basic","import:Mathlib.Algebra.Group.Pointwise.Set.BigOperators","import:Mathlib.Algebra.Module.Submodule.Finsupp","import:Mathlib.Algebra.Ring.NonZeroDivisors","import:Mathlib.Algebra.Ring.Submonoid.Pointwise","import:Mathlib.Data.Set.Semiring","import:Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise"],"family_id":"le_one_toaddsubmonoid","file_id":"mathlib/Mathlib/Algebra/Algebra/Operations.lean","imports":["public import Mathlib.Algebra.Algebra.Bilinear","public import Mathlib.Algebra.Algebra.Opposite","public import Mathlib.Algebra.Group.Pointwise.Finset.Basic","public import Mathlib.Algebra.Group.Pointwise.Set.BigOperators","public import Mathlib.Algebra.Module.Submodule.Finsupp","public import Mathlib.Algebra.Ring.NonZeroDivisors","public import Mathlib.Algebra.Ring.Submonoid.Pointwise","public import Mathlib.Data.Set.Semiring","public import Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise"],"local_context":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `Pointwise` scope we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\nWhen `R` is not necessarily commutative, and `A` is merely an `R`-module with a ring structure\nsuch that `IsScalarTower R A A` holds (equivalent to the data of a ring homomorphism `R →+* A`\nby `ringHomEquivModuleIsScalarTower`), we can still define `1 : Submodule R A` and\n`Mul (Submodule R A)`, but `1` is only a left identity, not necessarily a right one.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n@[expose] public section\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen scoped Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n\nend SubMulAction\n\nnamespace Submodule\n\nsection Module\n\nvariable {R : Type u} [Semiring R] {A : Type v} [Semiring A] [Module R A]\n\n-- TODO: Why is this in a file about `Algebra`?\n-- TODO: potentially change this back to `LinearMap.range (Algebra.linearMap R A)`\n-- once a version of `Algebra` without the `commutes'` field is introduced.\n-- See issue https://github.com/leanprover-community/mathlib4/issues/18110.\n/-- `1 : Submodule R A` is the submodule `R ∙ 1` of `A`.\n-/\ninstance one : One (Submodule R A) :=\n ⟨LinearMap.range (LinearMap.toSpanSingleton R A 1)⟩\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 :=\n (LinearMap.span_singleton_eq_range _ _ _).symm","module_header":true,"namespace":"Submodule","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Bilinear\npublic import Mathlib.Algebra.Algebra.Opposite\npublic import Mathlib.Algebra.Group.Pointwise.Finset.Basic\npublic import Mathlib.Algebra.Group.Pointwise.Set.BigOperators\npublic import Mathlib.Algebra.Module.Submodule.Finsupp\npublic import Mathlib.Algebra.Ring.NonZeroDivisors\npublic import Mathlib.Algebra.Ring.Submonoid.Pointwise\npublic import Mathlib.Data.Set.Semiring\npublic import Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\n\nNamespace:\nSubmodule\n\nLocal context:\n/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `Pointwise` scope we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\nWhen `R` is not necessarily commutative, and `A` is merely an `R`-module with a ring structure\nsuch that `IsScalarTower R A A` holds (equivalent to the data of a ring homomorphism `R →+* A`\nby `ringHomEquivModuleIsScalarTower`), we can still define `1 : Submodule R A` and\n`Mul (Submodule R A)`, but `1` is only a left identity, not necessarily a right one.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n@[expose] public section\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen scoped Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n\nend SubMulAction\n\nnamespace Submodule\n\nsection Module\n\nvariable {R : Type u} [Semiring R] {A : Type v} [Semiring A] [Module R A]\n\n-- TODO: Why is this in a file about `Algebra`?\n-- TODO: potentially change this back to `LinearMap.range (Algebra.linearMap R A)`\n-- once a version of `Algebra` without the `commutes'` field is introduced.\n-- See issue https://github.com/leanprover-community/mathlib4/issues/18110.\n/-- `1 : Submodule R A` is the submodule `R ∙ 1` of `A`.\n-/\ninstance one : One (Submodule R A) :=\n ⟨LinearMap.range (LinearMap.toSpanSingleton R A 1)⟩\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 :=\n (LinearMap.span_singleton_eq_range _ _ _).symm\n\nTarget:\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid :=\n\nProof body:\n","proof_body":"by\n rintro x ⟨n, rfl⟩\n exact ⟨n, show (n : R) • (1 : A) = n by rw [Nat.cast_smul_eq_nsmul, nsmul_one]⟩","provenance":{"declaration_index":3,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"da141db26dfeae2848534dd12050c271b2a2bd6eee4fe6c31f061491cb23907d","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Operations.lean"},"sample_id":"3f89d75c2f514e055d4ca60e976b9fdcd703ff20e237a98c3c52617b8fc8e931","schema_version":1,"split":"train","theorem_statement":"theorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid :="} {"completion":"by\n simp [one_eq_span]","context_contains_namespace":true,"context_suffix":"end Module\nend Submodule","dependency_ids":["import:Mathlib.Algebra.Algebra.Bilinear","import:Mathlib.Algebra.Algebra.Opposite","import:Mathlib.Algebra.Group.Pointwise.Finset.Basic","import:Mathlib.Algebra.Group.Pointwise.Set.BigOperators","import:Mathlib.Algebra.Module.Submodule.Finsupp","import:Mathlib.Algebra.Ring.NonZeroDivisors","import:Mathlib.Algebra.Ring.Submonoid.Pointwise","import:Mathlib.Data.Set.Semiring","import:Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise"],"family_id":"one_le","file_id":"mathlib/Mathlib/Algebra/Algebra/Operations.lean","imports":["public import Mathlib.Algebra.Algebra.Bilinear","public import Mathlib.Algebra.Algebra.Opposite","public import Mathlib.Algebra.Group.Pointwise.Finset.Basic","public import Mathlib.Algebra.Group.Pointwise.Set.BigOperators","public import Mathlib.Algebra.Module.Submodule.Finsupp","public import Mathlib.Algebra.Ring.NonZeroDivisors","public import Mathlib.Algebra.Ring.Submonoid.Pointwise","public import Mathlib.Data.Set.Semiring","public import Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise"],"local_context":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `Pointwise` scope we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\nWhen `R` is not necessarily commutative, and `A` is merely an `R`-module with a ring structure\nsuch that `IsScalarTower R A A` holds (equivalent to the data of a ring homomorphism `R →+* A`\nby `ringHomEquivModuleIsScalarTower`), we can still define `1 : Submodule R A` and\n`Mul (Submodule R A)`, but `1` is only a left identity, not necessarily a right one.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n@[expose] public section\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen scoped Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n\nend SubMulAction\n\nnamespace Submodule\n\nsection Module\n\nvariable {R : Type u} [Semiring R] {A : Type v} [Semiring A] [Module R A]\n\n-- TODO: Why is this in a file about `Algebra`?\n-- TODO: potentially change this back to `LinearMap.range (Algebra.linearMap R A)`\n-- once a version of `Algebra` without the `commutes'` field is introduced.\n-- See issue https://github.com/leanprover-community/mathlib4/issues/18110.\n/-- `1 : Submodule R A` is the submodule `R ∙ 1` of `A`.\n-/\ninstance one : One (Submodule R A) :=\n ⟨LinearMap.range (LinearMap.toSpanSingleton R A 1)⟩\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 :=\n (LinearMap.span_singleton_eq_range _ _ _).symm\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, show (n : R) • (1 : A) = n by rw [Nat.cast_smul_eq_nsmul, nsmul_one]⟩\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ ↦ by rw [one_eq_span, SubMulAction.mem_one]; exact mem_span_singleton\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n\n@[simp]","module_header":true,"namespace":"Submodule","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Bilinear\npublic import Mathlib.Algebra.Algebra.Opposite\npublic import Mathlib.Algebra.Group.Pointwise.Finset.Basic\npublic import Mathlib.Algebra.Group.Pointwise.Set.BigOperators\npublic import Mathlib.Algebra.Module.Submodule.Finsupp\npublic import Mathlib.Algebra.Ring.NonZeroDivisors\npublic import Mathlib.Algebra.Ring.Submonoid.Pointwise\npublic import Mathlib.Data.Set.Semiring\npublic import Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\n\nNamespace:\nSubmodule\n\nLocal context:\n/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `Pointwise` scope we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\nWhen `R` is not necessarily commutative, and `A` is merely an `R`-module with a ring structure\nsuch that `IsScalarTower R A A` holds (equivalent to the data of a ring homomorphism `R →+* A`\nby `ringHomEquivModuleIsScalarTower`), we can still define `1 : Submodule R A` and\n`Mul (Submodule R A)`, but `1` is only a left identity, not necessarily a right one.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n@[expose] public section\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen scoped Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n\nend SubMulAction\n\nnamespace Submodule\n\nsection Module\n\nvariable {R : Type u} [Semiring R] {A : Type v} [Semiring A] [Module R A]\n\n-- TODO: Why is this in a file about `Algebra`?\n-- TODO: potentially change this back to `LinearMap.range (Algebra.linearMap R A)`\n-- once a version of `Algebra` without the `commutes'` field is introduced.\n-- See issue https://github.com/leanprover-community/mathlib4/issues/18110.\n/-- `1 : Submodule R A` is the submodule `R ∙ 1` of `A`.\n-/\ninstance one : One (Submodule R A) :=\n ⟨LinearMap.range (LinearMap.toSpanSingleton R A 1)⟩\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 :=\n (LinearMap.span_singleton_eq_range _ _ _).symm\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, show (n : R) • (1 : A) = n by rw [Nat.cast_smul_eq_nsmul, nsmul_one]⟩\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ ↦ by rw [one_eq_span, SubMulAction.mem_one]; exact mem_span_singleton\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n\n@[simp]\n\nTarget:\ntheorem one_le {P : Submodule R A} : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P :=\n\nProof body:\n","proof_body":"by\n simp [one_eq_span]","provenance":{"declaration_index":6,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"da141db26dfeae2848534dd12050c271b2a2bd6eee4fe6c31f061491cb23907d","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Operations.lean"},"sample_id":"f30d4bf50b0916d91331d2f7486688c0874f76ec0da89e7afce938521b376bdb","schema_version":1,"split":"train","theorem_statement":"theorem one_le {P : Submodule R A} : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P :="} {"completion":"by\n refine Exists.elim ?_ fun (h : x ∈ I • N) (H : p x h) ↦ H\n exact smul_induction_on hx (fun a ha x hx ↦ ⟨_, smul _ ha _ hx⟩)\n fun x y ⟨_, hx⟩ ⟨_, hy⟩ ↦ ⟨_, add _ _ _ _ hx hy⟩","context_contains_namespace":true,"context_suffix":"end\nend Module\nend Submodule","dependency_ids":["import:Mathlib.Algebra.Algebra.Bilinear","import:Mathlib.Algebra.Algebra.Opposite","import:Mathlib.Algebra.Group.Pointwise.Finset.Basic","import:Mathlib.Algebra.Group.Pointwise.Set.BigOperators","import:Mathlib.Algebra.Module.Submodule.Finsupp","import:Mathlib.Algebra.Ring.NonZeroDivisors","import:Mathlib.Algebra.Ring.Submonoid.Pointwise","import:Mathlib.Data.Set.Semiring","import:Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise"],"family_id":"smul_induction_on","file_id":"mathlib/Mathlib/Algebra/Algebra/Operations.lean","imports":["public import Mathlib.Algebra.Algebra.Bilinear","public import Mathlib.Algebra.Algebra.Opposite","public import Mathlib.Algebra.Group.Pointwise.Finset.Basic","public import Mathlib.Algebra.Group.Pointwise.Set.BigOperators","public import Mathlib.Algebra.Module.Submodule.Finsupp","public import Mathlib.Algebra.Ring.NonZeroDivisors","public import Mathlib.Algebra.Ring.Submonoid.Pointwise","public import Mathlib.Data.Set.Semiring","public import Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise"],"local_context":"/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `Pointwise` scope we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\nWhen `R` is not necessarily commutative, and `A` is merely an `R`-module with a ring structure\nsuch that `IsScalarTower R A A` holds (equivalent to the data of a ring homomorphism `R →+* A`\nby `ringHomEquivModuleIsScalarTower`), we can still define `1 : Submodule R A` and\n`Mul (Submodule R A)`, but `1` is only a left identity, not necessarily a right one.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n@[expose] public section\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen scoped Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n\nend SubMulAction\n\nnamespace Submodule\n\nsection Module\n\nvariable {R : Type u} [Semiring R] {A : Type v} [Semiring A] [Module R A]\n\n-- TODO: Why is this in a file about `Algebra`?\n-- TODO: potentially change this back to `LinearMap.range (Algebra.linearMap R A)`\n-- once a version of `Algebra` without the `commutes'` field is introduced.\n-- See issue https://github.com/leanprover-community/mathlib4/issues/18110.\n/-- `1 : Submodule R A` is the submodule `R ∙ 1` of `A`.\n-/\ninstance one : One (Submodule R A) :=\n ⟨LinearMap.range (LinearMap.toSpanSingleton R A 1)⟩\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 :=\n (LinearMap.span_singleton_eq_range _ _ _).symm\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, show (n : R) • (1 : A) = n by rw [Nat.cast_smul_eq_nsmul, nsmul_one]⟩\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ ↦ by rw [one_eq_span, SubMulAction.mem_one]; exact mem_span_singleton\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n\n@[simp]\ntheorem one_le {P : Submodule R A} : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n simp [one_eq_span]\n\ninstance : AddCommMonoidWithOne (Submodule R A) where\n add_comm := sup_comm\n\nvariable {M : Type*} [AddCommMonoid M] [Module R M] [Module A M] [IsScalarTower R A M]\n\ninstance : SMul (Submodule R A) (Submodule R M) where\n smul A' M' :=\n { __ := A'.toAddSubmonoid • M'.toAddSubmonoid\n smul_mem' := fun r m hm ↦ AddSubmonoid.smul_induction_on hm\n (fun a ha m hm ↦ by rw [← smul_assoc]; exact AddSubmonoid.smul_mem_smul (A'.smul_mem r ha) hm)\n fun m₁ m₂ h₁ h₂ ↦ by rw [smul_add]; exact (A'.1 • M'.1).add_mem h₁ h₂ }\n\nsection\n\nvariable {I J : Submodule R A} {N P : Submodule R M}\n\ntheorem smul_toAddSubmonoid : (I • N).toAddSubmonoid = I.toAddSubmonoid • N.toAddSubmonoid := rfl\n\ntheorem smul_mem_smul {r} {n} (hr : r ∈ I) (hn : n ∈ N) : r • n ∈ I • N :=\n AddSubmonoid.smul_mem_smul hr hn\n\ntheorem smul_le : I • N ≤ P ↔ ∀ r ∈ I, ∀ n ∈ N, r • n ∈ P :=\n AddSubmonoid.smul_le\n\n@[simp, norm_cast]\nlemma coe_set_smul : (I : Set A) • N = I • N :=\n set_smul_eq_of_le _ _ _\n (fun _ _ hr hx ↦ smul_mem_smul hr hx)\n (smul_le.mpr fun _ hr _ hx ↦ mem_set_smul_of_mem_mem hr hx)\n\n@[elab_as_elim]\ntheorem smul_induction_on {p : M → Prop} {x} (H : x ∈ I • N) (smul : ∀ r ∈ I, ∀ n ∈ N, p (r • n))\n (add : ∀ x y, p x → p y → p (x + y)) : p x :=\n AddSubmonoid.smul_induction_on H smul add\n\n/-- Dependent version of `Submodule.smul_induction_on`. -/\n@[elab_as_elim]","module_header":true,"namespace":"Submodule","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Bilinear\npublic import Mathlib.Algebra.Algebra.Opposite\npublic import Mathlib.Algebra.Group.Pointwise.Finset.Basic\npublic import Mathlib.Algebra.Group.Pointwise.Set.BigOperators\npublic import Mathlib.Algebra.Module.Submodule.Finsupp\npublic import Mathlib.Algebra.Ring.NonZeroDivisors\npublic import Mathlib.Algebra.Ring.Submonoid.Pointwise\npublic import Mathlib.Data.Set.Semiring\npublic import Mathlib.GroupTheory.GroupAction.SubMulAction.Pointwise\n\nNamespace:\nSubmodule\n\nLocal context:\n/-\nCopyright (c) 2019 Kenny Lau. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Kenny Lau\n-/\n/-!\n# Multiplication and division of submodules of an algebra.\n\nAn interface for multiplication and division of sub-R-modules of an R-algebra A is developed.\n\n## Main definitions\n\nLet `R` be a commutative ring (or semiring) and let `A` be an `R`-algebra.\n\n* `1 : Submodule R A` : the R-submodule R of the R-algebra A\n* `Mul (Submodule R A)` : multiplication of two sub-R-modules M and N of A is defined to be\n the smallest submodule containing all the products `m * n`.\n* `Div (Submodule R A)` : `I / J` is defined to be the submodule consisting of all `a : A` such\n that `a • J ⊆ I`\n\nIt is proved that `Submodule R A` is a semiring, and also an algebra over `Set A`.\n\nAdditionally, in the `Pointwise` scope we promote `Submodule.pointwiseDistribMulAction` to a\n`MulSemiringAction` as `Submodule.pointwiseMulSemiringAction`.\n\nWhen `R` is not necessarily commutative, and `A` is merely an `R`-module with a ring structure\nsuch that `IsScalarTower R A A` holds (equivalent to the data of a ring homomorphism `R →+* A`\nby `ringHomEquivModuleIsScalarTower`), we can still define `1 : Submodule R A` and\n`Mul (Submodule R A)`, but `1` is only a left identity, not necessarily a right one.\n\n## Tags\n\nmultiplication of submodules, division of submodules, submodule semiring\n-/\n\n@[expose] public section\n\n\nuniverse uι u v\n\nopen Algebra Set MulOpposite\n\nopen scoped Pointwise\n\nnamespace SubMulAction\n\nvariable {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Algebra R A]\n\ntheorem algebraMap_mem (r : R) : algebraMap R A r ∈ (1 : SubMulAction R A) :=\n ⟨r, (algebraMap_eq_smul_one r).symm⟩\n\ntheorem mem_one' {x : A} : x ∈ (1 : SubMulAction R A) ↔ ∃ y, algebraMap R A y = x :=\n exists_congr fun r => by rw [algebraMap_eq_smul_one]\n\nend SubMulAction\n\nnamespace Submodule\n\nsection Module\n\nvariable {R : Type u} [Semiring R] {A : Type v} [Semiring A] [Module R A]\n\n-- TODO: Why is this in a file about `Algebra`?\n-- TODO: potentially change this back to `LinearMap.range (Algebra.linearMap R A)`\n-- once a version of `Algebra` without the `commutes'` field is introduced.\n-- See issue https://github.com/leanprover-community/mathlib4/issues/18110.\n/-- `1 : Submodule R A` is the submodule `R ∙ 1` of `A`.\n-/\ninstance one : One (Submodule R A) :=\n ⟨LinearMap.range (LinearMap.toSpanSingleton R A 1)⟩\n\ntheorem one_eq_span : (1 : Submodule R A) = R ∙ 1 :=\n (LinearMap.span_singleton_eq_range _ _ _).symm\n\ntheorem le_one_toAddSubmonoid : 1 ≤ (1 : Submodule R A).toAddSubmonoid := by\n rintro x ⟨n, rfl⟩\n exact ⟨n, show (n : R) • (1 : A) = n by rw [Nat.cast_smul_eq_nsmul, nsmul_one]⟩\n\n@[simp]\ntheorem toSubMulAction_one : (1 : Submodule R A).toSubMulAction = 1 :=\n SetLike.ext fun _ ↦ by rw [one_eq_span, SubMulAction.mem_one]; exact mem_span_singleton\n\ntheorem one_eq_span_one_set : (1 : Submodule R A) = span R 1 :=\n one_eq_span\n\n@[simp]\ntheorem one_le {P : Submodule R A} : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P := by\n simp [one_eq_span]\n\ninstance : AddCommMonoidWithOne (Submodule R A) where\n add_comm := sup_comm\n\nvariable {M : Type*} [AddCommMonoid M] [Module R M] [Module A M] [IsScalarTower R A M]\n\ninstance : SMul (Submodule R A) (Submodule R M) where\n smul A' M' :=\n { __ := A'.toAddSubmonoid • M'.toAddSubmonoid\n smul_mem' := fun r m hm ↦ AddSubmonoid.smul_induction_on hm\n (fun a ha m hm ↦ by rw [← smul_assoc]; exact AddSubmonoid.smul_mem_smul (A'.smul_mem r ha) hm)\n fun m₁ m₂ h₁ h₂ ↦ by rw [smul_add]; exact (A'.1 • M'.1).add_mem h₁ h₂ }\n\nsection\n\nvariable {I J : Submodule R A} {N P : Submodule R M}\n\ntheorem smul_toAddSubmonoid : (I • N).toAddSubmonoid = I.toAddSubmonoid • N.toAddSubmonoid := rfl\n\ntheorem smul_mem_smul {r} {n} (hr : r ∈ I) (hn : n ∈ N) : r • n ∈ I • N :=\n AddSubmonoid.smul_mem_smul hr hn\n\ntheorem smul_le : I • N ≤ P ↔ ∀ r ∈ I, ∀ n ∈ N, r • n ∈ P :=\n AddSubmonoid.smul_le\n\n@[simp, norm_cast]\nlemma coe_set_smul : (I : Set A) • N = I • N :=\n set_smul_eq_of_le _ _ _\n (fun _ _ hr hx ↦ smul_mem_smul hr hx)\n (smul_le.mpr fun _ hr _ hx ↦ mem_set_smul_of_mem_mem hr hx)\n\n@[elab_as_elim]\ntheorem smul_induction_on {p : M → Prop} {x} (H : x ∈ I • N) (smul : ∀ r ∈ I, ∀ n ∈ N, p (r • n))\n (add : ∀ x y, p x → p y → p (x + y)) : p x :=\n AddSubmonoid.smul_induction_on H smul add\n\n/-- Dependent version of `Submodule.smul_induction_on`. -/\n@[elab_as_elim]\n\nTarget:\ntheorem smul_induction_on' {x : M} (hx : x ∈ I • N) {p : ∀ x, x ∈ I • N → Prop}\n (smul : ∀ (r : A) (hr : r ∈ I) (n : M) (hn : n ∈ N), p (r • n) (smul_mem_smul hr hn))\n (add : ∀ x hx y hy, p x hx → p y hy → p (x + y) (add_mem ‹_› ‹_›)) : p x hx :=\n\nProof body:\n","proof_body":"by\n refine Exists.elim ?_ fun (h : x ∈ I • N) (H : p x h) ↦ H\n exact smul_induction_on hx (fun a ha x hx ↦ ⟨_, smul _ ha _ hx⟩)\n fun x y ⟨_, hx⟩ ⟨_, hy⟩ ↦ ⟨_, add _ _ _ _ hx hy⟩","provenance":{"declaration_index":12,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"da141db26dfeae2848534dd12050c271b2a2bd6eee4fe6c31f061491cb23907d","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Operations.lean"},"sample_id":"8c82bd41b51284d959c2e9791f7e32abe15a7fbdbe43dc91440266d2b76e6a4c","schema_version":1,"split":"train","theorem_statement":"theorem smul_induction_on' {x : M} (hx : x ∈ I • N) {p : ∀ x, x ∈ I • N → Prop}\n (smul : ∀ (r : A) (hr : r ∈ I) (n : M) (hn : n ∈ N), p (r • n) (smul_mem_smul hr hn))\n (add : ∀ x hx y hy, p x hx → p y hy → p (x + y) (add_mem ‹_› ‹_›)) : p x hx :="} {"completion":"by\n refine (isEpi_iff_forall_one_tmul_eq R A).mpr fun a ↦ ?_\n obtain ⟨r, rfl⟩ := h a\n rw [algebraMap_eq_smul_one, smul_tmul]","context_contains_namespace":true,"context_suffix":"end Semiring\nend Algebra","dependency_ids":["import:Mathlib.Algebra.Algebra.Bilinear","import:Mathlib.LinearAlgebra.TensorProduct.Tower","import:Mathlib.RingTheory.Localization.FractionRing","import:Mathlib.RingTheory.TensorProduct.Finite"],"family_id":"isepi_of_surjective_algebramap","file_id":"mathlib/Mathlib/Algebra/Algebra/Epi.lean","imports":["public import Mathlib.Algebra.Algebra.Bilinear","public import Mathlib.LinearAlgebra.TensorProduct.Tower","public import Mathlib.RingTheory.Localization.FractionRing","public import Mathlib.RingTheory.TensorProduct.Finite"],"local_context":"/-\nCopyright (c) 2026 Oliver Nash. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Oliver Nash\n-/\n/-!\n# Algebras which are commutative ring epimorphisms\n-/\n\n@[expose] public section\n\nnoncomputable section\nopen Function TensorProduct\n\nnamespace Algebra\n\nsection Semiring\n\nvariable (R A : Type*) [CommSemiring R] [Semiring A] [Algebra R A]\n\n/-- A commutative `R`-algebra `A` is epi, if the multiplication map `A ⊗[R] A → A` is injective. -/\nprotected class IsEpi : Prop where\n injective_lift_mul : Injective <| lift <| LinearMap.mul R A\n\n/-- See also `CommRingCat.epi_iff_epi`. -/\nlemma isEpi_iff_forall_one_tmul_eq :\n Algebra.IsEpi R A ↔ ∀ a : A, 1 ⊗ₜ[R] a = a ⊗ₜ[R] 1 := by\n refine ⟨fun h a ↦ IsEpi.injective_lift_mul <| by simp, fun h ↦ ⟨fun x y hxy ↦ ?_⟩⟩\n have h' (x : A ⊗[R] A) : ∃ a : A, x = a ⊗ₜ 1 := by\n induction x using TensorProduct.induction_on with\n | zero => exact ⟨0, by simp⟩\n | tmul u v =>\n use u * v\n calc u ⊗ₜ[R] v = u ⊗ₜ[R] 1 * 1 ⊗ₜ[R] v := by simp\n _ = u ⊗ₜ[R] 1 * v ⊗ₜ[R] 1 := by rw [h]\n _ = (u * v) ⊗ₜ[R] 1 := by simp\n | add u v hu hv =>\n obtain ⟨u, rfl⟩ := hu\n obtain ⟨v, rfl⟩ := hv\n exact ⟨u + v, by simp [add_tmul]⟩\n obtain ⟨a, rfl⟩ := h' x\n obtain ⟨b, rfl⟩ := h' y\n aesop\n\n/-- See also `Algebra.isEpi_iff_surjective_algebraMap_of_finite`. -/","module_header":true,"namespace":"Algebra","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Bilinear\npublic import Mathlib.LinearAlgebra.TensorProduct.Tower\npublic import Mathlib.RingTheory.Localization.FractionRing\npublic import Mathlib.RingTheory.TensorProduct.Finite\n\nNamespace:\nAlgebra\n\nLocal context:\n/-\nCopyright (c) 2026 Oliver Nash. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Oliver Nash\n-/\n/-!\n# Algebras which are commutative ring epimorphisms\n-/\n\n@[expose] public section\n\nnoncomputable section\nopen Function TensorProduct\n\nnamespace Algebra\n\nsection Semiring\n\nvariable (R A : Type*) [CommSemiring R] [Semiring A] [Algebra R A]\n\n/-- A commutative `R`-algebra `A` is epi, if the multiplication map `A ⊗[R] A → A` is injective. -/\nprotected class IsEpi : Prop where\n injective_lift_mul : Injective <| lift <| LinearMap.mul R A\n\n/-- See also `CommRingCat.epi_iff_epi`. -/\nlemma isEpi_iff_forall_one_tmul_eq :\n Algebra.IsEpi R A ↔ ∀ a : A, 1 ⊗ₜ[R] a = a ⊗ₜ[R] 1 := by\n refine ⟨fun h a ↦ IsEpi.injective_lift_mul <| by simp, fun h ↦ ⟨fun x y hxy ↦ ?_⟩⟩\n have h' (x : A ⊗[R] A) : ∃ a : A, x = a ⊗ₜ 1 := by\n induction x using TensorProduct.induction_on with\n | zero => exact ⟨0, by simp⟩\n | tmul u v =>\n use u * v\n calc u ⊗ₜ[R] v = u ⊗ₜ[R] 1 * 1 ⊗ₜ[R] v := by simp\n _ = u ⊗ₜ[R] 1 * v ⊗ₜ[R] 1 := by rw [h]\n _ = (u * v) ⊗ₜ[R] 1 := by simp\n | add u v hu hv =>\n obtain ⟨u, rfl⟩ := hu\n obtain ⟨v, rfl⟩ := hv\n exact ⟨u + v, by simp [add_tmul]⟩\n obtain ⟨a, rfl⟩ := h' x\n obtain ⟨b, rfl⟩ := h' y\n aesop\n\n/-- See also `Algebra.isEpi_iff_surjective_algebraMap_of_finite`. -/\n\nTarget:\nlemma isEpi_of_surjective_algebraMap (h : Surjective (algebraMap R A)) :\n Algebra.IsEpi R A :=\n\nProof body:\n","proof_body":"by\n refine (isEpi_iff_forall_one_tmul_eq R A).mpr fun a ↦ ?_\n obtain ⟨r, rfl⟩ := h a\n rw [algebraMap_eq_smul_one, smul_tmul]","provenance":{"declaration_index":1,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"8556868e97c2f0a55cbc6fdeb87479062f2695e69c83e5f32206d26061a5f4d3","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Epi.lean"},"sample_id":"bfe876b9ad071a1b52e67fc8cf5ce982851d8bd7a9a026b1fb00551ecca04dea","schema_version":1,"split":"train","theorem_statement":"lemma isEpi_of_surjective_algebraMap (h : Surjective (algebraMap R A)) :\n Algebra.IsEpi R A :="} {"completion":"by\n refine ⟨fun h ↦ ?_, isEpi_of_surjective_algebraMap R A⟩\n let R' := (Algebra.linearMap R A).range\n rcases subsingleton_or_nontrivial (A ⧸ R') with h | _\n · rwa [Submodule.Quotient.subsingleton_iff, LinearMap.range_eq_top] at h\n have : Subsingleton ((A ⧸ R') ⊗[R] (A ⧸ R')) := by\n refine subsingleton_of_forall_eq 0 fun y ↦ ?_\n induction y with\n | zero => rfl\n | add a b e₁ e₂ => rwa [e₁, zero_add]\n | tmul x y =>\n obtain ⟨x, rfl⟩ := R'.mkQ_surjective x\n obtain ⟨y, rfl⟩ := R'.mkQ_surjective y\n obtain ⟨s, hs⟩ : ∃ s, 1 ⊗ₜ[R] s = x ⊗ₜ[R] y := by\n use x * y\n trans x ⊗ₜ 1 * 1 ⊗ₜ y\n · simp [(isEpi_iff_forall_one_tmul_eq R A).mp]\n · simp\n have : R'.mkQ 1 = 0 := (Submodule.Quotient.mk_eq_zero R').mpr ⟨1, map_one (algebraMap R A)⟩\n rw [← map_tmul R'.mkQ R'.mkQ, ← hs, map_tmul, this, zero_tmul]\n cases false_of_nontrivial_of_subsingleton ((A ⧸ R') ⊗[R] (A ⧸ R'))","context_contains_namespace":true,"context_suffix":"end Ring\nend Algebra","dependency_ids":["import:Mathlib.Algebra.Algebra.Bilinear","import:Mathlib.LinearAlgebra.TensorProduct.Tower","import:Mathlib.RingTheory.Localization.FractionRing","import:Mathlib.RingTheory.TensorProduct.Finite"],"family_id":"isepi_iff_surjective_algebramap_of_finite","file_id":"mathlib/Mathlib/Algebra/Algebra/Epi.lean","imports":["public import Mathlib.Algebra.Algebra.Bilinear","public import Mathlib.LinearAlgebra.TensorProduct.Tower","public import Mathlib.RingTheory.Localization.FractionRing","public import Mathlib.RingTheory.TensorProduct.Finite"],"local_context":"/-\nCopyright (c) 2026 Oliver Nash. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Oliver Nash\n-/\n/-!\n# Algebras which are commutative ring epimorphisms\n-/\n\n@[expose] public section\n\nnoncomputable section\nopen Function TensorProduct\n\nnamespace Algebra\n\nsection Semiring\n\nvariable (R A : Type*) [CommSemiring R] [Semiring A] [Algebra R A]\n\n/-- A commutative `R`-algebra `A` is epi, if the multiplication map `A ⊗[R] A → A` is injective. -/\nprotected class IsEpi : Prop where\n injective_lift_mul : Injective <| lift <| LinearMap.mul R A\n\n/-- See also `CommRingCat.epi_iff_epi`. -/\nlemma isEpi_iff_forall_one_tmul_eq :\n Algebra.IsEpi R A ↔ ∀ a : A, 1 ⊗ₜ[R] a = a ⊗ₜ[R] 1 := by\n refine ⟨fun h a ↦ IsEpi.injective_lift_mul <| by simp, fun h ↦ ⟨fun x y hxy ↦ ?_⟩⟩\n have h' (x : A ⊗[R] A) : ∃ a : A, x = a ⊗ₜ 1 := by\n induction x using TensorProduct.induction_on with\n | zero => exact ⟨0, by simp⟩\n | tmul u v =>\n use u * v\n calc u ⊗ₜ[R] v = u ⊗ₜ[R] 1 * 1 ⊗ₜ[R] v := by simp\n _ = u ⊗ₜ[R] 1 * v ⊗ₜ[R] 1 := by rw [h]\n _ = (u * v) ⊗ₜ[R] 1 := by simp\n | add u v hu hv =>\n obtain ⟨u, rfl⟩ := hu\n obtain ⟨v, rfl⟩ := hv\n exact ⟨u + v, by simp [add_tmul]⟩\n obtain ⟨a, rfl⟩ := h' x\n obtain ⟨b, rfl⟩ := h' y\n aesop\n\n/-- See also `Algebra.isEpi_iff_surjective_algebraMap_of_finite`. -/\nlemma isEpi_of_surjective_algebraMap (h : Surjective (algebraMap R A)) :\n Algebra.IsEpi R A := by\n refine (isEpi_iff_forall_one_tmul_eq R A).mpr fun a ↦ ?_\n obtain ⟨r, rfl⟩ := h a\n rw [algebraMap_eq_smul_one, smul_tmul]\n\nend Semiring\n\n-- TODO Generalise to any localization\ninstance (R A : Type*) [CommRing R] [IsDomain R] [Field A] [Algebra R A] [IsFractionRing R A] :\n Algebra.IsEpi R A := by\n refine (isEpi_iff_forall_one_tmul_eq R A).mpr fun x ↦ ?_\n obtain ⟨a, b, hb, rfl⟩ := IsFractionRing.div_surjective R x\n set f := algebraMap R A with hf\n replace hb : f b ≠ 0 := by aesop\n calc 1 ⊗ₜ[R] (f a / f b)\n = 1 ⊗ₜ[R] (a • (1 / f b)) := by rw [← smul_div_assoc, algebraMap_eq_smul_one a]\n _ = f a ⊗ₜ[R] (1 / f b) := by rw [← smul_tmul, algebraMap_eq_smul_one a]\n _ = (b • (f a / f b)) ⊗ₜ[R] (1 / f b) := by rw [smul_def, mul_div_cancel₀ _ hb]\n _ = (f a / f b) ⊗ₜ[R] (b • (1 / f b)) := by rw [smul_tmul]\n _ = (f a / f b) ⊗ₜ[R] 1 := by rw [smul_def, mul_div_cancel₀ _ hb]\n\nsection Ring\n\nvariable {R A : Type*} [CommRing R] [Ring A] [Algebra R A]","module_header":true,"namespace":"Algebra","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Bilinear\npublic import Mathlib.LinearAlgebra.TensorProduct.Tower\npublic import Mathlib.RingTheory.Localization.FractionRing\npublic import Mathlib.RingTheory.TensorProduct.Finite\n\nNamespace:\nAlgebra\n\nLocal context:\n/-\nCopyright (c) 2026 Oliver Nash. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Oliver Nash\n-/\n/-!\n# Algebras which are commutative ring epimorphisms\n-/\n\n@[expose] public section\n\nnoncomputable section\nopen Function TensorProduct\n\nnamespace Algebra\n\nsection Semiring\n\nvariable (R A : Type*) [CommSemiring R] [Semiring A] [Algebra R A]\n\n/-- A commutative `R`-algebra `A` is epi, if the multiplication map `A ⊗[R] A → A` is injective. -/\nprotected class IsEpi : Prop where\n injective_lift_mul : Injective <| lift <| LinearMap.mul R A\n\n/-- See also `CommRingCat.epi_iff_epi`. -/\nlemma isEpi_iff_forall_one_tmul_eq :\n Algebra.IsEpi R A ↔ ∀ a : A, 1 ⊗ₜ[R] a = a ⊗ₜ[R] 1 := by\n refine ⟨fun h a ↦ IsEpi.injective_lift_mul <| by simp, fun h ↦ ⟨fun x y hxy ↦ ?_⟩⟩\n have h' (x : A ⊗[R] A) : ∃ a : A, x = a ⊗ₜ 1 := by\n induction x using TensorProduct.induction_on with\n | zero => exact ⟨0, by simp⟩\n | tmul u v =>\n use u * v\n calc u ⊗ₜ[R] v = u ⊗ₜ[R] 1 * 1 ⊗ₜ[R] v := by simp\n _ = u ⊗ₜ[R] 1 * v ⊗ₜ[R] 1 := by rw [h]\n _ = (u * v) ⊗ₜ[R] 1 := by simp\n | add u v hu hv =>\n obtain ⟨u, rfl⟩ := hu\n obtain ⟨v, rfl⟩ := hv\n exact ⟨u + v, by simp [add_tmul]⟩\n obtain ⟨a, rfl⟩ := h' x\n obtain ⟨b, rfl⟩ := h' y\n aesop\n\n/-- See also `Algebra.isEpi_iff_surjective_algebraMap_of_finite`. -/\nlemma isEpi_of_surjective_algebraMap (h : Surjective (algebraMap R A)) :\n Algebra.IsEpi R A := by\n refine (isEpi_iff_forall_one_tmul_eq R A).mpr fun a ↦ ?_\n obtain ⟨r, rfl⟩ := h a\n rw [algebraMap_eq_smul_one, smul_tmul]\n\nend Semiring\n\n-- TODO Generalise to any localization\ninstance (R A : Type*) [CommRing R] [IsDomain R] [Field A] [Algebra R A] [IsFractionRing R A] :\n Algebra.IsEpi R A := by\n refine (isEpi_iff_forall_one_tmul_eq R A).mpr fun x ↦ ?_\n obtain ⟨a, b, hb, rfl⟩ := IsFractionRing.div_surjective R x\n set f := algebraMap R A with hf\n replace hb : f b ≠ 0 := by aesop\n calc 1 ⊗ₜ[R] (f a / f b)\n = 1 ⊗ₜ[R] (a • (1 / f b)) := by rw [← smul_div_assoc, algebraMap_eq_smul_one a]\n _ = f a ⊗ₜ[R] (1 / f b) := by rw [← smul_tmul, algebraMap_eq_smul_one a]\n _ = (b • (f a / f b)) ⊗ₜ[R] (1 / f b) := by rw [smul_def, mul_div_cancel₀ _ hb]\n _ = (f a / f b) ⊗ₜ[R] (b • (1 / f b)) := by rw [smul_tmul]\n _ = (f a / f b) ⊗ₜ[R] 1 := by rw [smul_def, mul_div_cancel₀ _ hb]\n\nsection Ring\n\nvariable {R A : Type*} [CommRing R] [Ring A] [Algebra R A]\n\nTarget:\nlemma isEpi_iff_surjective_algebraMap_of_finite [Module.Finite R A] :\n Algebra.IsEpi R A ↔ Surjective (algebraMap R A) :=\n\nProof body:\n","proof_body":"by\n refine ⟨fun h ↦ ?_, isEpi_of_surjective_algebraMap R A⟩\n let R' := (Algebra.linearMap R A).range\n rcases subsingleton_or_nontrivial (A ⧸ R') with h | _\n · rwa [Submodule.Quotient.subsingleton_iff, LinearMap.range_eq_top] at h\n have : Subsingleton ((A ⧸ R') ⊗[R] (A ⧸ R')) := by\n refine subsingleton_of_forall_eq 0 fun y ↦ ?_\n induction y with\n | zero => rfl\n | add a b e₁ e₂ => rwa [e₁, zero_add]\n | tmul x y =>\n obtain ⟨x, rfl⟩ := R'.mkQ_surjective x\n obtain ⟨y, rfl⟩ := R'.mkQ_surjective y\n obtain ⟨s, hs⟩ : ∃ s, 1 ⊗ₜ[R] s = x ⊗ₜ[R] y := by\n use x * y\n trans x ⊗ₜ 1 * 1 ⊗ₜ y\n · simp [(isEpi_iff_forall_one_tmul_eq R A).mp]\n · simp\n have : R'.mkQ 1 = 0 := (Submodule.Quotient.mk_eq_zero R').mpr ⟨1, map_one (algebraMap R A)⟩\n rw [← map_tmul R'.mkQ R'.mkQ, ← hs, map_tmul, this, zero_tmul]\n cases false_of_nontrivial_of_subsingleton ((A ⧸ R') ⊗[R] (A ⧸ R'))","provenance":{"declaration_index":2,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"8556868e97c2f0a55cbc6fdeb87479062f2695e69c83e5f32206d26061a5f4d3","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Epi.lean"},"sample_id":"eea1f5123c61fd5e1de6991cbe03c34032dcb4958d7e305f2785a7075e3c52e6","schema_version":1,"split":"train","theorem_statement":"lemma isEpi_iff_surjective_algebraMap_of_finite [Module.Finite R A] :\n Algebra.IsEpi R A ↔ Surjective (algebraMap R A) :="} {"completion":"by\n have (a b : A) := calc a ⊗ₜ[R] b\n = a • (1 ⊗ₜ[R] b) := by rw [tmul_eq_smul_one_tmul]\n _ = a • (b ⊗ₜ[R] 1) := by rw [(isEpi_iff_forall_one_tmul_eq R A).mp inferInstance b]\n _ = a • (b • (1 ⊗ₜ[R] 1)) := by rw [tmul_eq_smul_one_tmul]\n rw [this a b, this b a, smul_comm]","context_contains_namespace":true,"context_suffix":"end CommSemiring\nend Algebra","dependency_ids":["import:Mathlib.Algebra.Algebra.Bilinear","import:Mathlib.LinearAlgebra.TensorProduct.Tower","import:Mathlib.RingTheory.Localization.FractionRing","import:Mathlib.RingTheory.TensorProduct.Finite"],"family_id":"tmul_comm","file_id":"mathlib/Mathlib/Algebra/Algebra/Epi.lean","imports":["public import Mathlib.Algebra.Algebra.Bilinear","public import Mathlib.LinearAlgebra.TensorProduct.Tower","public import Mathlib.RingTheory.Localization.FractionRing","public import Mathlib.RingTheory.TensorProduct.Finite"],"local_context":"/-\nCopyright (c) 2026 Oliver Nash. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Oliver Nash\n-/\n/-!\n# Algebras which are commutative ring epimorphisms\n-/\n\n@[expose] public section\n\nnoncomputable section\nopen Function TensorProduct\n\nnamespace Algebra\n\nsection Semiring\n\nvariable (R A : Type*) [CommSemiring R] [Semiring A] [Algebra R A]\n\n/-- A commutative `R`-algebra `A` is epi, if the multiplication map `A ⊗[R] A → A` is injective. -/\nprotected class IsEpi : Prop where\n injective_lift_mul : Injective <| lift <| LinearMap.mul R A\n\n/-- See also `CommRingCat.epi_iff_epi`. -/\nlemma isEpi_iff_forall_one_tmul_eq :\n Algebra.IsEpi R A ↔ ∀ a : A, 1 ⊗ₜ[R] a = a ⊗ₜ[R] 1 := by\n refine ⟨fun h a ↦ IsEpi.injective_lift_mul <| by simp, fun h ↦ ⟨fun x y hxy ↦ ?_⟩⟩\n have h' (x : A ⊗[R] A) : ∃ a : A, x = a ⊗ₜ 1 := by\n induction x using TensorProduct.induction_on with\n | zero => exact ⟨0, by simp⟩\n | tmul u v =>\n use u * v\n calc u ⊗ₜ[R] v = u ⊗ₜ[R] 1 * 1 ⊗ₜ[R] v := by simp\n _ = u ⊗ₜ[R] 1 * v ⊗ₜ[R] 1 := by rw [h]\n _ = (u * v) ⊗ₜ[R] 1 := by simp\n | add u v hu hv =>\n obtain ⟨u, rfl⟩ := hu\n obtain ⟨v, rfl⟩ := hv\n exact ⟨u + v, by simp [add_tmul]⟩\n obtain ⟨a, rfl⟩ := h' x\n obtain ⟨b, rfl⟩ := h' y\n aesop\n\n/-- See also `Algebra.isEpi_iff_surjective_algebraMap_of_finite`. -/\nlemma isEpi_of_surjective_algebraMap (h : Surjective (algebraMap R A)) :\n Algebra.IsEpi R A := by\n refine (isEpi_iff_forall_one_tmul_eq R A).mpr fun a ↦ ?_\n obtain ⟨r, rfl⟩ := h a\n rw [algebraMap_eq_smul_one, smul_tmul]\n\nend Semiring\n\n-- TODO Generalise to any localization\ninstance (R A : Type*) [CommRing R] [IsDomain R] [Field A] [Algebra R A] [IsFractionRing R A] :\n Algebra.IsEpi R A := by\n refine (isEpi_iff_forall_one_tmul_eq R A).mpr fun x ↦ ?_\n obtain ⟨a, b, hb, rfl⟩ := IsFractionRing.div_surjective R x\n set f := algebraMap R A with hf\n replace hb : f b ≠ 0 := by aesop\n calc 1 ⊗ₜ[R] (f a / f b)\n = 1 ⊗ₜ[R] (a • (1 / f b)) := by rw [← smul_div_assoc, algebraMap_eq_smul_one a]\n _ = f a ⊗ₜ[R] (1 / f b) := by rw [← smul_tmul, algebraMap_eq_smul_one a]\n _ = (b • (f a / f b)) ⊗ₜ[R] (1 / f b) := by rw [smul_def, mul_div_cancel₀ _ hb]\n _ = (f a / f b) ⊗ₜ[R] (b • (1 / f b)) := by rw [smul_tmul]\n _ = (f a / f b) ⊗ₜ[R] 1 := by rw [smul_def, mul_div_cancel₀ _ hb]\n\nsection Ring\n\nvariable {R A : Type*} [CommRing R] [Ring A] [Algebra R A]\n\nlemma isEpi_iff_surjective_algebraMap_of_finite [Module.Finite R A] :\n Algebra.IsEpi R A ↔ Surjective (algebraMap R A) := by\n refine ⟨fun h ↦ ?_, isEpi_of_surjective_algebraMap R A⟩\n let R' := (Algebra.linearMap R A).range\n rcases subsingleton_or_nontrivial (A ⧸ R') with h | _\n · rwa [Submodule.Quotient.subsingleton_iff, LinearMap.range_eq_top] at h\n have : Subsingleton ((A ⧸ R') ⊗[R] (A ⧸ R')) := by\n refine subsingleton_of_forall_eq 0 fun y ↦ ?_\n induction y with\n | zero => rfl\n | add a b e₁ e₂ => rwa [e₁, zero_add]\n | tmul x y =>\n obtain ⟨x, rfl⟩ := R'.mkQ_surjective x\n obtain ⟨y, rfl⟩ := R'.mkQ_surjective y\n obtain ⟨s, hs⟩ : ∃ s, 1 ⊗ₜ[R] s = x ⊗ₜ[R] y := by\n use x * y\n trans x ⊗ₜ 1 * 1 ⊗ₜ y\n · simp [(isEpi_iff_forall_one_tmul_eq R A).mp]\n · simp\n have : R'.mkQ 1 = 0 := (Submodule.Quotient.mk_eq_zero R').mpr ⟨1, map_one (algebraMap R A)⟩\n rw [← map_tmul R'.mkQ R'.mkQ, ← hs, map_tmul, this, zero_tmul]\n cases false_of_nontrivial_of_subsingleton ((A ⧸ R') ⊗[R] (A ⧸ R'))\n\n@[deprecated (since := \"2026-01-13\")]\nalias _root_.RingHom.surjective_of_tmul_eq_tmul_of_finite :=\n isEpi_iff_surjective_algebraMap_of_finite\n\nend Ring\n\nsection CommSemiring\n\nvariable (R A : Type*) [CommSemiring R] [CommSemiring A] [Algebra R A] [Algebra.IsEpi R A]\n\nvariable {A} in","module_header":true,"namespace":"Algebra","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.Algebra.Algebra.Bilinear\npublic import Mathlib.LinearAlgebra.TensorProduct.Tower\npublic import Mathlib.RingTheory.Localization.FractionRing\npublic import Mathlib.RingTheory.TensorProduct.Finite\n\nNamespace:\nAlgebra\n\nLocal context:\n/-\nCopyright (c) 2026 Oliver Nash. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Oliver Nash\n-/\n/-!\n# Algebras which are commutative ring epimorphisms\n-/\n\n@[expose] public section\n\nnoncomputable section\nopen Function TensorProduct\n\nnamespace Algebra\n\nsection Semiring\n\nvariable (R A : Type*) [CommSemiring R] [Semiring A] [Algebra R A]\n\n/-- A commutative `R`-algebra `A` is epi, if the multiplication map `A ⊗[R] A → A` is injective. -/\nprotected class IsEpi : Prop where\n injective_lift_mul : Injective <| lift <| LinearMap.mul R A\n\n/-- See also `CommRingCat.epi_iff_epi`. -/\nlemma isEpi_iff_forall_one_tmul_eq :\n Algebra.IsEpi R A ↔ ∀ a : A, 1 ⊗ₜ[R] a = a ⊗ₜ[R] 1 := by\n refine ⟨fun h a ↦ IsEpi.injective_lift_mul <| by simp, fun h ↦ ⟨fun x y hxy ↦ ?_⟩⟩\n have h' (x : A ⊗[R] A) : ∃ a : A, x = a ⊗ₜ 1 := by\n induction x using TensorProduct.induction_on with\n | zero => exact ⟨0, by simp⟩\n | tmul u v =>\n use u * v\n calc u ⊗ₜ[R] v = u ⊗ₜ[R] 1 * 1 ⊗ₜ[R] v := by simp\n _ = u ⊗ₜ[R] 1 * v ⊗ₜ[R] 1 := by rw [h]\n _ = (u * v) ⊗ₜ[R] 1 := by simp\n | add u v hu hv =>\n obtain ⟨u, rfl⟩ := hu\n obtain ⟨v, rfl⟩ := hv\n exact ⟨u + v, by simp [add_tmul]⟩\n obtain ⟨a, rfl⟩ := h' x\n obtain ⟨b, rfl⟩ := h' y\n aesop\n\n/-- See also `Algebra.isEpi_iff_surjective_algebraMap_of_finite`. -/\nlemma isEpi_of_surjective_algebraMap (h : Surjective (algebraMap R A)) :\n Algebra.IsEpi R A := by\n refine (isEpi_iff_forall_one_tmul_eq R A).mpr fun a ↦ ?_\n obtain ⟨r, rfl⟩ := h a\n rw [algebraMap_eq_smul_one, smul_tmul]\n\nend Semiring\n\n-- TODO Generalise to any localization\ninstance (R A : Type*) [CommRing R] [IsDomain R] [Field A] [Algebra R A] [IsFractionRing R A] :\n Algebra.IsEpi R A := by\n refine (isEpi_iff_forall_one_tmul_eq R A).mpr fun x ↦ ?_\n obtain ⟨a, b, hb, rfl⟩ := IsFractionRing.div_surjective R x\n set f := algebraMap R A with hf\n replace hb : f b ≠ 0 := by aesop\n calc 1 ⊗ₜ[R] (f a / f b)\n = 1 ⊗ₜ[R] (a • (1 / f b)) := by rw [← smul_div_assoc, algebraMap_eq_smul_one a]\n _ = f a ⊗ₜ[R] (1 / f b) := by rw [← smul_tmul, algebraMap_eq_smul_one a]\n _ = (b • (f a / f b)) ⊗ₜ[R] (1 / f b) := by rw [smul_def, mul_div_cancel₀ _ hb]\n _ = (f a / f b) ⊗ₜ[R] (b • (1 / f b)) := by rw [smul_tmul]\n _ = (f a / f b) ⊗ₜ[R] 1 := by rw [smul_def, mul_div_cancel₀ _ hb]\n\nsection Ring\n\nvariable {R A : Type*} [CommRing R] [Ring A] [Algebra R A]\n\nlemma isEpi_iff_surjective_algebraMap_of_finite [Module.Finite R A] :\n Algebra.IsEpi R A ↔ Surjective (algebraMap R A) := by\n refine ⟨fun h ↦ ?_, isEpi_of_surjective_algebraMap R A⟩\n let R' := (Algebra.linearMap R A).range\n rcases subsingleton_or_nontrivial (A ⧸ R') with h | _\n · rwa [Submodule.Quotient.subsingleton_iff, LinearMap.range_eq_top] at h\n have : Subsingleton ((A ⧸ R') ⊗[R] (A ⧸ R')) := by\n refine subsingleton_of_forall_eq 0 fun y ↦ ?_\n induction y with\n | zero => rfl\n | add a b e₁ e₂ => rwa [e₁, zero_add]\n | tmul x y =>\n obtain ⟨x, rfl⟩ := R'.mkQ_surjective x\n obtain ⟨y, rfl⟩ := R'.mkQ_surjective y\n obtain ⟨s, hs⟩ : ∃ s, 1 ⊗ₜ[R] s = x ⊗ₜ[R] y := by\n use x * y\n trans x ⊗ₜ 1 * 1 ⊗ₜ y\n · simp [(isEpi_iff_forall_one_tmul_eq R A).mp]\n · simp\n have : R'.mkQ 1 = 0 := (Submodule.Quotient.mk_eq_zero R').mpr ⟨1, map_one (algebraMap R A)⟩\n rw [← map_tmul R'.mkQ R'.mkQ, ← hs, map_tmul, this, zero_tmul]\n cases false_of_nontrivial_of_subsingleton ((A ⧸ R') ⊗[R] (A ⧸ R'))\n\n@[deprecated (since := \"2026-01-13\")]\nalias _root_.RingHom.surjective_of_tmul_eq_tmul_of_finite :=\n isEpi_iff_surjective_algebraMap_of_finite\n\nend Ring\n\nsection CommSemiring\n\nvariable (R A : Type*) [CommSemiring R] [CommSemiring A] [Algebra R A] [Algebra.IsEpi R A]\n\nvariable {A} in\n\nTarget:\nlemma tmul_comm (a b : A) :\n a ⊗ₜ[R] b = b ⊗ₜ[R] a :=\n\nProof body:\n","proof_body":"by\n have (a b : A) := calc a ⊗ₜ[R] b\n = a • (1 ⊗ₜ[R] b) := by rw [tmul_eq_smul_one_tmul]\n _ = a • (b ⊗ₜ[R] 1) := by rw [(isEpi_iff_forall_one_tmul_eq R A).mp inferInstance b]\n _ = a • (b • (1 ⊗ₜ[R] 1)) := by rw [tmul_eq_smul_one_tmul]\n rw [this a b, this b a, smul_comm]","provenance":{"declaration_index":3,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"8556868e97c2f0a55cbc6fdeb87479062f2695e69c83e5f32206d26061a5f4d3","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/Algebra/Epi.lean"},"sample_id":"d1ce3363b601abdd78368d5468d824b761f38f793d16f2416f39ac8ae5dc0d54","schema_version":1,"split":"train","theorem_statement":"lemma tmul_comm (a b : A) :\n a ⊗ₜ[R] b = b ⊗ₜ[R] a :="} {"completion":"by\n simpa [embedding] using! mk_left_injective 0","context_contains_namespace":true,"context_suffix":"end AffineAddMonoid","dependency_ids":["import:Mathlib.GroupTheory.Finiteness","import:Mathlib.GroupTheory.FreeAbelianGroup","import:Mathlib.GroupTheory.MonoidLocalization.GrothendieckGroup","import:Mathlib.LinearAlgebra.Dimension.Finrank","import:Mathlib.Algebra.EuclideanDomain.Int","import:Mathlib.GroupTheory.MonoidLocalization.Finite","import:Mathlib.LinearAlgebra.Dimension.Free","import:Mathlib.LinearAlgebra.FreeModule.PID","import:Mathlib.LinearAlgebra.Dimension.Free"],"family_id":"embedding_injective","file_id":"mathlib/Mathlib/Algebra/AffineMonoid/Embedding.lean","imports":["public import Mathlib.GroupTheory.Finiteness","public import Mathlib.GroupTheory.FreeAbelianGroup","public import Mathlib.GroupTheory.MonoidLocalization.GrothendieckGroup","public import Mathlib.LinearAlgebra.Dimension.Finrank","import Mathlib.Algebra.EuclideanDomain.Int","import Mathlib.GroupTheory.MonoidLocalization.Finite","import Mathlib.LinearAlgebra.Dimension.Free","import Mathlib.LinearAlgebra.FreeModule.PID","public import Mathlib.LinearAlgebra.Dimension.Free"],"local_context":"/-\nCopyright (c) 2025 Yaël Dillies, Patrick Luo. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yaël Dillies, Patrick Luo\n-/\n/-!\n# Affine monoids embed into `ℤⁿ`\n\nThis file proves that finitely generated cancellative torsion-free commutative monoids embed into\n`ℤⁿ` for some `n`.\n-/\n\npublic section\n\nopen Algebra AddLocalization Function\n\nvariable {M : Type*} [AddCancelCommMonoid M] [AddMonoid.FG M] [IsAddTorsionFree M]\n\nnamespace AffineAddMonoid\n\nvariable (M) in\n/-- The dimension of an affine monoid `M`, namely the minimum `n` for which `M` embeds into `ℤⁿ`. -/\nnoncomputable abbrev dim := Module.finrank ℤ <| GrothendieckAddGroup M\n\nvariable (M) in\n/-- An arbitrary embedding of an affine monoid `M` into `ℤ ^ dim M`. -/\nnoncomputable def embedding : M →+ FreeAbelianGroup (Fin (dim M)) :=\n .comp (FreeAbelianGroup.equivFinsupp _).symm.toAddMonoidHom <|\n .comp (Module.finBasis ℤ _).repr.toAddMonoidHom\n (addMonoidOf ⊤).toAddMonoidHom","module_header":true,"namespace":"AffineAddMonoid","prompt":"Return exactly one Lean proof body beginning with `by`. Do not emit prose, fences, declarations, sorry, admit, by?, or warnings.\n\nImports:\npublic import Mathlib.GroupTheory.Finiteness\npublic import Mathlib.GroupTheory.FreeAbelianGroup\npublic import Mathlib.GroupTheory.MonoidLocalization.GrothendieckGroup\npublic import Mathlib.LinearAlgebra.Dimension.Finrank\nimport Mathlib.Algebra.EuclideanDomain.Int\nimport Mathlib.GroupTheory.MonoidLocalization.Finite\nimport Mathlib.LinearAlgebra.Dimension.Free\nimport Mathlib.LinearAlgebra.FreeModule.PID\npublic import Mathlib.LinearAlgebra.Dimension.Free\n\nNamespace:\nAffineAddMonoid\n\nLocal context:\n/-\nCopyright (c) 2025 Yaël Dillies, Patrick Luo. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Yaël Dillies, Patrick Luo\n-/\n/-!\n# Affine monoids embed into `ℤⁿ`\n\nThis file proves that finitely generated cancellative torsion-free commutative monoids embed into\n`ℤⁿ` for some `n`.\n-/\n\npublic section\n\nopen Algebra AddLocalization Function\n\nvariable {M : Type*} [AddCancelCommMonoid M] [AddMonoid.FG M] [IsAddTorsionFree M]\n\nnamespace AffineAddMonoid\n\nvariable (M) in\n/-- The dimension of an affine monoid `M`, namely the minimum `n` for which `M` embeds into `ℤⁿ`. -/\nnoncomputable abbrev dim := Module.finrank ℤ <| GrothendieckAddGroup M\n\nvariable (M) in\n/-- An arbitrary embedding of an affine monoid `M` into `ℤ ^ dim M`. -/\nnoncomputable def embedding : M →+ FreeAbelianGroup (Fin (dim M)) :=\n .comp (FreeAbelianGroup.equivFinsupp _).symm.toAddMonoidHom <|\n .comp (Module.finBasis ℤ _).repr.toAddMonoidHom\n (addMonoidOf ⊤).toAddMonoidHom\n\nTarget:\nlemma embedding_injective : Injective (embedding M) :=\n\nProof body:\n","proof_body":"by\n simpa [embedding] using! mk_left_injective 0","provenance":{"declaration_index":0,"environment_hash":"08dda26699fe1025520aeb9450ff1df6b58e8ef0aa8100ae158997e8a703b831","lean_toolchain":"leanprover/lean4:v4.32.0-rc1","license":"Apache-2.0","original_import_scope":"module-specific","source_revision":"360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56","source_sha256":"6a5fde6c2ff3d7c97172431450fb5cc1acfa83a2b3092b3495d485869ef8e36d","source_uri":"https://github.com/leanprover-community/mathlib4/blob/360da6fa66c1273b76b6b2d8c5666fd5ac2e3b56/Mathlib/Algebra/AffineMonoid/Embedding.lean"},"sample_id":"77eed944ef31e311a95974ccefa4348c24d9ca511211310dc601bdd2dddb3955","schema_version":1,"split":"train","theorem_statement":"lemma embedding_injective : Injective (embedding M) :="}