Binary Structure CalculusRecently, I was exploring some

s-expression notation known from LISP breed of languages. LISP languages are usually used for AI (a part of OpenCog is based on it). What I was trying to achieve is having an algebra of duality. For example, we define summation function and automatically derive difference function. Or we define multiply function and automatically derive division function. Or we define emergence, and conclude consequence from specifying cause, or conclude cause from specifying consequence. In general, we define a function, and we could query it in both directions, from parameters to result, or from result to parameters. I believe it has something to do with a

million dollar prized P = NP? question.

All of this should nicely fit with math, logic, knowledge base querying, theorem proving, and it could find a use in any science field, I believe.

This is syntax in BNF notation - this is the whole language, there is nothing else:

`start ::= e //s-expression`

e ::= a // atom

| a e // sequencing

| (e) // grouping

a ::= c // constant

| {q} // query

q ::= a q // querying to the right of a

| q a // querying to the left of a

| ? // return query result

| ! // return query complement

| (q) // grouping

These are seven semantic rules expressed in a kind of

Sequent Calculus:

constant c ϵ Γ

────────────────────── (1)

Γ ⊢ c

Γ ⊢ c1 Γ ⊢ c2

───────────────────────── (2)

Γ ⊢ c1 c2

───────────────────────── (3)

Γ, {σ} ⊢ Σ(σ) → Γ

Σ(c σ) → c c1 Σ(c σ) → c c2 ...

─────────────────────────────────────────────── (4)

(Σ(σ) → c1) ∧ (Σ(σ) → c2) ∧ ...

Σ(σ c) → c1 c Σ(σ c) → c2 c ...

─────────────────────────────────────────────── (5)

(Σ(σ) → c1) ∨ (Σ(σ) → c2) ∨ ...

Σ(?) → σ

──────────────── (6)

σ

Σ(!) → σ

─────────────────────── (7)

complement of σ

Rules 1-2 are sequence introducing rules. Rules 3-7 are sequence query mechanism. (3) is converting a query to intermediate sigma form. (4) and (5) are sigma tree traversal inference. (6) and (7) are converting terminal sigma form to usable end result.

Basically, Binary Structure Calculus is a syntax of s-expressions plus syntax of querying over s-expressions. Query can simply be

{x ?} for reaching element right to matched x, or

{? x} for reaching element left to matched x. Of course, queries can be nested to reach complex structure elements. And that's all there is, and it seems enough.

You'll be surprised how expressive this combination might be. More about it soon, I'm preparing a whitepaper.