Interactive Solver for Polynomial Inequalities Using Interval Arithmetic
Total Page:16
File Type:pdf, Size:1020Kb
DESIGN PROJECT REPORT DESIGN PROJECT 2A 2020/2021 INTERACTIVE SOLVER FOR POLYNOMIAL INEQUALITIES USING INTERVAL ARITHMETIC Mart de Roos (s2176416) Neil Kichler (s2106019) Rifqi Adlan Apriyadi (s2079755) Max Resing (s2069229) Supervised By: Dr.-Ing. Moritz Hahn Department of FMT University of Twente, Enschede 1 Abstract The report is part of the Design Project course at the University of Twente. The project was requested by the University group Formal Methods and Tools (FMT). The motivation behind the project is the sparse availability of interactive visualization tools in the domain of inter- val arithmetic. A big issue in mathematics is uncertainty, a quantitative estimation of errors. Interval arithmetic is one of the mathematical tools to eliminate uncertainty and to draw mathematically sound conclusions. The project focuses on the visual support of solving polynomial inequal- ities using interval arithmetic. In interval arithmetic, the variables of polynomial inequalities are representative of intervals with well-defined boundaries. The parameter space is then divided into regions, which can be split into finer sub-regions. The inequalities can be evaluated for the boundaries of the sub-regions to determine whether a given inequalities holds true, false, or undecided for specific boundaries. The report elab- orates on the design process during the development of the application, including the specification of the requirements, the design choices, the mathematical background and the testing procedure. A system overview is given and every aspect of the application is explained and justified in detail. In the future, this application could be used by researchers and practitioners interested in applying interval arithmetic to their specific problems. 2 Contents 1 Introduction 6 2 Domain Analysis 7 2.1 Potential Users . .7 2.2 Existing software . .7 3 Requirements 8 3.1 User requirements . .8 3.2 System requirements . .9 4 Planning 10 4.1 Feature Planning . 10 4.2 Schedule & Milestones . 11 5 Research 13 5.1 Mathematical Background . 13 5.1.1 Mathematical Operators . 13 5.1.2 Monotonic and Non-Monotonic Functions . 14 5.1.3 Inequality Operators . 15 5.2 Interval Arithmetic on Modern-day Computers . 15 5.2.1 Machine-made Issues . 15 5.2.2 IEEE 754 - Standard for Floating-Point Arithmetic . 16 5.2.3 Rational Data Type . 17 5.2.4 IEEE 1788 - Standard for Interval Arithmetic . 17 5.2.5 MPFR - Solution to Floating-Point Rounding Errors . 18 5.3 Ternary Operations . 19 5.4 Parser . 19 5.4.1 Stages of a parser . 20 5.4.2 Tokenizer . 20 5.4.3 Grammar . 20 5.4.4 Abstract syntax tree . 21 5.4.5 Walking an abstract syntax tree . 21 5.4.6 Parser types . 22 6 Global and Architectural design 23 7 Preliminary Design Choices 24 7.1 Programming Language . 24 7.2 Libraries . 24 7.3 Architectural Design Choices . 28 3 8 System Overview 29 8.1 Menu . 29 8.2 2D-View . 30 8.3 Console . 31 8.4 History . 32 8.5 Region Table View . 33 8.6 Region Tree View . 34 8.7 3D-View . 35 8.8 Notes . 36 8.9 Help Box . 36 9 Detailed Design 38 9.1 Data Layout . 38 9.2 History . 39 9.3 Saving and Loading Files . 39 9.4 Graphical User Interface . 39 9.5 3D-Viewport . 41 9.6 Interval Arithmetic . 43 9.6.1 Arithmetic Operations . 44 9.6.2 Boolean Operations . 45 9.6.3 Numerical Operations . 46 9.7 Splitting intervals . 47 9.7.1 Memory Pool Allocation . 47 9.7.2 Manual Refinement . 49 9.7.3 Automatic Refinement . 49 9.8 Parser . 51 9.9 Expressions . 53 9.9.1 Unary Expressions . 53 9.9.2 Expression Sequences . 54 9.10 Evaluables . 54 9.10.1 InEquations . 55 9.10.2 Ternaries . 55 10 Testing 57 10.1 Interval Tests . 57 10.2 Expression Tests . 58 10.3 Property Tests . 58 10.4 Ternary Tests . 58 10.5 Parser Tests . 59 10.6 Task Scheduler Tests . 59 10.7 Gui Tests . 59 10.8 Usability . 60 10.8.1 Heuristics . 60 10.8.2 Evaluation . 61 4 11 Limitations 63 11.1 Parser . 63 11.2 Parsable Ternary Logic Operators . 63 11.3 Numerals . 63 11.4 Exponentiation with negative base . 64 11.5 GUI . 64 12 Evaluation and Conclusion 66 12.1 Requirements evaluation . 66 12.1.1 User requirements . 66 12.1.2 System requirements . 67 12.2 Reflection on Planning . 67 12.3 Reflection on Group Work . 68 12.4 Future Work . 69 12.5 Conclusion . 70 Appendices 73 A Images of Entire Application 73 5 1 Introduction The nature of mathematics is to provide precise answers and conclusions to a given problem. Whereas in practice, precision is a variable term and should rather be seen as accuracy. A temperature sensor can indicate that the temper- ature is 21 degree Celsius. But this measurement is actually an approximation and depending on the accuracy of the sensor, the actual temperature lies within an interval of 20.5 to 21.5 degree Celsius. This is essentially where interval arithmetic excels. Interval arithmetic is a mathematical tool to provide precise answers in a domain of uncertainty. In gen- eral, interval arithmetic provides the same arithmetic, trigonometric, numeric and Boolean operations which other fields of mathematics use. Nonetheless, interval arithmetic has some special rules and characteristics which might occur unconventional when comparing it to regular arithmetical operations. The product at hand was built on top of the theory of interval arithmetic. Since interval arithmetic supports the regular common operations like addition, subtractions, multiplication and non-negative exponentiation, one can also build polynomials in interval arithmetic. These polynomials can be added to an in- equality. An inequality is essentially a polynomial compared to a Boolean op- eration. The polynomial can have arbitrarily many variables. In an inequality, one can try to assign intervals to each variable. Next, one can try to shrink the intervals of each variable to draw conclusions under which set of numbers a given inequality holds true or false. The process of reducing the size of the intervals is called refinement. The application in question is a tool which visually supports the user to re- fine a given inequality and to draw conclusions about the inequality statement. The software helps to understand the characteristics of interval arithmetic. Fur- thermore, it supports a user's thinking process when working with intervals and inequalities. More use cases, as well as existing software is covered in the domain analysis in Chapter 2. Chapter 3 summarizes the user and system requirements before presenting a planning and milestones in Chapter 4. Afterwards, Chapter 5 cov- ers previously made research regarding mathematical and technical difficulties. It also includes applied theory which can be found in the products implemen- tation. Lastly, it refers to existing standards of the Institute of Electrical and Electronics Engineers (IEEE). The global architecture and a broad design de- scription is included in Chapter 6 before discussing detailed design decisions in Chapter 7. Chapter 8 guides the reader through the different components of the program. After making the reader familiar with the application, Chapter 7 is complemented with a technical detailed design description. Chapters 10 and 11 discuss technical limitations of the product as well as obstacles which the team encountered during the 10 weeks implementation of the project. Afterwards, the report continues with the team's testing approaches. The design report is concluded with possible extensions and future work and a final conclusion. 6 2 Domain Analysis Although, most of people with a mathematical education are aware of intervals, very few people actually studied the details of interval arithmetic. Since inter- val arithmetic is so exotic there exist very few tools to support researchers in this domain. Since interval arithmetic deals with real numbers, it bears some additional problems when developing programs which deal with intervals. An elaboration can be found in the research section 5. 2.1 Potential Users The system is designed for researchers and practitioners interested in inter- actively applying interval arithmetic to their mathematical problems. These mathematical problems can include polynomial or non-polynomial inequalities and constraint based systems that use Boolean expressions. Moreover, the pro- gram can be interesting to researchers developing new refinement algorithms in that it can give visual insights into these problems. Understanding the math- ematical problem domain inherently gives insight to the potential use cases. It is thus recommended to refer to Chapter 5.1. The client of this project is Moritz Hahn from the FMT (formal methods and tools) faculty of the Univer- sity of Twente who is simultaneously also the supervisor of this project. It can be assumed that all potential users are familiar with the subject material and have a good understanding of interval arithmetic. Focusing on explaining in- terval arithmetic inside the application is thus not needed and their knowledge regarding the use of complex programs will be fairly similar. 2.2 Existing software Given that the problem domain is rather academic in nature, not many produc- tion quality tools exist that can solve interval arithmetic problems interactively. A notable example is RSolver [10]. It focuses on a specific algorithm developed by Stefan Ratschan and visualizes the results in a two-dimensional scene. In- teracting with the program is, however, limited to entering new problems and seeing the solver automatically refine the problem. Manual refinement is not possible - only predefined settings can be toggled. Another program in this space is iSAT3 [1]. It is a command-line constraint checker that has its own do- main specific language to encode arithmetic problems which will then be solved.