Thanks to visit codestin.com
Credit goes to github.com

Skip to content

thtrieu/GeoGen

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Automated Generation of Planar Geometry Olympiad Problems (Master's Thesis)

The software can generate difficult geometry problems suitable for mathematical contests. The following is an automatically generated, drawn, and stated problem:

Alt text

Table of Contents

About

This repository contains the code developed for the master's thesis Automated Generation of Planar Geometry Olympiad Problems. For more information check out the following assets:

Installation

The system requires to have .NET 5.0 installed.

Building

The application can be built via dotnet build run in the Source folder.

Unit Tests

Automated tests can be run via dotnet test run in the Source folder.

Libraries

All major logic is written from scratch, with heavy use of LINQ to objects.

The following helper libraries have also been used:

For tests, we used:

Usage

Main Launcher

This is the main module that runs the main algorithm. The application tries to read the settings from the file settings.json. The example settings are available here. As a start, you may copy this file to the folder with the executable. These settings are configured so that:

Constructions

The following constructions are supported in input files (and object introduction rules / inference rules / drawing rules...):

  • CircleWithCenterThroughPoint - takes two points A, B and outputs the circle with the center A and a radius AB
  • CircleWithDiameter - takes two points A, B and outputs the circle with a diameter AB.
  • Circumcenter - takes three points A, B, C and outputs the circumcenter of triangle ABC.
  • Circumcircle - takes three points A, B, C and outputs the circumcircle of triangle ABC.
  • Excenter - takes three points A, B, C and outputs the A-excenter of triangle ABC.
  • Excircle - takes three points A, B, C and outputs the A-excircle of triangle ABC.
  • ExternalAngleBisector - takes three points A, B, C and outputs the external angle bisector of angle BAC.
  • Incenter - takes three points A, B, C and outputs the incenter of triangle ABC.
  • Incircle - takes three points A, B, C and outputs the incircle of triangle ABC.
  • InternalAngleBisector - takes three points A, B, C and outputs the internal angle bisector of angle BAC.
  • IntersectionOfLineAndLineFromPoints - takes four points A, B, C, D and outputs the intersection point of lines AB and CD.
  • IntersectionOfLines - takes two lines and outputs their intersection points.
  • IntersectionOfLinesFromPoints - takes a line l and two points A, B and outputs the intersection point of lines l and AB.
  • IsoscelesTrapezoidPoint - takes three points A, B, C and outputs such a point D that ABCD is an isosceles trapezoid.
  • LineFromPoints - takes two points and outputs the line passing through both of them.
  • LineThroughCircumcenter - takes three points A, B, C and outputs the line through A and the circumcenter of ABC.
  • Median - takes three points A, B, C and outputs the A-median of triangle ABC.
  • Midline - takes three points A, B, C and outputs the A-midline of triangle ABC.
  • Midpoint - takes two points A, B and output the midpoint of segment AB.
  • MidpointOfArc - takes three points A, B, C and outputs the midpoint of arc BAC.
  • MidpointOfOppositeArc - takes three points A, B, C and outputs the midpoint of arc BAC not containing A.
  • NinePointCircle - takes three points A, B, C and outputs the Nine-Point circle of triangle ABC.
  • OppositePointOnCircumcircle - takes three points A, B, C and outputs such a point D that AD is a diameter of the circumcircle of ABC.
  • Orthocenter - takes three points A, B, C and outputs the orthocenter of triangle ABC.
  • ParallelLine - takes a point A and a line l and outputs the line through A parallel to l.
  • ParallelLineToLineFromPoints - takes three points A, B, C and outputs the line through A parallel to BC.
  • ParallelogramPoint - takes three points A, B, C and outputs such a point D that ABDC is a parallelogram.
  • PerpendicularBisector - takes two points A, B and outputs the perpendicular bisector of segment AB.
  • PerpendicularLine - takes a point P and a line l and outputs the line through P perpendicular to l.
  • PerpendicularLineAtPointOfLine - takes two points A, B and outputs the line through A perpendicular to AB.
  • PerpendicularLineToLineFromPoints - takes three points A, B, C and outputs the perpendicular line through A to BC.
  • PerpendicularProjection - takes a point P and a line l and outputs the projection of P onto l.
  • PerpendicularProjectionOnLineFromPoints - takes three points A, B, C and outputs the projection of A onto BC.
  • PointReflection - takes two points A, B and outputs the reflection of A in B.
  • ReflectionInLine - takes a line l and a point P and outputs the reflection of A in l.
  • ReflectionInLineFromPoints - takes three points A, B, C and outputs the reflection of A in line BC.
  • SecondIntersectionOfCircleAndLineFromPoints - takes four points A, C, C, D and outputs the second intersection point of line AB and the circumcircle of ACD.
  • SecondIntersectionOfTwoCircumcircles - takes five points A, B, C, D, E and outputs the second intersection point of the circumcircles ABC and ADE.
  • TangentLine - takes three points A, B, C and outputs the tangent line to the circumcircle of ABC at A.

Inference rules

The used inference rules can be found here. They use constructions described here.

Object introduction rules

The used object introduction rules can be found here. They use constructions described here.

Drawing Launcher

Provides visualization of the results produced by Main Launcher via generating EPS figures using MetaPost.

Requirements

  • MikTeX (other distributions haven't been tested, but they will probably work too)
  • OPmac, used for quick font selection while printing problem texts

To preview generated results, I personally use

Running

The application tries to read the settings from the file settings.json. The example settings are available here.

After running, you are requested to provide a path to a JSON theorem file. These files are produced by the Main Launcher. In our examples, the files from the folders JsonOutput and JsonBestTheorems. After selecting the theorems to be drawn, the program will generate eps files in the folder with the executable.

Macros and rules

Note the following folder, which contains all written MetaPost macros and custom drawing rules.

Tip for quick previewing on Windows

  1. In the settings, set PostcompilationCommand to file.bat

  2. In the folder with the executable create a file file.bat with the following content:

    @ECHO OFF
    
    SET /A starting_index = %1
    SET /A number_of_files = %2
    SET /A maximal_index = %starting_index% + %number_of_files% - 1
    
    FOR /L %%i IN (%starting_index% 1 %maximal_index%) DO "{SumatraPath}" "figures.%%i"
    
    EXIT 0
    

{SumatraPath} should be replaced with the path to the SumatraPDF executable. The usual location on Windows is C:\Program Files\SumatraPDF\SumatraPDF.exe. This will ensure that drawn figures are automatically opened for previewing.

Theorem Proving Integration Test

If you want to review the capabilities of the theorem prover, then run this test. The main method requires two arguments:

  1. The path to the folder with inference rules.
  2. The path to the folder with object introduction rules.

The default values that should work after cloning can be found in launchSettings.json.

Helper modules

The following modules were used to prepare the large-scale experiments described in the thesis.

  • Configuration Generation Launcher - this module was used to test the counts of generated configurations for certain input files (and memory usage). It can be used similarly as the Main Launcher, with the default settings available here, which needs to be copied to the folder with the executable. The output is not saved, only printed into the console.
  • Input Generation Launcher - this module generated input files. Running it would generate around 4500 small files, totaling 4MB.
  • Output Merging Launcher - this module merged the final result. The main method requires one argument, the path to the folder with JSON outputs (the folder is scanned recursively).

Contact

For more information, you can contact me via email.

About

Automated generation of planar geometry olympiad problems

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%