# Simple logic

Paradigm(s) | Declarative |
---|---|

Designed by | User:Hakerh400 |

Appeared in | 2023 |

Computational class | Turing complete |

Major implementations | Implemented |

File extension(s) | `.txt` |

**Simple logic** is an esolang invented by User:Hakerh400 in 2023.

## Overview

**Simple logic** is a very simple formal mathematical system of first-order logic and set theory. It has very basic inference rules, but it is powerful enough that we can implement Zermelo–Fraenkel set theory.

It has the following constants: `zero succ var some set mem inp univ wff var_lt var_ne fresh subst`

And the following inference rules:

var_zero_lt_succ :: set (vara) ⊢ var_lt zero (succa) var_succ_lt_succ_of :: var_ltab⊢ var_lt (succa) (succb) var_ne_of_lt :: var_ltab⊢ var_neabfresh_var :: var_neab⊢ fresha(set (varb)) fresh_some_1 :: wffa, set (varb) ⊢ freshb(someba) fresh_some_2 :: wffa, set (varb), freshca⊢ freshc(someba) fresh_mem :: seta, setb, freshca, freshcb⊢ freshc(memab) fresh_imp :: wffa, wffb, freshca, freshcb⊢ freshc(impab) fresh_univ_1 :: wffa, set (varb) ⊢ freshb(univba) fresh_univ_2 :: wffa, set (varb), freshca⊢ freshc(univba) subst_var_1 :: setr, set (varx) ⊢ substxr(varx)rsubst_var_2 :: setr, var_nexy⊢ substxr(vary) (vary) subst_some_1 :: setr, wffs, set (varx) ⊢ substxr(somexs) (somexs) subst_some_2 :: wffs, var_nexy, freshyr, substxrsa⊢ substxr(someys) (someya) subst_mem :: sets, sett, substxrsa, substxrtb⊢ substxr(memst) (memab) subst_imp :: wffs, wfft, substxrsa, substxrtb⊢ substxr(impst) (impab) subst_univ_1 :: setr, wffs, set (varx) ⊢ substxr(univxs) (univxs) subst_univ_2 :: wffs, var_nexy, freshyr, substxrsa⊢ substxr(univys) (univya) set_var_zero :: ⊢ set (var zero) set_var_succ :: set (vara) ⊢ set (var (succa)) set_some :: set (vara)), wffb⊢ set (someab) wff_mem :: seta, setb⊢ wff (memab) wff_imp :: wffa, wffb⊢ wff (impab) wff_univ :: set (vara)), wffb⊢ wff (univab) ax_imp_1 :: wffa, wffb⊢ impa(impba) ax_imp_2 :: wffa, wffb, wffc⊢ imp (impa(impbc)) (imp (impab) (impac)) univ_i :: impab, freshxa⊢ impa(univxb) univ_e :: impa(univxb), substxrbc⊢ impacmp :: impab,a⊢b

On the left we have name of inference rule and on the right we have inference scheme. The identifiers in blue can be substituted with any expression.

Inference rules are separated into three groups (for readability). The first group represents technical rules (regarding variable substitution). The second group defines how expressions (sets and wffs) can be built. The third group represents the actual axioms and inference rules of logic.

Note that `zero`

and `succ`

do not represent natural numbers in the set-theoretic way. They are just technical terms used here to specify set variables (variable "a" can be represented as `zero`

, variable "b" as `succ zero`

, and so on).

## Definitions

As we can see, the only logical connective we have is implication `imp`

and the only quantifier is the universal quantifier `univ`

. But that is actually everything we need. We can model the rest of logic using only those two.

False can be defined as `⊥ := ∀ a b, a ∈ b`

. In technical terms that would be `univ zero (univ (succ zero) (mem (var zero) (var (succ zero))))`

. We can use inference rules to prove that this is indeed a wff.

True can be defined as `⊤ := ⊥ → ⊥`

Negation can be defined as `¬`

**P** := **P** → ⊥

Disjunction **P** ∨ **Q** := ¬**P** → **Q**

Conjunction **P** ∧ **Q** := ¬(¬**P** ∨ ¬**Q**)

Equivalence **P** ↔ **Q** := (**P** → **Q**) ∧ (**Q** → **P**)

Existential quantifier `∃ x, `

**P** := ¬∀ x, ¬**P**

## Proofs

Just like constructing expressions, we can use inference rules to prove propositions. See the reference implementation to see how we proved `⊢ ⊤`

(true holds).

Note that constructing a proposition and proving a proposition are two very different things. We can construct any syntactically valid proposition, even if the proposion itself is false. For instance, we can easily prove `⊢ wff ⊤`

, but proving `⊢ ⊤`

is much more difficult. Also, we can prove `⊢ wff ⊥`

, but we cannot prove `⊢ ⊥`

.