Skip to content

Commit 0913062

Browse files
committed
feat: port Algebra.Star.Pi (#1432)
1 parent b6c42e5 commit 0913062

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ import Mathlib.Algebra.Ring.ULift
149149
import Mathlib.Algebra.Ring.Units
150150
import Mathlib.Algebra.SMulWithZero
151151
import Mathlib.Algebra.Star.Basic
152+
import Mathlib.Algebra.Star.Pi
152153
import Mathlib.Algebra.Tropical.Basic
153154
import Mathlib.Algebra.Tropical.Lattice
154155
import Mathlib.CategoryTheory.Category.Basic

Mathlib/Algebra/Star/Pi.lean

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/-
2+
Copyright (c) 2021 Eric Wieser. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Eric Wieser
5+
6+
! This file was ported from Lean 3 source module algebra.star.pi
7+
! leanprover-community/mathlib commit 247a102b14f3cebfee126293341af5f6bed00237
8+
! Please do not edit these lines, except to modify the commit id
9+
! if you have ported upstream changes.
10+
-/
11+
import Mathlib.Algebra.Star.Basic
12+
import Mathlib.Algebra.Ring.Pi
13+
14+
/-!
15+
# `star` on pi types
16+
17+
We put a `Star` structure on pi types that operates elementwise, such that it describes the
18+
complex conjugation of vectors.
19+
-/
20+
21+
22+
universe u v w
23+
24+
variable {I : Type u}
25+
26+
-- The indexing type
27+
variable {f : I → Type v}
28+
29+
-- The family of types already equipped with instances
30+
namespace Pi
31+
32+
instance [∀ i, Star (f i)] : Star (∀ i, f i) where star x i := star (x i)
33+
34+
@[simp]
35+
theorem star_apply [∀ i, Star (f i)] (x : ∀ i, f i) (i : I) : star x i = star (x i) :=
36+
rfl
37+
#align pi.star_apply Pi.star_apply
38+
39+
theorem star_def [∀ i, Star (f i)] (x : ∀ i, f i) : star x = fun i => star (x i) :=
40+
rfl
41+
#align pi.star_def Pi.star_def
42+
43+
instance [∀ i, InvolutiveStar (f i)] : InvolutiveStar (∀ i, f i)
44+
where star_involutive _ := funext fun _ => star_star _
45+
46+
instance [∀ i, Semigroup (f i)] [∀ i, StarSemigroup (f i)] : StarSemigroup (∀ i, f i)
47+
where star_mul _ _ := funext fun _ => star_mul _ _
48+
49+
instance [∀ i, AddMonoid (f i)] [∀ i, StarAddMonoid (f i)] : StarAddMonoid (∀ i, f i)
50+
where star_add _ _ := funext fun _ => star_add _ _
51+
52+
instance [∀ i, NonUnitalSemiring (f i)] [∀ i, StarRing (f i)] : StarRing (∀ i, f i)
53+
where star_add _ _ := funext fun _ => star_add _ _
54+
55+
instance {R : Type w} [∀ i, SMul R (f i)] [Star R] [∀ i, Star (f i)]
56+
[∀ i, StarModule R (f i)] : StarModule R (∀ i, f i)
57+
where star_smul r x := funext fun i => star_smul r (x i)
58+
59+
theorem single_star [∀ i, AddMonoid (f i)] [∀ i, StarAddMonoid (f i)] [DecidableEq I] (i : I)
60+
(a : f i) : Pi.single i (star a) = star (Pi.single i a) :=
61+
single_op (fun i => @star (f i) _) (fun _ => star_zero _) i a
62+
#align pi.single_star Pi.single_star
63+
64+
end Pi
65+
66+
namespace Function
67+
68+
theorem update_star [∀ i, Star (f i)] [DecidableEq I] (h : ∀ i : I, f i) (i : I) (a : f i) :
69+
Function.update (star h) i (star a) = star (Function.update h i a) :=
70+
funext fun j => (apply_update (fun _ => star) h i a j).symm
71+
#align function.update_star Function.update_star
72+
73+
theorem star_sum_elim {I J α : Type _} (x : I → α) (y : J → α) [Star α] :
74+
star (Sum.elim x y) = Sum.elim (star x) (star y) := by
75+
ext x; cases x <;> simp only [Pi.star_apply, Sum.elim_inl, Sum.elim_inr]
76+
#align function.star_sum_elim Function.star_sum_elim
77+
78+
end Function

0 commit comments

Comments
 (0)