Contents
###### Abstract

In this paper we explore the application of some notable Boolean methods, namely the Disjunctive Normal Form representation of logic table expansions, and apply them to a real-valued logic model which utilizes quantities on the range [0,1] to produce a probabilistic programming of a game character’s logic in mathematical form.

Applying Boolean discrete methods in the production of a real-valued probabilistic programming model

Jonathan Nix

December 2015

## 1 Introduction

Let us begin please by considering the set of all functions of the form and where each , , and are single bits from the set {0,1}. Then we have the set of functions as depicted in Tables 1 and 2 which we may call the George Boole Logical Operators, where all such operators of the form , or may be interpreted as functions, e.g. , or , and vice-versa. When given the variable , or the tuple (,), which we may call Boolean variables, we may list each of their possible values, and then in the columns define each possible function that may exist.

From these tables we select the functions , , , and which satisfy the definitions of the Boolean NOT, AND, OR, and XNOR operators from , and so they are depicted in Table 3.

From these tables we can also observe that each function in can be written in terms of a function in as shown by Table 4, allowing that only those functions in be further utilized by this paper111Observe that the value of the quantity in Table 4 does not affect the output of the function..

Then the set may be used instead of the set and we select Theorem 1.1 to utilize instead of , to thereby use AND, OR, and XNOR further in the paper. We show that XNOR is binary equivalent to NOT in the proof of Theorem 1.1.

###### Theorem 1.1

NOT(x) = XNOR(x,0)

Proof: Given x, then with:

1. NOT(0) = XNOR(0,0) = 1

2. NOT(1) = XNOR(1,0) = 0

Then we can show that the extra parameter on XNOR embodies a previously constant value in the definition of logic table from . We accomplish that through an analysis of world values, logic values, logic questions, logic tables and their expansion to a Disjunctive Normal Form (DNF) equation which computes the result designed by the logic table using the methods from  and .

During that analysis a series of examples are shown using conventional methods on discrete Boolean logical quantities (e.g. logic values from the set { 0, 1 }), and an extension to a non-discrete continuous logic space on the range [0, 1] is proposed, its methods utilizing logic tables are shown, and several examples and code samples are provided.

## 2 Definitions of terms

###### Definition 2.1

A “World Value”, labeled , is an external stimulae, potentially quantized (e.g. in numeric form), representing some specific aspect of qualia (e.g. hot, cold, far, near, etc.) in regard to a perception of a system.

###### Definition 2.2

A “Logic Value”, labeled , is one of:

1. A value from the set {0, 1}, e.g. a “Boolean” value.

2. A value from an arbitrary set ), e.g. a discrete or “crisp” value.

3. A value from the range [0,1], e.g. a continuous or “fuzzy” value.

4. A special value UNKNOWN, e.g. provision for an “unknown” value.

###### Definition 2.3

A “fuzzification” after  is a mapping , e.g. a “fuzzification function”, and may be a mathematical operation that performs the mapping from a world value to a logic value when is represented in numeric form.

###### Definition 2.4

A “Logic Question” is one of:

1. A question answerable by a value from the set {0, 1}, e.g. a “Boolean” question.

2. A question answerable from an arbitrary set S of states, e.g. a discrete or “crisp” question.

3. A question answerable by a value from the range [0,1], e.g. a continuous or “fuzzy” question.

###### Definition 2.5

A “contemplation” in this paper is a Fuzzy Control System process after , as follows:

1. A fuzzification of a set of world values W into a set of logic values Z (e.g. a perception).

2. A contemplation on a set of logic values Z, e.g. an answering of a series of logic questions, in this paper using Boolean methods in continuous mathematical form.

3. A defuzzification of some resulting logic value from Z into a world value W (e.g. a motive action).

In Problem 9.1 further in the paper we apply the fuzzy control system process by gathering a collection of world values which we are interested in, and organize them into a set which we may further utilize.

We observe that world values are of any arbitrary units and form, and so we mathematically normalize them by utilizing a set of fuzzification functions to transform the world values into logic values which we may further contemplate upon.

