Ai Dreams Forum

Member's Experiments & Projects => General Project Discussion => Topic started by: ivan.moony on June 24, 2019, 12:10:44 PM

Title: Logos formal language specification
Post by: ivan.moony on June 24, 2019, 12:10:44 PM
I've been working on a formal language specification for a while, and it finally took a shape I'm satisfied with. If you like, you can take a look at Logos specification in the link below (some twenty minutes read). Logos stands for a (l)anguage (o)f (g)eneral (o)perational (s)emantics. The language represents all of the following:

It reminds of a Lisp (lisp is a usual choice for AI development), and brings some extension on s-expressions (https://en.wikipedia.org/wiki/S-expression). Logos has completely flexible syntax, ready to host *any* theory language, from logic, to lambda calculus, to different embodiments of industry programming languages.

Its syntax is very simple, but it represents a Turing complete (https://en.wikipedia.org/wiki/Turing_completeness) language:

Code: [Select]
a-expr ::= ()
         | identifier
         | a-expr a-expr
         | ‹a-expr›
         | «a-expr»
         | (a-expr)

Some of implementation is already done in a form of context free grammar (https://en.wikipedia.org/wiki/Context-free_grammar) parser. Further development has something to do with Turing completeness of unrestricted grammar from Chomsky hierarchy (https://en.wikipedia.org/wiki/Chomsky_hierarchy), which is an extension of context free grammar. Logos should be a form of a higher order unrestricted grammar metalanguage.

If you are into symbolic AI, Logos could be a place to start with to collect some useful info about knowledge mining. It is aimed to be a language for manipulating formal knowledge.

Read about the project here (https://github.com/ivanvodisek/Logos).
Title: Re: Logos formal language specification
Post by: Zero on June 24, 2019, 01:31:56 PM
Congratulations.  O0

Code: [Select]

«(a ‹⋅› b) ‹+› (a ‹⋅› c)»

(higher (a (lower ⋅) b) (lower +) (a (lower ⋅) b) )


Why did you choose to extend the S-expression syntax?

Also, another question: are parenthesis impacted by the « » and ‹ › ? or identifiers are the only things impacted? For example,
Code: [Select]
«(f ‹[› x ‹:=› «x» ‹]›) ‹->› f»
Here square brackets are part of the expression, clearly: they are "constantified"  ::)
But aren't the outer « » enough to group the left-hand side?

Sorry, I swear I'm trying real hard to get my head around it all...
Title: Re: Logos formal language specification
Post by: ivan.moony on June 24, 2019, 01:57:35 PM
Thank you, Zero for a kind word :)

Code: [Select]

«(a ‹⋅› b) ‹+› (a ‹⋅› c)»

(higher (a (lower ⋅) b) (lower +) (a (lower ⋅) b) )


actually it is:
Code: [Select]

«(a ‹⋅› b) ‹+› (a ‹⋅› c)»

higher((a (lower ⋅) b) (lower +) (a (lower ⋅) b) )


Why did you choose to extend the S-expression syntax?

To introduce a clear distinction between variables and constants. And to relate (as an implication) constants and variables denoted by the same symbol. Note that there are no keywords. Only parenthesis and single or double angle quotes.

Also, another question: are parenthesis impacted by the « » and ‹ › ? or identifiers are the only things impacted? For example,

Parenthesis and double angle quotes can be nested, but within nests they have to be both opened and closed. It is not possible to have  `« ... ( ... » ... )`, like it is not possible to have ( ... « ... ) ». The same goes with all combinations of single and double angle quotes and round parenthesis.

 
Code: [Select]
«(f ‹[› x ‹:=› «x» ‹]›) ‹->› f»

Here square brackets are part of the expression, clearly: they are "constantified"  ::)
But aren't the outer « » enough to group the left-hand side?

The purpose of outer double angle quotes is to connect the left `f` and the right `f`. `‹->›` in between (the operator is defined earlier in the specification) allows us to automatically rewrite the left side with the right side in the context of the expression.
Title: Re: Logos formal language specification
Post by: Zero on June 24, 2019, 02:47:51 PM
Code: [Select]
higher((a (lower ⋅) b) (lower +) (a (lower ⋅) b) )
Weird, it feels like jumping from (f x) notation to f(x) notation. I don't get it.

Quote
And to relate (as an implication) constants and variables denoted by the same symbol.

z and «z» are related because the identifier is the same, am I correct?
Title: Re: Logos formal language specification
Post by: ivan.moony on June 24, 2019, 03:05:03 PM
z and «z» are related because the identifier is the same, am I correct?

yes  ::)
Title: Re: Logos formal language specification
Post by: LOCKSUIT on June 24, 2019, 11:21:10 PM
Is the idea to make many languages speak/translate to the same thing? Like hello & ko-ni-chi-wa = bonjour ?

