Architecture, Design and Implementation of a Mathematical Derivation - - PowerPoint PPT Presentation
Architecture, Design and Implementation of a Mathematical Derivation - - PowerPoint PPT Presentation
Architecture, Design and Implementation of a Mathematical Derivation Editor Johannes Eriksson What is the Derivation Editor? The Mathematical Derivation Editor (nicknamed Mathedit) is work in progress; it aims be a useful tool for
The Mathematical Derivation Editor (nicknamed “Mathedit”) is work in progress; it aims be a useful tool for creating, editing and correctness checking mathematical papers.
What is the Derivation Editor?
2 / 24
Gaudi software factory Ralph-Johan Back Main director and producer Victor Bos Designer Viorel Preoteasa Designer Johannes Eriksson Developer
Main developers
What is the Derivation Editor? 3 / 24
- Outlining editor
- Editing of hierarchically structured text
- Useful for writing mathematical papers
- Input of special characters
- Editing structured calculational proof
Examples from Back, Grundy, v. Wright: Structured Calculation Proof
Goals
What is the Derivation Editor? 4 / 24
- Correctness checking
- Export to presentation formats such as HTML and LaTeX
- Extensible
- Define an API to allow users to modify and extend the editor's
behaviour
Goals (Continued)
What is the Derivation Editor? 5 / 24
Features
6 / 24
The basic features of a graphical text editor:
- Basic editing commands (type character, delete, move cursor,...)
- Editable keybindings
- Input of unicode characters (using a keybinding or the menu)
- Cut, copy, paste via system clipboard
- Load and save files (XML)
Basic text editing
Features 7 / 24
- Hierarchically structured text
- Strict outlining
- Possiblity to collapse/expand items
Outlining
Features 8 / 24
- Expression and rule markup
- Syntax understanding
- Mathematical profiles
- Profile interface
- The universal profile (UP)
Formula syntax
Features 9 / 24
- Determines applicable rules by unification
- Steps can be generated automatically or written manually
- Correctness checking
- Parsing of complete derivations
- Re-application of rules, compares terms
- Nested derivations
- Result of a conditional rule
- Focuses on a subexpression
- Assumptions = scoped rules
Derivation
Features 10 / 24
- Extensibility, user-defined tools
- Some source code features (mainly syntax highlighting)
- Export filters
- HTML with Javascript or CSS
- LaTeX
- Possibility to #include documents
- Hyperlinks between documents
- Other minor features
Other features
Features 11 / 24
Development
12 / 24
The programming work has been carried out by computer science and computer engineering students from Åbo Akademi, who have been em- ployed as programmers at the Gaudi Software Factory. The bulk of the work has been done during the two summers of 2002 and 2003, when four programmers worked full-time. Some part-time work during the semesters. Several different teams, altogether 11 individuals have been working as programmers on the project.
People
Development 13 / 24
- Short iterations
- Pair programming
- Unit tests
- Continuous refactoring
Extreme programming
Development 14 / 24
- Python language
- Linux PCs
- xemacs editor
- Gaudi Sourceforge on xprog0.cs.abo.fi
- Task tracking
- Bugtracking
Development tools
Development 15 / 24
Architecture, design and implementation
16 / 24
A bottom-up, incremental software development methodology. Soft- ware is built in thin layers where each successive layer introduces a new feature and does not break the functionality of previous layers.
- Classes in a new layer become subclasses of the corresponding
classes in previous layer, i.e. the application is extended by inherit- ance of its classes.
- Overridden methods should preserve functionality from previous
layers.
- The different components (packages, modules, classes) and the lay-
er hierarchy are orthogonal partitionings of the software.
Stepwise Feature Introduction (SFI)
Architecture, design and implementation 17 / 24
Layer structure of Mathedit
Architecture, design and implementation 18 / 24
Command
Main window, menu, toolbar and command pat- tern.
Frame
Multiple (empty) windows.
Text
Text editing (unicode) with the QTextEdit widget, Open, Save, Save As, Save All. Our own docu- ment model.
MV
Multiple views of the same document, New View command.
Edit
Copy, cut and paste text.
CmdList
Support for undo/redo of editing commands. Ex- tended the document model with a command list.
Outline1
Extended the document model and editing capab- ilities of the text widget to support an outlining structure.
Outline2
Support for collapsing and expanding an item. Collapse hides all lines indented deeper than the current line, expand shows them again.
Format
Rich text formatting of text.
Derivation
Formula syntax. Is is possible to define math- emathical expressions, which the editor parses
Layer structure of Mathedit (Continued)
Architecture, design and implementation 19 / 24
according to its grammar. Perform mathemathical derivations by applying rules on expressions.
Profile
Possibility to add own profiles.
Filter
Filters for export to HTML and LaTeX, import of LaTeX.
Highlight
Syntax highlighting for programming languages.
Hook
Possibility to connect custom functions to hooks in mathedit.
Layer structure of Mathedit (Continued)
Architecture, design and implementation 20 / 24
- Naming conventions. Each class/subclass name is prefixed with
Layername_ to identify the layer it belongs to. Example:
Text_Document, Outline1_Document, Derivation_Document, ...
- Store metadata, e.g. the list of layers. Possible to find out the layer
- f any class as well as the layer's position in the hierarchy.
- Import modules by “try-and-catch”. Reduces the amount of factory
methods.
layers = [ Command, Frame, Text, ... ] layeri = layers.index(layer) while layeri>=0: try: exec("import "+layer+"_"+modulename) except ImportError: layeri -= 1 layer = layers[layeri] else: return eval(layer+"_"+modulename) raise "No module " + modulename
Special solutions to aid in SFI
Architecture, design and implementation 21 / 24
- Works well with incremental software development
- Each layer can be run as a standalone application, making it easier
to track down bugs
- Unit tests can follow layer hierachy
Advantages of SFI
Architecture, design and implementation 22 / 24
- Can make some refactorings difficult
- Changes to existing features may not fit well into the hierarchy
- Large number of classes and deep inheritance hierarchies may be
difficult to deal with
Disadvantages of SFI
Architecture, design and implementation 23 / 24
- Python 2.2
- Interpreted, object-oriented language
- Easy to learn
- Garbage collection
- Highly dynamic
- Introspective power
- www.python.org
- Qt 3.1
- A cross-platform C++ widget toolkit
- Language bindings for Python (PyQt)
- www.trolltech.com
Implementation
Architecture, design and implementation 24 / 24