{
  "status": "proved",
  "decl": "EuclideanGeometry.pompeiu",
  "lean_source": "import Mathlib.Analysis.Complex.Norm\nimport Mathlib.Analysis.Normed.Affine.Simplex\nimport Mathlib.Geometry.Euclidean.Circumcenter\nimport Mathlib.Tactic.LinearCombination\n\n/-!\n# Pompeiu's theorem\n\nWe compute the Heron polynomial of the three distances in complex coordinates,\nthen use its factorization to obtain the triangle inequalities and the equality case.\n-/\n\nnamespace EuclideanGeometry\n\nopen Complex\n\n/-- The Heron polynomial, with squared lengths as inputs. -/\nprivate def heronPolynomial (a b c : ℝ) : ℝ :=\n  2 * (a * b + b * c + c * a) - (a ^ 2 + b ^ 2 + c ^ 2)\n\nprivate theorem heronPolynomial_factor (a b c : ℝ) :\n    heronPolynomial (a ^ 2) (b ^ 2) (c ^ 2) =\n      (a + b + c) * (b + c - a) * (c + a - b) * (a + b - c) := by\n  unfold heronPolynomial\n  ring\n\nprivate theorem le_add_of_heronPolynomial_nonneg {a b c : ℝ} (hb : 0 ≤ b) (hc : 0 ≤ c)\n    (h : 0 ≤ heronPolynomial (a ^ 2) (b ^ 2) (c ^ 2)) : a ≤ b + c := by\n  by_contra! hlt\n  have hsum : 0 < a + b + c := by linarith\n  have ha' : b + c - a < 0 := by linarith\n  have hb' : 0 < c + a - b := by linarith\n  have hc' : 0 < a + b - c := by linarith\n  rw [heronPolynomial_factor] at h\n  exact (not_lt_of_ge h)\n    (mul_neg_of_neg_of_pos (mul_neg_of_neg_of_pos (mul_neg_of_pos_of_neg hsum ha') hb') hc')\n\nprivate theorem heronPolynomial_normalized (p c o : ℂ)\n    (hc : normSq c = 1) (hc₁ : normSq (c - 1) = 1)\n    (ho₁ : normSq (o - 1) = normSq o) (hoc : normSq (o - c) = normSq o) :\n    heronPolynomial (normSq p) (normSq (p - 1)) (normSq (p - c)) =\n      3 * (normSq (p - o) - normSq o) ^ 2 := by\n  simp only [normSq_apply, sub_re, sub_im, one_re, one_im, sub_zero] at hc hc₁ ho₁ hoc\n  -- The third vertex is at squared distance one from both zero and one.\n  have hcre : c.re = 1 / 2 := by nlinarith only [hc, hc₁]\n  have hcim : c.im ^ 2 = 3 / 4 := by\n    rw [hcre] at hc\n    nlinarith only [hc]\n  -- Equidistance from the vertices determines the center in the same coordinates.\n  have hore : o.re = 1 / 2 := by nlinarith only [ho₁]\n  have hoc' : o.im * c.im = 1 / 4 := by\n    rw [hore, hcre] at hoc\n    nlinarith only [hoc, hcim]\n  have hcim_ne : c.im ≠ 0 := by\n    intro h\n    norm_num [h] at hcim\n  have hoim : o.im = c.im / 3 := by\n    apply mul_right_cancel₀ hcim_ne\n    nlinarith only [hoc', hcim]\n  have hpb : normSq (p - 1) = normSq p + (1 - 2 * p.re) := by\n    simp only [normSq_apply, sub_re, sub_im, one_re, one_im, sub_zero]\n    ring\n  have hpc : normSq (p - c) = normSq p + (1 - p.re - 2 * p.im * c.im) := by\n    simp only [normSq_apply, sub_re, sub_im, hcre]\n    nlinarith only [hcim]\n  have hpo : normSq (p - o) - normSq o = normSq p - p.re - 2 * p.im * c.im / 3 := by\n    simp only [normSq_apply, sub_re, sub_im, hore, hoim]\n    ring\n  rw [hpb, hpc, hpo, normSq_apply]\n  unfold heronPolynomial\n  linear_combination -(16 / 3 : ℝ) * p.im ^ 2 * hcim\n\nprivate theorem heronPolynomial_eq (A B C O P : ℂ) (hAB : A ≠ B)\n    (hCA : dist C A = dist B A) (hCB : dist C B = dist B A)\n    (hOB : dist O B = dist O A) (hOC : dist O C = dist O A) :\n    heronPolynomial (dist P A ^ 2) (dist P B ^ 2) (dist P C ^ 2) =\n      3 * (dist P O ^ 2 - dist O A ^ 2) ^ 2 := by\n  -- Translate A to zero and divide by the directed side from A to B.\n  let d := B - A\n  let f (z : ℂ) := (z - A) / d\n  have hd : d ≠ 0 := sub_ne_zero.mpr hAB.symm\n  have hn : normSq d ≠ 0 := fun h ↦ hd (normSq_eq_zero.mp h)\n  have hA : f A = 0 := by simp [f]\n  have hB : f B = 1 := div_self hd\n  have hscale (z w : ℂ) : normSq (f z - f w) * normSq d = dist z w ^ 2 := by\n    rw [← normSq_mul, dist_eq_norm, Complex.sq_norm, sub_mul]\n    simp only [f, div_mul_cancel₀ _ hd, sub_sub_sub_cancel_right]\n  have hside : normSq d = dist B A ^ 2 := by\n    simpa only [hA, hB, sub_zero, map_one, one_mul] using hscale B A\n  have hc : normSq (f C) = 1 := by\n    apply mul_right_cancel₀ hn\n    simpa only [hA, sub_zero, hCA, ← hside, one_mul] using hscale C A\n  have hc₁ : normSq (f C - 1) = 1 := by\n    apply mul_right_cancel₀ hn\n    simpa only [hB, hCB, ← hside, one_mul] using hscale C B\n  have ho₁ : normSq (f O - 1) = normSq (f O) := by\n    apply mul_right_cancel₀ hn\n    rw [← hB, hscale, ← sub_zero (f O), ← hA, hscale, hOB]\n  have hoc : normSq (f O - f C) = normSq (f O) := by\n    apply mul_right_cancel₀ hn\n    rw [hscale, ← sub_zero (f O), ← hA, hscale, hOC]\n  calc\n    heronPolynomial (dist P A ^ 2) (dist P B ^ 2) (dist P C ^ 2) =\n        heronPolynomial (normSq (f P)) (normSq (f P - 1)) (normSq (f P - f C)) *\n          normSq d ^ 2 := by\n      rw [← hscale P A, ← hscale P B, ← hscale P C, hA, hB, sub_zero]\n      unfold heronPolynomial\n      ring\n    _ = (3 * (normSq (f P - f O) - normSq (f O)) ^ 2) * normSq d ^ 2 := by\n      rw [heronPolynomial_normalized _ _ _ hc hc₁ ho₁ hoc]\n    _ = 3 * (dist P O ^ 2 - dist O A ^ 2) ^ 2 := by\n      rw [← hscale P O, ← hscale O A, hA, sub_zero]\n      ring\n\n/-- **Pompeiu's theorem** (Wikidata Q3534036).\n“ABC is an equilateral triangle of positive side in the Euclidean plane and P is ANY point of\nthe plane. Then PA, PB, PC satisfy the three weak triangle inequalities (they are the sides of a\ntriangle), and all three are strict if and only if P is not on the circumcircle of ABC; on the\ncircumcircle the largest distance equals the sum of the other two (vertices included).”\n\nHere the Euclidean plane is represented by `ℂ`, and `t` is an equilateral triangle.\nThe final disjunction records which distance is the sum of the other two. -/\ntheorem pompeiu (t : Affine.Triangle ℝ ℂ) (ht : t.Equilateral) (P : ℂ) :\n    let a := dist P (t.points 0)\n    let b := dist P (t.points 1)\n    let c := dist P (t.points 2)\n    (a ≤ b + c ∧ b ≤ c + a ∧ c ≤ a + b) ∧\n    ((a < b + c ∧ b < c + a ∧ c < a + b) ↔ P ∉ t.circumsphere) ∧\n    ((a = b + c ∨ b = c + a ∨ c = a + b) ↔ P ∈ t.circumsphere) := by\n  intro a b c\n  have hAB : t.points 0 ≠ t.points 1 := fun h ↦\n    (by decide : (0 : Fin 3) ≠ 1) (t.independent.injective h)\n  have hCA : dist (t.points 2) (t.points 0) = dist (t.points 1) (t.points 0) :=\n    ht.dist_eq (by decide) (by decide)\n  have hCB : dist (t.points 2) (t.points 1) = dist (t.points 1) (t.points 0) :=\n    ht.dist_eq (by decide) (by decide)\n  have hheron : heronPolynomial (a ^ 2) (b ^ 2) (c ^ 2) =\n      3 * (dist P t.circumcenter ^ 2 - t.circumradius ^ 2) ^ 2 := by\n    simpa only [t.dist_circumcenter_eq_circumradius'] using\n      heronPolynomial_eq _ _ _ t.circumcenter P hAB hCA hCB\n        (by simp) (by simp)\n  have hnonneg : 0 ≤ heronPolynomial (a ^ 2) (b ^ 2) (c ^ 2) := by\n    rw [hheron]\n    positivity\n  have ha : a ≤ b + c := le_add_of_heronPolynomial_nonneg dist_nonneg dist_nonneg hnonneg\n  have hb : b ≤ c + a := by\n    apply le_add_of_heronPolynomial_nonneg dist_nonneg dist_nonneg\n    convert hnonneg using 1\n    unfold heronPolynomial\n    ring\n  have hc : c ≤ a + b := by\n    apply le_add_of_heronPolynomial_nonneg dist_nonneg dist_nonneg\n    convert hnonneg using 1\n    unfold heronPolynomial\n    ring\n  have hsum : a + b + c ≠ 0 := by\n    have hab : 0 < dist (t.points 0) (t.points 1) := dist_pos.mpr hAB\n    have hab' : dist (t.points 0) (t.points 1) ≤ a + b := by\n      simpa only [dist_comm (t.points 0) P] using dist_triangle (t.points 0) P (t.points 1)\n    have hc₀ : 0 ≤ c := dist_nonneg\n    apply ne_of_gt\n    linarith\n  have heq : (a = b + c ∨ b = c + a ∨ c = a + b) ↔\n      heronPolynomial (a ^ 2) (b ^ 2) (c ^ 2) = 0 := by\n    rw [heronPolynomial_factor]\n    simp only [mul_eq_zero, hsum, false_or, sub_eq_zero, @eq_comm ℝ (b + c) a,\n      @eq_comm ℝ (c + a) b, @eq_comm ℝ (a + b) c, or_assoc]\n  have hzero : heronPolynomial (a ^ 2) (b ^ 2) (c ^ 2) = 0 ↔ P ∈ t.circumsphere := by\n    simp [hheron, mem_sphere, sub_eq_zero, sq_eq_sq₀ dist_nonneg t.circumradius_nonneg]\n  have hdegen := heq.trans hzero\n  refine ⟨⟨ha, hb, hc⟩, ?_, hdegen⟩\n  rw [← hdegen, not_or, not_or]\n  exact ⟨fun h ↦ ⟨ne_of_lt h.1, ne_of_lt h.2.1, ne_of_lt h.2.2⟩,\n    fun h ↦ ⟨lt_of_le_of_ne ha h.1, lt_of_le_of_ne hb h.2.1, lt_of_le_of_ne hc h.2.2⟩⟩\n\nend EuclideanGeometry\n\n#print axioms EuclideanGeometry.pompeiu\n",
  "build_output": "'EuclideanGeometry.pompeiu' depends on axioms: [propext, Classical.choice, Quot.sound]\n",
  "explanation": "Let ABC be an equilateral triangle of positive side length, and let P be any point of the complex plane. The distances PA, PB and PC satisfy all three weak triangle inequalities. All three are strict exactly off the circumcircle. On the circumcircle at least one of the distances equals the sum of the other two, so that distance is a largest one. This also covers a vertex, where one distance is zero and the two other distances are equal.\n\nTranslate A to zero and divide by B − A to send B to one. If y is the imaginary coordinate of the image of C, equal side lengths give its real coordinate as 1/2 and y² = 3/4. The image of the circumcenter is equidistant from the three vertices, which forces its coordinates to be (1/2, y/3). Expand the squared distances in these coordinates and scale back to the original triangle. For a = PA², b = PB² and c = PC² the identity is 2(ab+bc+ca) − (a²+b²+c²) = 3(PO²−R²)², where O is the circumcenter and R the circumradius. Both sides scale by the fourth power of the side length when the normalization is undone.\n\nThe left side factors as the perimeter times the three differences between the sum of two distances and the third. The perimeter is positive because P cannot coincide with both A and B. If one difference were negative, the other two would be positive by nonnegativity of distances, making the product negative. The square on the right rules that out. With all three differences nonnegative, one is zero exactly when the product is zero. The square vanishes exactly when PO = R because both are nonnegative. This gives both directions of the strictness and equality characterizations.",
  "fidelity": {
    "triangle_and_plane": "Affine.Triangle ℝ ℂ supplies three affinely independent points in the Euclidean complex plane. t.Equilateral imposes equal edge lengths. Distinctness gives a positive common side length. Conversely any positive equilateral triple is affinely independent because three distinct collinear points have one distance equal to the sum of the other two, which is impossible for three equal positive distances. There is no orientation hypothesis.",
    "all_points": "P is an unrestricted argument of type ℂ, including interior and exterior points, the center, all points on the circle, and the vertices.",
    "weak_inequalities": "The first conjunct states PA ≤ PB + PC, PB ≤ PC + PA, and PC ≤ PA + PB for all P.",
    "strict_iff": "The second conjunct states the conjunction of all three strict inequalities iff P ∉ t.circumsphere. This is Mathlib's circumsphere of t, a circle in ℂ whose membership is equality of the distance to t.circumcenter with t.circumradius.",
    "degeneracy_iff_and_vertices": "The third conjunct states PA = PB + PC or PB = PC + PA or PC = PA + PB iff P ∈ t.circumsphere. A distance satisfying one of these equalities is maximal because the summands are nonnegative. Mathlib's Affine.Simplex.mem_circumsphere puts every vertex on this circle, so ties at vertices are included.",
    "local_verification": "Lean 4.36.0, Mathlib fc4f59e577feb1a4956671bc04ac18aaaf8cd842. Both downloaded archives matched their SHA-256 values in fetch.json. The file compiled using the prebuilt libraries with lean -DautoImplicit=false -DwarningAsError=true Pompeiu.lean. The compiler exited 0 and printed only the permitted axiom list.",
    "independent_verification": "UNVERIFIED. The build and clause-by-clause review were performed locally by the implementing agent."
  },
  "prior_work": {
    "checked_on": "2026-11-26",
    "mathlib_master": {
      "urls": [
        "https://codeload.github.com/leanprover-community/mathlib4/tar.gz/refs/heads/master",
        "https://raw.githubusercontent.com/leanprover-community/mathlib4/master/docs/1000.yaml",
        "https://leanprover-community.github.io/1000-missing.html",
        "https://leanprover-community.github.io/1000.html",
        "https://loogle.lean-lang.org/json?q=%22Pompeiu%22"
      ],
      "finding": "Searched the downloaded master snapshot's Mathlib and docs directories for Pompeiu, Pompeïu and Q3534036. The only match was the title-only Q3534036 record in docs/1000.yaml. The missing page lists it and the finished page has no Pompeiu entry. Loogle's name search for Pompeiu returned zero declarations."
    },
    "mathlib_pr_queue": {
      "urls": [
        "https://api.github.com/search/issues?q=repo%3Aleanprover-community%2Fmathlib4+is%3Apr+is%3Aopen+Pompeiu",
        "https://api.github.com/search/issues?q=repo%3Aleanprover-community%2Fmathlib4+is%3Apr+is%3Aopen+Pompe%C3%AFu",
        "https://api.github.com/search/issues?q=repo%3Aleanprover-community%2Fmathlib4+is%3Apr+Q3534036"
      ],
      "finding": "GitHub's issue search returned zero results for open Mathlib PRs mentioning Pompeiu or Pompeïu and for Mathlib PRs of any status mentioning Q3534036."
    },
    "github": {
      "urls": [
        "https://api.github.com/search/issues?q=Pompeiu%20%22equilateral%22%20Lean",
        "https://api.github.com/search/commits?q=Pompeiu%20equilateral",
        "https://api.github.com/search/issues?q=Pompeiu%20circumcircle%20Lean",
        "https://api.github.com/search/issues?q=%22van%20Schooten%22%20circumcircle%20Lean",
        "https://github.com/rjwalters/lean-genius/pull/25024",
        "https://api.github.com/repos/rjwalters/lean-genius/pulls/25024",
        "https://raw.githubusercontent.com/rjwalters/lean-genius/482da62461a4c5e6ff770aa1f6f8e91155444de7/proofs/Proofs/PompeiuTheorem.lean",
        "https://api.github.com/repos/rjwalters/lean-genius/pulls/25027",
        "https://api.github.com/repos/rjwalters/lean-genius/pulls/25029",
        "https://github.com/rjwalters/lean-genius/pull/25007",
        "https://github.com/search?q=Pompeiu%20language%3ALean&type=code"
      ],
      "finding": "Confirmed prior public Lean code for the weak inequalities. Lean Genius PR #25024 was merged on 2026-06-16. Its declaration PompeiuTheorem.pompeiu at the merge commit states three weak inequalities. The circumcircle claim appears in its module prose only. Closed, unmerged PRs #25027 and #25029 describe inequality proofs. The circumcircle-specific query found only the Lean Genius candidate-seeding PR #25007, whose text describes the full target. The van Schooten query returned zero results. GitHub code search required sign-in. Public issue and commit searches and inspection of the merge-commit declaration revealed no Lean proof of the full vetted statement. The proof in this item was developed independently against Mathlib."
    },
    "lean_zulip": {
      "urls": [
        "https://leanprover-community.github.io/archive/",
        "https://codeload.github.com/leanprover-community/archive/tar.gz/refs/heads/main",
        "https://raw.githubusercontent.com/leanprover-community/archive/4a4a212bfcfdc1bd0bc5c675224bb8476fc6a5b7/zulip_json/610393-Tau-Ceti/PRs.json",
        "https://github.com/TauCetiProject/TauCeti/pull/14348",
        "https://leanprover.zulipchat.com/#narrow/search/Pompeiu"
      ],
      "finding": "Searched the public Lean Zulip archive's downloaded JSON messages for Pompeiu, Pompeïu, Q3534036 and Schooten. The Pompeiu hits concerned the Cauchy–Pompeiu integral formula and related Cauchy-transform work, including Tau Ceti PR #14348. No equilateral-triangle formalization was found in the archive. Live Zulip message search required authentication."
    },
    "priority": "UNVERIFIED for the full vetted statement. Prior Lean formalization of the weak inequalities is confirmed."
  },
  "database_entry": {
    "wikidata_id": "Q3534036",
    "title": "Pompeiu's theorem",
    "declaration": "EuclideanGeometry.pompeiu",
    "file": "Pompeiu.lean",
    "yaml": "Q3534036:\n  title: Pompeiu's theorem\n  decl: EuclideanGeometry.pompeiu\n"
  },
  "stuck": null,
  "sources": [
    "https://leanprover-community.github.io/1000-missing.html",
    "https://leanprover-community.github.io/1000.html",
    "https://api.github.com/search/issues?q=Pompeiu%20circumcircle%20Lean",
    "https://ictp.acad.ro/some-remarks-on-a-theorem-of-m-d-pompeiu/",
    "https://raw.githubusercontent.com/leanprover-community/mathlib4/master/docs/1000.yaml",
    "https://api.github.com/search/issues?q=repo%3Aleanprover-community%2Fmathlib4+is%3Apr+is%3Aopen+Pompeiu",
    "https://api.github.com/search/issues?q=repo%3Aleanprover-community%2Fmathlib4+is%3Apr+is%3Aopen+Pompe%C3%AFu",
    "https://api.github.com/search/issues?q=repo%3Aleanprover-community%2Fmathlib4+is%3Apr+Q3534036",
    "https://api.github.com/search/issues?q=Pompeiu%20%22equilateral%22%20Lean",
    "https://api.github.com/repos/rjwalters/lean-genius/pulls/25024",
    "https://raw.githubusercontent.com/rjwalters/lean-genius/482da62461a4c5e6ff770aa1f6f8e91155444de7/proofs/Proofs/PompeiuTheorem.lean",
    "https://api.github.com/repos/rjwalters/lean-genius/pulls/25027",
    "https://api.github.com/repos/rjwalters/lean-genius/pulls/25029",
    "https://raw.githubusercontent.com/leanprover-community/archive/4a4a212bfcfdc1bd0bc5c675224bb8476fc6a5b7/zulip_json/610393-Tau-Ceti/PRs.json",
    "https://github.com/TauCetiProject/TauCeti/pull/14348",
    "https://raw.githubusercontent.com/leanprover-community/mathlib4/fc4f59e577feb1a4956671bc04ac18aaaf8cd842/Mathlib/Basic/Complex/Basic.lean",
    "https://raw.githubusercontent.com/leanprover-community/mathlib4/fc4f59e577feb1a4956671bc04ac18aaaf8cd842/Mathlib/Analysis/Normed/Affine/Simplex.lean",
    "https://raw.githubusercontent.com/leanprover-community/mathlib4/fc4f59e577feb1a4956671bc04ac18aaaf8cd842/Mathlib/Geometry/Euclidean/Circumcenter.lean",
    "https://loogle.lean-lang.org/json?q=Complex.normSq_mul",
    "https://github.com/Identity-md/lean-bundles/releases/download/pequalnp-e125f04d0dc6/fetch.json"
  ],
  "triage": [
    {
      "target": "Pompeiu's theorem (equilateral triangle)",
      "wikidata_id": "Q3534036",
      "statement": "For a positive-side equilateral triangle ABC and any planar P, each of PA, PB and PC is at most the sum of the other two. All three inequalities are strict iff P is off the circumcircle. On the circumcircle a largest distance equals the sum of the other two, including at vertices.",
      "proof_and_length": "The Heron-polynomial coordinate argument takes about one page on paper (estimate). Normalize A and B to 0 and 1, find the coordinates of C and O from their prescribed distances, expand and rescale the identity, then read the signs and the vanishing from its factored form. The complete file is 178 lines.",
      "mathlib_available": "Affine.Triangle, Affine.Simplex.Equilateral and Equilateral.dist_eq supply the geometry of the input. Affine.Simplex.circumsphere, dist_circumcenter_eq_circumradius', circumradius_nonneg and EuclideanGeometry.mem_sphere supply the circle. Complex.normSq_apply, Complex.normSq_mul, Complex.sq_norm and sq_eq_sq₀ supply the coordinate and real-square steps. The pinned sources were searched locally, and Loogle confirmed Complex.normSq_mul and the circumcenter distance lemma. Moogle did not return a search result at the attempted endpoints.",
      "missing": "The link between the Heron polynomial and the square of the power of P with respect to the circumcircle, together with the algebraic sign and zero-factor consequences. Only local helpers are needed.",
      "grade": "A"
    }
  ]
}
