The parallel postulate
Through a point not on a line, how many lines never meet it? Euclid needed the answer to be one, and for two thousand years people tried to prove it from his other postulates. It cannot be proved, because there are geometries where everything else holds and the answer is different. Here are five, with the count made exactly in each.
parallelPostulate().map((r) => [r.geometry, r.parallels]);
// Euclidean plane exactly one
// sphere none
// hyperbolic plane infinitely many
// affine plane over the field with 3 elements exactly one
// Fano plane (projective, 7 points) none
The postulate
Euclid's fifth postulate is about two lines cut by a third. The form used now is Playfair's: through a point not on a given line there is exactly one line that does not meet it. "At least one" follows from Euclid's other postulates; the content is "at most one". It is equivalent to the angles of a triangle adding up to two right angles, to the existence of similar triangles of different sizes, and to Pythagoras' theorem.
One: the Euclidean plane, and finite affine planes
In the plane, parallelThrough(l, P) is the one parallel, and any other line through P meets l in a point that meet finds exactly. The same holds in a world with nine points: in the affine plane over the field with three elements, every line has 3 points, and for each of the 12 lines and each of the 6 points off it there is exactly one line through the point that shares no point with the line. The row for it is checked for every such pair.
None: the sphere and projective planes
On the sphere two great circles always cross, so there are no parallels at all. The price is that two lines meet twice, and that Euclid's first postulate fails for opposite points. Identify each point with its opposite and that is repaired: the result is the projective plane, where two lines meet exactly once. Its smallest relative is the Fano plane, seven points and seven lines, any two of which meet.
With no parallels, the angles of a triangle add up to more than two right angles, and the surplus is the area.
Infinitely many: the hyperbolic plane
In the hyperbolic plane all of Euclid's other postulates hold, and through a point off a line there are two limiting parallels and infinitely many lines between them, none meeting the line. The row for it builds three different lines through the point (the two limiting parallels and one ultraparallel) and verifies exactly that each passes through the point and misses the line. The models inside the Euclidean plane are what show the fifth postulate cannot be proved: a proof would hold in the model too, where the postulate is false.
With many parallels, the angles of a triangle add up to less than two right angles, and the shortfall is the area.
| geometry | parallels | angle sum of a triangle | circumference of a circle |
|---|---|---|---|
| sphere | none | more than π; the excess is the area | |
| Euclidean plane | exactly one | π | |
| hyperbolic plane | infinitely many | less than π; the defect is the area |
What the function returns
parallelPostulate({ q }) returns one row per geometry: geometry, parallels, count, an example with the line, the point and the lines found, and checked, which is true when the example was verified exactly. q chooses the field for the affine plane (a prime power; 3 by default). The same question can be put to any single figure: greatCircle.parallelsThrough(P) is always empty and carries a witness, hline.parallelsThrough(P) returns the limiting parallels and the angle of parallelism, and an incidence structure's parallels(p, l) lists them.
@ratmath/geo and Core's Rational in scope. The last line's value is shown; PRINT(…) adds lines, TEX(…) typesets math.