# Finite-valued logic

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:

Let us test the function.

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:

Let us test the function.

### (Re) definition of logical operations

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

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.

#### Conjunction

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

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:

#### Material implication

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

#### Equivalence

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

#### Exclusive disjunction

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

#### 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: #### (Pseudo) tautology 1. Modus ponens

The following is the Modus ponens rule of inference: As it is shown, it is not a tautology. Let us show the numerical values:

#### (Pseudo) tautology 2. Modus tollens

The following is the Modus tollens rule of inference: As it is shown, it is not a tautology. Let us show the numerical values:

#### (Pseudo) tautology 3. Reductio ad absurdum

The following is the Reductio ad absurdum rule of inference: As it is shown, it is not a tautology. Let us show the numerical values: