geometry.tex 61 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476
  1. \documentclass{article}
  2. \title{\geo\ : A Small Package for Mechanized (Plane) Geometry
  3. Manipulations\\[20pt] Version 1.1}
  4. \author{Hans-Gert Gr\"abe, Univ. Leipzig, Germany}
  5. \date{September 7, 1998}
  6. \newenvironment{code}{\tt \begin{tabbing}
  7. \hspace*{1cm}\=\hspace*{1cm}\=\hspace*{1cm}\=
  8. \hspace*{1cm}\=\hspace*{1cm}\=\kill
  9. }{\end{tabbing}}
  10. \newcommand{\formel}[1]{\[\begin{array}{l} #1\end{array}\]}
  11. \newcommand{\iks}{{\bf x}}
  12. \newcommand{\uhh}{{\bf u}}
  13. \newcommand{\vau}{{\bf v}}
  14. \newcommand{\geo}{{\sc Geometry}}
  15. \newcommand{\gr}{{Gr\"obner}}
  16. \newcommand{\xxyy}[2] {\noindent{\tt #1} \\\hspace*{1cm}
  17. \parbox[t]{9cm}{#2} \\[6pt]}
  18. \begin{document}
  19. \maketitle
  20. \section{Introduction}
  21. Geometry is not only a part of mathematics with ancient roots but also
  22. a vivid area of modern research. Especially the field of geometry,
  23. called by some negligence ``elementary'', continues to attract the
  24. attention also of the great community of leisure mathematicians. This
  25. is probably due to the small set of prerequisites necessary to
  26. formulate the problems posed in this area and the erudition and non
  27. formal approaches ubiquitously needed to solve them. Examples from
  28. this area are also an indispensable component of high school
  29. mathematical competitions of different levels upto the International
  30. Mathematics Olympiad (IMO) \cite{IMO}.
  31. \medskip
  32. The great range of ideas involved in elementary geometry theorem
  33. proving inspired mathematicians to search for a common toolbox that
  34. allows to discover such geometric statements or, at least, to prove
  35. them in a more unified way. These attempts again may be traced back
  36. until ancient times, e.g., to Euclid and his axiomatic approach to
  37. geometry.
  38. Axiomatic approaches are mainly directed towards the introduction of
  39. coordinates that allow to quantify geometric statements and to use the
  40. full power of algebraic and even analytic arguments to prove geometry
  41. theorems. Different ways of axiomatization lead to different, even
  42. non-commutative, {\em rings of scalars}, the basic domain of
  43. coordinate values, see \cite{Wu:94}.
  44. Taking rational, real or even complex coordinates for granted (as we
  45. will do in the following) it turns out that geometry theorems may be
  46. classified due to their symmetry group as statements in, e.g.,
  47. projective, affine or Euclidean (Cartesian) geometry. Below such a
  48. distinction will be important for the freedom to choose appropriate
  49. coordinate systems.
  50. \medskip
  51. It may be surprising that tedious but mostly straightforward
  52. manipulations of the algebraic counterparts of geometric statements
  53. allow to prove many theorems in geometry with even ingenious ``true
  54. geometric'' proofs. With the help of a Computer Algebra System
  55. supporting algebraic manipulations this approach obtains new power.
  56. The method is not automatic, since one often needs a good feeling how
  57. to encode a problem efficiently, but mechanized in the sense that one
  58. can develop a tool box to support this encoding and some very standard
  59. tools to derive a (mathematically strong~!) proof from these encoded
  60. data.
  61. The attempts to algorithmize this part of mathematics found their
  62. culmination in the 80's in the work of W.-T. Wu \cite{Wu:94} on ``the
  63. Chinese Prover'' and the fundamental book \cite{Chou:88} of S.-C. Chou
  64. who proved 512 geometry theorems with this mechanized method, see also
  65. \cite{Chou:84}, \cite{Chou:90}, \cite{Wu:84a}, \cite{Wu:84b}.
  66. Since the geometric interpretation of algebraic expressions depends
  67. heavily on the properties of the field of scalars, we get another
  68. classification of geometry theorems: Those with coordinate version
  69. valid over the algebraically closed field ${\bf C}$ and those with
  70. coordinate version valid (or may be even formulated) only over ${\bf
  71. R}$. The latter statements include {\em ordered geometry}, that uses
  72. the distinction between ``inside'' and ``outside'', since ${\bf C}$
  73. doesn't admit monotone orderings.
  74. \medskip
  75. This package \geo, written in the algebraic mode of Reduce, should
  76. provide the casual user with a couple of procedures that allow him/her
  77. to mechanize his/her own geometry proofs. Together with the Reduce
  78. built-in simplifier for rational functions, the {\tt solve} function,
  79. and the \gr\ utilities\footnote{Unfortunately, the built in \gr\
  80. package of Reduce doesn't admit enough flexibility for our purposes.}
  81. of the author's package CALI \cite{CALI} (part of the Reduce library)
  82. it allows for proving a wide range of theorems of unordered geometry,
  83. see the examples below and in the test file {\tt geometry.tst}.
  84. This package grew up from a course of lectures for students of
  85. computer science on this topic held by the author at the Univ. of
  86. Leipzig in fall 1996 and was updated after a similar lecture in spring
  87. 1998.
  88. \section{Mechanizing Geometry Proving}
  89. Most geometric statements are of the following form:
  90. \begin{quote}
  91. Given certain (more or less) arbitrarily chosen points and/or lines we
  92. construct certain derived points and lines from them. Then the
  93. (relative) position of these geometric objects is of a certain
  94. specific kind regardless of the (absolute) position of the chosen
  95. data.
  96. \end{quote}
  97. To obtain evidence for such a statement (recommended before attempting
  98. to prove it~!) one makes usually one or several drawings, choosing the
  99. independent data appropriately and constructing the dependent ones out
  100. of them (best with ruler and compass, if possible). A computer may be
  101. helpful in such a task, since the constructions are purely algorithmic
  102. and computers are best suited for algorithmic tasks. Given appropriate
  103. data structures such construction steps may be encoded into {\em
  104. functions} that afterwards need only to be called with appropriate
  105. parameters.
  106. Even more general statements may be transformed into such a form and
  107. must be transformed to create drawings. This may sometimes involve
  108. constructions that can't be executed with ruler and compass as, e.g.,
  109. angle trisection in Morley's theorem or construction of a conic in
  110. Pascal's theorem.
  111. \subsection{Algorithmization of (plane) geometry}
  112. The representation of geometric objects through coordinates is best
  113. suited for both compact (finite) data encoding and regeometrization of
  114. derived objects, e.g., through graphic output. Note that the target
  115. language for realization of these ideas on a computer can be almost
  116. every computer language and is not restricted to those supporting
  117. symbolic computations. Different geometric objects may be collected
  118. into a {\em scene}. Rapid graphic output of such a scene with
  119. different parameters may be collected into animations or even
  120. interactive drag-and-move pictures if supported by the programming
  121. system. (All this is not (yet) supported by \geo.)
  122. \medskip
  123. We will demonstrate this approach on geometric objects, containing
  124. points and lines, represented as pairs {\tt P:Point=$(p_{1},p_{2})$}
  125. or tripels {\tt g:Line=$(g_{1}, g_{2}, g_{3})$} of a certain basic
  126. type {\tt Scalar}, e.g., floating point reals. Here $g$ represents the
  127. homogeneous coordinates of the line $\{(x,y)\, :\, g_{1}x + g_{2}y +
  128. g_{3}=0\}$. In this setting geometric constructions may be understood
  129. as functions constructing new geometric objects from given ones.
  130. Implementing such functions variables occur in a natural way as formal
  131. parameters that are assigned with special values of the correct type
  132. during execution.
  133. \medskip
  134. 1) For example, the equation
  135. \[(x-p_{1})(q_{2}-p_{2}) - (y-p_{2})(q_{1}-p_{1})=0\]
  136. of the line through two given points $P=(p_{1},p_{2}),\,
  137. Q=(q_{1},q_{2})$ yields the function
  138. \begin{code}
  139. pp\_line(P,Q:Point):Line ==
  140. $(q_{2}-p_{2},p_{1}-q_{1},p_{2}q_{1}-p_{1}q_{2})$
  141. \end{code}
  142. that returns the (representation of the) line through these two
  143. points. In this function $P$ and $Q$ are neither special nor general
  144. points but formal parameters of type {\tt Point}.
  145. 2) The (coordinates of the) intersection point of two lines may be
  146. computed solving the corresponding system of linear equations. We get
  147. a partially defined function, since there is no or a not uniquely
  148. defined intersection point, if the two lines are parallel. In this
  149. case our function terminates with an error message.
  150. \begin{code}
  151. intersection\_point(a,b:Line):Point == \+\\
  152. d:=$a_{1}b_{2}-a_{2}b_{1}$;\\
  153. if $d=0$ then error ``Lines are parallel''\\
  154. else return $((a_{2}b_{3}-a_{3}b_{2})/d,(a_{3}b_{1}-a_{1}b_{3})/d)$
  155. \end{code}
  156. Again $a$ and $b$ are formal parameters, here of the type {\tt Line}.
  157. 3) In the same way we may define a line $l$ through a given point $P$
  158. perpendicular to a second line $a$ as
  159. \begin{code}
  160. lot(P:Point,a:Line):Line == $(a_{2},-a_{1},a_{1}p_{2}-a_{2}p_{1})$
  161. \end{code}
  162. and a line through $P$ parallel to $a$ as
  163. \begin{code}
  164. par(P:Point,a:Line):Line == $(a_{1},a_{2},-a_{1}p_{1}-a_{2}p_{2})$
  165. \end{code}
  166. 4) All functions so far returned objects with coordinates being
  167. rational expressions in the input parameters, thus especially well
  168. suited for algebraic manipulations. To keep this nice property we
  169. introduce only the {\em squared Euclidean distance}
  170. \begin{code}
  171. sqrdist(P,Q:Point):Scalar == $(p_{1}-q_{1})^{2}+(p_{2}-q_{2})^{2}$
  172. \end{code}
  173. 5) Due to the relative nature of geometric statements some of the
  174. points and lines may be chosen arbitrarily or with certain
  175. restrictions. Hence we need appropriate constructors for points and
  176. lines given by their coordinates
  177. \begin{code}
  178. Point(a,b:Scalar):Point == $(a,b)$\\
  179. Line(a,b,c::Scalar):Line == $(a,b,c)$
  180. \end{code}
  181. and also for a point on a given line. For this purpose we provide two
  182. different functions
  183. \begin{code}
  184. choose\_Point(a:Line,u:Scalar):Point == \+\\
  185. if $a_{2}=0$ then\+\\
  186. if $a_{1}=0$ then error ``a is not a line''\\
  187. else return $(-a_{3}/a_{1},u)$\-\\
  188. else return $(u,-(a_{3}+a_1\,u)/a_{2})$
  189. \end{code}
  190. that chooses a point on a line $a$ and
  191. \begin{code}
  192. varPoint(P,Q:Point,u:Scalar):Point ==
  193. $(u\,a_{1}+(1-u)\,b_{1},u\,a_{2}+(1-u)\,b_{2})$
  194. \end{code}
  195. that chooses a point on the line through two given points. The main
  196. reason to have also the second definition is that $u$ has a well
  197. defined geometric meaning in this case. For example, the midpoint of
  198. $PQ$ corresponds to $u={1\over 2}$:
  199. \begin{code}
  200. midPoint(P,Q:Point):Point == varPoint(P,Q,1/2)
  201. \end{code}
  202. 6) One can compose these functions to get more complicated geometric
  203. objects as, e.g., the pedal point of a perpendicular
  204. \begin{code}
  205. pedalPoint(P:Point,a:Line):Point == intersection\_point(lot(P,a),a),
  206. \end{code}
  207. the midpoint perpendicular of $BC$
  208. \begin{code}
  209. mp(B,C:Point):Line == lot(midPoint(B,C),line(B,C)),
  210. \end{code}
  211. the altitude to $BC$ in the triangle $\Delta\,ABC$
  212. \begin{code}
  213. altitude(A,B,C:Point):Line == lot(A,line(B,C))
  214. \end{code}
  215. and the median line
  216. \begin{code}
  217. median(A,B,C:Point):Line == line(A,midPoint(B,C))
  218. \end{code}
  219. 7) We can also test geometric conditions to be fulfilled, e.g., whether
  220. two lines $a$ and $b$ are parallel or orthogonal
  221. \begin{code}
  222. parallel(a,b:Line):Boolean == $(a_{1}b_{2}-a_{2}b_{1}=0)$
  223. \end{code}
  224. resp.
  225. \begin{code}
  226. orthogonal(a,b:Line):Boolean == $(a_{1}b_{1}+a_{2}b_{2}=0)$
  227. \end{code}
  228. or whether a given point is on a given line
  229. \begin{code}
  230. point\_on\_line(P:Point,a:Line):Boolean ==
  231. $(a_{1}p_{1}+a_{2}p_{2}+a_{3}=0)$
  232. \end{code}
  233. The corresponding procedures implemented in the package return the
  234. value of the expression to be equated to zero instead of a boolean.
  235. Even more complicated conditions may be checked as, e.g., whether
  236. three lines have a point in common or whether three points are on a
  237. common line. For a complete collection of the available procedures we
  238. refer to the section \ref{description}.
  239. \medskip
  240. Note that due to the linearity of points and lines all procedures
  241. considered so far return data with coordinates that are rational in
  242. the input parameters. One can easily enlarge the ideas presented in
  243. this section to handle also non linear objects as circles and angles,
  244. compute intersection points of circles, tangent lines etc., if the
  245. basic domain {\tt Scalar} admits to solve non-linear (mainly
  246. quadratic) equations. Since non-linear equations usually have more
  247. than one solution, branching ideas should be incorporated, too. For
  248. example, intersecting a circle and a line the program should consider
  249. both intersection points.
  250. \subsection{Mechanized evidence of geometric statements}
  251. With a computer and these prerequisites at hand one may obtain
  252. evidence of geometric statements not only from plots but also
  253. computationally, converting the statement to be checked into a
  254. function depending on the variable coordinates as parameters and
  255. plugging in different values for them.
  256. For example, the following function tests whether the three midpoint
  257. perpendiculars in a triangle given by the coordinates of its vertices
  258. $A,B,C$ pass through a common point
  259. \begin{code}
  260. test(A,B,C:Point):Boolean ==\\\>\>\>
  261. concurrent(mp(A,B,C),mp(B,C,A),mp(C,A,B))
  262. \end{code}
  263. Plugging in different values for $A,B,C$ we can verify the theorem for
  264. many different special geometric configurations. Of course this is
  265. not yet a {\bf proof}.
  266. \medskip
  267. Lets add another remark: {\tt Point} and {\tt Line} are not only the
  268. basic data types of our geometry, but data type functions parametrized
  269. by the data type {\tt Scalar}. To have the full functionality of our
  270. procedures {\tt Scalar} must be a field with effective zero test.
  271. \section{Geometry Theorems of Constructive Type}
  272. Implementing the functions described above in a system, that admits
  273. also symbolic computations, we can execute the same computations also
  274. with symbolic values, i.e. taking a pure transcendental extension of
  275. ${\bf Q}$ as scalars. The procedures then return (simplified) symbolic
  276. expressions that specialize under (almost all) substitutions of
  277. ``real'' values for these symbolic ones to the same values as if they
  278. were computed by the original procedures with the specialized input.
  279. This leads to the notion of {\em generic geometric configurations}. A
  280. geometric statement holds in this generic configuration, i.e., the
  281. corresponding symbolic expression simplifies to zero, if and only if
  282. it is ``generically true'', i.e., holds for all special coordinate
  283. values except degenerate ones.
  284. \subsection{Geometric configurations of constructive type}
  285. This approach is especially powerful, if all geometric objects
  286. involved into a configuration may be constructed step by step and have
  287. {\em rational} expressions in the algebraically independent variables
  288. as symbolic coordinates.
  289. \medskip
  290. {\sc Definition: } We say that a geometric configuration is of {\em
  291. constructive type}\footnote{This notion is different from
  292. \cite{Chou:88}.}, if its generic configuration may be constructed step
  293. by step in such a way, that the coordinates of each successive
  294. geometric object may be expressed as rational functions of the
  295. coordinates of objects already available or algebraically independent
  296. variables, and the conclusion may be expressed as vanishing of a
  297. rational function in the coordinates of the available geometric
  298. objects.
  299. \medskip
  300. Substituting the corresponding rational expressions of the coordinates
  301. of the involved geometric objects into the coordinate slots of newly
  302. constructed objects and finally into the conclusion expression, we
  303. obtain successively rational expressions in the given algebraically
  304. independent variables.
  305. \begin{quote}\it
  306. A geometry theorem of constructive type is generically true if and
  307. only if (its configuration is not contradictory and) the conclusion
  308. expression simplifies to zero.
  309. \end{quote}
  310. Indeed, if this expression simplifies to zero, the algebraic version
  311. of the theorem will be satisfied for all ``admissible'' values of the
  312. parameters. If the expression doesn't simplify to zero, the theorem
  313. fails for almost all such parameters.
  314. Note that due to cancelation of denominators the domain of definition
  315. of the simplified expression may be greater than the (common) domain
  316. of definition of the different parts of the unsimplified
  317. expression. The correct non degeneracy conditions describing
  318. ``admissibility'' may be collected during the computation. Collecting
  319. up the zero expression indicates, that the geometric configuration is
  320. contradictory. Hence the statement, that a certain geometric
  321. configuration of constructive type is contradictory, is of
  322. constructive type, too.
  323. The package \geo\ provides procedures {\tt clear\_ndg(), print\_ndg()}
  324. to manage and print these non degeneracy conditions and also a
  325. procedure {\tt add\_ndg(d)} as a hook for their user driven
  326. management.
  327. \subsection{Some one line proofs}
  328. Take independent variables $a_1,a_2,b_1,b_2,c_1,c_2$ and
  329. \begin{code}
  330. A:=Point(a1,a2);\ B:=Point(b1,b2);\ C:=Point(c1,c2);
  331. \end{code}
  332. as the vertices of a generic triangle. We can prove the following
  333. geometric statements about triangles computing the corresponding
  334. (compound) symbolic expressions and proving that they simplify to
  335. zero. Note that Reduce does simplification automatically.
  336. \medskip
  337. \noindent 1) The midpoint perpendiculars of $\Delta\,ABC$ pass through
  338. a common point since
  339. \begin{code}\+\>
  340. concurrent(mp(A,B),mp(B,C),mp(C,A));
  341. \end{code}
  342. simplifies to zero.
  343. \medskip
  344. \noindent 2) The intersection point of the midpoint perpendiculars
  345. \begin{code}\+\>
  346. M:=intersection\_point(mp(A,B),mp(B,C));
  347. \end{code}
  348. is the center of the circumscribed circle since
  349. \begin{code}\+\>
  350. sqrdist(M,A) - sqrdist(M,B);
  351. \end{code}
  352. simplifies to zero.
  353. \medskip
  354. \noindent 3) {\em Euler's line}:
  355. \begin{quote}
  356. The center $M$ of the circumscribed circle, the orthocenter $H$ and
  357. the barycenter $S$ are collinear and $S$ divides $MH$ with ratio 1:2.
  358. \end{quote}
  359. Compute the coordinates of the corresponding points
  360. \begin{code}\+\>
  361. M:=intersection\_point(mp(a,b,c),mp(b,c,a));\\
  362. H:=intersection\_point(altitude(a,b,c),altitude(b,c,a));\\
  363. S:=intersection\_point(median(a,b,c),median(b,c,a));
  364. \end{code}
  365. and then prove that
  366. \begin{code}\+\>
  367. collinear(M,H,S);\\
  368. sqrdist(S,varpoint(M,H,2/3));
  369. \end{code}
  370. both simplify to zero.
  371. \medskip
  372. \noindent 4) {\em Feuerbach's circle}:
  373. \begin{quote}
  374. The midpoint $N$ of $MH$ is the center of a circle that passes through
  375. nine special points, the three pedal points of the altitudes, the
  376. midpoints of the sides of the triangle and the midpoints of the upper
  377. parts of the three altitudes.
  378. \end{quote}
  379. \begin{code}\+\>
  380. N:=midpoint(M,H);\\[8pt]
  381. sqrdist(N,midpoint(A,B))-sqrdist(N,midpoint(B,C));\\
  382. sqrdist(N,midpoint(A,B))-sqrdist(N,midpoint(H,C));\\[8pt]
  383. D:=intersection\_point(pp\_line(A,B),pp\_line(H,C));\\
  384. sqrdist(N,midpoint(A,B))-sqrdist(N,D);
  385. \end{code}
  386. Again the last expression simplifies to zero thus proving the theorem.
  387. \section{Non-linear Geometric Objects}
  388. \geo\ provides several functions to handle angles and circles as
  389. non-linear geometric objects.
  390. \subsection{Angles and bisectors}
  391. (Oriented) angles between two given lines are presented as tangens of
  392. the difference of the corresponding slopes. Since
  393. \[\tan(\alpha-\beta) = \frac{\tan(\alpha)-\tan(\beta)}{1+
  394. \tan(\alpha)\, \tan(\beta)}\]
  395. we get for the angle between two lines $g,h$
  396. \begin{code}\>
  397. l2\_angle(g,h:Line):Scalar == $\frac{g_2h_1-g_1h_2}{g_1h_1+g_2h_2}$
  398. \end{code}
  399. Note that in unordered geometry we can't distinguish between inner and
  400. outer angles. Hence we cannot describe (rationally) the parameters of
  401. the angle bisector of a triangle. For a point $P$ the equation
  402. \begin{code}\>
  403. l2\_angle(pp\_line(A,B),pp\_line(P,B)) =\\\>\>\>
  404. l2\_angle(pp\_line(P,B),pp\_line(C,B))
  405. \end{code}
  406. i.e., $\angle\,ABP=\angle\,PBC$, describes the condition to be located
  407. on either the inner or outer bisector of $\angle\,ABC$. Clearing
  408. denominators yields a procedure
  409. \begin{code}\>
  410. point\_on\_bisector(P,A,B,C)
  411. \end{code}
  412. that returns on generic input a polynomial of (total) degree 4 and
  413. quadratic in the coordinates of $P$ that describes the condition for
  414. $P$ to be on (either the inner or the outer) bisector of
  415. $\angle\,ABC$.
  416. \medskip
  417. With some more effort one can also employ such indirect geometric
  418. descriptions. For example, we can prove the following unordered
  419. version of the bisector intersection theorem.
  420. \medskip
  421. \noindent 5) There are four common points on the three bisector pairs
  422. of a given triangle $\Delta\,ABC$. Indeed, due to Cartesian symmetry
  423. we may choose a special coordinate system with origin $A$ and (after
  424. scaling) $x$-axes unit point $B$. The remaining point $C$ is
  425. arbitrary. Then the corresponding generic geometric configuration is
  426. described with two independent parameters $u_1,u_2$ -- the coordinates
  427. of $C$:
  428. \begin{code}\>
  429. A:=Point(0,0); B:=Point(1,0); C:=Point(u1,u2);
  430. \end{code}
  431. A point {\tt P:=Point(x1,x2)} is an intersection point of three
  432. bisectors iff it is a common zero of the polynomial system
  433. \begin{code}
  434. polys:=\{\>\>\+\+ point\_on\_bisector(P,A,B,C),\\
  435. point\_on\_bisector(P,B,C,A),\\
  436. point\_on\_bisector(P,C,A,B)\},
  437. \end{code}
  438. i.e., of the polynomial system
  439. \begin{quote}
  440. $\hspace*{-2ex}\{\ {x_1}^{2}\,u_2 -2\,x_1\,x_2\,u_1 +2\,x_1\,x_2
  441. -2\,x_1\,u_2 -{x_2}^{2}\,u_2 +2\,x_2\,u_1 -2 \,x_2 +u_2,\\
  442. 2\,{x_1}^{2}\,u_1\,u_2 -{x_1}^{2}\,u_2 -2\,x_1\,x_2\,{u_1}^{2}
  443. +2\,x_1\,x_2\,u_1 +2\,x_1\,x_2\,{u_2}^{2} -2\,x_1\,{u_1}^{2}\,u_2
  444. -2\,x_1\,{u_2}^{3} -2\,{x_2}^{2}\,u_1\, u_2 +{x_2}^{2}\,u_2
  445. +2\,x_2\,{u_1}^{3} -2\,x_2\,{u_1}^{2} +2\,x_2\,u_1\,{u_2}^{2} -2\,x_2
  446. \,{u_2}^{2} +{u_1}^{2}\,u_2 +{u_2}^{3},\\ {x_1}^{2}\,u_2
  447. -2\,x_1\,x_2\,u_1 -{x_2}^{2}\,u_2\}$
  448. \end{quote}
  449. with indeterminates $x_1,x_2$ over the coefficient field ${\bf
  450. Q}(u_1,u_2)$. A \gr\ basis computation with CALI
  451. \begin{code}\>\+
  452. load cali;\\
  453. setring(\{$x_1,x_2$\},\{\},lex);\\
  454. setideal(polys,polys);\\
  455. gbasis polys;
  456. \end{code}
  457. yields the following equivalent system:
  458. \begin{quote}
  459. $\hspace*{-2ex}\{\ 4\,{x_2}^{4}\,u_2 -8\,{x_2}^{3}\,{u_1}^{2}
  460. +8\,{x_2}^{3}\,u_1 -8\,{x_2}^{3}\,{u_2}^{2 }
  461. +4\,{x_2}^{2}\,{u_1}^{2}\,u_2 -4\,{x_2}^{2}\,u_1\,u_2
  462. +4\,{x_2}^{2}\,{u_2}^{3} -4\,{ x_2}^{2}\,u_2 +4\,x_2\,{u_2}^{2}
  463. -{u_2}^{3},\\ 2\,x_1\,u_1\,{u_2}^{2} -x_1\,{u_2}^{2} +2\,{
  464. x_2}^{3}\,u_2 -4\,{x_2}^{2}\,{u_1}^{2} +4\,{x_2}^{2}\,u_1
  465. -2\,{x_2}^{2}\,{u_2}^{2} -2\, x_2\,{u_1}^{2}\,u_2 +2\,x_2\,u_1\,u_2
  466. -2\,x_2\,u_2 -u_1\,{u_2}^{2} +{u_2}^{2}\} $
  467. \end{quote}
  468. The first equation has 4 solutions in $x_2$ and each of them may be
  469. completed with a single value for $x_1$ determined from the second
  470. equation. Hence the system $polys$ has four generic solutions
  471. corresponding to the four expected intersection points. The solutions
  472. have algebraic coordinates of degree 4 over the generic field of
  473. scalars ${\bf Q}(u_1,u_2)$ and specialize to the correct ``special''
  474. intersection points for almost all values for the parameters $u_1$ and
  475. $u_2$.
  476. Although it is hard to give an explicit description through radicals
  477. of these symbolic values, one can compute with them knowing their
  478. minimal polynomials. Since in this situation $x_2$ is the distance
  479. from $P$ to the line $AB$, we can prove that each of the four points
  480. has equal distance to each of the 3 lines through two vertices of
  481. $\Delta\,ABC$, i.e., that these points are the centers of its incircle
  482. and the three excircles. First we compute the differences of the
  483. corresponding squared distances
  484. \begin{code}\>\+
  485. con1:=sqrdist(P,pedalpoint(p,pp\_line(A,C)))-x2\^{}2;\\
  486. con2:=sqrdist(p,pedalpoint(p,pp\_line(B,C)))-x2\^{}2;
  487. \end{code}
  488. The numerator of each of these two expressions should simplify to zero
  489. under the special algebraic values of $x_1,x_2$. This may be verified
  490. computing their normal forms with respect to the above \gr\ basis:
  491. \begin{code}\>\+
  492. con1 mod gbasis polys;\\
  493. con2 mod gbasis polys;
  494. \end{code}
  495. Note that \cite{Wu:94} proposes also a constructive proof for the
  496. bisector intersection theorem:
  497. Start with $A,B$ and the intersection point $P$ of the bisectors
  498. through $A$ and $B$. Then $g(AC)$ and $g(BC)$ are symmetric to $g(AB)$
  499. wrt.\ $g(AP)$ and $g(BP)$ and $P$ must be on their bisector:
  500. \begin{code}\>\+
  501. A:=Point(0,0); B:=Point(1,0); P:=Point(u1,u2);\\
  502. l1:=pp\_line(A,B);\\
  503. l2:=symline(l1,pp\_line(A,P));\\
  504. l3:=symline(l1,pp\_line(B,P));\\[6pt]
  505. point\_on\_bisector(P,A,B,intersection\_point(l2,l3));
  506. \end{code}
  507. As desired the last expression simplifies to zero.
  508. \subsection{Circles}
  509. The package \geo\ supplies two different types for encoding circles.
  510. The first type is {\tt Circle1} that stores the pair $(M,s)$, the
  511. center and the squared radius of the circle. The implementation of
  512. {\tt point\_on\_circle1(P,c)} and \linebreak {\tt p3\_circle1(A,B,C)}
  513. is almost straightforward. The latter function finds the circle
  514. through 3 given points, computing its center as the intersection point
  515. of two midpoint perpendiculars.
  516. For purposes of analytic geometry it is often better to work with the
  517. representation {\tt Circle} derived from the description of the circle
  518. as the set of points $(x,y)$ for which the expression
  519. \[(x-m_1)^2+(y-m_2)^2-r^2 = (x^2+y^2) -2\,m_1\,x -2\,m_2\,y
  520. +m_1^2+m_2^2-r^2 \]
  521. vanishes. We use homogeneous coordinates {\tt k:Circle}
  522. $=(k_1,k_2,k_3,k_4)$ for the circle
  523. \[k:=\{\,(x,y)\ :\ k_1*(x^2+y^2)+k_2*x+k_3*y+k_4 = 0\}\]
  524. since they admit denominator free computations and include also lines
  525. as special circles with infinite radius: The line $g=(g_1,g_2,g_3)$ is
  526. the circle $(0,g_1,g_2,g_3)$.
  527. Its easy to derive formulas {\tt circle\_center(k)} for the center of
  528. the circle $k$ and {\tt circle\_sqradius(k)} for its squared radius.
  529. It is also straightforward to test {\tt point\_on\_circle(P,k)}. The
  530. parameters of the circle {\tt p3\_circle(A,B,C)} through 3 given
  531. points
  532. \begin{code}\>
  533. A:=Point($a_1,a_2$); B:=Point($b_1,b_2$); C=Point($c_1,c_2$);
  534. \end{code}
  535. may be obtained from a nontrivial solution of the corresponding
  536. homogeneous linear system with coefficient matrix
  537. \[\left(\begin{array}{cccc}
  538. a_1^2+a_2^2 & a_1 & a_2 & 1 \\ b_1^2+b_2^2 & b_1 & b_2 & 1 \\
  539. c_1^2+c_2^2 & c_1 & c_2 & 1 \\
  540. \end{array}\right)
  541. \]
  542. The condition that 4 points are on a common circle then may be
  543. expressed as
  544. \begin{code}\>
  545. p4\_circle(A,B,C,D) == point\_on\_circle(D,p3\_circle(A,B,C));
  546. \end{code}
  547. For generic points $A,B,C,D$ this yields a polynomial $p_4$ of degree
  548. 4 in their coordinates.
  549. Note that this condition is equivalent to the circular angle theorem:
  550. For generic points $A,B,C,D$
  551. \begin{code}\+\>
  552. u:=angle(pp\_line(A,D),pp\_line(B,D));\\
  553. v:=angle(pp\_line(A,C),pp\_line(B,C));\\
  554. (num(u)*den(v)-den(u)*num(v));
  555. \end{code}
  556. yields the same condition $p_4$. The common denominator {\tt
  557. den(u)*den(v)} corresponds to the degeneracy condition that either
  558. $A,B,C$ or $A,B,D$ are collinear.
  559. \medskip
  560. This condition is also equivalent to {\em Ptolemy's theorem}:
  561. \begin{quote}
  562. For points $A,B,C,D$ are (in that order) on a circle iff
  563. \[l(AB)*l(CD)+l(AD)*l(BC) = l(AC)*l(BD),\]
  564. i.e., the sum of the products of the lengths of opposite sides of the
  565. cyclic quadrilateral $ABCD$ equals the product of the lengths of its
  566. diagonals.
  567. \end{quote}
  568. For an elementary proof see \cite[2.61]{Coxeter:67}. To get a
  569. mechanized proof with the tools developed so far we are faced with
  570. several problems. First the theorem invokes distances and not their
  571. squares. Second the theorem uses the order of the given points.
  572. Unordered geometry can't even distinguish between sides and diagonals
  573. of a quadrilateral.
  574. The fist problem may be solved by repeated squaring. Denoting the
  575. lengths appropriately we get step by step
  576. \[\begin{array}{c}
  577. p\cdot r + q\cdot s = t\cdot u\\
  578. (p\,r)^2+(q\,s)^2-(t\,u)^2 = -(2\,p\,q\,r\,s)\\
  579. ((p\,r)^2+(q\,s)^2-(t\,u)^2)^2 - (2\,p\,q\,r\,s)^2 = 0
  580. \end{array}\]
  581. arriving at an expression that contains only squared distances. This
  582. expression
  583. \[{\tt poly:= }\ p^4\,r^4 - 2\,p^2\,q^2\,r^2\,s^2 -
  584. 2\,p^2\,r^2\,t^2\,u^2 + q^4\,s^4 - 2\,q^2\, s ^2\,t^2\,u^2 + t^4\,u^4
  585. \]
  586. is symmetric in pairs of opposite sides thus solving also the second
  587. problem. Substituting the corresponding squared distances of generic
  588. points $A,B,C,D$ we obtain exactly the square of the condition $p_4$.
  589. \medskip
  590. As for bisector coordinates the coordinates of intersection points of
  591. a circle and a line generally can't be expressed rationally in terms
  592. of the coordinates of the circles. For a generic circle {\tt c:=
  593. Circle($c_1,c_2,c_3,c_4$)} and a generic line {\tt
  594. d:=Line($d_1,d_2,d_3$)} we may solve the line equation for $y$ and
  595. substitute the result into the circle equation to get a single
  596. polynomial $q(x)$ of degree 2 with zeroes being the $x$-coordinate of
  597. the two intersection points of {\tt c} and {\tt d}:
  598. \begin{code}\>\+
  599. vars:=\{x,y\};\\
  600. polys:=\{c1*(x\^{}2+y\^{}2)+c2*x+c3*y+c4, d1*x+d2*y+d3\};\\
  601. s:=solve(second polys,y);\\
  602. q:=num sub(s,first polys);
  603. \end{code}
  604. $q:={x}^{2}\,c_1\,({d_1}^{2} +{d_2}^{2}) +x\,(2\,c_1\,d_1\,d_3 +
  605. c_2\,{d_2}^{2} -c_3\,d_1\,d_2 ) +(c_1\,{d_3}^{2} -c_3\,d_2\,d_3
  606. +c_4\,{d_2}^{2})$
  607. \medskip
  608. In many cases {\tt d} is the line through a specified point {\tt P:=
  609. Point($p_1,p_2$)} on the circle. Fixing these coordinates as generic
  610. ones we get the algebraic relations
  611. \begin{code}\>
  612. polys:=\{point\_on\_line(P,d), point\_on\_circle(P,c)\};
  613. \end{code}
  614. \formel{\{d_1\,p_1 +d_2\,p_2 +d_3, c_1\,{p_1}^{2} +c_1\,{p_2}^{2}
  615. +c_2\,p_1 +c_3\,p_2 +c_4\}}
  616. between the coordinates of $c, d$ and $P$. This dependency may be
  617. removed solving these equations for $d_3$ and $c_4$. In the new
  618. coordinates the polynomial $q(x)$ factors
  619. \begin{code}\>\+
  620. s:=solve(polys,\{d3,c4\});\\
  621. factorize sub(s,q);
  622. \end{code}
  623. into $x-p_1$ and a second factor that is linear in $x$. This yields
  624. the coordinates for the intersection point of {\tt c} and {\tt d}
  625. different from {\tt P} that are saved into a function {\tt
  626. other\_cl\_point(P,c,d)}. Similarly we computed the coordinates of the
  627. second intersection point of two circles $c_1$ and $c_2$ passing
  628. through a common point {\tt P} and saved into a function {\tt
  629. other\_cc\_point(P,c1,c2)}.
  630. Also conditions on the coordinates of a circle and a line resp.\ two
  631. circles to be tangent may be derived in a similar way.
  632. \medskip
  633. \noindent 6) These functions admit a constructive proof of {\em
  634. Miquels theorem}:
  635. \begin{quote} Let $\Delta\,ABC$ be a triangle. Fix arbitrary points
  636. $P,Q,R$ on the sides $AB, BC, AC$. Then the three circles through each
  637. vertex and the chosen points on adjacent sides pass through a common
  638. point.
  639. \end{quote}
  640. Take as above
  641. \begin{code}\>
  642. A:=Point(0,0); B:=Point(1,0); C:=Point(c1,c2);
  643. \end{code}
  644. Generic points on the sides may be introduced with three auxiliary
  645. indeterminates:
  646. \begin{code}\>\+
  647. P:=choose\_pl(pp\_line(A,B),u1);\\
  648. Q:=choose\_pl(pp\_line(B,C),u2);\\
  649. R:=choose\_pl(pp\_line(A,C),u3);
  650. \end{code}
  651. Then
  652. \begin{code}\>
  653. X:=other\_cc\_point(P,p3\_circle(A,P,R),p3\_circle(B,P,Q));
  654. \end{code}
  655. is the intersection point of two of the circles different from {\tt P}
  656. (its generic coordinates contain 182 terms) and since
  657. \begin{code}\>
  658. point\_on\_circle(X,p3\_circle(C,Q,R));
  659. \end{code}
  660. simplifies to zero the third circle also passes through {\tt X}.
  661. \section{Geometry Theorems of Equational Type}
  662. As already seen in the last section non-linear geometric conditions
  663. are best given through implicit polynomial dependency conditions on
  664. the coordinates of the geometric objects. In this more general setting
  665. a geometric statement may be translated into a {\em generic geometric
  666. configuration}, involving different geometric objects with coordinates
  667. depending on (algebraically independent) variables $\vau = (v_1,
  668. \ldots, v_n)$, a system of {\em polynomial conditions} $F= \{f_1,
  669. \ldots, f_r\}$ expressing the implicit geometric conditions and a
  670. polynomial $g$ encoding the geometric conclusion, such that, for a
  671. certain polynomial non degeneracy condition $h$, the following holds:
  672. \begin{quote}\it
  673. The geometric statement is true iff for all non degenerate correct
  674. special geometric configurations, i.e., with coordinates, obtained
  675. from the generic ones by specialization $v_i\mapsto c_i$ in such a
  676. way, that $f({\bf c})=0$ for all $f\in F$ but $h({\bf c})\neq 0$, the
  677. conclusion holds, i.e., $g({\bf c})$ vanishes.
  678. \end{quote}
  679. Denoting by $Z(F)$ the set of zeroes of the polynomial system $F$ and
  680. writing $Z(h)=Z(\{h\})$ for short, we arrive at {\em geometry theorems
  681. of equational type}, that may be shortly stated in the form
  682. \[Z(F)\setminus Z(h) \subseteq Z(g).\]
  683. Over an algebraically closed field, e.g. ${\bf C}$, this is equivalent
  684. to the ideal membership problem
  685. \[g\cdot h\in rad\ I(F),\]
  686. where $rad\ I(F)$ is the radical of the ideal generated by $F$. Even
  687. if $h$ is unknown a detailed analysis of the different components of
  688. the ideal $I(F)$ allows to obtain more insight into the geometric
  689. problem.
  690. \medskip
  691. Note the symmetry between $g$ and $h$ in the latter formulation of
  692. geometry theorems. This allows to derive {\em non degeneracy
  693. conditions} for a given geometry theorem of equational type from the
  694. stable ideal quotient
  695. \[h\in rad\ I(F):g^\infty.\]
  696. Since every element of this ideal may serve as non degeneracy
  697. condition there is no weakest condition among them, if the ideal is
  698. not principal.
  699. \subsection{Dependent and independent variables}
  700. Let $S=R[v_1,\ldots,v_n]$ be the polynomial ring in the given
  701. variables over the field of scalars $R$. The polynomial system $F$
  702. describes algebraic dependency relations between these variables in
  703. such a way that the values of some of the variables may be chosen
  704. (almost) arbitrarily whereas the remaining variables are determined
  705. upto a finite number of values by these choices.
  706. \medskip
  707. A set of variables $\uhh\subset\vau$ is called {\em independent} wrt.\
  708. the ideal $I=I(F)$ iff $I\cap R[\uhh]=(0)$, i.e., the variables are
  709. algebraically independent modulo $I$. If $\uhh$ is a maximal subset
  710. with this property the remaining variables $\iks=\vau\setminus\uhh$
  711. are called {\em dependent}.
  712. Although a maximal set of independent variables may be read off from a
  713. \gr\ basis of $I$ there is often a natural choice of dependent and
  714. independent variables induced from the geometric problem. $\uhh$ is a
  715. maximal independent set of variables iff $F$ has a finite number of
  716. solutions as polynomial system in $\iks$ over the generic scalar field
  717. $R(\uhh)$. In many cases this may be proved with less effort than
  718. computing a \gr\ basis of $I$ over $S$.
  719. If $F$ has an infinite number of solutions then $\uhh$ was independent
  720. but not maximal. If $F$ has no solution then $\uhh$ was not
  721. independent.
  722. \subsection{Geometry theorems of linear type}
  723. We arrive at a particularly nice situation in the case when $F$ is a
  724. non degenerate quadratic linear system of equations in $\iks$ over
  725. $R(\uhh)$. Such geometry theorems are called {\em of linear type}.
  726. In this case there is a unique (rational) solution $\iks = \iks(\uhh)$
  727. that may be substituted for the dependent variables into the geometric
  728. conclusion $g=g(\iks,\uhh)$. We obtain as for geometry theorems of
  729. constructive type a rational expression in $\uhh$ and
  730. \begin{quote}\it
  731. the geometry theorem holds (under the non degeneracy condition
  732. $h=det(F)\in R[\uhh]$, where $det(F)$ is the determinant of the linear
  733. system $F$) iff this expression simplifies to zero.
  734. \end{quote}
  735. \noindent 7) As an example consider the {\em theorem of Pappus}:
  736. \begin{quote}
  737. Let $A,B,C$ and $P,Q,R$ be two triples of collinear points. Then the
  738. intersection points $g(AQ)\wedge g(BP), g(AR)\wedge g(CP)$ and
  739. $g(BR)\wedge g(CQ)$ are collinear.
  740. \end{quote}
  741. The geometric conditions put no restrictions on $A,B,P,Q$ and one
  742. restriction on each $C$ and $R$. Hence we may take as generic
  743. coordinates
  744. \begin{code}\>\+
  745. A:=Point(u1,u2); B:=Point(u3,u4); C:=Point(x1,u5);\\
  746. P:=Point(u6,u7); Q:=Point(u8,u9); R:=Point(u0,x2);
  747. \end{code}
  748. with $u_0,\ldots,u_9$ independent and $x_1,x_2$ dependent, as
  749. polynomial conditions
  750. \begin{code}\>
  751. F:=\{collinear(A,B,C), collinear(P,Q,R)\};
  752. \end{code}
  753. and as conclusion
  754. \begin{code}\+\+
  755. con:=collinear(\\
  756. intersection\_point(pp\_line(A,Q),pp\_line(P,B)),\\
  757. intersection\_point(pp\_line(A,R),pp\_line(P,C)),\\
  758. intersection\_point(pp\_line(B,R),pp\_line(Q,C)));
  759. \end{code}
  760. a rational expression with 462 terms. The polynomial conditions are
  761. linear in $x_1,x_2$ and already separated. Hence
  762. \begin{code}\>\+
  763. sol:=solve(polys,\{x1,x2\});\\
  764. sub(sol,con);
  765. \end{code}
  766. proves the theorem since the expression obtained from $con$
  767. substituting the dependent variables by their rational expressions in
  768. $\uhh$ simplifies to zero.
  769. \medskip
  770. As for most theorems of linear type the linear system may be solved
  771. ``geometrically'' and the whole theorem may be translated into a
  772. constructive geometric statement:
  773. \begin{code}\>\+
  774. A:=Point(u1,u2); B:=Point(u3,u4);\\
  775. P:=Point(u6,u7); Q:=Point(u8,u9);\\[6pt]
  776. C:=choose\_pl(pp\_line(A,B),u5);\\
  777. R:=choose\_pl(pp\_line(P,Q),u0);\\[6pt]
  778. con:=collinear(\+\\
  779. intersection\_point(pp\_line(A,Q),pp\_line(P,B)),\\
  780. intersection\_point(pp\_line(A,R),pp\_line(P,C)),\\
  781. intersection\_point(pp\_line(B,R),pp\_line(Q,C)));
  782. \end{code}
  783. \subsection{Geometry theorems of non-linear type}
  784. Lets return to the general situation of a polynomial system $F\subset
  785. S$ that describes algebraic dependency relations, a subdivision
  786. $\vau=\iks\cup\uhh$ of the variables into dependent and independent
  787. ones, and the conclusion polynomial $g(\iks,\uhh)\in S$. The set of
  788. zeros $Z(F)$ may be decomposed into irreducible components that
  789. correspond to prime components $P_\alpha$ of the ideal $I=I(F)$
  790. generated by $F$ over the ring $S=R[\iks,\uhh]$.
  791. Since $P_\alpha\supset I$ the variables $\uhh$ may become dependent
  792. wrt.\ $P_\alpha$. Prime components where $\uhh$ remains independent
  793. are called {\em generic}, the other components are called {\em
  794. special}. Note that each special component contains a non zero
  795. polynomial in $R[\uhh]$. Multiplying them all together yields a non
  796. degeneracy condition $h=h(\uhh)\in R[\uhh]$ on the independent
  797. variables such that a zero $P\in Z(F)$ with $h(P)\neq 0$ necessarily
  798. belongs to one of the generic components. Hence they are the
  799. ``essential'' components and we say that the geometry theorem is {\em
  800. generically true}, when the conclusion polynomial $g$ vanishes on all
  801. these generic components.
  802. \medskip
  803. If we compute in the ring $S'=R(\uhh)[\iks]$, i.e., consider the
  804. independent variables as parameters, exactly the generic components
  805. remain visible. Indeed, this corresponds to a localization of $S$ by
  806. the multiplicative set $R[\uhh]\setminus\{0\}$. Hence the geometry
  807. theorem is generically true iff $g\in rad(I)\cdot S'$, i.e. $g$
  808. belongs to the radical of the ideal $I$ in this special extension of
  809. $S$. A sufficient condition can be derived from a \gr\ basis $G$ of
  810. $F$ with the $\uhh$ variables as parameters: Test whether $g\ mod\ G
  811. =0$, i.e., the normal form vanishes. More subtle examples may be
  812. analyzed with the \gr\ factorizer or more advanced techniques from the
  813. authors package CALI, \cite{CALI}.
  814. \medskip
  815. \noindent 8) As an application we consider the following nice theorem
  816. from \cite[ch. 4, \S\ 2]{Coxeter:67} about Napoleon triangles:
  817. \begin{quote}
  818. Let $\Delta\,ABC$ be an arbitrary triangle and $P,Q$ and $R$ the third
  819. vertex of equilateral triangles erected externally on the sides $BC,
  820. AC$ and $AB$ of the triangle. Then the lines $g(AP), g(BQ)$ and
  821. $g(CR)$ pass through a common point, the {\em Fermat point} of the
  822. triangle $\Delta\,ABC$.
  823. \end{quote}
  824. A mechanized proof again will be faced with the difficulty that
  825. unordered geometry can't distinguish between different sides wrt.\ a
  826. line. A straightforward formulation of the geometric conditions starts
  827. with independent coordinates for $A,B,C$ and dependent coordinates for
  828. $P,Q,R$. W.l.o.g. we may fix the coordinates in the following way:
  829. \begin{code}\+\>
  830. A:=Point(0,0); B:=Point(0,2); C:=Point(u1,u2);\\
  831. P:=Point(x1,x2); Q:=Point(x3,x4); R:=Point(x5,x6);
  832. \end{code}
  833. There are 6 geometric conditions for the 6 dependent variables.
  834. \begin{code}\+\+
  835. polys:=\{\>\>sqrdist(P,B)-sqrdist(B,C), sqrdist(P,C)-sqrdist(B,C),\\
  836. sqrdist(Q,A)-sqrdist(A,C), sqrdist(Q,C)-sqrdist(A,C),\\
  837. sqrdist(R,B)-sqrdist(A,B), sqrdist(R,A)-sqrdist(A,B)\};
  838. \end{code}
  839. \formel{
  840. {x_1}^{2} +{x_2}^{2} -4\,x_2 -{u_1}^{2} -{u_2}^{2} +4\,u_2\\
  841. {x_1}^{2} -2\,x_1\,u_1 +{ x_2}^{2} -2\,x_2\,u_2 +4\,u_2 -4\\
  842. {x_3}^{2} +{x_4}^{2} -{u_1}^{2} -{u_2}^{2}\\
  843. {x_3}^{2} -2\,x_3\,u_1 +{x_4}^{2} -2\,x_4\,u_2\\
  844. {x_5}^{2} +{x_6}^{2} -4\,x_6\\
  845. {x_5}^{2} +{x_6}^{2} -4}
  846. These equations may be divided into three groups of two quadratic
  847. relations for the coordinates of each of the points $P,Q,R$. Each of
  848. this pairs has (only) two solutions, the inner and the outer triangle
  849. vertex, since it may easily be reduced to a quadratic and a linear
  850. equation, the line equation of the corresponding midpoint
  851. perpendicular. Hence the whole system has 8 solutions and by geometric
  852. reasons the conclusion
  853. \begin{code}\>
  854. con:=concurrent(pp\_line(A,P), pp\_line(B,Q), pp\_line(C,R));
  855. \end{code}
  856. will hold on at most two of them. Due to the special structure the
  857. interreduced polynomial system is already a \gr\ basis and hence can't
  858. be split by the \gr\ factorizer. A full decomposition into isolated
  859. primes yields four components over $R(\uhh)$, each corresponding to a
  860. pair of solutions over the algebraic closure. On one of them the
  861. conclusion polynomial reduces to zero thus proving the geometry
  862. theorem.
  863. \begin{code}\>\+
  864. vars:=\{x1,x2,x3,x4,x5,x6\};\\
  865. setring(vars,\{\},lex);\\
  866. iso:=isolatedprimes polys;\\[6pt]
  867. for each u in iso collect con mod u;
  868. \end{code}
  869. With a formulation as in \cite[p.~123]{Chou:88}, that uses oriented
  870. angles, we may force all Napoleon triangles to be erected on the {\em
  871. same} side (internally resp.\ externally) and prove a more general
  872. theorem as above. Taking isosceles triangles with equal base angles
  873. and (due to one more degree of freedom) $x_5$ as independent the
  874. conclusion remains valid:
  875. \begin{code}
  876. polys2:=\{\>\>sqrdist(P,B)-sqrdist(P,C),\+\+\\
  877. sqrdist(Q,A)-sqrdist(Q,C), \\
  878. sqrdist(R,A)-sqrdist(R,B), \\
  879. num(p3\_angle(R,A,B)-p3\_angle(P,B,C)), \\
  880. num(p3\_angle(Q,C,A)-p3\_angle(P,B,C))\};\-\-\\[6pt]
  881. sol:=solve(polys2,\{x1,x2,x3,x4,x6\});\\
  882. sub(first sol,con);
  883. \end{code}
  884. again simplifies to zero. Note that the new theorem is of linear type.
  885. \section{The Procedures Supplied by \geo}\label{description}
  886. This section contains a short description of all procedures available
  887. in \geo. We refer to the data types {\tt Scalar, Point, Line, Circle1}
  888. and {\tt Circle} described above. Booleans are represented as extended
  889. booleans, i.e.\ the procedure returns a {\tt Scalar} that is zero iff
  890. the condition is fulfilled. In some cases also a non zero result has a
  891. geometric meaning. For example, {\tt collinear(A,B,C)} returns the
  892. signed area of the corresponding parallelogram.
  893. \bigskip
  894. \xxyy{angle\_sum(a,b:Scalar):Scalar }{Returns $\tan(\alpha+\beta)$, if
  895. $a=\tan(\alpha), b=\tan(\beta)$.}
  896. \xxyy{altitude(A,B,C:Point):Line }{The altitude from $A$ onto
  897. $g(BC)$. }
  898. \xxyy{c1\_circle(M:Point,sqr:Scalar):Circle}{The circle with given
  899. center and sqradius.}
  900. \xxyy{cc\_tangent(c1,c2:Circle):Scalar}{Zero iff $c_1$ and $c_2$ are
  901. tangent.}
  902. \xxyy{choose\_pc(M:Point,r,u):Point}{Chooses a point on the circle
  903. around $M$ with radius $r$ using its rational parametrization with
  904. parameter $u$.}
  905. \xxyy{choose\_pl(a:Line,u):Point }{Chooses a point on $a$ using
  906. parameter $u$.}
  907. \xxyy{Circle(c1,c2,c3,c4:Scalar):Circle}{The {\tt Circle} constructor.}
  908. \xxyy{Circle1(M:Point,sqr:Scalar):Circle1}{The {\tt Circle1}
  909. constructor. }
  910. \xxyy{circle\_center(c:Circle):Point}{The center of $c$.}
  911. \xxyy{circle\_sqradius(c:Circle):Point}{The sqradius of $c$.}
  912. \xxyy{cl\_tangent(c:Circle,l:Line):Scalar}{Zero iff $l$ is tangent to
  913. $c$.}
  914. \xxyy{collinear(A,B,C:Point):Scalar}{Zero iff $A,B,C$ are on a common
  915. line. In general the signed area of the parallelogram spanned by
  916. $\vec{AB}$ and $\vec{AC}$. }
  917. \xxyy{concurrent(a,b,c:Line):Scalar}{Zero iff $a,b,c$ have a common
  918. point.}
  919. \xxyy{intersection\_point(a,b:Line):Point}{The intersection point of
  920. the lines $a,b$. }
  921. \xxyy{l2\_angle(a,b:Line):Scalar}{Tangens of the angle between $a$ and
  922. $b$. }
  923. \xxyy{Line(a,b,c:Scalar):Line}{The {\tt Line} constructor.}
  924. \xxyy{lot(P:Point,a:Line):Line}{The perpendicular from $P$ onto $a$.}
  925. \xxyy{median(A,B,C:Point):Line}{The median line from $A$ to $BC$.}
  926. \xxyy{midpoint(A,B:Point):Point}{The midpoint of $AB$. }
  927. \xxyy{mp(B,C:Point):Line}{The midpoint perpendicular of $BC$.}
  928. \xxyy{orthogonal(a,b:Line):Scalar}{zero iff the lines $a,b$ are
  929. orthogonal. }
  930. \xxyy{other\_cc\_point(P:Point,c1,c2:Circle):Point}{ $c_1$ and $c_2$
  931. intersect at $P$. The procedure returns the second intersection
  932. point. }
  933. \xxyy{other\_cl\_point(P:Point,c:Circle,l:Line):Point}{$c$ and $l$
  934. intersect at $P$. The procedure returns the second intersection
  935. point.}
  936. \xxyy{p3\_angle(A,B,C:Point):Scalar}{Tangens of the angle between
  937. $\vec{BA}$ and $\vec{BC}$. }
  938. \xxyy{p3\_circle(A,B,C:Point):Circle\ {\rm or\ }\\
  939. p3\_circle1(A,B,C:Point):Circle1}{The circle through 3 given points. }
  940. \xxyy{p4\_circle(A,B,C,D:Point):Scalar}{Zero iff four given points
  941. are on a common circle. }
  942. \xxyy{par(P:Point,a:Line):Line}{The line through $P$ parallel to
  943. $a$. }
  944. \xxyy{parallel(a,b:Line):Scalar}{Zero iff the lines $a,b$ are
  945. parallel. }
  946. \xxyy{pedalpoint(P:Point,a:Line):Point}{The pedal point of the
  947. perpendicular from $P$ onto $a$.}
  948. \xxyy{Point(a,b:Scalar):Point}{The {\tt Point} constructor.}
  949. \xxyy{point\_on\_bisector(P,A,B,C:Point):Scalar}{Zero iff $P$ is a
  950. point on the (inner or outer) bisector of the angle $\angle\,ABC$.}
  951. \xxyy{point\_on\_circle(P:Point,c:Circle):Scalar\ {\rm or\ }\\
  952. point\_on\_circle1(P:Point,c:Circle1):Scalar}{Zero iff $P$ is on the
  953. circle $c$.}
  954. \xxyy{point\_on\_line(P:Point,a:Line):Scalar}{Zero iff $P$ is on the
  955. line $a$. }
  956. \xxyy{pp\_line(A,B:Point):Line}{The line through $A$ and $B$.}
  957. \xxyy{sqrdist(A,B:Point):Scalar}{Square of the distance between $A$
  958. and $B$.}
  959. \xxyy{sympoint(P:Point,l:Line):Point}{The point symmetric to $P$ wrt.\
  960. the line $l$.}
  961. \xxyy{symline(a:Line,l:Line):Line}{The line symmetric to $a$ wrt.\ the
  962. line $l$.}
  963. \xxyy{varpoint(A,B:Point,u):Point}{The point $D=u\cdot A+(1-u)\cdot
  964. B$. }
  965. \noindent \geo\ supplies as additional tools the functions
  966. \bigskip
  967. \xxyy{extractmat(polys,vars)}{Returns the coefficient matrix of the
  968. list of equations $polys$ that are linear in the variables $vars$. }
  969. \xxyy{red\_hom\_coords(u:\{Line,Circle\})}{Returns the reduced
  970. homogeneous coordinates of $u$, i.e., divides out the content. }
  971. \section{More Examples}
  972. Here we give a more detailed explanation of some of the examples
  973. collected in the test file {\tt geometry.tst} and give a list of
  974. exercises. Their solutions can be found in the test file, too.
  975. \subsection{Theorems that can be translated into theorems of
  976. constructive or linear type}
  977. There are many geometry theorems that may be reformulated as theorems
  978. of constructive type.
  979. \medskip
  980. \noindent 9) The affine version of {\em Desargue's theorem}:
  981. \begin{quote}
  982. If two triangles $\Delta\,ABC$ and $\Delta\,RST$ are in similarity
  983. position,\linebreak i.e., $g(AB)\,\|g(RS),\ g(BC)\|g(ST)$ and
  984. $g(AC)\|g(RT)$, then $g(AR),\linebreak g(BS)$ and $g(CT)$ pass through
  985. a common point (or are parallel).
  986. \end{quote}
  987. The given configuration may be constructed step by step in the
  988. following way: Take $A,B,C,R$ arbitrarily, choose $S$ arbitrarily on
  989. the line through $R$ parallel to $g(AB)$ and $T$ as the intersection
  990. point of the lines through $R$ parallel to $g(AC)$ and through $S$
  991. parallel to $g(BC)$.
  992. \begin{code}\>\+
  993. A:=Point(a1,a2); B:=Point(b1,b2);\\
  994. C:=Point(c1,c2); R:=Point(d1,d2);\\
  995. S:=choose\_pl(par(R,pp\_line(A,B)),u);\\
  996. T:=intersection\_point(\\\>\>
  997. par(R,pp\_line(A,C)),par(S,pp\_line(B,C)));\\[6pt]
  998. con:=concurrent(pp\_line(A,R),pp\_line(B,S),pp\_line(C,T));
  999. \end{code}
  1000. Another proof may be obtained translating the statement into a theorem
  1001. of linear type. Since the geometric conditions put no restrictions on
  1002. $A,B,C,R$, one restriction on $S$ ($g(AB)\|g(RS)$) and two
  1003. restrictions on $T$ ($g(BC)\|g(ST),\,$ $g(AC)\|g(RT)$),
  1004. we may take as generic coordinates
  1005. \begin{code}\>\+
  1006. A:=Point(u1,u2); B:=Point(u3,u4); C:=Point(u5,u6);\\
  1007. R:=Point(u7,u8); S:=Point(u9,x1); T:=Point(x2,x3);
  1008. \end{code}
  1009. with $u_1,\ldots,u_9$ independent and $x_1,x_2,x_3$ dependent, as
  1010. polynomial conditions
  1011. \begin{code}\+\+
  1012. polys:=\{\>\>parallel(pp\_line(R,S),pp\_line(A,B)),\\
  1013. parallel(pp\_line(S,T),pp\_line(B,C)),\\
  1014. parallel(pp\_line(R,T),pp\_line(A,C))\};
  1015. \end{code}
  1016. and as conclusion
  1017. \begin{code}\>
  1018. con:=concurrent(pp\_line(A,R),pp\_line(B,S),pp\_line(C,T));
  1019. \end{code}
  1020. The polynomial conditions are linear in $x_1,x_2,x_3$ and thus
  1021. \begin{code}\>\+
  1022. sol:=solve(polys,\{x1,x2,x3\});\\
  1023. sub(sol,con);
  1024. \end{code}
  1025. proves the theorem since the expression obtained from $con$
  1026. substituting the dependent variables by their rational expressions in
  1027. $\uhh$ simplifies to zero.
  1028. \medskip
  1029. The general version of {\em Desargue's theorem}:
  1030. \begin{quote}
  1031. The lines $g(AR),\ g(BS)$ and $g(CT)$ pass through a common point iff
  1032. the intersection points $g(AB)\wedge g(RS),\ g(BC)\wedge g(ST)$ and
  1033. $g(AC)\wedge g(RT)$ are collinear.
  1034. \end{quote}
  1035. may be reduced to the above theorem by a projective transformation
  1036. mapping the line through the three intersection points to infinity.
  1037. Its algebraic formulation
  1038. \begin{code}\>\+
  1039. A:=Point(0,0); B:=Point(0,1); C:=Point(u5,u6);\\
  1040. R:=Point(u7,u8); S:=Point(u9,u1); T:=Point(u2,x1);\\[6pt]
  1041. con1:=collinear(\+\\intersection\_point(pp\_line(R,S),pp\_line(A,B)),\\
  1042. intersection\_point(pp\_line(S,T),pp\_line(B,C)),\\
  1043. intersection\_point(pp\_line(R,T),pp\_line(A,C)));\-\\
  1044. con2:=concurrent(pp\_line(A,R),pp\_line(B,S),pp\_line(C,T));
  1045. \end{code}
  1046. contains a polynomial $con_2$ linear in $x_1$ and a rational function
  1047. $con_1$ with numerator quadratic in $x_1$ that factors as
  1048. \[{\rm num}(con_1)=con_2\cdot {\rm collinear}(R,S,T)\]
  1049. thus also proving the general theorem.
  1050. \medskip
  1051. \noindent 10) Consider the following theorem about the {\em Brocard
  1052. points} (\cite[p.~336]{Chou:88})
  1053. \begin{quote}
  1054. Let $\Delta\,ABC$ be a triangle. The circles $c_1$ through $A,B$ and
  1055. tangent to $g(AC)$, $c_2$ through $B,C$ and tangent to $g(AB)$, and
  1056. $c_3$ through $A,C$ and tangent to $g(BC)$ pass through a common
  1057. point.
  1058. \end{quote}
  1059. It leads to a theorem of linear type that can't be translated into
  1060. constructive type in an obvious way. The circles may be described each
  1061. by 3 dependent variables and 3 conditions
  1062. \begin{code}\>\+
  1063. A:=Point(0,0); B:=Point(1,0); C:=Point(u1,u2);\\[6pt]
  1064. c1:=Circle(1,x1,x2,x3);\\
  1065. c2:=Circle(1,x4,x5,x6);\\
  1066. c3:=Circle(1,x7,x8,x9);\-\\[6pt]
  1067. polys:=\{\>\>
  1068. cl\_tangent(c1,pp\_line(A,C)), \+\+\\
  1069. point\_on\_circle(A,c1), \\
  1070. point\_on\_circle(B,c1), \\
  1071. cl\_tangent(c2,pp\_line(A,B)), \\
  1072. point\_on\_circle(B,c2), \\
  1073. point\_on\_circle(C,c2), \\
  1074. cl\_tangent(c3,pp\_line(B,C)), \\
  1075. point\_on\_circle(A,c3), \\
  1076. point\_on\_circle(C,c3)\};
  1077. \end{code}
  1078. that are linear in the dependent variables. Hence the coordinates of
  1079. the circles and the intersection point of two of them may be computed
  1080. and checked for incidence with the third circle:
  1081. \begin{code}\>\+
  1082. vars:=\{x1,x2,x3,x4,x5,x6,x7,x8,x9\};\\
  1083. sol:=solve(polys,vars);\\[6pt]
  1084. P:=other\_cc\_point(C,sub(sol,c1),sub(sol,c2));\\
  1085. con:=point\_on\_circle(P,sub(sol,c3));
  1086. \end{code}
  1087. Again $con$ simplifies to zero thus proving the theorem.
  1088. \medskip
  1089. Even some theorems involving nonlinear objects as circles may be
  1090. translated into theorems of constructive type using a rational
  1091. parametrization of the non linear object. For a circle with radius $r$
  1092. and center $M=(m_1,m_2)$ we may use the rational parametrization
  1093. \[\{(\frac{1-u^2}{1+u^2}r+m_1,\frac{2u}{1+u^2}r+m_2)\ |\ u\in {\bf
  1094. C}\}.\]
  1095. This way we can prove
  1096. \medskip
  1097. \noindent 11) {\em Simson's theorem} (\cite[p. 261]{Chou:84},
  1098. \cite[thm. 2.51]{Coxeter:67}):
  1099. \begin{quote}
  1100. Let $P$ be a point on the circle circumscribed to the triangle
  1101. $\Delta\,ABC$ and $X,Y,Z$ the pedal points of the perpendiculars from
  1102. $P$ onto the lines passing through pairs of vertices of the triangle.
  1103. These points are collinear.
  1104. \end{quote}
  1105. Take the center $M$ of the circumscribed circle as the origin and $r$
  1106. as its radius. The proof of the problem may be mechanized in the
  1107. following way:
  1108. \begin{code}\>\+
  1109. M:=Point(0,0);\\
  1110. A:=choose\_pc(M,r,u1);\\
  1111. B:=choose\_pc(M,r,u2);\\
  1112. C:=choose\_pc(M,r,u3);\\
  1113. P:=choose\_pc(M,r,u4);\\
  1114. X:=pedalpoint(P,pp\_line(A,B));\\
  1115. Y:=pedalpoint(P,pp\_line(B,C));\\
  1116. Z:=pedalpoint(P,pp\_line(A,C));\\[8pt]
  1117. con:=collinear(X,Y,Z);
  1118. \end{code}
  1119. Since $con$ simplifies to zero this proves the theorem.
  1120. \subsection{Theorems of equational type}
  1121. An ``almost'' constructive proof of Simson's theorem may be obtained
  1122. in the following way:
  1123. \begin{code}\>\+
  1124. A:=Point(0,0); B:=Point(u1,u2);\\
  1125. C:=Point(u3,u4); P:=Point(u5,x1);\\
  1126. X:=pedalpoint(P,pp\_line(A,B));\\
  1127. Y:=pedalpoint(P,pp\_line(B,C));\\
  1128. Z:=pedalpoint(P,pp\_line(A,C));\\[6pt]
  1129. poly:=p4\_circle(A,B,C,P);\\[6pt]
  1130. con:=collinear(X,Y,Z);
  1131. \end{code}
  1132. There is a single dependent variable bound by the quadratic condition
  1133. $poly$ that the given points are on a common circle. $con$ is a
  1134. rational expression with numerator equal to
  1135. \formel{poly\cdot {\rm collinear}(A,B,C)^2. }
  1136. Since the second factor may be considered as degeneracy condition this
  1137. also proves Simson's theorem. The factors of the denominator
  1138. \formel{{\rm den}(con)={\rm sqrdist}(A,B)\cdot {\rm sqrdist}(A,C)\cdot
  1139. {\rm sqrdist}(B,C) }
  1140. are exactly the non degeneracy conditions collected during the
  1141. computation. They may be printed with {\tt print\_ndg()}.
  1142. \medskip
  1143. One may also substitute the rational coordinate construction of
  1144. $X,Y,Z$ through {\tt pedalpoint} with additional dependent variables
  1145. and polynomial conditions:
  1146. \begin{code}\>\+
  1147. M:=Point(0,0); A:=Point(0,1); \\
  1148. B:=Point(u1,x1); C:=Point(u2,x2); P:=Point(u3,x3);\\
  1149. X:=varpoint(A,B,x4);\\ Y:=varpoint(B,C,x5);\\ Z:=varpoint(A,C,x6);
  1150. \end{code}
  1151. The polynomial conditions
  1152. \begin{code}
  1153. polys:=\{\>\> sqrdist(M,B)-1, sqrdist(M,C)-1, sqrdist(M,P)-1,\+\+\\
  1154. orthogonal(pp\_line(A,B),pp\_line(P,X)),\\
  1155. orthogonal(pp\_line(A,C),pp\_line(P,Z)),\\
  1156. orthogonal(pp\_line(B,C),pp\_line(P,Y))\};
  1157. \end{code}
  1158. contain three quadratic polynomials in $x_1,x_2,x_3$ and three
  1159. polynomials linear in $x_4,x_5,x_6$. The quadratic polynomials
  1160. correspond to different points on the circle with given
  1161. $x$-coordinate. The best variable order eliminates linear variables
  1162. first. Thus the following computations prove the theorem
  1163. \begin{code}
  1164. con:=collinear(X,Y,Z);\\[8pt]
  1165. vars:=\{x4,x5,x6,x1,x2,x3\};\\
  1166. setring(vars,\{\},lex);\\
  1167. setideal(polys,polys);\\
  1168. con mod gbasis polys;
  1169. \end{code}
  1170. since the conclusion polynomial reduces to zero.
  1171. \medskip
  1172. \noindent 12) The Butterfly Theorem (\cite[p. 269]{Chou:84},
  1173. \cite[thm. 2.81]{Coxeter:67}) :
  1174. \begin{quote}
  1175. Let $A,B,C,D$ be four points on a circle with center $O$, $P$ the
  1176. intersection point of $AC$ and $BD$ and $F$ resp. $G$ the intersection
  1177. point of the line through $P$ perpendicular to $OP$ with $AB$
  1178. resp. $CD$. Then $P$ is the midpoint of $FG$.
  1179. \end{quote}
  1180. Taking $P$ as the origin and the lines $g(FG)$ and $g(OP)$ as axes we
  1181. get the following coordinatization:
  1182. \begin{code}\>\+
  1183. P:=Point(0,0); O:=Point(u1,0);\\
  1184. A:=Point(u2,u3); B:=Point(u4,x1);\\
  1185. C:=Point(x2,x3); D:=Point(x4,x5); \\
  1186. F:=Point(0,x6); G:=Point(0,x7);\-\\[6pt]
  1187. polys:=\{\>\> sqrdist(O,B)-sqrdist(O,A),\+\+\\
  1188. sqrdist(O,C)-sqrdist(O,A), \\
  1189. sqrdist(O,D)-sqrdist(O,A),\\
  1190. point\_on\_line(P,pp\_line(A,C)),\\
  1191. point\_on\_line(P,pp\_line(B,D)),\\
  1192. point\_on\_line(F,pp\_line(A,D)),\\
  1193. point\_on\_line(G,pp\_line(B,C))\};\-\-\\[6pt]
  1194. con:=num sqrdist(P,midpoint(F,G));
  1195. \end{code}
  1196. Note that the formulation of the theorem includes $A\neq C$ and $B\neq
  1197. D$. Hence the conclusion may (and will) fail on some of the components
  1198. of $Z(polys)$. This can be avoided supplying appropriate constraints
  1199. to the \gr\ factorizer:
  1200. \begin{code}\>\+
  1201. vars:=\{x6,x7,x3,x5,x1,x2,x4\};\\
  1202. setring(vars,\{\},lex);\\[6pt]
  1203. sol:=groebfactor(polys,\{sqrdist(A,C),sqrdist(B,D)\});\\[6pt]
  1204. for each u in sol collect con mod u;
  1205. \end{code}
  1206. $sol$ contains a single solution that reduces the conclusion $con$ to
  1207. zero. Hence the \gr\ factorizer could split the components and remove
  1208. the auxiliary ones.
  1209. Note that there is also a constructive proof of the Butterfly theorem,
  1210. see {\tt geometry.tst}.
  1211. \medskip
  1212. \noindent 13) Let's prove another property of Feuerbach's circle
  1213. (\cite[thm. 5.61]{Coxeter:67}):
  1214. \begin{quote}
  1215. For an arbitrary triangle $\Delta\,ABC$ Feuerbach's circle is tangent
  1216. to its in- and excircles (tangent circles for short).
  1217. \end{quote}
  1218. Take the same coordinates as in example 5 and construct the
  1219. coordinates of the center $N$ of Feuerbach's circle $c_1$ as in
  1220. example 4:
  1221. \begin{code}\>\+
  1222. A:=Point(0,0); B:=Point(2,0); C:=Point(u1,u2);\\
  1223. M:=intersection\_point(mp(A,B),mp(B,C));\\
  1224. H:=intersection\_point(altitude(A,B,C),altitude(B,C,A));\\
  1225. N:=midpoint(M,H);\\[6pt]
  1226. c1:=c1\_circle(N,sqrdist(N,midpoint(A,B)));
  1227. \end{code}
  1228. The coordinates of the center {\tt P:=Point(x1,x2)} of one of the
  1229. tangent circles are bound by the conditions
  1230. \begin{code}
  1231. polys:=\{point\_on\_bisector(P,A,B,C), point\_on\_bisector(P,B,C,A)\};
  1232. \end{code}
  1233. Due to the choice of the coordinates $x_2$ is the radius of this
  1234. circle. Hence the conclusion may be expressed as
  1235. \begin{code}\>
  1236. con:=cc\_tangent(c1\_circle(P,x2\^{}2),c1);
  1237. \end{code}
  1238. The polynomial conditions $polys$ have four generic solutions, the
  1239. centers of the four tangent circles, as derived in example 5. Since
  1240. \begin{code}\>\+
  1241. vars:=\{x1,x2\};\\
  1242. setring(vars,\{\},lex);\\
  1243. setideal(polys,polys);\\
  1244. num con mod gbasis polys;
  1245. \end{code}
  1246. yields zero this proves that all four circles are tangent to
  1247. Feuerbach's circle. \cite[ch.5,\S 6]{Coxeter:67} points out that
  1248. Feuerbach's circle of $\Delta\,ABC$ coincides with Feuerbach's circle
  1249. of each of the triangles $\Delta\,ABH,\, \Delta\,ACH$ and
  1250. $\Delta\,BCH$. Hence there are another 12 circles tangent to
  1251. $c_1$. This may be proved
  1252. Note that the proof in \cite{Coxeter:67} uses inversion geometry. The
  1253. author doesn't know about a really ``elementary'' proof of this
  1254. theorem.
  1255. \section{Exercises}
  1256. \begin{itemize}
  1257. \item[1.] (\cite[p. 267]{Chou:84}) Let $ABCD$ be a square and $P$ a
  1258. point on the line parallel to $BD$ through $C$ such that
  1259. $l(BD)=l(BP)$, where $l(BD)$ denotes the distance between $B$ and
  1260. $D$. Let $Q$ be the intersection point of $BF$ and $CD$. Show that
  1261. $l(DP)=l(DQ)$.
  1262. \item[2.] The altitudes' pedal points theorem: Let $P,Q,R$ be the
  1263. altitudes' pedal points in the triangle $\Delta\,ABC$. Show that the
  1264. altitude through $Q$ bisects $\angle\, PQR$.
  1265. \item[3.] Let $\Delta\,ABC$ be an arbitrary triangle. Consider the
  1266. three altitude pedal points and the pedal points of the perpendiculars
  1267. from these points onto the the opposite sides of the triangle. Show
  1268. that these 6 points are on a common circle, the {\em Taylor circle}.
  1269. \item[4.] Prove the formula \[F(\Delta\,ABC) = \frac{a\,b\,c}{4\,R},\]
  1270. for the area of the triangle $\Delta\,ABC$, if $a,b,c$ are the lengths
  1271. of its sides and $R$ the radius of its circumscribed circle.
  1272. \item[5.] (\cite[p. 283]{Chou:84}) Let $k$ be a circle, $A$ the contact
  1273. point of the tangent line from a point $B$ to $k$, $M$ the midpoint of
  1274. $AB$ and $D$ a point on $k$. Let $C$ be the second intersection point
  1275. of $DM$ with $k$, $E$ the second intersection point of $BD$ with $k$
  1276. and $F$ the second intersection point of $BC$ with $k$. Show that $EF$
  1277. is parallel to $AB$.
  1278. \item[6.] (35th IMO 1995, Toronto, problem 1, \cite{IMO}) Let
  1279. $A,B,C,D$ be four distinct points on a line, in that order. The
  1280. circles with diameters $AC$ and $BD$ intersect at the points $X$ and
  1281. $Y$. The line $XY$ meets $BC$ at the point $Z$. Let $P$ be a point on
  1282. the line $XY$ different from $Z$. The line $CP$ intersects the circle
  1283. with diameter $AC$ at the points $C$ and $M$, and the line $BP$
  1284. intersects the circle with diameter $BD$ at the points $B$ and
  1285. $N$. Prove that the lines $AM, DN$ and $XY$ are concurrent.
  1286. \item[7.] (34th IMO 1994, Hong Kong, problem 2, \cite{IMO}) $ABC$ is
  1287. an isosceles triangle with $AB = AC$. Suppose that
  1288. \begin{enumerate}
  1289. \item[(i)] $M$ is the midpoint of $BC$ and $O$ is the point on the
  1290. line $AM$ such that $OB$ is perpendicular to $AB$;
  1291. \item[(ii)] $Q$ is an arbitrary point on the segment $BC$ different
  1292. from $B$ and $C$;
  1293. \item[(iii)] $E$ lies on the line $AB$ and $F$ lies on the line $AC$
  1294. such that $E, Q$ and $F$ are distinct and collinear.
  1295. \end{enumerate}
  1296. \noindent
  1297. Prove that $OQ$ is perpendicular to $EF$ if and only if $QE = QF$.
  1298. \item[8.] (4th IMO 1959, Czechia, problem 6, \cite{Morozova:68}) Show
  1299. that the distance $d$ between the centers of the inscribed and the
  1300. circumscribed circles of a triangle $\Delta\,ABC$ satisfies
  1301. $d^2=r^2-2r\rho$, where $r$ is the radius of the circumscribed circle
  1302. and $\rho$ the radius of the inscribed circle.
  1303. \item[9.] (1th IMO 1959, Roumania, problem 5, \cite{Morozova:68}) Let
  1304. $M$ be a point on AB, $AMCD$ and $MBEF$ squares to the same side of
  1305. $g(AB)$ and $N$ the intersection point of their circumscribed circles,
  1306. different from $M$.
  1307. \begin{enumerate}
  1308. \item[(i)] Show that $g(AF)$ and $g(BC)$ intersect at $N$.
  1309. \item[(ii)] Show that all lines $g(MN)$ for various $M$ meet at a
  1310. common point.
  1311. \end{enumerate}
  1312. \end{itemize}
  1313. \bibliographystyle{plain} \bibliography{geometry}
  1314. \end{document}