Skip to content

Commit bbaf7e6

Browse files
committed
Replace ℤ with an extra type parameter.
For now, we probably want to build on top of this limited to ℕ anyway.
1 parent 9643c01 commit bbaf7e6

1 file changed

Lines changed: 23 additions & 18 deletions

File tree

src/geometric_algebra/nursery/graded.lean

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ import algebra.group
33
import linear_algebra.tensor_product
44
import tactic.ring
55

6-
universes u
6+
universes u v
77

88
open_locale big_operators
99
open_locale classical
1010
open finset
1111

1212
class graded_module_components
13+
-- the indices of the grades, typically ℕ
14+
{ι : Type u} [has_zero ι]
1315
-- a type for each grade.
14-
(A : Type u)
16+
(A : ιType u)
1517
:=
1618
-- (A 0) is the scalar type
1719
[zc: comm_ring (A 0)]
@@ -25,21 +27,23 @@ attribute [instance] graded_module_components.b
2527
attribute [instance] graded_module_components.c
2628

2729
namespace graded_module_components
28-
variables {A : Type u}
30+
variables {ι : Type u} [has_zero ι] {A : ιType u}
2931
/-- objects are coercible only if they have the same grade-/
30-
instance has_coe (r s : ) (h: r = s) : has_coe (A r) (A s) := { coe := by {subst h, exact id}}
32+
instance has_coe (r s : ι) (h: r = s) : has_coe (A r) (A s) := { coe := by {subst h, exact id}}
3133
end graded_module_components
3234

3335
-- needed for the definition of `select`
3436
attribute [instance] dfinsupp.to_semimodule
3537

3638
/-- Grade selection maps from objects in G to a finite set of components of substituent grades -/
3739
class has_grade_select
38-
(A : ℤ → Type u) (G: Type u)
40+
{ι : Type u} [has_zero ι]
41+
(A : ι → Type u) (G: Type u)
3942
[graded_module_components A]
4043
[add_comm_group G]
44+
[ring (A 0)]
4145
[module (A 0) G] :=
42-
(select : G →ₗ[A 0] (Π₀ r, A r))
46+
(select : linear_map (A 0) G (Π₀ r, A r))
4347

4448
/- TODO: check precedence -/
4549
notation `⟨`:0 g`⟩_`:0 r:100 := has_grade_select.select g r
@@ -51,7 +55,8 @@ notation `⟨`:0 g`⟩_`:0 r:100 := has_grade_select.select g r
5155
/-- A module divisible into disjoint graded modules, where the grade selectio
5256
operator is a complete and independent set of projections -/
5357
class graded_module
54-
(A : ℤ → Type u) (G: Type u)
58+
{ι : Type v} [has_zero ι]
59+
(A : ι → Type u) (G: Type u)
5560
[graded_module_components A]
5661
[add_comm_group G]
5762
[module (A 0) G]
@@ -61,42 +66,42 @@ class graded_module
6166

6267

6368
namespace graded_module
64-
variables {A : Type u} {G: Type u}
69+
variables {ι : Type v} [has_zero ι] {A : ιType u} {G: Type u}
6570
variables [graded_module_components A] [add_comm_group G] [module (A 0) G]
6671
variables [graded_module A G]
6772

6873
/-- locally bind the notation above to our A and G-/
69-
local notation `⟨`:0 g`⟩_`:0 r:100 := @has_grade_select.select A G _ _ _ _ g r
74+
local notation `⟨`:0 g`⟩_`:0 r:100 := @has_grade_select.select ι A G _ _ _ _ g r
7075

7176
/-- convert from r-vectors to multi-vectors -/
72-
instance has_coe (r : ) : has_coe (A r) G := { coe := to_fun }
77+
instance has_coe (r : ι) : has_coe (A r) G := { coe := to_fun }
7378

7479
@[simp]
75-
lemma coe_def {r : } (v : A r) : (v : G) = to_fun v := rfl
80+
lemma coe_def {r : ι} (v : A r) : (v : G) = to_fun v := rfl
7681

7782
/-- An r-vector has only a single grade
7883
Discussed at https://leanprover.zulipchat.com/#narrow/stream/113489-new-members/topic/Expressing.20a.20sum.20with.20finitely.20many.20nonzero.20terms/near/202657281-/
79-
lemma select_coe_is_single {r : } (v : A r) : has_grade_select.select (v : G) = dfinsupp.single r v := begin
84+
lemma select_coe_is_single {r : ι} (v : A r) : has_grade_select.select (v : G) = dfinsupp.single r v := begin
8085
symmetry,
8186
rw is_complete (v : G) (dfinsupp.single r v),
8287
symmetry,
8388
apply dfinsupp.sum_single_index,
8489
exact linear_map.map_zero _,
8590
end
8691

87-
def is_r_vector (r : ) (a : G) := (⟨a⟩_r : G) = a
92+
def is_r_vector (r : ι) (a : G) := (⟨a⟩_r : G) = a
8893

8994
/-- Chisholm 6a, ish.
9095
This says A = ⟨A}_r for r-vectors.
9196
Chisholm aditionally wants proof that A != ⟨A}_r for non-rvectors -/
92-
lemma r_grade_of_coe {r : } (v : A r) : ⟨v⟩_r = v := begin
97+
lemma r_grade_of_coe {r : ι} (v : A r) : ⟨v⟩_r = v := begin
9398
rw select_coe_is_single,
9499
rw dfinsupp.single_apply,
95100
simp,
96101
end
97102

98103
/-- to_fun is injective -/
99-
lemma to_fun_inj (r : ) : function.injective (to_fun : A r → G) := begin
104+
lemma to_fun_inj (r : ι) : function.injective (to_fun : A r → G) := begin
100105
intros a b h,
101106
rw ← r_grade_of_coe a,
102107
rw ← r_grade_of_coe b,
@@ -106,13 +111,13 @@ namespace graded_module
106111
end
107112

108113
/-- Chisholm 6b -/
109-
lemma grade_of_sum (r : ) (a b : G) : ⟨a + b⟩_r = ⟨a⟩_r + ⟨b⟩_r := by simp
114+
lemma grade_of_sum (r : ι) (a b : G) : ⟨a + b⟩_r = ⟨a⟩_r + ⟨b⟩_r := by simp
110115

111116
/-- Chisholm 6c -/
112-
lemma grade_smul (r : ) (k : A 0) (a : G) : ⟨k • a⟩_r = k • ⟨a⟩_r := by simp
117+
lemma grade_smul (r : ι) (k : A 0) (a : G) : ⟨k • a⟩_r = k • ⟨a⟩_r := by simp
113118

114119
/-- chisholm 6d. Modifid to use `_s` instead of `_r` on the right, to keep the statement cast-free -/
115-
lemma grade_grade (r s : ) (a : G) : ⟨⟨a⟩_r⟩_s = if r = s then ⟨a⟩_s else 0
120+
lemma grade_grade (r s : ι) (a : G) : ⟨⟨a⟩_r⟩_s = if r = s then ⟨a⟩_s else 0
116121
:= begin
117122
rw select_coe_is_single,
118123
rw dfinsupp.single_apply,

0 commit comments

Comments
 (0)