It appears as if, like Zero's, you use a Tree that builds bigger parts,

But to truly translate languages, you need to master Context. It's not always as simple as hello=bonjour.

I see you say, in replace of context, we can use truth proving to clarify hello=bonjour. Like the frequencies of things that imply/etc. However it is the same thing, using data (context) to show what is what.

?

If we have:
"can you stick this over here"
stick doesn't mean branch, but put
Title: Re: Logos formal language specification
Post by: ivan.moony on June 25, 2019, 08:05:09 AM
Logos represents merely a translator from whatever to whatever. That's a definition of a term rewriting system. You can imagine translating natural language commands to sequences that output electricity of proper strength at proper wires, needed to move eyes, head, limbs, ... Moreover, if a logic is involved, we can detect contradictions (usually derivations of a form of `A /\ ~ A`) indicating what we translate is a falsehood / lie.
Title: Re: Logos formal language specification
Post by: goaty on June 25, 2019, 09:47:00 AM
logo is a cool name,  trademark it!  :D

.
Title: Re: Logos formal language specification
Post by: ivan.moony on June 25, 2019, 01:08:53 PM
https://en.wikipedia.org/wiki/Logo_(programming_language) (https://en.wikipedia.org/wiki/Logo_(programming_language))
Title: Re: Logos formal language specification
Post by: Zero on June 25, 2019, 09:26:59 PM
Remaking Logo in Logos would be cool. I love Logo.
Title: Re: Logos formal language specification
Post by: Zero on June 27, 2019, 09:38:00 AM
Thank you, Zero for a kind word :)

Code: [Select]

«(a ‹⋅› b) ‹+› (a ‹⋅› c)»

(higher (a (lower ⋅) b) (lower +) (a (lower ⋅) b) )


actually it is:
Code: [Select]

«(a ‹⋅› b) ‹+› (a ‹⋅› c)»

higher((a (lower ⋅) b) (lower +) (a (lower ⋅) b) )


Sorry Ivan, can we go over this again please, I didn't understand. I'm interesting in the potential s-expression translation one could make of an a-expression. Why is "higher" outside of parens?
Title: Re: Logos formal language specification
Post by: ivan.moony on June 27, 2019, 10:23:26 AM
We introduced `higher` and `lower` keywords to demistify double and single angle quotes (these keywords are not included in the language by default). I assume these keywords are of the form

Code: [Select]
higher (...)
lower (...)

so the expressions inside braces don't get polluted by our new keywords. This example should represent the following (respectively):

Code: [Select]
«...»
‹...›

braces after our new keywords may be left out if expression inside them stands for a single identifier.
Title: Re: Logos formal language specification
Post by: Zero on June 27, 2019, 10:37:12 AM
I get it, thx.

Then how would you represent a-expressions in s-expressions?
Title: Re: Logos formal language specification
Post by: ivan.moony on June 27, 2019, 11:19:20 AM
Then how would you represent a-expressions in s-expressions?

Exactly how you proposed.

[edit]
What's more interesting is internal representation of atoms. By the definition, it is based on implication and a negation, and those two are functionally complete (https://en.wikipedia.org/wiki/Functional_completeness) combination. To draw a parallel, implicational logic (https://en.wikipedia.org/wiki/Implicational_propositional_calculus) is based only on these two.