User:Thepigdog/Value Set Logic Programming

Value Set Programming is formed by combining the use of Value Sets, reversible functions, and Demand Driven Evaluation.

Value Sets are sets of values a variable may take. The use of Value Sets allows logic to be evaluated without backtracking.

Reversible functions allow simple equations to be solved.

Demand Driven Evaluations allows working with sets of simple unsolved equations to dynamically decide the correct order or processing.

The result is a high level paradigm for writing software.

Index

 * Value Sets
 * Value Set Implementation
 * Function to Fact Transformation
 * Demand Driven Evaluation.

Summary
Equations that have a single occurrence of the unknown variable may be solved by applying inverse functions. For example,


 * $$15 = x * 2 + 5$$

may easily be solved by applying inverse functions to give,


 * $$(15 - 5) / 2 = (x * 2 + 5 - 5)/2 = x$$

Therefore,


 * $$x = 2$$

This solves simple equations if inverse functions exist. However for many functions there is no inverse function. An inverse for a function exists only if the mapping is one to one. Otherwise the inverse function would have multiple values which is not allowed in mathematics.

A Value Set allows a function with no inverse function in its data type to have a inverse function that returns a Value Set of the data type. A Value Set is a single value that represents all the values that the inverse function would have.

In particular the logic operators "and" and "or" do not have inverse functions. So Value Sets applied to logic make logic easy to work with.

To evaluate simple unsolved equations the order of evaluation needs to be controlled by the requested value. In the above example $$x$$ is the value we want to evaluate (the requested value). By writing the above equation as,


 * $$15 = y + 5$$
 * $$y = x * 2$$

then requesting x and applying the inverse function gives,


 * $$x = y / 2$$

Then by requesting y we get,


 * $$y = 15 - 5$$

So the request process orders the evaluation of functions to give us the result.

Foundations
These principles give a programming System that can work with logic operations and with many unsolved equations. This provides the foundations for a high level but efficient programming system.

Links

 * Intelligence and Reasoning
 * Symbolic Logic Systems