RISC JKU
Theorema Tutorial

System Architecture

Major System Components

The major components of the Theorema system are reflected in the top-level directory structure of the Theorema installation. The directories "Documentation", "FrontEnd", and "Kernel" are standard directories expected to be present in every Mathematica package, they are required in order to guarantee smooth integration of Theorema into Mathematica, e.g. system documentation will be available through the Mathematica Documentation Center.

Computation

Language.m
Implements computational semantics of the Theorema built-in language constructs, e.g. numbers, tuples, finite sets, logical connectives, quantifiers with finite ranges, etc.

Interface

ColorSchemes.m
Color definitions for GUI components and notebooks.
GUI.m
Implements the whole graphical user interface displayed in the Theorema commander.
Language.m
Implements the mechanisms that allow setting up the system interface in different languages.

Knowledge

This directory and its subdirectories collect user-supplied mathematical theories.

Theorema Language

Expressions.m
Here are the definitions for formatting Theorema expressions, which can occur both in computations and outside of computations. The rest of the definitions for formatting expressions is in Syntax.m, see below.
This file is special, it is not a package for itself, it is a plain file, which is loaded twice during the system startup process. Once it is loaded inside the context Theorema`Language` and once it is loaded in the context Theorema`Computation`Language`, so that all definitions collected in Expressions.m are available in both contexts.
FormulaManipulation.m
This package collects functions for manipulating Theorema expressions, e.g. substitution of free variables, converting universally quantified equalities into Mathematica rewrite rules, etc.
Session.m
This package defines functions used for organizing the Theorema session, e.g. storing definitions and theorems, processing of global declarations, etc.
Syntax.m
This package defines the syntax of the Theorema language, both for input (MakeExpression and related) and for output (MakeBoxes and related). Regarding output, only a fragment of the language is defined here, the rest is in Expressions.m, see above.

Provers

Common.m
This packages defines the general proving mechanism and everything needed for it, e.g. the overall proof search procedure, datastructures for proof objects, inference rule handling, etc.
Strategies.m

System

Utilities.m

Common.m

This is a special package on the top-level of the hierarchy. Its purpose is to collect all public symbols to be exported. All packages that use symbols from other packages need to include only this package in order to have all exported symbols available.

Directories & Packages

The Theorema system consists of a multitude of packages. In the standard package layout in Mathematica, every package has a "public context" corresponding to the filename path and a "private context" (typically the public context with "`Private`" appended). The public contexts contain the names of symbols that should be visible outside of the package, these symbols are exported and can be used in other packages, due to the standard setup that puts the public context into Mathematica's context path $ContextPath. All non-exported symbols are in the respective private contexts and cannot be used in other packages since the private context is not part of the context path.
In order to keep the context path within a reasonable size, we setup context differently. Not every package corresponds to a context in the context path. Instead, we provide several contexts for symbols that should be shared between different packages of the system. These contexts typically do not correspond to a file in the system, they rather correspond to directories, although this must not be considered a strict rule of any significance.
Theorema`The context for some special system symbols. This context will be found in the context path after loading the system.
Theorema`Common`The context for functions and global variables making up the Theorema system implementation. This context is relevant for system developers mostly, Theorema users should not get in touch with this context.
Theorema`Language`The context for symbols making up the Theorema mathematical language. The symbols identifying Theorema language constructs (e.g. quantifiers, logical connectives, etc.) live in this context. None of these symbols has computational semantics attached to it, one can rely on the fact that expressions in this context do not evaluate in any way, these symbols are guaranteed to be uninterpreted.
Theorema`Computation`The context for symbols making up the computable fragment of the Theorema mathematical language. Some Theorema language constructs (e.g. quantifiers, logical connectives, etc.) have computational semantics for special finite cases. For these constructs, the uninterpretable symbol in Theorema`Language` corresponds uniquely to a symbol with the same name in Theorema`Computation`. Typically all symbols in this context have Mathematica defintions representing the computational semantics attached to it.
Theorema`Knowledge`The context for user-defined symbols. Constants, variables, functions, or predicates introduced by the user are stored in this context. No Theorema-internal symbols go into this context, it plays the role of the Global`-context in a standard Mathematica session.
Theorema`Computation`Knowledge`The computable counterparts of symbols in Theorema`Knowledge` are put inot this context.
Theorema`Knowledge`...User-defined theories store their symbols in subcontexts of Theorema`Knowledge`.
Theorema`Computation`Knowledge`...The computable counterparts of theory symbols are organized in respective subcontexts of Theorema`Computation`Knowledge`.
Theorema`Provers`The context for symbols used in the provers, typically e.g. the symbols referring to the inference rules of the provers.

Important contexts for shared symbols in the Theorema system.

The symbols defined in some of the above mentioned contexts.
In[9]:=
Click for copyable input
Out[11]=
In[12]:=
Click for copyable input
Out[12]=
In[21]:=
Click for copyable input
Out[21]=
In[22]:=
Click for copyable input
Out[22]=
In[26]:=
Click for copyable input
Out[26]=

Language Support

The Theorema system is designed in such a way that language-dependent portions of the implementation are grouped in well-defined places. In this way, we try to support the translation of the entire system into different languages.
Help texts for Theorema system functions

XXXX.