@@ -225,6 +225,21 @@ theorem HasMFDerivWithinAt.prodMk {f : M → M'} {g : M → M''}
225225    HasMFDerivWithinAt I (I'.prod I'') (fun  y ↦ (f y, g y)) s x (df.prod dg) :=
226226  ⟨hf.1 .prodMk hg.1 , hf.2 .prodMk hg.2 ⟩
227227
228+ lemma  mfderivWithin_prodMk  {f : M → M'} {g : M → M''}
229+     (hf : MDifferentiableWithinAt I I' f s x) (hg : MDifferentiableWithinAt I I'' g s x)
230+     (hs : UniqueMDiffWithinAt I s x) :
231+     mfderivWithin I (I'.prod I'') (fun  x => (f x, g x)) s x
232+       = (mfderivWithin I I' f s x).prod (mfderivWithin I I'' g s x) :=
233+   (hf.hasMFDerivWithinAt.prodMk hg.hasMFDerivWithinAt).mfderivWithin hs
234+ 
235+ lemma  mfderiv_prodMk  {f : M → M'} {g : M → M''}
236+     (hf : MDifferentiableAt I I' f x) (hg : MDifferentiableAt I I'' g x) :
237+     mfderiv I (I'.prod I'') (fun  x => (f x, g x)) x
238+       = (mfderiv I I' f x).prod (mfderiv I I'' g x) := by 
239+   simp_rw [← mfderivWithin_univ]
240+   exact mfderivWithin_prodMk hf.mdifferentiableWithinAt hg.mdifferentiableWithinAt
241+     (uniqueMDiffWithinAt_univ I)
242+ 
228243theorem  MDifferentiableAt.prodMk  {f : M → M'} {g : M → M''} (hf : MDifferentiableAt I I' f x)
229244    (hg : MDifferentiableAt I I'' g x) :
230245    MDifferentiableAt I (I'.prod I'') (fun  x => (f x, g x)) x :=
@@ -539,6 +554,64 @@ theorem MDifferentiable.prodMap (hf : MDifferentiable I I' f) (hg : MDifferentia
539554@[deprecated (since := "2025-04-18")] 
540555alias MDifferentiable.prod_map := MDifferentiable.prodMap
541556
557+ lemma  HasMFDerivWithinAt.prodMap  {s : Set <| M × M'} {p : M × M'} {f : M → N} {g : M' → N'}
558+     {df : TangentSpace I p.1  →L[𝕜] TangentSpace J (f p.1 )}
559+     (hf : HasMFDerivWithinAt I J f (Prod.fst '' s) p.1  df)
560+     {dg : TangentSpace I' p.2  →L[𝕜] TangentSpace J' (g p.2 )}
561+     (hg : HasMFDerivWithinAt I' J' g (Prod.snd '' s) p.2  dg) :
562+     HasMFDerivWithinAt (I.prod I') (J.prod J') (Prod.map f g) s p (df.prodMap dg) := by 
563+   refine ⟨hf.1 .prodMap hg.1  |>.mono (by  grind), ?_⟩
564+   have  better : ((extChartAt (I.prod I') p).symm ⁻¹' s ∩ range ↑(I.prod I')) ⊆
565+       ((extChartAt I p.1 ).symm ⁻¹' (Prod.fst '' s) ∩ range I) ×ˢ
566+         ((extChartAt I' p.2 ).symm ⁻¹' (Prod.snd '' s) ∩ range I') := by 
567+     simp only [mfld_simps]
568+     rw [range_prodMap, I.toPartialEquiv.prod_symm, (chartAt H p.1 ).toPartialEquiv.prod_symm]
569+     -- This is very tedious; a nicer proof is welcome! 
570+     intro p₀ ⟨hp₀, ⟨hp₁₁, hp₁₂⟩⟩
571+     refine ⟨⟨?_, by  assumption⟩, ⟨?_, by  assumption⟩⟩
572+     · simp_all
573+       use (chartAt H' p.2 ).symm <| I'.symm p₀.2 
574+     · simp_all
575+       use (chartAt H p.1 ).symm <| I.symm p₀.1 
576+   rw [writtenInExtChart_prod]
577+   apply HasFDerivWithinAt.mono ?_ better
578+   apply HasFDerivWithinAt.prodMap
579+   exacts [hf.2 .mono (fst_image_prod_subset ..), hg.2 .mono (snd_image_prod_subset ..)]
580+ 
581+ lemma  HasMFDerivAt.prodMap  {p : M × M'} {f : M → N} {g : M' → N'}
582+     {df : TangentSpace I p.1  →L[𝕜] TangentSpace J (f p.1 )} (hf : HasMFDerivAt I J f p.1  df)
583+     {dg : TangentSpace I' p.2  →L[𝕜] TangentSpace J' (g p.2 )} (hg : HasMFDerivAt I' J' g p.2  dg) :
584+     HasMFDerivAt (I.prod I') (J.prod J') (Prod.map f g) p
585+       ((mfderiv I J f p.1 ).prodMap (mfderiv I' J' g p.2 )) := by 
586+   simp_rw [← hasMFDerivWithinAt_univ, ← mfderivWithin_univ, ← univ_prod_univ]
587+   convert hf.hasMFDerivWithinAt.prodMap hg.hasMFDerivWithinAt
588+   · rw [mfderivWithin_univ]; exact hf.mfderiv
589+   · rw [mfderivWithin_univ]; exact hg.mfderiv
590+ 
591+ -- Note: this lemma does not apply easily to an arbitrary subset `s ⊆ M × M'` as 
592+ -- unique differentiability on `(Prod.fst '' s)` and `(Prod.snd '' s)` does not imply 
593+ -- unique differentiability on `s`: a priori, `(Prod.fst '' s) × (Prod.fst '' s)` 
594+ -- could be a strict superset of `s`. 
595+ lemma  mfderivWithin_prodMap  {p : M × M'} {t : Set M'} {f : M → N} {g : M' → N'}
596+     (hf : MDifferentiableWithinAt I J f s p.1 ) (hg : MDifferentiableWithinAt I' J' g t p.2 )
597+     (hs : UniqueMDiffWithinAt I s p.1 ) (ht : UniqueMDiffWithinAt I' t p.2 ) :
598+     mfderivWithin (I.prod I') (J.prod J') (Prod.map f g) (s ×ˢ t) p
599+       = (mfderivWithin I J f s p.1 ).prodMap (mfderivWithin I' J' g t p.2 ) := by 
600+   have  hf' : HasMFDerivWithinAt I J f (Prod.fst '' s ×ˢ t) p.1  (mfderivWithin I J f s p.1 ) := by 
601+     apply hf.hasMFDerivWithinAt.mono (by  grind)
602+   have  hg' : HasMFDerivWithinAt I' J' g (Prod.snd '' s ×ˢ t) p.2  (mfderivWithin I' J' g t p.2 ) := by 
603+     apply hg.hasMFDerivWithinAt.mono (by  grind)
604+   apply (hf'.prodMap hg').mfderivWithin (hs.prod ht)
605+ 
606+ lemma  mfderiv_prodMap  {p : M × M'} {f : M → N} {g : M' → N'}
607+     (hf : MDifferentiableAt I J f p.1 ) (hg : MDifferentiableAt I' J' g p.2 ) :
608+     mfderiv (I.prod I') (J.prod J') (Prod.map f g) p
609+       = (mfderiv I J f p.1 ).prodMap (mfderiv I' J' g p.2 ) := by 
610+   simp_rw [← mfderivWithin_univ]
611+   rw [← univ_prod_univ]
612+   exact mfderivWithin_prodMap hf.mdifferentiableWithinAt hg.mdifferentiableWithinAt
613+     (uniqueMDiffWithinAt_univ I) (uniqueMDiffWithinAt_univ I')
614+ 
542615end  prodMap
543616
544617@[simp, mfld_simps] 
0 commit comments