We define logic values in Definition 2.2 to describe the various types of numeric values and their interpretations as utilized in this paper.

We answer logic questions with the methods in the paper, and produce logic values. When the logic value is strictly numeric we may further utilize its value mathematically. We may transform the logic value into a world value, or otherwise act upon it, through an action known as defuzzification.

We can observe that the action of forming a logic question is an inductive step, and the act of answering a logic question via one or more conditions upon which the question depends, is an example of a deductive step.

Examples are shown further in this paper of logic tables answering logic questions.

## 3 Logic Tables

We define logic tables in this paper by Definition 3.1. We may think of a logic table as accepting some specific input where each element of the set is assigned some logic value. Then the items in the set are implicitly interpreted as having a subjective meaning (e.g. health, shields, distance, etc.) and so the set represents a specific situation within which the logic table is able to produce some specific output which is itself a single logic value. Like the input values, the output value also has a subjective meaning which can be interpreted as either a computation or a contemplation of logic, so the logic table is said to output the answer to a logic question.

###### Definition 3.1

A “Logic Table” consists of:

1. The set of inputs where each element of is a logic value. When values are assigned to each member of , the set represents a specific situation under which the logic table will compute the answer to a configured question.

2. The set of outputs where each element of is a logic value. The values in the set each describe a specific response that the table defines for some recognized input situation.

3. The set of matrix values where each element of is a logic value. The values in the set describe the situations within which the corresponding outputs from are produced.

We can then observe that the definitions of Boolean logical operations in Tables 1, 2, and 3 are themselves logic tables, as are any mathematical definition table, or any table listing a mapping of inputs to outputs.

We then describe how a logic table can be constructed and an equation produced which computationally maps the configured inputs to the configured outputs, and we apply the process to produce a mathematical programming of a game character’s logic.

## 4 Disjunctive Normal Form (DNF)

We can make use of the AND, OR, and NOT222We then use XNOR instead of NOT in order to compose the DNF equation in a more customizable form. operators by applying an established technique from  whereby an mapping is listed in a logic table, and a formula in terms of AND, OR, and NOT is written which computes the outputs depicted in the table when their directly-related inputs are presented to the equation. The equation produced is said to be in Disjunctive Normal Form (DNF) after .

Then an algorithm whereby that process is most traditionally accomplished is depicted in Algorithm 1, and an algorithm depicting use of XNOR is depicted in Algorithm 2.

An example of the equations produced by Algorithms 1 and 2 are shown through Example 4.1.

###### Example 4.1

Given an arbitrary logic table, such as the XOR operation:

 Ii = X,Y Mi,j Oj Find an equation in Disjunctive Normal Form that computes the output depicted in the table, when an input matching any of those listed in M is presented as X, Y on the input. 0 0 0 0 1 1 1 0 1 1 1 0
###### Solution 4.2

The equation produced by Algorithm 1 for the table depicted in Example 4.1 is:

(NOT(X) AND Y) OR (X AND NOT(Y))

###### Solution 4.3

The equation produced by Algorithm 2 for the table depicted in Example 4.1 is:

(XNOR(X,0) AND XNOR(Y,1)) OR (XNOR(X,1) AND XNOR(Y,0))

We observe that the additional parameter on the XNOR operation is itself the value from the logic table, and we observe by Theorem 4.4 that the equation utilizing XNOR is identical to the equation utilizing NOT.

###### Theorem 4.4

The equation in Solution 4.3 equates to the equation in Solution 4.2.

Proof: Given Equation 4.2: Apply the relations from Theorem 1.1 and observe that while preserving the values of the equations there exists a process to convert one into the other.

1. XNOR(Q,0) = NOT(Q)

2. XNOR(Q,1) = Q

We then consider the consequences of Theorem 4.4 in regard to its utility in Logic Tables. In particular we find, and utilize in Definition 5.4, the additional parameter on the XNOR operator and find that it may utilize additional form of logic values, but first please observe Examples 4.5 and 4.7.

###### Example 4.5

Produce a logic table which “recognizes” the bit sequence { 1, 0, 1 }.

