Skip to content

Commit 2001fec

Browse files
committed
feat: transfer star-related instances across equivalences
1 parent 61a1558 commit 2001fec

File tree

2 files changed

+93
-1
lines changed

2 files changed

+93
-1
lines changed

Mathlib/Algebra/Star/Basic.lean

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ theorem star_inj [InvolutiveStar R] {x y : R} : star x = star y ↔ x = y :=
9393
star_injective.eq_iff
9494

9595
/-- `star` as an equivalence when it is involutive. -/
96-
protected def Equiv.star [InvolutiveStar R] : Equiv.Perm R :=
96+
protected def Equiv.Perm.star [InvolutiveStar R] : Equiv.Perm R :=
9797
star_involutive.toPerm _
9898

9999
theorem eq_star_of_eq_star [InvolutiveStar R] {r s : R} (h : r = star s) : s = star r := by
@@ -522,6 +522,41 @@ theorem isRegular_star_iff [Mul R] [StarMul R] {x : R} :
522522

523523
end Regular
524524

525+
namespace Function.Injective
526+
527+
variable {S : Type v} (f : R → S)
528+
529+
/-- Given a type endowed with `star`, that `star` is involutive if it admits an injective map that
530+
preserves `star` to a type with whose `star` is involutive. See note [reducible non-instances]. -/
531+
protected abbrev involutiveStar [Star R] [InvolutiveStar S] (hf : Injective f)
532+
(star : ∀ x, f (star x) = star (f x)) : InvolutiveStar R where
533+
star_involutive r := hf <| by rw [star, star, star_star]
534+
535+
/-- A type endowed with `star` and `*` is a star magma if it admits an injective map that
536+
preserves `star` and `*` to star magma. See note [reducible non-instances]. -/
537+
protected abbrev starMul [Star R] [Mul R] [Mul S] [StarMul S] (hf : Injective f)
538+
(star : ∀ x, f (star x) = star (f x)) (mul : ∀ x y, f (x * y) = f x * f y) :
539+
StarMul R where
540+
toInvolutiveStar := hf.involutiveStar _ star
541+
star_mul x y := hf <| by rw [star, mul, star_mul, mul, star, star]
542+
543+
/-- A additive monoid endowed with `star` is an additive star monoid if it admits an injective map
544+
that preserves `star` and `+` to an additive star monoid. See note [reducible non-instances]. -/
545+
protected abbrev starAddMonoid [Star R] [AddMonoid R] [AddMonoid S] [StarAddMonoid S]
546+
(hf : Injective f) (star : ∀ x, f (star x) = star (f x)) (add : ∀ x y, f (x + y) = f x + f y) :
547+
StarAddMonoid R where
548+
toInvolutiveStar := hf.involutiveStar f star
549+
star_add x y := hf <| by rw [star, add, star_add, add, star, star]
550+
551+
/-- A non-unital non-associative ring endowed with `star` is a star ring if it admits an injective
552+
map that preserves `star`, `*` and `+` to a star ring. See note [reducible non-instances]. -/
553+
protected abbrev starRing [Star R] [NonUnitalNonAssocSemiring R] [NonUnitalNonAssocSemiring S]
554+
[StarRing S] (star : ∀ x, f (star x) = star (f x)) (add : ∀ x y, f (x + y) = f x + f y)
555+
(mul : ∀ x y, f (x * y) = f x * f y) (hf : Injective f) :
556+
StarRing R :=
557+
{ hf.starMul f star mul, hf.starAddMonoid f star add with }
558+
559+
end Function.Injective
525560

526561
namespace MulOpposite
527562

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/-
2+
Copyright (c) 2026 Jireh Loreaux. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Jireh Loreaux
5+
-/
6+
module
7+
8+
public import Mathlib.Algebra.Star.Basic
9+
public import Mathlib.Algebra.Ring.TransferInstance
10+
11+
/-! # Transfer algebraic structures across `Equiv`s
12+
13+
This continues the pattern set in `Mathlib/Algebra/Group/TransferInstance.lean`.
14+
-/
15+
16+
variable {R S : Type*}
17+
18+
@[expose] public section
19+
20+
namespace Equiv
21+
22+
variable (e : R ≃ S)
23+
24+
/-- Transfer `Star` across an `Equiv` -/
25+
protected abbrev star [Star S] : Star R where
26+
star r := e.symm (star (e r))
27+
28+
/-- Transfer `InvolutiveStar` across an `Equiv` -/
29+
protected abbrev InvolutiveStar [InvolutiveStar S] : InvolutiveStar R :=
30+
let _ := e.star
31+
e.injective.involutiveStar _ fun _ ↦ e.apply_symm_apply _
32+
33+
/-- Transfer `StarMul` across an `Equiv` -/
34+
protected abbrev starMul [Mul S] [StarMul S] :
35+
letI := e.mul
36+
StarMul R := by
37+
let := e.star
38+
let := e.mul
39+
apply e.injective.starMul <;> (intros; exact e.apply_symm_apply _)
40+
41+
/-- Transfer `StarAddMonoid` across an `Equiv` -/
42+
protected abbrev starAddMonoid [AddMonoid S] [StarAddMonoid S] :
43+
letI := e.addMonoid
44+
StarAddMonoid R := by
45+
let := e.star
46+
let := e.addMonoid
47+
apply e.injective.starAddMonoid <;> (intros; exact e.apply_symm_apply _)
48+
49+
/-- Transfer `StarRing` across an `Equiv` -/
50+
protected abbrev starRing [NonUnitalNonAssocSemiring S] [StarRing S] :
51+
letI := e.nonUnitalNonAssocSemiring
52+
StarRing R := by
53+
let := e.star
54+
let := e.nonUnitalNonAssocSemiring
55+
apply e.injective.starRing <;> (intros; exact e.apply_symm_apply _)
56+
57+
end Equiv

0 commit comments

Comments
 (0)