Ai Dreams Forum

Member's Experiments & Projects => General Project Discussion => Topic started by: ivan.moony on March 15, 2018, 06:42:55 pm

Title: S-Expression Query Language
Post by: ivan.moony on March 15, 2018, 06:42:55 pm
Binary Structure Calculus

Recently, I was exploring some s-expression (https://en.wikipedia.org/wiki/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 (https://simple.wikipedia.org/wiki/P_versus_NP).

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:
Code
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 (https://en.wikipedia.org/wiki/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.
Title: Re: Binary Structure Calculus
Post by: infurl on March 15, 2018, 09:02:08 pm
That's very interesting work. It looks like unification and logical resolution operations and could be used for the same things such as knowledge representation and theorem proving but maybe what you are developing is more powerful. I'm looking forward to finding out more about it.

For reference, this is what I'm talking about.

Given rules:
Code
(equal ?x ?x)
(<=> (equal ?x ?y) (equal ?y ?x))
(<=> (and (equal ?x ?y) (equal ?y ?z)) (equal ?x ?z))
(not (parent ?x ?x))
(not (grandparent ?x ?x))
(<=> (or (father ?x ?y) (mother ?x ?y)) (parent ?x ?y))
(<=> (or (grandfather ?x ?y) (grandmother ?x ?y)) (grandparent ?x ?y))
(<=> (and (parent ?x ?y) (mother ?y ?z)) (grandmother ?x ?z))
(<=> (and (parent ?x ?y) (father ?y ?z)) (grandfather ?x ?z))

and facts:
Code
(father carol robert)
(mother carol alice)
(father alice bill)
(mother alice mary)
(father robert tom)
(mother robert sally)

solve:
Code
(grandparent carol ?z)

which yields (bill mary sally tom) as possible values for z.
Title: Re: Binary Structure Calculus
Post by: LOCKSUIT on March 15, 2018, 09:05:23 pm
But are those millennium prizes even real? I mean there's probably hogs online with toneeees of proposals. Can you really discover the answer and get the money legitimately still?
Title: Re: Binary Structure Calculus
Post by: ivan.moony on March 15, 2018, 09:44:42 pm
(Rules for millennium prizes at Clay Institute (http://www.claymath.org/millennium-problems/rules-millennium-prizes))

In short, to get the millennium prize, you have to first publish your work in some significant science magazine. Then you have to wait two years. If in a meanwhile some serious scientific work is built on top of your paper, and your paper gets cited a lot of times, the prize is yours (but if your work is significantly influenced by some other author, the author also gets a share). It is the world who accepts or rejects your solution, Clay Institute just observes and responds. Right now, I think there are around a hundred proofs reported for both P = NP or P != NP. Neither one got the prize yet. It is a real mess out there and I'd rather stay out of it if I can. But if anyone else builds her work on top of mine, I'd appreciate a reference to any of my my papers (one so far on the subject (https://docs.google.com/document/d/1pTESAkcVjv-08BBrebhbvl1Thf291TSfgZ_EeUlSn8A/edit?usp=sharing)).
Title: Re: Binary Structure Calculus
Post by: LOCKSUIT on March 15, 2018, 10:26:41 pm
I think I just solved the NP problem..........I instantly realized the answer to a NP question on the wiki page in polynomial time. I'm NOT telling yous how just yet haha! That was fast!                                                   ?

It said above it:
There are many important NP problems that people don't know how to solve in a way that is faster than testing every possible answer. Here are some examples:

EDIT: This is the easiest thing everrrrrrrrrrrrrrrr
Title: Re: Binary Structure Calculus
Post by: ivan.moony on April 03, 2018, 04:38:34 pm
I just updated semantic section of the top post. I had problems with this one, but I think I got it right this time.

I think that semantics expressed in Sequent Calculus are that thing that divide theories with "calculus" epithet and theories with "language" epithet. This way expressed semantics are not of much use except they can be verified for correctness in some proof verifying tools. The other use of these kind of expressed semantics is possible understanding from some genius reader. You know how things seem complicated when you don't know them yet, and simple when you realize how they work? That is why I have to write an explanation in a natural language to pair it with Sequent Calculus definition, so that formal Sequent Calculus definition could be understood by an average reader like me.

I'm still working on bidirectional examples, and things look cool for now. I expect things like automatic getting math integral formulas from specifying math derivative formulas, and similar kinds of perversions. Will post it here, hopefully, if I live long enough.

[I'm still not satisfied with the calculus name, thinking about "S-Expression Query Language" (SEQL)]
Title: Re: Binary Structure Calculus
Post by: ivan.moony on April 04, 2018, 04:41:06 pm
As a teaser, I bring a few examples of integer numbers and basic operation on them. Note that this is mathematical-like definition, and it is complete in a sense that we don't need any external dependencies to outer datat ypes and operators.

This is how integer constants are formed:
Code
// integer definition
(
    Int {
        Zero |
        (One {Int})
    }
)
0 = Zero, 1 = One (Zero), 2 = One (One (Zero)), ...

Code
// increment and decrement by one
{
    Use (
        {Int}
        (x {Int})
    ) in (
        ((++ {x}) {One {x}})
        ((-- {One {x}}) {x})
    )
}

Code
// addition and subtraction
{
    Use (
        (x {Int})
        (y {Int})
        {
            Use (
                (incremented {Int})
                (decremented {Int})
            ) in (
                Loop {incremented} {decremented} {
                    iff {{decremented} in Zero}
                        {Loop {++{incremented}} {--{decremented}}}
                        {incremented}
                }
            )
        }
    ) in (
        (
            ({x} + {y})
            {Loop {x} {y}}
        )
        (
            ({x} - {y})
            {(? + {y}) {x}}
        )
    )
}
Plus operation is defined in terms of looped incrementation. Minus operation is defined in terms of plus operation. It reads: "x - y = what plus y gives x?"

Code
// multiplication and division
{
    Use (
        {Int}
        (x {Int})
        (y {Int})
        {
            Use (
                (step {Int})
                (accumulator {Int})
                (decremented {Int})
            ) in (
                Step {step} Loop {accumulator} {decremented} {
                    iff {{decremented} in Zero}
                        {Loop {{accumulator} + {step}} {--{decremented}}}
                        {accumulator}
                }
            )
        }
    ) in (
        (
            ({x} * {y})
            {Step {x} Loop {Zero} {y}}
        )
        (
            ({x} / {y})
            {(? * {y}) {x}}
        )
    )
}
Multiply operation is defined in terms of looped addition. Divide operation is defined in terms of multiply operation. It reads: "x / y = what times y gives x?"

Implementation of the language will be a bit tricky, but I think it is possible.
Title: Re: Binary Structure Calculus
Post by: ivan.moony on April 11, 2018, 04:55:24 pm
This is a quote from the paper I'm writing:
Quote
This is the essence of extracting, for example a function parameters from a function result: we substitute the whole expression, just to extract pieces from it. For this process to be functional, we need to define all the calculations in terms of our metatheoretical framework. Only then, since we don't use external, hard coded definitions, but only definitions in a form of queryable s-expressions, we are covering a complete range of computable expressions. Once calculated, we are able to extract any fragment from a process of possible construction of any expression, thus reducing the problem only to pattern matching. However, low level implementation will be a bit of challenge to grapple with, regarding to recursive functions, but the implementation is possible, as long as we restrict the number of possible recursions to a finite number.
Title: Re: S-Expression Query Language
Post by: infurl on April 11, 2018, 10:44:13 pm
Ivan I frequently use the technique that you're describing in C applications. You can use macros to implement the S-expression queries that you're describing. It is a very powerful technique which can save a lot of maintenance effort. Generic term for it is X-macro.

https://en.wikipedia.org/wiki/X_Macro

Here's an example from a program that I wrote last week.

Code
#define mKeyWords                               \
mKeyWord(Aliases,        "aliases")             \
mKeyWord(Amount,         "amount")              \
mKeyWord(Badges,         "badges")              \
mKeyWord(CalendarModel,  "calendarmodel")       \
mKeyWord(Claims,         "claims")              \
mKeyWord(DataType,       "datatype")            \
mKeyWord(DataValue,      "datavalue")           \
mKeyWord(Descriptions,   "descriptions")        \
mKeyWord(Hash,           "hash")                \
mKeyWord(Id,             "id")                  \
mKeyWord(Labels,         "labels")              \
mKeyWord(Language,       "language")            \
mKeyWord(LastRevId,      "lastrevid")           \
mKeyWord(LowerBound,     "lowerBound")          \
mKeyWord(MainSnak,       "mainsnak")            \
mKeyWord(Modified,       "modified")            \
mKeyWord(Property,       "property")            \
mKeyWord(Qualifiers,     "qualifiers")          \
mKeyWord(QualifiersOrder,"qualifiers-order")    \
mKeyWord(Rank,           "rank")                \
mKeyWord(References,     "references")          \
mKeyWord(Site,           "site")                \
mKeyWord(SiteLinks,      "sitelinks")           \
mKeyWord(SnakType,       "snaktype")            \
mKeyWord(SnaksOrder,     "snaks-order")         \
mKeyWord(Time,           "time")                \
mKeyWord(Title,          "title")               \
mKeyWord(Type,           "type")                \
mKeyWord(Unit,           "unit")                \
mKeyWord(UpperBound,     "upperBound")          \
mKeyWord(Value,          "value")               \

static const char* gKeyWords[] =
{
    #define mKeyWord(Symbol,String) String,
    mKeyWords
    #undef mKeyWord
};

enum tKeyWordIndex
{
    #define mKeyWord(Symbol,String) k##Symbol##KeyWordIndex,
    mKeyWords
    #undef mKeyWord
};

enum tKeyWord
{
    #define mKeyWord(Symbol,String) k##Symbol##KeyWord = (-1 - k##Symbol##KeyWordIndex),
    mKeyWords
    #undef mKeyWord
};

#define kKeyWordLimit (sizeof(gKeyWords) / sizeof(char*))

Title: Re: S-Expression Query Language
Post by: ivan.moony on April 12, 2018, 12:06:01 am
Yes, X-macros are somewhat like what I'm talking about. If I'm correct, we just need to define every operation by a macro, and the pattern match does the job of extracting the information, parameters to result, or result to parameters. It is really not a big deal, once we realize it. The trick is that we shouldn't use any built in function, not even increment by one. Once we have them all defined in terms of macros, the whole new world opens, from parameters <- [query] -> result relation, to assumption <- [logic proof] -> conclusion relation. Simple, isn't it? The only question is how expressive the macro system is.

I'm sure there are tons of similar material out there, but unless a possible use is recognized, we can't really do much with it just because we don't see the real potential. We just don't know how to use it. Unfortunately, when I threw a look at macros back in 1996., I didn't realize what they could do. I got a similar thing by myself a few months ago, but now it looks promising, and I wish I had someone to explain it to me some twenty years ago.

Still, I want to implement the engine in Javascript and apply it to crowdsourced online knowledge mining to see how far it can go.
Title: Re: S-Expression Query Language
Post by: infurl on April 12, 2018, 12:30:11 am
The only question is how expressive the macro system is... I'm sure there are tons of similar material out there, but unless a possible use is recognized, we can't really do much with it just because we don't see the real potential. We just don't know how to use it.

Well you see, here's the thing. X-macros are just a way of implementing a simple relational database at compile time in a C program, for code generation. Relational databases are a well known concept with lots of applications and if you've used an enterprise grade RDBMS like Oracle or PostgreSQL then you might have some idea of their real power. (I should point out that SQL/Server, MySql and MS-Access are just toy implementations of SQL not worth wasting your time with, although apparently a lot of people do. Haha, fools.)

So I have many gigabytes of data comprising different kinds of knowledge bases aligned and stored in my database server, and I use SQL to extract the information and recombine it in different ways to generate the code for my artificial intelligence software. I'm still ramping up my builds as I add more knowledge sources, but we're already talking about millions of lines of code in a very high-level language of my own design, which ultimately compiles down to C and machine code. I like to think that I'm doing AI on an industrial scale. :D
Title: Re: S-Expression Query Language
Post by: ivan.moony on April 12, 2018, 01:56:10 pm
The only question is how expressive the macro system is... I'm sure there are tons of similar material out there, but unless a possible use is recognized, we can't really do much with it just because we don't see the real potential. We just don't know how to use it.

Well you see, here's the thing. X-macros are just a way of implementing a simple relational database at compile time in a C program, for code generation. Relational databases are a well known concept with lots of applications and if you've used an enterprise grade RDBMS like Oracle or PostgreSQL then you might have some idea of their real power. (I should point out that SQL/Server, MySql and MS-Access are just toy implementations of SQL not worth wasting your time with, although apparently a lot of people do.
I didn't work with such advanced database tools. What, for example we can do with those?

(I have a kind of relational algebra in mind for a future use of my language. I want to classify all the data in ontology manner, powered by relational algebra defined in a functional paradigm.)

Haha, fools.)
Please don't...

So I have many gigabytes of data comprising different kinds of knowledge bases aligned and stored in my database server, and I use SQL to extract the information and recombine it in different ways to generate the code for my artificial intelligence software. I'm still ramping up my builds as I add more knowledge sources, but we're already talking about millions of lines of code in a very high-level language of my own design, which ultimately compiles down to C and machine code. I like to think that I'm doing AI on an industrial scale. :D
Sounds like a big project.
Title: Re: S-Expression Query Language
Post by: spydaz on April 12, 2018, 04:39:37 pm
These entanglements can be tricky!

But it all seems relational;

It depends on how you capture and store the data: database type is actually irrelevant - As an XML file can become a database; dealing with database size can be an issue! but by creating DataMarts (subsets of data) this problem can be addressed.

If the data has no actual meaning full structure it has no real use. just means that your a hoarder of data!

in the data collection process entanglements should be considered; Propositions (statements) can be handled with propositional logic calculus - Right too for the right job.... There is no need to re-invent the wheel. to do MATH with words. the propositional calculus enables for this ... Managing, Subject Predicate Object relationships.......calculating the entanglements... the calculus is very Boolean!

I have written some papers -- recently i have found my papers even being cited! lol (so happy) ....I believe releasing papers or another attempt at Vanity! just like releasing a record!.... And now just having a GitHUB! / YOUTUBE is enough to satisfy and prove to the community that you know what you know.... papers are actually becoming a dated art form ...... most papers are fake and cannot be reproduced. when you have 100 dissertations to read over the summer and mark them you don't have time to check every project for validity! this is life lots of fakes get through! (Experience talking)...

Title: Re: S-Expression Query Language
Post by: ivan.moony on April 12, 2018, 06:35:14 pm
If we put data entanglements right, then all the calculations could be done by simply querying data structures. I believe the same thing happens when you're constructing a processor with its assembler. And I'm trying to extract a higher level version of it. It has to be able to do anything that a human mind can conceive (in a sense of reconstructing a thought process).
Title: Re: S-Expression Query Language
Post by: spydaz on April 12, 2018, 09:48:31 pm
If we put data entanglements right, then all the calculations could be done by simply querying data structures. I believe the same thing happens when you're constructing a processor with its assembler. And I'm trying to extract a higher level version of it. It has to be able to do anything that a human mind can conceive (in a sense of reconstructing a thought process).

Recently i wrote a token-izer program and now understand the importance of parsing a language with a simple syntax a lot can be achieved. Coding wise i found that "Extension methods helped" .... (.NET) ... For me removing invalid Tokens has become a Great TOOL... With this Project As each method to read the syntax the ability to chain all the commands into a Long Calculation can be easily achieved....
It will be an interesting read....
I like infuls Usage of the syntax!!!
Thinking along these lines is the way forward to great solving many NLP Extraction and entanglement logic for words.
Title: Re: S-Expression Query Language
Post by: infurl on April 12, 2018, 09:52:10 pm
If we put data entanglements right, then all the calculations could be done by simply querying data structures.

This has already been done too. It's called RDF and the language that is used for querying such structures is called SPARQL. It allows you to treat different data repositories that are distributed around the internet as a single entity and issue queries across them all. An important aspect of RDF (and of the databases that I am assembling in my own project) is alignment. You have to match equivalent terms from different sources or it is all just a meaningless blob.
Title: Re: S-Expression Query Language
Post by: ivan.moony on April 12, 2018, 10:22:25 pm
I'm aware of RDF (https://www.w3.org/RDF/), but I didn't like it much. It's too complicated, it has a million keywords for a million different stuff, as far as I remember. It was created as a W3C response to semantic web requirement, and they try to promote it on their site. But anyway, I'll do my own version for the task I'm trying to achieve (sharing knowledge), based on s-expressions.

S-expressions are underrated these days. More complex formats took a place that could be filled by simpler s-expressions.

For example, I'd also like to see s-expression version of HTML with some macro support.
Title: Re: S-Expression Query Language
Post by: infurl on April 12, 2018, 11:02:56 pm
Your efforts to improve on the current technology are certainly to be applauded. While I'm trying to learn as much as I can from the principles of resource description framework (RDF) I'm not actually using it either. Like you I am very much favouring symbolic expressions over the rather awkward universal resource identifier (URI) syntax of RDF.

The next level up from RDF triples is first order logic (FOL) which can also be used to simulate higher order logic (HOL) to avoid the intractability of the latter, making it capable of expressing any kind of knowledge. Practical applications of this include knowledge interchange format (KIF) and even better, SUO-KIF which comes with a fairly comprehensive ontology in the form of the suggested upper merged ontology (SUMO) which is mature and in active development.

Have you devoted much thought to the use of S-expressions for building ontologies or do you have something else in mind for them? (If you want HTML with macro support then you should be looking at XHTML and XSLT which is how the web should be implemented. Also W3C standards.)
Title: Re: S-Expression Query Language
Post by: ivan.moony on April 12, 2018, 11:33:46 pm
Quote
Have you devoted much thought to the use of S-expressions for building ontologies or do you have something else in mind for them?

Actually, I'm building a language in which any other language (programming, DSL, scientific, natural) could be syntactically and semantically described. It is a knowledge base theory language. For a reference, throw a look to the left of this post, to click on the blue-green globe. That is a link to my year-and-a-half old specification of such a language. Basically, it is a lambda calculus packaged in a structured manner, capable of what I stated. It caught a nice critics on lambda-the-ultimate blogging site, but people there know much about computational theory, so I didn't have to explain much to them. Probably, on some other site I wouldn't get away with a material from the link because it is not thoroughly shaken over examples.

However, I didn't implement the language back then, and I sustained to search further (god knows why), so I ended up in a s-expression query system a few months ago, as a better version of knowledge representation theory. After it got over the child diseases, now I'm eager to explain it in a paper before stepping into coding, just to be sure I didn't leave something out.

Who knows, maybe after this I'll sustain to seek further, but honestly, I hope to code in this version because my investigation already took a sick amount of time. It is time for me to actually do something, instead of just thinking about it.
Title: Re: S-Expression Query Language
Post by: infurl on April 13, 2018, 07:47:03 am
Actually, I'm building a language in which any other language (programming, DSL, scientific, natural) could be syntactically and semantically described. It is a knowledge base theory language. For a reference, throw a look to the left of this post, to click on the blue-green globe. That is a link to my year-and-a-half old specification of such a language.

Wow. So I spent a fair portion of the day reading and rereading your paper and I can absolutely assure you that you are on the right track. You still have a way to go though, so I hope you persevere and continue.

I know this because I followed the same path that you are taking and four years ago I completed a system which does everything that you describe and more. I was able to refine my language considerably compared to yours and it has a much cleaner and easier to use syntax, but it does everything that you describe and more. My system scales up to handle millions of rules which I think is essential for natural language processing. It compiles the rules in sections which are saved and then linked together to save time. I've spent the time since I paused development of it collecting and preparing knowledge bases for it to use.

Once you start implementing your language you will start to have insights which will help you improve it too.

Reading about Typed Feature Structures might help you get there sooner.

https://en.wikipedia.org/wiki/Feature_structure

https://www.amazon.com/Logic-Typed-Feature-Structures-Applications/dp/0521022541

You're doing brilliant work Ivan, please keep it up.
Title: Re: S-Expression Query Language
Post by: Zero on June 06, 2018, 10:33:22 am
Hi,

Are you still working on this ivan?

Looking for the simplest way to organize discrete data, I thought yesterday that cons cells are really the lowest level one could reach: conceptually, a memory cell holding two pointers, so it's like a digraph where vertices have always 2 edges. What I'd like to make is an algorithm that finds the best way to compress a network of cons cells, so that it is expressed by another (smaller) network of cons cells. Is it related to your work?

S-expressions are underrated these days. More complex formats took a place that could be filled by simpler s-expressions.

For example, I'd also like to see s-expression version of HTML with some macro support.
I agree. About HTML in S-expression, there's SEML (http://loganbraga.github.io/seml/) (appending classes and ids to the tag names feels a bit like cheating to me though).
Title: Re: S-Expression Query Language
Post by: ivan.moony on June 06, 2018, 10:54:13 am
Hi,

Are you still working on this ivan?

Looking for the simplest way to organize discrete data, I thought yesterday that cons cells are really the lowest level one could reach: conceptually, a memory cell holding two pointers, so it's like a digraph where vertices have always 2 edges. What I'd like to make is an algorithm that finds the best way to compress a network of cons cells, so that it is expressed by another (smaller) network of cons cells. Is it related to your work?

Hi, it's been a long time... Hope everything is ok.  :-\

Yes, I'm on it these days. I still have to finish and document the specification.

I don't understand what compression is there to make. Do you mean something like reusing duplicate elements?

However, I'm counting I'll get to a level where I would be able to make inferences by induction, like:
Code
(
    (1 . 2 . 3) &
    (2 . 2 . 4) &
    (1 . 4 . 5) &
    (3 . 4 . 7) &
    ...
) => (a . b . (a + b))
Title: Re: S-Expression Query Language
Post by: LOCKSUIT on June 06, 2018, 11:32:09 am
Wait a minute here lol :) ... Is this project of yours ivan all about:

x does b
g does z
....therefore h is w !

"discovery forming" ? And, what else is it all about? If you can list a 2nd thing, that'd be big, besides discovery forming being 1st.
Title: Re: S-Expression Query Language
Post by: ivan.moony on June 06, 2018, 12:01:10 pm
Wait a minute here lol :) ... Is this project of yours ivan all about:

x does b
g does z
....therefore h is w !

"discovery forming" ? And, what else is it all about? If you can list a 2nd thing, that'd be big, besides discovery forming being 1st.

Lock, I'm building a functional programming language. Functional programming languages have a nice property of representing term rewriting systems (https://en.wikipedia.org/wiki/Rewriting). Term rewriting systems, in turn can describe conclusions in a form of deduction, abduction and induction (as thinking processes). Intention of this programming language is mainly supporting automated thinking processes.

A field I'm particularly interested to support is science. I hope to connect all the sciences by unified theory description (programming) language. I would need to build a crowdsourced site for this intention because I need scientists to enter their theories into my language. I hope for providing new automated conclusions when enough science fields are connected by the language.

I know it is a long shot, but I'll try. I have an idea of helping scholars and students solving their everyday school tasks. When they grow up, some of them would become scientists that I need to populate all the wonderful data on my (or even third party distributed) site.
Title: Re: S-Expression Query Language
Post by: spydaz on June 06, 2018, 12:20:34 pm
Wait a minute here lol :) ... Is this project of yours ivan all about:

x does b
g does z
....therefore h is w !

"discovery forming" ? And, what else is it all about? If you can list a 2nd thing, that'd be big, besides discovery forming being 1st.

Lock, I'm building a functional programming language. Functional programming languages have a nice property of representing term rewriting systems (https://en.wikipedia.org/wiki/Rewriting). Term rewriting systems, in turn can describe conclusions in a form of deduction, abduction and induction (as thinking processes). Intention of this programming language is mainly supporting automated thinking processes.

A field I'm particularly interested to support is science. I hope to connect all the sciences by unified theory description (programming) language. I would need to build a crowdsourced site for this intention because I need scientists to enter their theories into my language. I hope for providing new automated conclusions when enough science fields are connected by the language.

I know it is a long shot, but I'll try. I have an idea of helping scholars and students solving their everyday school tasks. When they grow up, some of them would become scientists that I need to populate all the wonderful data on my (or even third party distributed) site.

To me it seems as though the programming technology is going backwards... (maybe people are just catching up).... IT seems like the repel Environment is the way to go!
Title: Re: S-Expression Query Language
Post by: ivan.moony on June 06, 2018, 12:41:35 pm
To me it seems as though the programming technology is going backwards... (maybe people are just catching up).... IT seems like the repel Environment is the way to go!

I think that object oriented design gave a boost to imperative programming style, so everyone are using it nowdays. But I think that the future lays in declarative programming, such is functional paradigm. It is just that not much people invested their time in declarative paradigm improvement, so it is not as developed as imperative paradigm.
Title: Re: S-Expression Query Language
Post by: Zero on June 06, 2018, 01:17:52 pm
Hi, it's been a long time... Hope everything is ok.  :-\

Yes, I'm on it these days. I still have to finish and document the specification.

I don't understand what compression is there to make. Do you mean something like reusing duplicate elements?

However, I'm counting I'll get to a level where I would be able to make inferences by induction, like:
Code
(
    (1 . 2 . 3) &
    (2 . 2 . 4) &
    (1 . 4 . 5) &
    (3 . 4 . 7) &
    ...
) => (a . b . (a + b))


Yes everything's ok :) I hope you're fine.

Induction is nice. One expensive way to do it is calculate anything you could (any combination of operands and operators), and see where there's a match, but I bet you have a better idea in mind?

"Compression", so to speak, would encompass several things. I'll use the following syntax:
Code
address = car, cdr

Say you have:
Code
objectA =   null,    null
propA1 =    objectA, has
whatA1 =    propA1,  wheels
howmanyA1 = whatA1,  4
propA2 =    objectA, has
whatA2 =    propA2,  engine

objectB =   null,    null
propB1 =    objectB, has
whatB1 =    propB1,  wheels
howmanyB1 = whatB1,  4
propB2 =    objectB, has
whatB2 =    propB2,  engine
What it means is "objectA has 4 wheels and an engine". Well obviously, it can be compressed by introducing a new vocabulary "car", like this:
Code
objectA = null,    null
whatisA = objectA, car

objectB = null,    null
whatisB = objectB, car
This one was easy because there's no variant part in the original message. Using "car" is enough to represent the whole network, with the 4 wheels and the engine.

Things get more interesting when we want to compress messages with variant parts.
Code
objectA =   null,    null
propA1 =    objectA, has
whatA1 =    propA1,  wheels
howmanyA1 = whatA1,  4
propA2 =    objectA, has
whatA2 =    propA2,  engine

objectC =   null,    null
propC1 =    objectC, has
whatC1 =    propC1,  wheels
howmanyC1 = whatC1,  2
propC2 =    objectC, has
whatC2 =    propC2,  engine
Almost the same, objectC just have 2 wheels instead of 4. The global structure remains similar, so here we have two objects with a lot of things in common, and a little difference. It can be (lossless) compressed like this:
Code
objectA  = null,    null
whatisA  = objectA, vehicle
nwheelsA = objectA, 4

objectC  = null,    null
whatisC  = objectC, vehicle
nwheelsC = objectC, 2

I think it's related to induction indeed.
I'd like not to bruteforce it.

Title: Re: S-Expression Query Language
Post by: ivan.moony on June 06, 2018, 01:38:32 pm
Quote
I'd like not to bruteforce it.

maybe https://en.wikipedia.org/wiki/Genetic_algorithm (https://en.wikipedia.org/wiki/Genetic_algorithm)?
Title: Re: S-Expression Query Language
Post by: Zero on June 06, 2018, 02:41:05 pm
Interesting spark, thanks!

So it would be like... I take a few vertices and edges away (randomly chosen), replace them by a few new ones, temporarily declaring "this means that", then I try to compress data with my brand new mutant compressor, and my fit-function is whether or not... mmm it's not clear yet in my head, I have to think more. Nice idea.

Ed: Something tells me there's a more direct approach to this.

Ed: Maybe seeing this as a binary tree rather than as a digraph would be more productive, I don't know.
Title: Re: S-Expression Query Language
Post by: LOCKSUIT on June 06, 2018, 05:11:03 pm
You need to do heuristics. Tweak your BEST objects. And the way you tweak them is your BEST guess/tweak.
Title: Re: S-Expression Query Language
Post by: Zero on June 06, 2018, 10:11:01 pm
I didn't understand, LOCKSUIT.

Can someone understand this (https://arxiv.org/pdf/1304.7392.pdf)?
Title: Re: S-Expression Query Language
Post by: spydaz on June 06, 2018, 11:47:28 pm
I didn't understand, LOCKSUIT.

Can someone understand this (https://arxiv.org/pdf/1304.7392.pdf)?

I have read a similar paper (for DNA Genome Encoding and Searching) its the same technique ....) They Create trees First (try trees) then reduce them with compression algorithms... by Combining pathways, and reducing the Pathways.... then applying Referencing to the nodes..essentially looking up the required node rather than Parsing the tree..... the tree Stores the locations therefore the tree becomes compressed. Less nodes... Yet each combined end leaf node, which may have pointers to lower end nodes which contain the previous end node... (node are considered to be end nodes although having sub-nodes) ...Combined Prefixes to the final end nodes.... it seems very complex in construction terms as first a optimised tree needs to be created, then optimised... then Locations applied.... by combining locations which point to sub locations to complete a Suffix or "piece of data"....

I have recently been playing with tree/tries/binary trees.... and am currently meditating on the same compression methods.... it the look up process where i'm trying to get straight....the tree reduction process depends on the data being stored and how your storing it in the tree... so that's tailored to your own project.... Videos on suffix tries and suffix arrays .... is helping me along.... i also keep getting sidetracked with understanding the Lambda functions in lisp ... and how it might be useful for me....i like the idea of being able to rewrite functions with the lambda function....

that paper would take me a few days to read and understand....
Title: Re: Binary Structure Calculus
Post by: ranch vermin on June 07, 2018, 05:05:03 am
I think I just solved the NP problem..........I instantly realized the answer to a NP question on the wiki page in polynomial time. I'm NOT telling yous how just yet haha! That was fast!                                                   ?

It said above it:
There are many important NP problems that people don't know how to solve in a way that is faster than testing every possible answer. Here are some examples:

EDIT: This is the easiest thing everrrrrrrrrrrrrrrr

Sorry I just joined this thread,  this one is an old one from locksuit.   

Locksuit,  you dont even know what I think about transforms and equations!!!!  I think its definitely possible to solve "non polynomial" functions,  but all inputs must be read at least once and no data can be concocted from nothing, with an added cost to your system, and u havent defied logical reality,  but NP problems are solvable IN P time, making them not NP really.   But u have to realize the specifics of your problem better.

Why do I think this?  Because the public key encryption is cracked by an ordinary method that runs on an ordinary computer NOW.  (if u could call it ordinary.)  All this quantum mechanics stuff is just a big smoke screen and u dont even need it.   So get on working out *decent optimizations* but dont flip out when you work one out.

That Yolo,  look only once, method for computer vision is a leading contender for *optimizing* classification of images.   once somethings optimized, unless youve got a whole lot of crapper optimizations to compare it to you just take the function for granted, as if it always was that fast to operate. 
How much work was circumvented becomes from then on expected.

Comparing the naive approach, to the optimized approach is a big difference is it not, sometimes. But its just the "better way" its not quantum computing,  but it tends to be alot faster.
Title: Re: S-Expression Query Language
Post by: Zero on June 07, 2018, 07:41:34 am
Are you aware of this paper (http://www.vldb.org/pvldb/1/1453965.pdf)? Basically it's a space/time tradeoff technique you might like to use in your project ivan. There's also an implementation (http://crubier.github.io/Hexastore/).

Also, is there a relation between your project and minikanren (http://minikanren.org/)?
Title: Re: S-Expression Query Language
Post by: LOCKSUIT on June 07, 2018, 09:24:38 am
@ranch, you have to brute force a password no heuristics. Only hints can become heuristics ex. the password is the name of a cat.

Trying a 0-8 digit password is already a heuristic, you know jumping on a trampoline or shooting Mars 67 times is not the answer!
Title: Re: S-Expression Query Language
Post by: Zero on June 07, 2018, 09:50:44 am
I didn't understand, LOCKSUIT.

Can someone understand this (https://arxiv.org/pdf/1304.7392.pdf)?

I have read a similar paper (for DNA Genome Encoding and Searching) its the same technique ....) They Create trees First (try trees) then reduce them with compression algorithms... by Combining pathways, and reducing the Pathways.... then applying Referencing to the nodes..essentially looking up the required node rather than Parsing the tree..... the tree Stores the locations therefore the tree becomes compressed. Less nodes... Yet each combined end leaf node, which may have pointers to lower end nodes which contain the previous end node... (node are considered to be end nodes although having sub-nodes) ...Combined Prefixes to the final end nodes.... it seems very complex in construction terms as first a optimised tree needs to be created, then optimised... then Locations applied.... by combining locations which point to sub locations to complete a Suffix or "piece of data"....

I have recently been playing with tree/tries/binary trees.... and am currently meditating on the same compression methods.... it the look up process where i'm trying to get straight....the tree reduction process depends on the data being stored and how your storing it in the tree... so that's tailored to your own project.... Videos on suffix tries and suffix arrays .... is helping me along.... i also keep getting sidetracked with understanding the Lambda functions in lisp ... and how it might be useful for me....i like the idea of being able to rewrite functions with the lambda function....

that paper would take me a few days to read and understand....

If I understood correctly this paper is about compressing a binary tree into an array of bits, which is not what I want. I think I'll just sit down in front of my notepad and spit out a few js functions, as usual, to see where it leads.

Actually, what I want is a bit like pattern learning, the way you'd  do it with NNs, except I want it on discrete data. Once trained, the machine could shrink a huge list of related cons cells into a smaller one, and then answer questions about it a lot faster (if you know it's a car, then it has 4 wheels, you don't have to check, you already know it). It could also fire an appropriate action response, if you want. This is all about creating a higher level representation of a situation.
Title: Re: S-Expression Query Language
Post by: ivan.moony on June 07, 2018, 10:12:46 am
Are you aware of this paper (http://www.vldb.org/pvldb/1/1453965.pdf)? Basically it's a space/time tradeoff technique you might like to use in your project ivan. There's also an implementation (http://crubier.github.io/Hexastore/).

Thanks for the reference, very nice idea there. I plan to use only pairs, but I might sort them in a similar way from that paper. That would boost up compilation process. Great stuff there, thanks :)

Also, is there a relation between your project and minikanren (http://minikanren.org/)?

No relation other than being a s-expression based language. Syntax is different, and I use some other primitive operators: a dot and a quotation for forming s-expressions, and ? or ! for querying them.
Title: Re: S-Expression Query Language
Post by: Zero on June 07, 2018, 11:59:21 am
You're welcome.

About minikanren, I thought there was a link, because db querying and logic programming are often "neighbours" conceptually.

I like what you're doing here, if there's anything I can do to help, don't hesitate.
Title: Re: S-Expression Query Language
Post by: ivan.moony on June 07, 2018, 12:11:32 pm
I like what you're doing here, if there's anything I can do to help, don't hesitate.

Thanks for the offer. Right now, I'm still writing the specification. Maybe in some later phase I might take that offer seriously.

There is a long way to go, and I guess this is a life span plan for me. Well, one thing at a time would hopefully get me somewhere.
Title: Re: S-Expression Query Language
Post by: ivan.moony on July 27, 2018, 10:16:12 am
I've been busy lately finishing a draft about Sequela. When I came to the part about describing logic examples, I realized that all I wrote is about logic and predicates, just as they said loud and clear in Curry-Howard correspondence (https://en.wikipedia.org/wiki/Curry%E2%80%93Howard_correspondence). Finally I decided to abandon the draft in a favor of logic. But I didn't go through all this trouble for nothing. You see, logic is a very messy place, starting with all the transformations including disjunctive normal form, and that makes logic code observations difficult. However, if we follow some patterns, it becomes easy to predict how the code behaves, and that is what I got from this journey - some practical patterns we can use to tame the beast, just to make general computation predictable. I don't know if I'm going to make a paper about this before I actually make a Javascript implementation, but when I finally do it, I think it will have an effect like "What?!! We were looking at this all the time, and a solution was right under our nose, but we didn't see it!"

This is almost finished Sequela paper (https://github.com/ivanvod/Sequela/blob/master/sequela.md) I'm abandoning. You might want to take a look, but it is past already. I'm making a switch to almost pure classical logic.
Title: Re: S-Expression Query Language
Post by: Zero on July 27, 2018, 03:34:23 pm
What logic often lacks is temporality. Things seem to exist in a land where there's no notion of time. A logic programming paradigm that would take transformation into account would be really nice.

One way or another, you're still climbing the same mountain...  :)
Title: Re: S-Expression Query Language
Post by: ivan.moony on July 27, 2018, 04:40:06 pm
What logic often lacks is temporality. Things seem to exist in a land where there's no notion of time. A logic programming paradigm that would take transformation into account would be really nice.

I concluded the same thing about logic. There is no order in logic operators, they all seem to live in the same medium without a notion of time, finally resulting with only one true or false. But escape might be in something like functions (predicates are functions with Boolean result), especially like recursive ones. Function parameters may be used to represent sequences of data where it matters what comes before and what after.

But I'm not that much into classical predicates. I'm laying my bets in free concatenations of logical expressions that form sequences of data, while each sequence element is being under influence of all logical formulas in the same scope of reach. These concatenations would replace predicates and functions.