l3lab/ntp-mathlib huggingface dataset:
theorem isLocalStructomorphOn_contDiffGroupoid_iff_aux {f : PartialHomeomorph M M'}
    (hf : LiftPropOn (contDiffGroupoid ⊤ I).IsLocalStructomorphWithinAt f f.source) :
    SmoothOn I I f f.source := by
  -- It suffices to show smoothness near each `x`
  apply contMDiffOn_of_locally_contMDiffOn
  intro x hx
  let c := chartAt H x
  let c' := chartAt H (f x)
  obtain ⟨-, hxf⟩ := hf x hx
  -- Since `f` is a local structomorph, it is locally equal to some transferred element `e` of
  -- the `contDiffGroupoid`.
  obtain
    ⟨e, he, he' : EqOn (c' ∘ f ∘ c.symm) e (c.symm ⁻¹' f.source ∩ e.source), hex :
      c x ∈ e.source⟩ :=
    hxf (by simp only [hx, mfld_simps])
  -- We choose a convenient set `s` in `M`.
  let s : Set M := (f.trans c').source ∩ ((c.trans e).trans c'.symm).source
  refine' ⟨s, (f.trans c').open_source.inter ((c.trans e).trans c'.symm).open_source, _, _⟩
  · simp only [mfld_simps]
    rw [← he'] <;> simp only [hx, hex, mfld_simps]
  -- We need to show `f` is `ContMDiffOn` the domain `s ∩ f.source`.  We show this in two
  -- steps: `f` is equal to `c'.symm ∘ e ∘ c` on that domain and that function is
  -- `ContMDiffOn` it.
  have H₁ : ContMDiffOn I I ⊤ (c'.symm ∘ e ∘ c) s := by
    have hc' : ContMDiffOn I I ⊤ c'.symm _ := contMDiffOn_chart_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
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✝ : PartialHomeomorph M H
x✝ : M
m n : ℕ∞
inst✝ : ChartedSpace H M'
IsM' : SmoothManifoldWithCorners I M'
f : PartialHomeomorph M M'
hf : LiftPropOn (StructureGroupoid.IsLocalStructomorphWithinAt (contDiffGroupoid ⊤ I)) (↑f) f.source
x : M
hx : x ∈ f.source
c : PartialHomeomorph M H := chartAt H x
c' : PartialHomeomorph M' H := chartAt H (↑f x)
hxf :
  StructureGroupoid.IsLocalStructomorphWithinAt (contDiffGroupoid ⊤ I)
    (↑(chartAt H (↑f x)) ∘ ↑f ∘ ↑(PartialHomeomorph.symm (chartAt H x)))
    (↑(PartialHomeomorph.symm (chartAt H x)) ⁻¹' f.source) (↑(chartAt H x) x)
e : PartialHomeomorph H H
he : e ∈ contDiffGroupoid ⊤ I
he' : EqOn (↑c' ∘ ↑f ∘ ↑(PartialHomeomorph.symm c)) (↑e) (↑(PartialHomeomorph.symm c) ⁻¹' f.source ∩ e.source)
hex : ↑c x ∈ e.source
s : Set M := (f ≫ₕ c').toPartialEquiv.source ∩ ((c ≫ₕ e) ≫ₕ PartialHomeomorph.symm c').toPartialEquiv.source
hc' : ContMDiffOn I I ⊤ (↑(PartialHomeomorph.symm c')) (chartAt H (↑f x)).toPartialEquiv.target
⊢ ContMDiffOn I I ⊤ (↑(PartialHomeomorph.symm c') ∘ ↑e ∘ ↑c) s

Next tactic:
have he'' : ContMDiffOn I I ⊤ e _ := contMDiffOn_of_mem_contDiffGroupoid he
theorem isLocalStructomorphOn_contDiffGroupoid_iff_aux {f : PartialHomeomorph M M'}
    (hf : LiftPropOn (contDiffGroupoid ⊤ I).IsLocalStructomorphWithinAt f f.source) :
    SmoothOn I I f f.source := by
  -- It suffices to show smoothness near each `x`
  apply contMDiffOn_of_locally_contMDiffOn
  intro x hx
  let c := chartAt H x
  let c' := chartAt H (f x)
  obtain ⟨-, hxf⟩ := hf x hx
  -- Since `f` is a local structomorph, it is locally equal to some transferred element `e` of
  -- the `contDiffGroupoid`.
  obtain
    ⟨e, he, he' : EqOn (c' ∘ f ∘ c.symm) e (c.symm ⁻¹' f.source ∩ e.source), hex :
      c x ∈ e.source⟩ :=
    hxf (by simp only [hx, mfld_simps])
  -- We choose a convenient set `s` in `M`.
  let s : Set M := (f.trans c').source ∩ ((c.trans e).trans c'.symm).source
  refine' ⟨s, (f.trans c').open_source.inter ((c.trans e).trans c'.symm).open_source, _, _⟩
  · simp only [mfld_simps]
    rw [← he'] <;> simp only [hx, hex, mfld_simps]
  -- We need to show `f` is `ContMDiffOn` the domain `s ∩ f.source`.  We show this in two
  -- steps: `f` is equal to `c'.symm ∘ e ∘ c` on that domain and that function is
  -- `ContMDiffOn` it.
  have H₁ : ContMDiffOn I I ⊤ (c'.symm ∘ e ∘ c) s := by
    have hc' : ContMDiffOn I I ⊤ c'.symm _ := contMDiffOn_chart_symm
    have he'' : ContMDiffOn I I ⊤ e _ := contMDiffOn_of_mem_contDiffGroupoid he
    

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✝ : PartialHomeomorph M H
x✝ : M
m n : ℕ∞
inst✝ : ChartedSpace H M'
IsM' : SmoothManifoldWithCorners I M'
f : PartialHomeomorph M M'
hf : LiftPropOn (StructureGroupoid.IsLocalStructomorphWithinAt (contDiffGroupoid ⊤ I)) (↑f) f.source
x : M
hx : x ∈ f.source
c : PartialHomeomorph M H := chartAt H x
c' : PartialHomeomorph M' H := chartAt H (↑f x)
hxf :
  StructureGroupoid.IsLocalStructomorphWithinAt (contDiffGroupoid ⊤ I)
    (↑(chartAt H (↑f x)) ∘ ↑f ∘ ↑(PartialHomeomorph.symm (chartAt H x)))
    (↑(PartialHomeomorph.symm (chartAt H x)) ⁻¹' f.source) (↑(chartAt H x) x)
e : PartialHomeomorph H H
he : e ∈ contDiffGroupoid ⊤ I
he' : EqOn (↑c' ∘ ↑f ∘ ↑(PartialHomeomorph.symm c)) (↑e) (↑(PartialHomeomorph.symm c) ⁻¹' f.source ∩ e.source)
hex : ↑c x ∈ e.source
s : Set M := (f ≫ₕ c').toPartialEquiv.source ∩ ((c ≫ₕ e) ≫ₕ PartialHomeomorph.symm c').toPartialEquiv.source
hc' : ContMDiffOn I I ⊤ (↑(PartialHomeomorph.symm c')) (chartAt H (↑f x)).toPartialEquiv.target
he'' : ContMDiffOn I I ⊤ (↑e) e.source
⊢ ContMDiffOn I I ⊤ (↑(PartialHomeomorph.symm c') ∘ ↑e ∘ ↑c) s

Next tactic:
have hc : ContMDiffOn I I ⊤ c _ := contMDiffOn_chart
theorem isLocalStructomorphOn_contDiffGroupoid_iff_aux {f : PartialHomeomorph M M'}
    (hf : LiftPropOn (contDiffGroupoid ⊤ I).IsLocalStructomorphWithinAt f f.source) :
    SmoothOn I I f f.source := by
  -- It suffices to show smoothness near each `x`
  apply contMDiffOn_of_locally_contMDiffOn
  intro x hx
  let c := chartAt H x
  let c' := chartAt H (f x)
  obtain ⟨-, hxf⟩ := hf x hx
  -- Since `f` is a local structomorph, it is locally equal to some transferred element `e` of
  -- the `contDiffGroupoid`.
  obtain
    ⟨e, he, he' : EqOn (c' ∘ f ∘ c.symm) e (c.symm ⁻¹' f.source ∩ e.source), hex :
      c x ∈ e.source⟩ :=
    hxf (by simp only [hx, mfld_simps])
  -- We choose a convenient set `s` in `M`.
  let s : Set M := (f.trans c').source ∩ ((c.trans e).trans c'.symm).source
  refine' ⟨s, (f.trans c').open_source.inter ((c.trans e).trans c'.symm).open_source, _, _⟩
  · simp only [mfld_simps]
    rw [← he'] <;> simp only [hx, hex, mfld_simps]
  -- We need to show `f` is `ContMDiffOn` the domain `s ∩ f.source`.  We show this in two
  -- steps: `f` is equal to `c'.symm ∘ e ∘ c` on that domain and that function is
  -- `ContMDiffOn` it.
  have H₁ : ContMDiffOn I I ⊤ (c'.symm ∘ e ∘ c) s := by
    have hc' : ContMDiffOn I I ⊤ c'.symm _ := contMDiffOn_chart_symm
    have he'' : ContMDiffOn I I ⊤ e _ := contMDiffOn_of_mem_contDiffGroupoid he
    have hc : ContMDiffOn I I ⊤ c _ := contMDiffOn_chart
    

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✝ : PartialHomeomorph M H
x✝ : M
m n : ℕ∞
inst✝ : ChartedSpace H M'
IsM' : SmoothManifoldWithCorners I M'
f : PartialHomeomorph M M'
hf : LiftPropOn (StructureGroupoid.IsLocalStructomorphWithinAt (contDiffGroupoid ⊤ I)) (↑f) f.source
x : M
hx : x ∈ f.source
c : PartialHomeomorph M H := chartAt H x
c' : PartialHomeomorph M' H := chartAt H (↑f x)
hxf :
  StructureGroupoid.IsLocalStructomorphWithinAt (contDiffGroupoid ⊤ I)
    (↑(chartAt H (↑f x)) ∘ ↑f ∘ ↑(PartialHomeomorph.symm (chartAt H x)))
    (↑(PartialHomeomorph.symm (chartAt H x)) ⁻¹' f.source) (↑(chartAt H x) x)
e : PartialHomeomorph H H
he : e ∈ contDiffGroupoid ⊤ I
he' : EqOn (↑c' ∘ ↑f ∘ ↑(PartialHomeomorph.symm c)) (↑e) (↑(PartialHomeomorph.symm c) ⁻¹' f.source ∩ e.source)
hex : ↑c x ∈ e.source
s : Set M := (f ≫ₕ c').toPartialEquiv.source ∩ ((c ≫ₕ e) ≫ₕ PartialHomeomorph.symm c').toPartialEquiv.source
hc' : ContMDiffOn I I ⊤ (↑(PartialHomeomorph.symm c')) (chartAt H (↑f x)).toPartialEquiv.target
he'' : ContMDiffOn I I ⊤ (↑e) e.source
hc : ContMDiffOn I I ⊤ (↑c) (chartAt H x).toPartialEquiv.source
⊢ ContMDiffOn I I ⊤ (↑(PartialHomeomorph.symm c') ∘ ↑e ∘ ↑c) s

Next tactic:
refine' (hc'.comp' (he''.comp' hc)).mono _
theorem isLocalStructomorphOn_contDiffGroupoid_iff_aux {f : PartialHomeomorph M M'}
    (hf : LiftPropOn (contDiffGroupoid ⊤ I).IsLocalStructomorphWithinAt f f.source) :
    SmoothOn I I f f.source := by
  -- It suffices to show smoothness near each `x`
  apply contMDiffOn_of_locally_contMDiffOn
  intro x hx
  let c := chartAt H x
  let c' := chartAt H (f x)
  obtain ⟨-, hxf⟩ := hf x hx
  -- Since `f` is a local structomorph, it is locally equal to some transferred element `e` of
  -- the `contDiffGroupoid`.
  obtain
    ⟨e, he, he' : EqOn (c' ∘ f ∘ c.symm) e (c.symm ⁻¹' f.source ∩ e.source), hex :
      c x ∈ e.source⟩ :=
    hxf (by simp only [hx, mfld_simps])
  -- We choose a convenient set `s` in `M`.
  let s : Set M := (f.trans c').source ∩ ((c.trans e).trans c'.symm).source
  refine' ⟨s, (f.trans c').open_source.inter ((c.trans e).trans c'.symm).open_source, _, _⟩
  · simp only [mfld_simps]
    rw [← he'] <;> simp only [hx, hex, mfld_simps]
  -- We need to show `f` is `ContMDiffOn` the domain `s ∩ f.source`.  We show this in two
  -- steps: `f` is equal to `c'.symm ∘ e ∘ c` on that domain and that function is
  -- `ContMDiffOn` it.
  have H₁ : ContMDiffOn I I ⊤ (c'.symm ∘ e ∘ c) s := by
    have hc' : ContMDiffOn I I ⊤ c'.symm _ := contMDiffOn_chart_symm
    have he'' : ContMDiffOn I I ⊤ e _ := contMDiffOn_of_mem_contDiffGroupoid he
    have hc : ContMDiffOn I I ⊤ c _ := contMDiffOn_chart
    refine' (hc'.comp' (he''.comp' hc)).mono _
    mfld_set_tac
  have H₂ : EqOn f (c'.symm ∘ e ∘ c) s := 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
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✝ : PartialHomeomorph M H
x✝ : M
m n : ℕ∞
inst✝ : ChartedSpace H M'
IsM' : SmoothManifoldWithCorners I M'
f : PartialHomeomorph M M'
hf : LiftPropOn (StructureGroupoid.IsLocalStructomorphWithinAt (contDiffGroupoid ⊤ I)) (↑f) f.source
x : M
hx : x ∈ f.source
c : PartialHomeomorph M H := chartAt H x
c' : PartialHomeomorph M' H := chartAt H (↑f x)
hxf :
  StructureGroupoid.IsLocalStructomorphWithinAt (contDiffGroupoid ⊤ I)
    (↑(chartAt H (↑f x)) ∘ ↑f ∘ ↑(PartialHomeomorph.symm (chartAt H x)))
    (↑(PartialHomeomorph.symm (chartAt H x)) ⁻¹' f.source) (↑(chartAt H x) x)
e : PartialHomeomorph H H
he : e ∈ contDiffGroupoid ⊤ I
he' : EqOn (↑c' ∘ ↑f ∘ ↑(PartialHomeomorph.symm c)) (↑e) (↑(PartialHomeomorph.symm c) ⁻¹' f.source ∩ e.source)
hex : ↑c x ∈ e.source
s : Set M := (f ≫ₕ c').toPartialEquiv.source ∩ ((c ≫ₕ e) ≫ₕ PartialHomeomorph.symm c').toPartialEquiv.source
H₁ : ContMDiffOn I I ⊤ (↑(PartialHomeomorph.symm c') ∘ ↑e ∘ ↑c) s
⊢ EqOn (↑f) (↑(PartialHomeomorph.symm c') ∘ ↑e ∘ ↑c) s

Next tactic:
intro y hy
theorem isLocalStructomorphOn_contDiffGroupoid_iff_aux {f : PartialHomeomorph M M'}
    (hf : LiftPropOn (contDiffGroupoid ⊤ I).IsLocalStructomorphWithinAt f f.source) :
    SmoothOn I I f f.source := by
  -- It suffices to show smoothness near each `x`
  apply contMDiffOn_of_locally_contMDiffOn
  intro x hx
  let c := chartAt H x
  let c' := chartAt H (f x)
  obtain ⟨-, hxf⟩ := hf x hx
  -- Since `f` is a local structomorph, it is locally equal to some transferred element `e` of
  -- the `contDiffGroupoid`.
  obtain
    ⟨e, he, he' : EqOn (c' ∘ f ∘ c.symm) e (c.symm ⁻¹' f.source ∩ e.source), hex :
      c x ∈ e.source⟩ :=
    hxf (by simp only [hx, mfld_simps])
  -- We choose a convenient set `s` in `M`.
  let s : Set M := (f.trans c').source ∩ ((c.trans e).trans c'.symm).source
  refine' ⟨s, (f.trans c').open_source.inter ((c.trans e).trans c'.symm).open_source, _, _⟩
  · simp only [mfld_simps]
    rw [← he'] <;> simp only [hx, hex, mfld_simps]
  -- We need to show `f` is `ContMDiffOn` the domain `s ∩ f.source`.  We show this in two
  -- steps: `f` is equal to `c'.symm ∘ e ∘ c` on that domain and that function is
  -- `ContMDiffOn` it.
  have H₁ : ContMDiffOn I I ⊤ (c'.symm ∘ e ∘ c) s := by
    have hc' : ContMDiffOn I I ⊤ c'.symm _ := contMDiffOn_chart_symm
    have he'' : ContMDiffOn I I ⊤ e _ := contMDiffOn_of_mem_contDiffGroupoid he
    have hc : ContMDiffOn I I ⊤ c _ := contMDiffOn_chart
    refine' (hc'.comp' (he''.comp' hc)).mono _
    mfld_set_tac
  have H₂ : EqOn f (c'.symm ∘ e ∘ c) s := by
    intro y hy
    

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✝ : PartialHomeomorph M H
x✝ : M
m n : ℕ∞
inst✝ : ChartedSpace H M'
IsM' : SmoothManifoldWithCorners I M'
f : PartialHomeomorph M M'
hf : LiftPropOn (StructureGroupoid.IsLocalStructomorphWithinAt (contDiffGroupoid ⊤ I)) (↑f) f.source
x : M
hx : x ∈ f.source
c : PartialHomeomorph M H := chartAt H x
c' : PartialHomeomorph M' H := chartAt H (↑f x)
hxf :
  StructureGroupoid.IsLocalStructomorphWithinAt (contDiffGroupoid ⊤ I)
    (↑(chartAt H (↑f x)) ∘ ↑f ∘ ↑(PartialHomeomorph.symm (chartAt H x)))
    (↑(PartialHomeomorph.symm (chartAt H x)) ⁻¹' f.source) (↑(chartAt H x) x)
e : PartialHomeomorph H H
he : e ∈ contDiffGroupoid ⊤ I
he' : EqOn (↑c' ∘ ↑f ∘ ↑(PartialHomeomorph.symm c)) (↑e) (↑(PartialHomeomorph.symm c) ⁻¹' f.source ∩ e.source)
hex : ↑c x ∈ e.source
s : Set M := (f ≫ₕ c').toPartialEquiv.source ∩ ((c ≫ₕ e) ≫ₕ PartialHomeomorph.symm c').toPartialEquiv.source
H₁ : ContMDiffOn I I ⊤ (↑(PartialHomeomorph.symm c') ∘ ↑e ∘ ↑c) s
y : M
hy : y ∈ s
⊢ ↑f y = (↑(PartialHomeomorph.symm c') ∘ ↑e ∘ ↑c) y

Next tactic:
simp only [mfld_simps] at hy
/-- Let `M` and `M'` be smooth manifolds with the same model-with-corners, `I`.  Then `f : M → M'`
is a local structomorphism for `I`, if and only if it is manifold-smooth on the domain of definition
in both directions. -/
theorem isLocalStructomorphOn_contDiffGroupoid_iff (f : PartialHomeomorph M M') :
    LiftPropOn (contDiffGroupoid ⊤ I).IsLocalStructomorphWithinAt f f.source ↔
      SmoothOn I I f f.source ∧ SmoothOn I I f.symm f.target := 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
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 : PartialHomeomorph M H
x : M
m n : ℕ∞
inst✝ : ChartedSpace H M'
IsM' : SmoothManifoldWithCorners I M'
f : PartialHomeomorph M M'
⊢ LiftPropOn (StructureGroupoid.IsLocalStructomorphWithinAt (contDiffGroupoid ⊤ I)) (↑f) f.source ↔
    SmoothOn I I (↑f) f.source ∧ SmoothOn I I (↑(PartialHomeomorph.symm f)) f.target

Next tactic:
constructor
/-- Let `M` and `M'` be smooth manifolds with the same model-with-corners, `I`.  Then `f : M → M'`
is a local structomorphism for `I`, if and only if it is manifold-smooth on the domain of definition
in both directions. -/
theorem isLocalStructomorphOn_contDiffGroupoid_iff (f : PartialHomeomorph M M') :
    LiftPropOn (contDiffGroupoid ⊤ I).IsLocalStructomorphWithinAt f f.source ↔
      SmoothOn I I f f.source ∧ SmoothOn I I f.symm f.target := by
  constructor
  · 

Proof state:
case mp
𝕜 : 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 : PartialHomeomorph M H
x : M
m n : ℕ∞
inst✝ : ChartedSpace H M'
IsM' : SmoothManifoldWithCorners I M'
f : PartialHomeomorph M M'
⊢ LiftPropOn (StructureGroupoid.IsLocalStructomorphWithinAt (contDiffGroupoid ⊤ I)) (↑f) f.source →
    SmoothOn I I (↑f) f.source ∧ SmoothOn I I (↑(PartialHomeomorph.symm f)) f.target

Next tactic:
intro h
/-- Let `M` and `M'` be smooth manifolds with the same model-with-corners, `I`.  Then `f : M → M'`
is a local structomorphism for `I`, if and only if it is manifold-smooth on the domain of definition
in both directions. -/
theorem isLocalStructomorphOn_contDiffGroupoid_iff (f : PartialHomeomorph M M') :
    LiftPropOn (contDiffGroupoid ⊤ I).IsLocalStructomorphWithinAt f f.source ↔
      SmoothOn I I f f.source ∧ SmoothOn I I f.symm f.target := by
  constructor
  · intro h
    

Proof state:
case mp
𝕜 : 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 : PartialHomeomorph M H
x : M
m n : ℕ∞
inst✝ : ChartedSpace H M'
IsM' : SmoothManifoldWithCorners I M'
f : PartialHomeomorph M M'
h : LiftPropOn (StructureGroupoid.IsLocalStructomorphWithinAt (contDiffGroupoid ⊤ I)) (↑f) f.source
⊢ SmoothOn I I (↑f) f.source ∧ SmoothOn I I (↑(PartialHomeomorph.symm f)) f.target

Next tactic:
refine' ⟨isLocalStructomorphOn_contDiffGroupoid_iff_aux h,
      isLocalStructomorphOn_contDiffGroupoid_iff_aux _⟩
/-- Let `M` and `M'` be smooth manifolds with the same model-with-corners, `I`.  Then `f : M → M'`
is a local structomorphism for `I`, if and only if it is manifold-smooth on the domain of definition
in both directions. -/
theorem isLocalStructomorphOn_contDiffGroupoid_iff (f : PartialHomeomorph M M') :
    LiftPropOn (contDiffGroupoid ⊤ I).IsLocalStructomorphWithinAt f f.source ↔
      SmoothOn I I f f.source ∧ SmoothOn I I f.symm f.target := by
  constructor
  · intro h
    refine' ⟨isLocalStructomorphOn_contDiffGroupoid_iff_aux h,
      isLocalStructomorphOn_contDiffGroupoid_iff_aux _⟩
    -- todo: we can generalize this part of the proof to a lemma
    

Proof state:
case mp
𝕜 : 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 : PartialHomeomorph M H
x : M
m n : ℕ∞
inst✝ : ChartedSpace H M'
IsM' : SmoothManifoldWithCorners I M'
f : PartialHomeomorph M M'
h : LiftPropOn (StructureGroupoid.IsLocalStructomorphWithinAt (contDiffGroupoid ⊤ I)) (↑f) f.source
⊢ LiftPropOn (StructureGroupoid.IsLocalStructomorphWithinAt (contDiffGroupoid ⊤ I)) (↑(PartialHomeomorph.symm f))
    (PartialHomeomorph.symm f).toPartialEquiv.source

Next tactic:
intro X hX
/-- Let `M` and `M'` be smooth manifolds with the same model-with-corners, `I`.  Then `f : M → M'`
is a local structomorphism for `I`, if and only if it is manifold-smooth on the domain of definition
in both directions. -/
theorem isLocalStructomorphOn_contDiffGroupoid_iff (f : PartialHomeomorph M M') :
    LiftPropOn (contDiffGroupoid ⊤ I).IsLocalStructomorphWithinAt f f.source ↔
      SmoothOn I I f f.source ∧ SmoothOn I I f.symm f.target := by
  constructor
  · intro h
    refine' ⟨isLocalStructomorphOn_contDiffGroupoid_iff_aux h,
      isLocalStructomorphOn_contDiffGroupoid_iff_aux _⟩
    -- todo: we can generalize this part of the proof to a lemma
    intro X hX
    

Proof state:
case mp
𝕜 : 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 : PartialHomeomorph M H
x : M
m n : ℕ∞
inst✝ : ChartedSpace H M'
IsM' : SmoothManifoldWithCorners I M'
f : PartialHomeomorph M M'
h : LiftPropOn (StructureGroupoid.IsLocalStructomorphWithinAt (contDiffGroupoid ⊤ I)) (↑f) f.source
X : M'
hX : X ∈ (PartialHomeomorph.symm f).toPartialEquiv.source
⊢ LiftPropWithinAt (StructureGroupoid.IsLocalStructomorphWithinAt (contDiffGroupoid ⊤ I)) (↑(PartialHomeomorph.symm f))
    (PartialHomeomorph.symm f).toPartialEquiv.source X

Next tactic:
let x := f.symm X