l3lab/ntp-mathlib huggingface dataset:
lemma IsSeparable.of_equiv_equiv {A₁ B₁ A₂ B₂ : Type*} [Field A₁] [Field B₁]
    [Field A₂] [Field B₂] [Algebra A₁ B₁] [Algebra A₂ B₂] (e₁ : A₁ ≃+* A₂) (e₂ : B₁ ≃+* B₂)
    (he : RingHom.comp (algebraMap A₂ B₂) ↑e₁ = RingHom.comp ↑e₂ (algebraMap A₁ B₁))
    [IsSeparable A₁ B₁] : IsSeparable A₂ B₂ := by
  letI := e₁.toRingHom.toAlgebra
  letI := ((algebraMap A₁ B₁).comp e₁.symm.toRingHom).toAlgebra
  haveI : IsScalarTower A₁ A₂ B₁ := IsScalarTower.of_algebraMap_eq
    (fun x ↦ by simp [RingHom.algebraMap_toAlgebra])
  

Proof state:
F : Type u_1
K : Type u_2
E : Type u_3
inst✝¹³ : Field F
inst✝¹² : Field K
inst✝¹¹ : Field E
inst✝¹⁰ : Algebra F K
inst✝⁹ : Algebra F E
inst✝⁸ : Algebra K E
inst✝⁷ : IsScalarTower F K E
A₁ : Type u_4
B₁ : Type u_5
A₂ : Type u_6
B₂ : Type u_7
inst✝⁶ : Field A₁
inst✝⁵ : Field B₁
inst✝⁴ : Field A₂
inst✝³ : Field B₂
inst✝² : Algebra A₁ B₁
inst✝¹ : Algebra A₂ B₂
e₁ : A₁ ≃+* A₂
e₂ : B₁ ≃+* B₂
he : RingHom.comp (algebraMap A₂ B₂) ↑e₁ = RingHom.comp (↑e₂) (algebraMap A₁ B₁)
inst✝ : IsSeparable A₁ B₁
this✝¹ : Algebra A₁ A₂ := RingHom.toAlgebra (RingEquiv.toRingHom e₁)
this✝ : Algebra A₂ B₁ := RingHom.toAlgebra (RingHom.comp (algebraMap A₁ B₁) (RingEquiv.toRingHom (RingEquiv.symm e₁)))
this : IsScalarTower A₁ A₂ B₁
⊢ IsSeparable A₂ B₂

Next tactic:
let e : B₁ ≃ₐ[A₂] B₂ := { e₂ with commutes' := fun r ↦ by simpa [RingHom.algebraMap_toAlgebra]
                                                  using FunLike.congr_fun he.symm (e₁.symm r) }
