3. A Simplified Introduction to the Algebro-Geometric Background
As already mentioned in the Introduction, there is an ‘ad hoc’, computational (complex) algebraic geometry approach behind the performance of the different tools we have exemplified. Very roughly speaking (see [
12] for the mathematical background, or [
2] for further details regarding the different methods implemented in GeoGebra), GeoGebra proceeds by automatically translating the different steps of the construction involved in a given statement into a series of polynomial equations. Now, looking for the
Relation between some elements of the corresponding figure is addressed by describing the result of eliminating, in this polynomial system, all variables except those associated to the selected elements.
For instance, given a right triangle
, so that
and
are perpendicular, suppose we would like to find the relation between the altitude
g of
C and the pair of segments
, where
D is the altitude foot on side
, see
Figure 1. Then GeoGebra can assume, for simplicity, that
, and it is likely to consider the following equation
describing the perpendicularity of the two catheti
, and the equations (at least from an intuitive point of view) describing
:
. Finally, the elimination of
in this system yields (among others) the equation
, that is, the
Relation described in the Altitude Theorem.
On the other hand, if we already know the thesis
of this theorem and we just want to verify that it holds always true on right triangles, by means of the
Prove command, GeoGebra considers its refutation, which seems natural to be expressed through the system of equations
where the last one
represents the negation of the thesis. Now it checks that this system has no solutions at all, i.e., that 1 is a combination of the given equations (by Hilbert’s Nullstellensatz). Thus, since it happens that the refutation of the introduced statement is never true, GeoGebra concludes that the statement is always true!
Finally, to provide a more complete, albeit very naive, description about the implemented algorithmic approach, let us assume, as in
Figure 1, that we consider a general triangle and we would like to learn the conditions for the Altitude Theorem to hold. Here GeoGebra could proceed considering now the set of equations
, where we have dropped the perpendicularity requirement of the catheti and we have added the verification of the thesis
. Again, by elimination of all variables except
we obtain the
LocusEquation:, i.e., that the truth of the thesis of the Altitude Theorem requires that
C lies on the locus given by the circle of center the midpoint of
, or, equivalently, that
is a right triangle at
C.
4. Complications
The conclusion of the last section seems to contradict the output of
Figure 2, which included a hyperbola and a circle as the locus for the Altitude Theorem! Moreover, it happens that if the
Relation tool is applied to verify the truth of this statement for a right triangle
, the output message is “true on parts, false on parts”. Even more confusing, this declaration contradicts the result of the
Prove command, that declares the truth of the thesis
(see
Figure 7). This issue is specifically addressed in [
13], and it is related to the fact that the—perhaps intuitively evident—equations that we have used here describing
:, i.e.,
, are actually to be replaced, to work in all generality with lengths of segments, by
and, then, choosing the positive values of
.
It happens that, if we mimic the procedure described at the beginning of the previous section, with this new set of equations plus the perpendicularity condition
, the elimination of
in this complete system yields now
, and not
. Therefore, in this new context, the thesis of the Altitude Theorem would not be obtained as output of the
Relation command! Of course, the equality
cannot hold for positive values of
and, thus,
is equivalent to
for real positive values; however, working over the real numbers and involving inequalities requires replacing Gröbner-based elimination methods by real quantifier elimination algorithms, with weaker performance (see [
14] for some very promising but preliminary results in this direction).
Thus, a different operating alternative has been developed in [
15,
16], observing that
holds over some primary components of the variety described by the complex solutions of
and fails over some others (where
holds), i.e., the Altitude Theorem is “true on parts, false on parts” (as shown in
Figure 7). Again, the idea is to arrive to such a conclusion without having to compute the (costly) primary decomposition.
This somehow confusing panorama: intuitive algebraic formulation, manipulation, and derivation of geometric facts vs. (sometimes) contradictory GeoGebra’s output, is just a warning sign of the need to revise the naive approach we have described in the previous section. As already remarked, to begin with, given a certain geometric situation, we should pay special attention to the way we introduce the algebraic input in the automated reasoning algorithms. Indeed, the automated reasoning protocol starts by having the human user translating the textual—or figural or imagined—context into a GeoGebra construction. This translation is not irrelevant. For instance, in the context of Thales theorem (
https://en.wikipedia.org/wiki/Thales’s_theorem, accessed on 13 August 2021), if we want to deal with a circle
c, a diameter
, a point
C on the circle and lines
, a possible approach could be to start fixing two points
, then building the circle centered at
O and passing through
A, choosing one point
C on the circle and, finally, intersecting the circle with the line
to get the other extreme
B of the diameter. This yields, with a straightforward translation (We exemplify the following computations using Maple computer algebra software,
https://www.maplesoft.com, accessed on 13 August 2021), the following ideal of hypotheses:
with
as free variables. Now, both adding the refutation of the thesis, the perpendicularity of
, i.e.,
, or the thesis itself
, yields the zero ideal with eliminating all except the free variables. Thus the statement is ‘true on parts’ [
15,
16], that is, neither true nor false, because point
B—the intersection of a line and a circle—is not uniquely defined and yields different primary components on the hypotheses ideal, some of them holding true, some false, the given thesis.
On the other hand, if the construction starts with two free points
and considers the circle centered at the midpoint
O of segment
, a point
C on the circle, and lines
, the corresponding ideal
has only one component and the perpendicularity of
is always true on it:
EliminationIdeal(<(c_1-o_1)^2+(c_2-o_2)^2-(a_1-o_1)^2-(a_2-o_2)^2,
o_1-(a_1+b_1)/2, o_2-(a_2+b_2)/2,
((c_1-b_1)*(c_1-a_1)+(c_2-b_2)*(c_2-a_2))*t-1>,
{a_1,a_2,b_1,b_2,c_1});
<1>
Next to the impact of the human translation—through the choice of the construction steps—of a given statement, are the different assumptions and tricks that GeoGebra programmers have implemented in the involved algorithms, to speed up the automatic reasoning features. For instance, internally, the initial free points are usually assumed to be
in order to diminish the number of involved variables; in addition, some negative constraints, using Rabinowitsch’s trick, are often added to avoid foreseeable degeneracies, such as the coincidence of two points, but with potentially conflictive consequences [
17]; likewise, to deal with magnitudes that are supposed to be positive, GeoGebra considers automatically only some specific components of the hypotheses variety or includes the so-called Minimal Euclidean Polynomial (MEP) extension, that represents only with even powers all variables related to distances [
13], etc.
We refer, for precise details and examples to illustrate the difficulties and the adopted technical solutions, to the basic document [
12] and, for recent updates, to [
13,
15] or [
17]. The algorithms described in these papers are implemented in GeoGebra through the embedded computer algebra system Giac [
18,
19].
5. Reflecting about Degeneracy Conditions
One of the more frequent, yet unexpected, outputs of the automated reasoning tools is the inclusion of a list of degenerate cases (e.g., circles of radius zero, triangles collapsing to a line, etc.) in the answer to the
ProveDetails command. Cases have to be avoided because of the generic truth of a certain statement that the user was ‘a priori’ convinced was absolutely true. This problem has been well known for a long time and happens even in quite simple cases (see [
12]). For example, it might happen that the user had constructed a circle or a triangle, and GeoGebra had translated the construction into polynomial equations, but both the graphic and the algebraic counterpart include the case of the circle being reduced to a point. There is also the case of the three vertices of the triangle being aligned or coincident, etc., even if the user did not consider, intuitively, such instances as verifying the hypotheses of a certain geometric statement. Then, it can occur—somehow at random and with little geometric interpretation, since it might refer to the diameter of a circle of radius zero, or to the heights of a triangle reduced to a point, etc.—that some of these degenerate instances do not verify a given thesis, yielding thus a negative answer to the correctness of a proposition that the user reasonably considered as true.
To avoid as much as possible such situations, the algorithm in [
12], quite successfully implemented in GeoGebra (see [
2,
3]), considers as ‘generally true’ those statements where the thesis vanishes over all the irreducible components of the hypotheses variety describing all the non-degenerate instances; i.e., it disregards, as irrelevant that the thesis fails over the components that include degenerate cases. Likewise, a statement is labeled as ‘generally false’ if the thesis does not vanish identically over every non-degenerate irreducible component of the hypotheses variety—those describing the non-degenerate instances; it does not matter that the thesis holds over the components that include degenerate cases. Thus, it turns out that the key concept is that of ‘degeneracy’.
The usual approach to deal with this issue is, first, to consider that the different steps of a construction provide a collection of points that rule the construction, i.e., that, if dragged along the window of the application, the whole construction should follow them. For example, in
Figure 1, the three vertices
are free. In
Figure 2, right, once
are fixed, vertex
C is determined, so only
are free. In
Figure 3 the four vertices of the quadrilateral are free and nothing else, since they determine the midpoints of the sides. In
Figure 4, the basic element is an equilateral triangle
, as the other points are clearly depending on this initial data. However, an equilateral triangle is also finitely determined once two vertices are fixed. So, say, here there are only two vertices that actually rule the whole construction, because having a finite number of possible positions for the third vertex can be considered as being determined, anyway. Finally,
Figure 7 exemplifies a new situation: the right triangle can be considered as having at least two free vertices
; and once
are fixed, then vertex
C is semi-free, as there is an infinite number of possible positions for one of its coordinates (along the circle with diameter
).
Now, the algebraic translation of this concept of “freedom” has to do, first, with the consideration of the coordinates of the points as variables in the polynomial ring describing the geometric statement. The counterpart for the idea of free or semi-free point is, then, the concept of a set of independent variables with respect to an ideal: a set of variables such that there is no polynomial just on these variables in the given ideal. That is, a set of variables such that the given ideal does not include any polynomial constraint among them; namely, they are free. Algorithmically, we are talking about variables such that the elimination of the remaining variables in the ideal yields the zero ideal. Finally, the fact that such free variables “rule” the construction can be thought of as referring to a set of variables so that the remaining ones are finitely determined by the free ones: a maximal set of independent variables.
Unfortunately this condition does not necessarily imply that the cardinal of this maximal set is also maximum among the possible collections of sets of independent variables; i.e., it can be less than the Krull dimension (also known as Hilbert dimension) of the given ideal. For example, consider the ideal , where both and are maximal and maximum-size sets of independent variables; and, if , then both and are maximal sets of independent variables, but only the second has cardinality equal to the dimension of I.
This example might look artificial and, indeed, when dealing with geometric statements, it is often assumed in most cases that the ‘intuitively’ maximal set of independent variables is maximum-size, but there are examples in which this is not the case. See Example 2 in ([
12], p. 72): the number of coordinates of free points in the chosen geometric construction is 5, but the Hilbert dimension of
H is 6; or Example 7 in the Reference [
20], about Euler’s formula concerning the distance between the centers and the radii of the inner and outer circles of a triangle with vertices
. Here the ‘intuitive’ dimension of the hypotheses variety should be 2 (the coordinates of the only free vertex of the triangle), but applying the algebraic definition it turns out to be three, unless it is explicitly added to the hypotheses the (obvious) fact that
should not lie in the
x-axis. This quite common problem—related to the a priori control and detail of all geometric degeneracies—is already considered in the basic Reference [
7], mentioning, in particular (cf. page 43), that in many occasions it is not trivial to intuitively prevent, by adding some extra conditions to the hypotheses ideal, the appearance of unwanted situations.
To deal with this complicated context, the current algorithm implemented in GeoGebra automatically associates—following the construction steps—a maximal set of algebraically independent variables to the hypotheses ideal H and considers as ‘degenerate’ those irreducible components of where these variables do not remain independent but constrained by some relations. Then, as already defined above, it declares a statement to be generally true (respectively, generally false) iff it is true (false) over all the non-degenerate components.
We will provide further details about this protocol in the next section, but let us remark here that there is a potentially sharper concept of degeneracy, including, besides the components where the chosen algebraically independent variables fail to be independent, those components where these variables remain independent but the dimension of the component is strictly greater than the cardinal of the set of selected variables. This is something geometrically ‘strange’, as it means that the chosen set of variables does not control the construction and there are some ‘unknown’ free points. Following [
7], Remark 2, page 47, we will not deal with this notion of degeneracy, considering it irrelevant in practice.
6. A Proposal to Avoid Working with Degeneracy Conditions
Let us fix notation as follows: let us consider K and L to be fields, with L an algebraically closed extension on K (for instance and ), and an algebraically translated statement . Let be and the hypotheses and thesis ideals in the polynomial ring , where the variables refer to the symbolic coordinates involved in the algebraic description of the hypotheses in . Furthermore, take the algebraic variety (respectively, ) in the affine space defined over K. Next, fix—following a geometric intuition or through the steps of the geometric construction in the Dynamic Geometry program—a maximal set of independent variables for the hypotheses ideal H and denote by the remaining variables.
Definition 1. We say that a primary component of H, or an irreducible component of , are non-degenerate iff Y remains independent over the primary component, that is, if there is no polynomial in the Y variables that vanishes over all the corresponding irreducible component.
Remark 1. Notice that the current definition is similar to the one in [12], but now we are not requiring the dimension of H to be equal to the cardinal of the set of variables, a quite small, but useful in practice, advantage. Moreover, following the consideration in the last paragraph of the previous section, we assume, for the rest of the paper, that non-degenerate components are of dimension d, although d does not have to be the dimension of H. Now, let us collect different algorithmic criteria for generally true or false statements.
Proposition 1. The statement is generally true if and only if This result follows from the proof of the first statement in Theorem 1 in [
15], bearing in mind that in the proof of that particular item it is not required that
Y is of maximum size, with
. On the other hand, following carefully the proof of the second statement in the same Theorem 1, we have the following proposition.
Proposition 2. The statement is generally false if Further, adding the condition , this inequation holds if the statement is generally false.
Definition 2. Statements that are neither generally true nor generally false are called “true on parts, false on parts” or “true on components”, see [15,16]. These results point out the interest of addressing two further issues:
How to fully verify the
generally false case when
? See Example 2 in [
15], for a situation where the zero elimination requirement derived from Proposition 2 is necessary but not sufficient for being not generally false.
How to discriminate non-degenerate components where the thesis holds from those where the thesis fails, in the “true on components” case? This is usually a source of geometric insight, as it shows further restrictions that have to be added for a certain statement to be always true, usually related to the lack of precision of the algebraic translation (e.g., not declaring if the vertex
C of an equilateral triangle
stands up or down the
x-axis, see Example 1 in [
15]).
Of course, an immediate solution could be to compute the primary decomposition of H and, then, for each component, to verify if it is, or not, non-degenerate, by eliminating all variables except Y; by definition, the output should be zero iff the component is non-degenerate. Then, over each non-degenerate component, as they are of dimension d, by our assumption—see Definition 1—we could fully apply the criterion expressed in the above propositions.
However, obtaining a complete primary decomposition is usually quite challenging, over a personal computer, through a standard computer algebra program. A much more practical alternative could be the following proposal:
- (1)
Isolating the collection of non-degenerate components of H by means of saturation, see Proposition 3 below, and then applying the criteria from the above Propositions.
- (2)
Working directly in a zero-dimensional context (as in [
16] but without having to compute zero-divisors), extending ideal
H to the ring
, i.e., including the selected free variables as elements of the coefficient field.
Let us recall the notion of saturation:
Proposition 3 ([
21], Prop. 4.9)
. If S is a multiplicatively closed subset of a ring A and I is a decomposable ideal of A, with a minimal primary decomposition , then decomposes with a minimal primary decomposition as , where denote those primary components such that the associated prime ideals do not meet S. Its contraction (the contraction of the “extension of ”, also called saturation
of I) has also as primary minimal decomposition the intersection of . Thus, to address the first item of our proposal, we will consider S as the polynomial ring in the Y variables and thus, computing the saturation we can directly obtain the full collection of non-degenerate components without performing a primary decomposition, thus facilitating the verification of the truth or falsity of the proposition just over the non-degenerate cases (or checking the ‘true on non-degenerate parts’ case). This can be done as follows:
Proposition 4. Let be an ideal in . Let be a Gröbner basis of with respect to any monomial ordering in the variables Z (and coefficients in ). Where, without loss of generality, , . Let be the leading term of each with respect to the chosen monomial ordering. Furthermore, write . Then: Proof. The last equality is a standard result on saturating an ideal with respect to a polynomial. If . Then, for sufficiently large k, . So, . But, since , and .
Consider now
. Then
. Since
is a Gröbner basis of
, we can perform the division algorithm of
h and
(over
) with respect to the monomial ordering. Since the leading coefficient of
is a factor of
b, we can write:
with
and a suitable
k-th power of
b. From this equation
and
□
As a more detailed alternative, we can consider the proposal from item (2) above, working directly with the zero-dimensional case. That is, we can extend ideal H to the polynomial ring and, as remarked in Proposition 3, we will get only the extension of the components of H such that the Y-variables are free, that is, the non-degenerate. We can perform a primary decomposition of the extended ideal much more simply than for the initial ideal , since there are less variables and it is a dimension zero ideal. Now we can decide quite simply about the truth or falsity of the statement over each non-degenerate component as follows:
Proposition 5. Let a component of , the extension of a non-degenerate component Q of . Let a base of , where the elements are chosen, clearing denominators, from . Then the statement is true iff And the statement is false iff Remark that, over a single, irreducible, non-degenerate component, the idea of generally true or generally false is actually the truth or falsity of the statement over the whole component.
Proof. Let us recall that
are also elements of
Q, since
, ([
21], Prop. 4.8). Now, suppose that
. Then, clearing denominators, we will find a non-zero polynomial in
Y in
, that is, over the ring
. Now, substituting
and clearing again denominators, we get that a power of
f times a polynomial in
Y belongs to
Q. Since the polynomial in
Y cannot be in
Q and
Q is primary, it follows that a power of the thesis
f must be in
Q, so
over all
. Conversely, if
f vanishes over of
, a power of
f must be in
Q, thus
must contain 1, and the same applies ‘a fortiori’ to
.
A similar argument proves the second statement. If , then there is a non-zero polynomial in Y that is in , so the vanishing of the thesis over is restricted to the subset of this component where the polynomial in Y vanishes too. As Q is non-degenerate and Y are free over Q, it follows that this subset where the thesis holds is a proper, closed subset of . Conversely, if the thesis does not hold over all , by the previous Proposition 2, since , is not zero, thus it has some non-zero polynomial in . It follows that this ideal . □
Corollary 1. Notice that, as a consequence of this proposition, is generally true if and only if Likewise, it is generally false iff Proof. In fact, if the statement is generally true, then it is generally true over each component Q of , thus 1 is a combination of elements in . Multiplying all these expressions, for all such Q’s, we get 1 in . Conversely, if , then ‘a fortiori’ 1 belongs to every , and thus the statement is generally true. A similar argument applies to the generally false case. □
In conclusion, our proposal to deal with degeneracy conditions (rather: to avoid them in an automatic way) could be summarized as follows.
Choose—from the geometric construction—a meaningful maximal set of independent variables Y. Verify they are actually maximally independent from the algebraic point of view, using elimination commands.
Restrict the hypotheses variety to the union of non-degenerate components, by using the saturation of the hypotheses ideal with respect to S, the polynomial ring in the Y variables.
Use the elimination commands, as in Proposition 1 and 2, to test the general truth or falsity of the statement over ; or use the Corollary over .
If the output is ‘true on some, false on some’ non-degenerate components, perform a primary decomposition of . Use Proposition 5 to analyze individually each component, as this proposition shows that the result is valid over the corresponding components in .
7. An Example
Let us exemplify the use and difficulties of these concepts on a simple, yet illustrative, situation.
Example 1. We consider two free points . We build circles c (centered at A and passing through B) and d (centered at B and passing through A). The lines , through (respectively) are built perpendicular to segment . Let D and F be the intersection of g with c and of h with respectively. Thesis: is parallel to . See Figure 8. A possible algebraic translation of these hypotheses and thesis could start assigning coordinates
and the corresponding equations
Then point
D is defined by these two equations
and
F is defined by these other two
while the thesis is formulated as
It seems intuitively clear that the whole construction is ruled by the coordinates of
, and so the hypotheses ideal
H, including the equations describing
plus those describing points
, should be of Dimension 4, but it turns out its Hilbert dimension is 5. Indeed
are independent variables, but there are sets with five independent variables modulo
H, such as
, that is, with the coordinates of one of the given free point s (e.g.,
A), then one single variable from
B, one from
D, one from
F. Let us remark that no set with five independent variables can be found including
, as expected (see previous comment about [
7], Remark 2, page 47). Although the direct computation of the primary components of
H is quite involved (for example, it did not succeed within a reasonable amount of time and space, using Maple 2021 on our laptops), we can analyze what happens with the five-dimensional components where, say,
are free, as follows.
First, we will consider S as the polynomial ring in the variables and thus, if we extend ideal H to the polynomial ring , and perform there a primary decomposition, we will get only the extension of the components of H such that are free. It turns out that this much simpler computation yields that is already prime, of dimension zero, and that it contains the polynomial . It follows that some polynomials in times will belong to the contraction to of ‘the’ component of H where are free. Since by construction no polynomial in can vanish identically on this component, it means that must be zero over the component, that is, interpreted geometrically over the reals, that on this component, so it is degenerate in a ‘real’ sense and are not free! A similar output happens with the other different choices of five independent variables.
On the other hand, considering this set of variables, we see that they are also free over H, so we might be interested in investigating what happens with the components that do not meet . We repeat the above protocol, getting five components such that, over four of them the variables are also free; however, there is also a component verifying , so we might call it degenerate, although only ‘slightly’ degenerate: a four dimensional component, where points are free and the remaining points are determined by them but are constrained by some relation.
Finally, assuming as the variables defining non-degeneracy in this example and applying the test from Propositions 1 and 2 above, we get
EliminationIdeal(<(x-a1)^2+(y-a2)^2-((a1-b1)^2+(a2-b2)^2),
(u-b1)^2+(v-b2)^2-((a1-b1)^2+(a2-b2)^2),
(x-a1)*(b1-a1)+ (y-a2)*(b2-a2),
(u-b1)*(b1-a1)+(v-b2)*(b2-a2),
((u-x)*(b2-a2) -(v-y)*(b1-a1))*t-1>,{a1,a2,b1,b2});
<0>
EliminationIdeal(<(x-a1)^2+(y-a2)^2-((a1-b1)^2+(a2-b2)^2),
(u-b1)^2+(v-b2)^2-((a1-b1)^2+(a2-b2)^2),(
x-a1)*(b1-a1)+ (y-a2)*(b2-a2),
(u-b1)*(b1-a1)+(v-b2)*(b2-a2),
((u-x)*(b2-a2) -(v-y)*(b1-a1))>,{a1,a2,b1,b2});
<0>
which means that the statement is not generally true, but we do not know if it is generally false (as here ).
Now, we can extend the ideal of hypotheses H to the ring . One possibility is to apply the above protocol but only to the contraction of this extended ideal, by means of saturation, which is quite obvious in this case (saturation involves only operating with , after computing a simple Gröbner basis with that just involves this polynomial as leading coefficient). The output is that, over the non-degenerate components, the statement is clearly true on parts and false on parts.
To be more precise, we can show that this extended ideal has four components (immediately computed on a laptop with Maple 2021). Over each component we can perform the contraction of each component to the initial ring ; saturation here is practically obvious, since in every case, the correspondent Gröbner basis with shows constant (in K) leading coefficients. Finally, we can perform the above test over the contracted components, yielding that the statement is true on two of them and false on other two (in this case, suggesting that is a required extra condition for the truth of the statement on the components where it fails).
Alternatively, we can work directly over on and verify if 1 is or not in the elimination of the component ideals plus or , as in Proposition 5 above. The answer is true, false for the first and fourth components and false, true for the other two, as expected.
We refer the interested reader to
https://doi.org/10.5281/zenodo.5179979 (accessed on 13 August 2021) for a MW and PDF files detailing the Maple computations we have described in this section.