-- Mathlib/Topology/Germ.lean
/-- If the germ of `f` w.r.t. each `𝓝 x` is constant, `f` is locally constant. -/
lemma IsLocallyConstant.of_germ_isConstant (h : ∀ x : X, (f : Germ (𝓝 x) Y).IsConstant) :
    IsLocallyConstant f

Proof state:
X : Type u_1
Y : Type u_2
inst✝ : TopologicalSpace X
f : X → Y
h : ∀ (x : X), (↑f).IsConstant
⊢ IsLocallyConstant f

Tactic:
intro s

Result:
X : Type u_1
Y : Type u_2
inst✝ : TopologicalSpace X
f : X → Y
h : ∀ (x : X), (↑f).IsConstant
s : Set Y
⊢ IsOpen (f ⁻¹' s)

Proof state:
case intro
X : Type u_1
Y : Type u_2
inst✝ : TopologicalSpace X
f : X → Y
h : ∀ (x : X), (↑f).IsConstant
s : Set Y
a : X
ha : a ∈ f ⁻¹' s
b : Y
hb : f =ᶠ[𝓝 a] fun x => b
⊢ f ⁻¹' s ∈ 𝓝 a

Tactic:
apply mem_of_superset hb

Result:
case intro
X : Type u_1
Y : Type u_2
inst✝ : TopologicalSpace X
f : X → Y
h : ∀ (x : X), (↑f).IsConstant
s : Set Y
a : X
ha : a ∈ f ⁻¹' s
b : Y
hb : f =ᶠ[𝓝 a] fun x => b
⊢ {x | (fun x => f x = (fun x => b) x) x} ⊆ f ⁻¹' s

Proof state:
X : Type u_1
Y : Type u_2
inst✝ : TopologicalSpace X
f : X → Y
h : ∀ (x : X), (↑f).IsConstant
s : Set Y
⊢ ∀ x ∈ f ⁻¹' s, f ⁻¹' s ∈ 𝓝 x

Tactic:
intro a ha

Result:
X : Type u_1
Y : Type u_2
inst✝ : TopologicalSpace X
f : X → Y
h : ∀ (x : X), (↑f).IsConstant
s : Set Y
a : X
ha : a ∈ f ⁻¹' s
⊢ f ⁻¹' s ∈ 𝓝 a

Proof state:
case intro
X : Type u_1
Y : Type u_2
inst✝ : TopologicalSpace X
f : X → Y
h : ∀ (x : X), (↑f).IsConstant
s : Set Y
a : X
ha : a ∈ f ⁻¹' s
b : Y
hb : f =ᶠ[𝓝 a] fun x => b
x : X
hx : x ∈ {x | (fun x => f x = (fun x => b) x) x}
⊢ x ∈ f ⁻¹' s

Tactic:
have : f x = f a := (mem_of_mem_nhds hb) ▸ hx

Result:
case intro
X : Type u_1
Y : Type u_2
inst✝ : TopologicalSpace X
f : X → Y
h : ∀ (x : X), (↑f).IsConstant
s : Set Y
a : X
ha : a ∈ f ⁻¹' s
b : Y
hb : f =ᶠ[𝓝 a] fun x => b
x : X
hx : x ∈ {x | (fun x => f x = (fun x => b) x) x}
this : f x = f a
⊢ x ∈ f ⁻¹' s

Proof state:
case intro
X : Type u_1
Y : Type u_2
inst✝ : TopologicalSpace X
f : X → Y
h : ∀ (x : X), (↑f).IsConstant
s : Set Y
a : X
ha : a ∈ f ⁻¹' s
b : Y
hb : f =ᶠ[𝓝 a] fun x => b
⊢ {x | (fun x => f x = (fun x => b) x) x} ⊆ f ⁻¹' s

Tactic:
intro x hx

Result:
case intro
X : Type u_1
Y : Type u_2
inst✝ : TopologicalSpace X
f : X → Y
h : ∀ (x : X), (↑f).IsConstant
s : Set Y
a : X
ha : a ∈ f ⁻¹' s
b : Y
hb : f =ᶠ[𝓝 a] fun x => b
x : X
hx : x ∈ {x | (fun x => f x = (fun x => b) x) x}
⊢ x ∈ f ⁻¹' s

Proof state:
case intro
X : Type u_1
Y : Type u_2
inst✝ : TopologicalSpace X
f : X → Y
h : ∀ (x : X), (↑f).IsConstant
s : Set Y
a : X
ha : a ∈ f ⁻¹' s
b : Y
hb : f =ᶠ[𝓝 a] fun x => b
x : X
hx : x ∈ {x | (fun x => f x = (fun x => b) x) x}
this : f x = f a
⊢ f a ∈ s

Tactic:
exact ha

Result:
no goals

Proof state:
X : Type u_1
Y : Type u_2
inst✝ : TopologicalSpace X
f : X → Y
h : ∀ (x : X), (↑f).IsConstant
s : Set Y
a : X
ha : a ∈ f ⁻¹' s
⊢ f ⁻¹' s ∈ 𝓝 a

Tactic:
obtain ⟨b, hb⟩ := h a

Result:
case intro
X : Type u_1
Y : Type u_2
inst✝ : TopologicalSpace X
f : X → Y
h : ∀ (x : X), (↑f).IsConstant
s : Set Y
a : X
ha : a ∈ f ⁻¹' s
b : Y
hb : f =ᶠ[𝓝 a] fun x => b
⊢ f ⁻¹' s ∈ 𝓝 a

Proof state:
case intro
X : Type u_1
Y : Type u_2
inst✝ : TopologicalSpace X
f : X → Y
h : ∀ (x : X), (↑f).IsConstant
s : Set Y
a : X
ha : a ∈ f ⁻¹' s
b : Y
hb : f =ᶠ[𝓝 a] fun x => b
x : X
hx : x ∈ {x | (fun x => f x = (fun x => b) x) x}
this : f x = f a
⊢ x ∈ f ⁻¹' s

Tactic:
rw [mem_preimage, this]

Result:
case intro
X : Type u_1
Y : Type u_2
inst✝ : TopologicalSpace X
f : X → Y
h : ∀ (x : X), (↑f).IsConstant
s : Set Y
a : X
ha : a ∈ f ⁻¹' s
b : Y
hb : f =ᶠ[𝓝 a] fun x => b
x : X
hx : x ∈ {x | (fun x => f x = (fun x => b) x) x}
this : f x = f a
⊢ f a ∈ s

Proof state:
X : Type u_1
Y : Type u_2
inst✝ : TopologicalSpace X
f : X → Y
h : ∀ (x : X), (↑f).IsConstant
s : Set Y
⊢ IsOpen (f ⁻¹' s)

Tactic:
rw [isOpen_iff_mem_nhds]

Result:
X : Type u_1
Y : Type u_2
inst✝ : TopologicalSpace X
f : X → Y
h : ∀ (x : X), (↑f).IsConstant
s : Set Y
⊢ ∀ x ∈ f ⁻¹' s, f ⁻¹' s ∈ 𝓝 x