/-- Being `Cⁿ` in the model space is a local property, invariant under smooth maps. Therefore,
it will lift nicely to manifolds. -/
theorem contDiffWithinAt_localInvariantProp (n : ℕ∞) :
    (contDiffGroupoid ∞ I).LocalInvariantProp (contDiffGroupoid ∞ I')
      (ContDiffWithinAtProp I I' n) where
  is_local := by
    intro s x u f u_open xu
    have : I.symm ⁻¹' (s ∩ u) ∩ range I = I.symm ⁻¹' s ∩ range I ∩ I.symm ⁻¹' u := by
      simp only [inter_right_comm, preimage_inter]
    rw [ContDiffWithinAtProp, ContDiffWithinAtProp, this]
    symm
    apply contDiffWithinAt_inter
    have : u ∈ 𝓝 (I.symm (I x)) := by
      rw [ModelWithCorners.left_inv]; exact IsOpen.mem_nhds u_open xu
    apply ContinuousAt.preimage_mem_nhds I.continuous_symm.continuousAt this
  right_invariance' := by
    intro s x f e he hx h
    rw [ContDiffWithinAtProp] at h ⊢
    have : I x = (I ∘ e.symm ∘ I.symm) (I (e x)) := by simp only [hx, mfld_simps]
    rw [this] at h
    have : I (e x) ∈ I.symm ⁻¹' e.target ∩ range I := by simp only [hx, mfld_simps]
    

Proof state:
𝕜 : Type u_1
inst✝³⁷ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝³⁶ : NormedAddCommGroup E
inst✝³⁵ : NormedSpace 𝕜 E
H : Type u_3
inst✝³⁴ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
M : Type u_4
inst✝³³ : TopologicalSpace M
inst✝³² : ChartedSpace H M
inst✝³¹ : SmoothManifoldWithCorners I M
E' : Type u_5
inst✝³⁰ : NormedAddCommGroup E'
inst✝²⁹ : NormedSpace 𝕜 E'
H' : Type u_6
inst✝²⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M' : Type u_7
inst✝²⁷ : TopologicalSpace M'
inst✝²⁶ : ChartedSpace H' M'
inst✝²⁵ : SmoothManifoldWithCorners I' M'
E'' : Type u_8
inst✝²⁴ : NormedAddCommGroup E''
inst✝²³ : NormedSpace 𝕜 E''
H'' : Type u_9
inst✝²² : TopologicalSpace H''
I'' : ModelWithCorners 𝕜 E'' H''
M'' : Type u_10
inst✝²¹ : TopologicalSpace M''
inst✝²⁰ : ChartedSpace H'' M''
F : Type u_11
inst✝¹⁹ : NormedAddCommGroup F
inst✝¹⁸ : NormedSpace 𝕜 F
G : Type u_12
inst✝¹⁷ : TopologicalSpace G
J : ModelWithCorners 𝕜 F G
N : Type u_13
inst✝¹⁶ : TopologicalSpace N
inst✝¹⁵ : ChartedSpace G N
inst✝¹⁴ : SmoothManifoldWithCorners J N
F' : Type u_14
inst✝¹³ : NormedAddCommGroup F'
inst✝¹² : NormedSpace 𝕜 F'
G' : Type u_15
inst✝¹¹ : TopologicalSpace G'
J' : ModelWithCorners 𝕜 F' G'
N' : Type u_16
inst✝¹⁰ : TopologicalSpace N'
inst✝⁹ : ChartedSpace G' N'
inst✝⁸ : SmoothManifoldWithCorners J' N'
F₁ : Type u_17
inst✝⁷ : NormedAddCommGroup F₁
inst✝⁶ : NormedSpace 𝕜 F₁
F₂ : Type u_18
inst✝⁵ : NormedAddCommGroup F₂
inst✝⁴ : NormedSpace 𝕜 F₂
F₃ : Type u_19
inst✝³ : NormedAddCommGroup F₃
inst✝² : NormedSpace 𝕜 F₃
F₄ : Type u_20
inst✝¹ : NormedAddCommGroup F₄
inst✝ : NormedSpace 𝕜 F₄
e✝ : PartialHomeomorph M H
e' : PartialHomeomorph M' H'
f✝ f₁ : M → M'
s✝ s₁ t : Set M
x✝ : M
m n✝ n : ℕ∞
s : Set H
x : H
f : H → H'
e : PartialHomeomorph H H
he : e ∈ contDiffGroupoid ⊤ I
hx : x ∈ e.source
h :
  ContDiffWithinAt 𝕜 n (↑I' ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I)
    ((↑I ∘ ↑(PartialHomeomorph.symm e) ∘ ↑(ModelWithCorners.symm I)) (↑I (↑e x)))
this✝ : ↑I x = (↑I ∘ ↑(PartialHomeomorph.symm e) ∘ ↑(ModelWithCorners.symm I)) (↑I (↑e x))
this : ↑I (↑e x) ∈ ↑(ModelWithCorners.symm I) ⁻¹' e.target ∩ range ↑I
⊢ ContDiffWithinAt 𝕜 n (↑I' ∘ (f ∘ ↑(PartialHomeomorph.symm e)) ∘ ↑(ModelWithCorners.symm I))
    (↑(ModelWithCorners.symm I) ⁻¹' (↑(PartialHomeomorph.symm e) ⁻¹' s) ∩ range ↑I) (↑I (↑e x))

Next tactic:
have := (mem_groupoid_of_pregroupoid.2 he).2.contDiffWithinAt this