@@ -89,10 +89,10 @@ bundled:
89
89
* `dfinsupp.map_range.linear_map`
90
90
* `dfinsupp.map_range.linear_equiv`
91
91
-/
92
- def map_range (f : Π i, β₁ i → β₂ i) (hf : ∀ i, f i 0 = 0 ) (g : Π₀ i, β₁ i) : Π₀ i, β₂ i :=
93
- quotient.lift_on g (λ x, ⟦(⟨λ i, f i (x. 1 i), x. 2 ,
94
- λ i, or.cases_on (x.3 i) or.inl $ λ H, or.inr $ by rw [H, hf]⟩ : pre ι β₂)⟧) $ λ x y H,
95
- quotient.sound $ λ i, by simp only [H i]
92
+ def map_range (f : Π i, β₁ i → β₂ i) (hf : ∀ i, f i 0 = 0 ) : ( Π₀ i, β₁ i) → Π₀ i, β₂ i :=
93
+ quotient.map
94
+ (λ x, ⟨λ i, f i (x.1 i), x. 2 , λ i, (x. 3 i).imp_right $ λ H, by rw [H, hf]⟩)
95
+ (λ x y H i, by simp only [H i])
96
96
97
97
@[simp] lemma map_range_apply
98
98
(f : Π i, β₁ i → β₂ i) (hf : ∀ i, f i 0 = 0 ) (g : Π₀ i, β₁ i) (i : ι) :
@@ -115,17 +115,17 @@ by { ext, simp only [map_range_apply, coe_zero, pi.zero_apply, hf] }
115
115
116
116
/-- Let `f i` be a binary operation `β₁ i → β₂ i → β i` such that `f i 0 0 = 0`.
117
117
Then `zip_with f hf` is a binary operation `Π₀ i, β₁ i → Π₀ i, β₂ i → Π₀ i, β i`. -/
118
- def zip_with (f : Π i, β₁ i → β₂ i → β i) (hf : ∀ i, f i 0 0 = 0 )
119
- (g₁ : Π₀ i, β₁ i) (g₂ : Π₀ i, β₂ i) : (Π₀ i, β i) :=
118
+ def zip_with (f : Π i, β₁ i → β₂ i → β i) (hf : ∀ i, f i 0 0 = 0 ) :
119
+ (Π₀ i, β₁ i) → ( Π₀ i, β₂ i) → (Π₀ i, β i) :=
120
120
begin
121
- refine quotient.lift_on₂ g₁ g₂ (λ x y, ⟦(⟨λ i, f i (x. 1 i) (y. 1 i), x. 2 + y. 2 ,
122
- λ i, _⟩ : pre ι β)⟧ ) _,
121
+ refine quotient.map₂
122
+ (λ x y, ⟨λ i, f i (x. 1 i) (y. 1 i), x. 2 + y. 2 , λ i, _⟩ ) _,
123
123
{ cases x.3 i with h1 h1,
124
124
{ left, rw multiset.mem_add, left, exact h1 },
125
125
cases y.3 i with h2 h2,
126
126
{ left, rw multiset.mem_add, right, exact h2 },
127
127
right, rw [h1, h2, hf] },
128
- exact λ x₁ x₂ y₁ y₂ H1 H2, quotient.sound $ λ i, by simp only [H1 i, H2 i]
128
+ exact λ x₁ x₂ H1 y₁ y₂ H2 i, by simp only [H1 i, H2 i]
129
129
end
130
130
131
131
@[simp] lemma zip_with_apply
@@ -260,10 +260,10 @@ end algebra
260
260
section filter_and_subtype_domain
261
261
262
262
/-- `filter p f` is the function which is `f i` if `p i` is true and 0 otherwise. -/
263
- def filter [Π i, has_zero (β i)] (p : ι → Prop ) [decidable_pred p] (f : Π₀ i, β i) : Π₀ i, β i :=
264
- quotient.lift_on f (λ x, ⟦(⟨λ i, if p i then x. 1 i else 0 , x. 2 ,
265
- λ i, or.cases_on (x.3 i) or.inl $ λ H, or.inr $ by rw [H, if_t_t]⟩ : pre ι β)⟧) $ λ x y H,
266
- quotient.sound $ λ i, by simp only [H i]
263
+ def filter [Π i, has_zero (β i)] (p : ι → Prop ) [decidable_pred p] : ( Π₀ i, β i) → Π₀ i, β i :=
264
+ quotient.map
265
+ (λ x, ⟨λ i, if p i then x. 1 i else 0 , x. 2 , λ i, (x.3 i).imp_right $ λ H, by rw [H, if_t_t]⟩)
266
+ (λ x y H i, by simp only [H i])
267
267
268
268
@[simp] lemma filter_apply [Π i, has_zero (β i)]
269
269
(p : ι → Prop ) [decidable_pred p] (i : ι) (f : Π₀ i, β i) :
@@ -287,19 +287,13 @@ ext $ λ i, by simp only [add_apply, filter_apply]; split_ifs; simp only [add_ze
287
287
288
288
/-- `subtype_domain p f` is the restriction of the finitely supported function
289
289
`f` to the subtype `p`. -/
290
- def subtype_domain [Π i, has_zero (β i)] (p : ι → Prop ) [decidable_pred p]
291
- (f : Π₀ i, β i) : Π₀ i : subtype p, β i :=
292
- begin
293
- fapply quotient.lift_on f,
294
- { intro x,
295
- refine ⟦⟨λ i, x.1 (i : ι),
296
- (x.2 .filter p).attach.map $ λ j, ⟨j, (multiset.mem_filter.1 j.2 ).2 ⟩, _⟩⟧,
297
- refine λ i, or.cases_on (x.3 i) (λ H, _) or.inr,
298
- left, rw multiset.mem_map, refine ⟨⟨i, multiset.mem_filter.2 ⟨H, i.2 ⟩⟩, _, subtype.eta _ _⟩,
299
- apply multiset.mem_attach },
300
- intros x y H,
301
- exact quotient.sound (λ i, H i)
302
- end
290
+ def subtype_domain [Π i, has_zero (β i)] (p : ι → Prop ) [decidable_pred p] :
291
+ (Π₀ i, β i) → Π₀ i : subtype p, β i :=
292
+ quotient.map
293
+ (λ x, ⟨λ i, x.1 (i : ι), (x.2 .filter p).attach.map $ λ j, ⟨j, (multiset.mem_filter.1 j.2 ).2 ⟩,
294
+ λ i, (x.3 i).imp_left $ λ H, multiset.mem_map.2
295
+ ⟨⟨i, multiset.mem_filter.2 ⟨H, i.2 ⟩⟩, multiset.mem_attach _ _, subtype.eta _ _⟩⟩)
296
+ (λ x y H i, H i)
303
297
304
298
@[simp] lemma subtype_domain_zero [Π i, has_zero (β i)] {p : ι → Prop } [decidable_pred p] :
305
299
subtype_domain p (0 : Π₀ i, β i) = 0 :=
@@ -436,11 +430,11 @@ lemma single_eq_of_sigma_eq
436
430
by { cases h, refl }
437
431
438
432
/-- Redefine `f i` to be `0`. -/
439
- def erase (i : ι) (f : Π₀ i, β i) : Π₀ i, β i :=
440
- quotient.lift_on f (λ x, ⟦(⟨λ j, if j = i then 0 else x. 1 j, x. 2 ,
441
- λ j, or.cases_on (x. 3 j) or.inl $ λ H, or.inr $ by simp only [H, if_t_t]⟩ : pre ι β)⟧) $ λ x y H ,
442
- quotient.sound $ λ j, if h : j = i then by simp only [if_pos h]
443
- else by simp only [if_neg h, H j]
433
+ def erase (i : ι) : ( Π₀ i, β i) → Π₀ i, β i :=
434
+ quotient.map
435
+ (λ x, ⟨λ j, if j = i then 0 else x. 1 j, x. 2 ,
436
+ λ j, (x. 3 j).imp_right $ λ H, by simp only [H, if_t_t]⟩)
437
+ (λ x y H j, if h : j = i then by simp only [if_pos h] else by simp only [if_neg h, H j])
444
438
445
439
@[simp] lemma erase_apply {i j : ι} {f : Π₀ i, β i} :
446
440
(f.erase i) j = if j = i then 0 else f j :=
@@ -551,7 +545,7 @@ begin
551
545
{ exact quotient.sound (λ i, rfl) },
552
546
rw H3, apply ih },
553
547
have H2 : p (erase i ⟦{to_fun := f, pre_support := i ::ₘ s, zero := H}⟧),
554
- { dsimp only [erase, quotient.lift_on_mk ],
548
+ { dsimp only [erase, quotient.map_mk ],
555
549
have H2 : ∀ j, j ∈ s ∨ ite (j = i) 0 (f j) = 0 ,
556
550
{ intro j, cases H j with H2 H2,
557
551
{ cases multiset.mem_cons.1 H2 with H3 H3,
0 commit comments