-- Mathlib/Analysis/Meromorphic/Basic.lean
/-- With our definitions, `MeromorphicAt f x` depends only on the values of `f` on a punctured
neighbourhood of `x` (not on `f x`) -/
lemma congr {f g : 𝕜 → E} {x : 𝕜} (hf : MeromorphicAt f x) (hfg : f =ᶠ[𝓝[≠] x] g) :
    MeromorphicAt g x

Proof state:
case intro
𝕜 : Type u_1
inst✝² : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
f g : 𝕜 → E
x : 𝕜
hfg : f =ᶠ[𝓝[≠] x] g
m : ℕ
hf : AnalyticAt 𝕜 (fun z => (z - x) ^ m • f z) x
this : AnalyticAt 𝕜 (fun z => z - x) x
⊢ AnalyticAt 𝕜 (fun z => (z - x) ^ (m + 1) • g z) x

Tactic:
refine (this.smul' hf).congr ?_

Result:
case intro
𝕜 : Type u_1
inst✝² : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
f g : 𝕜 → E
x : 𝕜
hfg : f =ᶠ[𝓝[≠] x] g
m : ℕ
hf : AnalyticAt 𝕜 (fun z => (z - x) ^ m • f z) x
this : AnalyticAt 𝕜 (fun z => z - x) x
⊢ (fun x_1 => (x_1 - x) • (x_1 - x) ^ m • f x_1) =ᶠ[𝓝 x] fun z => (z - x) ^ (m + 1) • g z

Proof state:
case intro
𝕜 : Type u_1
inst✝² : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
f g : 𝕜 → E
x : 𝕜
hfg : ∀ᶠ (x_1 : 𝕜) in 𝓝 x, x_1 ∈ {x}ᶜ → f x_1 = g x_1
m : ℕ
hf : AnalyticAt 𝕜 (fun z => (z - x) ^ m • f z) x
this : AnalyticAt 𝕜 (fun z => z - x) x
⊢ (fun x_1 => (x_1 - x) • (x_1 - x) ^ m • f x_1) =ᶠ[𝓝 x] fun z => (z - x) ^ (m + 1) • g z

Tactic:
filter_upwards [hfg] with z hz

Result:
case h
𝕜 : Type u_1
inst✝² : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
f g : 𝕜 → E
x : 𝕜
hfg : ∀ᶠ (x_1 : 𝕜) in 𝓝 x, x_1 ∈ {x}ᶜ → f x_1 = g x_1
m : ℕ
hf : AnalyticAt 𝕜 (fun z => (z - x) ^ m • f z) x
this : AnalyticAt 𝕜 (fun z => z - x) x
z : 𝕜
hz : z ∈ {x}ᶜ → f z = g z
⊢ (z - x) • (z - x) ^ m • f z = (z - x) ^ (m + 1) • g z

Proof state:
case h
𝕜 : Type u_1
inst✝² : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
f g : 𝕜 → E
x : 𝕜
hfg : ∀ᶠ (x_1 : 𝕜) in 𝓝 x, x_1 ∈ {x}ᶜ → f x_1 = g x_1
m : ℕ
hf : AnalyticAt 𝕜 (fun z => (z - x) ^ m • f z) x
this : AnalyticAt 𝕜 (fun z => z - x) x
z : 𝕜
hz : z ∈ {x}ᶜ → f z = g z
⊢ (z - x) • (z - x) ^ m • f z = (z - x) ^ (m + 1) • g z

Tactic:
rcases eq_or_ne z x with rfl | hn

Result:
case h.inl
𝕜 : Type u_1
inst✝² : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
f g : 𝕜 → E
m : ℕ
z : 𝕜
hfg : ∀ᶠ (x : 𝕜) in 𝓝 z, x ∈ {z}ᶜ → f x = g x
hf : AnalyticAt 𝕜 (fun z_1 => (z_1 - z) ^ m • f z_1) z
this : AnalyticAt 𝕜 (fun z_1 => z_1 - z) z
hz : z ∈ {z}ᶜ → f z = g z
⊢ (z - z) • (z - z) ^ m • f z = (z - z) ^ (m + 1) • g z

case h.inr
𝕜 : Type u_1
inst✝² : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
f g : 𝕜 → E
x : 𝕜
hfg : ∀ᶠ (x_1 : 𝕜) in 𝓝 x, x_1 ∈ {x}ᶜ → f x_1 = g x_1
m : ℕ
hf : AnalyticAt 𝕜 (fun z => (z - x) ^ m • f z) x
this : AnalyticAt 𝕜 (fun z => z - x) x
z : 𝕜
hz : z ∈ {x}ᶜ → f z = g z
hn : z ≠ x
⊢ (z - x) • (z - x) ^ m • f z = (z - x) ^ (m + 1) • g z

Proof state:
case intro
𝕜 : Type u_1
inst✝² : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
f g : 𝕜 → E
x : 𝕜
hfg : f =ᶠ[𝓝[≠] x] g
m : ℕ
hf : AnalyticAt 𝕜 (fun z => (z - x) ^ m • f z) x
⊢ AnalyticAt 𝕜 (fun z => (z - x) ^ (m + 1) • g z) x

Tactic:
have : AnalyticAt 𝕜 (fun z ↦ z - x) x := analyticAt_id.sub analyticAt_const

Result:
case intro
𝕜 : Type u_1
inst✝² : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
f g : 𝕜 → E
x : 𝕜
hfg : f =ᶠ[𝓝[≠] x] g
m : ℕ
hf : AnalyticAt 𝕜 (fun z => (z - x) ^ m • f z) x
this : AnalyticAt 𝕜 (fun z => z - x) x
⊢ AnalyticAt 𝕜 (fun z => (z - x) ^ (m + 1) • g z) x

Proof state:
𝕜 : Type u_1
inst✝² : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
f g : 𝕜 → E
x : 𝕜
hf : MeromorphicAt f x
hfg : f =ᶠ[𝓝[≠] x] g
⊢ MeromorphicAt g x

Tactic:
rcases hf with ⟨m, hf⟩

Result:
case intro
𝕜 : Type u_1
inst✝² : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
f g : 𝕜 → E
x : 𝕜
hfg : f =ᶠ[𝓝[≠] x] g
m : ℕ
hf : AnalyticAt 𝕜 (fun z => (z - x) ^ m • f z) x
⊢ MeromorphicAt g x

Proof state:
case h.inr
𝕜 : Type u_1
inst✝² : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
f g : 𝕜 → E
x : 𝕜
hfg : ∀ᶠ (x_1 : 𝕜) in 𝓝 x, x_1 ∈ {x}ᶜ → f x_1 = g x_1
m : ℕ
hf : AnalyticAt 𝕜 (fun z => (z - x) ^ m • f z) x
this : AnalyticAt 𝕜 (fun z => z - x) x
z : 𝕜
hz : z ∈ {x}ᶜ → f z = g z
hn : z ≠ x
⊢ (z - x) • (z - x) ^ m • f z = (z - x) ^ (m + 1) • g z

Tactic:
rw [hz (Set.mem_compl_singleton_iff.mp hn), pow_succ', mul_smul]

Result:
no goals

Proof state:
case h.inl
𝕜 : Type u_1
inst✝² : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
f g : 𝕜 → E
m : ℕ
z : 𝕜
hfg : ∀ᶠ (x : 𝕜) in 𝓝 z, x ∈ {z}ᶜ → f x = g x
hf : AnalyticAt 𝕜 (fun z_1 => (z_1 - z) ^ m • f z_1) z
this : AnalyticAt 𝕜 (fun z_1 => z_1 - z) z
hz : z ∈ {z}ᶜ → f z = g z
⊢ (z - z) • (z - z) ^ m • f z = (z - z) ^ (m + 1) • g z

Tactic:
simp

Result:
no goals

Proof state:
case intro
𝕜 : Type u_1
inst✝² : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
f g : 𝕜 → E
x : 𝕜
hfg : f =ᶠ[𝓝[≠] x] g
m : ℕ
hf : AnalyticAt 𝕜 (fun z => (z - x) ^ m • f z) x
this : AnalyticAt 𝕜 (fun z => z - x) x
⊢ (fun x_1 => (x_1 - x) • (x_1 - x) ^ m • f x_1) =ᶠ[𝓝 x] fun z => (z - x) ^ (m + 1) • g z

Tactic:
rw [eventuallyEq_nhdsWithin_iff] at hfg

Result:
case intro
𝕜 : Type u_1
inst✝² : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
f g : 𝕜 → E
x : 𝕜
hfg : ∀ᶠ (x_1 : 𝕜) in 𝓝 x, x_1 ∈ {x}ᶜ → f x_1 = g x_1
m : ℕ
hf : AnalyticAt 𝕜 (fun z => (z - x) ^ m • f z) x
this : AnalyticAt 𝕜 (fun z => z - x) x
⊢ (fun x_1 => (x_1 - x) • (x_1 - x) ^ m • f x_1) =ᶠ[𝓝 x] fun z => (z - x) ^ (m + 1) • g z

Proof state:
case intro
𝕜 : Type u_1
inst✝² : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
f g : 𝕜 → E
x : 𝕜
hfg : f =ᶠ[𝓝[≠] x] g
m : ℕ
hf : AnalyticAt 𝕜 (fun z => (z - x) ^ m • f z) x
⊢ MeromorphicAt g x

Tactic:
refine ⟨m + 1, ?_⟩

Result:
case intro
𝕜 : Type u_1
inst✝² : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedSpace 𝕜 E
f g : 𝕜 → E
x : 𝕜
hfg : f =ᶠ[𝓝[≠] x] g
m : ℕ
hf : AnalyticAt 𝕜 (fun z => (z - x) ^ m • f z) x
⊢ AnalyticAt 𝕜 (fun z => (z - x) ^ (m + 1) • g z) x