l3lab/ntp-mathlib huggingface dataset:
@[to_additive]
theorem alternatingProd_eq_finset_prod {G : Type*} [CommGroup G] :
    ∀ (L : List G), alternatingProd L = ∏ i : Fin L.length, L.get i ^ (-1 : ℤ) ^ (i : ℕ)
  | [] => by
    rw [alternatingProd, Finset.prod_eq_one]
    rintro ⟨i, ⟨⟩⟩
  | g::[] => by
    show g = ∏ i : Fin 1, [g].get i ^ (-1 : ℤ) ^ (i : ℕ)
    rw [Fin.prod_univ_succ]; 

Proof state:
α : Type u_1
β : Type u_2
G : Type u_3
inst✝ : CommGroup G
g : G
⊢ g = get [g] 0 ^ (-1) ^ ↑0 * ∏ i : Fin 0, get [g] (Fin.succ i) ^ (-1) ^ ↑(Fin.succ i)

Next tactic:
simp
@[to_additive]
theorem alternatingProd_eq_finset_prod {G : Type*} [CommGroup G] :
    ∀ (L : List G), alternatingProd L = ∏ i : Fin L.length, L.get i ^ (-1 : ℤ) ^ (i : ℕ)
  | [] => by
    rw [alternatingProd, Finset.prod_eq_one]
    rintro ⟨i, ⟨⟩⟩
  | g::[] => by
    show g = ∏ i : Fin 1, [g].get i ^ (-1 : ℤ) ^ (i : ℕ)
    rw [Fin.prod_univ_succ]; simp
  | g::h::L =>
    calc g * h⁻¹ * L.alternatingProd
      = g * h⁻¹ * ∏ i : Fin L.length, L.get i ^ (-1 : ℤ) ^ (i : ℕ) :=
        congr_arg _ (alternatingProd_eq_finset_prod _)
    _ = ∏ i : Fin (L.length + 2), List.get (g::h::L) i ^ (-1 : ℤ) ^ (i : ℕ) := by
        

Proof state:
α : Type u_1
β : Type u_2
G : Type u_3
inst✝ : CommGroup G
g h : G
L : List G
⊢ g * h⁻¹ * ∏ i : Fin (length L), get L i ^ (-1) ^ ↑i = ∏ i : Fin (length L + 2), get (g :: h :: L) i ^ (-1) ^ ↑i

Next tactic:
{ rw [Fin.prod_univ_succ, Fin.prod_univ_succ, mul_assoc]
          simp [Nat.succ_eq_add_one, pow_add]}
