Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Algebra): add missing substructure lemmas #20269

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions Mathlib/Algebra/Algebra/Subalgebra/Unitization.lean
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,36 @@ variable {R : Type*} [NonAssocSemiring R]
def Subsemiring.toNonUnitalSubsemiring (S : Subsemiring R) : NonUnitalSubsemiring R :=
{ S with }

theorem Subsemiring.toNonUnitalSubsemiring_injective :
Function.Injective (toNonUnitalSubsemiring : Subsemiring R → _) :=
fun S₁ S₂ h => SetLike.ext'_iff.2 (
show (S₁.toNonUnitalSubsemiring : Set R) = S₂ from SetLike.ext'_iff.1 h)

@[simp]
theorem Subsemiring.toNonUnitalSubsemiring_eq {S₁ S₂ : Subsemiring R} :
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
theorem Subsemiring.toNonUnitalSubsemiring_eq {S₁ S₂ : Subsemiring R} :
theorem Subsemiring.toNonUnitalSubsemiring_inj {S₁ S₂ : Subsemiring R} :

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

named by analogy to e.g. Subgroup.toSubmonoid_eq

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, many precedents exist for both conventions
is there consensus on which is preferred?

S₁.toNonUnitalSubsemiring = S₂.toNonUnitalSubsemiring ↔ S₁ = S₂ :=
toNonUnitalSubsemiring_injective.eq_iff

@[simp]
theorem Subsemiring.mem_toNonUnitalSubsemiring {S : Subsemiring R}
{x : R} : x ∈ S.toNonUnitalSubsemiring ↔ x ∈ S := Iff.rfl

@[simp]
theorem Subsemiring.coe_toNonUnitalSubsemiring (S : Subsemiring R) :
(S.toNonUnitalSubsemiring : Set R) = S := rfl

theorem Subsemiring.one_mem_toNonUnitalSubsemiring (S : Subsemiring R) :
(1 : R) ∈ S.toNonUnitalSubsemiring :=
S.one_mem

@[simp]
theorem Submonoid.subsemiringClosure_toNonUnitalSubsemiring {M : Submonoid R} :
M.subsemiringClosure.toNonUnitalSubsemiring = .closure M := by
refine Eq.symm (NonUnitalSubsemiring.closure_eq_of_le ?_ (fun _ hx => ?_))
· simp [Submonoid.subsemiringClosure_coe]
· simp [Submonoid.subsemiringClosure_mem] at hx
induction hx using AddSubmonoid.closure_induction <;> aesop

/-- Turn a non-unital subsemiring containing `1` into a subsemiring. -/
def NonUnitalSubsemiring.toSubsemiring (S : NonUnitalSubsemiring R) (h1 : (1 : R) ∈ S) :
Subsemiring R :=
Expand Down Expand Up @@ -241,7 +267,7 @@ theorem unitization_apply (x : Unitization ℕ s) : unitization s x = x.fst + x.
rfl

theorem unitization_range :
(unitization s).range = subalgebraOfSubsemiring (Subsemiring.closure s) := by
(unitization s).range = subalgebraOfSubsemiring (.closure s) := by
have := AddSubmonoidClass.nsmulMemClass (S := S)
rw [unitization, NonUnitalSubalgebra.unitization_range (hSRA := this), Algebra.adjoin_nat]

Expand Down Expand Up @@ -288,7 +314,7 @@ theorem unitization_apply (x : Unitization ℤ s) : unitization s x = x.fst + x.
rfl

theorem unitization_range :
(unitization s).range = subalgebraOfSubring (Subring.closure s) := by
(unitization s).range = subalgebraOfSubring (.closure s) := by
have := AddSubgroupClass.zsmulMemClass (S := S)
rw [unitization, NonUnitalSubalgebra.unitization_range (hSRA := this), Algebra.adjoin_int]

Expand Down
4 changes: 4 additions & 0 deletions Mathlib/Algebra/Ring/Subsemiring/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,10 @@ theorem subsemiringClosure_coe :
(M.subsemiringClosure : Set R) = AddSubmonoid.closure (M : Set R) :=
rfl

theorem subsemiringClosure_mem {x : R} :
x ∈ M.subsemiringClosure ↔ x ∈ AddSubmonoid.closure (M : Set R) :=
Iff.rfl

theorem subsemiringClosure_toAddSubmonoid :
M.subsemiringClosure.toAddSubmonoid = AddSubmonoid.closure (M : Set R) :=
rfl
Expand Down
Loading