modules

geometor.poincare

GEOMETOR • Poincaré: Bilingual La Science et l’Hypothèse Codex & Exact Hyperbolic Disk Engine.

Combines a synchronized 4-track Digital Scriptorium Book Codex (English · French (1902) · Summary · Notes) of Henri Poincaré’s La Science et l’Hypothèse (1902 / 1905) with 100% exact SymPy + geometor.model straightedge-and-compass constructions in the Poincaré Conformal Hyperbolic Disk Model.

Submodules

Attributes

CODEX_UNITS

construct_saccheri_triangle_defect

FIGURE_SPECS

render_figure_svg

__version__

Classes

CodexAuditReport

Summary of verified codex witnesses, apparatus registries, figures, and 4-track units.

BeltramiKleinBridgeResult

Exact straightedge correspondence between Poincaré conformal arcs & Beltrami–Klein chords.

DedekindCutResult

Exact model for Unit 1: Dedekind continuum cut (\(\sqrt{2}/2\)) & rational thresholds.

HeatedDiskResult

Exact model for Unit 3: Poincaré's Heated Disk optical rays & isothermals (Ch. IV).

HyperbolicGeodesic

Exact hyperbolic geodesic in the Poincaré Conformal Disk \(\mathbb{D}\).

HyperbolicMetricReport

Exact cross-ratio and Rational Hyperbolic Quadrance invariants for \(P, Q \in \mathbb{D}\).

IdealTriangleResult

Exact Pythagorean ideal hyperbolic triangle on \(\partial\Omega\) with \(0^\circ\) angles.

SaccheriDefectResult

Exact rational hyperbolic right-triangle & Saccheri quadrilateral defect proof.

StellarParallaxResult

Exact model for Unit 4: Stellar parallax triangle & Poincaré conventionalism (Ch. V § 3).

UltraparallelPencil

Hyperbolic parallel & ultraparallel pencil demonstrating Postulate V independence.

Functions

audit_codex_repository([repo_root]) → CodexAuditReport

Audit all primary witnesses, apparatus JSONs, 8 SVGs, and 16 4-track unit RST files.

compile_apparatus_rst([repo_root]) → list[pathlib.Path]

Compile concordance.rst, bibliography.rst, persons.rst, and glossary.rst.

default_repo_root() → pathlib.Path

Return the root directory of geometor/poincare.

load_concordance([repo_root]) → dict[str, Any]

Load resources/science_and_hypothesis/concordance.json.

load_sources_manifest([repo_root]) → dict[str, Any]

Load resources/science_and_hypothesis/sources_manifest.json.

verify_sources_manifest([repo_root]) → list[dict[str, Any]]

Verify SHA-256 digests and byte counts of all archival witness files.

construct_beltrami_klein_bridge([model]) → BeltramiKleinBridgeResult

Construct the exact Weierstrass radial projection \(K(P) = \frac{2P}{1 + \|P\|^2}\).

construct_dedekind_continuum_cut([model]) → DedekindCutResult

Construct the incommensurable diagonal-circle Dedekind cut for Chs. I–II.

construct_heated_disk_optical_rays([model]) → HeatedDiskResult

Construct Poincaré's Heated-Disk optical world (\(T \propto 1 - r^2,\; n \propto (1-r^2)^{-1}\)).

construct_hyperbolic_geodesic(model, P, Q, *[, ...]) → HyperbolicGeodesic

Construct the unique hyperbolic geodesic through \(P, Q \in \overline{\mathbb{D}}\).

construct_ideal_hyperbolic_triangle([model]) → IdealTriangleResult

Construct the exact rational ideal hyperbolic triangle on \(U_1, U_2, U_3 \in \partial\Omega\).

construct_inversion_in_horizon(model, P, *[, label]) → sympy.geometry.Point2D

Construct the exact Euclidean inverse \(P^* = P / \|P\|^2\) in \(\Omega: x^2+y^2=1\).

construct_saccheri_triangleDefect([model]) → SaccheriDefectResult

Construct an exact hyperbolic right triangle & Saccheri quadrilateral proving defect > 0.

construct_stellar_parallax_conventionalism([model]) → StellarParallaxResult

Construct Poincaré's astronomical parallax triangle (Ch. V, Experience and Geometry).