###### Solution 4.6

The logic table produced for Example 4.5 is:

:

.
: 1 0 1 1

The classical DNF equation by Algorithm 1 is:

(X AND NOT(Y) AND Z)

and the augmented equation by Algorithm 2 is:

(XNOR(X,1) AND XNOR(Y,0) AND XNOR(Z,1))

###### Example 4.7

Produce a logic table which “computes” the sum of three bits.

###### Solution 4.8

The logic table produced for Example 4.7 is:

 I: X Y Z O1 O2 M: 0 0 1 0 1 I={X,Y,Z} O1={0,0,1,0,1,1,1} O2={1,1,0,1,0,0,1} M={{0,0,1},{0,1,0},{0,1,1},{1,0,0},{1,0,1},{1,1,0},{1,1,1}}. 0 1 0 0 1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1

The outputs and produce separate classical DNF equations by Algorithm 1 as:

(NOT(X) AND Y AND Z) OR (X AND NOT(Y) AND Z) OR (X AND Y AND NOT(Z)) OR (X AND Y AND Z))

(NOT(X) AND NOT(Y) AND Z) OR (NOT(X) AND Y AND NOT(Z)) OR (X AND NOT(Y) AND NOT(Z)) OR (X AND Y AND Z)

with augmented formulas given by Algorithm 2 as:

(XNOR(X,0) AND XNOR(Y,1) AND XNOR(Z,1)) OR (XNOR(X,1) AND XNOR(Y,0) AND XNOR(Z,1)) OR (XNOR(X,1) AND XNOR(Y,1) AND XNOR(Z,0)) OR (XNOR(X,1) AND XNOR(Y,1) AND XNOR(Z,1))

(XNOR(X,0) AND XNOR(Y,0) AND XNOR(Z,1)) OR (XNOR(X,0) AND XNOR(Y,1) AND XNOR(Z,0)) OR (XNOR(X,1) AND XNOR(Y,0) AND XNOR(Z,0)) OR (XNOR(X,1) AND XNOR(Y,1) AND XNOR(Z,1))

## 5 Extensions to continuous logic

We find continuous mathematical definitions for classical Boolean operators remaining relatively unchanged from history, with the definition of NOT, AND, and OR going as far back as  and .

When selecting continuous mathematical functions that compute NOT, AND, OR, and XNOR, we may then seek any of those functions which produce the same {0,1} output values for any given {0,1} input values, and consider alternatives333We have found to behave more accurately and less warped than . to the definitions here as affecting the values produced between 0 and 1. We analyze and observe the results. In particular, we examine the following:

###### Definition 5.1
0 1 1 0

The complement of a logical quantity produces a depiction of its lack of contribution to a whole truth.

###### Definition 5.2
0 0 0 0 1 0 1 0 0 1 1 1

The multiplication of two logical quantities produces a depiction of their mutual contribution to a whole truth.

###### Definition 5.3
0 0 0 0 1 1 1 0 1 1 1 1 : [0,1]

The capped addition of two logical quantities produces a depiction of an independent contribution of each quantity toward a whole truth.

###### Definition 5.4
0 0 1 0 1 0 1 0 0 1 1 1

The XNOR of two logical quantities produces a depiction of the extent as to which two logical quantities agree toward the value of a truth.

Where the operator denoted here is addition restricted to the range [0,1], the XNOR function is labeled for clarity444Observe that the Boolean XNOR operation can indeed be described as an equals operator, and the operator used in Definition 5.4 denotes the absolute value operator.

We can then rewrite Solution 4.3 to produce the equation shown in Solution 5.5 which we call the continuous form of its logical expression.

###### Solution 5.5

The equation from Solution 4.3 rewritten in “continuous form” is:

When graphed the equation from Solution 5.5 produces the surface depicted in Figure 1 and matches the expected output of its definition from Example 4.1, which is the XOR function.

We observe that the corners of the surface are pinned to 0 or 1 as determined by the terms of the formula.

