User:Thepigdog/Meta values

Meta values are the representation of mathematics, or programs, as data to be manipulated by other programs or mathematics.

Meta values are similar to quotations, but explicitly include the structure of the object of the quotation.

Meta Values
If mathematics is rules, then how do we describe rules about mathematics. Most of the time these rules about rules may be represented, simply as rules. There are only a few situations, usually in relation to the stating of axioms, that the ideas of meta-values need to be applied.

However more generally, the use of meta-values is used in,
 * The parsing of text to produce mathematics.
 * The description of algorithms for describing the processing or mathematical objects.

The idea of meta values may be used in the resolution of paradoxes. Evaluation may be divided into execution steps called meta-phases. An initial meta-phase may produce a mathematical equation. However the mathematical equation may not refer back to objects in an earlier meta-phase. This avoids certain paradoxes.

Consider the quotation "consider the quotation". The quotation marks distinguish between the text and the meta-text. In programming languages, the quotes have come to be designating a string of characters without meaning. But that is not the human view of the text in quote. In common language, "consider the quotation" has grammatical structure. It is still considered as text from the English language.

There may also be levels of quotation, as in, "Consider the quotation 'consider the quotation'". A quotation may contain a quotation.

Because of ambiguities, and previous use for representing strings, the quote has lost it's meaning. The symbol "meta" may be used to replace it in a new mathematics. meta(1, 5) means the value 5, but considered as a mathematical object. meta(1, x * y) means the mathematical object x * y, but not the calculation that may be made from it.

Then meta(-1, meta(1, 5)) = 5. The first parameter to meta is the change in meta level.

The use of meta allows the explicit statement of many ideas that must be implied, or hand-waved away, if meta is not understood explicitly as an idea.

Meta Phases
Evaluation of variables, and running of programs may be divided into stages, called meta phases. A conventional example of a meta phase is compilation of a program (compilation phase), followed by running of the program (execution phase). Many large systems use some code generation to write common code, to implement interfaces across languages, database access, and implement GUI/web frameworks. Code generation is also considered as a meta phase.

There are other examples of the phased execution. Implementation and installation of large computer systems is often implemented by the execution of programs to create, or update the database schema to match the schema required by the code.

The purpose of all these steps is speed up the execution of the program for the user. Multiple phases could be eliminated, at some speed cost to the user.
 * Compilation phase - use an interpreted language.
 * Code generation - Database access - uses list of fields representation of objects.
 * Code generation - Interface - use late binding (reflection).
 * Schema update - Check schema is up to date on usage.
 * GUI Framework - Implement using list of fields representation of objects.

The lack of systematic language features for phased execution is key draw back in current system development technologies. The common feature of phased implementation is the provision of general abstract functionality, realized as efficient implementations. This may be considered as "partial evaluation". Partial evaluation is the execution and optimization of code based on incomplete information to generate a more efficient implementation for the end user.

Partial Evaluation
Partial evaluation is the evaluation of the properties of a program that may determined prior to the final execution of the program, to determine,
 * Data types.
 * Determinacy.
 * Constant values and expressions.
 * Determine what data fields are required.
 * Check what code is required.
 * Run code that does not depend on user input (schema update).
 * Implement meta language features.
 * To check and or prove the validity of the program.

Integrated language based partial evaluation is a key feature for any advance in programming language design.

Phased evaluation to resolve paradoxes
Many paradoxes result from some type of reflection. In designing computer systems there are many logical problems associated with changing the meta structure of the program while executing the program in a single phase. Code that changes the structure of the code while executing logic makes the system hard to analyze and test.

By dividing the executions into meta phases, but still within the same language and software system many logical and design problems may be resolved.

Implementation of language features
Many language features would better be implemented as rules to be implemented in a meta phase. For example, object inheritance,


 * If A inherits from B and B has a method M and A does not define M, then A has a method M.

This is the somewhat strange rule of inheritance implemented in current OO languages. It is exceedingly strange. It does not implement the sub-set relationship described as "is a" in English. Such a rule would be,


 * If A inherits from B and B has a method M, a call to M on A calls both the method M defined for A, if there is one, and the method M for B.

This rule is an implementation of the principle.
 * If A is a B, then anything true about all B instances is true also about all A instances.

Implementing of inheritance in a meta-rules would allow the developer to define correct inheritance semantics, and also invent related semantics. The implementation could be made more efficient by partial evaluation, which would reduce the program down to simpler form, prior to the end user execution phase.