construct_ultraparallels_through_point([model, L_hyp, P]) → UltraparallelPencil

Construct two limiting horoparallels and two ultraparallels to L_hyp through P.

construct_unit_horizon(model) → tuple[sympy.geometry.Point2D, sympy.geometry.Point2D, sympy.geometry.Circle]

Ensure the unit horizon circle \(\Omega: x^2 + y^2 = 1\) exists in model.

euclidean_tangent_at_circle_point(model, circle, ...) → sympy.geometry.Line2D

Construct the Euclidean tangent line to circle at boundary point pt_on_circle.

hyperbolic_cross_ratio_and_quadrance(P, Q[, U, V]) → HyperbolicMetricReport

Compute the exact algebraic cross-ratio and Wildberger's Rational Hyperbolic Quadrance.

export_all_codex_figures(output_dir) → list[pathlib.Path]

Generate and write all 8 standalone .euclid-graphic SVGs into output_dir.

render_codex_figure(filename) → str

Render one of the 8 canonical .euclid-graphic codex figures by filename.

Package Contents

geometor.poincare.CODEX_UNITS: tuple[str, ...] = ('unit-1-number-and-magnitude', 'unit-2-non-euclidean-geometries', 'unit-3-space-and-geometry',...
class geometor.poincare.CodexAuditReport

Summary of verified codex witnesses, apparatus registries, figures, and 4-track units.

witness_count: int
concordance_entries: int
dictionary_rows: int
persons_count: int
citations_count: int
glossary_count: int
figure_count: int
unit_track_files: int
geometor.poincare.audit_codex_repository(repo_root: pathlib.Path | None = None) → CodexAuditReport

Audit all primary witnesses, apparatus JSONs, 8 SVGs, and 16 4-track unit RST files.

Parameters:

repo_root – Optional repository root path.

Returns:

Verified CodexAuditReport.

Raises:
  • FileNotFoundError – If any expected codex track or SVG figure is missing.

  • ValueError – If any :layout: book file embeds a .. py_file:: script.

geometor.poincare.compile_apparatus_rst(repo_root: pathlib.Path | None = None) → list[pathlib.Path]

Compile concordance.rst, bibliography.rst, persons.rst, and glossary.rst.

Parameters:

repo_root – Optional repository root path.

Returns:

List of generated .rst paths under docsrc/science_and_hypothesis/.

geometor.poincare.default_repo_root() → pathlib.Path

Return the root directory of geometor/poincare.

geometor.poincare.load_concordance(repo_root: pathlib.Path | None = None) → dict[str, Any]

Load resources/science_and_hypothesis/concordance.json.

geometor.poincare.load_sources_manifest(repo_root: pathlib.Path | None = None) → dict[str, Any]

Load resources/science_and_hypothesis/sources_manifest.json.

geometor.poincare.verify_sources_manifest(repo_root: pathlib.Path | None = None) → list[dict[str, Any]]

Verify SHA-256 digests and byte counts of all archival witness files.

Parameters:

repo_root – Optional repository root path.

Returns:

List of verified witness records.

Raises:
  • FileNotFoundError – If any witness file is missing.

  • ValueError – If a SHA-256 digest or byte count mismatches sources_manifest.json.

class geometor.poincare.BeltramiKleinBridgeResult

Exact straightedge correspondence between Poincaré conformal arcs & Beltrami–Klein chords.

model: geometor.model.Model
poincare_geodesic: HyperbolicGeodesic
beltrami_klein_chord: sympy.geometry.Line2D
poincare_points: tuple[sympy.geometry.Point2D, sympy.geometry.Point2D]
klein_points: tuple[sympy.geometry.Point2D, sympy.geometry.Point2D]
class geometor.poincare.DedekindCutResult

Exact model for Unit 1: Dedekind continuum cut (\(\sqrt{2}/2\)) & rational thresholds.

model: geometor.model.Model
cut_point: sympy.geometry.Point2D
lower_rational: sympy.geometry.Point2D
upper_rational: sympy.geometry.Point2D
class geometor.poincare.HeatedDiskResult

Exact model for Unit 3: Poincaré’s Heated Disk optical rays & isothermals (Ch. IV).

model: geometor.model.Model
source: sympy.geometry.Point2D
isothermals: tuple[sympy.geometry.Circle, sympy.geometry.Circle, sympy.geometry.Circle]
light_rays: tuple[HyperbolicGeodesic, HyperbolicGeodesic, HyperbolicGeodesic, HyperbolicGeodesic]
class geometor.poincare.HyperbolicGeodesic

Exact hyperbolic geodesic in the Poincaré Conformal Disk \(\mathbb{D}\).

Supports both named attribute inspection (.carrier, .U, .V, .ideal_points) and 3-tuple unpacking carrier, U, V = geodesic. Stores the underlying spg.Line2D diameter or orthogonal spg.Circle carrier, ordered ideal horizon endpoints (U, V), optional inverse point \(P^*\), Euclidean circle center, squared radius \(r^2 = |OC|^2 - 1\), and exact orthogonality residual \(|OC|^2 - r^2 - 1 = 0\).

carrier: sympy.geometry.Line2D | sympy.geometry.Circle
U: sympy.geometry.Point2D
V: sympy.geometry.Point2D
inverse_point: sympy.geometry.Point2D | None = None
is_diameter: bool = False
center: sympy.geometry.Point2D | None = None
radius_squared: sympy.Expr | None = None
orthogonality_residual: sympy.Expr
property ideal_points: tuple[sympy.geometry.Point2D, sympy.geometry.Point2D]

Return ordered ideal boundary endpoints (U, V) on \(\partial\Omega\).

__iter__() → collections.abc.Iterator[sympy.geometry.Line2D | sympy.geometry.Circle | sympy.geometry.Point2D]

Yield (carrier, U, V) for ergonomic tuple unpacking.

class geometor.poincare.HyperbolicMetricReport

Exact cross-ratio and Rational Hyperbolic Quadrance invariants for \(P, Q \in \mathbb{D}\).

Unites Poincaré’s cross-ratio logarithmic distance with Norman Wildberger’s transcendental-free Universal Hyperbolic Geometry (UHG) and Cayley–Klein quadrances:

  • cross_ratio: \(\chi(P, Q; U, V) = \frac{|PV|\cdot|QU|}{|PU|\cdot|QV|} \ge 1\)

  • cross_ratio_squared: \(\chi^2(P, Q; U, V) = \frac{Q(P,V)\,Q(Q,U)}{Q(P,U)\,Q(Q,V)}\)

  • poincare_distance: \(d_{\mathbb{H}}(P, Q) = \ln \chi(P, Q; U, V)\)

  • conformal_quadrance: \(\tau(P, Q) = \frac{\|P-Q\|^2}{\|1 - \bar{P}Q\|^2} = \left(\frac{\chi-1}{\chi+1}\right)^2 \in [0, 1)\)

  • wildberger_uhg_quadrance: \(q_{\text{UHG}}(P, Q) = -\frac{4\tau}{(1-\tau)^2} = -\sinh^2 d_{\mathbb{H}}(P, Q) \in \mathbb{Q}(P, Q)\)

  • cayley_klein_quadrance: \(q_{\text{CK}}(P, Q) = \frac{4\tau}{(1+\tau)^2} = \tanh^2 d_{\mathbb{H}}(P, Q) \in [0, 1)\)

  • isometric_delta: \(\delta(P, Q) = \frac{2\|P-Q\|^2}{(1-\|P\|^2)(1-\|Q\|^2)} = \cosh d_{\mathbb{H}}(P, Q) - 1\)

cross_ratio: sympy.Expr
cross_ratio_squared: sympy.Expr
poincare_distance: sympy.Expr
conformal_quadrance: sympy.Expr
wildberger_uhg_quadrance: sympy.Expr
cayley_klein_quadrance: sympy.Expr
isometric_delta: sympy.Expr
class geometor.poincare.IdealTriangleResult

Exact Pythagorean ideal hyperbolic triangle on \(\partial\Omega\) with \(0^\circ\) angles.

model: geometor.model.Model
vertices: tuple[sympy.geometry.Point2D, sympy.geometry.Point2D, sympy.geometry.Point2D]
sides: tuple[HyperbolicGeodesic, HyperbolicGeodesic, HyperbolicGeodesic]
centers: tuple[sympy.geometry.Point2D, sympy.geometry.Point2D, sympy.geometry.Point2D]
radii: tuple[sympy.Rational, sympy.Rational, sympy.Rational]
vertex_spreads: tuple[sympy.Expr, sympy.Expr, sympy.Expr]
angular_defect: sympy.Expr
class geometor.poincare.SaccheriDefectResult

Exact rational hyperbolic right-triangle & Saccheri quadrilateral defect proof.

model: geometor.model.Model
triangle_vertices: tuple[sympy.geometry.Point2D, sympy.geometry.Point2D, sympy.geometry.Point2D]
triangle_hypotenuse: HyperbolicGeodesic
triangle_spreads: tuple[sympy.Expr, sympy.Expr, sympy.Expr]
triangle_defect: sympy.Expr
saccheri_vertices: tuple[sympy.geometry.Point2D, sympy.geometry.Point2D, sympy.geometry.Point2D, sympy.geometry.Point2D]
saccheri_base: HyperbolicGeodesic
saccheri_legs: tuple[HyperbolicGeodesic, HyperbolicGeodesic]
saccheri_summit: HyperbolicGeodesic
saccheri_base_spreads: tuple[sympy.Expr, sympy.Expr]
saccheri_summit_spreads: tuple[sympy.Expr, sympy.Expr]
saccheri_leg_uhg_quadrances: tuple[sympy.Expr, sympy.Expr]
saccheri_defect: sympy.Expr
class geometor.poincare.StellarParallaxResult

Exact model for Unit 4: Stellar parallax triangle & Poincaré conventionalism (Ch. V § 3).

model: geometor.model.Model
stars: tuple[sympy.geometry.Point2D, sympy.geometry.Point2D, sympy.geometry.Point2D]
lobachevsky_rays: tuple[HyperbolicGeodesic, HyperbolicGeodesic, HyperbolicGeodesic]
euclidean_chords: tuple[sympy.geometry.Line2D, sympy.geometry.Line2D, sympy.geometry.Line2D]
class geometor.poincare.UltraparallelPencil

Hyperbolic parallel & ultraparallel pencil demonstrating Postulate V independence.

model: geometor.model.Model
base_geodesic: HyperbolicGeodesic
point: sympy.geometry.Point2D
limiting_parallels: tuple[HyperbolicGeodesic, HyperbolicGeodesic]
ultraparallels: tuple[HyperbolicGeodesic, HyperbolicGeodesic]
geometor.poincare.construct_beltrami_klein_bridge(model: geometor.model.Model | None = None) → BeltramiKleinBridgeResult

Construct the exact Weierstrass radial projection \(K(P) = \frac{2P}{1 + \|P\|^2}\).

geometor.poincare.construct_dedekind_continuum_cut(model: geometor.model.Model | None = None) → DedekindCutResult

Construct the incommensurable diagonal-circle Dedekind cut for Chs. I–II.

geometor.poincare.construct_heated_disk_optical_rays(model: geometor.model.Model | None = None) → HeatedDiskResult

Construct Poincaré’s Heated-Disk optical world (\(T \propto 1 - r^2,\; n \propto (1-r^2)^{-1}\)).

geometor.poincare.construct_hyperbolic_geodesic(model: geometor.model.Model, P: sympy.geometry.Point2D, Q: sympy.geometry.Point2D, *, classes: list[str] | None = None, label: str | None = None) → HyperbolicGeodesic

Construct the unique hyperbolic geodesic through \(P, Q \in \overline{\mathbb{D}}\).

Implements Poincaré’s Translation Dictionary (La Science et l’Hypothèse, Ch. III):

  • When \(O, P, Q\) are collinear, constructs the Euclidean diameter line \(PQ\) and intersects it with \(\Omega\) to obtain antipodal ideal points \(U, V\).

  • When \(O, P, Q\) are non-collinear and at least one point lies strictly inside \(\mathbb{D}\), constructs its horizon inverse \(P^* = P / \|P\|^2\) and circumscribes the unique Euclidean circle through \((P, Q, P^*)\). By power-of-a-point (\(|OP|\cdot|OP^*| = 1 = R_\Omega^2\)), this circle cuts \(\Omega\) orthogonally at two exact ideal points \(U, V \in \partial\Omega\).

  • When both \(P\) and \(Q\) lie on \(\partial\Omega\) (ideal geodesic), intersects the Euclidean horizon tangents at \(P\) and \(Q\) to locate the exact orthogonal circle center \(C\).

Parameters:
  • model – Active geometor.model.Model.

  • P – First point in \(\overline{\mathbb{D}}\).

  • Q – Second distinct point in \(\overline{\mathbb{D}}\).

  • classes – Optional CSS/semantic class tags for the constructed geodesic element.

  • label – Optional identifier for the constructed geodesic element.

Returns:

Populated HyperbolicGeodesic dataclass (unpackable as (carrier, U, V)).

Raises:
  • TypeError – If P or Q contains floating-point coordinates.

  • ValueError – If P == Q or either point lies outside \(\overline{\mathbb{D}}\).

geometor.poincare.construct_ideal_hyperbolic_triangle(model: geometor.model.Model | None = None) → IdealTriangleResult

Construct the exact rational ideal hyperbolic triangle on \(U_1, U_2, U_3 \in \partial\Omega\).

Uses Pythagorean horizon points \(U_1 = (1, 0)\), \(U_2 = (-\frac{3}{5}, \frac{4}{5})\), and \(U_3 = (-\frac{3}{5}, -\frac{4}{5})\). Every side is an orthogonal Euclidean circle with 100% rational center and rational radius:

  • \(C_{12} = (1, 2),\; r_{12} = 2\)

  • \(C_{13} = (1, -2),\; r_{13} = 2\)

  • \(C_{23} = (-\frac{5}{3}, 0),\; r_{23} = \frac{4}{3}\)

Meeting tangentially along radii \(OU_1, OU_2, OU_3\) with interior spreads (0, 0, 0) (\(0^\circ\) angle sum, maximal Gauss–Bonnet defect \(\pi\)).

Parameters:

model – Optional geometor.model.Model (created if None).

Returns:

Verified IdealTriangleResult.

geometor.poincare.construct_inversion_in_horizon(model: geometor.model.Model, P: sympy.geometry.Point2D, *, label: str | None = None) → sympy.geometry.Point2D

Construct the exact Euclidean inverse \(P^* = P / \|P\|^2\) in \(\Omega: x^2+y^2=1\).

Uses pure straightedge-and-compass geometry inside model:

  • If \(P \in \partial\Omega\) (\(\|P\|^2 = 1\)), returns \(P\) itself.

  • If \(0 < \|P\|^2 < 1\) (\(P \in \mathbb{D} \setminus \{O\}\)), erects the chord perpendicular to \(OP\) at \(P\) meeting \(\Omega\) at \(T_1\), then intersects the horizon tangent at \(T_1\) with ray \(OP\) (Euclid VI.8: \(|OP|\cdot|OP^*| = |OT_1|^2 = 1\)).

  • If \(\|P\|^2 > 1\), constructs the Thales circle on diameter \(OP\) meeting \(\Omega\) at \(T_1, T_2\) and intersects polar chord \(T_1 T_2\) with \(OP\).

Parameters:
  • model – Active geometor.model.Model.

  • P – Exact non-origin point spg.Point2D.

  • label – Optional label for the constructed inverse point P*.

Returns:

Exact inverse point \(P^*\) satisfying \(Q(O, P) \cdot Q(O, P^*) = 1\).

Raises:
  • TypeError – If P contains floating-point coordinates.

  • ValueError – If P coincides with the horizon center O = (0, 0).

geometor.poincare.construct_saccheri_triangle_defect
geometor.poincare.construct_saccheri_triangleDefect(model: geometor.model.Model | None = None) → SaccheriDefectResult

Construct an exact hyperbolic right triangle & Saccheri quadrilateral proving defect > 0.

Parameters:

model – Optional geometor.model.Model (created if None).

Returns:

Verified SaccheriDefectResult with 100% rational spreads and quadrances.

geometor.poincare.construct_stellar_parallax_conventionalism(model: geometor.model.Model | None = None) → StellarParallaxResult

Construct Poincaré’s astronomical parallax triangle (Ch. V, Experience and Geometry).

geometor.poincare.construct_ultraparallels_through_point(model: geometor.model.Model | None = None, L_hyp: HyperbolicGeodesic | sympy.geometry.Circle | sympy.geometry.Line2D | None = None, P: sympy.geometry.Point2D | None = None) → UltraparallelPencil

Construct two limiting horoparallels and two ultraparallels to L_hyp through P.

Demonstrates inside geometor.model that Euclid’s Fifth Postulate fails in the Poincaré disk while Postulates I–IV (in Poincaré’s dictionary) hold identically: through a single point \(P \notin L_{\text{hyp}}\), infinitely many hyperbolic lines fail to meet \(L_{\text{hyp}}\).

Parameters:
  • model – Optional geometor.model.Model (created if None).

  • L_hyp – Reference hyperbolic geodesic (or its Circle/Line2D carrier). If omitted, constructs the rational geodesic with ideal endpoints \((\frac{4}{5}, -\frac{3}{5})\) and \((-\frac{4}{5}, -\frac{3}{5})\).

  • P – Exterior point in \(\mathbb{D} \setminus L_{\text{hyp}}\). Defaults to \((\frac{1}{6}, \frac{2}{5})\).

Returns:

Verified UltraparallelPencil with exact disjointness over \(\overline{\mathbb{D}}\).

geometor.poincare.construct_unit_horizon(model: geometor.model.Model) → tuple[sympy.geometry.Point2D, sympy.geometry.Point2D, sympy.geometry.Circle]

Ensure the unit horizon circle \(\Omega: x^2 + y^2 = 1\) exists in model.

Parameters:

model – Active geometor.model.Model (recommended auto_intersect=False).

Returns:

Tuple (O, Ex, Omega) consisting of center O = (0, 0), horizon unit point Ex = (1, 0), and Euclidean unit circle Omega.

geometor.poincare.euclidean_tangent_at_circle_point(model: geometor.model.Model, circle: sympy.geometry.Circle, pt_on_circle: sympy.geometry.Point2D) → sympy.geometry.Line2D

Construct the Euclidean tangent line to circle at boundary point pt_on_circle.

Parameters:
  • model – Active geometor.model.Model.

  • circle – Circle element whose center is registered or constructible in model.

  • pt_on_circle – Point lying on circle.

Returns:

Exact spg.Line2D tangent to circle at pt_on_circle.

geometor.poincare.hyperbolic_cross_ratio_and_quadrance(P: sympy.geometry.Point2D, Q: sympy.geometry.Point2D, U: sympy.geometry.Point2D | None = None, V: sympy.geometry.Point2D | None = None) → HyperbolicMetricReport

Compute the exact algebraic cross-ratio and Wildberger’s Rational Hyperbolic Quadrance.

Eliminates transcendental logarithms for algebraic comparison while verifying the exact polynomial bridge \((1 - \tau)^2 (\chi^2 + 1)^2 = 4 (1 + \tau)^2 \chi^2\) between the 4-point circle chord cross-ratio \(\chi(P, Q; U, V)\) and the purely rational conformal/UHG quadrances over \(\mathbb{Q}\).

Parameters:
  • P – First interior point \(P \in \mathbb{D}\).

  • Q – Second interior point \(Q \in \mathbb{D}\).

  • U – First ideal endpoint on \(\partial\Omega\) (constructed automatically if None).

  • V – Second ideal endpoint on \(\partial\Omega\) (constructed automatically if None).

Returns:

Populated HyperbolicMetricReport with 100% exact SymPy invariants.

Raises:
  • TypeError – If any point contains sp.Float coordinates.

  • ValueError – If P or Q does not lie strictly inside \(\mathbb{D}\).

geometor.poincare.FIGURE_SPECS: dict[str, str]
geometor.poincare.export_all_codex_figures(output_dir: pathlib.Path) → list[pathlib.Path]

Generate and write all 8 standalone .euclid-graphic SVGs into output_dir.

Parameters:

output_dir – Target directory (e.g. docsrc/_static/figures).

Returns:

Sorted list of written SVG file paths.

geometor.poincare.render_codex_figure(filename: str) → str

Render one of the 8 canonical .euclid-graphic codex figures by filename.

Parameters:

filename – Key in FIGURE_SPECS (with or without .svg suffix).

Returns:

Complete UTF-8 SVG document string.

Raises:

KeyError – If filename is not a recognized codex figure.

geometor.poincare.render_figure_svg
geometor.poincare.__version__ = '0.1.0'