l3lab/ntp-mathlib huggingface dataset:
/-- The composition of `C^n` functions on domains is `C^n`. -/
theorem ContDiffOn.comp {s : Set E} {t : Set F} {g : F → G} {f : E → F} (hg : ContDiffOn 𝕜 n g t)
    (hf : ContDiffOn 𝕜 n f s) (st : s ⊆ f ⁻¹' t) : ContDiffOn 𝕜 n (g ∘ f) s := by
  /- we lift all the spaces to a common universe, as we have already proved the result in this
    situation. -/
  let Eu : Type max uE uF uG := ULift.{max uF uG} E
  let Fu : Type max uE uF uG := ULift.{max uE uG} F
  let Gu : Type max uE uF uG := ULift.{max uE uF} G
  -- declare the isomorphisms
  have isoE : Eu ≃L[𝕜] E := ContinuousLinearEquiv.ulift
  have isoF : Fu ≃L[𝕜] F := ContinuousLinearEquiv.ulift
  have isoG : Gu ≃L[𝕜] G := ContinuousLinearEquiv.ulift
  -- lift the functions to the new spaces, check smoothness there, and then go back.
  let fu : Eu → Fu := (isoF.symm ∘ f) ∘ isoE
  have fu_diff : ContDiffOn 𝕜 n fu (isoE ⁻¹' s) := by
    rwa [isoE.contDiffOn_comp_iff, isoF.symm.comp_contDiffOn_iff]
  let gu : Fu → Gu := (isoG.symm ∘ g) ∘ isoF
  have gu_diff : ContDiffOn 𝕜 n gu (isoF ⁻¹' t) := by
    rwa [isoF.contDiffOn_comp_iff, isoG.symm.comp_contDiffOn_iff]
  have main : ContDiffOn 𝕜 n (gu ∘ fu) (isoE ⁻¹' s) := by
    apply ContDiffOn.comp_same_univ gu_diff fu_diff
    

Proof state:
𝕜 : Type u_1
inst✝¹⁰ : NontriviallyNormedField 𝕜
D : Type uD
inst✝⁹ : NormedAddCommGroup D
inst✝⁸ : NormedSpace 𝕜 D
E : Type uE
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type uF
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type uG
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
X : Type u_2
inst✝¹ : NormedAddCommGroup X
inst✝ : NormedSpace 𝕜 X
s✝ s₁ t✝ u : Set E
f✝ f₁ : E → F
g✝ : F → G
x x₀ : E
c : F
b : E × F → G
m n : ℕ∞
p : E → FormalMultilinearSeries 𝕜 E F
s : Set E
t : Set F
g : F → G
f : E → F
hg : ContDiffOn 𝕜 n g t
hf : ContDiffOn 𝕜 n f s
st : s ⊆ f ⁻¹' t
Eu : Type (max uE uF uG) := ULift.{max uF uG, uE} E
Fu : Type (max uE uF uG) := ULift.{max uE uG, uF} F
Gu : Type (max uE uF uG) := ULift.{max uE uF, uG} G
isoE : Eu ≃L[𝕜] E
isoF : Fu ≃L[𝕜] F
isoG : Gu ≃L[𝕜] G
fu : Eu → Fu := (⇑(ContinuousLinearEquiv.symm isoF) ∘ f) ∘ ⇑isoE
fu_diff : ContDiffOn 𝕜 n fu (⇑isoE ⁻¹' s)
gu : Fu → Gu := (⇑(ContinuousLinearEquiv.symm isoG) ∘ g) ∘ ⇑isoF
gu_diff : ContDiffOn 𝕜 n gu (⇑isoF ⁻¹' t)
⊢ ⇑isoE ⁻¹' s ⊆ fu ⁻¹' (⇑isoF ⁻¹' t)

Next tactic:
intro y hy
/-- The composition of `C^n` functions on domains is `C^n`. -/
theorem ContDiffOn.comp {s : Set E} {t : Set F} {g : F → G} {f : E → F} (hg : ContDiffOn 𝕜 n g t)
    (hf : ContDiffOn 𝕜 n f s) (st : s ⊆ f ⁻¹' t) : ContDiffOn 𝕜 n (g ∘ f) s := by
  /- we lift all the spaces to a common universe, as we have already proved the result in this
    situation. -/
  let Eu : Type max uE uF uG := ULift.{max uF uG} E
  let Fu : Type max uE uF uG := ULift.{max uE uG} F
  let Gu : Type max uE uF uG := ULift.{max uE uF} G
  -- declare the isomorphisms
  have isoE : Eu ≃L[𝕜] E := ContinuousLinearEquiv.ulift
  have isoF : Fu ≃L[𝕜] F := ContinuousLinearEquiv.ulift
  have isoG : Gu ≃L[𝕜] G := ContinuousLinearEquiv.ulift
  -- lift the functions to the new spaces, check smoothness there, and then go back.
  let fu : Eu → Fu := (isoF.symm ∘ f) ∘ isoE
  have fu_diff : ContDiffOn 𝕜 n fu (isoE ⁻¹' s) := by
    rwa [isoE.contDiffOn_comp_iff, isoF.symm.comp_contDiffOn_iff]
  let gu : Fu → Gu := (isoG.symm ∘ g) ∘ isoF
  have gu_diff : ContDiffOn 𝕜 n gu (isoF ⁻¹' t) := by
    rwa [isoF.contDiffOn_comp_iff, isoG.symm.comp_contDiffOn_iff]
  have main : ContDiffOn 𝕜 n (gu ∘ fu) (isoE ⁻¹' s) := by
    apply ContDiffOn.comp_same_univ gu_diff fu_diff
    intro y hy
    

Proof state:
𝕜 : Type u_1
inst✝¹⁰ : NontriviallyNormedField 𝕜
D : Type uD
inst✝⁹ : NormedAddCommGroup D
inst✝⁸ : NormedSpace 𝕜 D
E : Type uE
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type uF
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type uG
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
X : Type u_2
inst✝¹ : NormedAddCommGroup X
inst✝ : NormedSpace 𝕜 X
s✝ s₁ t✝ u : Set E
f✝ f₁ : E → F
g✝ : F → G
x x₀ : E
c : F
b : E × F → G
m n : ℕ∞
p : E → FormalMultilinearSeries 𝕜 E F
s : Set E
t : Set F
g : F → G
f : E → F
hg : ContDiffOn 𝕜 n g t
hf : ContDiffOn 𝕜 n f s
st : s ⊆ f ⁻¹' t
Eu : Type (max uE uF uG) := ULift.{max uF uG, uE} E
Fu : Type (max uE uF uG) := ULift.{max uE uG, uF} F
Gu : Type (max uE uF uG) := ULift.{max uE uF, uG} G
isoE : Eu ≃L[𝕜] E
isoF : Fu ≃L[𝕜] F
isoG : Gu ≃L[𝕜] G
fu : Eu → Fu := (⇑(ContinuousLinearEquiv.symm isoF) ∘ f) ∘ ⇑isoE
fu_diff : ContDiffOn 𝕜 n fu (⇑isoE ⁻¹' s)
gu : Fu → Gu := (⇑(ContinuousLinearEquiv.symm isoG) ∘ g) ∘ ⇑isoF
gu_diff : ContDiffOn 𝕜 n gu (⇑isoF ⁻¹' t)
y : Eu
hy : y ∈ ⇑isoE ⁻¹' s
⊢ y ∈ fu ⁻¹' (⇑isoF ⁻¹' t)

Next tactic:
simp only [ContinuousLinearEquiv.coe_apply, Function.comp_apply, mem_preimage]
/-- The composition of `C^n` functions on domains is `C^n`. -/
theorem ContDiffOn.comp {s : Set E} {t : Set F} {g : F → G} {f : E → F} (hg : ContDiffOn 𝕜 n g t)
    (hf : ContDiffOn 𝕜 n f s) (st : s ⊆ f ⁻¹' t) : ContDiffOn 𝕜 n (g ∘ f) s := by
  /- we lift all the spaces to a common universe, as we have already proved the result in this
    situation. -/
  let Eu : Type max uE uF uG := ULift.{max uF uG} E
  let Fu : Type max uE uF uG := ULift.{max uE uG} F
  let Gu : Type max uE uF uG := ULift.{max uE uF} G
  -- declare the isomorphisms
  have isoE : Eu ≃L[𝕜] E := ContinuousLinearEquiv.ulift
  have isoF : Fu ≃L[𝕜] F := ContinuousLinearEquiv.ulift
  have isoG : Gu ≃L[𝕜] G := ContinuousLinearEquiv.ulift
  -- lift the functions to the new spaces, check smoothness there, and then go back.
  let fu : Eu → Fu := (isoF.symm ∘ f) ∘ isoE
  have fu_diff : ContDiffOn 𝕜 n fu (isoE ⁻¹' s) := by
    rwa [isoE.contDiffOn_comp_iff, isoF.symm.comp_contDiffOn_iff]
  let gu : Fu → Gu := (isoG.symm ∘ g) ∘ isoF
  have gu_diff : ContDiffOn 𝕜 n gu (isoF ⁻¹' t) := by
    rwa [isoF.contDiffOn_comp_iff, isoG.symm.comp_contDiffOn_iff]
  have main : ContDiffOn 𝕜 n (gu ∘ fu) (isoE ⁻¹' s) := by
    apply ContDiffOn.comp_same_univ gu_diff fu_diff
    intro y hy
    simp only [ContinuousLinearEquiv.coe_apply, Function.comp_apply, mem_preimage]
    

Proof state:
𝕜 : Type u_1
inst✝¹⁰ : NontriviallyNormedField 𝕜
D : Type uD
inst✝⁹ : NormedAddCommGroup D
inst✝⁸ : NormedSpace 𝕜 D
E : Type uE
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type uF
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type uG
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
X : Type u_2
inst✝¹ : NormedAddCommGroup X
inst✝ : NormedSpace 𝕜 X
s✝ s₁ t✝ u : Set E
f✝ f₁ : E → F
g✝ : F → G
x x₀ : E
c : F
b : E × F → G
m n : ℕ∞
p : E → FormalMultilinearSeries 𝕜 E F
s : Set E
t : Set F
g : F → G
f : E → F
hg : ContDiffOn 𝕜 n g t
hf : ContDiffOn 𝕜 n f s
st : s ⊆ f ⁻¹' t
Eu : Type (max uE uF uG) := ULift.{max uF uG, uE} E
Fu : Type (max uE uF uG) := ULift.{max uE uG, uF} F
Gu : Type (max uE uF uG) := ULift.{max uE uF, uG} G
isoE : Eu ≃L[𝕜] E
isoF : Fu ≃L[𝕜] F
isoG : Gu ≃L[𝕜] G
fu : Eu → Fu := (⇑(ContinuousLinearEquiv.symm isoF) ∘ f) ∘ ⇑isoE
fu_diff : ContDiffOn 𝕜 n fu (⇑isoE ⁻¹' s)
gu : Fu → Gu := (⇑(ContinuousLinearEquiv.symm isoG) ∘ g) ∘ ⇑isoF
gu_diff : ContDiffOn 𝕜 n gu (⇑isoF ⁻¹' t)
y : Eu
hy : y ∈ ⇑isoE ⁻¹' s
⊢ isoF ((ContinuousLinearEquiv.symm isoF) (f (isoE y))) ∈ t

Next tactic:
rw [isoF.apply_symm_apply (f (isoE y))]
/-- The composition of `C^n` functions on domains is `C^n`. -/
theorem ContDiffOn.comp {s : Set E} {t : Set F} {g : F → G} {f : E → F} (hg : ContDiffOn 𝕜 n g t)
    (hf : ContDiffOn 𝕜 n f s) (st : s ⊆ f ⁻¹' t) : ContDiffOn 𝕜 n (g ∘ f) s := by
  /- we lift all the spaces to a common universe, as we have already proved the result in this
    situation. -/
  let Eu : Type max uE uF uG := ULift.{max uF uG} E
  let Fu : Type max uE uF uG := ULift.{max uE uG} F
  let Gu : Type max uE uF uG := ULift.{max uE uF} G
  -- declare the isomorphisms
  have isoE : Eu ≃L[𝕜] E := ContinuousLinearEquiv.ulift
  have isoF : Fu ≃L[𝕜] F := ContinuousLinearEquiv.ulift
  have isoG : Gu ≃L[𝕜] G := ContinuousLinearEquiv.ulift
  -- lift the functions to the new spaces, check smoothness there, and then go back.
  let fu : Eu → Fu := (isoF.symm ∘ f) ∘ isoE
  have fu_diff : ContDiffOn 𝕜 n fu (isoE ⁻¹' s) := by
    rwa [isoE.contDiffOn_comp_iff, isoF.symm.comp_contDiffOn_iff]
  let gu : Fu → Gu := (isoG.symm ∘ g) ∘ isoF
  have gu_diff : ContDiffOn 𝕜 n gu (isoF ⁻¹' t) := by
    rwa [isoF.contDiffOn_comp_iff, isoG.symm.comp_contDiffOn_iff]
  have main : ContDiffOn 𝕜 n (gu ∘ fu) (isoE ⁻¹' s) := by
    apply ContDiffOn.comp_same_univ gu_diff fu_diff
    intro y hy
    simp only [ContinuousLinearEquiv.coe_apply, Function.comp_apply, mem_preimage]
    rw [isoF.apply_symm_apply (f (isoE y))]
    

Proof state:
𝕜 : Type u_1
inst✝¹⁰ : NontriviallyNormedField 𝕜
D : Type uD
inst✝⁹ : NormedAddCommGroup D
inst✝⁸ : NormedSpace 𝕜 D
E : Type uE
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type uF
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type uG
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
X : Type u_2
inst✝¹ : NormedAddCommGroup X
inst✝ : NormedSpace 𝕜 X
s✝ s₁ t✝ u : Set E
f✝ f₁ : E → F
g✝ : F → G
x x₀ : E
c : F
b : E × F → G
m n : ℕ∞
p : E → FormalMultilinearSeries 𝕜 E F
s : Set E
t : Set F
g : F → G
f : E → F
hg : ContDiffOn 𝕜 n g t
hf : ContDiffOn 𝕜 n f s
st : s ⊆ f ⁻¹' t
Eu : Type (max uE uF uG) := ULift.{max uF uG, uE} E
Fu : Type (max uE uF uG) := ULift.{max uE uG, uF} F
Gu : Type (max uE uF uG) := ULift.{max uE uF, uG} G
isoE : Eu ≃L[𝕜] E
isoF : Fu ≃L[𝕜] F
isoG : Gu ≃L[𝕜] G
fu : Eu → Fu := (⇑(ContinuousLinearEquiv.symm isoF) ∘ f) ∘ ⇑isoE
fu_diff : ContDiffOn 𝕜 n fu (⇑isoE ⁻¹' s)
gu : Fu → Gu := (⇑(ContinuousLinearEquiv.symm isoG) ∘ g) ∘ ⇑isoF
gu_diff : ContDiffOn 𝕜 n gu (⇑isoF ⁻¹' t)
y : Eu
hy : y ∈ ⇑isoE ⁻¹' s
⊢ f (isoE y) ∈ t

Next tactic:
exact st hy
/-- The composition of `C^n` functions on domains is `C^n`. -/
theorem ContDiffOn.comp {s : Set E} {t : Set F} {g : F → G} {f : E → F} (hg : ContDiffOn 𝕜 n g t)
    (hf : ContDiffOn 𝕜 n f s) (st : s ⊆ f ⁻¹' t) : ContDiffOn 𝕜 n (g ∘ f) s := by
  /- we lift all the spaces to a common universe, as we have already proved the result in this
    situation. -/
  let Eu : Type max uE uF uG := ULift.{max uF uG} E
  let Fu : Type max uE uF uG := ULift.{max uE uG} F
  let Gu : Type max uE uF uG := ULift.{max uE uF} G
  -- declare the isomorphisms
  have isoE : Eu ≃L[𝕜] E := ContinuousLinearEquiv.ulift
  have isoF : Fu ≃L[𝕜] F := ContinuousLinearEquiv.ulift
  have isoG : Gu ≃L[𝕜] G := ContinuousLinearEquiv.ulift
  -- lift the functions to the new spaces, check smoothness there, and then go back.
  let fu : Eu → Fu := (isoF.symm ∘ f) ∘ isoE
  have fu_diff : ContDiffOn 𝕜 n fu (isoE ⁻¹' s) := by
    rwa [isoE.contDiffOn_comp_iff, isoF.symm.comp_contDiffOn_iff]
  let gu : Fu → Gu := (isoG.symm ∘ g) ∘ isoF
  have gu_diff : ContDiffOn 𝕜 n gu (isoF ⁻¹' t) := by
    rwa [isoF.contDiffOn_comp_iff, isoG.symm.comp_contDiffOn_iff]
  have main : ContDiffOn 𝕜 n (gu ∘ fu) (isoE ⁻¹' s) := by
    apply ContDiffOn.comp_same_univ gu_diff fu_diff
    intro y hy
    simp only [ContinuousLinearEquiv.coe_apply, Function.comp_apply, mem_preimage]
    rw [isoF.apply_symm_apply (f (isoE y))]
    exact st hy
  

Proof state:
𝕜 : Type u_1
inst✝¹⁰ : NontriviallyNormedField 𝕜
D : Type uD
inst✝⁹ : NormedAddCommGroup D
inst✝⁸ : NormedSpace 𝕜 D
E : Type uE
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type uF
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type uG
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
X : Type u_2
inst✝¹ : NormedAddCommGroup X
inst✝ : NormedSpace 𝕜 X
s✝ s₁ t✝ u : Set E
f✝ f₁ : E → F
g✝ : F → G
x x₀ : E
c : F
b : E × F → G
m n : ℕ∞
p : E → FormalMultilinearSeries 𝕜 E F
s : Set E
t : Set F
g : F → G
f : E → F
hg : ContDiffOn 𝕜 n g t
hf : ContDiffOn 𝕜 n f s
st : s ⊆ f ⁻¹' t
Eu : Type (max uE uF uG) := ULift.{max uF uG, uE} E
Fu : Type (max uE uF uG) := ULift.{max uE uG, uF} F
Gu : Type (max uE uF uG) := ULift.{max uE uF, uG} G
isoE : Eu ≃L[𝕜] E
isoF : Fu ≃L[𝕜] F
isoG : Gu ≃L[𝕜] G
fu : Eu → Fu := (⇑(ContinuousLinearEquiv.symm isoF) ∘ f) ∘ ⇑isoE
fu_diff : ContDiffOn 𝕜 n fu (⇑isoE ⁻¹' s)
gu : Fu → Gu := (⇑(ContinuousLinearEquiv.symm isoG) ∘ g) ∘ ⇑isoF
gu_diff : ContDiffOn 𝕜 n gu (⇑isoF ⁻¹' t)
main : ContDiffOn 𝕜 n (gu ∘ fu) (⇑isoE ⁻¹' s)
⊢ ContDiffOn 𝕜 n (g ∘ f) s

Next tactic:
have : gu ∘ fu = (isoG.symm ∘ g ∘ f) ∘ isoE := by
    ext y
    simp only [Function.comp_apply]
    rw [isoF.apply_symm_apply (f (isoE y))]
/-- The composition of `C^n` functions on domains is `C^n`. -/
theorem ContDiffOn.comp {s : Set E} {t : Set F} {g : F → G} {f : E → F} (hg : ContDiffOn 𝕜 n g t)
    (hf : ContDiffOn 𝕜 n f s) (st : s ⊆ f ⁻¹' t) : ContDiffOn 𝕜 n (g ∘ f) s := by
  /- we lift all the spaces to a common universe, as we have already proved the result in this
    situation. -/
  let Eu : Type max uE uF uG := ULift.{max uF uG} E
  let Fu : Type max uE uF uG := ULift.{max uE uG} F
  let Gu : Type max uE uF uG := ULift.{max uE uF} G
  -- declare the isomorphisms
  have isoE : Eu ≃L[𝕜] E := ContinuousLinearEquiv.ulift
  have isoF : Fu ≃L[𝕜] F := ContinuousLinearEquiv.ulift
  have isoG : Gu ≃L[𝕜] G := ContinuousLinearEquiv.ulift
  -- lift the functions to the new spaces, check smoothness there, and then go back.
  let fu : Eu → Fu := (isoF.symm ∘ f) ∘ isoE
  have fu_diff : ContDiffOn 𝕜 n fu (isoE ⁻¹' s) := by
    rwa [isoE.contDiffOn_comp_iff, isoF.symm.comp_contDiffOn_iff]
  let gu : Fu → Gu := (isoG.symm ∘ g) ∘ isoF
  have gu_diff : ContDiffOn 𝕜 n gu (isoF ⁻¹' t) := by
    rwa [isoF.contDiffOn_comp_iff, isoG.symm.comp_contDiffOn_iff]
  have main : ContDiffOn 𝕜 n (gu ∘ fu) (isoE ⁻¹' s) := by
    apply ContDiffOn.comp_same_univ gu_diff fu_diff
    intro y hy
    simp only [ContinuousLinearEquiv.coe_apply, Function.comp_apply, mem_preimage]
    rw [isoF.apply_symm_apply (f (isoE y))]
    exact st hy
  have : gu ∘ fu = (isoG.symm ∘ g ∘ f) ∘ isoE := by
    

Proof state:
𝕜 : Type u_1
inst✝¹⁰ : NontriviallyNormedField 𝕜
D : Type uD
inst✝⁹ : NormedAddCommGroup D
inst✝⁸ : NormedSpace 𝕜 D
E : Type uE
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type uF
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type uG
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
X : Type u_2
inst✝¹ : NormedAddCommGroup X
inst✝ : NormedSpace 𝕜 X
s✝ s₁ t✝ u : Set E
f✝ f₁ : E → F
g✝ : F → G
x x₀ : E
c : F
b : E × F → G
m n : ℕ∞
p : E → FormalMultilinearSeries 𝕜 E F
s : Set E
t : Set F
g : F → G
f : E → F
hg : ContDiffOn 𝕜 n g t
hf : ContDiffOn 𝕜 n f s
st : s ⊆ f ⁻¹' t
Eu : Type (max uE uF uG) := ULift.{max uF uG, uE} E
Fu : Type (max uE uF uG) := ULift.{max uE uG, uF} F
Gu : Type (max uE uF uG) := ULift.{max uE uF, uG} G
isoE : Eu ≃L[𝕜] E
isoF : Fu ≃L[𝕜] F
isoG : Gu ≃L[𝕜] G
fu : Eu → Fu := (⇑(ContinuousLinearEquiv.symm isoF) ∘ f) ∘ ⇑isoE
fu_diff : ContDiffOn 𝕜 n fu (⇑isoE ⁻¹' s)
gu : Fu → Gu := (⇑(ContinuousLinearEquiv.symm isoG) ∘ g) ∘ ⇑isoF
gu_diff : ContDiffOn 𝕜 n gu (⇑isoF ⁻¹' t)
main : ContDiffOn 𝕜 n (gu ∘ fu) (⇑isoE ⁻¹' s)
⊢ gu ∘ fu = (⇑(ContinuousLinearEquiv.symm isoG) ∘ g ∘ f) ∘ ⇑isoE

Next tactic:
ext y
/-- The composition of `C^n` functions on domains is `C^n`. -/
theorem ContDiffOn.comp {s : Set E} {t : Set F} {g : F → G} {f : E → F} (hg : ContDiffOn 𝕜 n g t)
    (hf : ContDiffOn 𝕜 n f s) (st : s ⊆ f ⁻¹' t) : ContDiffOn 𝕜 n (g ∘ f) s := by
  /- we lift all the spaces to a common universe, as we have already proved the result in this
    situation. -/
  let Eu : Type max uE uF uG := ULift.{max uF uG} E
  let Fu : Type max uE uF uG := ULift.{max uE uG} F
  let Gu : Type max uE uF uG := ULift.{max uE uF} G
  -- declare the isomorphisms
  have isoE : Eu ≃L[𝕜] E := ContinuousLinearEquiv.ulift
  have isoF : Fu ≃L[𝕜] F := ContinuousLinearEquiv.ulift
  have isoG : Gu ≃L[𝕜] G := ContinuousLinearEquiv.ulift
  -- lift the functions to the new spaces, check smoothness there, and then go back.
  let fu : Eu → Fu := (isoF.symm ∘ f) ∘ isoE
  have fu_diff : ContDiffOn 𝕜 n fu (isoE ⁻¹' s) := by
    rwa [isoE.contDiffOn_comp_iff, isoF.symm.comp_contDiffOn_iff]
  let gu : Fu → Gu := (isoG.symm ∘ g) ∘ isoF
  have gu_diff : ContDiffOn 𝕜 n gu (isoF ⁻¹' t) := by
    rwa [isoF.contDiffOn_comp_iff, isoG.symm.comp_contDiffOn_iff]
  have main : ContDiffOn 𝕜 n (gu ∘ fu) (isoE ⁻¹' s) := by
    apply ContDiffOn.comp_same_univ gu_diff fu_diff
    intro y hy
    simp only [ContinuousLinearEquiv.coe_apply, Function.comp_apply, mem_preimage]
    rw [isoF.apply_symm_apply (f (isoE y))]
    exact st hy
  have : gu ∘ fu = (isoG.symm ∘ g ∘ f) ∘ isoE := by
    ext y
    

Proof state:
case h.h
𝕜 : Type u_1
inst✝¹⁰ : NontriviallyNormedField 𝕜
D : Type uD
inst✝⁹ : NormedAddCommGroup D
inst✝⁸ : NormedSpace 𝕜 D
E : Type uE
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type uF
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type uG
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
X : Type u_2
inst✝¹ : NormedAddCommGroup X
inst✝ : NormedSpace 𝕜 X
s✝ s₁ t✝ u : Set E
f✝ f₁ : E → F
g✝ : F → G
x x₀ : E
c : F
b : E × F → G
m n : ℕ∞
p : E → FormalMultilinearSeries 𝕜 E F
s : Set E
t : Set F
g : F → G
f : E → F
hg : ContDiffOn 𝕜 n g t
hf : ContDiffOn 𝕜 n f s
st : s ⊆ f ⁻¹' t
Eu : Type (max uE uF uG) := ULift.{max uF uG, uE} E
Fu : Type (max uE uF uG) := ULift.{max uE uG, uF} F
Gu : Type (max uE uF uG) := ULift.{max uE uF, uG} G
isoE : Eu ≃L[𝕜] E
isoF : Fu ≃L[𝕜] F
isoG : Gu ≃L[𝕜] G
fu : Eu → Fu := (⇑(ContinuousLinearEquiv.symm isoF) ∘ f) ∘ ⇑isoE
fu_diff : ContDiffOn 𝕜 n fu (⇑isoE ⁻¹' s)
gu : Fu → Gu := (⇑(ContinuousLinearEquiv.symm isoG) ∘ g) ∘ ⇑isoF
gu_diff : ContDiffOn 𝕜 n gu (⇑isoF ⁻¹' t)
main : ContDiffOn 𝕜 n (gu ∘ fu) (⇑isoE ⁻¹' s)
y : Eu
⊢ ((gu ∘ fu) y).down = (((⇑(ContinuousLinearEquiv.symm isoG) ∘ g ∘ f) ∘ ⇑isoE) y).down

Next tactic:
simp only [Function.comp_apply]
/-- The composition of `C^n` functions on domains is `C^n`. -/
theorem ContDiffOn.comp {s : Set E} {t : Set F} {g : F → G} {f : E → F} (hg : ContDiffOn 𝕜 n g t)
    (hf : ContDiffOn 𝕜 n f s) (st : s ⊆ f ⁻¹' t) : ContDiffOn 𝕜 n (g ∘ f) s := by
  /- we lift all the spaces to a common universe, as we have already proved the result in this
    situation. -/
  let Eu : Type max uE uF uG := ULift.{max uF uG} E
  let Fu : Type max uE uF uG := ULift.{max uE uG} F
  let Gu : Type max uE uF uG := ULift.{max uE uF} G
  -- declare the isomorphisms
  have isoE : Eu ≃L[𝕜] E := ContinuousLinearEquiv.ulift
  have isoF : Fu ≃L[𝕜] F := ContinuousLinearEquiv.ulift
  have isoG : Gu ≃L[𝕜] G := ContinuousLinearEquiv.ulift
  -- lift the functions to the new spaces, check smoothness there, and then go back.
  let fu : Eu → Fu := (isoF.symm ∘ f) ∘ isoE
  have fu_diff : ContDiffOn 𝕜 n fu (isoE ⁻¹' s) := by
    rwa [isoE.contDiffOn_comp_iff, isoF.symm.comp_contDiffOn_iff]
  let gu : Fu → Gu := (isoG.symm ∘ g) ∘ isoF
  have gu_diff : ContDiffOn 𝕜 n gu (isoF ⁻¹' t) := by
    rwa [isoF.contDiffOn_comp_iff, isoG.symm.comp_contDiffOn_iff]
  have main : ContDiffOn 𝕜 n (gu ∘ fu) (isoE ⁻¹' s) := by
    apply ContDiffOn.comp_same_univ gu_diff fu_diff
    intro y hy
    simp only [ContinuousLinearEquiv.coe_apply, Function.comp_apply, mem_preimage]
    rw [isoF.apply_symm_apply (f (isoE y))]
    exact st hy
  have : gu ∘ fu = (isoG.symm ∘ g ∘ f) ∘ isoE := by
    ext y
    simp only [Function.comp_apply]
    

Proof state:
case h.h
𝕜 : Type u_1
inst✝¹⁰ : NontriviallyNormedField 𝕜
D : Type uD
inst✝⁹ : NormedAddCommGroup D
inst✝⁸ : NormedSpace 𝕜 D
E : Type uE
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type uF
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type uG
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
X : Type u_2
inst✝¹ : NormedAddCommGroup X
inst✝ : NormedSpace 𝕜 X
s✝ s₁ t✝ u : Set E
f✝ f₁ : E → F
g✝ : F → G
x x₀ : E
c : F
b : E × F → G
m n : ℕ∞
p : E → FormalMultilinearSeries 𝕜 E F
s : Set E
t : Set F
g : F → G
f : E → F
hg : ContDiffOn 𝕜 n g t
hf : ContDiffOn 𝕜 n f s
st : s ⊆ f ⁻¹' t
Eu : Type (max uE uF uG) := ULift.{max uF uG, uE} E
Fu : Type (max uE uF uG) := ULift.{max uE uG, uF} F
Gu : Type (max uE uF uG) := ULift.{max uE uF, uG} G
isoE : Eu ≃L[𝕜] E
isoF : Fu ≃L[𝕜] F
isoG : Gu ≃L[𝕜] G
fu : Eu → Fu := (⇑(ContinuousLinearEquiv.symm isoF) ∘ f) ∘ ⇑isoE
fu_diff : ContDiffOn 𝕜 n fu (⇑isoE ⁻¹' s)
gu : Fu → Gu := (⇑(ContinuousLinearEquiv.symm isoG) ∘ g) ∘ ⇑isoF
gu_diff : ContDiffOn 𝕜 n gu (⇑isoF ⁻¹' t)
main : ContDiffOn 𝕜 n (gu ∘ fu) (⇑isoE ⁻¹' s)
y : Eu
⊢ ((ContinuousLinearEquiv.symm isoG) (g (isoF ((ContinuousLinearEquiv.symm isoF) (f (isoE y)))))).down =
    ((ContinuousLinearEquiv.symm isoG) (g (f (isoE y)))).down

Next tactic:
rw [isoF.apply_symm_apply (f (isoE y))]
/-- The composition of `C^n` functions on domains is `C^n`. -/
theorem ContDiffOn.comp {s : Set E} {t : Set F} {g : F → G} {f : E → F} (hg : ContDiffOn 𝕜 n g t)
    (hf : ContDiffOn 𝕜 n f s) (st : s ⊆ f ⁻¹' t) : ContDiffOn 𝕜 n (g ∘ f) s := by
  /- we lift all the spaces to a common universe, as we have already proved the result in this
    situation. -/
  let Eu : Type max uE uF uG := ULift.{max uF uG} E
  let Fu : Type max uE uF uG := ULift.{max uE uG} F
  let Gu : Type max uE uF uG := ULift.{max uE uF} G
  -- declare the isomorphisms
  have isoE : Eu ≃L[𝕜] E := ContinuousLinearEquiv.ulift
  have isoF : Fu ≃L[𝕜] F := ContinuousLinearEquiv.ulift
  have isoG : Gu ≃L[𝕜] G := ContinuousLinearEquiv.ulift
  -- lift the functions to the new spaces, check smoothness there, and then go back.
  let fu : Eu → Fu := (isoF.symm ∘ f) ∘ isoE
  have fu_diff : ContDiffOn 𝕜 n fu (isoE ⁻¹' s) := by
    rwa [isoE.contDiffOn_comp_iff, isoF.symm.comp_contDiffOn_iff]
  let gu : Fu → Gu := (isoG.symm ∘ g) ∘ isoF
  have gu_diff : ContDiffOn 𝕜 n gu (isoF ⁻¹' t) := by
    rwa [isoF.contDiffOn_comp_iff, isoG.symm.comp_contDiffOn_iff]
  have main : ContDiffOn 𝕜 n (gu ∘ fu) (isoE ⁻¹' s) := by
    apply ContDiffOn.comp_same_univ gu_diff fu_diff
    intro y hy
    simp only [ContinuousLinearEquiv.coe_apply, Function.comp_apply, mem_preimage]
    rw [isoF.apply_symm_apply (f (isoE y))]
    exact st hy
  have : gu ∘ fu = (isoG.symm ∘ g ∘ f) ∘ isoE := by
    ext y
    simp only [Function.comp_apply]
    rw [isoF.apply_symm_apply (f (isoE y))]
  

Proof state:
𝕜 : Type u_1
inst✝¹⁰ : NontriviallyNormedField 𝕜
D : Type uD
inst✝⁹ : NormedAddCommGroup D
inst✝⁸ : NormedSpace 𝕜 D
E : Type uE
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type uF
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type uG
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
X : Type u_2
inst✝¹ : NormedAddCommGroup X
inst✝ : NormedSpace 𝕜 X
s✝ s₁ t✝ u : Set E
f✝ f₁ : E → F
g✝ : F → G
x x₀ : E
c : F
b : E × F → G
m n : ℕ∞
p : E → FormalMultilinearSeries 𝕜 E F
s : Set E
t : Set F
g : F → G
f : E → F
hg : ContDiffOn 𝕜 n g t
hf : ContDiffOn 𝕜 n f s
st : s ⊆ f ⁻¹' t
Eu : Type (max uE uF uG) := ULift.{max uF uG, uE} E
Fu : Type (max uE uF uG) := ULift.{max uE uG, uF} F
Gu : Type (max uE uF uG) := ULift.{max uE uF, uG} G
isoE : Eu ≃L[𝕜] E
isoF : Fu ≃L[𝕜] F
isoG : Gu ≃L[𝕜] G
fu : Eu → Fu := (⇑(ContinuousLinearEquiv.symm isoF) ∘ f) ∘ ⇑isoE
fu_diff : ContDiffOn 𝕜 n fu (⇑isoE ⁻¹' s)
gu : Fu → Gu := (⇑(ContinuousLinearEquiv.symm isoG) ∘ g) ∘ ⇑isoF
gu_diff : ContDiffOn 𝕜 n gu (⇑isoF ⁻¹' t)
main : ContDiffOn 𝕜 n (gu ∘ fu) (⇑isoE ⁻¹' s)
this : gu ∘ fu = (⇑(ContinuousLinearEquiv.symm isoG) ∘ g ∘ f) ∘ ⇑isoE
⊢ ContDiffOn 𝕜 n (g ∘ f) s

Next tactic:
rwa [this, isoE.contDiffOn_comp_iff, isoG.symm.comp_contDiffOn_iff] at main
/-- The composition of `C^n` functions at points in domains is `C^n`. -/
theorem ContDiffWithinAt.comp {s : Set E} {t : Set F} {g : F → G} {f : E → F} (x : E)
    (hg : ContDiffWithinAt 𝕜 n g t (f x)) (hf : ContDiffWithinAt 𝕜 n f s x) (st : s ⊆ f ⁻¹' t) :
    ContDiffWithinAt 𝕜 n (g ∘ f) s x := by
  

Proof state:
𝕜 : Type u_1
inst✝¹⁰ : NontriviallyNormedField 𝕜
D : Type uD
inst✝⁹ : NormedAddCommGroup D
inst✝⁸ : NormedSpace 𝕜 D
E : Type uE
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace 𝕜 E
F : Type uF
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace 𝕜 F
G : Type uG
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace 𝕜 G
X : Type u_2
inst✝¹ : NormedAddCommGroup X
inst✝ : NormedSpace 𝕜 X
s✝ s₁ t✝ u : Set E
f✝ f₁ : E → F
g✝ : F → G
x✝ x₀ : E
c : F
b : E × F → G
m n : ℕ∞
p : E → FormalMultilinearSeries 𝕜 E F
s : Set E
t : Set F
g : F → G
f : E → F
x : E
hg : ContDiffWithinAt 𝕜 n g t (f x)
hf : ContDiffWithinAt 𝕜 n f s x
st : s ⊆ f ⁻¹' t
⊢ ContDiffWithinAt 𝕜 n (g ∘ f) s x

Next tactic:
intro m hm