Documentation

Atlas.ComplexVariables.code.Lecture14

Lecture 14: The Residue of f at an Isolated Singularity #

Definition 1 #

Let Ω be a region and a ∈ Ω. Let f(z) be holomorphic in Ω' = Ω \ {a} (i.e., f has an isolated singularity at a).

The residue of f at a is defined as

Res_{z=a} f(z) := (2πi)⁻¹ ∮_C f(z) dz

where C is any circle contained in Ω with center a.

This is well-defined (independent of the choice of circle) by Cauchy's theorem for the annulus.

Theorem 17' (The Residue Theorem) #

Let f be analytic except for isolated singularities a_j in a region Ω. Let γ be a simple closed curve which has interior contained in Ω and a_j ∉ γ (all j). Then

(2πi)⁻¹ ∮_γ f(z) dz = ∑j Res{z=a_j} f(z)

where the sum ranges over all a_j inside γ.

noncomputable def residue (f : ) (a : ) (R : ) :

Definition 1, Lecture 14 (Residue). The residue of a function f at the isolated singularity a, computed using a circle of radius R > 0 centered at a:

Res_{z=a} f(z) = (2πi)⁻¹ ∮_{C(a,R)} f(z) dz

This matches the textbook definition exactly: "The residue is defined as R = Res_{z=a} f(z) ≜ (1/2πi) ∫_C f(z) dz where C is any circle contained in Ω with center a, and f(z) is holomorphic in Ω' = Ω - {a}."

The value is independent of the choice of radius R when f is holomorphic on a punctured neighborhood of a (see residue_eq_of_differentiableOn_annulus).

Lean implementation: residue f a R = (2 * π * i)⁻¹ * ∮ z in C(a, R), f z.

