Finite-valued logic

From Fōrmulæ wiki
Jump to: navigation, search

This page is an an exercise to represent and show values and operations in finite-values logic in Fōrmulæ.

Representation

Given a logic of n values, let us represent these values an equal spaced values between 0 (pure false) and 1 (pure true).

These values are calculated with the following function:

FiniteValuedLogic01.png

Let us test the function.

FiniteValuedLogic02.png

In the last case, we use 11 values because they are spaced by 1/10. It will be useful more later.

Visualization of logic values as colors

Although numeric values is a good representation, let us create a representation of values as colors.

The CreateColor(r, g, b) expression, from the Standard Color package, produces a Color, given its components of red, green and blue, provided as numbers between 0 and 1.

A Color expression can be used in many places, but by itself, it is shown as a square filled with the color it represents.

Let us create a function that, given the logical value returns its color. The value 0 (pure false) has to produce a pure red color, while the value 1 (pure true) has to produce a pure green color, as following:

FiniteValuedLogic03.png

Let us test the function.

FiniteValuedLogic04.png

(Re) definition of logical operations

Logical operations with finite-valued logic are usually defined as:

FiniteValuedLogic05.png

Note. The material implication formula is sometimes defined different than how it is shown here.

Visualization of logical operations

The following function calculates the combinations of the n values and calculates the operation given as a lambda expression.

FiniteValuedLogic06.png

Conjunction

The following is the conjunction in 2, 3 and 11-valued logic:

FiniteValuedLogic07.png

The values or the axes are shown as follows: 0 to 1 from left to right, and from top to bottom.

Disjunction

The following is the disjunction in 2, 3 and 11-valued logic:

FiniteValuedLogic08.png

Material implication

The following is the material implication in 2, 3 and 11-valued logic:

FiniteValuedLogic09.png

Equivalence

The following is the equivalence in 2, 3 and 11-valued logic:

FiniteValuedLogic10.png

Exclusive disjunction

The following is the exclusive disjunction in 2, 3 and 11-valued logic:

FiniteValuedLogic11.png

Tautology 1. De Morgan's laws

A tautology must always produce true results. In this case 1 (or green):

The following is the De Morgan's law tautology:

FiniteValuedLogic12.png

(Pseudo) tautology 1. Modus ponens

The following is the Modus ponens rule of inference:

FiniteValuedLogic13.png

As it is shown, it is not a tautology. Let us show the numerical values:

FiniteValuedLogic14.png

(Pseudo) tautology 2. Modus tollens

The following is the Modus tollens rule of inference:

FiniteValuedLogic15.png

As it is shown, it is not a tautology. Let us show the numerical values:

FiniteValuedLogic16.png

(Pseudo) tautology 3. Reductio ad absurdum

The following is the Reductio ad absurdum rule of inference:

FiniteValuedLogic17.png

As it is shown, it is not a tautology. Let us show the numerical values:

FiniteValuedLogic18.png