@@ -85,65 +85,80 @@ instance has_mul [∀ i, has_mul $ f i] :
85
85
section
86
86
87
87
variables [decidable_eq I]
88
- variables [Π i, has_zero (f i)] [Π i, has_zero (g i)] [Π i, has_zero (h i)]
88
+ variables [Π i, has_one (f i)] [Π i, has_one (g i)] [Π i, has_one (h i)]
89
89
90
- /-- The function supported at `i`, with value `x` there. -/
91
- def single (i : I) (x : f i) : Π i, f i :=
92
- function.update 0 i x
90
+ /-- The function supported at `i`, with value `x` there, and `1` elsewhere. -/
91
+ @[to_additive pi.single " The function supported at `i`, with value `x` there, and `0` elsewhere." ]
92
+ def mul_single (i : I) (x : f i) : Π i, f i :=
93
+ function.update 1 i x
93
94
94
- @[simp] lemma single_eq_same (i : I) (x : f i) : single i x i = x :=
95
+ @[simp, to_additive]
96
+ lemma mul_single_eq_same (i : I) (x : f i) : mul_single i x i = x :=
95
97
function.update_same i x _
96
98
97
- @[simp] lemma single_eq_of_ne {i i' : I} (h : i' ≠ i) (x : f i) : single i x i' = 0 :=
99
+ @[simp, to_additive]
100
+ lemma mul_single_eq_of_ne {i i' : I} (h : i' ≠ i) (x : f i) : mul_single i x i' = 1 :=
98
101
function.update_noteq h x _
99
102
100
- /-- Abbreviation for `single_eq_of_ne h.symm`, for ease of use by `simp`. -/
101
- @[simp] lemma single_eq_of_ne' {i i' : I} (h : i ≠ i') (x : f i) : single i x i' = 0 :=
102
- single_eq_of_ne h.symm x
103
+ /-- Abbreviation for `mul_single_eq_of_ne h.symm`, for ease of use by `simp`. -/
104
+ @[simp, to_additive " Abbreviation for `single_eq_of_ne h.symm`, for ease of
105
+ use by `simp`." ]
106
+ lemma mul_single_eq_of_ne' {i i' : I} (h : i ≠ i') (x : f i) : mul_single i x i' = 1 :=
107
+ mul_single_eq_of_ne h.symm x
103
108
104
- @[simp] lemma single_zero (i : I) : single i (0 : f i) = 0 :=
109
+ @[simp, to_additive]
110
+ lemma mul_single_one (i : I) : mul_single i (1 : f i) = 1 :=
105
111
function.update_eq_self _ _
106
112
107
- /-- On non-dependent functions, `pi.single` can be expressed as an `ite` -/
108
- lemma single_apply {β : Sort *} [has_zero β] (i : I) (x : β) (i' : I) :
109
- single i x i' = if i' = i then x else 0 :=
110
- function.update_apply 0 i x i'
113
+ /-- On non-dependent functions, `pi.mul_single` can be expressed as an `ite` -/
114
+ @[to_additive " On non-dependent functions, `pi.single` can be expressed as an `ite`" ]
115
+ lemma mul_single_apply {β : Sort *} [has_one β] (i : I) (x : β) (i' : I) :
116
+ mul_single i x i' = if i' = i then x else 1 :=
117
+ function.update_apply 1 i x i'
111
118
112
- /-- On non-dependent functions, `pi.single` is symmetric in the two indices. -/
113
- lemma single_comm {β : Sort *} [has_zero β] (i : I) (x : β) (i' : I) :
114
- single i x i' = single i' x i :=
115
- by simp [single_apply, eq_comm]
119
+ /-- On non-dependent functions, `pi.mul_single` is symmetric in the two indices. -/
120
+ @[to_additive " On non-dependent functions, `pi.single` is symmetric in the two
121
+ indices." ]
122
+ lemma mul_single_comm {β : Sort *} [has_one β] (i : I) (x : β) (i' : I) :
123
+ mul_single i x i' = mul_single i' x i :=
124
+ by simp [mul_single_apply, eq_comm]
116
125
117
- lemma apply_single (f' : Π i, f i → g i) (hf' : ∀ i, f' i 0 = 0 ) (i : I) (x : f i) (j : I):
118
- f' j (single i x j) = single i (f' i x) j :=
119
- by simpa only [pi.zero_apply, hf', single] using function.apply_update f' 0 i x j
126
+ @[to_additive]
127
+ lemma apply_mul_single (f' : Π i, f i → g i) (hf' : ∀ i, f' i 1 = 1 ) (i : I) (x : f i) (j : I):
128
+ f' j (mul_single i x j) = mul_single i (f' i x) j :=
129
+ by simpa only [pi.one_apply, hf', mul_single] using function.apply_update f' 1 i x j
120
130
121
- lemma apply_single₂ (f' : Π i, f i → g i → h i) (hf' : ∀ i, f' i 0 0 = 0 )
131
+ @[to_additive apply_single₂]
132
+ lemma apply_mul_single₂ (f' : Π i, f i → g i → h i) (hf' : ∀ i, f' i 1 1 = 1 )
122
133
(i : I) (x : f i) (y : g i) (j : I):
123
- f' j (single i x j) (single i y j) = single i (f' i x y) j :=
134
+ f' j (mul_single i x j) (mul_single i y j) = mul_single i (f' i x y) j :=
124
135
begin
125
136
by_cases h : j = i,
126
- { subst h, simp only [single_eq_same ] },
127
- { simp only [single_eq_of_ne h, hf'] },
137
+ { subst h, simp only [mul_single_eq_same ] },
138
+ { simp only [mul_single_eq_of_ne h, hf'] },
128
139
end
129
140
130
- lemma single_op {g : I → Type *} [Π i, has_zero (g i)] (op : Π i, f i → g i) (h : ∀ i, op i 0 = 0 )
141
+ @[to_additive]
142
+ lemma mul_single_op {g : I → Type *} [Π i, has_one (g i)] (op : Π i, f i → g i) (h : ∀ i, op i 1 = 1 )
131
143
(i : I) (x : f i) :
132
- single i (op i x) = λ j, op j (single i x j) :=
133
- eq.symm $ funext $ apply_single op h i x
144
+ mul_single i (op i x) = λ j, op j (mul_single i x j) :=
145
+ eq.symm $ funext $ apply_mul_single op h i x
134
146
135
- lemma single_op₂ {g₁ g₂ : I → Type *} [Π i, has_zero (g₁ i)] [Π i, has_zero (g₂ i)]
136
- (op : Π i, g₁ i → g₂ i → f i) (h : ∀ i, op i 0 0 = 0 ) (i : I) (x₁ : g₁ i) (x₂ : g₂ i) :
137
- single i (op i x₁ x₂) = λ j, op j (single i x₁ j) (single i x₂ j) :=
138
- eq.symm $ funext $ apply_single₂ op h i x₁ x₂
147
+ @[to_additive]
148
+ lemma mul_single_op₂ {g₁ g₂ : I → Type *} [Π i, has_one (g₁ i)] [Π i, has_one (g₂ i)]
149
+ (op : Π i, g₁ i → g₂ i → f i) (h : ∀ i, op i 1 1 = 1 ) (i : I) (x₁ : g₁ i) (x₂ : g₂ i) :
150
+ mul_single i (op i x₁ x₂) = λ j, op j (mul_single i x₁ j) (mul_single i x₂ j) :=
151
+ eq.symm $ funext $ apply_mul_single₂ op h i x₁ x₂
139
152
140
153
variables (f)
141
154
142
- lemma single_injective (i : I) : function.injective (single i : f i → Π i, f i) :=
155
+ @[to_additive]
156
+ lemma mul_single_injective (i : I) : function.injective (mul_single i : f i → Π i, f i) :=
143
157
function.update_injective _ i
144
158
145
- @[simp] lemma single_inj (i : I) {x y : f i} : pi.single i x = pi.single i y ↔ x = y :=
146
- (pi.single_injective _ _).eq_iff
159
+ @[simp, to_additive]
160
+ lemma mul_single_inj (i : I) {x y : f i} : mul_single i x = mul_single i y ↔ x = y :=
161
+ (pi.mul_single_injective _ _).eq_iff
147
162
148
163
end
149
164
@@ -197,7 +212,8 @@ lemma bijective_pi_map {F : Π i, f i → g i} (hF : ∀ i, bijective (F i)) :
197
212
198
213
end function
199
214
200
- lemma subsingleton.pi_single_eq {α : Type *} [decidable_eq I] [subsingleton I] [has_zero α]
215
+ @[to_additive subsingleton.pi_single_eq]
216
+ lemma subsingleton.pi_mul_single_eq {α : Type *} [decidable_eq I] [subsingleton I] [has_one α]
201
217
(i : I) (x : α) :
202
- pi.single i x = λ _, x :=
203
- funext $ λ j, by rw [subsingleton.elim j i, pi.single_eq_same ]
218
+ pi.mul_single i x = λ _, x :=
219
+ funext $ λ j, by rw [subsingleton.elim j i, pi.mul_single_eq_same ]
0 commit comments