Planar general-position primitives #
Original copyright: Copyright 2025 The Formal Conjectures Authors. These Apache-2.0 definitions were copied verbatim from the formal-conjectures support library.
A small set of planar-geometry predicates that the
Elekes–Sharir / Guth–Katz base reduction layer (namespace Esgk) consumes.
None of these exist in mathlib v4.30 — they are originals from the
formal-conjectures
support layer (FormalConjecturesForMathlib/Geometry/2d.lean and
.../Data/Set/Triplewise.lean, Apache 2.0), copied verbatim and given a
permanent home here so the project stays mathlib-only with no cross-version
dependency.
What they are built on — Collinear, EuclideanGeometry.Cospherical,
EuclideanSpace ℝ (Fin 2) — are mathlib citizens; only the predicates
themselves (Set.Triplewise, NonTrilinear, distinctDistances,
InGeneralPosition) and the ℝ² notation are formal-conjectures-specific.
Provided here:
- the
ℝ²notation (scoped toEuclideanGeometry); Set.Triplewise— a ternary "holds on all distinct triples of a set" relation;NonTrilinear— no three points of a set are collinear;distinctDistances— the number of distinct pairwise distances of a finite set;InGeneralPosition— no three collinear and no four cocircular.
The earlier FormalConjectures/Util.lean shim hosted these alongside the
answer( … ) / category / AMS macro-and-attribute machinery and the
vendored Erdős problem statements (96/97/98). Those statements have been
removed (formal-conjectures now tracks mathlib v4.30 directly), and the dead
ConvexIndep / unitDistancePairsCount / bare Triplewise defs and the shim
machinery went with them; only the live primitives survive here.
ℝ² notation (verbatim: FormalConjecturesForMathlib/Geometry/2d.lean) #
The Euclidean plane over the real numbers.
Equations
- EuclideanGeometry.«termℝ²» = Lean.ParserDescr.node `EuclideanGeometry.«termℝ²» 1024 (Lean.ParserDescr.symbol "ℝ²")
Instances For
Planar geometry (verbatim: FormalConjecturesForMathlib/Geometry/2d.lean) #
We say a subset A of points in the plane is non-trilinear
if it contains no three points that lie on the same line.
Equations
- EuclideanGeometry.NonTrilinear A = A.Triplewise fun (x y z : P) => ¬Collinear ℝ {x, y, z}
Instances For
Given a finite set of points in the plane, we define the number of distinct distances between pairs of points.
Equations
- EuclideanGeometry.distinctDistances points = (Finset.image (fun (pair : EuclideanSpace ℝ (Fin 2) × EuclideanSpace ℝ (Fin 2)) => dist pair.1 pair.2) points.offDiag).card
Instances For
A collection $x_1, \dots, x_n\in\mathbb{R}^2$ is in general position if no three are collinear and no four lie on a circle.
Equations
- EuclideanGeometry.InGeneralPosition X = (EuclideanGeometry.NonTrilinear ↑X ∧ ∀ T ⊆ X, T.card = 4 → ¬EuclideanGeometry.Cospherical ↑T)