@@ -36,8 +36,31 @@ This file also collects `•` application
3636
3737 -/
3838
39+ -- creates a simp loop with `WithLp.zero_def`
40+ attribute [-simp] WithLp.toLp_zero
41+
42+ -- why aren't these set?
43+ attribute [coe] WithLp.ofLp
44+ attribute [norm_cast] WithLp.ofLp_smul
45+
3946public section
4047
48+ /-
49+ Missing instance, which should go into the section around `WithLp.instNontrivial`.
50+ -/
51+ section WithLpMissingInstances
52+
53+ namespace WithLp
54+
55+ open scoped ENNReal
56+
57+ variable (p : ℝ≥0 ∞) (K K' : Type *) {K'' : Type *} (V : Type *) {V' V'' : Type *}
58+
59+ @ [to_additive (attr := simps)]
60+ instance instOne [One V] : One (WithLp p V) := (WithLp.equiv p V).one
61+
62+ end WithLpMissingInstances.WithLp
63+
4164open EuclideanSpace PiOuterProduct Function
4265
4366variable {ι : Type *} [Fintype ι]
@@ -46,6 +69,10 @@ namespace EuclideanSpace
4669
4770variable {α : Type *} (l : ι → Type *)
4871
72+ @[ext]
73+ theorem ext {α n : Type *} {x y : EuclideanSpace α n} (h : x.ofLp = y.ofLp) : x = y :=
74+ WithLp.ofLp_injective 2 h
75+
4976@[simp]
5077theorem ofLp_update_apply {ι : Type *} [DecidableEq ι] {l : ι → Type *}
5178 (f : Π i, EuclideanSpace α (l i)) (i' : ι) (x : EuclideanSpace α (l i'))
@@ -54,41 +81,39 @@ theorem ofLp_update_apply {ι : Type*} [DecidableEq ι] {l : ι → Type*}
5481 = update (fun i ↦ (f i).ofLp (j i)) i' (x.ofLp (j i')) i :=
5582 apply_update (fun i (v : EuclideanSpace α (l i)) ↦ v.ofLp (j i)) f i' x i
5683
57- instance PiOuterPrdocutInst [CommMonoid α] :
58- PiOuterProduct (fun i => EuclideanSpace α (l i)) (EuclideanSpace α (Π i, l i)) where
84+ instance instPiOuterProduct [CommMonoid α] :
85+ PiOuterProduct (fun i ↦ EuclideanSpace α (l i)) (EuclideanSpace α (Π i, l i)) where
5986 tprod f := WithLp.toLp 2 (⨂ i, ((f i) : (l i → α)))
6087
61- @[simp]
62- theorem piOuterProduct_apply [CommMonoid α] (f : (i : ι) → EuclideanSpace α (l i)) (j) :
63- (⨂ i, f i).ofLp j = ∏ i, f i (j i) := by
64- simp [PiOuterProduct.tprod, ← Multiset.prod_eq_foldr]
88+ @ [simp, norm_cast]
89+ theorem ofLp_injective [CommMonoid α] (f : Π i, EuclideanSpace α (l i)) :
90+ (⨂ i, f i).ofLp = (⨂ i, (f i).ofLp) := rfl
91+
92+ example [CommMonoid α] (f : (i : ι) → EuclideanSpace α (l i)) (j) :
93+ (⨂ i, f i) j = ∏ i, f i (j i) := by simp
6594
95+ -- remove? geometrically, the all-ones vector isn't distinguished in an l2 space.
6696@[simp]
67- theorem piOuterProduct_one [CommMonoid α] :
68- (⨂ i, (WithLp.toLp 2 (1 : l i → α) : EuclideanSpace α (l i)))
69- = (WithLp.toLp 2 (1 : (Π i, l i) → α) : EuclideanSpace α (Π i, l i)) := by
70- ext j
97+ theorem piOuterProduct_one [CommMonoid α] : (⨂ i, (1 : EuclideanSpace α (l i))) = 1 := by
98+ ext1
7199 simp
72100
73101@[simp]
74102theorem piOuterProduct_zero [CommMonoidWithZero α] (f : Π i, EuclideanSpace α (l i))
75- (h : ∃ i, f i = (WithLp.toLp 2 (0 : l i → α) : EuclideanSpace α (l i))) :
76- (⨂ i, f i) = (WithLp.toLp 2 (0 : (Π i, l i) → α) : EuclideanSpace α (Π i, l i)) := by
103+ (h : ∃ i, f i = 0 ) : (⨂ i, f i) = 0 := by
77104 ext j
78105 obtain ⟨i, hi⟩ := h
79- rw [piOuterProduct_apply]
80- exact Finset.prod_eq_zero (Finset.mem_univ i) (by simp [hi])
106+ simpa using Finset.prod_eq_zero (Finset.mem_univ i) (by simp [hi])
81107
82108@[simp]
83109theorem piOuterProduct_smul [CommSemiring α] [DecidableEq ι]
84- (f : Π i, EuclideanSpace α (l i)) (i : ι) (s : α)
85- (x : EuclideanSpace α (l i)) :
110+ (f : Π i, EuclideanSpace α (l i)) (i : ι) (s : α) (x : EuclideanSpace α (l i)) :
86111 (⨂ j, (update f i (s • x)) j) = s • (⨂ j, (update f i x) j) := by
87112 ext
88113 simp [Finset.prod_update_of_mem, mul_assoc]
89114
90115-- Lean only synthesizes `Add` under `SeminormedAddCommGroup` assumption.
91- -- See `PiLp.add_apply`. Investigate why?
116+ -- See `PiLp.add_apply`. TBD: Investigate.
92117@[simp]
93118theorem piOuterProduct_add [DecidableEq ι] [CommMonoid α]
94119 [SeminormedAddCommGroup α] [RightDistribClass α]
@@ -99,26 +124,28 @@ theorem piOuterProduct_add [DecidableEq ι] [CommMonoid α]
99124
100125@ [simps, expose]
101126def PiOuterProduct.toMultilinearMap [SeminormedCommRing α] :
102- MultilinearMap α (fun i => EuclideanSpace α (l i)) (EuclideanSpace α (Π i, l i)) where
127+ MultilinearMap α (fun i ↦ EuclideanSpace α (l i)) (EuclideanSpace α (Π i, l i)) where
103128 toFun f := ⨂ i, f i
104129 map_update_add' := by simp
105130 map_update_smul' := by simp
106131
107132theorem piOuterProduct_smul_univ [SeminormedCommRing α] (c : ι → α)
108133 (f : Π i, EuclideanSpace α (l i)) :
109134 (⨂ i, c i • f i) = (∏ i, c i) • (⨂ i, f i) := by
110- simp [← EuclideanSpace.PiOuterProduct.toMultilinearMap_apply, MultilinearMap.map_smul_univ]
135+ ext1
136+ simp [Pi.piOuterProduct_smul_univ]
111137
112138theorem piOuterProduct_smul_const [SeminormedCommRing α] (a : α)
113139 (f : Π i, EuclideanSpace α (l i)) :
114140 (⨂ i, a • f i) = a ^ (Fintype.card ι) • (⨂ i, f i) := by
115- simp [piOuterProduct_smul_univ]
141+ ext1
142+ simp [Pi.piOuterProduct_smul_const]
116143
117144theorem piOuterProduct_univ_sum [DecidableEq ι] [SeminormedCommRing α] {κ : Type *} [Fintype κ]
118145 (g : (i : ι) → κ → EuclideanSpace α (l i)) :
119146 (⨂ i, ∑ j : κ, g i j) = ∑ k : (ι → κ), ⨂ i, g i (k i) := by
120- ext x
121- simp [piOuterProduct_apply, Fintype.prod_sum ]
147+ ext1
148+ simp [Pi.piOuterProduct_univ_sum ]
122149
123150end EuclideanSpace
124151
0 commit comments