Skip to content

Commit 5b512e5

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 5b512e5

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

src/geometric_algebra/nursery/graded.lean

Lines changed: 26 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,26 @@ 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}
31+
32+
def simp_grade {r s : ι} (h: r = s) : A r → A s := by {subst h, exact id}
33+
2934
/-- 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}}
35+
instance has_coe {r s : ι} (h: r = s) : has_coe (A r) (A s) := { coe := simp_grade h }
3136
end graded_module_components
3237

3338
-- needed for the definition of `select`
3439
attribute [instance] dfinsupp.to_semimodule
3540

3641
/-- Grade selection maps from objects in G to a finite set of components of substituent grades -/
3742
class has_grade_select
38-
(A : ℤ → Type u) (G: Type u)
43+
{ι : Type u} [has_zero ι]
44+
(A : ι → Type u) (G: Type u)
3945
[graded_module_components A]
4046
[add_comm_group G]
47+
[ring (A 0)]
4148
[module (A 0) G] :=
42-
(select : G →ₗ[A 0] (Π₀ r, A r))
49+
(select : @linear_map (A 0) G (Π₀ r, A r) _ _ _ _ _)
4350

4451
/- TODO: check precedence -/
4552
notation `⟨`:0 g`⟩_`:0 r:100 := has_grade_select.select g r
@@ -51,7 +58,8 @@ notation `⟨`:0 g`⟩_`:0 r:100 := has_grade_select.select g r
5158
/-- A module divisible into disjoint graded modules, where the grade selectio
5259
operator is a complete and independent set of projections -/
5360
class graded_module
54-
(A : ℤ → Type u) (G: Type u)
61+
{ι : Type v} [has_zero ι]
62+
(A : ι → Type u) (G: Type u)
5563
[graded_module_components A]
5664
[add_comm_group G]
5765
[module (A 0) G]
@@ -61,42 +69,42 @@ class graded_module
6169

6270

6371
namespace graded_module
64-
variables {A : Type u} {G: Type u}
72+
variables {ι : Type v} [has_zero ι] {A : ιType u} {G: Type u}
6573
variables [graded_module_components A] [add_comm_group G] [module (A 0) G]
6674
variables [graded_module A G]
6775

6876
/-- 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
77+
local notation `⟨`:0 g`⟩_`:0 r:100 := @has_grade_select.select ι A G _ _ _ _ g r
7078

7179
/-- convert from r-vectors to multi-vectors -/
72-
instance has_coe (r : ) : has_coe (A r) G := { coe := to_fun }
80+
instance has_coe (r : ι) : has_coe (A r) G := { coe := to_fun }
7381

7482
@[simp]
75-
lemma coe_def {r : } (v : A r) : (v : G) = to_fun v := rfl
83+
lemma coe_def {r : ι} (v : A r) : (v : G) = to_fun v := rfl
7684

7785
/-- An r-vector has only a single grade
7886
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
87+
lemma select_coe_is_single {r : ι} (v : A r) : has_grade_select.select (v : G) = dfinsupp.single r v := begin
8088
symmetry,
8189
rw is_complete (v : G) (dfinsupp.single r v),
8290
symmetry,
8391
apply dfinsupp.sum_single_index,
8492
exact linear_map.map_zero _,
8593
end
8694

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

8997
/-- Chisholm 6a, ish.
9098
This says A = ⟨A}_r for r-vectors.
9199
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
100+
lemma r_grade_of_coe {r : ι} (v : A r) : ⟨v⟩_r = v := begin
93101
rw select_coe_is_single,
94102
rw dfinsupp.single_apply,
95103
simp,
96104
end
97105

98106
/-- to_fun is injective -/
99-
lemma to_fun_inj (r : ) : function.injective (to_fun : A r → G) := begin
107+
lemma to_fun_inj (r : ι) : function.injective (to_fun : A r → G) := begin
100108
intros a b h,
101109
rw ← r_grade_of_coe a,
102110
rw ← r_grade_of_coe b,
@@ -106,13 +114,13 @@ namespace graded_module
106114
end
107115

108116
/-- Chisholm 6b -/
109-
lemma grade_of_sum (r : ) (a b : G) : ⟨a + b⟩_r = ⟨a⟩_r + ⟨b⟩_r := by simp
117+
lemma grade_of_sum (r : ι) (a b : G) : ⟨a + b⟩_r = ⟨a⟩_r + ⟨b⟩_r := by simp
110118

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

114122
/-- 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
123+
lemma grade_grade (r s : ι) (a : G) : ⟨⟨a⟩_r⟩_s = if r = s then ⟨a⟩_s else 0
116124
:= begin
117125
rw select_coe_is_single,
118126
rw dfinsupp.single_apply,

0 commit comments

Comments
 (0)