{
  "verdict": "pass",
  "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",
  "source_sha256": "32f7dc3209cc721457470f4746500f4c8f997550f4cfe8ee0665f2fe325c2154",
  "build_output": "'Complex.casorati_weierstrass' depends on axioms: [propext, Classical.choice, Quot.sound]\n",
  "fidelity_review": {
    "conclusion": "PASS. The elaborated theorem is Casorati–Weierstrass in exactly the vetted disc formulation, without extra assumptions or a weakened conclusion.",
    "clauses": [
      {
        "clause": "Ambient objects and quantification",
        "assessment": "PASS. f : ℂ → ℂ, c : ℂ and R r : ℝ are arbitrary implicit arguments. There are no hidden typeclass hypotheses or local replacement definitions. A function defined only on the punctured disc can be extended arbitrarily outside it to this total-function representation."
      },
      {
        "clause": "Holomorphic domain",
        "assessment": "PASS. DifferentiableOn ℂ f (Metric.ball c R \\ {c}) is complex differentiability throughout the open punctured disc. In the complex metric, membership is precisely z ≠ c and ‖z-c‖ < R, equivalently 0 < |z-c| < R. The domain is open, so differentiability within it gives ordinary complex differentiability there."
      },
      {
        "clause": "Essential singularity and the center value",
        "assessment": "PASS. The hypothesis is literally ¬ MeromorphicAt f c. Mathlib defines meromorphy by analyticity after multiplication by some natural power of z-c. MeromorphicAt.congr, meromorphicAt_congr and update_iff in the pinned Basic.lean show that only the punctured germ matters; no continuity or prescribed value at c is assumed. The submitted docstring gives the requested removable-or-pole justification. For a complex holomorphic punctured germ, the analytic numerator either vanishes identically nearby or has a first nonzero power-series term. In the first case the singularity is removable. Otherwise subtracting the damping exponent from that finite order yields either an analytic extension or a pole. Conversely removable germs are meromorphic by congruence and analyticAt.meromorphicAt; a finite-order pole becomes analytic after multiplication by its order. The pinned Order.lean corroborates this using MeromorphicAt.meromorphicOrderAt_nonneg_iff and tendsto_cobounded_of_meromorphicOrderAt_neg. Thus the hypothesis means neither removable nor a pole.",
        "sources": [
          "https://raw.githubusercontent.com/leanprover-community/mathlib4/fc4f59e577feb1a4956671bc04ac18aaaf8cd842/Mathlib/Analysis/Meromorphic/Basic.lean",
          "https://raw.githubusercontent.com/leanprover-community/mathlib4/fc4f59e577feb1a4956671bc04ac18aaaf8cd842/Mathlib/Analysis/Meromorphic/Order.lean"
        ]
      },
      {
        "clause": "Positive original and smaller radii",
        "assessment": "PASS. The assumptions 0 < r and r ≤ R imply 0 < R. Quantification over arbitrary r includes every requested 0 < r ≤ R and includes r = R. No shrinkage factor, extra upper bound or fixed radius occurs."
      },
      {
        "clause": "Conclusion",
        "assessment": "PASS. Dense (f '' (Metric.ball c r \\ {c})) is density of the image in the ambient complex plane. The proof rewrites Metric.dense_iff and considers arbitrary target w : ℂ and ε > 0. It establishes intersection with every target ball, not surjectivity or density merely in some restricted codomain."
      },
      {
        "clause": "Satisfiable hypotheses and nonvacuity",
        "assessment": "PASS by independent mathematical review. For any c and R > 0 take f(z) = Complex.exp ((z-c)⁻¹), with any assigned value at c. It is holomorphic off c. Along z=c+t as t decreases to zero its modulus tends to infinity; along z=c-t it tends to zero. It therefore has neither a finite removable limit nor a pole. This witness does not invoke Casorati–Weierstrass. The witness argument was reviewed mathematically; a separate Lean existence lemma was not compiled."
      },
      {
        "clause": "Proof integrity",
        "assessment": "PASS. The submitted file only imports the two specified Mathlib modules and proves the theorem; it introduces no axiom or altered global definition. Token review found no sorry, admit, native_decide or axiom command. The independent compiler reported exactly the three permitted axioms and no sorryAx, errors or warnings."
      }
    ],
    "independent_type_check": {
      "status": "PASS",
      "method": "A separate scratch audit file reproduced the unchanged submission and then type-checked its use against the exact vetted signature with autoImplicit=false. It compiled with exit 0.",
      "output": "'Complex.casorati_weierstrass' depends on axioms: [propext, Classical.choice, Quot.sound]\n@Complex.casorati_weierstrass : ∀ {f : ℂ → ℂ} {c : ℂ} {R r : ℝ},\n  DifferentiableOn ℂ f (ball c R \\ {c}) → ¬MeromorphicAt f c → 0 < r → r ≤ R → Dense (f '' (ball c r \\ {c}))\n"
    },
    "review_basis": "Independent inspection of the submitted source, the elaborated signature, the compiler axiom output and the pinned Mathlib definitions; the original worker's claimed build was not used as verification evidence."
  },
  "prior_work": [
    {
      "search": "Community missing and finished lists",
      "urls": [
        "https://leanprover-community.github.io/1000-missing.html",
        "https://leanprover-community.github.io/1000.html"
      ],
      "finding": "Q2226962 appears on the missing page as Weierstrass–Casorati theorem. A case-insensitive scan of the finished page found no Casorati or Q2226962 entry. The missing page itself allows that an existing formalization may simply be unrecorded; list membership alone does not establish priority."
    },
    {
      "search": "Mathlib master source and database",
      "urls": [
        "https://api.github.com/repos/leanprover-community/mathlib4/commits/e54979a532247ae4eb9d5578a8fd40a1bc332101",
        "https://raw.githubusercontent.com/leanprover-community/mathlib4/e54979a532247ae4eb9d5578a8fd40a1bc332101/docs/1000.yaml",
        "https://codeload.github.com/leanprover-community/mathlib4/tar.gz/e54979a532247ae4eb9d5578a8fd40a1bc332101"
      ],
      "finding": "Independently resolved master to e54979a532247ae4eb9d5578a8fd40a1bc332101 (commit timestamp 2026-11-26T12:14:34Z), downloaded that exact source archive, and searched its complete Mathlib directory case-insensitively for casorati, Q2226962 and essential.singular. No matches. Also searched for Dense.*[Mm]eromorphic and [Mm]eromorphic.*Dense, with no matches. docs/1000.yaml has only the title for Q2226962, without decl/decls or a proof link. An equivalent unnamed theorem under unrelated wording is UNVERIFIED."
    },
    {
      "search": "Open Mathlib PRs: Casorati",
      "urls": [
        "https://api.github.com/search/issues?q=repo%3Aleanprover-community%2Fmathlib4+is%3Apr+is%3Aopen+Casorati"
      ],
      "finding": "GitHub API returned total_count 0, incomplete_results false."
    },
    {
      "search": "Open Mathlib PRs: exact phrase essential singularity",
      "urls": [
        "https://api.github.com/search/issues?q=repo%3Aleanprover-community%2Fmathlib4+is%3Apr+is%3Aopen+%22essential+singularity%22"
      ],
      "finding": "GitHub API returned total_count 0, incomplete_results false."
    },
    {
      "search": "Open Mathlib PRs: exact phrase essential singularities",
      "urls": [
        "https://api.github.com/search/issues?q=repo%3Aleanprover-community%2Fmathlib4+is%3Apr+is%3Aopen+%22essential+singularities%22"
      ],
      "finding": "GitHub API returned total_count 0, incomplete_results false."
    },
    {
      "search": "Broader open Mathlib PR metadata: meromorphic",
      "urls": [
        "https://api.github.com/search/issues?q=repo%3Aleanprover-community%2Fmathlib4+is%3Apr+is%3Aopen+meromorphic&per_page=100"
      ],
      "finding": "Retrieved all 86 results with per_page=100. No Casorati or essential-singularity phrase occurred in their titles or bodies. This is a metadata check, not a review of all code on every PR branch."
    },
    {
      "search": "Related isolated-singularity/residue PR #29588",
      "urls": [
        "https://api.github.com/repos/leanprover-community/mathlib4/pulls/29588",
        "https://api.github.com/repos/leanprover-community/mathlib4/pulls/29588/files?per_page=100"
      ],
      "finding": "Reviewed the PR description and complete one-file patch: 383 additions in Mathlib/Analysis/Complex/Residue/Basic.lean. It defines isolated/removable singularities and residues, proves radius independence, zero residues for holomorphic functions, and a simple-pole residue formula. There is no Casorati, Dense/dense or closure occurrence in the patch and no image-density theorem. It does not duplicate this result."
    },
    {
      "search": "GitHub public code search: Casorati language:Lean",
      "urls": [
        "https://api.github.com/search/code?q=Casorati+language%3ALean"
      ],
      "finding": "UNVERIFIED. The API returned HTTP 401, Requires authentication. No authenticated search was available; this failure is not evidence of absence."
    },
    {
      "search": "GitHub public code search: essential singularity language:Lean",
      "urls": [
        "https://api.github.com/search/code?q=%22essential+singularity%22+language%3ALean"
      ],
      "finding": "UNVERIFIED. The API returned HTTP 401, Requires authentication."
    },
    {
      "search": "GitHub repository search: Casorati language:Lean",
      "urls": [
        "https://api.github.com/search/repositories?q=Casorati+language%3ALean",
        "https://api.github.com/repos/papanokechi/pcf-casoratian-lean"
      ],
      "finding": "One result, papanokechi/pcf-casoratian-lean. Its repository description concerns Theorem 6.3, a Casoratian closed form, rather than Casorati–Weierstrass. No matching formalization was identified. Repository-name/description search does not replace code search."
    },
    {
      "search": "Public Lean Zulip archive, theorem-name search and thread review",
      "urls": [
        "https://leanprover-community.github.io/archive/stream/116395-maths/topic/Multivariate.20complex.20analysis.html"
      ],
      "finding": "The indexed public archive thread Multivariate complex analysis mentions Casorati–Weierstrass on January 20, 2026 in a preliminary list explicitly not checked for existing results. It supplies no proof or Lean declaration for this theorem. Complete live/private/unindexed Zulip coverage is UNVERIFIED."
    }
  ],
  "explanation": "Suppose the image misses a ball of radius ε > 0 around w. Then |f(z)-w| ≥ ε throughout the punctured smaller disc. Define H(z)=(z-c)²/(f(z)-w). Total division makes H(c)=0. Off c the quotient rule gives complex differentiability, since the denominator cannot vanish. At c the slope is (z-c)/(f(z)-w), whose norm is at most |z-c|/ε, so the derivative is zero. Thus H is holomorphic on the whole smaller disc and analytic at c. On its puncture the nonzero numerator and denominator give f(z)=w+(z-c)²/H(z). A quotient of analytic germs is meromorphic, and meromorphy depends only on the punctured germ. This contradicts ¬ MeromorphicAt f c. Every positive target ball therefore intersects the image, which is exactly density.",
  "database_entry": {
    "wikidata_id": "Q2226962",
    "title": "Weierstrass–Casorati theorem",
    "decl": "Complex.casorati_weierstrass",
    "file": "CasoratiWeierstrass.lean",
    "yaml": "Q2226962:\n  title: Weierstrass–Casorati theorem\n  decl: Complex.casorati_weierstrass\n",
    "note": "The named Lean file is reproducible byte-for-byte from lean_source. The YAML declaration is ready for use after upstreaming; no public upstream proof URL or author identity is invented."
  },
  "repairs": [],
  "verification": {
    "checked_at_utc": "2026-11-26T13:13:22.741095+00:00",
    "input_artifact_sha256": "aa23db96f70c2449d513ac3df89f629ff172370f84111764e38195fc4a82c3df",
    "source_unchanged": true,
    "source_bytes": 3528,
    "lean_version": "Lean 4.36.0, x86_64-unknown-linux-gnu, commit 611c117bfaf7b7ae1cfcf246ce6fba31e8f509e9, Release",
    "mathlib_commit": "fc4f59e577feb1a4956671bc04ac18aaaf8cd842",
    "setup": "Fresh scratch extraction of both specified prebuilt bundles; checked SHA-256 of each complete archive against fetch.json before use. Retried Lean extraction with --no-same-owner because this sandbox cannot set the archive uid/gid. The successful extraction completed without error. No Lake command was run and Mathlib was not built from source. The two directly imported Mathlib sources, and Order.lean used for review, matched the pinned raw GitHub files byte-for-byte.",
    "bundles": [
      {
        "name": "lean-4.36.0-linux.tar.zst",
        "sha256": "2b7ab1ed8b92d2e6abfaf41344823b510064dbc9c0260cac73eb496ab2dea6eb",
        "verified": true
      },
      {
        "name": "pequalnp-e125f04d0dc6-packages-lean-4.36.0-linux-x64.tar.zst",
        "sha256": "69b68c745d0bd8dba3ab21966f8cdb14f9373bd4f1df1d17680f4b80dad98a88",
        "verified": true
      }
    ],
    "compile_command": "export PATH=\"$(ls -d D/lean/*/bin | head -n1):$PATH\" LEAN_PATH=\"$(ls -d D/pk/*/.lake/build/lib/lean | paste -sd: -)\" && lean -DautoImplicit=false CasoratiWeierstrass.lean",
    "compiler_exit_code": 0,
    "elapsed_seconds": 11.407,
    "axioms": [
      "propext",
      "Classical.choice",
      "Quot.sound"
    ],
    "errors": 0,
    "warnings": 0,
    "clean_source_compile": "The exact source was written to a new scratch file and elaborated against freshly downloaded prebuilt dependencies, without reusing any output from the proof worker.",
    "limits": [
      "UNVERIFIED: global first-formalization priority, because authenticated GitHub code search and exhaustive live Zulip search were unavailable. No prior Lean formalization was found in the checks described above.",
      "UNVERIFIED: compilation against a newer Mathlib master rather than the task-specified prebuilt fc4f59e bundle."
    ]
  },
  "sources": [
    "https://api.imd.fun/artifacts/aa23db96f70c2449d513ac3df89f629ff172370f84111764e38195fc4a82c3df",
    "https://github.com/Identity-md/lean-bundles/releases/download/pequalnp-e125f04d0dc6/fetch.json",
    "https://raw.githubusercontent.com/leanprover-community/mathlib4/fc4f59e577feb1a4956671bc04ac18aaaf8cd842/Mathlib/Analysis/Meromorphic/Basic.lean",
    "https://raw.githubusercontent.com/leanprover-community/mathlib4/fc4f59e577feb1a4956671bc04ac18aaaf8cd842/Mathlib/Analysis/Meromorphic/Order.lean",
    "https://raw.githubusercontent.com/leanprover-community/mathlib4/fc4f59e577feb1a4956671bc04ac18aaaf8cd842/Mathlib/Analysis/Complex/CauchyIntegral.lean",
    "https://leanprover-community.github.io/1000-missing.html",
    "https://leanprover-community.github.io/1000.html",
    "https://api.github.com/repos/leanprover-community/mathlib4/commits/e54979a532247ae4eb9d5578a8fd40a1bc332101",
    "https://raw.githubusercontent.com/leanprover-community/mathlib4/e54979a532247ae4eb9d5578a8fd40a1bc332101/docs/1000.yaml",
    "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/issues?q=repo%3Aleanprover-community%2Fmathlib4+is%3Apr+is%3Aopen+%22essential+singularities%22",
    "https://api.github.com/search/code?q=Casorati+language%3ALean",
    "https://api.github.com/search/code?q=%22essential+singularity%22+language%3ALean",
    "https://api.github.com/search/repositories?q=Casorati+language%3ALean",
    "https://api.github.com/repos/papanokechi/pcf-casoratian-lean",
    "https://leanprover-community.github.io/archive/stream/116395-maths/topic/Multivariate.20complex.20analysis.html",
    "https://api.github.com/repos/leanprover-community/mathlib4/pulls/29588",
    "https://api.github.com/repos/leanprover-community/mathlib4/pulls/29588/files?per_page=100",
    "https://api.github.com/search/issues?q=repo%3Aleanprover-community%2Fmathlib4+is%3Apr+is%3Aopen+meromorphic&per_page=100"
  ]
}
