Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 6728201

Browse files
committed
chore(data/finsupp): add missing lemmas (#8553)
These lemmas are needed by `[simps {simp_rhs := tt}]` when composing equivs, otherwise simp doesn't make progress on `(map_range.add_equiv f).to_equiv.symm x` which should simplify to `map_range f.to_equiv.symm x`.
1 parent 3f5a348 commit 6728201

File tree

2 files changed

+75
-9
lines changed

2 files changed

+75
-9
lines changed

src/data/finsupp/basic.lean

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ variables [has_zero M] [has_zero N] [has_zero P]
415415
This preserves the structure on `f`, and exists in various bundled forms for when `f` is itself
416416
bundled:
417417
418+
* `finsupp.map_range.equiv`
418419
* `finsupp.map_range.zero_hom`
419420
* `finsupp.map_range.add_monoid_hom`
420421
* `finsupp.map_range.add_equiv`
@@ -1186,6 +1187,43 @@ lemma multiset_sum_sum [has_zero M] [add_comm_monoid N] {f : α →₀ M} {h :
11861187

11871188
section map_range
11881189

1190+
section equiv
1191+
variables [has_zero M] [has_zero N] [has_zero P]
1192+
1193+
/-- `finsupp.map_range` as an equiv. -/
1194+
@[simps apply]
1195+
def map_range.equiv (f : M ≃ N) (hf : f 0 = 0) (hf' : f.symm 0 = 0) : (α →₀ M) ≃ (α →₀ N) :=
1196+
{ to_fun := (map_range f hf : (α →₀ M) → (α →₀ N)),
1197+
inv_fun := (map_range f.symm hf' : (α →₀ N) → (α →₀ M)),
1198+
left_inv := λ x, begin
1199+
rw ←map_range_comp _ _ _ _; simp_rw equiv.symm_comp_self,
1200+
{ exact map_range_id _ },
1201+
{ refl },
1202+
end,
1203+
right_inv := λ x, begin
1204+
rw ←map_range_comp _ _ _ _; simp_rw equiv.self_comp_symm,
1205+
{ exact map_range_id _ },
1206+
{ refl },
1207+
end }
1208+
1209+
@[simp]
1210+
lemma map_range.equiv_refl :
1211+
map_range.equiv (equiv.refl M) rfl rfl = equiv.refl (α →₀ M) :=
1212+
equiv.ext map_range_id
1213+
1214+
lemma map_range.equiv_trans
1215+
(f : M ≃ N) (hf : f 0 = 0) (hf') (f₂ : N ≃ P) (hf₂ : f₂ 0 = 0) (hf₂') :
1216+
(map_range.equiv (f.trans f₂) (by rw [equiv.trans_apply, hf, hf₂])
1217+
(by rw [equiv.symm_trans_apply, hf₂', hf']) : (α →₀ _) ≃ _) =
1218+
(map_range.equiv f hf hf').trans (map_range.equiv f₂ hf₂ hf₂') :=
1219+
equiv.ext $ map_range_comp _ _ _ _ _
1220+
1221+
lemma map_range.equiv_symm (f : M ≃ N) (hf hf') :
1222+
((map_range.equiv f hf hf').symm : (α →₀ _) ≃ _) = map_range.equiv f.symm hf' hf :=
1223+
equiv.ext $ λ x, rfl
1224+
1225+
end equiv
1226+
11891227
section zero_hom
11901228
variables [has_zero M] [has_zero N] [has_zero P]
11911229

@@ -1229,6 +1267,12 @@ lemma map_range.add_monoid_hom_comp (f : N →+ P) (f₂ : M →+ N) :
12291267
(map_range.add_monoid_hom f).comp (map_range.add_monoid_hom f₂) :=
12301268
add_monoid_hom.ext $ map_range_comp _ _ _ _ _
12311269

1270+
@[simp]
1271+
lemma map_range.add_monoid_hom_to_zero_hom (f : M →+ N) :
1272+
(map_range.add_monoid_hom f).to_zero_hom =
1273+
(map_range.zero_hom f.to_zero_hom : zero_hom (α →₀ _) _) :=
1274+
zero_hom.ext $ λ _, rfl
1275+
12321276
lemma map_range_multiset_sum (f : M →+ N) (m : multiset (α →₀ M)) :
12331277
map_range f f.map_zero m.sum = (m.map $ λx, map_range f f.map_zero x).sum :=
12341278
(map_range.add_monoid_hom f : (α →₀ _) →+ _).map_multiset_sum _
@@ -1269,6 +1313,18 @@ lemma map_range.add_equiv_symm (f : M ≃+ N) :
12691313
((map_range.add_equiv f).symm : (α →₀ _) ≃+ _) = map_range.add_equiv f.symm :=
12701314
add_equiv.ext $ λ x, rfl
12711315

1316+
@[simp]
1317+
lemma map_range.add_equiv_to_add_monoid_hom (f : M ≃+ N) :
1318+
(map_range.add_equiv f : (α →₀ _) ≃+ _).to_add_monoid_hom =
1319+
(map_range.add_monoid_hom f.to_add_monoid_hom : (α →₀ _) →+ _) :=
1320+
add_monoid_hom.ext $ λ _, rfl
1321+
1322+
@[simp]
1323+
lemma map_range.add_equiv_to_equiv (f : M ≃+ N) :
1324+
(map_range.add_equiv f).to_equiv =
1325+
(map_range.equiv f.to_equiv f.map_zero f.symm.map_zero : (α →₀ _) ≃ _) :=
1326+
equiv.ext $ λ _, rfl
1327+
12721328
end add_monoid_hom
12731329

12741330
end map_range

src/linear_algebra/finsupp.lean

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,12 @@ lemma map_range.linear_map_comp (f : N →ₗ[R] P) (f₂ : M →ₗ[R] N) :
635635
(map_range.linear_map f).comp (map_range.linear_map f₂) :=
636636
linear_map.ext $ map_range_comp _ _ _ _ _
637637

638+
@[simp]
639+
lemma map_range.linear_map_to_add_monoid_hom (f : M →ₗ[R] N) :
640+
(map_range.linear_map f).to_add_monoid_hom =
641+
(map_range.add_monoid_hom f.to_add_monoid_hom : (α →₀ M) →+ _):=
642+
add_monoid_hom.ext $ λ _, rfl
643+
638644
/-- `finsupp.map_range` as a `linear_equiv`. -/
639645
@[simps apply]
640646
def map_range.linear_equiv (e : M ≃ₗ[R] N) : (α →₀ M) ≃ₗ[R] (α →₀ N) :=
@@ -658,6 +664,18 @@ lemma map_range.linear_equiv_symm (f : M ≃ₗ[R] N) :
658664
((map_range.linear_equiv f).symm : (α →₀ _) ≃ₗ[R] _) = map_range.linear_equiv f.symm :=
659665
linear_equiv.ext $ λ x, rfl
660666

667+
@[simp]
668+
lemma map_range.linear_equiv_to_add_equiv (f : M ≃ₗ[R] N) :
669+
(map_range.linear_equiv f).to_add_equiv =
670+
(map_range.add_equiv f.to_add_equiv : (α →₀ M) ≃+ _):=
671+
add_equiv.ext $ λ _, rfl
672+
673+
@[simp]
674+
lemma map_range.linear_equiv_to_linear_map (f : M ≃ₗ[R] N) :
675+
(map_range.linear_equiv f).to_linear_map =
676+
(map_range.linear_map f.to_linear_map : (α →₀ M) →ₗ[R] _):=
677+
linear_map.ext $ λ _, rfl
678+
661679
/-- An equivalence of domain and a linear equivalence of codomain induce a linear equivalence of the
662680
corresponding finitely supported functions. -/
663681
def lcongr {ι κ : Sort*} (e₁ : ι ≃ κ) (e₂ : M ≃ₗ[R] N) : (ι →₀ M) ≃ₗ[R] (κ →₀ N) :=
@@ -669,15 +687,7 @@ by simp [lcongr]
669687

670688
@[simp] lemma lcongr_apply_apply {ι κ : Sort*} (e₁ : ι ≃ κ) (e₂ : M ≃ₗ[R] N) (f : ι →₀ M) (k : κ) :
671689
lcongr e₁ e₂ f k = e₂ (f (e₁.symm k)) :=
672-
begin
673-
apply finsupp.induction_linear f,
674-
{ simp, },
675-
{ intros f g hf hg, simp [map_add, hf, hg], },
676-
{ intros i m,
677-
simp only [finsupp.lcongr_single],
678-
simp only [finsupp.single, equiv.eq_symm_apply, finsupp.coe_mk],
679-
split_ifs; simp, },
680-
end
690+
rfl
681691

682692
theorem lcongr_symm_single {ι κ : Sort*} (e₁ : ι ≃ κ) (e₂ : M ≃ₗ[R] N) (k : κ) (n : N) :
683693
(lcongr e₁ e₂).symm (finsupp.single k n) = finsupp.single (e₁.symm k) (e₂.symm n) :=

0 commit comments

Comments
 (0)