Symbolic Logic:Programming:Value Set 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.

History
Writing programs in imperitive programs forces us to write the solution, not the problem. This in turn forces programs to be too low level, leading to brittleness and the gradual decay of programs over time, as the environment in which they run changes.

Early work on theorem provers lead to Logic programming. Logic Programming is based on Resolution and uses backtracking to work through a tree of possible solutions.

Constraint Logic Programming is an extension of Logic Programming to add constraints (conditions on variables).

While Logic Programming supported variables that may have many values, Functional Programming deals with calculations that may only return a single value.

The Curry Programming Language unifies Functional Programming with constraints, using narrowing, to derive a new paradigm for logic programming.

Value Set Programming extends this idea to derive a simple basis for programming free from backtracking, but with the ability to solve trivial equations, and handle variables with multiple values. It supports logic programming but in a different way than the traditional Logic Programming approach.

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

 * Symbolic Logic:Programming
 * Intelligence and Reasoning