lemma IsSeparable.of_equiv_equiv {A₁ B₁ A₂ B₂ : Type*} [Field A₁] [Field B₁]
    [Field A₂] [Field B₂] [Algebra A₁ B₁] [Algebra A₂ B₂] (e₁ : A₁ ≃+* A₂) (e₂ : B₁ ≃+* B₂)
    (he : RingHom.comp (algebraMap A₂ B₂) ↑e₁ = RingHom.comp ↑e₂ (algebraMap A₁ B₁))
    [IsSeparable A₁ B₁] : IsSeparable A₂ B₂ := by
  letI := e₁.toRingHom.toAlgebra
  letI := ((algebraMap A₁ B₁).comp e₁.symm.toRingHom).toAlgebra
  haveI : IsScalarTower A₁ A₂ B₁ := IsScalarTower.of_algebraMap_eq
    (fun x ↦ by simp [RingHom.algebraMap_toAlgebra])
  let e : B₁ ≃ₐ[A₂] B₂ := { e₂ with commutes' := fun r ↦ by 

Proof state:
F : Type u_1
K : Type u_2
E : Type u_3
inst✝¹³ : Field F
inst✝¹² : Field K
inst✝¹¹ : Field E
inst✝¹⁰ : Algebra F K
inst✝⁹ : Algebra F E
inst✝⁸ : Algebra K E
inst✝⁷ : IsScalarTower F K E
A₁ : Type u_4
B₁ : Type u_5
A₂ : Type u_6
B₂ : Type u_7
inst✝⁶ : Field A₁
inst✝⁵ : Field B₁
inst✝⁴ : Field A₂
inst✝³ : Field B₂
inst✝² : Algebra A₁ B₁
inst✝¹ : Algebra A₂ B₂
e₁ : A₁ ≃+* A₂
e₂ : B₁ ≃+* B₂
he : RingHom.comp (algebraMap A₂ B₂) ↑e₁ = RingHom.comp (↑e₂) (algebraMap A₁ B₁)
inst✝ : IsSeparable A₁ B₁
this✝¹ : Algebra A₁ A₂ := RingHom.toAlgebra (RingEquiv.toRingHom e₁)
this✝ : Algebra A₂ B₁ := RingHom.toAlgebra (RingHom.comp (algebraMap A₁ B₁) (RingEquiv.toRingHom (RingEquiv.symm e₁)))
this : IsScalarTower A₁ A₂ B₁
r : A₂
⊢ Equiv.toFun e₂.toEquiv ((algebraMap A₂ B₁) r) = (algebraMap A₂ B₂) r

Next tactic:
simpa [RingHom.algebraMap_toAlgebra]
                                                  using FunLike.congr_fun he.symm (e₁.symm r)
lemma IsSeparable.of_equiv_equiv {A₁ B₁ A₂ B₂ : Type*} [Field A₁] [Field B₁]
    [Field A₂] [Field B₂] [Algebra A₁ B₁] [Algebra A₂ B₂] (e₁ : A₁ ≃+* A₂) (e₂ : B₁ ≃+* B₂)
    (he : RingHom.comp (algebraMap A₂ B₂) ↑e₁ = RingHom.comp ↑e₂ (algebraMap A₁ B₁))
    [IsSeparable A₁ B₁] : IsSeparable A₂ B₂ := by
  letI := e₁.toRingHom.toAlgebra
  letI := ((algebraMap A₁ B₁).comp e₁.symm.toRingHom).toAlgebra
  haveI : IsScalarTower A₁ A₂ B₁ := IsScalarTower.of_algebraMap_eq
    (fun x ↦ by simp [RingHom.algebraMap_toAlgebra])
  let e : B₁ ≃ₐ[A₂] B₂ := { e₂ with commutes' := fun r ↦ by simpa [RingHom.algebraMap_toAlgebra]
                                                  using FunLike.congr_fun he.symm (e₁.symm r) }
  

Proof state:
F : Type u_1
K : Type u_2
E : Type u_3
inst✝¹³ : Field F
inst✝¹² : Field K
inst✝¹¹ : Field E
inst✝¹⁰ : Algebra F K
inst✝⁹ : Algebra F E
inst✝⁸ : Algebra K E
inst✝⁷ : IsScalarTower F K E
A₁ : Type u_4
B₁ : Type u_5
A₂ : Type u_6
B₂ : Type u_7
inst✝⁶ : Field A₁
inst✝⁵ : Field B₁
inst✝⁴ : Field A₂
inst✝³ : Field B₂
inst✝² : Algebra A₁ B₁
inst✝¹ : Algebra A₂ B₂
e₁ : A₁ ≃+* A₂
e₂ : B₁ ≃+* B₂
he : RingHom.comp (algebraMap A₂ B₂) ↑e₁ = RingHom.comp (↑e₂) (algebraMap A₁ B₁)
inst✝ : IsSeparable A₁ B₁
this✝¹ : Algebra A₁ A₂ := RingHom.toAlgebra (RingEquiv.toRingHom e₁)
this✝ : Algebra A₂ B₁ := RingHom.toAlgebra (RingHom.comp (algebraMap A₁ B₁) (RingEquiv.toRingHom (RingEquiv.symm e₁)))
this : IsScalarTower A₁ A₂ B₁
e : B₁ ≃ₐ[A₂] B₂ :=
  { toEquiv := e₂.toEquiv,
    map_mul' :=
      (_ : ∀ (x y : B₁), Equiv.toFun e₂.toEquiv (x * y) = Equiv.toFun e₂.toEquiv x * Equiv.toFun e₂.toEquiv y),
    map_add' :=
      (_ : ∀ (x y : B₁), Equiv.toFun e₂.toEquiv (x + y) = Equiv.toFun e₂.toEquiv x + Equiv.toFun e₂.toEquiv y),
    commutes' := (_ : ∀ (r : A₂), Equiv.toFun e₂.toEquiv ((algebraMap A₂ B₁) r) = (algebraMap A₂ B₂) r) }
⊢ IsSeparable A₂ B₂

Next tactic:
haveI := isSeparable_tower_top_of_isSeparable A₁ A₂ B₁
lemma IsSeparable.of_equiv_equiv {A₁ B₁ A₂ B₂ : Type*} [Field A₁] [Field B₁]
    [Field A₂] [Field B₂] [Algebra A₁ B₁] [Algebra A₂ B₂] (e₁ : A₁ ≃+* A₂) (e₂ : B₁ ≃+* B₂)
    (he : RingHom.comp (algebraMap A₂ B₂) ↑e₁ = RingHom.comp ↑e₂ (algebraMap A₁ B₁))
    [IsSeparable A₁ B₁] : IsSeparable A₂ B₂ := by
  letI := e₁.toRingHom.toAlgebra
  letI := ((algebraMap A₁ B₁).comp e₁.symm.toRingHom).toAlgebra
  haveI : IsScalarTower A₁ A₂ B₁ := IsScalarTower.of_algebraMap_eq
    (fun x ↦ by simp [RingHom.algebraMap_toAlgebra])
  let e : B₁ ≃ₐ[A₂] B₂ := { e₂ with commutes' := fun r ↦ by simpa [RingHom.algebraMap_toAlgebra]
                                                  using FunLike.congr_fun he.symm (e₁.symm r) }
  haveI := isSeparable_tower_top_of_isSeparable A₁ A₂ B₁
  

Proof state:
F : Type u_1
K : Type u_2
E : Type u_3
inst✝¹³ : Field F
inst✝¹² : Field K
inst✝¹¹ : Field E
inst✝¹⁰ : Algebra F K
inst✝⁹ : Algebra F E
inst✝⁸ : Algebra K E
inst✝⁷ : IsScalarTower F K E
A₁ : Type u_4
B₁ : Type u_5
A₂ : Type u_6
B₂ : Type u_7
inst✝⁶ : Field A₁
inst✝⁵ : Field B₁
inst✝⁴ : Field A₂
inst✝³ : Field B₂
inst✝² : Algebra A₁ B₁
inst✝¹ : Algebra A₂ B₂
e₁ : A₁ ≃+* A₂
e₂ : B₁ ≃+* B₂
he : RingHom.comp (algebraMap A₂ B₂) ↑e₁ = RingHom.comp (↑e₂) (algebraMap A₁ B₁)
inst✝ : IsSeparable A₁ B₁
this✝² : Algebra A₁ A₂ := RingHom.toAlgebra (RingEquiv.toRingHom e₁)
this✝¹ : Algebra A₂ B₁ := RingHom.toAlgebra (RingHom.comp (algebraMap A₁ B₁) (RingEquiv.toRingHom (RingEquiv.symm e₁)))
this✝ : IsScalarTower A₁ A₂ B₁
e : B₁ ≃ₐ[A₂] B₂ :=
  { toEquiv := e₂.toEquiv,
    map_mul' :=
      (_ : ∀ (x y : B₁), Equiv.toFun e₂.toEquiv (x * y) = Equiv.toFun e₂.toEquiv x * Equiv.toFun e₂.toEquiv y),
    map_add' :=
      (_ : ∀ (x y : B₁), Equiv.toFun e₂.toEquiv (x + y) = Equiv.toFun e₂.toEquiv x + Equiv.toFun e₂.toEquiv y),
    commutes' := (_ : ∀ (r : A₂), Equiv.toFun e₂.toEquiv ((algebraMap A₂ B₁) r) = (algebraMap A₂ B₂) r) }
this : IsSeparable A₂ B₁
⊢ IsSeparable A₂ B₂

Next tactic:
exact IsSeparable.of_algHom _ _ e.symm.toAlgHom
theorem AlgHom.card_of_powerBasis (pb : PowerBasis K S) (h_sep : (minpoly K pb.gen).Separable)
    (h_splits : (minpoly K pb.gen).Splits (algebraMap K L)) :
    @Fintype.card (S →ₐ[K] L) (PowerBasis.AlgHom.fintype pb) = pb.dim := by
  

Proof state:
R : Type u_1
S : Type u_2
T : Type u_3
inst✝⁵ : CommRing S
K : Type u_4
L : Type u_5
F : Type u_6
inst✝⁴ : Field K
inst✝³ : Field L
inst✝² : Field F
inst✝¹ : Algebra K S
inst✝ : Algebra K L
pb : PowerBasis K S
h_sep : Separable (minpoly K pb.gen)
h_splits : Splits (algebraMap K L) (minpoly K pb.gen)
⊢ Fintype.card (S →ₐ[K] L) = pb.dim

Next tactic:
let _ := (PowerBasis.AlgHom.fintype pb : Fintype (S →ₐ[K] L))
theorem AlgHom.card_of_powerBasis (pb : PowerBasis K S) (h_sep : (minpoly K pb.gen).Separable)
    (h_splits : (minpoly K pb.gen).Splits (algebraMap K L)) :
    @Fintype.card (S →ₐ[K] L) (PowerBasis.AlgHom.fintype pb) = pb.dim := by
  let _ := (PowerBasis.AlgHom.fintype pb : Fintype (S →ₐ[K] L))
  

Proof state:
R : Type u_1
S : Type u_2
T : Type u_3
inst✝⁵ : CommRing S
K : Type u_4
L : Type u_5
F : Type u_6
inst✝⁴ : Field K
inst✝³ : Field L
inst✝² : Field F
inst✝¹ : Algebra K S
inst✝ : Algebra K L
pb : PowerBasis K S
h_sep : Separable (minpoly K pb.gen)
h_splits : Splits (algebraMap K L) (minpoly K pb.gen)
x✝ : Fintype (S →ₐ[K] L) := PowerBasis.AlgHom.fintype pb
⊢ Fintype.card (S →ₐ[K] L) = pb.dim

Next tactic:
rw [Fintype.card_congr pb.liftEquiv', Fintype.card_of_subtype _ (fun x => Multiset.mem_toFinset),
    ← pb.natDegree_minpoly, natDegree_eq_card_roots h_splits, Multiset.toFinset_card_of_nodup]
theorem AlgHom.card_of_powerBasis (pb : PowerBasis K S) (h_sep : (minpoly K pb.gen).Separable)
    (h_splits : (minpoly K pb.gen).Splits (algebraMap K L)) :
    @Fintype.card (S →ₐ[K] L) (PowerBasis.AlgHom.fintype pb) = pb.dim := by
  let _ := (PowerBasis.AlgHom.fintype pb : Fintype (S →ₐ[K] L))
  rw [Fintype.card_congr pb.liftEquiv', Fintype.card_of_subtype _ (fun x => Multiset.mem_toFinset),
    ← pb.natDegree_minpoly, natDegree_eq_card_roots h_splits, Multiset.toFinset_card_of_nodup]
  

Proof state:
R : Type u_1
S : Type u_2
T : Type u_3
inst✝⁵ : CommRing S
K : Type u_4
L : Type u_5
F : Type u_6
inst✝⁴ : Field K
inst✝³ : Field L
inst✝² : Field F
inst✝¹ : Algebra K S
inst✝ : Algebra K L
pb : PowerBasis K S
h_sep : Separable (minpoly K pb.gen)
h_splits : Splits (algebraMap K L) (minpoly K pb.gen)
x✝ : Fintype (S →ₐ[K] L) := PowerBasis.AlgHom.fintype pb
⊢ Multiset.Nodup (aroots (minpoly K pb.gen) L)

Next tactic:
exact nodup_roots ((separable_map (algebraMap K L)).mpr h_sep)
/-- Being differentiable in the model space is a local property, invariant under smooth maps.
Therefore, it will lift nicely to manifolds. -/
theorem differentiable_within_at_localInvariantProp :
    (contDiffGroupoid ⊤ I).LocalInvariantProp (contDiffGroupoid ⊤ I')
      (DifferentiableWithinAtProp I I') :=
  { is_local := by
      

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
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'
⊢ ∀ {s : Set H} {x : H} {u : Set H} {f : H → H'},
    IsOpen u → x ∈ u → (DifferentiableWithinAtProp I I' f s x ↔ DifferentiableWithinAtProp I I' f (s ∩ u) x)

Next tactic:
intro s x u f u_open xu
/-- Being differentiable in the model space is a local property, invariant under smooth maps.
Therefore, it will lift nicely to manifolds. -/
theorem differentiable_within_at_localInvariantProp :
    (contDiffGroupoid ⊤ I).LocalInvariantProp (contDiffGroupoid ⊤ I')
      (DifferentiableWithinAtProp I I') :=
  { is_local := by
      intro s x u f u_open xu
      

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
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'
s : Set H
x : H
u : Set H
f : H → H'
u_open : IsOpen u
xu : x ∈ u
⊢ DifferentiableWithinAtProp I I' f s x ↔ DifferentiableWithinAtProp I I' f (s ∩ u) x

Next tactic:
have : I.symm ⁻¹' (s ∩ u) ∩ Set.range I = I.symm ⁻¹' s ∩ Set.range I ∩ I.symm ⁻¹' u := by
        simp only [Set.inter_right_comm, Set.preimage_inter]
/-- Being differentiable in the model space is a local property, invariant under smooth maps.
Therefore, it will lift nicely to manifolds. -/
theorem differentiable_within_at_localInvariantProp :
    (contDiffGroupoid ⊤ I).LocalInvariantProp (contDiffGroupoid ⊤ I')
      (DifferentiableWithinAtProp I I') :=
  { is_local := by
      intro s x u f u_open xu
      have : I.symm ⁻¹' (s ∩ u) ∩ Set.range I = I.symm ⁻¹' s ∩ Set.range I ∩ I.symm ⁻¹' u := by
        

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
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'
s : Set H
x : H
u : Set H
f : H → H'
u_open : IsOpen u
xu : x ∈ u
⊢ ↑(ModelWithCorners.symm I) ⁻¹' (s ∩ u) ∩ range ↑I =
    ↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I ∩ ↑(ModelWithCorners.symm I) ⁻¹' u

Next tactic:
simp only [Set.inter_right_comm, Set.preimage_inter]
/-- Being differentiable in the model space is a local property, invariant under smooth maps.
Therefore, it will lift nicely to manifolds. -/
theorem differentiable_within_at_localInvariantProp :
    (contDiffGroupoid ⊤ I).LocalInvariantProp (contDiffGroupoid ⊤ I')
      (DifferentiableWithinAtProp I I') :=
  { is_local := by
      intro s x u f u_open xu
      have : I.symm ⁻¹' (s ∩ u) ∩ Set.range I = I.symm ⁻¹' s ∩ Set.range I ∩ I.symm ⁻¹' u := by
        simp only [Set.inter_right_comm, Set.preimage_inter]
      

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
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'
s : Set H
x : H
u : Set H
f : H → H'
u_open : IsOpen u
xu : x ∈ u
this :
  ↑(ModelWithCorners.symm I) ⁻¹' (s ∩ u) ∩ range ↑I =
    ↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I ∩ ↑(ModelWithCorners.symm I) ⁻¹' u
⊢ DifferentiableWithinAtProp I I' f s x ↔ DifferentiableWithinAtProp I I' f (s ∩ u) x

Next tactic:
rw [DifferentiableWithinAtProp, DifferentiableWithinAtProp, this]
/-- Being differentiable in the model space is a local property, invariant under smooth maps.
Therefore, it will lift nicely to manifolds. -/
theorem differentiable_within_at_localInvariantProp :
    (contDiffGroupoid ⊤ I).LocalInvariantProp (contDiffGroupoid ⊤ I')
      (DifferentiableWithinAtProp I I') :=
  { is_local := by
      intro s x u f u_open xu
      have : I.symm ⁻¹' (s ∩ u) ∩ Set.range I = I.symm ⁻¹' s ∩ Set.range I ∩ I.symm ⁻¹' u := by
        simp only [Set.inter_right_comm, Set.preimage_inter]
      rw [DifferentiableWithinAtProp, DifferentiableWithinAtProp, this]
      

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
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'
s : Set H
x : H
u : Set H
f : H → H'
u_open : IsOpen u
xu : x ∈ u
this :
  ↑(ModelWithCorners.symm I) ⁻¹' (s ∩ u) ∩ range ↑I =
    ↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I ∩ ↑(ModelWithCorners.symm I) ⁻¹' u
⊢ DifferentiableWithinAt 𝕜 (↑I' ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I) (↑I x) ↔
    DifferentiableWithinAt 𝕜 (↑I' ∘ f ∘ ↑(ModelWithCorners.symm I))
      (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I ∩ ↑(ModelWithCorners.symm I) ⁻¹' u) (↑I x)

Next tactic:
symm
/-- Being differentiable in the model space is a local property, invariant under smooth maps.
Therefore, it will lift nicely to manifolds. -/
theorem differentiable_within_at_localInvariantProp :
    (contDiffGroupoid ⊤ I).LocalInvariantProp (contDiffGroupoid ⊤ I')
      (DifferentiableWithinAtProp I I') :=
  { is_local := by
      intro s x u f u_open xu
      have : I.symm ⁻¹' (s ∩ u) ∩ Set.range I = I.symm ⁻¹' s ∩ Set.range I ∩ I.symm ⁻¹' u := by
        simp only [Set.inter_right_comm, Set.preimage_inter]
      rw [DifferentiableWithinAtProp, DifferentiableWithinAtProp, this]
      symm
      

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
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'
s : Set H
x : H
u : Set H
f : H → H'
u_open : IsOpen u
xu : x ∈ u
this :
  ↑(ModelWithCorners.symm I) ⁻¹' (s ∩ u) ∩ range ↑I =
    ↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I ∩ ↑(ModelWithCorners.symm I) ⁻¹' u
⊢ DifferentiableWithinAt 𝕜 (↑I' ∘ f ∘ ↑(ModelWithCorners.symm I))
      (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I ∩ ↑(ModelWithCorners.symm I) ⁻¹' u) (↑I x) ↔
    DifferentiableWithinAt 𝕜 (↑I' ∘ f ∘ ↑(ModelWithCorners.symm I)) (↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I) (↑I x)

Next tactic:
apply differentiableWithinAt_inter
/-- Being differentiable in the model space is a local property, invariant under smooth maps.
Therefore, it will lift nicely to manifolds. -/
theorem differentiable_within_at_localInvariantProp :
    (contDiffGroupoid ⊤ I).LocalInvariantProp (contDiffGroupoid ⊤ I')
      (DifferentiableWithinAtProp I I') :=
  { is_local := by
      intro s x u f u_open xu
      have : I.symm ⁻¹' (s ∩ u) ∩ Set.range I = I.symm ⁻¹' s ∩ Set.range I ∩ I.symm ⁻¹' u := by
        simp only [Set.inter_right_comm, Set.preimage_inter]
      rw [DifferentiableWithinAtProp, DifferentiableWithinAtProp, this]
      symm
      apply differentiableWithinAt_inter
      

Proof state:
case ht
𝕜 : 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
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'
s : Set H
x : H
u : Set H
f : H → H'
u_open : IsOpen u
xu : x ∈ u
this :
  ↑(ModelWithCorners.symm I) ⁻¹' (s ∩ u) ∩ range ↑I =
    ↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I ∩ ↑(ModelWithCorners.symm I) ⁻¹' u
⊢ ↑(ModelWithCorners.symm I) ⁻¹' u ∈ 𝓝 (↑I x)

Next tactic:
have : u ∈ 𝓝 (I.symm (I x)) := by
        rw [ModelWithCorners.left_inv]
        exact IsOpen.mem_nhds u_open xu
/-- Being differentiable in the model space is a local property, invariant under smooth maps.
Therefore, it will lift nicely to manifolds. -/
theorem differentiable_within_at_localInvariantProp :
    (contDiffGroupoid ⊤ I).LocalInvariantProp (contDiffGroupoid ⊤ I')
      (DifferentiableWithinAtProp I I') :=
  { is_local := by
      intro s x u f u_open xu
      have : I.symm ⁻¹' (s ∩ u) ∩ Set.range I = I.symm ⁻¹' s ∩ Set.range I ∩ I.symm ⁻¹' u := by
        simp only [Set.inter_right_comm, Set.preimage_inter]
      rw [DifferentiableWithinAtProp, DifferentiableWithinAtProp, this]
      symm
      apply differentiableWithinAt_inter
      have : u ∈ 𝓝 (I.symm (I x)) := by
        

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
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'
s : Set H
x : H
u : Set H
f : H → H'
u_open : IsOpen u
xu : x ∈ u
this :
  ↑(ModelWithCorners.symm I) ⁻¹' (s ∩ u) ∩ range ↑I =
    ↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I ∩ ↑(ModelWithCorners.symm I) ⁻¹' u
⊢ u ∈ 𝓝 (↑(ModelWithCorners.symm I) (↑I x))

Next tactic:
rw [ModelWithCorners.left_inv]
/-- Being differentiable in the model space is a local property, invariant under smooth maps.
Therefore, it will lift nicely to manifolds. -/
theorem differentiable_within_at_localInvariantProp :
    (contDiffGroupoid ⊤ I).LocalInvariantProp (contDiffGroupoid ⊤ I')
      (DifferentiableWithinAtProp I I') :=
  { is_local := by
      intro s x u f u_open xu
      have : I.symm ⁻¹' (s ∩ u) ∩ Set.range I = I.symm ⁻¹' s ∩ Set.range I ∩ I.symm ⁻¹' u := by
        simp only [Set.inter_right_comm, Set.preimage_inter]
      rw [DifferentiableWithinAtProp, DifferentiableWithinAtProp, this]
      symm
      apply differentiableWithinAt_inter
      have : u ∈ 𝓝 (I.symm (I x)) := by
        rw [ModelWithCorners.left_inv]
        

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
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'
s : Set H
x : H
u : Set H
f : H → H'
u_open : IsOpen u
xu : x ∈ u
this :
  ↑(ModelWithCorners.symm I) ⁻¹' (s ∩ u) ∩ range ↑I =
    ↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I ∩ ↑(ModelWithCorners.symm I) ⁻¹' u
⊢ u ∈ 𝓝 x

Next tactic:
exact IsOpen.mem_nhds u_open xu
/-- Being differentiable in the model space is a local property, invariant under smooth maps.
Therefore, it will lift nicely to manifolds. -/
theorem differentiable_within_at_localInvariantProp :
    (contDiffGroupoid ⊤ I).LocalInvariantProp (contDiffGroupoid ⊤ I')
      (DifferentiableWithinAtProp I I') :=
  { is_local := by
      intro s x u f u_open xu
      have : I.symm ⁻¹' (s ∩ u) ∩ Set.range I = I.symm ⁻¹' s ∩ Set.range I ∩ I.symm ⁻¹' u := by
        simp only [Set.inter_right_comm, Set.preimage_inter]
      rw [DifferentiableWithinAtProp, DifferentiableWithinAtProp, this]
      symm
      apply differentiableWithinAt_inter
      have : u ∈ 𝓝 (I.symm (I x)) := by
        rw [ModelWithCorners.left_inv]
        exact IsOpen.mem_nhds u_open xu
      

Proof state:
case ht
𝕜 : 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
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'
s : Set H
x : H
u : Set H
f : H → H'
u_open : IsOpen u
xu : x ∈ u
this✝ :
  ↑(ModelWithCorners.symm I) ⁻¹' (s ∩ u) ∩ range ↑I =
    ↑(ModelWithCorners.symm I) ⁻¹' s ∩ range ↑I ∩ ↑(ModelWithCorners.symm I) ⁻¹' u
this : u ∈ 𝓝 (↑(ModelWithCorners.symm I) (↑I x))
⊢ ↑(ModelWithCorners.symm I) ⁻¹' u ∈ 𝓝 (↑I x)

Next tactic:
apply I.continuous_symm.continuousAt this