Instances For
    @[simp]
    theorem residue_def (f : ) (a : ) (R : ) :
    residue f a R = (2 * Real.pi * Complex.I)⁻¹ * (z : ) in C(a, R), f z

    Unfolding lemma for residue.

    theorem residue_eq_smul (f : ) (a : ) (R : ) :
    residue f a R = (2 * Real.pi * Complex.I)⁻¹ (z : ) in C(a, R), f z

    The residue can also be written as (2πi)⁻¹ • ∮ f.

    theorem residue_eq_of_differentiableOn_annulus {a : } {r R : } (hr : 0 < r) (hle : r R) {f : } {s : Set } (hs : s.Countable) (hc : ContinuousOn f (Metric.closedBall a R \ Metric.ball a r)) (hd : z ∈ (Metric.ball a R \ Metric.closedBall a r) \ s, DifferentiableAt f z) :
    residue f a R = residue f a r

    Well-definedness of the residue (Lecture 14). If f is continuous on the closed annulus r ≤ ‖z - a‖ ≤ R and complex differentiable at all but countably many points of its open interior, then the residue computed with radius R equals the residue computed with radius r.

    This is an immediate consequence of the Cauchy–Goursat theorem for the annulus (circleIntegral_eq_of_differentiable_on_annulus_off_countable).

    theorem residue_eq_of_differentiableOn_annulus' {a : } {r R : } (hr : 0 < r) (hle : r R) {f : } (hc : ContinuousOn f (Metric.closedBall a R \ Metric.ball a r)) (hd : zMetric.ball a R \ Metric.closedBall a r, DifferentiableAt f z) :
    residue f a R = residue f a r

    Variant of residue_eq_of_differentiableOn_annulus without the countable exceptional set.

    theorem residue_eq_zero_of_differentiableOn {a : } {R : } (hR : 0 R) {f : } (hc : ContinuousOn f (Metric.closedBall a R)) (hd : zMetric.ball a R, DifferentiableAt f z) :
    residue f a R = 0

    If f is differentiable on the entire closed disk (no singularity), then its residue is zero. This is a consequence of the Cauchy–Goursat theorem.

    theorem circleIntegral_sub_inv_eq_zero_of_not_mem {c a : } {R : } (hR : 0 R) (ha : aMetric.closedBall c R) :
    (z : ) in C(c, R), (z - a)⁻¹ = 0

    The circle integral of (z - a)⁻¹ vanishes when a is outside the closed ball. Since a ∉ closedBall c R, the function z ↦ (z - a)⁻¹ is holomorphic on all of closedBall c R, so the Cauchy–Goursat theorem (circleIntegral_eq_zero_of_differentiable_on_off_countable) gives the result.

    This is the companion to circleIntegral.integral_sub_inv_of_mem_ball (which gives 2πi when a ∈ ball c R).

    theorem differentiableOn_of_bounded_of_differentiableOn_punctured {a : } {R : } {h : } (hR : 0 < R) (hdiff : DifferentiableOn h (Metric.ball a R \ {a})) (hbdd : BddAbove (norm h '' (Metric.ball a R \ {a}))) :
    ∃ (g : ), DifferentiableOn g (Metric.ball a R) zMetric.ball a R \ {a}, g z = h z

    Removable singularity theorem (bounded version, Lecture 14).

    If h is holomorphic on the punctured open ball ball a R \ {a} and bounded there, then there exists a function g holomorphic on the full ball ball a R that agrees with h away from a.

    This is a direct consequence of Mathlib's differentiableOn_update_limUnder_of_bddAbove (the removable singularity theorem for bounded holomorphic functions). The witness is Function.update h a (limUnder (𝓝[≠] a) h), which redefines h at a to be the limit of h along the punctured-neighborhood filter.

    theorem diff_iUnion_fin_succ_eq {n : } (a : Fin (n + 1)) (S : Set ) :
    S \ ⋃ (j : Fin (n + 1)), {a j} = (S \ ⋃ (j : Fin n), {a j.castSucc}) \ {a (Fin.last n)}

    The union over Fin (n+1) can be split as the union over the first n (via castSucc) together with the last singleton. Removing both from S equals removing the first n then removing the last.

    theorem circleIntegral_eq_of_single_singularity_concentric {a₀ : } {r₀ R : } (hr₀ : 0 < r₀) (hle : r₀ R) {f : } (hcont : ContinuousOn f (Metric.closedBall a₀ R \ Metric.ball a₀ r₀)) (hdiff : zMetric.ball a₀ R \ Metric.closedBall a₀ r₀, DifferentiableAt f z) :
    (z : ) in C(a₀, R), f z = (z : ) in C(a₀, r₀), f z

    Concentric single-singularity contour deformation (Lecture 14).

    When the outer circle and the inner circle are both centered at the same singularity a₀, the contour integral over the outer circle equals the contour integral over the inner circle, by the annulus theorem (circleIntegral_eq_of_differentiable_on_annulus_off_countable).

    This is the concentric special case of the single-singularity contour deformation. The general (non-concentric) case is handled by circleIntegral_eq_sum_of_singularities, which uses the principal-parts subtraction approach (subtracting Cauchy-type integrals to reduce to a holomorphic function, then applying Cauchy's theorem).

    theorem circleIntegral_zpow_nonconcentric {c a : } {R r : } {n : } (hr : 0 < r) (ha : a Metric.ball c R) :
    (z : ) in C(c, R), (z - a) ^ n = (z : ) in C(a, r), (z - a) ^ n

    Non-concentric zpow circle integral equality.

    The circle integral of (z - a) ^ n over a non-concentric circle C(c, R) equals the integral over the concentric circle C(a, r), provided a ∈ ball c R and 0 < r.

    For n ≠ -1, both integrals are 0 by circleIntegral.integral_sub_zpow_of_ne (which works for any center and any w, not just when w is the circle's center). For n = -1, both integrals equal 2πi by circleIntegral.integral_sub_inv_of_mem_ball.

    Contour deformation via principal part subtraction #

    The key step in the residue theorem is showing that the integral over the large circle C(c, R) equals the sum of integrals over small circles around each singularity.

    Textbook approach (bridge construction, Fig. 14-3): The textbook proves this by connecting each small disk boundary to the large circle γ with narrow "bridges," creating a simply connected region where Cauchy's theorem gives a zero integral. Letting the bridge widths tend to 0 yields ∮_γ f = Σ_j ∮_{C(a_j, r_j)} f.

    However, formalizing this directly requires piecewise smooth contour integration, oriented contour addition/subtraction, and Cauchy's theorem for arbitrary simply connected regions — none of which are available in Mathlib. Mathlib's circle integral infrastructure only supports concentric circle deformation (circleIntegral_eq_of_differentiable_on_annulus_off_countable).

    Formalization approach: The contour deformation theorem circleIntegral_eq_sum_of_singularities is proved as a theorem by case split on n:

    Axioms in this file:

    Cauchy-type principal part integrals (supporting lemmas) #

    The following lemmas establish properties of the Cauchy-type integral P_j(z) = (2πi)⁻¹ ∮_{C(a_j,r_j)} (w-z)⁻¹ · f(w) dw.

    These are standalone results proved using Fubini's theorem and the Cauchy integral formula, and do not depend on any axioms. They were originally used in a principal-part-decomposition approach but are retained as useful infrastructure for complex analysis.

    theorem circleIntegral.integral_neg {f : } {c : } {R : } :
    (z : ) in C(c, R), -f z = - (z : ) in C(c, R), f z

    Circle integral of negation equals negation of circle integral.

    theorem principal_part_circle_integrable {c : } {R : } (hR : 0 < R) {a₀ : } {r₀ : } {f : } (_ha₀ : a₀ Metric.ball c R) (hr₀ : 0 < r₀) (hrd₀ : Metric.closedBall a₀ r₀ Metric.ball c R) (hf_int : CircleIntegrable f a₀ r₀) :
    CircleIntegrable (fun (z : ) => (2 * Real.pi * Complex.I)⁻¹ * (w : ) in C(a₀, r₀), (w - z)⁻¹ * f w) c R

    Circle-integrability of the Cauchy-type principal part.

    The function P(z) = (2πi)⁻¹ ∮_{C(a₀,r₀)} (w-z)⁻¹ f(w) dw is circle-integrable over C(c,R) whenever closedBall a₀ r₀ ⊆ ball c R. This uses the standard CIF sign convention with (w - z)⁻¹ so that P(z) = f(z) inside ball(a₀, r₀).

    Fubini for double circle integrals (standard CIF sign convention).

    With the standard kernel (w - z)⁻¹, integrating P(z) = (2πi)⁻¹ ∮_{C(a₀,r₀)} (w-z)⁻¹ f(w) dw over C(c,R) gives - ∮_{C(a₀,r₀)} f(w) dw.

    This arises because Fubini gives (2πi)⁻¹ ∮_{C(a₀,r₀)} f(w) [∮_{C(c,R)} (w - z)⁻¹ dz] dw and ∮_{C(c,R)} (w - z)⁻¹ dz = -(2πi) for w ∈ ball(c, R), so (2πi)⁻¹ · (-(2πi)) = -1.

    theorem principal_part_integral_eq {c : } {R : } (hR : 0 < R) {a₀ : } {r₀ : } {f : } (_ha₀ : a₀ Metric.ball c R) (hr₀ : 0 < r₀) (hrd₀ : Metric.closedBall a₀ r₀ Metric.ball c R) (hf_cont : ContinuousOn f (Metric.sphere a₀ r₀)) :
    (z : ) in C(c, R), (2 * Real.pi * Complex.I)⁻¹ * (w : ) in C(a₀, r₀), (w - z)⁻¹ * f w = - (w : ) in C(a₀, r₀), f w
    theorem sphere_subset_domain {n : } {a : Fin n} {r : Fin n} {c : } {R : } (hr : ∀ (j : Fin n), 0 < r j) (hrd : ∀ (j : Fin n), Metric.closedBall (a j) (r j) Metric.ball c R) (h_disj : ∀ (i j : Fin n), i jDisjoint (Metric.closedBall (a i) (r i)) (Metric.closedBall (a j) (r j))) (j : Fin n) :
    Metric.sphere (a j) (r j) Metric.closedBall c R \ ⋃ (k : Fin n), {a k}

    The sphere around singularity a_j lies inside the domain of f (i.e., inside closedBall c R \ ⋃ k, {a k}). This is because:

    • sphere (a j) (r j) ⊆ closedBall (a j) (r j) ⊆ ball c R ⊆ closedBall c R
    • a j ∉ sphere (a j) (r j) (since r j > 0)
    • a k ∉ closedBall (a j) (r j) for k ≠ j (by disjointness of closed balls)
    theorem principal_part_differentiableAt {c : } {R : } {n : } {a : Fin n} {r : Fin n} {f : } (hr : ∀ (j : Fin n), 0 < r j) (hrd : ∀ (j : Fin n), Metric.closedBall (a j) (r j) Metric.ball c R) (h_disj : ∀ (i j : Fin n), i jDisjoint (Metric.closedBall (a i) (r i)) (Metric.closedBall (a j) (r j))) (hcont : ContinuousOn f (Metric.closedBall c R \ ⋃ (j : Fin n), {a j})) (j : Fin n) (z : ) (hz : zMetric.sphere (a j) (r j)) :
    DifferentiableAt (fun (z : ) => (2 * Real.pi * Complex.I)⁻¹ * (w : ) in C(a j, r j), (w - z)⁻¹ * f w) z

    Differentiability of each Cauchy-type principal part off the contour.

    Each P_j(z) = (2πi)⁻¹ ∮_{C(a_j,r_j)} (w-z)⁻¹ f(w) dw is differentiable at every z ∉ sphere (a_j) (r_j). This uses the standard CIF sign convention with (w - z)⁻¹ so that P_j(z) = f(z) inside ball(a_j, r_j).

    theorem principal_part_integral_vanishes_on_disjoint_circle {c : } {R : } {n : } {a : Fin n} {r : Fin n} {f : } (hr : ∀ (j : Fin n), 0 < r j) (hrd : ∀ (j : Fin n), Metric.closedBall (a j) (r j) Metric.ball c R) (h_disj : ∀ (i j : Fin n), i jDisjoint (Metric.closedBall (a i) (r i)) (Metric.closedBall (a j) (r j))) (hcont : ContinuousOn f (Metric.closedBall c R \ ⋃ (j : Fin n), {a j})) (i j : Fin n) (hij : i j) :
    (z : ) in C(a j, r j), (2 * Real.pi * Complex.I)⁻¹ * (w : ) in C(a i, r i), (w - z)⁻¹ * f w = 0

    The Cauchy-type principal part P(z) = (2πi)⁻¹ ∮ (w-z)⁻¹ f(w) dw over C(aᵢ, rᵢ) has vanishing integral over any disjoint small circle C(aⱼ, rⱼ), because P is holomorphic on closedBall aⱼ rⱼ.

    theorem cauchy_transform_eq_f_inside {a₀ : } {r₀ : } {f : } (_hr : 0 < r₀) (hcont : ContinuousOn f (Metric.closedBall a₀ r₀)) (hdiff : zMetric.ball a₀ r₀ \ {a₀}, DifferentiableAt f z) {z : } (hz : z Metric.ball a₀ r₀) (_hza : z a₀) :
    (2 * Real.pi * Complex.I)⁻¹ * (w : ) in C(a₀, r₀), (w - z)⁻¹ * f w = f z

    Cauchy integral formula ((w-z)⁻¹ kernel, full-ball continuity). For f continuous on closedBall a₀ r₀ and differentiable on ball a₀ r₀ \ {a₀}, the Cauchy-type integral (2πi)⁻¹ ∮ (w-z)⁻¹ f(w) dw equals f(z) for any z ∈ ball a₀ r₀ with z ≠ a₀. This is a direct application of Mathlib's two_pi_I_inv_smul_circleIntegral_sub_inv_smul_of_differentiable_on_off_countable with the countable exceptional set {a₀}.

    theorem principal_part_fubini_sum {c : } {R : } (hR : 0 < R) {n : } {a : Fin (n + 1)} {r : Fin (n + 1)} {f : } (ha : ∀ (j : Fin (n + 1)), a j Metric.ball c R) (hr : ∀ (j : Fin (n + 1)), 0 < r j) (hrd : ∀ (j : Fin (n + 1)), Metric.closedBall (a j) (r j) Metric.ball c R) (h_disj : ∀ (i j : Fin (n + 1)), i jDisjoint (Metric.closedBall (a i) (r i)) (Metric.closedBall (a j) (r j))) (hcont : ContinuousOn f (Metric.closedBall c R \ ⋃ (j : Fin (n + 1)), {a j})) (j : Fin (n + 1)) :
    (z : ) in C(c, R), (2 * Real.pi * Complex.I)⁻¹ * (w : ) in C(a j, r j), (w - z)⁻¹ * f w = - (w : ) in C(a j, r j), f w

    Fubini identity for principal part integrals over the large circle.

    For each singularity a j, the integral of the Cauchy-type principal part Pⱼ(z) = (2πi)⁻¹ ∮_{C(aⱼ,rⱼ)} (w−z)⁻¹ f(w) dw over the large circle C(c,R) equals −∮_{C(aⱼ,rⱼ)} f. This is a key reduction step for the residue theorem: it shows that the bridge theorem ∮_{C(c,R)} f = Σⱼ ∮_{C(aⱼ,rⱼ)} f follows from the non-concentric contour deformation identity ∮_{C(c,R)} f + Σⱼ ∮_{C(c,R)} Pⱼ = 0.

    axiom diffContOnCl_piecewise_cauchy_extension {c : } {R : } (hR : 0 < R) {n : } {a : Fin n} {r : Fin n} {f : } (hr : ∀ (j : Fin n), 0 < r j) (hrd : ∀ (j : Fin n), Metric.closedBall (a j) (r j) Metric.ball c R) (h_disj : ∀ (i j : Fin n), i jDisjoint (Metric.closedBall (a i) (r i)) (Metric.closedBall (a j) (r j))) (hcont : ContinuousOn f (Metric.closedBall c R \ ⋃ (j : Fin n), Metric.ball (a j) (r j))) (hdiff : zMetric.ball c R \ ⋃ (j : Fin n), Metric.closedBall (a j) (r j), DifferentiableAt f z) :
    let P := fun (j : Fin n) (z : ) => (2 * Real.pi * Complex.I)⁻¹ * (w : ) in C(a j, r j), (w - z)⁻¹ * f w; DiffContOnCl (fun (z : ) => if ∃ (j : Fin n), z Metric.ball (a j) (r j) then k : Fin n, P k z else f z + k : Fin n, P k z) (Metric.ball c R)
    theorem circleIntegral_eq_nonconcentric_of_disjoint_balls {c : } {R : } (hR : 0 < R) {n : } {a : Fin n} {r : Fin n} {f : } (hr : ∀ (j : Fin n), 0 < r j) (hrd : ∀ (j : Fin n), Metric.closedBall (a j) (r j) Metric.ball c R) (h_disj : ∀ (i j : Fin n), i jDisjoint (Metric.closedBall (a i) (r i)) (Metric.closedBall (a j) (r j))) (hcont : ContinuousOn f (Metric.closedBall c R \ ⋃ (j : Fin n), Metric.ball (a j) (r j))) (hdiff : zMetric.ball c R \ ⋃ (j : Fin n), Metric.closedBall (a j) (r j), DifferentiableAt f z) :
    (z : ) in C(c, R), f z = j : Fin n, (z : ) in C(a j, r j), f z

    Non-concentric contour deformation for multiple singularities (Theorem 17'). The integral over a large circle C(c, R) equals the sum of integrals over disjoint small circles C(aⱼ, rⱼ), provided f is holomorphic between the circles. The proof uses principal_part_integral_eq and the piecewise Cauchy extension G.

    theorem circleIntegral_eq_sum_of_singularities_bridge {c : } {R : } (hR : 0 < R) {n : } {a : Fin (n + 1)} {r : Fin (n + 1)} {f : } (_hinj : Function.Injective a) (_ha : ∀ (j : Fin (n + 1)), a j Metric.ball c R) (hr : ∀ (j : Fin (n + 1)), 0 < r j) (hrd : ∀ (j : Fin (n + 1)), Metric.closedBall (a j) (r j) Metric.ball c R) (h_disj : ∀ (i j : Fin (n + 1)), i jDisjoint (Metric.closedBall (a i) (r i)) (Metric.closedBall (a j) (r j))) (hcont : ContinuousOn f (Metric.closedBall c R \ ⋃ (j : Fin (n + 1)), {a j})) (hdiff : zMetric.ball c R \ ⋃ (j : Fin (n + 1)), {a j}, DifferentiableAt f z) :
    (z : ) in C(c, R), f z = j : Fin (n + 1), (z : ) in C(a j, r j), f z

    Bridge construction for ≥ 1 isolated singularities (Lecture 14, Theorem 17'). Proved from circleIntegral_eq_nonconcentric_of_disjoint_balls by monotonicity: the bridge hypotheses (continuity/differentiability off singleton sets {aⱼ}) are stronger than the annulus helper's hypotheses (off open/closed balls around aⱼ), since {aⱼ} ⊆ ball aⱼ rⱼ ⊆ closedBall aⱼ rⱼ.

    theorem circleIntegral_eq_sum_of_singularities {c : } {R : } (hR : 0 < R) {n : } {a : Fin n} {r : Fin n} {f : } (hinj : Function.Injective a) (ha : ∀ (j : Fin n), a j Metric.ball c R) (hr : ∀ (j : Fin n), 0 < r j) (hrd : ∀ (j : Fin n), Metric.closedBall (a j) (r j) Metric.ball c R) (h_disj : ∀ (i j : Fin n), i jDisjoint (Metric.closedBall (a i) (r i)) (Metric.closedBall (a j) (r j))) (hcont : ContinuousOn f (Metric.closedBall c R \ ⋃ (j : Fin n), {a j})) (hdiff : zMetric.ball c R \ ⋃ (j : Fin n), {a j}, DifferentiableAt f z) :
    (z : ) in C(c, R), f z = j : Fin n, (z : ) in C(a j, r j), f z

    Contour deformation for isolated singularities (Lecture 14).

    The integral of f over a large circle C(c, R) equals the sum of integrals over small circles C(aⱼ, rⱼ) around each isolated singularity aⱼ, provided f is holomorphic on the region between the circles.

    Proof structure:

    theorem bridge_single_singularity_base {c : } {R : } (hR : 0 < R) {a₀ : } {r₀ : } {f : } (ha : a₀ Metric.ball c R) (hr : 0 < r₀) (hrd : Metric.closedBall a₀ r₀ Metric.ball c R) (hcont : ContinuousOn f (Metric.closedBall c R \ {a₀})) (hdiff : zMetric.ball c R \ {a₀}, DifferentiableAt f z) :
    (z : ) in C(c, R), f z = (z : ) in C(a₀, r₀), f z

    Non-concentric single-singularity contour deformation (Theorem 17'). Proved by reducing to circleIntegral_eq_sum_of_singularities with Fin 1.

    theorem residue_theorem_with_disj {c : } {R : } (hR : 0 < R) {n : } {a : Fin n} {f : } (ha : ∀ (j : Fin n), a j Metric.ball c R) (hinj : Function.Injective a) (hcont : ContinuousOn f (Metric.closedBall c R \ ⋃ (j : Fin n), {a j})) (hdiff : zMetric.ball c R \ ⋃ (j : Fin n), {a j}, DifferentiableAt f z) {r : Fin n} (hr : ∀ (j : Fin n), 0 < r j) (hrd : ∀ (j : Fin n), Metric.closedBall (a j) (r j) Metric.ball c R) (h_disj : ∀ (i j : Fin n), i jDisjoint (Metric.closedBall (a i) (r i)) (Metric.closedBall (a j) (r j))) :
    (2 * Real.pi * Complex.I)⁻¹ * (z : ) in C(c, R), f z = j : Fin n, residue f (a j) (r j)

    Theorem 17' (The Residue Theorem) — Circle specializationLecture 14, Theorem 17'.

    Let f be analytic except for isolated singularities a₁, ..., aₙ in a region Ω. Let γ be a simple closed curve with its interior contained in Ω, passing through no singularity. Then

    $$\frac{1}{2\pi i} \oint_{\gamma} f(z)\,dz = \sum_{j} \operatorname{Res}_{z = a_j} f(z)$$

    where the sum ranges over all singularities aⱼ inside γ.

    Here the simple closed curve γ is the circle C(c, R), whose interior is ball c R. The hypothesis ha : ∀ j, a j ∈ ball c R ensures all singularities lie in the interior of γ, and hcont/hdiff encode that f is holomorphic on the open ball minus the singularities — i.e., the interior of γ is contained in the region where f is defined.

    The proof deforms the large circle into small circles around each singularity using the bridge construction (Fig. 14-3), then identifies each small circle integral as a residue.

    Interior hypothesis: In the textbook statement, the critical hypothesis is that the interior of γ is contained in Ω. Here, Ω = closedBall c R and the interior of the circle C(c, R) is ball c R ⊆ closedBall c R = Ω, so this hypothesis is automatically satisfied. The hypotheses ha : ∀ j, a j ∈ ball c R (singularities lie in the interior) and hcont/hdiff (continuity and differentiability on the closed disk minus singularities) encode the full content of the textbook's "interior of γ ⊆ Ω" condition.

    theorem residue_theorem_aux {c : } {R : } (hR : 0 < R) {n : } {a : Fin n} {f : } (ha : ∀ (j : Fin n), a j Metric.ball c R) (hinj : Function.Injective a) (hcont : ContinuousOn f (Metric.closedBall c R \ ⋃ (j : Fin n), {a j})) (hdiff : zMetric.ball c R \ ⋃ (j : Fin n), {a j}, DifferentiableAt f z) {r : Fin n} (hr : ∀ (j : Fin n), 0 < r j) (hrd : ∀ (j : Fin n), Metric.closedBall (a j) (r j) Metric.ball c R) (h_sep : ∀ (i j : Fin n), i ja jMetric.closedBall (a i) (r i)) :
    (2 * Real.pi * Complex.I)⁻¹ * (z : ) in C(c, R), f z = j : Fin n, residue f (a j) (r j)

    Theorem 17' (The Residue Theorem)Lecture 14, Theorem 17'.

    Let f be analytic except for isolated singularities a₁, ..., aₙ in a region Ω. Let γ be a simple closed curve with its interior contained in Ω, passing through no singularity. Then

    $$\frac{1}{2\pi i} \oint_{\gamma} f(z)\,dz = \sum_{j} \operatorname{Res}_{z = a_j} f(z)$$

    where the sum ranges over all singularities aⱼ inside γ.

    This version removes the pairwise disjointness hypothesis h_disj from residue_theorem_with_disj. Instead, it only requires that each closed ball closedBall (a j) (r j) contains no other singularity center a k (k ≠ j), which ensures that residue f (a j) (r j) computes the correct residue at a j. The proof constructs smaller disjoint radii r' satisfying disjointness, applies residue_theorem_with_disj, and equates the residues via residue_eq_of_differentiableOn_annulus'.

    noncomputable def residueRadius {c : } {R : } (hR : 0 < R) {n : } {a : Fin n} {f : } (ha : ∀ (j : Fin n), a j Metric.ball c R) (hinj : Function.Injective a) (hcont : ContinuousOn f (Metric.closedBall c R \ ⋃ (j : Fin n), {a j})) (hdiff : zMetric.ball c R \ ⋃ (j : Fin n), {a j}, DifferentiableAt f z) :
    Fin n

    Canonical radius for computing the residue of f at singularity a j inside ball c R, used in the statement of the Residue Theorem. The value is chosen so that the closed balls around each singularity are contained in ball c R and are pairwise separated.

    Instances For
      theorem residue_theorem {c : } {R : } (hR : 0 < R) {n : } {a : Fin n} {f : } (ha : ∀ (j : Fin n), a j Metric.ball c R) (hinj : Function.Injective a) (hcont : ContinuousOn f (Metric.closedBall c R \ ⋃ (j : Fin n), {a j})) (hdiff : zMetric.ball c R \ ⋃ (j : Fin n), {a j}, DifferentiableAt f z) {r : Fin n} (hr : ∀ (j : Fin n), 0 < r j) (hrd : ∀ (j : Fin n), Metric.closedBall (a j) (r j) Metric.ball c R) (h_sep : ∀ (i j : Fin n), i ja jMetric.closedBall (a i) (r i)) :
      (2 * Real.pi * Complex.I)⁻¹ * (z : ) in C(c, R), f z = j : Fin n, residue f (a j) (r j)

      Theorem 17' (The Residue Theorem)Lecture 14, Theorem 17'.

      Let f be analytic except for isolated singularities a₁, ..., aₙ in a region Ω. Let γ be a simple closed curve with its interior contained in Ω, passing through no singularity. Then

      $$\frac{1}{2\pi i} \oint_{\gamma} f(z)\,dz = \sum_{j} \operatorname{Res}_{z = a_j} f(z)$$

      where the sum ranges over all singularities aⱼ inside γ.

      The user supplies radii r j > 0 with each closedBall (a j) (r j) ⊆ ball c R and no other singularity a k lying in closedBall (a j) (r j). The residue is radius-independent (by residue_eq_of_differentiableOn_annulus'), so the formula holds for any valid choice of radii. The h_sep condition ensures each integration circle encloses exactly one singularity, matching the book's implicit assumption that the residue at each aⱼ is well-defined.

      theorem residue_theorem' {c : } {R : } (hR : 0 < R) {n : } {a : Fin n} {f : } (ha : ∀ (j : Fin n), a j Metric.ball c R) (hinj : Function.Injective a) (hcont : ContinuousOn f (Metric.closedBall c R \ ⋃ (j : Fin n), {a j})) (hdiff : zMetric.ball c R \ ⋃ (j : Fin n), {a j}, DifferentiableAt f z) :
      (2 * Real.pi * Complex.I)⁻¹ * (z : ) in C(c, R), f z = j : Fin n, residue f (a j) (residueRadius hR ha hinj hcont hdiff j)

      Variant of the Residue Theorem using canonically chosen radii residueRadius. See residue_theorem for the primary, radius-explicit version.

      Theorem 18' (The Argument Principle) #

      Let f(z) be meromorphic in Ω, γ ⊂ Ω a simple closed curve with interior inside Ω. Assume γ passes through no zeros nor poles of f. Then

      (2πi)⁻¹ ∮_γ f'(z)/f(z) dz = N - P

      where N is the number of zeros, P the number of poles inside γ, all counted with multiplicity.

      @[reducible, inline]
      abbrev singPts {nz np : } (zeros : Fin nz) (poles : Fin np) :
      Fin (nz + np)

      Combine positions of zeros and poles into a single sequence indexed by Fin (nz + np), for use in the Argument Principle.

      Instances For
        @[reducible, inline]
        abbrev singRads {nz np : } (rz : Fin nz) (rp : Fin np) :
        Fin (nz + np)

        Combine radii around zeros and poles into a single sequence indexed by Fin (nz + np), for use in the Argument Principle.

        Instances For
          theorem logDeriv_sub_zpow (b : ) (n : ) (z : ) (hz : z b) :
          logDeriv (fun (x : ) => (x - b) ^ n) z = n / (z - b)

          Helper: the logarithmic derivative of (· - b) ^ n equals n / (· - b).

          axiom continuousOn_deriv_of_differentiableAt_closedBall {b : } {ε : } ( : 0 < ε) {g : } (hg_hol : zMetric.closedBall b ε, DifferentiableAt g z) :
          theorem circleIntegral_logDeriv_eq_zero {b : } {ε : } ( : 0 < ε) {g : } (hg_hol : zMetric.closedBall b ε, DifferentiableAt g z) (hg_cont : ContinuousOn g (Metric.closedBall b ε)) (hg_ne : zMetric.closedBall b ε, g z 0) :
          (z : ) in C(b, ε), logDeriv g z = 0

          The circle integral of logDeriv g vanishes when g is holomorphic and nonvanishing on the closed ball. This uses the Cauchy integral theorem: logDeriv g is holomorphic (hence its integral over any circle in the domain is zero) provided g is nonvanishing. The hypothesis g ≠ 0 on the entire closed ball ensures logDeriv g = (deriv g)/g is continuous and holomorphic on the ball, so the Cauchy integral theorem applies.

          theorem logDeriv_zero_decomposition {a : } {ε : } ( : 0 < ε) {f : } {n : } {g : } (hg_hol : zMetric.closedBall a ε, DifferentiableAt g z) (hg_ne : zMetric.sphere a ε, g z 0) (hf_nhds : zMetric.sphere a ε, ∀ᶠ (w : ) in nhds z, f w = (w - a) ^ n * g w) :
          Set.EqOn (logDeriv f) (fun (z : ) => n / (z - a) + logDeriv g z) (Metric.sphere a ε)

          On the circle C(a,ε), the logarithmic derivative of f decomposes as logDeriv f z = h/(z-a) + logDeriv g z, where f(z) = (z-a)^h · g(z). This is the product rule for logarithmic derivatives applied to the zero factorization.

          Hypotheses: g is holomorphic and nonzero on the sphere, and f agrees with (· - a)^h · g in a neighborhood of each point on the sphere.

          theorem residue_logDeriv_at_zero {a : } {ε : } ( : 0 < ε) {f : } {h : } (_hh : 0 < h) {g : } (hg_ne : zMetric.closedBall a ε, g z 0) (hg_hol : zMetric.closedBall a ε, DifferentiableAt g z) (hg_cont : ContinuousOn g (Metric.closedBall a ε)) (_hf_eq : zMetric.closedBall a ε \ {a}, f z = (z - a) ^ h * g z) (hf_nhds : zMetric.sphere a ε, ∀ᶠ (w : ) in nhds z, f w = (w - a) ^ h * g w) :
          residue (logDeriv f) a ε = h

          Residue of the logarithmic derivative at a zero (Lecture 14, proof of Theorem 18').

          If f has a zero of order h at a, meaning f(z) = (z - a)^h · g(z) with g holomorphic near a and g(a) ≠ 0, then Res(f'/f, a) = h.

          Proof sketch from the text: differentiating f(z) = (z - a)^h · g(z) gives f'(z)/f(z) = h/(z - a) + g'(z)/g(z). Since g'/g is holomorphic near a (as g(a) ≠ 0), its circle integral vanishes by Cauchy's theorem (Lecture 13), while the circle integral of h/(z - a) gives 2πi · h by the Cauchy integral formula (Lecture 11).

          theorem logDeriv_pole_decomposition {b : } {ε : } ( : 0 < ε) {f : } {k : } {g : } (hg_hol : zMetric.closedBall b ε, DifferentiableAt g z) (hg_ne : zMetric.sphere b ε, g z 0) (hf_eq : zMetric.sphere b ε, ∀ᶠ (w : ) in nhds z, f w = ((w - b) ^ k)⁻¹ * g w) :
          Set.EqOn (logDeriv f) (fun (z : ) => -k / (z - b) + logDeriv g z) (Metric.sphere b ε)

          On the circle C(b,ε), the logarithmic derivative of f decomposes as logDeriv f z = -k/(z-b) + logDeriv g z, where f(z) = (z-b)^(-k) · g(z). This is the product rule for logarithmic derivatives: (h₁ · h₂)' / (h₁ · h₂) = h₁'/h₁ + h₂'/h₂.

          Hypotheses: g is holomorphic and nonzero on the sphere, and f agrees with (· - b)^(-k) · g in a neighborhood of each point on the sphere.

          theorem residue_logDeriv_at_pole {b : } {ε : } ( : 0 < ε) {f : } {k : } (_hk : 0 < k) {g : } (hg_ne : zMetric.closedBall b ε, g z 0) (hg_hol : zMetric.closedBall b ε, DifferentiableAt g z) (hg_cont : ContinuousOn g (Metric.closedBall b ε)) (_hf_eq : zMetric.closedBall b ε \ {b}, f z = ((z - b) ^ k)⁻¹ * g z) (hf_eq_nhds : zMetric.sphere b ε, ∀ᶠ (w : ) in nhds z, f w = ((w - b) ^ k)⁻¹ * g w) :
          residue (logDeriv f) b ε = -k

          Residue of the logarithmic derivative at a pole (Lecture 14, proof of Theorem 18').

          If f has a pole of order k at b, meaning f(z) = (z - b)^(-k) · g(z) with g holomorphic near b and g(b) ≠ 0, then Res(f'/f, b) = -k.

          Proof sketch from the text: writing f(z) = (z - b)^(-k) · g(z) and differentiating gives f'(z)/f(z) = -k/(z - b) + g'(z)/g(z). By the same argument as for zeros, the residue is -k.

          theorem argument_principle {c : } {R : } (hR : 0 < R) {nz np : } {zeros : Fin nz} {poles : Fin np} {multZ : Fin nz} {multP : Fin np} {rz : Fin nz} {rp : Fin np} {f : } {gz : Fin nz} {gp : Fin np} (hzeros_in : ∀ (j : Fin nz), zeros j Metric.ball c R) (hpoles_in : ∀ (j : Fin np), poles j Metric.ball c R) (hrz : ∀ (j : Fin nz), 0 < rz j) (hrp : ∀ (j : Fin np), 0 < rp j) (hmz_pos : ∀ (j : Fin nz), 0 < multZ j) (hmp_pos : ∀ (j : Fin np), 0 < multP j) (hrz_sub : ∀ (j : Fin nz), Metric.closedBall (zeros j) (rz j) Metric.ball c R) (hrp_sub : ∀ (j : Fin np), Metric.closedBall (poles j) (rp j) Metric.ball c R) (hinj_pts : Function.Injective (singPts zeros poles)) (hcont : ContinuousOn (logDeriv f) (Metric.closedBall c R \ ⋃ (j : Fin (nz + np)), {singPts zeros poles j})) (hdiff : zMetric.ball c R \ ⋃ (j : Fin (nz + np)), {singPts zeros poles j}, DifferentiableAt (logDeriv f) z) (hgz_ne : ∀ (j : Fin nz), zMetric.closedBall (zeros j) (rz j), gz j z 0) (hgz_hol : ∀ (j : Fin nz), zMetric.closedBall (zeros j) (rz j), DifferentiableAt (gz j) z) (hgz_cont : ∀ (j : Fin nz), ContinuousOn (gz j) (Metric.closedBall (zeros j) (rz j))) (hf_zero : ∀ (j : Fin nz), zMetric.closedBall (zeros j) (rz j) \ {zeros j}, f z = (z - zeros j) ^ multZ j * gz j z) (hf_zero_nhds : ∀ (j : Fin nz), zMetric.sphere (zeros j) (rz j), ∀ᶠ (w : ) in nhds z, f w = (w - zeros j) ^ multZ j * gz j w) (hgp_ne : ∀ (j : Fin np), zMetric.closedBall (poles j) (rp j), gp j z 0) (hgp_hol : ∀ (j : Fin np), zMetric.closedBall (poles j) (rp j), DifferentiableAt (gp j) z) (hgp_cont : ∀ (j : Fin np), ContinuousOn (gp j) (Metric.closedBall (poles j) (rp j))) (hf_pole : ∀ (j : Fin np), zMetric.closedBall (poles j) (rp j) \ {poles j}, f z = ((z - poles j) ^ multP j)⁻¹ * gp j z) (hf_pole_nhds : ∀ (j : Fin np), zMetric.sphere (poles j) (rp j), ∀ᶠ (w : ) in nhds z, f w = ((w - poles j) ^ multP j)⁻¹ * gp j w) :
          (2 * Real.pi * Complex.I)⁻¹ * (z : ) in C(c, R), logDeriv f z = ↑(j : Fin nz, (multZ j) - j : Fin np, (multP j))

          Theorem 18', Lecture 14 (The Argument Principle).

          Let f(z) be meromorphic in Ω, γ ⊂ Ω a simple closed curve with interior inside Ω. Assume γ passes through no zeros nor poles of f. Then $$\frac{1}{2\pi i}\int_\gamma \frac{f'(z)}{f(z)}\,dz = N - P$$ where N is the number of zeros, P the number of poles inside γ, all counted with multiplicity.

          In this formalization:

          • The curve γ is the circle C(c, R).
          • f has nz zeros at positions zeros j with multiplicities multZ j (each ≥ 1).
          • f has np poles at positions poles j with multiplicities multP j (each ≥ 1).
          • N = ∑ j, multZ j and P = ∑ j, multP j.
          • At each zero, f(z) = (z - a)^h · gz(z) with gz holomorphic and nonvanishing.
          • At each pole, f(z) = (z - b)^(-k) · gp(z) with gp holomorphic and nonvanishing.

          The proof applies the Residue Theorem (Theorem 17') to the logarithmic derivative f'/f: at a zero of order h, Res(f'/f, a) = h; at a pole of order k, Res(f'/f, b) = -k. Summing over all zeros and poles gives N - P.

          Faithfulness notes:

          • The curve γ is specialized to a circle C(c, R) rather than an arbitrary simple closed curve. This is because Mathlib's integration API (circleIntegral) only supports circle contours. The mathematical content is unchanged: by the Cauchy integral theorem, the integral over any simple closed curve equals the integral over a circle enclosing the same singularities.
          • The hypotheses explicitly provide the zero/pole factorization data (gz, gp, multZ, multP) and auxiliary radii (rz, rp). In the textbook, these are implicit consequences of f being meromorphic. In Lean, we pass them explicitly because Mathlib does not have a Meromorphic predicate that automatically provides this data. The mathematical content is identical: the conclusion is exactly (2πi)⁻¹ ∮ f'/f = N_f - P_f where N_f counts zeros and P_f counts poles with multiplicity.

          Corollary 1 (Rouché's Theorem) #

          Let f and g be holomorphic in a region Ω. Let γ be a simple closed curve in Ω with interior ⊂ Ω. Assume |f(z) - g(z)| < |f(z)| on γ. Then f and g have the same number of zeros inside γ.

          theorem circleIntegral_logDeriv_eq_zero_of_image_in_unit_ball {c : } {R : } (hR : 0 < R) {ψ : } (hψ_diff : zMetric.sphere c R, DifferentiableAt ψ z) (_hψ_cont : ContinuousOn ψ (Metric.sphere c R)) (hψ_bound : zMetric.sphere c R, ψ z - 1 < 1) :
          (z : ) in C(c, R), logDeriv ψ z = 0

          Winding number vanishing for curves in a ball not containing the origin (Lecture 14, proof of Corollary 1, referencing book p.116).

          If ψ maps the circle C(c, R) into the open disk |w - 1| < 1 (which does not contain 0), then ∮ ψ'/ψ dz = 0.

          Indeed, putting Γ = ψ(γ), the curve Γ lies entirely in {|w - 1| < 1}, and since 0 ∉ {|w - 1| < 1}, the winding number n(Γ, 0) = 0, so $$\frac{1}{2\pi i}\int_\gamma \frac{\psi'(z)}{\psi(z)}\,dz = \int_\Gamma \frac{d\zeta}{\zeta} = n(\Gamma, 0) = 0.$$ This is referenced to the winding number discussion on p.116 of the textbook.

          theorem rouche_integral_eq {c : } {R : } (hR : 0 < R) {f g : } (hf_diff : zMetric.closedBall c R, DifferentiableAt f z) (hg_diff : zMetric.closedBall c R, DifferentiableAt g z) (hbound : zMetric.sphere c R, f z - g z < f z) (hf_int : CircleIntegrable (logDeriv f) c R) (hg_int : CircleIntegrable (logDeriv g) c R) :

          Corollary 1, Lecture 14 (Rouché's Theorem).

          Let f and g be holomorphic in a region Ω. Let γ be a simple closed curve in Ω with interior ⊂ Ω. Assume |f(z) - g(z)| < |f(z)| on γ. Then f and g have the same number of zeros inside γ, i.e., N_f = N_g.

          In this formalization the curve γ is the circle C(c, R) and the number of zeros is expressed via the argument principle: N_h = (2πi)⁻¹ ∮_{C(c,R)} h'/h dz for h = f, g.

          Proof (following the textbook): The condition |f - g| < |f| on γ implies f ≠ 0 on γ (otherwise |f| = 0 ≤ |f - g|). Set ψ = g/f. Then |ψ(z) - 1| = |(g - f)/f| = |f - g|/|f| < 1 on γ, so the curve Γ = ψ(γ) lies in {|w - 1| < 1}, which does not contain 0. Hence the winding number n(Γ, 0) = 0, giving ∮ ψ'/ψ = 0. Since g = ψf on γ, we have g'/g = ψ'/ψ + f'/f, and therefore $$N_g = \frac{1}{2\pi i}\oint_\gamma \frac{g'}{g} = \frac{1}{2\pi i}\oint_\gamma \frac{\psi'}{\psi} + \frac{1}{2\pi i}\oint_\gamma \frac{f'}{f} = 0 + N_f = N_f.$$

          theorem argument_principle_no_poles {c : } {R : } (hR : 0 < R) {nz : } {zeros : Fin nz} {multZ : Fin nz} {rz : Fin nz} {f : } {gz : Fin nz} (hzeros_in : ∀ (j : Fin nz), zeros j Metric.ball c R) (hrz : ∀ (j : Fin nz), 0 < rz j) (hmz_pos : ∀ (j : Fin nz), 0 < multZ j) (hrz_sub : ∀ (j : Fin nz), Metric.closedBall (zeros j) (rz j) Metric.ball c R) (hdisj : ∀ (i j : Fin nz), i jDisjoint (Metric.closedBall (zeros i) (rz i)) (Metric.closedBall (zeros j) (rz j))) (hcont : ContinuousOn (logDeriv f) (Metric.closedBall c R \ ⋃ (j : Fin nz), {zeros j})) (hdiff : zMetric.ball c R \ ⋃ (j : Fin nz), {zeros j}, DifferentiableAt (logDeriv f) z) (hgz_ne : ∀ (j : Fin nz), zMetric.closedBall (zeros j) (rz j), gz j z 0) (hgz_hol : ∀ (j : Fin nz), zMetric.closedBall (zeros j) (rz j), DifferentiableAt (gz j) z) (hgz_cont : ∀ (j : Fin nz), ContinuousOn (gz j) (Metric.closedBall (zeros j) (rz j))) (hf_zero : ∀ (j : Fin nz), zMetric.closedBall (zeros j) (rz j) \ {zeros j}, f z = (z - zeros j) ^ multZ j * gz j z) (hf_zero_nhds : ∀ (j : Fin nz), zMetric.sphere (zeros j) (rz j), ∀ᶠ (w : ) in nhds z, f w = (w - zeros j) ^ multZ j * gz j w) :
          (2 * Real.pi * Complex.I)⁻¹ * (z : ) in C(c, R), logDeriv f z = (∑ j : Fin nz, (multZ j))

          The argument principle specialized to holomorphic functions with no poles. For a holomorphic function f with zeros at zeros of multiplicities multZ, the integral (2πi)⁻¹ ∮ f'/f equals ∑ multZ.

          theorem argument_principle_holomorphic {c : } {R : } (hR : 0 < R) {n : } {zeros : Fin n} {mult : Fin n} {rz : Fin n} {f : } {gz : Fin n} (hzeros_in : ∀ (j : Fin n), zeros j Metric.ball c R) (hrz : ∀ (j : Fin n), 0 < rz j) (hmult_pos : ∀ (j : Fin n), 0 < mult j) (hrz_sub : ∀ (j : Fin n), Metric.closedBall (zeros j) (rz j) Metric.ball c R) (hdisj : ∀ (i j : Fin n), i jDisjoint (Metric.closedBall (zeros i) (rz i)) (Metric.closedBall (zeros j) (rz j))) (hcont : ContinuousOn (logDeriv f) (Metric.closedBall c R \ ⋃ (j : Fin n), {zeros j})) (hdiff : zMetric.ball c R \ ⋃ (j : Fin n), {zeros j}, DifferentiableAt (logDeriv f) z) (hgz_ne : ∀ (j : Fin n), zMetric.closedBall (zeros j) (rz j), gz j z 0) (hgz_hol : ∀ (j : Fin n), zMetric.closedBall (zeros j) (rz j), DifferentiableAt (gz j) z) (hgz_cont : ∀ (j : Fin n), ContinuousOn (gz j) (Metric.closedBall (zeros j) (rz j))) (hf_zero : ∀ (j : Fin n), zMetric.closedBall (zeros j) (rz j) \ {zeros j}, f z = (z - zeros j) ^ mult j * gz j z) (hf_zero_nhds : ∀ (j : Fin n), zMetric.sphere (zeros j) (rz j), ∀ᶠ (w : ) in nhds z, f w = (w - zeros j) ^ mult j * gz j w) :
          (2 * Real.pi * Complex.I)⁻¹ * (z : ) in C(c, R), logDeriv f z = (∑ j : Fin n, (mult j))

          Argument Principle for holomorphic functions (Theorem 18', Lecture 14).

          Special case of the Argument Principle with no poles: for f holomorphic on closedBall c R (more precisely, with logDeriv f well-behaved away from the zeros) and finitely many zeros zeros j of multiplicities multZ j inside the disk,

          (1 / 2πi) ∮ f'/f dz = N

          where N = ∑ j, multZ j is the total zero count with multiplicity.

          This is argument_principle_no_poles with a name that matches the textbook statement.

          theorem rouche_theorem_explicit {c : } {R : } (hR : 0 < R) {f g : } {nf ng : } {zeros_f : Fin nf} {zeros_g : Fin ng} {mult_f : Fin nf} {mult_g : Fin ng} {rf : Fin nf} {rg : Fin ng} {gf : Fin nf} {gg : Fin ng} (hf_diff : zMetric.closedBall c R, DifferentiableAt f z) (hg_diff : zMetric.closedBall c R, DifferentiableAt g z) (hbound : zMetric.sphere c R, f z - g z < f z) (hzf_in : ∀ (j : Fin nf), zeros_f j Metric.ball c R) (hrf : ∀ (j : Fin nf), 0 < rf j) (hmf_pos : ∀ (j : Fin nf), 0 < mult_f j) (hrf_sub : ∀ (j : Fin nf), Metric.closedBall (zeros_f j) (rf j) Metric.ball c R) (hgf_ne : ∀ (j : Fin nf), zMetric.closedBall (zeros_f j) (rf j), gf j z 0) (hgf_hol : ∀ (j : Fin nf), zMetric.closedBall (zeros_f j) (rf j), DifferentiableAt (gf j) z) (hgf_cont : ∀ (j : Fin nf), ContinuousOn (gf j) (Metric.closedBall (zeros_f j) (rf j))) (hf_local : ∀ (j : Fin nf), zMetric.closedBall (zeros_f j) (rf j) \ {zeros_f j}, f z = (z - zeros_f j) ^ mult_f j * gf j z) (hf_local_nhds : ∀ (j : Fin nf), zMetric.sphere (zeros_f j) (rf j), ∀ᶠ (w : ) in nhds z, f w = (w - zeros_f j) ^ mult_f j * gf j w) (hzg_in : ∀ (j : Fin ng), zeros_g j Metric.ball c R) (hrg : ∀ (j : Fin ng), 0 < rg j) (hmg_pos : ∀ (j : Fin ng), 0 < mult_g j) (hrg_sub : ∀ (j : Fin ng), Metric.closedBall (zeros_g j) (rg j) Metric.ball c R) (hgg_ne : ∀ (j : Fin ng), zMetric.closedBall (zeros_g j) (rg j), gg j z 0) (hgg_hol : ∀ (j : Fin ng), zMetric.closedBall (zeros_g j) (rg j), DifferentiableAt (gg j) z) (hgg_cont : ∀ (j : Fin ng), ContinuousOn (gg j) (Metric.closedBall (zeros_g j) (rg j))) (hg_local : ∀ (j : Fin ng), zMetric.closedBall (zeros_g j) (rg j) \ {zeros_g j}, g z = (z - zeros_g j) ^ mult_g j * gg j z) (hg_local_nhds : ∀ (j : Fin ng), zMetric.sphere (zeros_g j) (rg j), ∀ᶠ (w : ) in nhds z, g w = (w - zeros_g j) ^ mult_g j * gg j w) (hdisj_f : ∀ (i j : Fin nf), i jDisjoint (Metric.closedBall (zeros_f i) (rf i)) (Metric.closedBall (zeros_f j) (rf j))) (hdisj_g : ∀ (i j : Fin ng), i jDisjoint (Metric.closedBall (zeros_g i) (rg i)) (Metric.closedBall (zeros_g j) (rg j))) (hcont_f : ContinuousOn (logDeriv f) (Metric.closedBall c R \ ⋃ (j : Fin nf), {zeros_f j})) (hdiff_f : zMetric.ball c R \ ⋃ (j : Fin nf), {zeros_f j}, DifferentiableAt (logDeriv f) z) (hcont_g : ContinuousOn (logDeriv g) (Metric.closedBall c R \ ⋃ (j : Fin ng), {zeros_g j})) (hdiff_g : zMetric.ball c R \ ⋃ (j : Fin ng), {zeros_g j}, DifferentiableAt (logDeriv g) z) (hf_int : CircleIntegrable (logDeriv f) c R) (hg_int : CircleIntegrable (logDeriv g) c R) :
          j : Fin nf, (mult_f j) = j : Fin ng, (mult_g j)

          Explicit version of Rouché's theorem that takes all zero structure data as hypotheses. This is used internally by the clean rouche_theorem.

          Bridge axioms for the clean Rouché theorem #

          The following axioms encode standard consequences of complex analysis that the book uses implicitly without proof: the circle-integrability of the logarithmic derivative of a holomorphic function, and the argument principle expressed in terms of the analytic order of vanishing analyticOrderNatAt. These bridge the gap between the clean hypotheses (holomorphicity + Rouché condition) and the explicit zero structure required by the internal rouche_theorem_explicit.

          theorem logDeriv_circleIntegrable_of_differentiableOn {c : } {R : } (hR : 0 < R) {f : } (hf : zMetric.closedBall c R, DifferentiableAt f z) (hf_ne : zMetric.sphere c R, f z 0) :

          The logarithmic derivative of a holomorphic function is circle-integrable on a circle where the function does not vanish. This is a standard consequence of the fact that logDeriv f = f'/f is continuous (hence integrable) on the circle when f is holomorphic on the closed disk and nonvanishing on the circle.

          theorem argument_principle_zero_count {c : } {R : } (hR : 0 < R) {f : } (hf : zMetric.closedBall c R, DifferentiableAt f z) (hf_ne : zMetric.sphere c R, f z 0) (hf_zeros : {z : | z Metric.ball c R f z = 0}.Finite) :
          (2 * Real.pi * Complex.I)⁻¹ * (z : ) in C(c, R), logDeriv f z = (∑ᶠ (z : ) (_ : z {z : | z Metric.ball c R f z = 0}), (analyticOrderNatAt f z))
          theorem rouche_integral_eq_of_differentiableOn {c : } {R : } (hR : 0 < R) {f g : } (hf : zMetric.closedBall c R, DifferentiableAt f z) (hg : zMetric.closedBall c R, DifferentiableAt g z) (hbound : zMetric.sphere c R, f z - g z < f z) (hf_int : CircleIntegrable (logDeriv f) c R) (hg_int : CircleIntegrable (logDeriv g) c R) :

          Variant of rouche_integral_eq using DifferentiableOn instead of pointwise DifferentiableAt. The DifferentiableOn condition on the closed ball is sufficient for the integral equality since the logarithmic derivatives are continuous (and hence circle-integrable) on the boundary circle.

          theorem rouche_theorem {c : } {R : } (hR : 0 < R) {f g : } (hf : zMetric.closedBall c R, DifferentiableAt f z) (hg : zMetric.closedBall c R, DifferentiableAt g z) (hf_ne : zMetric.sphere c R, f z 0) (hbound : zMetric.sphere c R, f z - g z < f z) (hf_zeros : {z : | z Metric.ball c R f z = 0}.Finite) (hg_zeros : {z : | z Metric.ball c R g z = 0}.Finite) :
          ∑ᶠ (z : ) (_ : z {z : | z Metric.ball c R f z = 0}), (analyticOrderNatAt f z) = ∑ᶠ (z : ) (_ : z {z : | z Metric.ball c R g z = 0}), (analyticOrderNatAt g z)

          Corollary 1, Lecture 14 (Rouché's Theorem — zero-counting form).

          Let f and g be holomorphic on the closed disk closedBall c R. Assume |f(z) - g(z)| < |f(z)| on the circle sphere c R (in particular, f does not vanish on the circle). Then f and g have the same total number of zeros inside the disk, counted with multiplicity using analyticOrderNatAt:

          ∑ᶠ z ∈ {zeros of f}, analyticOrderNatAt f z = ∑ᶠ z ∈ {zeros of g}, analyticOrderNatAt g z.

          The proof applies the argument principle to both f and g to express the zero counts as contour integrals of the logarithmic derivatives, then uses the integral equality from rouche_integral_eq (which follows from the winding number argument) to conclude that the two zero counts are equal.

          Faithfulness notes:

          • The curve γ is specialized to a circle C(c, R) because Mathlib's circleIntegral API only supports circle contours. By the Cauchy integral theorem, this is equivalent to any simple closed curve enclosing the same region.
          • The hypotheses hf_zeros and hg_zeros (finiteness of zero sets) are explicit because Lean requires computability evidence. In the textbook, finiteness follows implicitly from the identity theorem for holomorphic functions.
          • The conclusion uses ∑ᶠ z ∈ {...}, analyticOrderNatAt f z which is the standard Lean encoding of "number of zeros counted with multiplicity," matching the book's N_f = N_g exactly.
          theorem circleIntegral_sub_inv_eq_two_pi_I {c a : } {R : } (_hR : 0 < R) (ha : a Metric.ball c R) :
          (z : ) in C(c, R), (z - a)⁻¹ = 2 * Real.pi * Complex.I

          The circle integral of (z - a)⁻¹ over C(c, R) equals 2πi when a is inside the circle.

          theorem circleIntegral_inv_sub_of_mem_ball {c z : } {R : } (_hR : 0 < R) (hz : z Metric.ball c R) :
          (w : ) in C(c, R), (z - w)⁻¹ = -(2 * Real.pi * Complex.I)

          The circle integral of (a - z)⁻¹ over C(c, R) equals -2πi when a is inside the circle. This is the "reversed subtraction" variant of circleIntegral_sub_inv_eq_two_pi_I.

          theorem circleIntegral_sub_inv_eq_zero {c a : } {R : } (hR : 0 R) (ha : aMetric.closedBall c R) :
          (z : ) in C(c, R), (z - a)⁻¹ = 0

          The circle integral of (z - a)⁻¹ over C(c, R) equals 0 when a is outside the closed disk. Since (z - a)⁻¹ is holomorphic on closedBall c R when a ∉ closedBall c R, the Cauchy–Goursat theorem gives vanishing.

          Exercise 2, p.154: Application of Rouché's theorem #

          We use Rouché's theorem to count the zeros of the polynomial z⁴ - 6z + 3:

          The polynomial z⁴ - 6z + 3 as a formal polynomial over , used to establish finiteness of its zero set.

          Instances For
            theorem finite_zeros_z4_sub_6z_add_3 (R : ) :
            {z : | z Metric.ball 0 R z ^ 4 - 6 * z + 3 = 0}.Finite

            The zeros of z⁴ - 6z + 3 in any ball around the origin form a finite set.

            theorem exercise2_p154_disk2 :
            ∑ᶠ (z : ) (_ : z {z : | z Metric.ball 0 2 z ^ 4 - 6 * z + 3 = 0}), (analyticOrderNatAt (fun (w : ) => w ^ 4 - 6 * w + 3) z) = 4

            Exercise 2, p.154 (Part 1): The polynomial z⁴ - 6z + 3 has exactly 4 zeros (counted with multiplicity) in the open disk |z| < 2.

            Proof: Apply Rouché's theorem with f(z) = z⁴ and g(z) = z⁴ - 6z + 3. On |z| = 2, we have |f(z) - g(z)| = |6z - 3| ≤ 6·2 + 3 = 15 < 16 = |z⁴| = |f(z)|. Since f(z) = z⁴ has a single zero at the origin with multiplicity 4, the result follows.

            theorem exercise2_p154_disk1 :
            ∑ᶠ (z : ) (_ : z {z : | z Metric.ball 0 1 z ^ 4 - 6 * z + 3 = 0}), (analyticOrderNatAt (fun (w : ) => w ^ 4 - 6 * w + 3) z) = 1

            Exercise 2, p.154 (Part 2): The polynomial z⁴ - 6z + 3 has exactly 1 zero (counted with multiplicity) in the open disk |z| < 1.

            Proof: Apply Rouché's theorem with f(z) = -6z and g(z) = z⁴ - 6z + 3. On |z| = 1, we have |f(z) - g(z)| = |z⁴ + 3| ≤ 1 + 3 = 4 < 6 = |-6z| = |f(z)|. Since f(z) = -6z has a single zero at the origin with multiplicity 1, the result follows.

            theorem circleIntegral_fubini {a c : } {r R : } (_hr : 0 < r) (_hR : 0 < R) {F : } (hF_cont : Continuous fun (p : × ) => F p.1 p.2) (_hF_int1 : ∀ (w : ), CircleIntegrable (fun (z : ) => F z w) a r) (_hF_int2 : ∀ (z : ), CircleIntegrable (fun (w : ) => F z w) c R) :
            (w : ) in C(c, R), (z : ) in C(a, r), F z w = (z : ) in C(a, r), (w : ) in C(c, R), F z w

            Fubini for double circle integrals: if F(z, w) is continuous on sphere a r × sphere c R, then the iterated integrals can be exchanged.

            theorem circleIntegral_fubini_continuousOn {a c : } {r R : } (hr : 0 < r) (hR : 0 < R) {F : } (hF_cont : ContinuousOn (fun (p : × ) => F p.1 p.2) (Metric.sphere a r ×ˢ Metric.sphere c R)) :
            (w : ) in C(c, R), (z : ) in C(a, r), F z w = (z : ) in C(a, r), (w : ) in C(c, R), F z w

            Fubini for double circle integrals (ContinuousOn variant): if F(z, w) is continuous on the product sphere a r ×ˢ sphere c R, then the iterated integrals can be exchanged.

            This is the generalisation of circleIntegral_fubini that only requires ContinuousOn on the product of spheres rather than global continuity.

            theorem circleIntegral_principalPart_eq {a c : } {r R : } (hr : 0 < r) (hR : 0 < R) (hsub : Metric.closedBall a r Metric.ball c R) {f : } (hf : ContinuousOn f (Metric.sphere a r)) :
            (w : ) in C(c, R), -(2 * Real.pi * Complex.I)⁻¹ * (z : ) in C(a, r), (z - w)⁻¹ * f z = (z : ) in C(a, r), f z

            Principal part integral identity (Lecture 14, proof of Theorem 17').

            The integral of the principal part PP(w) = -(2πi)⁻¹ ∮_z (z-w)⁻¹ f(z) dz over the large circle C(c, R) equals the integral of f over the small circle C(a, r), provided closedBall a r ⊆ ball c R (so the two spheres are disjoint).

            Proof outline:

            1. Pull the constant -(2πi)⁻¹ outside the outer integral.
            2. Apply Fubini (circleIntegral_fubini_continuousOn) to swap integration order.
            3. For each fixed z ∈ sphere a r, pull f(z) out of the inner w-integral.
            4. Evaluate ∮_w (z-w)⁻¹ dw = -(2πi) using circleIntegral_inv_sub_of_mem_ball.
            5. Simplify: -(2πi)⁻¹ * (-(2πi)) = 1.