We next apply a trivial arithmetic operation to cause each term of the equations emitted by Algorithm 2 to support arbitrary row outputs which can be configured to be in the range [0,1]. We accomplish that by applying a multiplier to each term, thereby transforming whether the term matches its configured values, into what we want the term to output given that it matches its configured values, producing the listing in Algorithm 3.

## 6 Provision for continuous outputs

###### Theorem 6.1

On each term of the equation in Solution 5.5, where we have a value on the range [0,1], we may apply a multiplier Z, producing terms of the form Z*(EQ(X,Y)*…). The resulting transformation is from a logical value on the range [0,1] to a value that becomes Z to the extent that X==Y, or { Z,Z,… } to the extent that { X,X,… } == { Y,Y,… }.

Proof: If EQ(X,Y) is whether X==Y by Definition 5.4, then Z*EQ(X,Y) is Z to the extent that X==Y.

###### Example 6.2

We apply a multiplier to each term and observe that the output interpolates to express the values depicted in the multipliers.

We reproduce the formula as follows, and observe that the nature of the formula is multidimensional interpolation.

Given the set of arbitrary input values on the range [0,1].

Given the set of arbitrary matrix values on the range [0,1].

Given the set of arbitrary output values on the range [0,1].

We can form a table as follows:

 Ii={i0,i1,i2,...,ii} Mi,j Oj Where the input values Ii are applied upon the matrix values Mi,j via the process depicted in Algorithm 3, to produce an interpolation of the output as configured in the set O. m0,0 m1,0 … mi,0 o0 m0,1 m1,1 … mi,0 o1 m0,2 m1,2 … mi,0 o2 ... ... ... ... … m0,j m1,j … mi,j oj

Producing an equation of the form:

Where Algorithm 3 extends the prior algorithms to account for the rescaling of the terms of the DNF equation, and to produce the full formula as shown in Example 6.2.

###### Theorem 6.3

Algorithm 3 produces a continuous equation which performs multidimensional interpolation.

Proof: We seek to demonstrate multidimensional interpolation in a proof by induction. We start by generating and expanding a logic table of a single variable and output as follows…

…observing that the output of the term will match the value configured in when the value of the input matches the value of the table value . We observe also that as deviates from , that less of the output value contributes to the output of the equation. We add an additional variable to the equation, still with only a single row, and we produce the following…

…observing that the quantity must match for the equation to produce the value on its output. It follows that for each additional variable we input into the equation that an additional quantity must be matched in the currently single row of the table in order for the configured output to be emitted. We next add an additional row to the logic table, producing an OR condition on the recognition of that row…

…and we observe that the output of the equation approaches to the extent that approaches , while also approaching the value of to the extent that the quantity approaches , resulting in an interpolation between the values depicted in the output array .

We next provision the formula with support for unknowns, and crisp state values, and finally show examples.

## 7 Provision for unknowns

We have observed what we might call Boolean Values, e.g. { x : x { 0, 1 } }, and Continuous Values, e.g. { z : z [0,1] }, and we next provision with support for additional data as defined as follows.

In particular we produce Algorithm 4 to allow for the special value UNKNOWN, enabling the machine to be configured so as to not necessitate a full connection of all its inputs to outputs.

## 8 Provision for state machines

We provision the EQ function in Algorithm 5 with support for crisp State Values, which we can describe simply as those whole numbered values, e.g. . We then can configure the logic table to recognize state values and also emit them.

We next show examples.

## 9 Examples

###### Problem 9.1

Show the construction of a machine which plays a primitive game of Soccer, while being programmed not in the traditional sense, but programmed probabilistically with equations of the form depicted prior.

We approach the answer to Problem 9.1 in Solution 9.2 by constructing a series of sets of arbitrary information that will be required to produce the sets needed for the logic tables. In particular we are depicting a Fuzzy Control System process as in .

We will let be the set of arbitrary “real world” values that the character may perceive. These are quantities which may be considered to be of any form or composition. The set W for this example is then given in Table 5.

Our next step is to apply a normalization of the values from W into the character’s [0,1] logic space. This step is called the fuzzification step after .