@[to_additive]
theorem alternatingProd_eq_finset_prod {G : Type*} [CommGroup G] :
    ∀ (L : List G), alternatingProd L = ∏ i : Fin L.length, L.get i ^ (-1 : ℤ) ^ (i : ℕ)
  | [] => by
    rw [alternatingProd, Finset.prod_eq_one]
    rintro ⟨i, ⟨⟩⟩
  | g::[] => by
    show g = ∏ i : Fin 1, [g].get i ^ (-1 : ℤ) ^ (i : ℕ)
    rw [Fin.prod_univ_succ]; simp
  | g::h::L =>
    calc g * h⁻¹ * L.alternatingProd
      = g * h⁻¹ * ∏ i : Fin L.length, L.get i ^ (-1 : ℤ) ^ (i : ℕ) :=
        congr_arg _ (alternatingProd_eq_finset_prod _)
    _ = ∏ i : Fin (L.length + 2), List.get (g::h::L) i ^ (-1 : ℤ) ^ (i : ℕ) := by
        { 

Proof state:
α : Type u_1
β : Type u_2
G : Type u_3
inst✝ : CommGroup G
g h : G
L : List G
⊢ g * h⁻¹ * ∏ i : Fin (length L), get L i ^ (-1) ^ ↑i = ∏ i : Fin (length L + 2), get (g :: h :: L) i ^ (-1) ^ ↑i

Next tactic:
rw [Fin.prod_univ_succ, Fin.prod_univ_succ, mul_assoc]
@[to_additive]
theorem alternatingProd_eq_finset_prod {G : Type*} [CommGroup G] :
    ∀ (L : List G), alternatingProd L = ∏ i : Fin L.length, L.get i ^ (-1 : ℤ) ^ (i : ℕ)
  | [] => by
    rw [alternatingProd, Finset.prod_eq_one]
    rintro ⟨i, ⟨⟩⟩
  | g::[] => by
    show g = ∏ i : Fin 1, [g].get i ^ (-1 : ℤ) ^ (i : ℕ)
    rw [Fin.prod_univ_succ]; simp
  | g::h::L =>
    calc g * h⁻¹ * L.alternatingProd
      = g * h⁻¹ * ∏ i : Fin L.length, L.get i ^ (-1 : ℤ) ^ (i : ℕ) :=
        congr_arg _ (alternatingProd_eq_finset_prod _)
    _ = ∏ i : Fin (L.length + 2), List.get (g::h::L) i ^ (-1 : ℤ) ^ (i : ℕ) := by
        { rw [Fin.prod_univ_succ, Fin.prod_univ_succ, mul_assoc]
          

Proof state:
α : Type u_1
β : Type u_2
G : Type u_3
inst✝ : CommGroup G
g h : G
L : List G
⊢ g * (h⁻¹ * ∏ i : Fin (length L), get L i ^ (-1) ^ ↑i) =
    get (g :: h :: L) 0 ^ (-1) ^ ↑0 *
      (get (g :: h :: L) (Fin.succ 0) ^ (-1) ^ ↑(Fin.succ 0) *
        ∏ i : Fin (length L), get (g :: h :: L) (Fin.succ (Fin.succ i)) ^ (-1) ^ ↑(Fin.succ (Fin.succ i)))

Next tactic:
simp [Nat.succ_eq_add_one, pow_add]
theorem congr_set {s t : Set H} {x : H} {f : H → H'} (hu : s =ᶠ[𝓝 x] t) : P f s x ↔ P f t x := by
  

Proof state:
H : Type u_1
M : Type u_2
H' : Type u_3
M' : Type u_4
X : Type u_5
inst✝⁶ : TopologicalSpace H
inst✝⁵ : TopologicalSpace M
inst✝⁴ : ChartedSpace H M
inst✝³ : TopologicalSpace H'
inst✝² : TopologicalSpace M'
inst✝¹ : ChartedSpace H' M'
inst✝ : TopologicalSpace X
G : StructureGroupoid H
G' : StructureGroupoid H'
P : (H → H') → Set H → H → Prop
s✝ t✝ u : Set H
x✝ : H
hG : LocalInvariantProp G G' P
s t : Set H
x : H
f : H → H'
hu : s =ᶠ[𝓝 x] t
⊢ P f s x ↔ P f t x

Next tactic:
obtain ⟨o, host, ho, hxo⟩ := mem_nhds_iff.mp hu.mem_iff
theorem congr_set {s t : Set H} {x : H} {f : H → H'} (hu : s =ᶠ[𝓝 x] t) : P f s x ↔ P f t x := by
  obtain ⟨o, host, ho, hxo⟩ := mem_nhds_iff.mp hu.mem_iff
  

Proof state:
case intro.intro.intro
H : Type u_1
M : Type u_2
H' : Type u_3
M' : Type u_4
X : Type u_5
inst✝⁶ : TopologicalSpace H
inst✝⁵ : TopologicalSpace M
inst✝⁴ : ChartedSpace H M
inst✝³ : TopologicalSpace H'
inst✝² : TopologicalSpace M'
inst✝¹ : ChartedSpace H' M'
inst✝ : TopologicalSpace X
G : StructureGroupoid H
G' : StructureGroupoid H'
P : (H → H') → Set H → H → Prop
s✝ t✝ u : Set H
x✝ : H
hG : LocalInvariantProp G G' P
s t : Set H
x : H
f : H → H'
hu : s =ᶠ[𝓝 x] t
o : Set H
host : o ⊆ {x | (fun x => x ∈ s ↔ x ∈ t) x}
ho : IsOpen o
hxo : x ∈ o
⊢ P f s x ↔ P f t x

Next tactic:
simp_rw [subset_def, mem_setOf, ← and_congr_left_iff, ← mem_inter_iff, ← Set.ext_iff] at host
theorem congr_set {s t : Set H} {x : H} {f : H → H'} (hu : s =ᶠ[𝓝 x] t) : P f s x ↔ P f t x := by
  obtain ⟨o, host, ho, hxo⟩ := mem_nhds_iff.mp hu.mem_iff
  simp_rw [subset_def, mem_setOf, ← and_congr_left_iff, ← mem_inter_iff, ← Set.ext_iff] at host
  

Proof state:
case intro.intro.intro
H : Type u_1
M : Type u_2
H' : Type u_3
M' : Type u_4
X : Type u_5
inst✝⁶ : TopologicalSpace H
inst✝⁵ : TopologicalSpace M
inst✝⁴ : ChartedSpace H M
inst✝³ : TopologicalSpace H'
inst✝² : TopologicalSpace M'
inst✝¹ : ChartedSpace H' M'
inst✝ : TopologicalSpace X
G : StructureGroupoid H
G' : StructureGroupoid H'
P : (H → H') → Set H → H → Prop
s✝ t✝ u : Set H
x✝ : H
hG : LocalInvariantProp G G' P
s t : Set H
x : H
f : H → H'
hu : s =ᶠ[𝓝 x] t
o : Set H
ho : IsOpen o
hxo : x ∈ o
host : s ∩ o = t ∩ o
⊢ P f s x ↔ P f t x

Next tactic:
rw [hG.is_local ho hxo, host, ← hG.is_local ho hxo]
theorem congr_iff_nhdsWithin {s : Set H} {x : H} {f g : H → H'} (h1 : f =ᶠ[𝓝[s] x] g)
    (h2 : f x = g x) : P f s x ↔ P g s x := by
  

Proof state:
H : Type u_1
M : Type u_2
H' : Type u_3
M' : Type u_4
X : Type u_5
inst✝⁶ : TopologicalSpace H
inst✝⁵ : TopologicalSpace M
inst✝⁴ : ChartedSpace H M
inst✝³ : TopologicalSpace H'
inst✝² : TopologicalSpace M'
inst✝¹ : ChartedSpace H' M'
inst✝ : TopologicalSpace X
G : StructureGroupoid H
G' : StructureGroupoid H'
P : (H → H') → Set H → H → Prop
s✝ t u : Set H
x✝ : H
hG : LocalInvariantProp G G' P
s : Set H
x : H
f g : H → H'
h1 : f =ᶠ[𝓝[s] x] g
h2 : f x = g x
⊢ P f s x ↔ P g s x

Next tactic:
simp_rw [hG.is_local_nhds h1]
theorem congr_iff_nhdsWithin {s : Set H} {x : H} {f g : H → H'} (h1 : f =ᶠ[𝓝[s] x] g)
    (h2 : f x = g x) : P f s x ↔ P g s x := by
  simp_rw [hG.is_local_nhds h1]
  

Proof state:
H : Type u_1
M : Type u_2
H' : Type u_3
M' : Type u_4
X : Type u_5
inst✝⁶ : TopologicalSpace H
inst✝⁵ : TopologicalSpace M
inst✝⁴ : ChartedSpace H M
inst✝³ : TopologicalSpace H'
inst✝² : TopologicalSpace M'
inst✝¹ : ChartedSpace H' M'
inst✝ : TopologicalSpace X
G : StructureGroupoid H
G' : StructureGroupoid H'
P : (H → H') → Set H → H → Prop
s✝ t u : Set H
x✝ : H
hG : LocalInvariantProp G G' P
s : Set H
x : H
f g : H → H'
h1 : f =ᶠ[𝓝[s] x] g
h2 : f x = g x
⊢ P f (s ∩ {x | f x = g x}) x ↔ P g (s ∩ {x | f x = g x}) x

Next tactic:
exact ⟨hG.congr_of_forall (fun y hy ↦ hy.2) h2, hG.congr_of_forall (fun y hy ↦ hy.2.symm) h2.symm⟩
theorem left_invariance {s : Set H} {x : H} {f : H → H'} {e' : PartialHomeomorph H' H'}
    (he' : e' ∈ G') (hfs : ContinuousWithinAt f s x) (hxe' : f x ∈ e'.source) :
    P (e' ∘ f) s x ↔ P f s x := by
  

Proof state:
H : Type u_1
M : Type u_2
H' : Type u_3
M' : Type u_4
X : Type u_5
inst✝⁶ : TopologicalSpace H
inst✝⁵ : TopologicalSpace M
inst✝⁴ : ChartedSpace H M
inst✝³ : TopologicalSpace H'
inst✝² : TopologicalSpace M'
inst✝¹ : ChartedSpace H' M'
inst✝ : TopologicalSpace X
G : StructureGroupoid H
G' : StructureGroupoid H'
P : (H → H') → Set H → H → Prop
s✝ t u : Set H
x✝ : H
hG : LocalInvariantProp G G' P
s : Set H
x : H
f : H → H'
e' : PartialHomeomorph H' H'
he' : e' ∈ G'
hfs : ContinuousWithinAt f s x
hxe' : f x ∈ e'.source
⊢ P (↑e' ∘ f) s x ↔ P f s x

Next tactic:
have h2f := hfs.preimage_mem_nhdsWithin (e'.open_source.mem_nhds hxe')
theorem left_invariance {s : Set H} {x : H} {f : H → H'} {e' : PartialHomeomorph H' H'}
    (he' : e' ∈ G') (hfs : ContinuousWithinAt f s x) (hxe' : f x ∈ e'.source) :
    P (e' ∘ f) s x ↔ P f s x := by
  have h2f := hfs.preimage_mem_nhdsWithin (e'.open_source.mem_nhds hxe')
  

Proof state:
H : Type u_1
M : Type u_2
H' : Type u_3
M' : Type u_4
X : Type u_5
inst✝⁶ : TopologicalSpace H
inst✝⁵ : TopologicalSpace M
inst✝⁴ : ChartedSpace H M
inst✝³ : TopologicalSpace H'
inst✝² : TopologicalSpace M'
inst✝¹ : ChartedSpace H' M'
inst✝ : TopologicalSpace X
G : StructureGroupoid H
G' : StructureGroupoid H'
P : (H → H') → Set H → H → Prop
s✝ t u : Set H
x✝ : H
hG : LocalInvariantProp G G' P
s : Set H
x : H
f : H → H'
e' : PartialHomeomorph H' H'
he' : e' ∈ G'
hfs : ContinuousWithinAt f s x
hxe' : f x ∈ e'.source
h2f : f ⁻¹' e'.source ∈ 𝓝[s] x
⊢ P (↑e' ∘ f) s x ↔ P f s x

Next tactic:
have h3f :=
    ((e'.continuousAt hxe').comp_continuousWithinAt hfs).preimage_mem_nhdsWithin <|
      e'.symm.open_source.mem_nhds <| e'.mapsTo hxe'
theorem left_invariance {s : Set H} {x : H} {f : H → H'} {e' : PartialHomeomorph H' H'}
    (he' : e' ∈ G') (hfs : ContinuousWithinAt f s x) (hxe' : f x ∈ e'.source) :
    P (e' ∘ f) s x ↔ P f s x := by
  have h2f := hfs.preimage_mem_nhdsWithin (e'.open_source.mem_nhds hxe')
  have h3f :=
    ((e'.continuousAt hxe').comp_continuousWithinAt hfs).preimage_mem_nhdsWithin <|
      e'.symm.open_source.mem_nhds <| e'.mapsTo hxe'
  

Proof state:
H : Type u_1
M : Type u_2
H' : Type u_3
M' : Type u_4
X : Type u_5
inst✝⁶ : TopologicalSpace H
inst✝⁵ : TopologicalSpace M
inst✝⁴ : ChartedSpace H M
inst✝³ : TopologicalSpace H'
inst✝² : TopologicalSpace M'
inst✝¹ : ChartedSpace H' M'
inst✝ : TopologicalSpace X
G : StructureGroupoid H
G' : StructureGroupoid H'
P : (H → H') → Set H → H → Prop
s✝ t u : Set H
x✝ : H
hG : LocalInvariantProp G G' P
s : Set H
x : H
f : H → H'
e' : PartialHomeomorph H' H'
he' : e' ∈ G'
hfs : ContinuousWithinAt f s x
hxe' : f x ∈ e'.source
h2f : f ⁻¹' e'.source ∈ 𝓝[s] x
h3f : ↑e' ∘ f ⁻¹' (PartialHomeomorph.symm e').toPartialEquiv.source ∈ 𝓝[s] x
⊢ P (↑e' ∘ f) s x ↔ P f s x

Next tactic:
constructor
theorem left_invariance {s : Set H} {x : H} {f : H → H'} {e' : PartialHomeomorph H' H'}
    (he' : e' ∈ G') (hfs : ContinuousWithinAt f s x) (hxe' : f x ∈ e'.source) :
    P (e' ∘ f) s x ↔ P f s x := by
  have h2f := hfs.preimage_mem_nhdsWithin (e'.open_source.mem_nhds hxe')
  have h3f :=
    ((e'.continuousAt hxe').comp_continuousWithinAt hfs).preimage_mem_nhdsWithin <|
      e'.symm.open_source.mem_nhds <| e'.mapsTo hxe'
  constructor
  · 

Proof state:
case mp
H : Type u_1
M : Type u_2
H' : Type u_3
M' : Type u_4
X : Type u_5
inst✝⁶ : TopologicalSpace H
inst✝⁵ : TopologicalSpace M
inst✝⁴ : ChartedSpace H M
inst✝³ : TopologicalSpace H'
inst✝² : TopologicalSpace M'
inst✝¹ : ChartedSpace H' M'
inst✝ : TopologicalSpace X
G : StructureGroupoid H
G' : StructureGroupoid H'
P : (H → H') → Set H → H → Prop
s✝ t u : Set H
x✝ : H
hG : LocalInvariantProp G G' P
s : Set H
x : H
f : H → H'
e' : PartialHomeomorph H' H'
he' : e' ∈ G'
hfs : ContinuousWithinAt f s x
hxe' : f x ∈ e'.source
h2f : f ⁻¹' e'.source ∈ 𝓝[s] x
h3f : ↑e' ∘ f ⁻¹' (PartialHomeomorph.symm e').toPartialEquiv.source ∈ 𝓝[s] x
⊢ P (↑e' ∘ f) s x → P f s x

Next tactic:
intro h
theorem left_invariance {s : Set H} {x : H} {f : H → H'} {e' : PartialHomeomorph H' H'}
    (he' : e' ∈ G') (hfs : ContinuousWithinAt f s x) (hxe' : f x ∈ e'.source) :
    P (e' ∘ f) s x ↔ P f s x := by
  have h2f := hfs.preimage_mem_nhdsWithin (e'.open_source.mem_nhds hxe')
  have h3f :=
    ((e'.continuousAt hxe').comp_continuousWithinAt hfs).preimage_mem_nhdsWithin <|
      e'.symm.open_source.mem_nhds <| e'.mapsTo hxe'
  constructor
  · intro h
    

Proof state:
case mp
H : Type u_1
M : Type u_2
H' : Type u_3
M' : Type u_4
X : Type u_5
inst✝⁶ : TopologicalSpace H
inst✝⁵ : TopologicalSpace M
inst✝⁴ : ChartedSpace H M
inst✝³ : TopologicalSpace H'
inst✝² : TopologicalSpace M'
inst✝¹ : ChartedSpace H' M'
inst✝ : TopologicalSpace X
G : StructureGroupoid H
G' : StructureGroupoid H'
P : (H → H') → Set H → H → Prop
s✝ t u : Set H
x✝ : H
hG : LocalInvariantProp G G' P
s : Set H
x : H
f : H → H'
e' : PartialHomeomorph H' H'
he' : e' ∈ G'
hfs : ContinuousWithinAt f s x
hxe' : f x ∈ e'.source
h2f : f ⁻¹' e'.source ∈ 𝓝[s] x
h3f : ↑e' ∘ f ⁻¹' (PartialHomeomorph.symm e').toPartialEquiv.source ∈ 𝓝[s] x
h : P (↑e' ∘ f) s x
⊢ P f s x

Next tactic:
rw [hG.is_local_nhds h3f] at h
theorem left_invariance {s : Set H} {x : H} {f : H → H'} {e' : PartialHomeomorph H' H'}
    (he' : e' ∈ G') (hfs : ContinuousWithinAt f s x) (hxe' : f x ∈ e'.source) :
    P (e' ∘ f) s x ↔ P f s x := by
  have h2f := hfs.preimage_mem_nhdsWithin (e'.open_source.mem_nhds hxe')
  have h3f :=
    ((e'.continuousAt hxe').comp_continuousWithinAt hfs).preimage_mem_nhdsWithin <|
      e'.symm.open_source.mem_nhds <| e'.mapsTo hxe'
  constructor
  · intro h
    rw [hG.is_local_nhds h3f] at h
    

Proof state:
case mp
H : Type u_1
M : Type u_2
H' : Type u_3
M' : Type u_4
X : Type u_5
inst✝⁶ : TopologicalSpace H
inst✝⁵ : TopologicalSpace M
inst✝⁴ : ChartedSpace H M
inst✝³ : TopologicalSpace H'
inst✝² : TopologicalSpace M'
inst✝¹ : ChartedSpace H' M'
inst✝ : TopologicalSpace X
G : StructureGroupoid H
G' : StructureGroupoid H'
P : (H → H') → Set H → H → Prop
s✝ t u : Set H
x✝ : H
hG : LocalInvariantProp G G' P
s : Set H
x : H
f : H → H'
e' : PartialHomeomorph H' H'
he' : e' ∈ G'
hfs : ContinuousWithinAt f s x
hxe' : f x ∈ e'.source
h2f : f ⁻¹' e'.source ∈ 𝓝[s] x
h3f : ↑e' ∘ f ⁻¹' (PartialHomeomorph.symm e').toPartialEquiv.source ∈ 𝓝[s] x
h : P (↑e' ∘ f) (s ∩ ↑e' ∘ f ⁻¹' (PartialHomeomorph.symm e').toPartialEquiv.source) x
⊢ P f s x

Next tactic:
have h2 := hG.left_invariance' (G'.symm he') (inter_subset_right _ _) (e'.mapsTo hxe') h
theorem left_invariance {s : Set H} {x : H} {f : H → H'} {e' : PartialHomeomorph H' H'}
    (he' : e' ∈ G') (hfs : ContinuousWithinAt f s x) (hxe' : f x ∈ e'.source) :
    P (e' ∘ f) s x ↔ P f s x := by
  have h2f := hfs.preimage_mem_nhdsWithin (e'.open_source.mem_nhds hxe')
  have h3f :=
    ((e'.continuousAt hxe').comp_continuousWithinAt hfs).preimage_mem_nhdsWithin <|
      e'.symm.open_source.mem_nhds <| e'.mapsTo hxe'
  constructor
  · intro h
    rw [hG.is_local_nhds h3f] at h
    have h2 := hG.left_invariance' (G'.symm he') (inter_subset_right _ _) (e'.mapsTo hxe') h
    

Proof state:
case mp
H : Type u_1
M : Type u_2
H' : Type u_3
M' : Type u_4
X : Type u_5
inst✝⁶ : TopologicalSpace H
inst✝⁵ : TopologicalSpace M
inst✝⁴ : ChartedSpace H M
inst✝³ : TopologicalSpace H'
inst✝² : TopologicalSpace M'
inst✝¹ : ChartedSpace H' M'
inst✝ : TopologicalSpace X
G : StructureGroupoid H
G' : StructureGroupoid H'
P : (H → H') → Set H → H → Prop
s✝ t u : Set H
x✝ : H
hG : LocalInvariantProp G G' P
s : Set H
x : H
f : H → H'
e' : PartialHomeomorph H' H'
he' : e' ∈ G'
hfs : ContinuousWithinAt f s x
hxe' : f x ∈ e'.source
h2f : f ⁻¹' e'.source ∈ 𝓝[s] x
h3f : ↑e' ∘ f ⁻¹' (PartialHomeomorph.symm e').toPartialEquiv.source ∈ 𝓝[s] x
h : P (↑e' ∘ f) (s ∩ ↑e' ∘ f ⁻¹' (PartialHomeomorph.symm e').toPartialEquiv.source) x
h2 : P (↑(PartialHomeomorph.symm e') ∘ ↑e' ∘ f) (s ∩ ↑e' ∘ f ⁻¹' (PartialHomeomorph.symm e').toPartialEquiv.source) x
⊢ P f s x

Next tactic:
rw [← hG.is_local_nhds h3f] at h2
theorem left_invariance {s : Set H} {x : H} {f : H → H'} {e' : PartialHomeomorph H' H'}
    (he' : e' ∈ G') (hfs : ContinuousWithinAt f s x) (hxe' : f x ∈ e'.source) :
    P (e' ∘ f) s x ↔ P f s x := by
  have h2f := hfs.preimage_mem_nhdsWithin (e'.open_source.mem_nhds hxe')
  have h3f :=
    ((e'.continuousAt hxe').comp_continuousWithinAt hfs).preimage_mem_nhdsWithin <|
      e'.symm.open_source.mem_nhds <| e'.mapsTo hxe'
  constructor
  · intro h
    rw [hG.is_local_nhds h3f] at h
    have h2 := hG.left_invariance' (G'.symm he') (inter_subset_right _ _) (e'.mapsTo hxe') h
    rw [← hG.is_local_nhds h3f] at h2
    

Proof state:
case mp
H : Type u_1
M : Type u_2
H' : Type u_3
M' : Type u_4
X : Type u_5
inst✝⁶ : TopologicalSpace H
inst✝⁵ : TopologicalSpace M
inst✝⁴ : ChartedSpace H M
inst✝³ : TopologicalSpace H'
inst✝² : TopologicalSpace M'
inst✝¹ : ChartedSpace H' M'
inst✝ : TopologicalSpace X
G : StructureGroupoid H
G' : StructureGroupoid H'
P : (H → H') → Set H → H → Prop
s✝ t u : Set H
x✝ : H
hG : LocalInvariantProp G G' P
s : Set H
x : H
f : H → H'
e' : PartialHomeomorph H' H'
he' : e' ∈ G'
hfs : ContinuousWithinAt f s x
hxe' : f x ∈ e'.source
h2f : f ⁻¹' e'.source ∈ 𝓝[s] x
h3f : ↑e' ∘ f ⁻¹' (PartialHomeomorph.symm e').toPartialEquiv.source ∈ 𝓝[s] x
h : P (↑e' ∘ f) (s ∩ ↑e' ∘ f ⁻¹' (PartialHomeomorph.symm e').toPartialEquiv.source) x
h2 : P (↑(PartialHomeomorph.symm e') ∘ ↑e' ∘ f) s x
⊢ P f s x

Next tactic:
refine' hG.congr_nhdsWithin _ (e'.left_inv hxe') h2
theorem left_invariance {s : Set H} {x : H} {f : H → H'} {e' : PartialHomeomorph H' H'}
    (he' : e' ∈ G') (hfs : ContinuousWithinAt f s x) (hxe' : f x ∈ e'.source) :
    P (e' ∘ f) s x ↔ P f s x := by
  have h2f := hfs.preimage_mem_nhdsWithin (e'.open_source.mem_nhds hxe')
  have h3f :=
    ((e'.continuousAt hxe').comp_continuousWithinAt hfs).preimage_mem_nhdsWithin <|
      e'.symm.open_source.mem_nhds <| e'.mapsTo hxe'
  constructor
  · intro h
    rw [hG.is_local_nhds h3f] at h
    have h2 := hG.left_invariance' (G'.symm he') (inter_subset_right _ _) (e'.mapsTo hxe') h
    rw [← hG.is_local_nhds h3f] at h2
    refine' hG.congr_nhdsWithin _ (e'.left_inv hxe') h2
    

Proof state:
case mp
H : Type u_1
M : Type u_2
H' : Type u_3
M' : Type u_4
X : Type u_5
inst✝⁶ : TopologicalSpace H
inst✝⁵ : TopologicalSpace M
inst✝⁴ : ChartedSpace H M
inst✝³ : TopologicalSpace H'
inst✝² : TopologicalSpace M'
inst✝¹ : ChartedSpace H' M'
inst✝ : TopologicalSpace X
G : StructureGroupoid H
G' : StructureGroupoid H'
P : (H → H') → Set H → H → Prop
s✝ t u : Set H
x✝ : H
hG : LocalInvariantProp G G' P
s : Set H
x : H
f : H → H'
e' : PartialHomeomorph H' H'
he' : e' ∈ G'
hfs : ContinuousWithinAt f s x
hxe' : f x ∈ e'.source
h2f : f ⁻¹' e'.source ∈ 𝓝[s] x
h3f : ↑e' ∘ f ⁻¹' (PartialHomeomorph.symm e').toPartialEquiv.source ∈ 𝓝[s] x
h : P (↑e' ∘ f) (s ∩ ↑e' ∘ f ⁻¹' (PartialHomeomorph.symm e').toPartialEquiv.source) x
h2 : P (↑(PartialHomeomorph.symm e') ∘ ↑e' ∘ f) s x
⊢ ↑(PartialHomeomorph.symm e') ∘ ↑e' ∘ f =ᶠ[𝓝[s] x] f

Next tactic:
exact eventually_of_mem h2f fun x' ↦ e'.left_inv
theorem left_invariance {s : Set H} {x : H} {f : H → H'} {e' : PartialHomeomorph H' H'}
    (he' : e' ∈ G') (hfs : ContinuousWithinAt f s x) (hxe' : f x ∈ e'.source) :
    P (e' ∘ f) s x ↔ P f s x := by
  have h2f := hfs.preimage_mem_nhdsWithin (e'.open_source.mem_nhds hxe')
  have h3f :=
    ((e'.continuousAt hxe').comp_continuousWithinAt hfs).preimage_mem_nhdsWithin <|
      e'.symm.open_source.mem_nhds <| e'.mapsTo hxe'
  constructor
  · intro h
    rw [hG.is_local_nhds h3f] at h
    have h2 := hG.left_invariance' (G'.symm he') (inter_subset_right _ _) (e'.mapsTo hxe') h
    rw [← hG.is_local_nhds h3f] at h2
    refine' hG.congr_nhdsWithin _ (e'.left_inv hxe') h2
    exact eventually_of_mem h2f fun x' ↦ e'.left_inv
  · 

Proof state:
case mpr
H : Type u_1
M : Type u_2
H' : Type u_3
M' : Type u_4
X : Type u_5
inst✝⁶ : TopologicalSpace H
inst✝⁵ : TopologicalSpace M
inst✝⁴ : ChartedSpace H M
inst✝³ : TopologicalSpace H'
inst✝² : TopologicalSpace M'
inst✝¹ : ChartedSpace H' M'
inst✝ : TopologicalSpace X
G : StructureGroupoid H
G' : StructureGroupoid H'
P : (H → H') → Set H → H → Prop
s✝ t u : Set H
x✝ : H
hG : LocalInvariantProp G G' P
s : Set H
x : H
f : H → H'
e' : PartialHomeomorph H' H'
he' : e' ∈ G'
hfs : ContinuousWithinAt f s x
hxe' : f x ∈ e'.source
h2f : f ⁻¹' e'.source ∈ 𝓝[s] x
h3f : ↑e' ∘ f ⁻¹' (PartialHomeomorph.symm e').toPartialEquiv.source ∈ 𝓝[s] x
⊢ P f s x → P (↑e' ∘ f) s x

Next tactic:
simp_rw [hG.is_local_nhds h2f]
theorem left_invariance {s : Set H} {x : H} {f : H → H'} {e' : PartialHomeomorph H' H'}
    (he' : e' ∈ G') (hfs : ContinuousWithinAt f s x) (hxe' : f x ∈ e'.source) :
    P (e' ∘ f) s x ↔ P f s x := by
  have h2f := hfs.preimage_mem_nhdsWithin (e'.open_source.mem_nhds hxe')
  have h3f :=
    ((e'.continuousAt hxe').comp_continuousWithinAt hfs).preimage_mem_nhdsWithin <|
      e'.symm.open_source.mem_nhds <| e'.mapsTo hxe'
  constructor
  · intro h
    rw [hG.is_local_nhds h3f] at h
    have h2 := hG.left_invariance' (G'.symm he') (inter_subset_right _ _) (e'.mapsTo hxe') h
    rw [← hG.is_local_nhds h3f] at h2
    refine' hG.congr_nhdsWithin _ (e'.left_inv hxe') h2
    exact eventually_of_mem h2f fun x' ↦ e'.left_inv
  · simp_rw [hG.is_local_nhds h2f]
    

Proof state:
case mpr
H : Type u_1
M : Type u_2
H' : Type u_3
M' : Type u_4
X : Type u_5
inst✝⁶ : TopologicalSpace H
inst✝⁵ : TopologicalSpace M
inst✝⁴ : ChartedSpace H M
inst✝³ : TopologicalSpace H'
inst✝² : TopologicalSpace M'
inst✝¹ : ChartedSpace H' M'
inst✝ : TopologicalSpace X
G : StructureGroupoid H
G' : StructureGroupoid H'
P : (H → H') → Set H → H → Prop
s✝ t u : Set H
x✝ : H
hG : LocalInvariantProp G G' P
s : Set H
x : H
f : H → H'
e' : PartialHomeomorph H' H'
he' : e' ∈ G'
hfs : ContinuousWithinAt f s x
hxe' : f x ∈ e'.source
h2f : f ⁻¹' e'.source ∈ 𝓝[s] x
h3f : ↑e' ∘ f ⁻¹' (PartialHomeomorph.symm e').toPartialEquiv.source ∈ 𝓝[s] x
⊢ P f (s ∩ f ⁻¹' e'.source) x → P (↑e' ∘ f) (s ∩ f ⁻¹' e'.source) x

Next tactic:
exact hG.left_invariance' he' (inter_subset_right _ _) hxe'
theorem right_invariance {s : Set H} {x : H} {f : H → H'} {e : PartialHomeomorph H H} (he : e ∈ G)
    (hxe : x ∈ e.source) : P (f ∘ e.symm) (e.symm ⁻¹' s) (e x) ↔ P f s x := by
  

Proof state:
H : Type u_1
M : Type u_2
H' : Type u_3
M' : Type u_4
X : Type u_5
inst✝⁶ : TopologicalSpace H
inst✝⁵ : TopologicalSpace M
inst✝⁴ : ChartedSpace H M
inst✝³ : TopologicalSpace H'
inst✝² : TopologicalSpace M'
inst✝¹ : ChartedSpace H' M'
inst✝ : TopologicalSpace X
G : StructureGroupoid H
G' : StructureGroupoid H'
P : (H → H') → Set H → H → Prop
s✝ t u : Set H
x✝ : H
hG : LocalInvariantProp G G' P
s : Set H
x : H
f : H → H'
e : PartialHomeomorph H H
he : e ∈ G
hxe : x ∈ e.source
⊢ P (f ∘ ↑(PartialHomeomorph.symm e)) (↑(PartialHomeomorph.symm e) ⁻¹' s) (↑e x) ↔ P f s x

Next tactic:
refine' ⟨fun h ↦ _, hG.right_invariance' he hxe⟩
theorem right_invariance {s : Set H} {x : H} {f : H → H'} {e : PartialHomeomorph H H} (he : e ∈ G)
    (hxe : x ∈ e.source) : P (f ∘ e.symm) (e.symm ⁻¹' s) (e x) ↔ P f s x := by
  refine' ⟨fun h ↦ _, hG.right_invariance' he hxe⟩
  

Proof state:
H : Type u_1
M : Type u_2
H' : Type u_3
M' : Type u_4
X : Type u_5
inst✝⁶ : TopologicalSpace H
inst✝⁵ : TopologicalSpace M
inst✝⁴ : ChartedSpace H M
inst✝³ : TopologicalSpace H'
inst✝² : TopologicalSpace M'
inst✝¹ : ChartedSpace H' M'
inst✝ : TopologicalSpace X
G : StructureGroupoid H
G' : StructureGroupoid H'
P : (H → H') → Set H → H → Prop
s✝ t u : Set H
x✝ : H
hG : LocalInvariantProp G G' P
s : Set H
x : H
f : H → H'
e : PartialHomeomorph H H
he : e ∈ G
hxe : x ∈ e.source
h : P (f ∘ ↑(PartialHomeomorph.symm e)) (↑(PartialHomeomorph.symm e) ⁻¹' s) (↑e x)
⊢ P f s x

Next tactic:
have := hG.right_invariance' (G.symm he) (e.mapsTo hxe) h