# Logic

## Connection between Logic and Reality (What Is)

Any kind of logic exist (is sound) due to reflection to the laws of this particular Universe. Logic captures general (but not abstract) notions of reality as it is. The claim that logic is something higher than reality, belonging to the realm of eternal pure ideas is a pure bullshit. *Any kind of logic is possible exactly because the Universe has its laws*.

Logic deals with the laws of causation - captures general principles of causes and effects. No more, no less. Every valid logical rules has corresponding notions in realty, in what is.

The principle of substituting of equal for equal (and equivalent for equivalent) is in atomic structures and molecular biology.

The notion of a compound, conjunction is just *O2* or *H2O*.

Syllogism is just a capture of the general notion that there **are** laws in this Universe.

If two H and O forms H2O and Hs and Os are present, then H2O is present, given other prerequisites, such as gravity and temperature is also *true*.
If H2O is present, then there are Hs and Os present. These are applications of laws of *the cause and effect*, generalized as the *natural deductions*.

## Connection between Logic and Functional Programming

Meta-propositions (which are always `True`

no matter what values of *variables* are).

Let `P`

, `Q`

, `R`

and `S`

be propositions (which may be `True`

or `False`

)

`(P → Q) ∧ P ⇒ Q`

-*Modus Ponens*.`(P → Q) ∧ (Q → R) ⇒ P → R`

-*Hypothetical Syllogism*.`P ∧ Q ⇒ P`

-*Simplification*.

and

`(P → P)`

-*Self-Implication*which is an obvious*tautology*.

All these came from the ancient logicians who studied how to construct *valid arguments* in general (in principle). A principle is a discovered Universal notion, by the way.

Again, they just have captured, consciously or not, that these notions are merely consequences (reflections) of *the causality principle* in the Universe which has its "laws". Everything is because the Universe has a structure and laws which establish it (make it possible).

The first two meta-statements has been captured and *defined* as

id :: a -> a -- Defined in ‘GHC.Base’ id x = x

const :: a -> b -> a -- Defined in ‘GHC.Base’ const x y = x

an irrelevant extra layer of too abstract idiocy which supposed to generalize *application*

(<*>) :: Applicative f => f (a -> b) -> f a -> f b

an irrelevant extra layer of too abstract idiocy which supposed to generalize *transition*

ap :: Monad m => m (a -> b) -> m a -> m b -- Defined in ‘GHC.Base’

Now, somehow, partial application of *established facts* (`const`

s - see `The Simplification`

rule)

ap (const ap) const :: (a -> b1) -> (b2 -> a) -> b2 -> b1

yields the *Hypothetical Syllogism* - a logical *transition step*.

or just function composition via nesting - the only way it could be *implemented* in Nature.

(.) :: (b -> c) -> (a -> b) -> a -> c f . g = \x -> f (g x)

This *correspondence* or *duality* shows that *pure logic* and *pure functional programming* is the same notion. No more, no less.

Now, by applying the very same `Hypothetical Syllogism`

, *pure functional programming* is the way to describe reality - it *does not contradict* The Causality Principle of this Universe and corresponds to the only way to construct a valid arguments.

## Predicate logic

Contrary to the definitions of Boolean Logic which forms the basis of logic in programming languages, the relationship between `True`

and `False`

is asymmetric. By this we mean so-called Empirical Truth. There are arbitrary many falsehoods and only one Truth. It reflect *what is*.

So, we would postulate that `True`

is what is NOT `False`

. Whatever cannot be refuted or turned out to be false is true (it is *falsifiable in principle* but cannot *experimentally confirmed or proven* to be so).

Truth is not arbitrary. It reflects and is bound by the fundamental principles and necessary constraints of this given Universe. So,

data Bool = False | True True = not False

Again, this definition reflects the recursive process of reduction (by removing nonsense) to an empirical truth (a mutual recursion of `eval`

and `apply`

, if you wish), which converges on this or that aspect of *what is*. What cannot be proven to be `False`

and has no contradiction which what is already known is accepted as `True`

. Enough philosophy for today.

Here comes the form of *syllogism* - when both *premises* are `True`

[in this given universe], the whole expression (syllogism) is `True`

.

(&&) True True = True

`False`

does NOT imply `True`

This imaginary rule (*non-p implies p*) from propositional logic, invented in order to artificially make the propositional calculus "complete", cannot be demonstrated and has no connection to empirical reality in which *contradictions does not exist*.

Every program which relies not this rule is flawed, due to *reliance on a false premise*.

See also Wadler

**Note:**See TracWiki for help on using the wiki.