Then let the set be the arbitrary set of normalized sensor values. These are continuous logic values on the range [0,1] and represent continuous Boolean logic (to distinguish it from discrete Boolean logic). We infer this set of values from the set W as shown in Table 6.

Where the miscellaneous mathematical functions such as “clamp” and “map” are listed in Table 7, and are being used to perform the conversion , and are called fuzzification functions. We observe that there may exist many such functions.

We may then define a series of continuous logic tables to describe each possible output behavior of the character as given in Solution 9.2.

###### Solution 9.2

Logic tables for Problem 9.1.

Should I drive forward?
= 1.0 * EQ(, 1.0)
Should I throw the ball?
= 1.0 * EQ(, 1.0) * EQ(, 0.75) * EQ(, 1.0)
 Should I turn to the right? Ii={s1,s3} Mi,j Oj = 1.0 * EQ(s3, 1.0) ⊕ 1.0 * EQ(s1, 1.0) * EQ(s3, 1.0) UNK 1.0 1.0 1.0 1.0 1.0
 Should I turn to the left? Ii={s1,s4} Mi,j Oj = 1.0 * EQ(s4, 1.0) ⊕ 1.0 * EQ(s1, 1.0) * EQ(s4, 1.0) UNK 1.0 1.0 1.0 1.0 1.0
 Where should I target (X,Y)? Ii={s5} Mi,j Oj = w6 * EQ(s5, 1.0) ⊕ w5 * EQ(s5, 0.0) 1.0 w6 0.0 w5

We then, at periodic intervals update the sets W and S, and compute a set Z to contain the answer to the questions depicted in the logic tables, which we may then directly “defuzzify” into motive actions. In particular, we may multiply the logic value of whether to drive forward with a value representing how fast to travel at maximum, and apply it to the character’s position causing the character to travel forward. We may also defuzzify the logical quantities about turning right or left by multiplying each of them by a quantity depicting how much to turn at maximum, and then turning in whichever direction represents a greater recommendation value, and we may defuzzify the logical quantity about throwing the ball, by evaluating whether it exceeds a threshold value (such as 0.90). We pick up the ball when the character is sufficiently close to it, setting the appropriate world variable, , to 1, and release the ball when the character decides to throw it by setting the variable to 0, and we apply motion to the ball depicting it thrown. We then reset the position of the ball, and we observe that the character plays a primitive game of soccer, picking up the ball, carrying it to, and throwing it in the goal, and will continue doing so perpetually as long as the character runs.

## 10 Conclusions

This paper summarizes a process whereby logical machines may be constructed and offers a foundation for further analysis which may appear in followup publications.

Acknowledgements: The views and conclusions contained herein are those of the author and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of the Art Institute of Portland.

## References

•  Boole, G. (Reprinted 2012). An Investigation of the Laws of Thought. Newburyport: Dover Publications.
•  Peirce, C., & Hartshorne, C. (n.d.). Collected papers of Charles Sanders Peirce, (Vol. II).
•  The Bureau of Naval Personnel. (UNCLASSIFIED OCT 20 1964). Basic Laws and Common Identities of Boolean Algebra. NAVPERS 92901: Boolean Algebra.
•  Kandel, A., & Langholz, G. (1994). Fuzzy control systems. Boca Raton: CRC Press.
•  Reghiş, M., & Roventa, E. (1998). Logical Networks. Classical and fuzzy concepts in mathematical logic and applications. Boca Raton: CRC Press.
•  Holdsworth, B., & Woods, R. C. (2002). Digital logic design. Oxford: Newnes.
•  O’Donnell, R. (2014). Analysis of Boolean functions. New York, NY: Cambridge Univ. Press.
You are adding the first comment!
How to quickly get a good reply:
• Give credit where it’s due by listing out the positive aspects of a paper before getting into which changes should be made.
• Be specific in your critique, and provide supporting evidence with appropriate references to substantiate general statements.
• Your comment should inspire ideas to flow and help the author improves the paper.

The better we are at sharing our knowledge with each other, the faster we move forward.
The feedback must be of minimum 40 characters and the title a minimum of 5 characters   