{
  "status": "proved",
  "decl": "Complex.casorati_weierstrass",
  "lean_source": "import Mathlib.Analysis.Complex.CauchyIntegral\nimport Mathlib.Analysis.Meromorphic.Basic\n\nopen Filter Metric Set\nopen scoped Topology\n\nnamespace Complex\n\n/-- **Casorati–Weierstrass theorem** (Wikidata Q2226962).\n\"If a function is holomorphic on a punctured disc and has an essential singularity at its\ncenter, its image on every concentric punctured disc of positive radius at most the original\nradius is dense in the complex plane.\"\n\nFor a holomorphic punctured germ, being meromorphic at the center means it is removable or\nhas a pole. Indeed, after multiplication by a sufficiently large power of `z - c` the germ\nextends analytically. Its power series is either zero or has a first nonzero term. Subtracting\nthe exponent of the multiplier from the order of this term gives a nonnegative order in the\nremovable case and a negative order in the pole case. Conversely an analytic extension or a\npole can be made analytic by such multiplication. This condition depends only on the germ\naway from the center. -/\ntheorem casorati_weierstrass {f : ℂ → ℂ} {c : ℂ} {R r : ℝ}\n    (hf : DifferentiableOn ℂ f (ball c R \\ {c})) (hess : ¬ MeromorphicAt f c)\n    (hr : 0 < r) (hrR : r ≤ R) :\n    Dense (f '' (ball c r \\ {c})) := by\n  rw [Metric.dense_iff]\n  intro w ε hε\n  by_contra hmiss\n  have hbound (z : ℂ) (hz : z ∈ ball c r \\ {c}) : ε ≤ ‖f z - w‖ := by\n    by_contra! hlt\n    exact hmiss ⟨f z, by simpa only [mem_ball, dist_eq_norm] using hlt, mem_image_of_mem f hz⟩\n  have hne (z : ℂ) (hz : z ∈ ball c r \\ {c}) : f z - w ≠ 0 := by\n    intro heq\n    simpa [heq, not_le.mpr hε] using hbound z hz\n  let H (z : ℂ) := (z - c) ^ 2 / (f z - w)\n  have hHc : H c = 0 := by simp [H]\n  have hderiv : HasDerivAt H 0 c := by\n    rw [hasDerivAt_iff_tendsto_slope, Metric.tendsto_nhdsWithin_nhds]\n    intro δ hδ\n    refine ⟨min r (δ * ε), lt_min hr (mul_pos hδ hε), ?_⟩\n    intro z hz hzc\n    have hzr : z ∈ ball c r \\ {c} :=\n      ⟨(lt_min_iff.mp hzc).1, hz⟩\n    have hsub : z - c ≠ 0 := sub_ne_zero.mpr hz\n    have hslope : slope H c z = (z - c) / (f z - w) := by\n      rw [slope_def_field, hHc, sub_zero]\n      dsimp [H]\n      field_simp [hsub, hne z hzr]\n    rw [hslope, dist_zero_right, norm_div, div_lt_iff₀ (hε.trans_le (hbound z hzr))]\n    rw [dist_eq_norm] at hzc\n    exact (lt_min_iff.mp hzc).2.trans_le (mul_le_mul_of_nonneg_left (hbound z hzr) hδ.le)\n  have hdiff : DifferentiableOn ℂ H (ball c r) := by\n    intro z hz\n    by_cases hzc : z = c\n    · subst z\n      exact hderiv.differentiableAt.differentiableWithinAt\n    · have hzf : z ∈ ball c R \\ {c} := ⟨ball_subset_ball hrR hz, hzc⟩\n      have hfz : DifferentiableAt ℂ f z :=\n        hf.differentiableAt ((isOpen_ball.sdiff isClosed_singleton).mem_nhds hzf)\n      exact (((differentiableAt_id.sub_const c).pow 2).div\n        (hfz.sub_const w) (hne z ⟨hz, hzc⟩)).differentiableWithinAt\n  have hHa : AnalyticAt ℂ H c := hdiff.analyticAt (ball_mem_nhds c hr)\n  have hnum : AnalyticAt ℂ (fun z : ℂ ↦ (z - c) ^ 2) c := by fun_prop\n  have hm : MeromorphicAt (fun z ↦ w + (z - c) ^ 2 / H z) c :=\n    (MeromorphicAt.const w c).add (hnum.meromorphicAt.div hHa.meromorphicAt)\n  apply hess (hm.congr ?_)\n  filter_upwards [mem_nhdsWithin_of_mem_nhds (ball_mem_nhds c hr),\n    self_mem_nhdsWithin] with z hzr hzc\n  have hsub : z - c ≠ 0 := sub_ne_zero.mpr hzc\n  have hden : f z - w ≠ 0 := hne z ⟨hzr, hzc⟩\n  dsimp [H]\n  field_simp\n  ring\n\nend Complex\n\n#print axioms Complex.casorati_weierstrass\n",
  "build_output": "'Complex.casorati_weierstrass' depends on axioms: [propext, Classical.choice, Quot.sound]\n",
  "explanation": "For any radius r with 0 < r ≤ R, every open target disc intersects the image of the punctured r-disc. If a disc of radius ε about w were missed, |f(z) − w| would be at least ε throughout the punctured r-disc. Set H(z) = (z − c)²/(f(z) − w). This formula gives H(c) = 0 even if f(c) = w, since division in Lean is total. Away from c, H is complex differentiable by the quotient rule. At c, the difference quotient has norm at most |z − c|/ε, so H has derivative zero there. Complex differentiability on the whole open disc gives analyticity at c. On the punctured disc, f(z) = w + (z − c)²/H(z), a meromorphic germ by the closure properties of MeromorphicAt. This contradicts essentiality. The proof does not use the removable-singularity theorem.",
  "fidelity": {
    "domain": "An arbitrary complex center c and a function f : ℂ → ℂ. The set ball c R minus {c} is exactly 0 < |z − c| < R.",
    "holomorphic": "DifferentiableOn ℂ f on that open set expresses complex differentiability at each point of the punctured disc.",
    "essential": "The hypothesis is ¬ MeromorphicAt f c. The docstring explains the removable-or-pole classification by the order of an analytic germ after multiplication by a power of z − c. Mathlib meromorphy depends only on the punctured germ, so f(c) is unrestricted.",
    "radii": "r is arbitrary with 0 < r and r ≤ R, including r = R. These hypotheses also imply 0 < R.",
    "conclusion": "Dense (f applied to the punctured r-disc) gives approximation of every complex target to arbitrary positive accuracy. It does not assert that every target is attained.",
    "verification": "Checked locally against Lean 4.36.0 and the checksum-verified prebuilt Mathlib bundle at fc4f59e577feb1a4956671bc04ac18aaaf8cd842 with autoImplicit=false. Independent clean-clone rebuild and fidelity review by another agent: UNVERIFIED."
  },
  "prior_work": [
    {
      "urls": [
        "https://leanprover-community.github.io/1000-missing.html",
        "https://leanprover-community.github.io/1000.html",
        "https://raw.githubusercontent.com/leanprover-community/mathlib4/e54979a532247ae4eb9d5578a8fd40a1bc332101/docs/1000.yaml",
        "https://github.com/leanprover-community/mathlib4/tree/e54979a532247ae4eb9d5578a8fd40a1bc332101/Mathlib"
      ],
      "finding": "Q2226962 is listed as missing and is absent from the finished page. At the sampled Mathlib master commit e54979a532247ae4eb9d5578a8fd40a1bc332101, docs/1000.yaml has a title-only record. A case-insensitive search of Mathlib sources found no Casorati, Q2226962 or essential singularity matches."
    },
    {
      "urls": [
        "https://api.github.com/search/issues?q=repo%3Aleanprover-community%2Fmathlib4+is%3Apr+is%3Aopen+Casorati",
        "https://api.github.com/search/issues?q=repo%3Aleanprover-community%2Fmathlib4+is%3Apr+is%3Aopen+%22essential+singularity%22"
      ],
      "finding": "GitHub issue search returned zero open Mathlib PRs for each of Casorati and the phrase essential singularity. Differently titled or unindexed work remains UNVERIFIED."
    },
    {
      "urls": [
        "https://api.github.com/search/repositories?q=Casorati+language%3ALean",
        "https://api.github.com/search/code?q=Casorati+language%3ALean",
        "https://github.com/papanokechi/pcf-casoratian-lean"
      ],
      "finding": "GitHub repository search for Casorati filtered to Lean returned one result about a Casoratian closed form. Indexed web searches using the theorem name and Lean also found no proof. GitHub code search required authentication, so exhaustive public code coverage is UNVERIFIED."
    },
    {
      "urls": [
        "https://leanprover-community.github.io/archive/stream/116395-maths/topic/Multivariate.20complex.20analysis.html"
      ],
      "finding": "The public Lean Zulip archive mentions the theorem in a preliminary complex analysis list whose author had not checked which results already existed. The mention supplies no Lean declaration or proof."
    }
  ],
  "database_entry": {
    "wikidata_id": "Q2226962",
    "title": "Weierstrass–Casorati theorem",
    "decl": "Complex.casorati_weierstrass",
    "file": "CasoratiWeierstrass.lean"
  },
  "stuck": null,
  "sources": [
    "https://leanprover-community.github.io/1000-missing.html",
    "https://leanprover-community.github.io/1000.html",
    "https://raw.githubusercontent.com/leanprover-community/mathlib4/e54979a532247ae4eb9d5578a8fd40a1bc332101/docs/1000.yaml",
    "https://leanprover-community.github.io/archive/stream/116395-maths/topic/Multivariate.20complex.20analysis.html",
    "https://api.github.com/search/issues?q=repo%3Aleanprover-community%2Fmathlib4+is%3Apr+is%3Aopen+Casorati",
    "https://api.github.com/search/issues?q=repo%3Aleanprover-community%2Fmathlib4+is%3Apr+is%3Aopen+%22essential+singularity%22",
    "https://api.github.com/search/repositories?q=Casorati+language%3ALean",
    "https://api.github.com/search/code?q=Casorati+language%3ALean",
    "https://raw.githubusercontent.com/leanprover-community/mathlib4/fc4f59e577feb1a4956671bc04ac18aaaf8cd842/Mathlib/Analysis/Meromorphic/Basic.lean",
    "https://raw.githubusercontent.com/leanprover-community/mathlib4/fc4f59e577feb1a4956671bc04ac18aaaf8cd842/Mathlib/Analysis/Complex/CauchyIntegral.lean",
    "https://github.com/Identity-md/lean-bundles/releases/download/pequalnp-e125f04d0dc6/fetch.json"
  ]
}
